Gio.UnixFDMessage

g GObject.Object GObject.Object Gio.SocketControlMessage Gio.SocketControlMessage GObject.Object->Gio.SocketControlMessage Gio.UnixFDMessage Gio.UnixFDMessage Gio.SocketControlMessage->Gio.UnixFDMessage

Subclasses:

None

Methods

Inherited:

Gio.SocketControlMessage (5), GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new ()

class

new_with_fd_list (fd_list)

append_fd (fd)

get_fd_list ()

steal_fds ()

Virtual Methods

Inherited:

Gio.SocketControlMessage (4), GObject.Object (7)

Properties

Name

Type

Flags

Short Description

fd-list

Gio.UnixFDList

r/w/co

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent_instance

Gio.SocketControlMessage

r

Class Details

class Gio.UnixFDMessage(**kwargs)
Bases:

Gio.SocketControlMessage

Abstract:

No

Structure:

Gio.UnixFDMessageClass

This [class`Gio`.SocketControlMessage] contains a [class`Gio`.UnixFDList]. It may be sent using [method`Gio`.Socket.send_message] and received using [method`Gio`.Socket.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 [method`Gio`.UnixConnection.send_fd] and [method`Gio`.UnixConnection.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.

classmethod new()[source]
Returns:

a new Gio.UnixFDMessage

Return type:

Gio.SocketControlMessage

Creates a new Gio.UnixFDMessage containing an empty file descriptor list.

New in version 2.22.

classmethod new_with_fd_list(fd_list)[source]
Parameters:

fd_list (Gio.UnixFDList) – a Gio.UnixFDList

Returns:

a new Gio.UnixFDMessage

Return type:

Gio.SocketControlMessage

Creates a new Gio.UnixFDMessage containing list.

New in version 2.24.

append_fd(fd)[source]
Parameters:

fd (int) – a valid open file descriptor

Raises:

GLib.Error

Returns:

True in case of success, else False (and error is set)

Return type:

bool

Adds a file descriptor to self.

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

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

New in version 2.22.

get_fd_list()[source]
Returns:

the Gio.UnixFDList from self

Return type:

Gio.UnixFDList

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

New in version 2.24.

steal_fds()[source]
Returns:

an array of file descriptors

Return type:

[int]

Returns the array of file descriptors that is contained in this object.

After this call, the descriptors are no longer contained in self. Further calls will return an empty list (unless more descriptors have been added).

The return result of this function must be freed with GLib.free(). The caller is also responsible for closing all of the file descriptors.

If length is non-None then it is set to the number of file descriptors in the returned array. The returned array is also terminated with -1.

This function never returns None. In case there are no file descriptors contained in self, an empty array is returned.

New in version 2.22.

Property Details

Gio.UnixFDMessage.props.fd_list
Name:

fd-list

Type:

Gio.UnixFDList

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The [class`Gio`.UnixFDList] object to send with the message.

New in version 2.22.