Open System Services System Calls Reference Manual (G06.28+)
System Functions (f - i) getprotobyname_r(2)
NAME
getprotobyname_r - Gets a protocol entry by name (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 *getprotobyname_r (
const char *name,
struct protoent *ret,
char *buffer,
int buflen
);
PARAMETERS
name Specifies the protocol name or alias.
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 getprotobyname_r( ) function is the reentrant version of the getprotobyname() function.
The getprotobyname_r( ) function searches the network protocols database file /etc/protocols
sequentially until a match with name 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 getprotobyname_r( ) function updates the protoent structure pointed to by the ret parame-
ter. 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 getprotobyname_r( ) function returns a pointer to a protoent
structure if the requested entry is found, and a null pointer if it is not found. If the call to
getprotobyname_r( ) fails, a null pointer is returned.
ERRORS
If the following condition occurs, the getprotobyname_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−77