Function

GLibsteal_fd

since: 2.70

Declaration [src]

static inline int
g_steal_fd (
  int* fd_ptr
)

Description [src]

Sets fd_ptr to -1, returning the value that was there before.

Conceptually, this transfers the ownership of the file descriptor from the referenced variable to the caller of the function (i.e. ‘steals’ the reference). This is very similar to g_steal_pointer(), but for file descriptors.

On POSIX platforms, this function is async-signal safe (see signal(7) and signal-safety(7)), making it safe to call from a signal handler or a GSpawnChildSetupFunc.

This function preserves the value of errno.

Available since: 2.70

This function is not directly available to language bindings.

Parameters

fd_ptr

Type: int*

A pointer to a file descriptor.

The argument will be modified by the function.

Return value

Type: int

The value that fd_ptr previously had.