endhostent_r()--Close Host Database
Syntax
#include <netdb.h>
void endhostent_r(struct hostent_data
*hostent_data_struct_addr)
Service Program Name: QSOSRV2
Default Public Authority: *USE
Threadsafe: Yes
The endhostent_r() function is used to close the host database
file. The file is opened by those functions that retrieve information about a
host (for example, gethostent_r()).
Parameters
- struct hostent_data *hostent_data_struct_addr
(input)
- Specifies the pointer to the hostent_data structure, which is used to pass
and preserve results between function calls. The field host_control_blk in the
hostent_data structure must be initialized with hexadecimal zeros before its
initial use. If compatibility with other platforms is required, then the entire
hostent_data structure must be initialized to hexadecimal zeros before initial
use.
Authorities
No authorization is required.
Return Value
The endhostent_r() function returns an integer. Possible values
are:
- -1 (unsuccessful call)
- 0 (successful call)
The struct hostent_datadenoted by
hostent_data_struct_addr is defined in
<netdb.h>.
Error Conditions
When the endhostent_r() function fails, errno can be set
to:
- [EINVAL]
The hostent_data structure was not properly
initialized to hexadecimal zeros before initial use. For corrective action, see
the description for structure hostent_data.
Usage Notes
- When the _XOPEN_SOURCE
macro defined to the value 520 or greater, the host file is always closed. When
the _XOPEN_SOURCE macro is not so defined, the host file will not be closed if a
sethostent_r() call with a nonzero parameter value was previously done.
- The iSeries Navigator or the following CL commands can be
used to access the host database file:
- ADDTCPHTE (Add TCP/IP Host Table Entry)
- RMVTCPHTE (Remove TCP/IP Host Table Entry)
- CHGTCPHTE (Change TCP/IP Host Table Entry)
- RNMTCPHTE (Rename TCP/IP Host Table Entry)
- MRGTCPHT (Merge TCP/IP Host Tables)
- When you develop in C-based languages and an application is compiled with
the _XOPEN_SOURCE macro defined to the value 520 or greater, the endhostent_r()
API is mapped to qso_endhostent_r98().
Related Information
API introduced: V4R2