setservent_r()--Open Service Database


  Syntax
 #include <netdb.h>

 int setservent_r(int stay_open,
       struct servent_data *servent_data_struct_addr)

  Service Program Name: QSOSRV2

  Default Public Authority: *USE

  Threadsafe: Yes

The setservent_r() function is used in preparation for sequential access to the service database file. The setservent_r() function opens the file and repositions the file marker to the beginning of the file.


Parameters

int stay_open  (input) 
Specifies whether to leave the database file open after each call to getservbyname_r() and getservbyport_r(). A non-zero value will result in the database file being left open.

struct servent_data *servent_data_struct_addr  (input/output) 
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 be initialized with hexadecimal zeros before initial use.

Authorities

No authorization is required.


Return Value

The setservent_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 setservent_r() function fails, errno can be set to:

[EINVAL]

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


Usage Notes

The iSeries Navigator or the following CL commands can be used to access the services database file:


Related Information



API introduced: V4R2
Top | UNIX-Type APIs | APIs by category