### Struct

# GLibUnix Pipe

since: 2.80

#### Description [src]

    struct GUnixPipe {
      int fds[2];
    }

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.

###### Structure members

`fds`

  A pair of file descriptors, each negative if closed or not yet opened. The file descriptor with index `G_UNIX_PIPE_END_READ` is readable. The file descriptor with index `G_UNIX_PIPE_END_WRITE` is writable.

Available since: 2.80

#### Functions

###### g_unix_pipe_clear

Close both ends of the pipe, unless they have already been closed or stolen. Any errors are ignored: use `g_unix_pipe_close()` or `g_clear_fd()` if error-handling is required.

since: 2.80

###### g_unix_pipe_close

Close one of the ends of the pipe and set the relevant member of `fds` to `-1` before returning, equivalent to g_clear_fd().

since: 2.80

###### g_unix_pipe_get

Return one of the ends of the pipe. It remains owned by `self`.

since: 2.80

###### g_unix_pipe_open

Open a pipe. This is the same as g_unix_open_pipe(), but uses the `GUnixPipe` data structure.

since: 2.80

###### g_unix_pipe_steal

Return one of the ends of the pipe. It becomes owned by the caller, and the file descriptor in the data structure is set to `-1`, similar to g_steal_fd().

since: 2.80