GLibUnix – 2.0
Description: Reference for GLibUnix-2.0

### Namespace

# GLibUnix – 2.0

Unix-specific APIs in GLib

Version | 2.88.2
Authors | GLib Development Team
License | LGPL-2.1-or-later
Website | https://www.gtk.org
Source | https://gitlab.gnome.org/GNOME/glib/

#### Build

C headers | `glib-unix.h, glib.h`
pkg-config files | `glib-2.0`

#### Dependencies

GLib—2.0 | The base utility library
| Browse documentation

#### Related libraries

GModule | Portable API for dynamically loading modules
| Browse documentation
GObject | The base type system library
| Browse documentation
GIO | GObject Interfaces and Objects, Networking, IPC, and I/O
| Browse documentation

#### Additional documentation

- Unix-specific Utilities

#### Structs

Pipe | A Unix pipe. The advantage of this type over `int[2]` is that it can be closed automatically when it goes out of scope, using `g_auto(GUnixPipe)`, on compilers that support that feature. since: 2.80

#### Enumerations

PipeEnd | Mnemonic constants for the ends of a Unix pipe. since: 2.80

#### Callbacks

FDSourceFunc | The type of functions to be called when a UNIX fd watch source triggers.

#### Functions

closefrom | Close every file descriptor equal to or greater than `lowfd`. since: 2.80
error_quark |
fd_add | Sets a function to be called when the IO condition, as specified by `condition` becomes true for `fd`. since: 2.36
fd_add_full | Sets a function to be called when the IO condition, as specified by `condition` becomes true for `fd`. since: 2.36
fd_query_path | Queries the file path for the given FD opened by the current process. since: 2.88
fd_source_new | Creates a `GSource` to watch for a particular I/O condition on a file descriptor. since: 2.36
fdwalk_set_cloexec | Mark every file descriptor equal to or greater than `lowfd` to be closed at the next `execve()` or similar, as if via the `FD_CLOEXEC` flag. since: 2.80
get_passwd_entry | Get the `passwd` file entry for the given `user_name` using `getpwnam_r()`. This can fail if the given `user_name` doesn’t exist. since: 2.64
open_pipe | Similar to the UNIX `pipe()` call, but on modern systems like Linux uses the `pipe2()` system call, which atomically creates a pipe with the configured flags. since: 2.30
set_fd_nonblocking | Control the non-blocking state of the given file descriptor, according to `nonblock`. On most systems this uses `O_NONBLOCK`, but on some older ones may use `O_NDELAY`. since: 2.30
signal_add | A convenience function for g_unix_signal_source_new(), which attaches to the default `GMainContext`. You can remove the watch using g_source_remove(). since: 2.30
signal_add_full | A convenience function for g_unix_signal_source_new(), which attaches to the default `GMainContext`. You can remove the watch using g_source_remove(). since: 2.30
signal_source_new | Create a `GSource` that will be dispatched upon delivery of the UNIX signal `signum`. In GLib versions before 2.36, only `SIGHUP`, `SIGINT`, `SIGTERM` can be monitored. In GLib 2.36, `SIGUSR1` and `SIGUSR2` were added. In GLib 2.54, `SIGWINCH` was added. since: 2.30