Open System Services System Calls Reference Manual (G06.28+)
System Functions (f - i) getprotoent_r(2)
NAME
getprotoent_r - Gets the next protocol entry (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 *getprotoent_r (
struct protoent *ret,
char *buffer,
int buflen
);
PARAMETERS
ret Points to a struct protoent structure allocated by the caller.
buffer Points to the buffer supplied by the caller and used as a storage space for
returned data.
buflen Specifies the size of the buffer passed in bytes.
DESCRIPTION
The getprotoent_r() function is the reentrant version of the getprotoent( ) function.
The getprotoent_r() (get protocol entry) function retrieves the next entry from /etc/protocols,
the network protocol database. This function returns a pointer to a protoent structure, whose
members contain information from the /etc/protocols file. The netdb.h header file defines the
protoent structure.
An application program can use the getprotoent_r() function to access a protocol name, its
aliases, and protocol number. Use the endprotoent() function to close the /etc/protocols file.
The getprotoent_r() function updates the protoent structure pointed to by the ret parameter.
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 getprotoent_r() function returns a pointer to a protoent struc-
ture if an entry was found, and a null pointer if the end of the file was reached. If the call to
getprotoent_r() fails, a null pointer is returned.
ERRORS
If the following condition occurs, the getprotoent_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.
527186-005 Hewlett-Packard Company 3−81