sgi_bindrpcport(3R)
sgi_bindrpcport - bind a name allowed for an RPC program to a socket
As shipped in IRIX 6.5.22. Added in IRIX 6.5.22.
NAME sgi_bindrpcport - bind a name allowed for an RPC program to a socket SYNOPSIS #include <netdb.h> int sgi_bindrpcport(int s, int prog, int proto, struct sockaddr *sa); DESCRIPTION Sgi_bindrpcport binds a socket address which is allowed for the RPC program number prog and transport protocol proto to the socket s. If the sa argument is NULL or points to a socket address whose sa_family field is the constant AF_UNSPEC, the name bound is the wildcard IP address INADDR_ANY with a port allowed for the program number and transport protocol, as controlled by the /etc/rpcports file (see rpcports(4)). Otherwise, the name bound is the IP address specified in *sa with an allowed port. If the sa argument is not NULL, it is filled in with the actual name bound on a successful return. The proto argument must be either IPPROTO_UDP or IPPROTO_TCP. If the range of ports allowed by the /etc/rpcports file contains both reserved and non-reserved ports, all the reserved ports are tried before any non-reserved ports are tried. For reserved ports, sgi_bindrpcport will attempt to add the CAP_PRIV_PORT capability to the effective capability set before binding and will restore the original effective capability set on return (see capabilities(4)). RETURN VALUE If an address was successfully bound to the socket, 0 is returned and the address bound is written to *sa (if sa is not NULL). If no address could be bound, -1 is returned and errno further specifies the error. ERRORS [EBADF] S is not a valid descriptor. [ENOTSOCK] S is not a socket. [EADDRNOTAVAIL] The specified address is not available from the local machine. [ENOENT] The /etc/rpcports file was missing, or the file contained no rules, or there was a syntax error in the file, or no rules matched the program and transport, or the matching rules resulted in an empty port range. [EADDRINUSE] A non-empty range of ports was specified in the /etc/rpcports file and all ports in the range are already in use. [EINVAL] The socket is already bound to an address. [EFAULT] The sa parameter is not NULL and is not in a valid part of the user address space. [EAFNOSUPPORT] The sa parameter points to a socket address of an unsupported family, or sa was NULL and the socket's address family was not supported. FILES /etc/rpcports SEE ALSO bind(2), rpcports(4), capabilities(4). ORIGIN Sgi_bindrpcport is specific to IRIX and first appeared in IRIX 6.5.20. An application wishing to use this function and to be capable of running on releases of IRIX prior to 6.5.20 should use the _MIPS_SYMBOL_PRESENT macro to test for the presence of the functions.