Open System Services Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)
OSS Library Calls (g - h) getprotoent_r(3)
On systems running H06.24 or later H-series RVUs or J06.13 or later J-series RVUs, you can use |
this function with 32-bit applications or 64-bit applications unless you are using the Standard |
POSIX Threads Library.
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 Programmer’s 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 setprotoent( ), getprotoent( ),
getprotoent_r( ), getprotobyname( ), getprotobyname_r( ), or endprotoent( ) functions.
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.
The structure of type protoent is defined in the netdb.h header file as:
struct protoent {
char *p_name;
char **p_aliases;
int p_proto;
};
The fields of this structure are:
p_name Points to the official name of the protocol.
p_aliases Points to an array of null-terminated pointers to the alternate names for protocol.
p_proto Is the protocol number.
ERRORS
If this 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.
527187-017 Hewlett-Packard Company 3−115