.\" Copyright (c) 2006, Michael Kerrisk (mtk.manpages@gmail.com) .\" .\" Permission is granted to make and distribute verbatim copies of this .\" manual provided the copyright notice and this permission notice are .\" preserved on all copies. .\" .\" Permission is granted to copy and distribute modified versions of this .\" manual under the conditions for verbatim copying, provided that the .\" entire resulting derived work is distributed under the terms of a .\" permission notice identical to this one. .\" .\" Since the Linux kernel and libraries are constantly changing, this .\" manual page may be incorrect or out-of-date. The author(s) assume no .\" responsibility for errors or omissions, or for damages resulting from .\" the use of the information contained herein. The author(s) may not .\" have taken the same level of care in the production of this manual, .\" which is licensed free of charge, as they might when working .\" professionally. .\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" .\" Japanese Version Copyright (c) 2006 Yuichi SATO .\" all rights reserved. .\" Translated 2006-08-01 by Yuichi SATO , LDP v2.36 .\" .TH SOCKATMARK 3 2008-12-03 "Linux" "Linux Programmer's Manual" .\"O .SH NAME .SH 名前 .\"O sockatmark \- determine whether socket is at out-of-band mark sockatmark \- どのソケットに帯域外 (out-of-band) マークが付けられているかを調べる .\"O .SH SYNOPSIS .SH 書式 .B #include .sp .BI "int sockatmark(int " sockfd ); .sp .in -4n .\"O Feature Test Macro Requirements for glibc (see .\"O .BR feature_test_macros (7)): glibc 向けの機能検査マクロの要件 .RB ( feature_test_macros (7) 参照): .in .sp .ad l .BR sockatmark (): _POSIX_C_SOURCE\ >=\ 200112L || _XOPEN_SOURCE\ >=\ 600 .ad b .\"O .SH DESCRIPTION .SH 説明 .\"O .BR sockatmark () .\"O returns a value indicating whether or not the socket referred .\"O to by the file descriptor .\"O .I sockfd .\"O is at the out-of-band mark. .BR sockatmark () はファイルディスクリプタ .I sockfd で参照されるソケットに帯域外マークが付けられているか否かを返す。 .\"O If the socket is at the mark, then 1 is returned; .\"O if the socket is not at the mark, 0 is returned. .\"O This function does not remove the out-of-band mark. ソケットにマークが付けられている場合は、1 が返される。 ソケットにマークが付けられていない場合は、0 が返される。 この関数は帯域外マークを削除しない。 .\"O .SH "RETURN VALUE" .SH 返り値 .\"O A successful call to .\"O .BR sockatmark () .\"O returns 1 if the socket is at the out-of-band mark, or 0 if it is not. .\"O On error, \-1 is returned and \fIerrno\fP is set to indicate the error. .BR sockatmark () の呼び出しが成功した場合、ソケットに帯域外マークが 付けられていれば 1 を返し、付けられていなければ 0 を返す。 エラーの場合は \-1 が返され、エラーを表す \fIerrno\fP が設定される。 .\"O .SH ERRORS .SH エラー .TP .B EBADF .\"O .I sockfd .\"O is not a valid file descriptor. .I sockfd が有効なファイルディスクリプタでない。 .TP .B EINVAL .\" POSIX.1 says ENOTTY for this case .\"O .I sockfd .\"O is not a file descriptor to which .\"O .BR sockatmark () .\"O can be applied. .I sockfd は .BR sockatmark () が適用できないファイルディスクリプタである。 .\"O .SH VERSIONS .SH バージョン .\"O .BR sockatmark () .\"O was added to glibc in version 2.2.4. .BR sockatmark () は glibc バージョン 2.2.4 で追加された。 .\"O .SH "CONFORMING TO" .SH 準拠 POSIX.1-2001. .\"O .SH NOTES .SH 注意 .\"O If .\"O .BR sockatmark () .\"O returns 1, then the out-of-band data can be read using the .\"O .B MSG_OOB .\"O flag of .\"O .BR recv (2). .BR sockatmark () が 1 を返す場合、帯域外データは .B MSG_OOB を指定した .BR recv (2) で読み込むことができる。 .\"O Out-of-band data is only supported on some stream socket protocols. 帯域外データは、いくつかのストリームソケットプロトコルでしか サポートされていない。 .\"O .BR sockatmark () .\"O can safely be called from a handler for the .\"O .B SIGURG .\"O signal. .BR sockatmark () は .B SIGURG シグナルのハンドラから安全に呼び出すことができる。 .\"O .BR sockatmark () .\"O is implemented using the .\"O .B SIOCATMARK .\"O .BR ioctl (2) .\"O operation. .BR sockatmark () は .B SIOCATMARK .BR ioctl (2) 操作を使って実装されている。 .\"O .SH BUGS .SH バグ .\"O Prior to glibc 2.4, .\"O .BR sockatmark () .\"O did not work. glibc 2.4 より前のバージョンでは、 .BR sockatmark () は動作しない。 .\"O .SH EXAMPLE .SH 例 .\"O The following code can be used after receipt of a .\"O .B SIGURG .\"O signal to read (and discard) all data up to the mark, .\"O and then read the byte of data at the mark: 以下のコードは、 .B SIGURG シグナルを受け取った後にマークまでの全てのデータを読み込んで (破棄し)、 マークされたデータのバイトを読み込むのに使用できる。 .nf char buf[BUF_LEN]; char oobdata; int atmark, s; for (;;) { atmark = sockatmark(sockfd); if (atmark == \-1) { perror("sockatmark"); break; } if (atmark) break; s = read(sockfd, buf, BUF_LEN) <= 0); if (s == \-1) perror("read"); if (s <= 0) break; } if (atmark == 1) { if (recv(sockfd, &oobdata, 1, MSG_OOB) == \-1) { perror("recv"); ... } } .fi .\"O .SH "SEE ALSO" .SH 関連項目 .BR fcntl (2), .BR recv (2), .BR send (2), .BR tcp (7)