* fhandler.h (PIPE_ADD_PID): Define new flag.
* pipe.cc (fhandler_pipe::create): Don't indiscriminately add process id to every pipe since some pipe names (fifo, tty) don't need it. * sigproc.cc (sigproc_init): Pass PIPE_ADD_PID to fhandler_pipe::create to ensure that pid is always part of sigwait pipe name.
This commit is contained in:
parent
c9306c71ed
commit
28c8ae66d5
|
@ -1,6 +1,14 @@
|
||||||
|
2012-04-30 Christopher Faylor <me.cygwin2012@cgf.cx>
|
||||||
|
|
||||||
|
* fhandler.h (PIPE_ADD_PID): Define new flag.
|
||||||
|
* pipe.cc (fhandler_pipe::create): Don't indiscriminately add process
|
||||||
|
id to every pipe since some pipe names (fifo, tty) don't need it.
|
||||||
|
* sigproc.cc (sigproc_init): Pass PIPE_ADD_PID to fhandler_pipe::create
|
||||||
|
to ensure that pid is always part of sigwait pipe name.
|
||||||
|
|
||||||
2012-04-28 Christopher Faylor <me.cygwin2012@cgf.cx>
|
2012-04-28 Christopher Faylor <me.cygwin2012@cgf.cx>
|
||||||
|
|
||||||
* environ.cc (struct parse_thing): Add temporary (?) "pipe_byte" option.
|
* environ.cc (struct parse_thing): Add "pipe_byte" option.
|
||||||
* globals.cc (pipe_byte): Declare.
|
* globals.cc (pipe_byte): Declare.
|
||||||
* pipe.cc (fhandler_pipe::create): Use current process id in pipe name
|
* pipe.cc (fhandler_pipe::create): Use current process id in pipe name
|
||||||
rather than pid for simple name collision avoidance. Do this only once
|
rather than pid for simple name collision avoidance. Do this only once
|
||||||
|
|
|
@ -36,6 +36,10 @@ details. */
|
||||||
so small. http://cygwin.com/ml/cygwin/2011-03/msg00541.html */
|
so small. http://cygwin.com/ml/cygwin/2011-03/msg00541.html */
|
||||||
#define DEFAULT_PIPEBUFSIZE PREFERRED_IO_BLKSIZE
|
#define DEFAULT_PIPEBUFSIZE PREFERRED_IO_BLKSIZE
|
||||||
|
|
||||||
|
/* Used for fhandler_pipe::create. Use an available flag which will
|
||||||
|
never be used in Cygwin for this function. */
|
||||||
|
#define PIPE_ADD_PID PIPE_ACCESS_OUTBOUND
|
||||||
|
|
||||||
extern const char *windows_device_names[];
|
extern const char *windows_device_names[];
|
||||||
extern struct __cygwin_perfile *perfile_table;
|
extern struct __cygwin_perfile *perfile_table;
|
||||||
#define __fmode (*(user_data->fmode_ptr))
|
#define __fmode (*(user_data->fmode_ptr))
|
||||||
|
|
|
@ -211,9 +211,8 @@ fhandler_pipe::create (LPSECURITY_ATTRIBUTES sa_ptr, PHANDLE r, PHANDLE w,
|
||||||
psize = DEFAULT_PIPEBUFSIZE;
|
psize = DEFAULT_PIPEBUFSIZE;
|
||||||
|
|
||||||
char pipename[MAX_PATH];
|
char pipename[MAX_PATH];
|
||||||
const size_t len = __small_sprintf (pipename, PIPE_INTRO "%S-%u-",
|
size_t len = __small_sprintf (pipename, PIPE_INTRO "%S-",
|
||||||
&cygheap->installation_key,
|
&cygheap->installation_key);
|
||||||
GetCurrentProcessId ());
|
|
||||||
DWORD pipe_mode = PIPE_READMODE_BYTE;
|
DWORD pipe_mode = PIPE_READMODE_BYTE;
|
||||||
if (!name)
|
if (!name)
|
||||||
pipe_mode |= pipe_byte ? PIPE_TYPE_BYTE : PIPE_TYPE_MESSAGE;
|
pipe_mode |= pipe_byte ? PIPE_TYPE_BYTE : PIPE_TYPE_MESSAGE;
|
||||||
|
@ -223,6 +222,12 @@ fhandler_pipe::create (LPSECURITY_ATTRIBUTES sa_ptr, PHANDLE r, PHANDLE w,
|
||||||
pipe_mode |= PIPE_TYPE_MESSAGE;
|
pipe_mode |= PIPE_TYPE_MESSAGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!name || (open_mode &= PIPE_ADD_PID))
|
||||||
|
{
|
||||||
|
len += __small_sprintf (pipename + len, "%u-", GetCurrentProcessId ());
|
||||||
|
open_mode &= ~PIPE_ADD_PID;
|
||||||
|
}
|
||||||
|
|
||||||
open_mode |= PIPE_ACCESS_INBOUND;
|
open_mode |= PIPE_ACCESS_INBOUND;
|
||||||
|
|
||||||
/* Retry CreateNamedPipe as long as the pipe name is in use.
|
/* Retry CreateNamedPipe as long as the pipe name is in use.
|
||||||
|
|
|
@ -529,7 +529,8 @@ sigproc_init ()
|
||||||
char char_sa_buf[1024];
|
char char_sa_buf[1024];
|
||||||
PSECURITY_ATTRIBUTES sa = sec_user_nih ((PSECURITY_ATTRIBUTES) char_sa_buf, cygheap->user.sid());
|
PSECURITY_ATTRIBUTES sa = sec_user_nih ((PSECURITY_ATTRIBUTES) char_sa_buf, cygheap->user.sid());
|
||||||
DWORD err = fhandler_pipe::create (sa, &my_readsig, &my_sendsig,
|
DWORD err = fhandler_pipe::create (sa, &my_readsig, &my_sendsig,
|
||||||
sizeof (sigpacket), "sigwait", 0);
|
sizeof (sigpacket), "sigwait",
|
||||||
|
PIPE_ADD_PID);
|
||||||
if (err)
|
if (err)
|
||||||
{
|
{
|
||||||
SetLastError (err);
|
SetLastError (err);
|
||||||
|
|
Loading…
Reference in New Issue