open_pipe
Description:
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.
As of GLib 2.78, the supported flags are `O_CLOEXEC`/`FD_CLOEXEC` (see below) and `O_NONBLOCK`. Prior to GLib 2.78, only `FD_CLOEXEC` was supported — if you wanted to configure `O_NONBLOCK` then that had to be done separately with `fcntl()`.
Since GLib 2.80, the constants g_unix_pipe_end_read and g_unix_pipe_end_write
can be used as mnemonic indexes in fds
.
It is a programmer error to call this function with unsupported flags, and a critical warning will be raised.
As of GLib 2.78, it is preferred to pass `O_CLOEXEC` in, rather than `FD_CLOEXEC`, as that matches the underlying `pipe()` API more closely. Prior to 2.78, only `FD_CLOEXEC` was supported. Support for `FD_CLOEXEC` may be deprecated and removed in future.
Parameters:
fds |
Array of two integers |
flags |
Bitfield of file descriptor flags, as for fcntl |
Returns:
true on success, false if not (and errno will be set). |