Open System Services Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)

getnetent_r(3) OSS Library Calls Reference Manual
If you are NOT using the Standard POSIX Threads Library (this is not a threaded application or
you are using the POSIX User Thread Model Library), you must:
Include the netdb.h header file
If you are using the Standard POSIX Threads library, you must:
Include the spthread.h header file
Link your application to:
/G/system/sysnn/zsptsrl (G-series)
or
/G/system/zdllnnn/zsptdll (H-series or J-series)
Compile your application using the #define _SPT_MODEL_ macro or an equivalent
compiler command option
If you are using this function in a threaded or 64-bit application in a system running H06.21 or a |
later H-series RVU or J06.10 or a later J-series RVU, you might need to include additional files |
or use additional macros. For more information about threaded and 64-bit applications in the |
OSS environment, see the Open System Services Programmers Guide.
In a threaded environment, the behavior of the application is undetermined if more than one
thread in application is calling different sequences of the setnetent( ), getnetent( ),
getnetent_r( ), getnetbyaddr( ), getnetbyaddr_r( ), getnetbyname( ), getnetbyname_r( ), or
endnetent( ) functions.
RETURN VALUES
Upon successful completion, the getnetent_r( ) function returns a pointer to a netent structure if
the next entry was retrieved, and a null pointer if the end of the file was reached. If the call to
getnetent_r( ) fails, a null pointer is returned. If an entry is found, the pointer returned by this
function points to the same netent structure as pointed to by the result parameter.
The structure of type netent is defined in the netdb.h header file as:
struct netent {
char *n_name;
char **n_aliases;
int n_addrtype;
uint32_t n_net;
};
The fields of this structure are:
n_name Points to the official name of the network.
n_aliases Points to an array of null-terminated pointers to the alternate names for the net-
work.
n_addrtype The type of network number being returned. Its value is always AF_INET, which
indicates that this is the network potion of an Internet address.
n_net Is the network number, in host order.
ERRORS
If this condition occurs, the getnetent_r() function sets errno to the corresponding value:
394 Hewlett-Packard Company 527187-017