Open System Services Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)
getservent(3) OSS Library Calls Reference Manual
NAME
getservent - Gets the next entry from the network services database
LIBRARY
G-series native OSS processes: /G/system/sysnn/zinetsrl
32-bit H-series and J-series OSS processes: /G/system/zdllnnn/zinetdll |
64-bit H-series and J-series OSS processes: /G/system/zdllnnn/yinetdll |
SYNOPSIS
#include <netdb.h>
struct servent *getservent(void);
PARAMETERS
None.
DESCRIPTION
The getservent() (get service entry) function reads the next line of the /etc/services file.
The getservent() 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.
If multiple threads interleave calls to getservbyname_r( ), getservbyport_r( ), getservent_r( )
and their base versions, the threads enumerate disjoint subsets of the services database.
NOTES
The getservent() return value points to static data, which is overwritten by any calls to get-
servbyport( ), getservbyname( ), tservent( ),orsetservent().
In a threaded environment, the behavior of the application is undetermined if more than one
thread in application is calling different sequences of the setservent(), getservbyport(),
getservbyport_r( ), getservbyname( ), getservbyname_r( ), or endservent( ) functions.
RETURN VALUES
Upon successful completion, the getservent( ) function returns a pointer to a servent structure.
If an error occurs or the end of the file is reached, the getservent( ) function returns a null pointer.
ERRORS
The getservent() function does not set errno.
FILES
/etc/services The Internet network service name database file. Each record in the file occupies
a single line and has four fields: the official service name, the port number, the
protocol name, and aliases.
RELATED INFORMATION
Functions: getservbyport(3), getservbyname(3), endservent(3), setservent(3).
Files: services(4).
3−144 Hewlett-Packard Company 527187-017