Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2004-09-12 07:47:57 +0400
committerChristopher Faylor <me@cgf.cx>2004-09-12 07:47:57 +0400
commitd584454c8231f5811136b1ab88defe6e5ca81923 (patch)
tree895b902952e3c3d4e329703af6ccc29275b9fec5 /winsup/cygwin/pipe.cc
parentca5ec6685a79620c1e24d2ca19081ee4f432b316 (diff)
* exceptions.cc: (ctrl_c_handler): Do nothing while a Cygwin subprocess is
starting. * child_info.h (init_child_info): Remove pid argument from declaration. * cygheap.h (init_cygheap::pid): New element. * dcrt0.cc (dll_crt0_0): Eliminate handling of now-noexistent cygpid parameter in child_info struct. Set forkee to 'true' rather than cygpid since the pid value was never used. (dll_crt0_1): Ditto. (_dll_crt0): Ditto. * fork.cc (fork_child): Don't wait for sigthread. This is handled in the fork call now. (fork_parent): Remove obsolete pid argument from init_child_info call. Don't do anything special with cygpid when DEBUGGING. (fork): Delay all signals during fork. (fork_init): Don't do anything special when DEBUGGING. * pinfo.cc (set_myself): Remove pid parameter. Use new pid field in cygheap. (pinfo_init): Don't pass pid argument to set_myself. * sigproc.cc (sig_send): Wait for dwProcessId to be non-zero as well as sendsig. (init_child_info): Eliminate handling of pid. (wait_sig): Implement method to temporarily hold off sending signals. * sigproc.h (__SIGHOLD): New enum. (__SIGNOHOLD): Ditto. * spawn.cc (spawn_guts): Remove obsolete pid argument from init_child_info call.
Diffstat (limited to 'winsup/cygwin/pipe.cc')
-rw-r--r--winsup/cygwin/pipe.cc114
1 files changed, 57 insertions, 57 deletions
diff --git a/winsup/cygwin/pipe.cc b/winsup/cygwin/pipe.cc
index aff3dd156..a55645eb7 100644
--- a/winsup/cygwin/pipe.cc
+++ b/winsup/cygwin/pipe.cc
@@ -223,9 +223,9 @@ leave:
unlike CreatePipe, which returns a bool for success or failure. */
static int
create_selectable_pipe (PHANDLE read_pipe_ptr,
- PHANDLE write_pipe_ptr,
- LPSECURITY_ATTRIBUTES sa_ptr,
- DWORD psize)
+ PHANDLE write_pipe_ptr,
+ LPSECURITY_ATTRIBUTES sa_ptr,
+ DWORD psize)
{
/* Default to error. */
*read_pipe_ptr = *write_pipe_ptr = INVALID_HANDLE_VALUE;
@@ -251,62 +251,62 @@ create_selectable_pipe (PHANDLE read_pipe_ptr,
debug_printf ("CreateNamedPipe: name %s, size %lu", pipename, psize);
/* Use CreateNamedPipe instead of CreatePipe, because the latter
- returns a write handle that does not permit FILE_READ_ATTRIBUTES
- access, on versions of win32 earlier than WinXP SP2.
- CreatePipe also stupidly creates a full duplex pipe, which is
- a waste, since only a single direction is actually used.
- It's important to only allow a single instance, to ensure that
- the pipe was not created earlier by some other process, even if
- the pid has been reused. We avoid FILE_FLAG_FIRST_PIPE_INSTANCE
- because that is only available for Win2k SP2 and WinXP. */
+ returns a write handle that does not permit FILE_READ_ATTRIBUTES
+ access, on versions of win32 earlier than WinXP SP2.
+ CreatePipe also stupidly creates a full duplex pipe, which is
+ a waste, since only a single direction is actually used.
+ It's important to only allow a single instance, to ensure that
+ the pipe was not created earlier by some other process, even if
+ the pid has been reused. We avoid FILE_FLAG_FIRST_PIPE_INSTANCE
+ because that is only available for Win2k SP2 and WinXP. */
SetLastError (0);
read_pipe = CreateNamedPipe (pipename,
- PIPE_ACCESS_INBOUND,
- PIPE_TYPE_BYTE | PIPE_READMODE_BYTE,
- 1, /* max instances */
- psize, /* output buffer size */
- psize, /* input buffer size */
- NMPWAIT_USE_DEFAULT_WAIT,
- sa_ptr);
+ PIPE_ACCESS_INBOUND,
+ PIPE_TYPE_BYTE | PIPE_READMODE_BYTE,
+ 1, /* max instances */
+ psize, /* output buffer size */
+ psize, /* input buffer size */
+ NMPWAIT_USE_DEFAULT_WAIT,
+ sa_ptr);
DWORD err = GetLastError ();
/* Win 95 seems to return NULL instead of INVALID_HANDLE_VALUE */
if ((read_pipe || !err) && read_pipe != INVALID_HANDLE_VALUE)
- {
- debug_printf ("pipe read handle %p", read_pipe);
- break;
- }
+ {
+ debug_printf ("pipe read handle %p", read_pipe);
+ break;
+ }
switch (err)
- {
- case ERROR_PIPE_BUSY:
- /* The pipe is already open with compatible parameters.
- Pick a new name and retry. */
- debug_printf ("pipe busy, retrying");
- continue;
- case ERROR_ACCESS_DENIED:
- /* The pipe is already open with incompatible parameters.
- Pick a new name and retry. */
- debug_printf ("pipe access denied, retrying");
- continue;
- case ERROR_CALL_NOT_IMPLEMENTED:
- /* We are on an older Win9x platform without named pipes.
- Return an anonymous pipe as the best approximation. */
- debug_printf ("CreateNamedPipe not implemented, resorting to "
- "CreatePipe size %lu", psize);
- if (CreatePipe (read_pipe_ptr, write_pipe_ptr, sa_ptr, psize))
- {
- debug_printf ("pipe read handle %p", *read_pipe_ptr);
- debug_printf ("pipe write handle %p", *write_pipe_ptr);
- return NO_ERROR;
- }
- err = GetLastError ();
- debug_printf ("CreatePipe failed, %E");
- return err;
- default:
- debug_printf ("CreateNamedPipe failed, %E");
- return err;
- }
+ {
+ case ERROR_PIPE_BUSY:
+ /* The pipe is already open with compatible parameters.
+ Pick a new name and retry. */
+ debug_printf ("pipe busy, retrying");
+ continue;
+ case ERROR_ACCESS_DENIED:
+ /* The pipe is already open with incompatible parameters.
+ Pick a new name and retry. */
+ debug_printf ("pipe access denied, retrying");
+ continue;
+ case ERROR_CALL_NOT_IMPLEMENTED:
+ /* We are on an older Win9x platform without named pipes.
+ Return an anonymous pipe as the best approximation. */
+ debug_printf ("CreateNamedPipe not implemented, resorting to "
+ "CreatePipe size %lu", psize);
+ if (CreatePipe (read_pipe_ptr, write_pipe_ptr, sa_ptr, psize))
+ {
+ debug_printf ("pipe read handle %p", *read_pipe_ptr);
+ debug_printf ("pipe write handle %p", *write_pipe_ptr);
+ return NO_ERROR;
+ }
+ err = GetLastError ();
+ debug_printf ("CreatePipe failed, %E");
+ return err;
+ default:
+ debug_printf ("CreateNamedPipe failed, %E");
+ return err;
+ }
/* NOTREACHED */
}
@@ -315,12 +315,12 @@ create_selectable_pipe (PHANDLE read_pipe_ptr,
/* Open the named pipe for writing.
Be sure to permit FILE_READ_ATTRIBUTES access. */
write_pipe = CreateFile (pipename,
- GENERIC_WRITE | FILE_READ_ATTRIBUTES,
- 0, /* share mode */
- sa_ptr,
- OPEN_EXISTING,
- 0, /* flags and attributes */
- 0); /* handle to template file */
+ GENERIC_WRITE | FILE_READ_ATTRIBUTES,
+ 0, /* share mode */
+ sa_ptr,
+ OPEN_EXISTING,
+ 0, /* flags and attributes */
+ 0); /* handle to template file */
if (write_pipe == INVALID_HANDLE_VALUE)
{