"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-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>
* sigproc.cc (remove_proc): Don't do busy loop when exiting since it
int __stdcall ftruncate (_off64_t, bool) __attribute__ ((regparm (3)));
int init (HANDLE, DWORD, mode_t);
static int create (fhandler_pipe *[2], unsigned, int);
- static int create_selectable (LPSECURITY_ATTRIBUTES, HANDLE *, HANDLE *, DWORD,
- const char *, DWORD);
+ static DWORD create (LPSECURITY_ATTRIBUTES, HANDLE *, HANDLE *, DWORD,
+ const char *, DWORD);
fhandler_pipe (void *) {}
void copyto (fhandler_base *x)
{
pc.file_attributes (FILE_ATTRIBUTE_NORMAL);
}
+ static const unsigned pipesize = 128 * 1024;
HANDLE output_mutex, input_mutex;
HANDLE input_available_event;
#define fnevent(w) fifo_name (npbuf, w "-event")
#define fnpipe() fifo_name (npbuf, "fifo")
#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 *
fhandler_fifo::fifo_name (char *buf, const char *what)
char pipename[sizeof("ptyNNNN-from-master")];
__small_sprintf (pipename, "pty%d-to-master", unit);
- res = fhandler_pipe::create_selectable (&sec_none, &get_io_handle (),
- &to_master, 128 * 1024, pipename, 0);
+ res = fhandler_pipe::create (&sec_none, &get_io_handle (), &to_master,
+ fhandler_pty_common::pipesize, pipename, 0);
if (res)
{
errstr = "output pipe";
BOOL WINAPI
CreatePipeOverlapped (PHANDLE hr, PHANDLE hw, LPSECURITY_ATTRIBUTES sa)
{
- int ret = fhandler_pipe::create_selectable (sa, hr, hw, 0, NULL,
- FILE_FLAG_OVERLAPPED);
+ int ret = fhandler_pipe::create (sa, hr, hw, 0, NULL,
+ FILE_FLAG_OVERLAPPED);
if (ret)
SetLastError (ret);
return ret == 0;
which is used to implement select and nonblocking writes.
Note that the return value is either 0 or GetLastError,
unlike CreatePipe, which returns a bool for success or failure. */
-int
-fhandler_pipe::create_selectable (LPSECURITY_ATTRIBUTES sa_ptr, HANDLE *r,
- HANDLE *w, DWORD psize, const char *name, DWORD open_mode)
+DWORD
+fhandler_pipe::create (LPSECURITY_ATTRIBUTES sa_ptr, PHANDLE r, PHANDLE w,
+ DWORD psize, const char *name, DWORD open_mode)
{
/* Default to error. */
if (r)
*w = NULL;
/* Ensure that there is enough pipe buffer space for atomic writes. */
- if (psize < DEFAULT_PIPEBUFSIZE)
+ if (!psize)
psize = DEFAULT_PIPEBUFSIZE;
char pipename[MAX_PATH];
SECURITY_ATTRIBUTES *sa = sec_none_cloexec (mode);
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)
__seterrno_from_win_error (ret);
else if ((fhs[0] = (fhandler_pipe *) build_fh_dev (*piper_dev)) == NULL)
sigproc_init ()
{
char char_sa_buf[1024];
- PSECURITY_ATTRIBUTES sa_buf = sec_user_nih ((PSECURITY_ATTRIBUTES) char_sa_buf, cygheap->user.sid());
- for (int i = 5;
- i > 0 && !CreatePipe (&my_readsig, &my_sendsig, sa_buf, 0);
- i--)
- if (i == 1)
+ 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), NULL, 0);
+ if (err)
+ {
+ SetLastError (err);
api_fatal ("couldn't create signal pipe, %E");
+ }
ProtectHandle (my_readsig);
myself->sendsig = my_sendsig;
/* sync_proc_subproc is used by proc_subproc. It serializes
then it exists although we may not have privileges to actually use it. */
char pipename[sizeof("ptyNNNN-from-master")];
__small_sprintf (pipename, "pty%d-from-master", get_unit ());
- /* fhandler_pipe::create_selectable returns 0 when creation succeeds */
- return fhandler_pipe::create_selectable (&sec_none, &r, &w, 128 * 1024,
- pipename, 0) == 0;
+ /* fhandler_pipe::create returns 0 when creation succeeds */
+ return fhandler_pipe::create (&sec_none, &r, &w,
+ fhandler_pty_common::pipesize, pipename,
+ 0) == 0;
}
bool