UnixFDMessage

class UnixFDMessage(**properties: Any)

Superclasses: SocketControlMessage, Object

This SocketControlMessage contains a UnixFDList. It may be sent using send_message and received using receive_message over UNIX sockets (ie: sockets in the G_SOCKET_FAMILY_UNIX family). The file descriptors are copied between processes by the kernel.

For an easier way to send and receive file descriptors over stream-oriented UNIX sockets, see send_fd and receive_fd.

Note that <gio/gunixfdmessage.h> belongs to the UNIX-specific GIO interfaces, thus you have to use the gio-unix-2.0.pc pkg-config file or the GioUnix-2.0 GIR namespace when using it.

Constructors

class UnixFDMessage
classmethod new() SocketControlMessage

Creates a new UnixFDMessage containing an empty file descriptor list.

Added in version 2.22.

classmethod new_with_fd_list(fd_list: UnixFDList) SocketControlMessage

Creates a new UnixFDMessage containing list.

Added in version 2.24.

Parameters:

fd_list – a UnixFDList

Methods

class UnixFDMessage
append_fd(fd: int) bool

Adds a file descriptor to message.

The file descriptor is duplicated using dup(). You keep your copy of the descriptor and the copy contained in message will be closed when message is finalized.

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

Added in version 2.22.

Parameters:

fd – a valid open file descriptor

get_fd_list() UnixFDList

Gets the UnixFDList contained in message. This function does not return a reference to the caller, but the returned list is valid for the lifetime of message.

Added in version 2.24.

Properties

class UnixFDMessage
props.fd_list: UnixFDList

The UnixFDList object to send with the message.

Added in version 2.22.

Fields

class UnixFDMessage
parent_instance
priv