mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-02-18 23:12:15 +08:00
* 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>
|
||||
|
||||
* environ.cc (struct parse_thing): Add temporary (?) "pipe_byte" option.
|
||||
* environ.cc (struct parse_thing): Add "pipe_byte" option.
|
||||
* globals.cc (pipe_byte): Declare.
|
||||
* pipe.cc (fhandler_pipe::create): Use current process id in pipe name
|
||||
rather than pid for simple name collision avoidance. Do this only once
|
||||
|
@ -14,8 +14,8 @@ details. */
|
||||
|
||||
#include "tty.h"
|
||||
/* fcntl flags used only internaly. */
|
||||
#define O_NOSYMLINK 0x080000
|
||||
#define O_DIROPEN 0x100000
|
||||
#define O_NOSYMLINK 0x080000
|
||||
#define O_DIROPEN 0x100000
|
||||
|
||||
/* newlib used to define O_NDELAY differently from O_NONBLOCK. Now it
|
||||
properly defines both to be the same. Unfortunately, we have to
|
||||
@ -36,6 +36,10 @@ details. */
|
||||
so small. http://cygwin.com/ml/cygwin/2011-03/msg00541.html */
|
||||
#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 struct __cygwin_perfile *perfile_table;
|
||||
#define __fmode (*(user_data->fmode_ptr))
|
||||
|
@ -211,9 +211,8 @@ fhandler_pipe::create (LPSECURITY_ATTRIBUTES sa_ptr, PHANDLE r, PHANDLE w,
|
||||
psize = DEFAULT_PIPEBUFSIZE;
|
||||
|
||||
char pipename[MAX_PATH];
|
||||
const size_t len = __small_sprintf (pipename, PIPE_INTRO "%S-%u-",
|
||||
&cygheap->installation_key,
|
||||
GetCurrentProcessId ());
|
||||
size_t len = __small_sprintf (pipename, PIPE_INTRO "%S-",
|
||||
&cygheap->installation_key);
|
||||
DWORD pipe_mode = PIPE_READMODE_BYTE;
|
||||
if (!name)
|
||||
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;
|
||||
}
|
||||
|
||||
if (!name || (open_mode &= PIPE_ADD_PID))
|
||||
{
|
||||
len += __small_sprintf (pipename + len, "%u-", GetCurrentProcessId ());
|
||||
open_mode &= ~PIPE_ADD_PID;
|
||||
}
|
||||
|
||||
open_mode |= PIPE_ACCESS_INBOUND;
|
||||
|
||||
/* Retry CreateNamedPipe as long as the pipe name is in use.
|
||||
|
@ -529,7 +529,8 @@ sigproc_init ()
|
||||
char char_sa_buf[1024];
|
||||
PSECURITY_ATTRIBUTES sa = sec_user_nih ((PSECURITY_ATTRIBUTES) char_sa_buf, cygheap->user.sid());
|
||||
DWORD err = fhandler_pipe::create (sa, &my_readsig, &my_sendsig,
|
||||
sizeof (sigpacket), "sigwait", 0);
|
||||
sizeof (sigpacket), "sigwait",
|
||||
PIPE_ADD_PID);
|
||||
if (err)
|
||||
{
|
||||
SetLastError (err);
|
||||
|
Loading…
x
Reference in New Issue
Block a user