.\" Copyright (C) 2007, Michael Kerrisk .\" and Copyright (C) 2008, Linux Foundation, written by Michael Kerrisk .\" .\" 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. .\" .\" 2007-05-31, mtk: Rewrite and substantial additional text. .\" 2008-12-03, mtk: Rewrote some pieces and fixed some errors .\" .\" Japanese Version Copyright (c) 1999 Shouichi Saito all rights reserved. .\" Translated 1999-08-28, Shouichi Saito .\" Proofed 1999-09-25, NAKANO Takeo .\" Updated 2007-06-11, Akihiro MOTOKI , LDP v2.54 .\" Updated 2008-12-24, Akihiro MOTOKI , LDP v3.15 .\" .TH BINDRESVPORT 3 2008-12-03 "" "Linux Programmer's Manual" .\"O .SH NAME .SH 名前 .\"O bindresvport \- bind a socket to a privileged IP port bindresvport \- ソケットを特権 IP ポートにバインドする .\"O .SH SYNOPSIS .SH 書式 .nf .B #include .B #include .LP .BI "int bindresvport(int " sockfd ", struct sockaddr_in *" sin ); .fi .\"O .SH DESCRIPTION .SH 説明 .LP .\"O .BR bindresvport () .\"O is used to bind a socket descriptor to a privileged anonymous IP port, .\"O that is, a port number arbitrarily selected from the range 512 to 1023. .BR bindresvport () は、ソケット・ディスクリプタを特権無名 (privileged anonymous) IP ポートに バインドするのに使う。特権無名 IP ポートとは、 ポート番号が 512 から 1023 の範囲から任意に選択されるポートである。 .\" Glibc actually starts searching with a port # in the range 600 to 1023 .\"O If the .\"O .BR bind (2) .\"O performed by .\"O .BR bindresvport () .\"O is successful, and .\"O .I sin .\"O is not NULL, then .\"O .I sin\->sin_port .\"O returns the port number actually allocated. .BR bindresvport () によって実行された .BR bind (2) が成功し、 .I sin が NULL 以外の場合、実際に割り当てられたポート番号が .I sin\->sin_port に入れて返される。 .\"O .I sin .\"O can be NULL, in which case .\"O .I sin\->sin_family .\"O is implicitly taken to be .\"O .BR AF_INET . .\"O However, in this case, .\"O .BR bindresvport () .\"O has no way to return the port number actually allocated. .\"O (This information can later be obtained using .\"O .BR getsockname (2).) .I sin には NULL を指定することもでき、その場合には .I sin\->sin_family は暗黙のうちに .B AF_INET とみなされる。 しかし、この場合には、 .BR bindresvport () は実際に割り当てられたポート番号を返す手段を持たない (割り当てられたポート番号は、後で .BR getsockname (2) を使って取得できる)。 .\"O .SH RETURN VALUE .SH 返り値 .\"O .BR bindresvport () .\"O returns 0 on success; otherwise \-1 is returned and .\"O .I errno .\"O set to indicate the cause of the error. .BR bindresvport () は成功すると 0 を返す。それ以外の場合、\-1 を返し、 .I errno にエラーの原因を示す値を設定する。 .\"O .SH ERRORS .SH エラー .\"O .BR bindresvport () .\"O can fail for any of the same reasons as .\"O .BR bind (2). .BR bindresvport () は .BR bind (2) と同じ原因で失敗する可能性がある。 .\"O In addition, the following errors may occur: さらに、以下のエラーが発生することがある: .TP .BR EACCES .\"O The caller did not have superuser privilege (to be precise: the .\"O .B CAP_NET_BIND_SERVICE .\"O capability is required). 呼び出し元がスーパーユーザの特権を持っていなかった (より正確に言うと、 .B CAP_NET_BIND_SERVICE ケーパビリティが必要である)。 .TP .B EADDRINUSE .\"O All privileged ports are in use. 全ての特権ポートが使用中である。 .TP .\"O .BR EAFNOSUPPORT " (" EPFNOSUPPORT " in glibc 2.7 and earlier)" .BR EAFNOSUPPORT " (glibc 2.7 以前では " EPFNOSUPPORT ")" .\"O .I sin .\"O is not NULL and .\"O .I sin->sin_family .\"O is not .\"O .BR AF_INET . .I sin が NULL 以外で、かつ .I sin->sin_family が .B AF_INET でなかった。 .\"O .SH "CONFORMING TO" .SH 準拠 .\"O Not in POSIX.1-2001. .\"O Present on the BSDs, Solaris, and many other systems. POSIX.1-2001 にはない。 BSD, Solaris およびその他の多くのシステムに存在する。 .\"O .SH NOTES .SH 注意 .LP .\"O Unlike some .\"O .BR bindresvport () .\"O implementations, .\"O the glibc implementation ignores any value that the caller supplies in .\"O .IR sin\->sin_port . .BR bindresvport () のいくつかの実装と異なり、glibc の実装では呼び出し元が .I sin\->sin_port で渡した値はどんな値であっても無視される。 .\"O .SH SEE ALSO .SH 関連項目 .BR bind (2), .BR getsockname (2)