2 .\" Copyright (c) 2006, Michael Kerrisk <mtk.manpages@gmail.com>
4 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
6 .TH sockatmark 3 (date) "Linux man-pages (unreleased)"
8 sockatmark \- determine whether socket is at out-of-band mark
11 .RI ( libc ", " \-lc )
14 .B #include <sys/socket.h>
16 .BI "int sockatmark(int " sockfd );
20 Feature Test Macro Requirements for glibc (see
21 .BR feature_test_macros (7)):
26 _POSIX_C_SOURCE >= 200112L
30 returns a value indicating whether or not the socket referred
31 to by the file descriptor
33 is at the out-of-band mark.
34 If the socket is at the mark, then 1 is returned;
35 if the socket is not at the mark, 0 is returned.
36 This function does not remove the out-of-band mark.
40 returns 1 if the socket is at the out-of-band mark, or 0 if it is not.
41 On error, \-1 is returned and
43 is set to indicate the error.
48 is not a valid file descriptor.
51 .\" POSIX.1 says ENOTTY for this case
53 is not a file descriptor to which
57 For an explanation of the terms used in this section, see
63 Interface Attribute Value
68 T} Thread safety MT-Safe
78 returns 1, then the out-of-band data can be read using the
83 Out-of-band data is supported only on some stream socket protocols.
86 can safely be called from a handler for the
91 is implemented using the
100 The following code can be used after receipt of a
102 signal to read (and discard) all data up to the mark,
103 and then read the byte of data at the mark:
111 atmark = sockatmark(sockfd);
113 perror("sockatmark");
120 s = read(sockfd, buf, BUF_LEN);
128 if (recv(sockfd, &oobdata, 1, MSG_OOB) == \-1) {