Drop the pipe() macro. Defining macros outside of its namespace that look

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
This commit is contained in:
Tor Lillqvist 2007-05-13 20:46:59 +00:00 committed by Tor Lillqvist
parent 441285045d
commit 20d47d6f9b
3 changed files with 18 additions and 6 deletions

View File

@ -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

View 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)"),

View 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