Open System Services System Calls Reference Manual (G06.28+)
System Functions (f - i) getservent_r(2)
NAME
getservent_r - Gets the next entry from the network services database (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 servent *getservent_r (
struct servent *ret,
char *buffer,
int buflen
);
PARAMETERS
ret Points to a struct servent 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 getservent_r() function is the reentrant version of the getservent() function.
The getservent_r() (get service entry) function reads the next line of the /etc/services file. This
function returns a pointer to a servent structure, which contains fields for a line of information
from the /etc/services file. The servent structure is defined in the netdb.h header file.
The getservent_r() function updates the servent structure pointed to by the ret parameter.
Storage referenced by the servent structure is allocated from the memory provided using the
buffer parameter, which is buflen characters in size.
RETURN VALUES
Upon successful completion, the getservent_r() function returns a pointer to a servent structure.
If an error occurs or the end of the file is reached, the getservent_r() function returns a null
pointer.
ERRORS
If the following condition occurs, the getservent_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 servent structure.
FILES
/etc/services The Internet network service name database file.
RELATED INFORMATION
Functions: getservent(3), getservbyport(3), getservbyport_r(2), getservbyname(3),
getservbyport_r(2), endservent(3), setservent(3).
Files: services(4).
527186-005 Hewlett-Packard Company 3−95