summaryrefslogtreecommitdiff
path: root/doc/man/fset.3
blob: 87a7dc874d14a8462e61f0e85fcd7078400aebf5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
.\" Ouroboros man pages CC-BY 2017 - 2024
.\" Dimitri Staessens <dimitri@ouroboros.rocks>
.\" Sander Vrijders <sander@ouroboros.rocks>

.TH FSET 3 2017-04-10 Ouroboros "Ouroboros Programmer's Manual"

.SH NAME

fset_create, fset_destroy, fset_zero, fset_add, fset_del, fset_has \-
manipulation of a set of flow descriptors

.SH SYNOPSIS

.B #include <ouroboros/fqueue.h>

\fBfset_t * fset_create(void);

\fBvoid fset_destroy(fset_t * \fIset\fB);

\fBvoid fset_zero(fset_t * \fIset\fB);

\fBint fset_add(fset_t * \fIset\fB, int \fIfd\fB);

\fBint fset_del(fset_t * \fIset\fB, int \fIfd\fB);

\fBbool fset_has(fset_t * \fIset\fB, int \fIfd\fB);

Compile and link with \fI-louroboros-dev\fR.

.SH DESCRIPTION

These calls are used to manage a set of \fIflow descriptors\fR.

The \fBfset_create\fR() function creates and fset_t struct which holds
a set of flow descriptors.

The \fBfset_destroy\fR() function frees any resources associated with
an \fBfset_t \fIset\fR.

The \fBset_zero\fR() function removes all flow descriptors from an
\fBfset_t \fIset\fR.

The \fBset_add\fR() function adds a flow descriptor \fIfd\fR to the
\fBfset_t \fIset\fR. A flow descriptor can be in at most one fset at a
time.

The \fBfset_del\fR() function removes a flow descriptor \fIfd\fR from
the \fBfset_t \fIset\fR. \fBfset_del\fR() ignores invalid input.

The \fBfset_has\fR() function checks whether a flow descriptor \fIfd\fR is
an element of the \fBfset_t \fIset\fR.

.SH RETURN VALUE

On success, \fBfset_create\fR() returns a pointer to an \fBfset_t\fB.

\fBfset_destroy\fR(), \fBset_zero\fR() and \fBfset_del\fR() have no return value.

\fBfset_add\fR() returns 0 on success or an error code.

\fBfset_has\fR() returns true when \fIfd\fR is in the set, false if it
is not or on invalid input.

.SH ERRORS

\fBfset_create\fR() returns NULL when insufficient resources
were available to create the \fBfset_t\fR.

\fBfset_add\fR() can return the following errors:

.B -EINVAL
An invalid argument was passed (\fIset\fR was NULL or \fIfd\fR was
invalid).

.B -EPERM
The passed flow descriptor \fIfd\fR was already in another \fBfset_t\fR.

.SH ATTRIBUTES

For an explanation of the terms used in this section, see \fBattributes\fR(7).

.TS
box, tab(&);
LB|LB|LB
L|L|L.
Interface & Attribute & Value
_
\fBfset_create\fR() & Thread safety & MT-Safe
_
\fBfset_destroy\fR() & Thread safety & MT-Safe
_
\fBfset_zero\fR() & Thread safety & MT-Safe
_
\fBfset_add\fR() & Thread safety & MT-Safe
_
\fBfset_del\fR() & Thread safety & MT-Safe
_
\fBfset_has\fR() & Thread safety & MT-Safe
.TE

.SH TERMINOLOGY
Please see \fBouroboros-glossary\fR(7).

.SH SEE ALSO

.BR fccntl "(3), " flow_alloc "(3), " flow_read "(3), " fccntl "(3), " \
fqueue "(3), " ouroboros (8)

.SH COLOPHON
This page is part of the Ouroboros project, found at
http://ouroboros.rocks

These man pages are licensed under the Creative Commons Attribution
4.0 International License. To view a copy of this license, visit
http://creativecommons.org/licenses/by/4.0/