OSDN Git Service

(split) Convert release and draft pages to UTF-8.
[linuxjm/LDP_man-pages.git] / draft / man3 / sockatmark.3
1 .\" Copyright (c) 2006, Michael Kerrisk (mtk.manpages@gmail.com)
2 .\"
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
6 .\"
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
11 .\"
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein.  The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
18 .\" professionally.
19 .\"
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
22 .\"
23 .\" Japanese Version Copyright (c) 2006 Yuichi SATO
24 .\"         all rights reserved.
25 .\" Translated 2006-08-01 by Yuichi SATO <ysato444@yahoo.co.jp>, LDP v2.36
26 .\"
27 .TH SOCKATMARK 3 2008-12-03 "Linux" "Linux Programmer's Manual"
28 .\"O .SH NAME
29 .SH 名前
30 .\"O sockatmark \- determine whether socket is at out-of-band mark
31 sockatmark \- どのソケットに帯域外 (out-of-band) マークが付けられているかを調べる
32 .\"O .SH SYNOPSIS
33 .SH 書式
34 .B #include <sys/socket.h>
35 .sp
36 .BI "int sockatmark(int " sockfd );
37 .sp
38 .in -4n
39 .\"O Feature Test Macro Requirements for glibc (see
40 .\"O .BR feature_test_macros (7)):
41 glibc 向けの機能検査マクロの要件
42 .RB ( feature_test_macros (7)
43 参照):
44 .in
45 .sp
46 .ad l
47 .BR sockatmark ():
48 _POSIX_C_SOURCE\ >=\ 200112L || _XOPEN_SOURCE\ >=\ 600
49 .ad b
50 .\"O .SH DESCRIPTION
51 .SH 説明
52 .\"O .BR sockatmark ()
53 .\"O returns a value indicating whether or not the socket referred
54 .\"O to by the file descriptor
55 .\"O .I sockfd
56 .\"O is at the out-of-band mark.
57 .BR sockatmark ()
58 はファイルディスクリプタ
59 .I sockfd
60 で参照されるソケットに帯域外マークが付けられているか否かを返す。
61 .\"O If the socket is at the mark, then 1 is returned;
62 .\"O if the socket is not at the mark, 0 is returned.
63 .\"O This function does not remove the out-of-band mark.
64 ソケットにマークが付けられている場合は、1 が返される。
65 ソケットにマークが付けられていない場合は、0 が返される。
66 この関数は帯域外マークを削除しない。
67 .\"O .SH "RETURN VALUE"
68 .SH 返り値
69 .\"O A successful call to
70 .\"O .BR sockatmark ()
71 .\"O returns 1 if the socket is at the out-of-band mark, or 0 if it is not.
72 .\"O On error, \-1 is returned and \fIerrno\fP is set to indicate the error.
73 .BR sockatmark ()
74 の呼び出しが成功した場合、ソケットに帯域外マークが
75 付けられていれば 1 を返し、付けられていなければ 0 を返す。
76 エラーの場合は \-1 が返され、エラーを表す \fIerrno\fP が設定される。
77 .\"O .SH ERRORS
78 .SH エラー
79 .TP
80 .B EBADF
81 .\"O .I sockfd
82 .\"O is not a valid file descriptor.
83 .I sockfd
84 が有効なファイルディスクリプタでない。
85 .TP
86 .B EINVAL
87 .\" POSIX.1 says ENOTTY for this case
88 .\"O .I sockfd
89 .\"O is not a file descriptor to which
90 .\"O .BR sockatmark ()
91 .\"O can be applied.
92 .I sockfd
93
94 .BR sockatmark ()
95 が適用できないファイルディスクリプタである。
96 .\"O .SH VERSIONS
97 .SH バージョン
98 .\"O .BR sockatmark ()
99 .\"O was added to glibc in version 2.2.4.
100 .BR sockatmark ()
101 は glibc バージョン 2.2.4 で追加された。
102 .\"O .SH "CONFORMING TO"
103 .SH 準拠
104 POSIX.1-2001.
105 .\"O .SH NOTES
106 .SH 注意
107 .\"O If
108 .\"O .BR sockatmark ()
109 .\"O returns 1, then the out-of-band data can be read using the
110 .\"O .B MSG_OOB
111 .\"O flag of
112 .\"O .BR recv (2).
113 .BR sockatmark ()
114 が 1 を返す場合、帯域外データは
115 .B MSG_OOB
116 を指定した
117 .BR recv (2)
118 で読み込むことができる。
119
120 .\"O Out-of-band data is only supported on some stream socket protocols.
121 帯域外データは、いくつかのストリームソケットプロトコルでしか
122 サポートされていない。
123
124 .\"O .BR sockatmark ()
125 .\"O can safely be called from a handler for the
126 .\"O .B SIGURG
127 .\"O signal.
128 .BR sockatmark ()
129
130 .B SIGURG
131 シグナルのハンドラから安全に呼び出すことができる。
132
133 .\"O .BR sockatmark ()
134 .\"O is implemented using the
135 .\"O .B SIOCATMARK
136 .\"O .BR ioctl (2)
137 .\"O operation.
138 .BR sockatmark ()
139
140 .B SIOCATMARK
141 .BR ioctl (2)
142 操作を使って実装されている。
143 .\"O .SH BUGS
144 .SH バグ
145 .\"O Prior to glibc 2.4,
146 .\"O .BR sockatmark ()
147 .\"O did not work.
148 glibc 2.4 より前のバージョンでは、
149 .BR sockatmark ()
150 は動作しない。
151 .\"O .SH EXAMPLE
152 .SH 例
153 .\"O The following code can be used after receipt of a
154 .\"O .B SIGURG
155 .\"O signal to read (and discard) all data up to the mark,
156 .\"O and then read the byte of data at the mark:
157 以下のコードは、
158 .B SIGURG
159 シグナルを受け取った後にマークまでの全てのデータを読み込んで (破棄し)、
160 マークされたデータのバイトを読み込むのに使用できる。
161 .nf
162
163     char buf[BUF_LEN];
164     char oobdata;
165     int atmark, s;
166
167     for (;;) {
168         atmark = sockatmark(sockfd);
169         if (atmark == \-1) {
170             perror("sockatmark");
171             break;
172         }
173
174         if (atmark)
175             break;
176
177         s = read(sockfd, buf, BUF_LEN) <= 0);
178         if (s == \-1)
179             perror("read");
180         if (s <= 0)
181             break;
182     }
183
184     if (atmark == 1) {
185         if (recv(sockfd, &oobdata, 1, MSG_OOB) == \-1) {
186             perror("recv");
187             ...
188         }
189     }
190 .fi
191 .\"O .SH "SEE ALSO"
192 .SH 関連項目
193 .BR fcntl (2),
194 .BR recv (2),
195 .BR send (2),
196 .BR tcp (7)