* fhandler.cc (fhandler::dup): Duplicate flags, too.

* fhandler.h (fhandler_fifo::owner): Eliminate.
* fhandler_disk_file.cc (fhandler_base::fstat_fs): Handle on-disk devices
better.
(fhandler_base::fstat_helper): Ditto.
* fhandler_fifo.cc (fhandler_fifo::fhandler_fifo): Don't initialize obsolete
"owner".
(fhandler_fifo::open_not_mine): Add some debugging.  Duplicate correct handle
when we own it.
(fhandler_fifo::open): Set flags from input, not from first pipe.  Flag that
fork fixup is needed.
(fhandler_fifo::dup): Set errno correctly when DuplicateHandle fails.
* pinfo.cc (commune_send): Add debugging for fifo.
* cygwin/version.h: Bump API minor version to 127 to reflect exporting of
sigrelese.
This commit is contained in:
Christopher Faylor 2005-04-16 05:20:01 +00:00
parent f40d6122ff
commit 06e18175e0
5 changed files with 32 additions and 8 deletions

View File

@ -1,3 +1,22 @@
2005-04-16 Christopher Faylor <cgf@timesys.com>
* fhandler.cc (fhandler::dup): Duplicate flags, too.
* fhandler.h (fhandler_fifo::owner): Eliminate.
* fhandler_disk_file.cc (fhandler_base::fstat_fs): Handle on-disk
devices better.
(fhandler_base::fstat_helper): Ditto.
* fhandler_fifo.cc (fhandler_fifo::fhandler_fifo): Don't initialize
obsolete "owner".
(fhandler_fifo::open_not_mine): Add some debugging. Duplicate correct
handle when we own it.
(fhandler_fifo::open): Set flags from input, not from first pipe. Flag
that fork fixup is needed.
(fhandler_fifo::dup): Set errno correctly when DuplicateHandle fails.
* pinfo.cc (commune_send): Add debugging for fifo.
* cygwin/version.h: Bump API minor version to 127 to reflect exporting
of sigrelese.
2005-04-14 Kazuhiro Fujieda <fujieda@jaist.ac.jp> 2005-04-14 Kazuhiro Fujieda <fujieda@jaist.ac.jp>
* syscalls.cc (setuid32): Correct debugging output. * syscalls.cc (setuid32): Correct debugging output.

View File

@ -1284,6 +1284,7 @@ fhandler_base::dup (fhandler_base *child)
VerifyHandle (nh); VerifyHandle (nh);
child->set_io_handle (nh); child->set_io_handle (nh);
} }
set_flags (child->get_flags ());
return 0; return 0;
} }

View File

@ -1,6 +1,6 @@
/* fhandler_fifo.cc. See fhandler.h for a description of the fhandler classes. /* fhandler_fifo.cc - See fhandler.h for a description of the fhandler classes.
Copyright 2002, 2003, 2004 Red Hat, Inc. Copyright 2002, 2003, 2004, 2005 Red Hat, Inc.
This file is part of Cygwin. This file is part of Cygwin.
@ -23,7 +23,7 @@
#include "pinfo.h" #include "pinfo.h"
fhandler_fifo::fhandler_fifo () fhandler_fifo::fhandler_fifo ()
: fhandler_pipe (), output_handle (NULL), owner (NULL), : fhandler_pipe (), output_handle (NULL),
read_use (0), write_use (0) read_use (0), write_use (0)
{ {
} }
@ -85,6 +85,8 @@ fhandler_fifo::open_not_mine (int flags)
r = p->commune_send (PICOM_FIFO, get_win32_name ()); r = p->commune_send (PICOM_FIFO, get_win32_name ());
if (r.handles[0] == NULL) if (r.handles[0] == NULL)
continue; // process doesn't own fifo continue; // process doesn't own fifo
debug_printf ("pid %d, handles[0] %p, handles[1] %p", p->pid,
r.handles[0], r.handles[1]);
} }
else else
{ {
@ -162,6 +164,7 @@ fhandler_fifo::open (int flags, mode_t)
delete (fhs[0]); delete (fhs[0]);
delete (fhs[1]); delete (fhs[1]);
set_use (1); set_use (1);
need_fork_fixup (true);
} }
out: out:
@ -170,17 +173,17 @@ out:
} }
int int
fhandler_fifo::dup (fhandler_base * child) fhandler_fifo::dup (fhandler_base *child)
{ {
int res = fhandler_pipe::dup (child); int res = fhandler_pipe::dup (child);
if (!res) if (!res)
{ {
fhandler_fifo *ff = (fhandler_fifo *) child; fhandler_fifo *ff = (fhandler_fifo *) child;
if (!DuplicateHandle (hMainProc, get_output_handle (), hMainProc, if (!DuplicateHandle (hMainProc, get_output_handle (), hMainProc,
&ff->get_output_handle (), false, true, &ff->get_output_handle (), false, true,
DUPLICATE_SAME_ACCESS)) DUPLICATE_SAME_ACCESS))
{ {
__seterrno ();
child->close (); child->close ();
res = -1; res = -1;
} }

View File

@ -252,13 +252,14 @@ details. */
123: Export utmpxname. 123: Export utmpxname.
124: Add MAP_AUTOGROW flag to mmap. 124: Add MAP_AUTOGROW flag to mmap.
125: LD_PRELOAD/CW_HOOK available. 125: LD_PRELOAD/CW_HOOK available.
126: Add lsearch, lfind, timer_gettime. 126: Export lsearch, lfind, timer_gettime.
127: Export sigrelese.
*/ */
/* Note that we forgot to bump the api for ualarm, strtoll, strtoull */ /* Note that we forgot to bump the api for ualarm, strtoll, strtoull */
#define CYGWIN_VERSION_API_MAJOR 0 #define CYGWIN_VERSION_API_MAJOR 0
#define CYGWIN_VERSION_API_MINOR 126 #define CYGWIN_VERSION_API_MINOR 127
/* There is also a compatibity version number associated with the /* There is also a compatibity version number associated with the
shared memory regions. It is incremented when incompatible shared memory regions. It is incremented when incompatible

View File

@ -237,6 +237,7 @@ fhandler_pipe::fixup_after_exec ()
void void
fhandler_pipe::fixup_after_fork (HANDLE parent) fhandler_pipe::fixup_after_fork (HANDLE parent)
{ {
debug_printf ("here");
fhandler_base::fixup_after_fork (parent); fhandler_base::fixup_after_fork (parent);
if (guard) if (guard)
fork_fixup (parent, guard, "guard"); fork_fixup (parent, guard, "guard");
@ -259,7 +260,6 @@ fhandler_pipe::dup (fhandler_base *child)
goto err; goto err;
} }
/* FIXME: This leaks handles in the failing condition */
if (guard == NULL) if (guard == NULL)
ftp->guard = NULL; ftp->guard = NULL;
else if (!DuplicateHandle (hMainProc, guard, hMainProc, &ftp->guard, 0, 1, else if (!DuplicateHandle (hMainProc, guard, hMainProc, &ftp->guard, 0, 1,