rresvport()

obtain a socket with a privileged address

Synopsis:

#include <resolv.h>

int rresvport( int *port );

Description:

The rresvport() function returns a descriptor to a socket with an address in the privileged port space. The ruserok() function is used by servers to authenticate clients requesting service with rcmd(). All three functions are present in the same file and are used by the rshd server, among others.

The rresvport() function obtains a socket with a privileged address bound to it. This socket can be used by rcmd() and several other functions. Privileged Internet ports are those in the range 0 to 1023. Only the superuser may bind this type of address to a socket.

Returns:

A valid, bound socket descriptor. If an error occurs, -1 is returned and errno is set.

Errors:

The error code EAGAIN is overloaded to mean ``All network ports in use.''

Classification:

UNIX

Safety:
Interrupt handler No
Signal handler No
Thread Yes

See also:

rcmd(), ruserok()