GioUnix.FDMessage

g GObject.Object GObject.Object Gio.SocketControlMessage Gio.SocketControlMessage GObject.Object->Gio.SocketControlMessage GioUnix.FDMessage GioUnix.FDMessage Gio.SocketControlMessage->GioUnix.FDMessage

Subclasses:

None

Methods

Inherited:

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

Structs:

GObject.ObjectClass (5)

class

append_fd (message, fd)

class

get_fd_list (message)

class

new ()

class

new_with_fd_list (fd_list)

class

steal_fds (message)

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 GioUnix.FDMessage(**kwargs)
Bases:

Gio.SocketControlMessage

Abstract:

No

Structure:

GioUnix.FDMessageClass

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 append_fd(message, fd)
Parameters:
Raises:

GLib.Error

Returns:

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

Return type:

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.

New in version 2.22.

classmethod get_fd_list(message)
Parameters:

message (Gio.UnixFDMessage) – a GioUnix.FDMessage

Returns:

the Gio.UnixFDList from message

Return type:

Gio.UnixFDList

Gets the Gio.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.

New in version 2.24.

classmethod new()
Returns:

a new GioUnix.FDMessage

Return type:

Gio.SocketControlMessage

Creates a new GioUnix.FDMessage containing an empty file descriptor list.

New in version 2.22.

classmethod new_with_fd_list(fd_list)
Parameters:

fd_list (Gio.UnixFDList) – a Gio.UnixFDList

Returns:

a new GioUnix.FDMessage

Return type:

Gio.SocketControlMessage

Creates a new GioUnix.FDMessage containing list.

New in version 2.24.

classmethod steal_fds(message)
Parameters:

message (Gio.UnixFDMessage) – a GioUnix.FDMessage

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 message. 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 message, an empty array is returned.

New in version 2.22.

Property Details

GioUnix.FDMessage.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.