.\" Copyright (c) 2006, Michael Kerrisk .\" .\" %%%LICENSE_START(VERBATIM) .\" 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. .\" %%%LICENSE_END .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .\" .\" Japanese Version Copyright (c) 2006 Yuichi SATO .\" all rights reserved. .\" Translated 2006-08-01 by Yuichi SATO , LDP v2.36 .\" .TH SOCKATMARK 3 2020\-06\-09 Linux "Linux Programmer's Manual" .SH 名前 sockatmark \- どのソケットに帯域外 (out\-of\-band) マークが付けられているかを調べる .SH 書式 \fB#include \fP .PP \fBint sockatmark(int \fP\fIsockfd\fP\fB);\fP .PP .RS -4 glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7) 参照): .RE .PP .ad l \fBsockatmark\fP(): _POSIX_C_SOURCE\ >=\ 200112L .ad b .SH 説明 \fBsockatmark\fP() はファイルディスクリプター \fIsockfd\fP で参照されるソケットに帯域外マークが付けられているか否かを返す。 ソケットにマークが付けられている場合は、1 が返される。 ソケットにマークが付けられていない場合は、0 が返される。 この関数は帯域外マークを削除しない。 .SH 返り値 \fBsockatmark\fP() の呼び出しが成功した場合、ソケットに帯域外マークが 付けられていれば 1 を返し、付けられていなければ 0 を返す。 エラーの場合は \-1 が返され、エラーを表す \fIerrno\fP が設定される。 .SH エラー .TP \fBEBADF\fP \fIsockfd\fP が有効なファイルディスクリプターでない。 .TP \fBEINVAL\fP .\" POSIX.1 says ENOTTY for this case \fIsockfd\fP は \fBsockatmark\fP() が適用できないファイルディスクリプターである。 .SH バージョン \fBsockatmark\fP() は glibc バージョン 2.2.4 で追加された。 .SH 属性 この節で使用されている用語の説明については、 \fBattributes\fP(7) を参照。 .TS allbox; lb lb lb l l l. インターフェース 属性 値 T{ \fBsockatmark\fP() T} Thread safety MT\-Safe .TE .SH 準拠 POSIX.1\-2001, POSIX.1\-2008. .SH 注意 \fBsockatmark\fP() が 1 を返す場合、帯域外データは \fBMSG_OOB\fP を指定した \fBrecv\fP(2) で読み込むことができる。 .PP 帯域外データは、いくつかのストリームソケットプロトコルでしか サポートされていない。 .PP \fBsockatmark\fP() は \fBSIGURG\fP シグナルのハンドラーから安全に呼び出すことができる。 .PP \fBsockatmark\fP() は \fBSIOCATMARK\fP \fBioctl\fP(2) 操作を使って実装されている。 .SH バグ glibc 2.4 より前のバージョンでは、 \fBsockatmark\fP() は動作しない。 .SH 例 以下のコードは、 \fBSIGURG\fP シグナルを受け取った後にマークまでの全てのデータを読み込んで (破棄し)、 マークされたデータのバイトを読み込むのに使用できる。 .PP .EX 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); if (s == \-1) perror("read"); if (s <= 0) break; } if (atmark == 1) { if (recv(sockfd, &oobdata, 1, MSG_OOB) == \-1) { perror("recv"); ... } } .EE .SH 関連項目 \fBfcntl\fP(2), \fBrecv\fP(2), \fBsend\fP(2), \fBtcp\fP(7) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 5.10 の一部である。プロジェクトの説明とバグ報告に関する情報は \%https://www.kernel.org/doc/man\-pages/ に書かれている。