mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-02-18 23:12:15 +08:00
* fhandler.h (fhandler_base::setup_overlapped): Delete virtual declaration.
(fhandler_base::destroy_overlapped): Ditto. (fhandler_base_overlapped): Remove now-unneeded friend. (fhandler_base_overlapped::setup_overlapped): Return int, remove parameter. (fhandler_base_overlapped::get_overlapped): Return reference. (fhandler_base_overlapped::fhandler_base_overlapped): Be more assertive about zeroing everything. (fhandler_base_overlapped::fixup_after_fork): Declare new function. (fhandler_base_overlapped::fixup_after_exec): Ditto. (fhandler_base_overlapped::dup): Ditto. (fhandler_base_overlapped::close): Ditto. * fhandler_fifo.cc (fhandler_fifo::dup): Call fhandler_base_overlapped::dup rather than fhandler_base::dup. * pipe.cc (fhandler_pipe::dup): Ditto. (fhandler_pipe::init): Accommodate change in setup_overlapped arguments for "opened_properly" case.
This commit is contained in:
parent
60efdd0c4c
commit
5151c80c8a
@ -1,3 +1,24 @@
|
|||||||
|
2010-04-02 Christopher Faylor <me+cygwin@cgf.cx>
|
||||||
|
|
||||||
|
* fhandler.h (fhandler_base::setup_overlapped): Delete virtual
|
||||||
|
declaration.
|
||||||
|
(fhandler_base::destroy_overlapped): Ditto.
|
||||||
|
(fhandler_base_overlapped): Remove now-unneeded friend.
|
||||||
|
(fhandler_base_overlapped::setup_overlapped): Return int, remove
|
||||||
|
parameter.
|
||||||
|
(fhandler_base_overlapped::get_overlapped): Return reference.
|
||||||
|
(fhandler_base_overlapped::fhandler_base_overlapped): Be more assertive
|
||||||
|
about zeroing everything.
|
||||||
|
(fhandler_base_overlapped::fixup_after_fork): Declare new function.
|
||||||
|
(fhandler_base_overlapped::fixup_after_exec): Ditto.
|
||||||
|
(fhandler_base_overlapped::dup): Ditto.
|
||||||
|
(fhandler_base_overlapped::close): Ditto.
|
||||||
|
* fhandler_fifo.cc (fhandler_fifo::dup): Call
|
||||||
|
fhandler_base_overlapped::dup rather than fhandler_base::dup.
|
||||||
|
* pipe.cc (fhandler_pipe::dup): Ditto.
|
||||||
|
(fhandler_pipe::init): Accommodate change in setup_overlapped arguments
|
||||||
|
for "opened_properly" case.
|
||||||
|
|
||||||
2010-04-02 Christopher Faylor <me+cygwin@cgf.cx>
|
2010-04-02 Christopher Faylor <me+cygwin@cgf.cx>
|
||||||
|
|
||||||
* fhandler_fifo.cc (fhandler_fifo::fhandler_fifo): Properly initialize
|
* fhandler_fifo.cc (fhandler_fifo::fhandler_fifo): Properly initialize
|
||||||
|
@ -1037,10 +1037,17 @@ fhandler_base::close ()
|
|||||||
|
|
||||||
__seterrno ();
|
__seterrno ();
|
||||||
}
|
}
|
||||||
destroy_overlapped ();
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
fhandler_base_overlapped::close ()
|
||||||
|
{
|
||||||
|
destroy_overlapped ();
|
||||||
|
return fhandler_base::close ();
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
fhandler_base::ioctl (unsigned int cmd, void *buf)
|
fhandler_base::ioctl (unsigned int cmd, void *buf)
|
||||||
{
|
{
|
||||||
@ -1162,10 +1169,17 @@ fhandler_base::dup (fhandler_base *child)
|
|||||||
VerifyHandle (nh);
|
VerifyHandle (nh);
|
||||||
child->set_io_handle (nh);
|
child->set_io_handle (nh);
|
||||||
}
|
}
|
||||||
child->setup_overlapped ();
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
fhandler_base_overlapped::dup (fhandler_base *child)
|
||||||
|
{
|
||||||
|
int res = fhandler_base::dup (child) ||
|
||||||
|
((fhandler_base_overlapped *) child)->setup_overlapped ();
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
int fhandler_base::fcntl (int cmd, void *arg)
|
int fhandler_base::fcntl (int cmd, void *arg)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
@ -1334,7 +1348,6 @@ fhandler_base::fork_fixup (HANDLE parent, HANDLE &h, const char *name)
|
|||||||
VerifyHandle (h);
|
VerifyHandle (h);
|
||||||
res = true;
|
res = true;
|
||||||
}
|
}
|
||||||
setup_overlapped ();
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1353,20 +1366,31 @@ fhandler_base::fixup_after_fork (HANDLE parent)
|
|||||||
debug_printf ("inheriting '%s' from parent", get_name ());
|
debug_printf ("inheriting '%s' from parent", get_name ());
|
||||||
if (!nohandle ())
|
if (!nohandle ())
|
||||||
fork_fixup (parent, io_handle, "io_handle");
|
fork_fixup (parent, io_handle, "io_handle");
|
||||||
setup_overlapped ();
|
|
||||||
/* POSIX locks are not inherited across fork. */
|
/* POSIX locks are not inherited across fork. */
|
||||||
if (unique_id)
|
if (unique_id)
|
||||||
del_my_locks (after_fork);
|
del_my_locks (after_fork);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
fhandler_base_overlapped::fixup_after_fork (HANDLE parent)
|
||||||
|
{
|
||||||
|
setup_overlapped ();
|
||||||
|
fhandler_base::fixup_after_fork (parent);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
fhandler_base::fixup_after_exec ()
|
fhandler_base::fixup_after_exec ()
|
||||||
{
|
{
|
||||||
debug_printf ("here for '%s'", get_name ());
|
debug_printf ("here for '%s'", get_name ());
|
||||||
setup_overlapped ();
|
|
||||||
if (unique_id && close_on_exec ())
|
if (unique_id && close_on_exec ())
|
||||||
del_my_locks (after_exec);
|
del_my_locks (after_exec);
|
||||||
}
|
}
|
||||||
|
void
|
||||||
|
fhandler_base_overlapped::fixup_after_exec ()
|
||||||
|
{
|
||||||
|
setup_overlapped ();
|
||||||
|
fhandler_base::fixup_after_exec ();
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
fhandler_base::is_nonblocking ()
|
fhandler_base::is_nonblocking ()
|
||||||
@ -1640,23 +1664,14 @@ fhandler_base::fpathconf (int v)
|
|||||||
|
|
||||||
/* Overlapped I/O */
|
/* Overlapped I/O */
|
||||||
|
|
||||||
bool
|
int
|
||||||
fhandler_base_overlapped::setup_overlapped (bool doit)
|
fhandler_base_overlapped::setup_overlapped ()
|
||||||
{
|
{
|
||||||
OVERLAPPED *ov = get_overlapped_buffer ();
|
OVERLAPPED *ov = get_overlapped_buffer ();
|
||||||
memset (ov, 0, sizeof (*ov));
|
memset (ov, 0, sizeof (*ov));
|
||||||
bool res;
|
set_overlapped (ov);
|
||||||
if (doit)
|
ov->hEvent = CreateEvent (&sec_none_nih, true, true, NULL);
|
||||||
{
|
return ov->hEvent ? 0 : -1;
|
||||||
set_overlapped (ov);
|
|
||||||
res = !!(ov->hEvent = CreateEvent (&sec_none_nih, true, true, NULL));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
set_overlapped (NULL);
|
|
||||||
res = false;
|
|
||||||
}
|
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1668,6 +1683,8 @@ fhandler_base_overlapped::destroy_overlapped ()
|
|||||||
CloseHandle (ov->hEvent);
|
CloseHandle (ov->hEvent);
|
||||||
ov->hEvent = NULL;
|
ov->hEvent = NULL;
|
||||||
}
|
}
|
||||||
|
io_pending = false;
|
||||||
|
get_overlapped () = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
@ -386,8 +386,6 @@ class fhandler_base
|
|||||||
bool issymlink () {return pc.issymlink ();}
|
bool issymlink () {return pc.issymlink ();}
|
||||||
bool device_access_denied (int) __attribute__ ((regparm (2)));
|
bool device_access_denied (int) __attribute__ ((regparm (2)));
|
||||||
int fhaccess (int flags, bool) __attribute__ ((regparm (3)));
|
int fhaccess (int flags, bool) __attribute__ ((regparm (3)));
|
||||||
virtual void destroy_overlapped () __attribute__ ((regparm (1))) {}
|
|
||||||
virtual bool setup_overlapped () {return false;}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class fhandler_mailslot : public fhandler_base
|
class fhandler_mailslot : public fhandler_base
|
||||||
@ -560,17 +558,24 @@ protected:
|
|||||||
OVERLAPPED *overlapped;
|
OVERLAPPED *overlapped;
|
||||||
public:
|
public:
|
||||||
int wait_overlapped (bool, bool, DWORD *, DWORD = 0) __attribute__ ((regparm (3)));
|
int wait_overlapped (bool, bool, DWORD *, DWORD = 0) __attribute__ ((regparm (3)));
|
||||||
bool setup_overlapped (bool doit = true) __attribute__ ((regparm (2)));
|
int setup_overlapped () __attribute__ ((regparm (1)));
|
||||||
void destroy_overlapped () __attribute__ ((regparm (1)));
|
void destroy_overlapped () __attribute__ ((regparm (1)));
|
||||||
void __stdcall read_overlapped (void *ptr, size_t& len) __attribute__ ((regparm (3)));
|
void __stdcall read_overlapped (void *ptr, size_t& len) __attribute__ ((regparm (3)));
|
||||||
ssize_t __stdcall write_overlapped (const void *ptr, size_t len);
|
ssize_t __stdcall write_overlapped (const void *ptr, size_t len);
|
||||||
OVERLAPPED *get_overlapped () {return overlapped;}
|
OVERLAPPED *&get_overlapped () {return overlapped;}
|
||||||
OVERLAPPED *get_overlapped_buffer () {return &io_status;}
|
OVERLAPPED *get_overlapped_buffer () {return &io_status;}
|
||||||
void set_overlapped (OVERLAPPED *ov) {overlapped = ov;}
|
void set_overlapped (OVERLAPPED *ov) {overlapped = ov;}
|
||||||
fhandler_base_overlapped (): io_pending (false), overlapped (NULL) {}
|
fhandler_base_overlapped (): io_pending (false), overlapped (NULL)
|
||||||
|
{
|
||||||
|
memset (&io_status, 0, sizeof io_status);
|
||||||
|
}
|
||||||
bool has_ongoing_io ();
|
bool has_ongoing_io ();
|
||||||
friend class select_pipe_info; /* FIXME: At least correct the naming
|
|
||||||
here */
|
void fixup_after_fork (HANDLE);
|
||||||
|
void fixup_after_exec ();
|
||||||
|
|
||||||
|
int close ();
|
||||||
|
int dup (fhandler_base *child);
|
||||||
};
|
};
|
||||||
|
|
||||||
class fhandler_pipe: public fhandler_base_overlapped
|
class fhandler_pipe: public fhandler_base_overlapped
|
||||||
|
@ -304,7 +304,7 @@ fhandler_fifo::close ()
|
|||||||
int
|
int
|
||||||
fhandler_fifo::dup (fhandler_base *child)
|
fhandler_fifo::dup (fhandler_base *child)
|
||||||
{
|
{
|
||||||
int res = fhandler_base::dup (child);
|
int res = fhandler_base_overlapped::dup (child);
|
||||||
fhandler_fifo *fifo_child = (fhandler_fifo *) child;
|
fhandler_fifo *fifo_child = (fhandler_fifo *) child;
|
||||||
if (res == 0 && dummy_client)
|
if (res == 0 && dummy_client)
|
||||||
{
|
{
|
||||||
|
@ -54,7 +54,10 @@ fhandler_pipe::init (HANDLE f, DWORD a, mode_t mode)
|
|||||||
a &= ~FILE_CREATE_PIPE_INSTANCE;
|
a &= ~FILE_CREATE_PIPE_INSTANCE;
|
||||||
fhandler_base::init (f, a, mode);
|
fhandler_base::init (f, a, mode);
|
||||||
close_on_exec (mode & O_CLOEXEC);
|
close_on_exec (mode & O_CLOEXEC);
|
||||||
setup_overlapped (opened_properly);
|
if (opened_properly)
|
||||||
|
setup_overlapped ();
|
||||||
|
else
|
||||||
|
destroy_overlapped ();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,7 +188,7 @@ fhandler_pipe::dup (fhandler_base *child)
|
|||||||
ftp->set_popen_pid (0);
|
ftp->set_popen_pid (0);
|
||||||
|
|
||||||
int res;
|
int res;
|
||||||
if (get_handle () && fhandler_base::dup (child))
|
if (get_handle () && fhandler_base_overlapped::dup (child))
|
||||||
res = -1;
|
res = -1;
|
||||||
else
|
else
|
||||||
res = 0;
|
res = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user