Open System Services System Calls Reference Manual (G06.28+, H06.05+)

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 buen
);
PARAMETERS
num Species the protocol number.
ret Points to a protoent structure allocated by the caller.
buffer Points to the buffer supplied by the caller used as a storage space for returned
data.
buflen Species 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 le starting at the rst 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
le. The netdb.h header le denes 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 buen 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 this condition occurs, the getprotobynumber_r() function sets errno to the corresponding
value:
[ERANGE] Insufcient storage was supplied via buffer and buen to contain the data to be
referenced by the resulting protoent structure.
FILES
/etc/protocols The Internet network protocols database le.
527186-007 Hewlett-Packard Company 399