Bind a socket to a privileged IP port
Synopsis:
#include <sys/types.h>
#include <rpc/rpc.h>
#include <netinet/in.h>
int bindresvport( int sd,
struct sockaddr_in * sin );
Arguments:
- sd
- The socket descriptor to bind to the port.
- sin
- A pointer to a sockaddr_in structure that specifies the privileged IP port.
Library:
libsocket
Use the -l socket option to
qcc
to link against this library.
Description:
The bindresvport() function binds a socket descriptor to a privileged IP port
(i.e., a port number in the range 0–1023).
Note:
Only root can bind to a privileged port; this call fails for any other user.
Returns:
- 0
- Success.
- -1
- An error occurred
(errno
is set).
Errors:
- EACCES
- You must be root to call bindresvport().
- EADDRINUSE
- The specified address is already in use.
- EADDRNOTAVAIL
- The specified address isn't available from the local machine.
- EBADF
- Invalid descriptor sd.
- EFAULT
- The sin parameter isn't a valid pointer to a sockaddr_in structure.
- EINVAL
- The socket is already bound to a port.
- EPFNOSUPPORT
- The protocol family isn't supported.
Classification:
Unix
Safety: |
|
Cancellation point |
No |
Interrupt handler |
No |
Signal handler |
No |
Thread |
No |