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.3 2007/08/18 20:48:47 swildner Exp $
11 .Nd bind a socket to a privileged IP port
17 .Fn bindresvport "int sd" "struct sockaddr_in *sin"
19 .Fn bindresvport_sa "int sd" "struct sockaddr *sa"
24 are used to bind a socket descriptor to a privileged
27 port number in the range 0-1023.
29 Only root can bind to a privileged port; this call will fail for any
36 must be initialized to the address family of the socket, passed by
38 If the value of sin->sin_port is non-zero
40 will attempt to use that specific port. If it fails, it chooses another
41 privileged port automatically.
43 It is legal to pass null pointer to
45 In this case, the caller cannot get the port number
55 acts exactly the same, with more neutral function prototype.
56 Note that both functions behave exactly the same, and
66 return 0 if they are successful, otherwise \-1 is returned and
68 set to reflect the cause of the error.
78 is not a valid descriptor.
82 .It Bq Er EADDRNOTAVAIL
83 The specified address is not available from the local machine.
85 The specified address is already in use.
87 The socket is already bound to an address,
88 or the socket family and the family of specified address mismatch.
90 The requested address is protected, and the current user
91 has inadequate permission to access it.
95 parameter is not in a valid part of the user
98 Insufficient resources were available in the system
99 to perform the operation.
100 .It Bq Er EPFNOSUPPORT
101 The protocol family has not been configured into the
102 system, no implementation for it exists,
103 or address family did not match between arguments.