* fhandler.h (fhandler_pipe::create): Rename from the misnamed
"create_selectable". Change return to DWORD. (fhandler_pty_common::pipesize): New constant. * fhandler_fifo.cc (fhandler_fifo::fhandler_fifo): Reflect create_selectable name change. * miscfuncs.cc (CreatePipeOverlapped): Ditto. * pipe.cc (fhandler_pipe::create): Ditto. (fhandler_pipe::create): Rename from the misnamed "create_selectable". Return DWORD. Only set pipe size to default when it is passed in as zero. * fhandler_tty.cc (fhandler_pty_master::setup): Ditto. Use fhandler_pty_common::pipesize rather than a raw constant. * tty.cc (tty::not_allocated): Ditto. * sigproc.cc (sigproc_init): Use create_selectable to create the signal pipe to get a more appropriate message based pipe.
This commit is contained in:
parent
cc07096c5c
commit
9f65451e3e
|
@ -1,3 +1,22 @@
|
||||||
|
2011-11-23 Christopher Faylor <me.cygwin2011@cgf.cx>
|
||||||
|
|
||||||
|
* fhandler.h (fhandler_pipe::create): Rename from the misnamed
|
||||||
|
"create_selectable". Change return to DWORD.
|
||||||
|
(fhandler_pty_common::pipesize): New constant.
|
||||||
|
* fhandler_fifo.cc (fhandler_fifo::fhandler_fifo): Reflect
|
||||||
|
create_selectable name change.
|
||||||
|
* miscfuncs.cc (CreatePipeOverlapped): Ditto.
|
||||||
|
* pipe.cc (fhandler_pipe::create): Ditto.
|
||||||
|
(fhandler_pipe::create): Rename from the misnamed "create_selectable".
|
||||||
|
Return DWORD. Only set pipe size to default when it is passed in as
|
||||||
|
zero.
|
||||||
|
* fhandler_tty.cc (fhandler_pty_master::setup): Ditto. Use
|
||||||
|
fhandler_pty_common::pipesize rather than a raw constant.
|
||||||
|
* tty.cc (tty::not_allocated): Ditto.
|
||||||
|
|
||||||
|
* sigproc.cc (sigproc_init): Use create_selectable to create the signal
|
||||||
|
pipe to get a more appropriate message based pipe.
|
||||||
|
|
||||||
2011-11-21 Christopher Faylor <me.cygwin2011@cgf.cx>
|
2011-11-21 Christopher Faylor <me.cygwin2011@cgf.cx>
|
||||||
|
|
||||||
* sigproc.cc (remove_proc): Don't do busy loop when exiting since it
|
* sigproc.cc (remove_proc): Don't do busy loop when exiting since it
|
||||||
|
|
|
@ -690,8 +690,8 @@ public:
|
||||||
int __stdcall ftruncate (_off64_t, bool) __attribute__ ((regparm (3)));
|
int __stdcall ftruncate (_off64_t, bool) __attribute__ ((regparm (3)));
|
||||||
int init (HANDLE, DWORD, mode_t);
|
int init (HANDLE, DWORD, mode_t);
|
||||||
static int create (fhandler_pipe *[2], unsigned, int);
|
static int create (fhandler_pipe *[2], unsigned, int);
|
||||||
static int create_selectable (LPSECURITY_ATTRIBUTES, HANDLE *, HANDLE *, DWORD,
|
static DWORD create (LPSECURITY_ATTRIBUTES, HANDLE *, HANDLE *, DWORD,
|
||||||
const char *, DWORD);
|
const char *, DWORD);
|
||||||
fhandler_pipe (void *) {}
|
fhandler_pipe (void *) {}
|
||||||
|
|
||||||
void copyto (fhandler_base *x)
|
void copyto (fhandler_base *x)
|
||||||
|
@ -1370,6 +1370,7 @@ class fhandler_pty_common: public fhandler_termios
|
||||||
{
|
{
|
||||||
pc.file_attributes (FILE_ATTRIBUTE_NORMAL);
|
pc.file_attributes (FILE_ATTRIBUTE_NORMAL);
|
||||||
}
|
}
|
||||||
|
static const unsigned pipesize = 128 * 1024;
|
||||||
HANDLE output_mutex, input_mutex;
|
HANDLE output_mutex, input_mutex;
|
||||||
HANDLE input_available_event;
|
HANDLE input_available_event;
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ fhandler_fifo::fhandler_fifo ():
|
||||||
#define fnevent(w) fifo_name (npbuf, w "-event")
|
#define fnevent(w) fifo_name (npbuf, w "-event")
|
||||||
#define fnpipe() fifo_name (npbuf, "fifo")
|
#define fnpipe() fifo_name (npbuf, "fifo")
|
||||||
#define create_pipe(r, w) \
|
#define create_pipe(r, w) \
|
||||||
fhandler_pipe::create_selectable (sa_buf, (r), (w), 0, fnpipe (), open_mode)
|
fhandler_pipe::create (sa_buf, (r), (w), 0, fnpipe (), open_mode)
|
||||||
|
|
||||||
char *
|
char *
|
||||||
fhandler_fifo::fifo_name (char *buf, const char *what)
|
fhandler_fifo::fifo_name (char *buf, const char *what)
|
||||||
|
|
|
@ -1630,8 +1630,8 @@ fhandler_pty_master::setup ()
|
||||||
|
|
||||||
char pipename[sizeof("ptyNNNN-from-master")];
|
char pipename[sizeof("ptyNNNN-from-master")];
|
||||||
__small_sprintf (pipename, "pty%d-to-master", unit);
|
__small_sprintf (pipename, "pty%d-to-master", unit);
|
||||||
res = fhandler_pipe::create_selectable (&sec_none, &get_io_handle (),
|
res = fhandler_pipe::create (&sec_none, &get_io_handle (), &to_master,
|
||||||
&to_master, 128 * 1024, pipename, 0);
|
fhandler_pty_common::pipesize, pipename, 0);
|
||||||
if (res)
|
if (res)
|
||||||
{
|
{
|
||||||
errstr = "output pipe";
|
errstr = "output pipe";
|
||||||
|
|
|
@ -337,8 +337,8 @@ nice_to_winprio (int &nice)
|
||||||
BOOL WINAPI
|
BOOL WINAPI
|
||||||
CreatePipeOverlapped (PHANDLE hr, PHANDLE hw, LPSECURITY_ATTRIBUTES sa)
|
CreatePipeOverlapped (PHANDLE hr, PHANDLE hw, LPSECURITY_ATTRIBUTES sa)
|
||||||
{
|
{
|
||||||
int ret = fhandler_pipe::create_selectable (sa, hr, hw, 0, NULL,
|
int ret = fhandler_pipe::create (sa, hr, hw, 0, NULL,
|
||||||
FILE_FLAG_OVERLAPPED);
|
FILE_FLAG_OVERLAPPED);
|
||||||
if (ret)
|
if (ret)
|
||||||
SetLastError (ret);
|
SetLastError (ret);
|
||||||
return ret == 0;
|
return ret == 0;
|
||||||
|
|
|
@ -196,9 +196,9 @@ fhandler_pipe::dup (fhandler_base *child, int flags)
|
||||||
which is used to implement select and nonblocking writes.
|
which is used to implement select and nonblocking writes.
|
||||||
Note that the return value is either 0 or GetLastError,
|
Note that the return value is either 0 or GetLastError,
|
||||||
unlike CreatePipe, which returns a bool for success or failure. */
|
unlike CreatePipe, which returns a bool for success or failure. */
|
||||||
int
|
DWORD
|
||||||
fhandler_pipe::create_selectable (LPSECURITY_ATTRIBUTES sa_ptr, HANDLE *r,
|
fhandler_pipe::create (LPSECURITY_ATTRIBUTES sa_ptr, PHANDLE r, PHANDLE w,
|
||||||
HANDLE *w, DWORD psize, const char *name, DWORD open_mode)
|
DWORD psize, const char *name, DWORD open_mode)
|
||||||
{
|
{
|
||||||
/* Default to error. */
|
/* Default to error. */
|
||||||
if (r)
|
if (r)
|
||||||
|
@ -207,7 +207,7 @@ fhandler_pipe::create_selectable (LPSECURITY_ATTRIBUTES sa_ptr, HANDLE *r,
|
||||||
*w = NULL;
|
*w = NULL;
|
||||||
|
|
||||||
/* Ensure that there is enough pipe buffer space for atomic writes. */
|
/* Ensure that there is enough pipe buffer space for atomic writes. */
|
||||||
if (psize < DEFAULT_PIPEBUFSIZE)
|
if (!psize)
|
||||||
psize = DEFAULT_PIPEBUFSIZE;
|
psize = DEFAULT_PIPEBUFSIZE;
|
||||||
|
|
||||||
char pipename[MAX_PATH];
|
char pipename[MAX_PATH];
|
||||||
|
@ -327,7 +327,7 @@ fhandler_pipe::create (fhandler_pipe *fhs[2], unsigned psize, int mode)
|
||||||
SECURITY_ATTRIBUTES *sa = sec_none_cloexec (mode);
|
SECURITY_ATTRIBUTES *sa = sec_none_cloexec (mode);
|
||||||
int res = -1;
|
int res = -1;
|
||||||
|
|
||||||
int ret = create_selectable (sa, &r, &w, psize, NULL, FILE_FLAG_OVERLAPPED);
|
int ret = create (sa, &r, &w, psize, NULL, FILE_FLAG_OVERLAPPED);
|
||||||
if (ret)
|
if (ret)
|
||||||
__seterrno_from_win_error (ret);
|
__seterrno_from_win_error (ret);
|
||||||
else if ((fhs[0] = (fhandler_pipe *) build_fh_dev (*piper_dev)) == NULL)
|
else if ((fhs[0] = (fhandler_pipe *) build_fh_dev (*piper_dev)) == NULL)
|
||||||
|
|
|
@ -464,12 +464,14 @@ void __stdcall
|
||||||
sigproc_init ()
|
sigproc_init ()
|
||||||
{
|
{
|
||||||
char char_sa_buf[1024];
|
char char_sa_buf[1024];
|
||||||
PSECURITY_ATTRIBUTES sa_buf = 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());
|
||||||
for (int i = 5;
|
DWORD err = fhandler_pipe::create (sa, &my_readsig, &my_sendsig,
|
||||||
i > 0 && !CreatePipe (&my_readsig, &my_sendsig, sa_buf, 0);
|
sizeof (sigpacket), NULL, 0);
|
||||||
i--)
|
if (err)
|
||||||
if (i == 1)
|
{
|
||||||
|
SetLastError (err);
|
||||||
api_fatal ("couldn't create signal pipe, %E");
|
api_fatal ("couldn't create signal pipe, %E");
|
||||||
|
}
|
||||||
ProtectHandle (my_readsig);
|
ProtectHandle (my_readsig);
|
||||||
myself->sendsig = my_sendsig;
|
myself->sendsig = my_sendsig;
|
||||||
/* sync_proc_subproc is used by proc_subproc. It serializes
|
/* sync_proc_subproc is used by proc_subproc. It serializes
|
||||||
|
|
|
@ -158,9 +158,10 @@ tty::not_allocated (HANDLE& r, HANDLE& w)
|
||||||
then it exists although we may not have privileges to actually use it. */
|
then it exists although we may not have privileges to actually use it. */
|
||||||
char pipename[sizeof("ptyNNNN-from-master")];
|
char pipename[sizeof("ptyNNNN-from-master")];
|
||||||
__small_sprintf (pipename, "pty%d-from-master", get_unit ());
|
__small_sprintf (pipename, "pty%d-from-master", get_unit ());
|
||||||
/* fhandler_pipe::create_selectable returns 0 when creation succeeds */
|
/* fhandler_pipe::create returns 0 when creation succeeds */
|
||||||
return fhandler_pipe::create_selectable (&sec_none, &r, &w, 128 * 1024,
|
return fhandler_pipe::create (&sec_none, &r, &w,
|
||||||
pipename, 0) == 0;
|
fhandler_pty_common::pipesize, pipename,
|
||||||
|
0) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
Loading…
Reference in New Issue