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 $
3 .\" $DragonFly: src/lib/libc/rpc/bindresvport.3,v 1.2 2003/06/17 04:26:44 dillon Exp $
11 .Nd bind a socket to a privileged IP port
15 .Fn bindresvport "int sd" "struct sockaddr_in *sin"
17 .Fn bindresvport_sa "int sd" "struct sockaddr *sa"
22 are used to bind a socket descriptor to a privileged
25 port number in the range 0-1023.
27 Only root can bind to a privileged port; this call will fail for any
34 must be initialized to the address family of the socket, passed by
36 If the value of sin->sin_port is non-zero
38 will attempt to use that specific port. If it fails, it chooses another
39 privileged port automatically.
41 It is legal to pass null pointer to
43 In this case, the caller cannot get the port number
53 acts exactly the same, with more neutral function prototype.
54 Note that both functions behave exactly the same, and
64 return 0 if they are successful, otherwise \-1 is returned and
66 set to reflect the cause of the error.
76 is not a valid descriptor.
80 .It Bq Er EADDRNOTAVAIL
81 The specified address is not available from the local machine.
83 The specified address is already in use.
85 The socket is already bound to an address,
86 or the socket family and the family of specified address mismatch.
88 The requested address is protected, and the current user
89 has inadequate permission to access it.
93 parameter is not in a valid part of the user
96 Insufficient resources were available in the system
97 to perform the operation.
98 .It Bq Er EPFNOSUPPORT
99 The protocol family has not been configured into the
100 system, no implementation for it exists,
101 or address family did not match between arguments.