UnixUtils

Members

Static functions

errorQuark
GQuark errorQuark()
fdAdd
uint fdAdd(int fd, GIOCondition condition, GUnixFDSourceFunc function_, void* userData)

Sets a function to be called when the IO condition, as specified by condition becomes true for fd.

fdAddFull
uint fdAddFull(int priority, int fd, GIOCondition condition, GUnixFDSourceFunc function_, void* userData, GDestroyNotify notify)

Sets a function to be called when the IO condition, as specified by condition becomes true for fd.

fdSourceNew
Source fdSourceNew(int fd, GIOCondition condition)

Creates a glib.Source to watch for a particular IO condition on a file descriptor.

openPipe
bool openPipe(int* fds, int flags)

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. The only supported flag currently is FD_CLOEXEC. If for example you want to configure O_NONBLOCK, that must still be done separately with fcntl().

setFdNonblocking
bool setFdNonblocking(int fd, bool nonblock)

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.

signalAdd
uint signalAdd(int signum, GSourceFunc handler, void* userData)

A convenience function for g_unix_signal_source_new(), which attaches to the default glib.MainContext You can remove the watch using Source.remove.

signalAddFull
uint signalAddFull(int priority, int signum, GSourceFunc handler, void* userData, GDestroyNotify notify)

A convenience function for g_unix_signal_source_new(), which attaches to the default glib.MainContext You can remove the watch using Source.remove.

signalSourceNew
Source signalSourceNew(int signum)

Create a glib.Source 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.