@comment The start of a comment is indicated by the following comment. This @comment syntax is used by the script funcstxh.sh: @comment function @comment function rresvport @node rresvport, rexec @findex rresvport @c This file was originally a Linux man page - see the copyright below. It @c was modified for use in libsocket by Richard Dawe . @c $NetBSD: rcmd.3,v 1.9 1996/05/28 02:07:39 mrg Exp $ @c @c Copyright (c) 1983, 1991, 1993 @c The Regents of the University of California. All rights reserved. @c @c Redistribution and use in source and binary forms, with or without @c modification, are permitted provided that the following conditions @c are met: @c 1. Redistributions of source code must retain the above copyright @c notice, this list of conditions and the following disclaimer. @c 2. Redistributions in binary form must reproduce the above copyright @c notice, this list of conditions and the following disclaimer in the @c documentation and/or other materials provided with the distribution. @c 3. All advertising materials mentioning features or use of this software @c must display the following acknowledgement: @c This product includes software developed by the University of @c California, Berkeley and its contributors. @c 4. Neither the name of the University nor the names of its contributors @c may be used to endorse or promote products derived from this software @c without specific prior written permission. @c @c THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND @c ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE @c IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @c ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE @c FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL @c DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS @c OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) @c HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT @c LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY @c OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF @c SUCH DAMAGE. @c @c @(#)rcmd.3 8.1 (Berkeley) 6/4/93 @c @c Contributed as Linux man page by David A. Holland, 970908 @c I have not checked whether the Linux situation is exactly the same. @c @c Modified by Richard Dawe for incorporation into @c libsocket 0.7.4. @c @subheading Syntax @example #include #include int rresvport (int *port); @end example @subheading Description The @code{rresvport()} function is used to obtain a socket with a privileged address bound to it. This socket is suitable for use by @code{rcmd()} (@pxref{rcmd}) and several other functions. Privileged Internet ports are those in the range 0 to 1023. Only the super-user is allowed to bind an address of this sort to a socket. @subheading Return Value The @code{rresvport()} function returns a valid, bound socket descriptor on success. It returns -1 on error with @var{errno} set according to the reason for failure. The error code @samp{EAGAIN} is overloaded to mean "All network ports in use". @subheading Portability @c TODO libsocket declares this function in @samp{sys/socket.h}, but it's usually defined in @samp{unistd.h}. @subheading Example @example @end example