summaryrefslogtreecommitdiffstats
path: root/upstream/fedora-rawhide/man3/sd_is_fifo.3
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 19:43:11 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 19:43:11 +0000
commitfc22b3d6507c6745911b9dfcc68f1e665ae13dbc (patch)
treece1e3bce06471410239a6f41282e328770aa404a /upstream/fedora-rawhide/man3/sd_is_fifo.3
parentInitial commit. (diff)
downloadmanpages-l10n-fc22b3d6507c6745911b9dfcc68f1e665ae13dbc.tar.xz
manpages-l10n-fc22b3d6507c6745911b9dfcc68f1e665ae13dbc.zip
Adding upstream version 4.22.0.upstream/4.22.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'upstream/fedora-rawhide/man3/sd_is_fifo.3')
-rw-r--r--upstream/fedora-rawhide/man3/sd_is_fifo.3169
1 files changed, 169 insertions, 0 deletions
diff --git a/upstream/fedora-rawhide/man3/sd_is_fifo.3 b/upstream/fedora-rawhide/man3/sd_is_fifo.3
new file mode 100644
index 00000000..76736e7d
--- /dev/null
+++ b/upstream/fedora-rawhide/man3/sd_is_fifo.3
@@ -0,0 +1,169 @@
+'\" t
+.TH "SD_IS_FIFO" "3" "" "systemd 255" "sd_is_fifo"
+.\" -----------------------------------------------------------------
+.\" * Define some portability stuff
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" http://bugs.debian.org/507673
+.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "NAME"
+sd_is_fifo, sd_is_socket, sd_is_socket_inet, sd_is_socket_unix, sd_is_socket_sockaddr, sd_is_mq, sd_is_special \- Check the type of a file descriptor
+.SH "SYNOPSIS"
+.sp
+.ft B
+.nf
+#include <systemd/sd\-daemon\&.h>
+.fi
+.ft
+.HP \w'int\ sd_is_fifo('u
+.BI "int sd_is_fifo(int\ " "fd" ", const\ char\ *" "path" ");"
+.HP \w'int\ sd_is_socket('u
+.BI "int sd_is_socket(int\ " "fd" ", int\ " "family" ", int\ " "type" ", int\ " "listening" ");"
+.HP \w'int\ sd_is_socket_inet('u
+.BI "int sd_is_socket_inet(int\ " "fd" ", int\ " "family" ", int\ " "type" ", int\ " "listening" ", uint16_t\ " "port" ");"
+.HP \w'int\ sd_is_socket_sockaddr('u
+.BI "int sd_is_socket_sockaddr(int\ " "fd" ", int\ " "type" ", const\ struct\ sockaddr\ *" "addr" ", unsigned\ " "addr_len" ", int\ " "listening" ");"
+.HP \w'int\ sd_is_socket_unix('u
+.BI "int sd_is_socket_unix(int\ " "fd" ", int\ " "type" ", int\ " "listening" ", const\ char\ *" "path" ", size_t\ " "length" ");"
+.HP \w'int\ sd_is_mq('u
+.BI "int sd_is_mq(int\ " "fd" ", const\ char\ *" "path" ");"
+.HP \w'int\ sd_is_special('u
+.BI "int sd_is_special(int\ " "fd" ", const\ char\ *" "path" ");"
+.SH "DESCRIPTION"
+.PP
+\fBsd_is_fifo()\fR
+may be called to check whether the specified file descriptor refers to a FIFO or pipe\&. If the
+\fIpath\fR
+parameter is not
+\fBNULL\fR, it is checked whether the FIFO is bound to the specified file system path\&.
+.PP
+\fBsd_is_socket()\fR
+may be called to check whether the specified file descriptor refers to a socket\&. If the
+\fIfamily\fR
+parameter is not
+\fBAF_UNSPEC\fR, it is checked whether the socket is of the specified family (\fBAF_UNIX\fR,
+\fBAF_INET\fR, \&...)\&. If the
+\fItype\fR
+parameter is not 0, it is checked whether the socket is of the specified type (\fBSOCK_STREAM\fR,
+\fBSOCK_DGRAM\fR, \&...)\&. If the
+\fIlistening\fR
+parameter is positive, it is checked whether the socket is in accepting mode, i\&.e\&.
+\fBlisten()\fR
+has been called for it\&. If
+\fIlistening\fR
+is 0, it is checked whether the socket is not in this mode\&. If the parameter is negative, no such check is made\&. The
+\fIlistening\fR
+parameter should only be used for stream sockets and should be set to a negative value otherwise\&.
+.PP
+\fBsd_is_socket_inet()\fR
+is similar to
+\fBsd_is_socket()\fR, but optionally checks the IPv4 or IPv6 port number the socket is bound to, unless
+\fIport\fR
+is zero\&. For this call
+\fIfamily\fR
+must be passed as either
+\fBAF_UNSPEC\fR,
+\fBAF_INET\fR, or
+\fBAF_INET6\fR\&.
+.PP
+\fBsd_is_socket_sockaddr()\fR
+is similar to
+\fBsd_is_socket_inet()\fR, but checks if the socket is bound to the address specified by
+\fIaddr\fR\&. The
+\fIfamily\fR
+specified by
+\fIaddr\fR
+must be either
+\fBAF_INET\fR
+or
+\fBAF_INET6\fR
+and
+\fIaddr_len\fR
+must be large enough for that family\&. If
+\fIaddr\fR
+specifies a non\-zero port, it is also checked if the socket is bound to this port\&. In addition, for IPv6, if
+\fIaddr\fR
+specifies non\-zero
+\fIsin6_flowinfo\fR
+or
+\fIsin6_scope_id\fR, it is checked if the socket has the same values\&.
+.PP
+\fBsd_is_socket_unix()\fR
+is similar to
+\fBsd_is_socket()\fR
+but optionally checks the
+\fBAF_UNIX\fR
+path the socket is bound to, unless the
+\fIpath\fR
+parameter is
+\fBNULL\fR\&. For normal file system
+\fBAF_UNIX\fR
+sockets, set the
+\fIlength\fR
+parameter to 0\&. For Linux abstract namespace sockets, set the
+\fIlength\fR
+to the size of the address, including the initial 0 byte, and set the
+\fIpath\fR
+to the initial 0 byte of the socket address\&.
+.PP
+\fBsd_is_mq()\fR
+may be called to check whether the specified file descriptor refers to a POSIX message queue\&. If the
+\fIpath\fR
+parameter is not
+\fBNULL\fR, it is checked whether the message queue is bound to the specified name\&.
+.PP
+\fBsd_is_special()\fR
+may be called to check whether the specified file descriptor refers to a special file\&. If the
+\fIpath\fR
+parameter is not
+\fBNULL\fR, it is checked whether the file descriptor is bound to the specified filename\&. Special files in this context are character device nodes and files in
+/proc/
+or
+/sys/\&.
+.SH "RETURN VALUE"
+.PP
+On failure, these calls return a negative errno\-style error code\&. If the file descriptor is of the specified type and bound to the specified address, a positive return value is returned, otherwise zero\&.
+.SH "NOTES"
+.PP
+Functions described here are available as a shared library, which can be compiled against and linked to with the
+\fBlibsystemd\fR\ \&\fBpkg-config\fR(1)
+file\&.
+.PP
+Internally, these functions use a combination of
+\fBfstat\fR(2)
+and
+\fBgetsockname\fR(2)
+to check the file descriptor type and where it is bound to\&.
+.SH "HISTORY"
+.PP
+\fBsd_is_special()\fR
+was added in version 209\&.
+.PP
+\fBsd_is_socket_sockaddr()\fR
+was added in version 233\&.
+.SH "SEE ALSO"
+.PP
+\fBsystemd\fR(1),
+\fBsd-daemon\fR(3),
+\fBsd_listen_fds\fR(3),
+\fBsystemd.service\fR(5),
+\fBsystemd.socket\fR(5),
+\fBip\fR(7),
+\fBipv6\fR(7),
+\fBunix\fR(7),
+\fBfifo\fR(7),
+\fBmq_overview\fR(7),
+\fBsocket\fR(7)\&.