glib-unix: New Unix-specific API

GLib historically has been designed to be "mostly" portable; there
are some functions only available on Unix like g_io_channel_unix_new(),
but these are typically paired with obvious counterparts for Win32.

However, as GLib is used not only by portable software, but components
targeting Unix (or even just Linux), there are a few cases where it
would be very convenient if GLib shipped built-in functionality.

This initial patch is a basic wrapper around pipe2(), including
fallbacks for older kernels.  This pairs well with the
existing g_spawn_*() API and its child_setup functionality.

However, in the future, I want to add a signal() wrapper here,
complete with proxying the signal to a mainloop.  I have initial code
for this, but doing it sanely (including factoring out gmain.c's
private worker thread), is a complex task, and I don't want to block
on that.

See also gwin32.h for Win32 specific functionality.

https://bugzilla.gnome.org/show_bug.cgi?id=644941
This commit is contained in:
Colin Walters
2011-03-16 13:54:28 -04:00
parent 27246c615d
commit 0ff211f520
8 changed files with 302 additions and 20 deletions

View File

@@ -1924,6 +1924,14 @@ g_win32_ftruncate
</SECTION>
<SECTION>
<TITLE>UNIX Compatibility Functions</TITLE>
<FILE>gunix</FILE>
G_UNIX_ERROR
g_unix_pipe_flags
</SECTION>
# Data Structures
<SECTION>