since: 2.24


g_unix_fd_list_get (
  GUnixFDList* list,
  gint index_,
  GError** error


Gets a file descriptor out of list.

index_ specifies the index of the file descriptor to get. It is a programmer error for index_ to be out of range; see g_unix_fd_list_get_length().

The file descriptor is duplicated using dup() and set as close-on-exec before being returned. You must call close() on it when you are done.

A possible cause of failure is exceeding the per-process or system-wide file descriptor limit.

Available since: 2.24



Type: gint

The index into the list.


Type: GError **

The return location for a recoverable error.

The argument can be NULL.
If the return location is not NULL, then you must initialize it to a NULL GError*.
The argument will left initialized to NULL by the method if there are no errors.
In case of error, the argument will be set to a newly allocated GError; the caller will take ownership of the data, and be responsible for freeing it.

Return value

Type: gint

The file descriptor, or -1 in case of error.