endservent_r()--Close Service Database


  Syntax
 #include <netdb.h>
 int endservent_r(struct servent_data
                  *servent_data_struct_addr)

  Service Program Name: QSOSRV1

  Default Public Authority: *USE

  Threadsafe: Yes

The endservent_r() function is used to close the service database file. The file is opened by those functions that retrieve information about services (for example, getservent_r()).

Parameters

struct servent_data *servent_data_struct_addr  (input) 
Specifies the pointer to the servent_data structure, which is used to pass and preserve results between function calls. The field serve_control_blk in the servent_data structure must be initialized with hexadecimal zeros before its initial use. If compatibility with other platforms is required, then the entire servent_data structure must initialized with hexadecimal zeros before initial use.

Authorities

No authorization is required.


Return Value

The endservent_r() function returns an integer. Possible values are:

The struct servent_datadenoted by servent_data_struct_addr is defined in <netdb.h>.


Error Conditions

When the endservent_r() function fails, errno can be set to:

[EINVAL]

The servent_data structure was not properly initialized with hexadecimal zeros before initial use. For corrective action,see the description for structure servent_data.


Usage Notes

  1. When the _XOPEN_SOURCE macro defined to the value 520 or greater, the services file is always closed. When the _XOPEN_SOURCE macro is not so defined, the services file will not be closed if a setservent_r() call with a non-zero parameter value was previously done.

  2. System i® Navigator or the following CL commands can be used to access the services database file:


  3. 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 endservent_r() API is mapped to qso_endservent_r98().

Related Information



API introduced: V4R2

[ Back to top | >UNIX-Type APIs | APIs by category ]