Drop the pipe() macro. Defining macros outside of its namespace that look
authorTor Lillqvist <tml@novell.com>
Sun, 13 May 2007 20:46:59 +0000 (20:46 +0000)
committerTor Lillqvist <tml@src.gnome.org>
Sun, 13 May 2007 20:46:59 +0000 (20:46 +0000)
2007-05-13  Tor Lillqvist  <tml@novell.com>

* 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
glib/gspawn-win32.c
glib/gwin32.h

index 38a2b2d..3a86ee0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2007-05-13  Tor Lillqvist  <tml@novell.com>
+
+       * 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  <mclasen@redhat.com>
 
        * glib/goption.c: Allow G_OPTION_ARG_CALLBACK for 
index f5bc820..297c9de 100644 (file)
@@ -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)"),
index 9c10447..431b198 100644 (file)
@@ -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: <direct.h> (MSVC), <io.h> (mingw32)
  * getpid: <process.h>
@@ -50,12 +53,9 @@ G_BEGIN_DECLS
  * unlink: <stdio.h> or <io.h>
  * open, read, write, lseek, close: <io.h>
  * rmdir: <io.h>
- * pipe: <io.h>
+ * pipe: <io.h> (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