Blame docs/reference/gio/html/GUnixFDList.html

Packit ae235b
Packit ae235b
<html>
Packit ae235b
<head>
Packit ae235b
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
Packit ae235b
<title>GUnixFDList: GIO Reference Manual</title>
Packit ae235b
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
Packit ae235b
<link rel="home" href="index.html" title="GIO Reference Manual">
Packit ae235b
<link rel="up" href="networking.html" title="Low-level network support">
Packit ae235b
<link rel="prev" href="GSocketControlMessage.html" title="GSocketControlMessage">
Packit ae235b
<link rel="next" href="GUnixFDMessage.html" title="GUnixFDMessage">
Packit ae235b
<meta name="generator" content="GTK-Doc V1.27 (XML mode)">
Packit ae235b
<link rel="stylesheet" href="style.css" type="text/css">
Packit ae235b
</head>
Packit ae235b
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
Packit ae235b
Packit ae235b
Packit ae235b
Top  | 
Packit ae235b
                  Description  | 
Packit ae235b
                  Object Hierarchy
Packit ae235b
Packit ae235b
Home
Packit ae235b
Up
Packit ae235b
Prev
Packit ae235b
Next
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

GUnixFDList

Packit ae235b

GUnixFDList — An object containing a set of UNIX file descriptors

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Functions

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
GUnixFDList *
Packit ae235b
Packit ae235b
Packit ae235b
g_unix_fd_list_new_from_array ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
GUnixFDList *
Packit ae235b
Packit ae235b
Packit ae235b
g_unix_fd_list_new ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
gint
Packit ae235b
Packit ae235b
Packit ae235b
g_unix_fd_list_get_length ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
gint
Packit ae235b
Packit ae235b
Packit ae235b
g_unix_fd_list_get ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
const gint *
Packit ae235b
Packit ae235b
Packit ae235b
g_unix_fd_list_peek_fds ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
gint *
Packit ae235b
Packit ae235b
Packit ae235b
g_unix_fd_list_steal_fds ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
gint
Packit ae235b
Packit ae235b
Packit ae235b
g_unix_fd_list_append ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Types and Values

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
 
Packit ae235b
GUnixFDList
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Object Hierarchy

Packit ae235b
    GObject
Packit ae235b
    ╰── GUnixFDList
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Includes

Packit ae235b
#include <gio/gunixfdlist.h>
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Description

Packit ae235b

A GUnixFDList contains a list of file descriptors. It owns the file

Packit ae235b
descriptors that it contains, closing them when finalized.

Packit ae235b

It may be wrapped in a GUnixFDMessage and sent over a GSocket in

Packit ae235b
the G_SOCKET_ADDRESS_UNIX family by using g_socket_send_message()
Packit ae235b
and received using g_socket_receive_message().

Packit ae235b

Note that &lt;gio/gunixfdlist.h> belongs to the UNIX-specific GIO

Packit ae235b
interfaces, thus you have to use the gio-unix-2.0.pc pkg-config
Packit ae235b
file when using it.

Packit ae235b
Packit ae235b
Packit ae235b

Functions

Packit ae235b
Packit ae235b

g_unix_fd_list_new_from_array ()

Packit ae235b
GUnixFDList *
Packit ae235b
g_unix_fd_list_new_from_array (const gint *fds,
Packit ae235b
                               gint n_fds);
Packit ae235b

Creates a new GUnixFDList containing the file descriptors given in

Packit ae235b
fds
Packit ae235b
.  The file descriptors become the property of the new list and
Packit ae235b
may no longer be used by the caller.  The array itself is owned by
Packit ae235b
the caller.

Packit ae235b

Each file descriptor in the array should be set to close-on-exec.

Packit ae235b

If n_fds

Packit ae235b
 is -1 then fds
Packit ae235b
 must be terminated with -1.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

fds

Packit ae235b

the initial list of file descriptors.

Packit ae235b
[array length=n_fds]
Packit ae235b
Packit ae235b
Packit ae235b

n_fds

Packit ae235b

the length of fds, or -1

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

a new GUnixFDList

Packit ae235b
Packit ae235b

Since: 2.24

Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_unix_fd_list_new ()

Packit ae235b
GUnixFDList *
Packit ae235b
g_unix_fd_list_new (void);
Packit ae235b

Creates a new GUnixFDList containing no file descriptors.

Packit ae235b
Packit ae235b

Returns

Packit ae235b

a new GUnixFDList

Packit ae235b
Packit ae235b

Since: 2.24

Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_unix_fd_list_get_length ()

Packit ae235b
gint
Packit ae235b
g_unix_fd_list_get_length (GUnixFDList *list);
Packit ae235b

Gets the length of list

Packit ae235b
 (ie: the number of file descriptors
Packit ae235b
contained within).

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

list

Packit ae235b

a GUnixFDList

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

the length of list

Packit ae235b

Packit ae235b
Packit ae235b

Since: 2.24

Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_unix_fd_list_get ()

Packit ae235b
gint
Packit ae235b
g_unix_fd_list_get (GUnixFDList *list,
Packit ae235b
                    gint index_,
Packit ae235b
                    GError **error);
Packit ae235b

Gets a file descriptor out of list

Packit ae235b
.

Packit ae235b

index_

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

Packit ae235b

The file descriptor is duplicated using dup() and set as

Packit ae235b
close-on-exec before being returned.  You must call close() on it
Packit ae235b
when you are done.

Packit ae235b

A possible cause of failure is exceeding the per-process or

Packit ae235b
system-wide file descriptor limit.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

list

Packit ae235b

a GUnixFDList

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

index_

Packit ae235b

the index into the list

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

error

Packit ae235b

a GError pointer

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

the file descriptor, or -1 in case of error

Packit ae235b
Packit ae235b

Since: 2.24

Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_unix_fd_list_peek_fds ()

Packit ae235b
const gint *
Packit ae235b
g_unix_fd_list_peek_fds (GUnixFDList *list,
Packit ae235b
                         gint *length);
Packit ae235b

Returns the array of file descriptors that is contained in this

Packit ae235b
object.

Packit ae235b

After this call, the descriptors remain the property of list

Packit ae235b
.  The
Packit ae235b
caller must not close them and must not free the array.  The array is
Packit ae235b
valid only until list
Packit ae235b
 is changed in any way.

Packit ae235b

If length

Packit ae235b
 is non-NULL then it is set to the number of file
Packit ae235b
descriptors in the returned array. The returned array is also
Packit ae235b
terminated with -1.

Packit ae235b

This function never returns NULL. In case there are no file

Packit ae235b
descriptors contained in list
Packit ae235b
, an empty array is returned.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

list

Packit ae235b

a GUnixFDList

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

length

Packit ae235b

pointer to the length of the returned

Packit ae235b
array, or NULL. 

Packit ae235b
[out][optional]
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

an array of file

Packit ae235b
descriptors. 

Packit ae235b

[array length=length][transfer none]

Packit ae235b
Packit ae235b

Since: 2.24

Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_unix_fd_list_steal_fds ()

Packit ae235b
gint *
Packit ae235b
g_unix_fd_list_steal_fds (GUnixFDList *list,
Packit ae235b
                          gint *length);
Packit ae235b

Returns the array of file descriptors that is contained in this

Packit ae235b
object.

Packit ae235b

After this call, the descriptors are no longer contained in

Packit ae235b
list
Packit ae235b
. Further calls will return an empty list (unless more
Packit ae235b
descriptors have been added).

Packit ae235b

The return result of this function must be freed with g_free().

Packit ae235b
The caller is also responsible for closing all of the file
Packit ae235b
descriptors.  The file descriptors in the array are set to
Packit ae235b
close-on-exec.

Packit ae235b

If length

Packit ae235b
 is non-NULL then it is set to the number of file
Packit ae235b
descriptors in the returned array. The returned array is also
Packit ae235b
terminated with -1.

Packit ae235b

This function never returns NULL. In case there are no file

Packit ae235b
descriptors contained in list
Packit ae235b
, an empty array is returned.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

list

Packit ae235b

a GUnixFDList

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

length

Packit ae235b

pointer to the length of the returned

Packit ae235b
array, or NULL. 

Packit ae235b
[out][optional]
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

an array of file

Packit ae235b
descriptors. 

Packit ae235b

[array length=length][transfer full]

Packit ae235b
Packit ae235b

Since: 2.24

Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_unix_fd_list_append ()

Packit ae235b
gint
Packit ae235b
g_unix_fd_list_append (GUnixFDList *list,
Packit ae235b
                       gint fd,
Packit ae235b
                       GError **error);
Packit ae235b

Adds a file descriptor to list

Packit ae235b
.

Packit ae235b

The file descriptor is duplicated using dup(). You keep your copy

Packit ae235b
of the descriptor and the copy contained in list
Packit ae235b
 will be closed
Packit ae235b
when list
Packit ae235b
 is finalized.

Packit ae235b

A possible cause of failure is exceeding the per-process or

Packit ae235b
system-wide file descriptor limit.

Packit ae235b

The index of the file descriptor in the list is returned. If you use

Packit ae235b
this index with g_unix_fd_list_get() then you will receive back a
Packit ae235b
duplicated copy of the same file descriptor.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

list

Packit ae235b

a GUnixFDList

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

fd

Packit ae235b

a valid open file descriptor

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

error

Packit ae235b

a GError pointer

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

the index of the appended fd in case of success, else -1

Packit ae235b
(and error
Packit ae235b
is set)

Packit ae235b
Packit ae235b

Since: 2.24

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Types and Values

Packit ae235b
Packit ae235b

GUnixFDList

Packit ae235b
typedef struct _GUnixFDList GUnixFDList;
Packit ae235b

GUnixFDList is an opaque data structure and can only be accessed

Packit ae235b
using the following functions.

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

See Also

Packit ae235b

GUnixFDMessage

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Generated by GTK-Doc V1.27
Packit ae235b
</body>
Packit ae235b
</html>