From 20d47d6f9b0930c1da15942aad847265aee1aaa4 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Sun, 13 May 2007 20:46:59 +0000 Subject: [PATCH] Drop the pipe() macro. Defining macros outside of its namespace that look 2007-05-13 Tor Lillqvist * glib/gwin32.h: Drop the pipe() macro. Defining macros outside of its namespace that look like POSIX functions is not GLib's business in my opinion. This means pipe()-using code that has relied on this definition will need changing to call _pipe() on Windows, and make the decision itself on what size pipe buffer to use, and whether to use text or binary mode, and whether the pipe handles should be inheritable or not. * glib/gspawn-win32.c (make_pipe): Use _pipe() instead of pipe(). svn path=/trunk/; revision=5490 --- ChangeLog | 12 ++++++++++++ glib/gspawn-win32.c | 2 +- glib/gwin32.h | 10 +++++----- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 38a2b2d..3a86ee0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2007-05-13 Tor Lillqvist + + * glib/gwin32.h: Drop the pipe() macro. Defining macros outside of + its namespace that look like POSIX functions is not GLib's + business in my opinion. This means pipe()-using code that has + relied on this definition will need changing to call _pipe() on + Windows, and make the decision itself on what size pipe buffer to + use, and whether to use text or binary mode, and whether the pipe + handles should be inheritable or not. + + * glib/gspawn-win32.c (make_pipe): Use _pipe() instead of pipe(). + 2007-05-11 Matthias Clasen * glib/goption.c: Allow G_OPTION_ARG_CALLBACK for diff --git a/glib/gspawn-win32.c b/glib/gspawn-win32.c index f5bc820..297c9de 100644 --- a/glib/gspawn-win32.c +++ b/glib/gspawn-win32.c @@ -281,7 +281,7 @@ static gboolean make_pipe (gint p[2], GError **error) { - if (pipe (p) < 0) + if (_pipe (p, 4096, _O_BINARY) < 0) { g_set_error (error, G_SPAWN_ERROR, G_SPAWN_ERROR_FAILED, _("Failed to create pipe for communicating with child process (%s)"), diff --git a/glib/gwin32.h b/glib/gwin32.h index 9c10447..431b198 100644 --- a/glib/gwin32.h +++ b/glib/gwin32.h @@ -42,7 +42,10 @@ G_BEGIN_DECLS /* * To get prototypes for the following POSIXish functions, you have to * include the indicated non-POSIX headers. The functions are defined - * in OLDNAMES.LIB (MSVC) or -lmoldname-msvc (mingw32). + * in OLDNAMES.LIB (MSVC) or -lmoldname-msvc (mingw32). But note that + * for POSIX functions that take or return file names in the system + * codepage, in many cases you would want to use the GLib wrappers in + * gstdio.h and UTF-8 instead. * * getcwd: (MSVC), (mingw32) * getpid: @@ -50,12 +53,9 @@ G_BEGIN_DECLS * unlink: or * open, read, write, lseek, close: * rmdir: - * pipe: + * pipe: (actually, _pipe()) */ -/* pipe is not in OLDNAMES.LIB or -lmoldname-msvc. */ -#define pipe(phandles) _pipe (phandles, 4096, _O_BINARY) - /* For some POSIX functions that are not provided by the MS runtime, * we provide emulation functions in glib, which are prefixed with * g_win32_. Or that was the idea at some time, but there is just one -- 2.7.4