1 .\" @(#)bindresvport.3n 2.2 88/08/02 4.0 RPCSRC; from 1.7 88/03/14 SMI
2 .\" $FreeBSD: src/lib/libc/rpc/bindresvport.3,v 1.10.2.2 2001/12/14 18:33:56 ru Exp $
10 .Nd bind a socket to a privileged IP port
14 .Fn bindresvport "int sd" "struct sockaddr_in *sin"
16 .Fn bindresvport_sa "int sd" "struct sockaddr *sa"
21 are used to bind a socket descriptor to a privileged
24 port number in the range 0-1023.
26 Only root can bind to a privileged port; this call will fail for any
33 must be initialized to the address family of the socket, passed by
35 If the value of sin->sin_port is non-zero
37 will attempt to use that specific port. If it fails, it chooses another
38 privileged port automatically.
40 It is legal to pass null pointer to
42 In this case, the caller cannot get the port number
52 acts exactly the same, with more neutral function prototype.
53 Note that both functions behave exactly the same, and
63 return 0 if they are successful, otherwise \-1 is returned and
65 set to reflect the cause of the error.
75 is not a valid descriptor.
79 .It Bq Er EADDRNOTAVAIL
80 The specified address is not available from the local machine.
82 The specified address is already in use.
84 The socket is already bound to an address,
85 or the socket family and the family of specified address mismatch.
87 The requested address is protected, and the current user
88 has inadequate permission to access it.
92 parameter is not in a valid part of the user
95 Insufficient resources were available in the system
96 to perform the operation.
97 .It Bq Er EPFNOSUPPORT
98 The protocol family has not been configured into the
99 system, no implementation for it exists,
100 or address family did not match between arguments.