.\" Copyright (c) 1983, 1991 The Regents of the University of California. .\" All rights reserved. .\" .\" %%%LICENSE_START(BSD_4_CLAUSE_UCB) .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" %%%LICENSE_END .\" .\" @(#)socketpair.2 6.4 (Berkeley) 3/10/91 .\" .\" Modified 1993-07-24 by Rik Faith .\" Modified 1996-10-22 by Eric S. Raymond .\" Modified 2002-07-22 by Michael Kerrisk .\" Modified 2004-06-17 by Michael Kerrisk .\" 2008-10-11, mtk: Add description of SOCK_NONBLOCK and SOCK_CLOEXEC .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .\" .\" Japanese Version Copyright (c) 1997 HANATAKA Shinya .\" all rights reserved. .\" Translated 1997-03-03, HANATAKA Shinya .\" Updated 2002-09-24, Akihiro MOTOKI .\" Updated 2005-02-24, Akihiro MOTOKI .\" Updated 2008-11-09, Akihiro MOTOKI , LDP v3.13 .\" .TH SOCKETPAIR 2 2020\-06\-09 Linux "Linux Programmer's Manual" .SH 名前 socketpair \- 接続されたソケットのペアを作成する .SH 書式 \fB#include \fP /* 「注意」参照 */ .br \fB#include \fP .PP \fBint socketpair(int \fP\fIdomain\fP\fB, int \fP\fItype\fP\fB, int \fP\fIprotocol\fP\fB, int \fP\fIsv\fP\fB[2]);\fP .SH 説明 \fBsocketpair\fP() は、指定されたドメイン \fIdomain\fP に指定された種類 \fItype\fP で名前のないソケットの接続されたペアを作成する。 \fIprotocol\fP が指定されると、このプロトコルを用いる。 これらの引数の詳細は \fBsocket\fP(2) を参照のこと。 .PP The file descriptors used in referencing the new sockets are returned in \fIsv[0]\fP and \fIsv[1]\fP. The two sockets are indistinguishable. .SH 返り値 On success, zero is returned. On error, \-1 is returned, \fIerrno\fP is set appropriately, and \fIsv\fP is left unchanged .PP .\" http://austingroupbugs.net/view.php?id=483 On Linux (and other systems), \fBsocketpair\fP() does not modify \fIsv\fP on failure. A requirement standardizing this behavior was added in POSIX.1\-2008 TC2. .SH エラー .TP \fBEAFNOSUPPORT\fP このマシンでは指定されたアドレスファミリーがサポートされていない。 .TP \fBEFAULT\fP アドレス \fIsv\fP がこのプロセスで使えるアドレス空間を指定していない。 .TP \fBEMFILE\fP 1プロセスがオープンできるファイルディスクリプター数の上限に達した。 .TP \fBENFILE\fP オープンされたファイルの総数がシステム全体の上限に達していた。 .TP \fBEOPNOTSUPP\fP 指定されたプロトコルではソケットのペアの作成がサポートされていない。 .TP \fBEPROTONOSUPPORT\fP このマシンでは指定されたプロトコルがサポートされていない。 .SH 準拠 POSIX.1\-2001, POSIX.1\-2008, 4.4BSD. \fBsocketpair\fP() は 4.2BSD で登場した。一般に (System\ V の変種を含めて) BSD のソケット層のクローンをサポートしている、BSD 以外のシステムと、 互いに移植性がある。 .SH 注意 .\" commit: 70b03759e9ecfae400605fa34f3d7154cccbbba3 On Linux, the only supported domains for this call are \fBAF_UNIX\fP (or synonymously, \fBAF_LOCAL\fP) and \fBAF_TIPC\fP (since Linux 4.12). .PP Since Linux 2.6.27, \fBsocketpair\fP() supports the \fBSOCK_NONBLOCK\fP and \fBSOCK_CLOEXEC\fP flags in the \fItype\fP argument, as described in \fBsocket\fP(2). .PP POSIX.1 では \fI\fP のインクルードは必須とされておらず、 Linux ではこのヘッダーファイルは必要ではない。 しかし、歴史的には、いくつかの実装 (BSD 系) でこのヘッダーファイルが 必要であり、移植性が必要なアプリケーションではこのファイルを インクルードするのが賢明であろう。 .SH 関連項目 \fBpipe\fP(2), \fBread\fP(2), \fBsocket\fP(2), \fBwrite\fP(2), \fBsocket\fP(7), \fBunix\fP(7) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 5.10 の一部である。プロジェクトの説明とバグ報告に関する情報は \%https://www.kernel.org/doc/man\-pages/ に書かれている。