Open System Services System Calls Reference Manual (G06.28+)
System Functions (f - i) getprotobynumber_r(2)
NAME
getprotobynumber_r - Gets a protocol entry by number (reentrant)
LIBRARY
G-series native OSS processes: /G/system/sysnn/zsptsrl
H-series OSS processes: /G/system/zdllnnn/zsptdll
SYNOPSIS
[#include <netdb.h>]
#include <spthread.h>
struct protoent *getprotobynumber_r (
int num,
struct protoent *ret,
char *buffer,
int buflen
);
PARAMETERS
num Specifies the protocol number.
ret Points to a struct protoent structure allocated by the caller.
buffer Points to the buffer supplied by the caller used as a storage space for returned
data.
buflen Specifies the size of the buffer passed in bytes.
DESCRIPTION
The getprotobynumber_r() function is the reentrant version of the getprotobynumber( ) func-
tion.
The getprotobynumber_r() function searches the /etc/protocols file starting at the first entry
until a match with the num parameter is found. This function returns a pointer to a structure of
type protoent whose members specify data from the /etc/protocols network protocols database
file. The netdb.h header file defines the protoent structure.
The getprotobynumber_r() function updates the protoent structure pointed to by the ret param-
eter. Storage referenced by the protoent structure is allocated from the memory provided using
the buffer parameter, which is buflen characters in size.
RETURN VALUES
Upon successful completion, the getprotobynumber_r() function returns a pointer to a pro-
toent structure if the entry was found, and a null pointer if the entry was not found. If the call to
getprotobynumber() fails, a null pointer is returned.
ERRORS
If the following condition occurs, the getprotobynumber_r() function sets errno to the
corresponding value:
[ERANGE] Insufficient storage was supplied via buffer and buflen to contain the data to be
referenced by the resulting protoent structure.
FILES
/etc/protocols The Internet network protocols database file.
527186-005 Hewlett-Packard Company 3−79