Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ setservent_r(3) — OSF/1 3.0 αXP

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

endservent(3)

getservbyname(3)

getservbyport(3)

getservent(3)

setservent(3)  —  Subroutines

NAME

setservent, setservent_r − Open or rewind the services file

LIBRARY

Standard C Library (libc.a)

SYNOPSIS

#include <netdb.h> int setservent(
int stay_open); int setservent_r(
int stay_open,
struct servent_data ∗serv_data);

PARAMETERS

stay_openIndicates when to close the services file.  Specifying a value of 0 (zero) closes the file after each call to the getservent() function.  Specifying a nonzero value allows the file to remain open after each call. 

serv_dataPoints to a structure where setservent_r() stores information about the services file. 

DESCRIPTION

The setservent() (set service entry) function opens the /etc/services file and sets the file marker at the beginning of the file. 

The setservent_r() function is the reentrant version of the setservent() function.  Note that before calling the setservent_r() function for the first time, you must zero-fill the servent_data structure.  The netdb.h header file defines the servent_data structure. 

The system searches either the local /etc/services file or the NIS distributed networks file for the requested information.  To determine which file or files to search, and in which order, the system uses the switches in the /etc/svc.conf file. 

RETURN VALUES

Upon successful completion, the setservent() function returns a 1 for success.  Otherwise, it returns a value of 0 (zero). 

Upon successful completion, the setservent_r() function returns a value of 0 (zero).  Otherwise, it returns a value of -1. 

ERRORS

If any of the following conditions occurs, the setservent_r() function sets errno to the corresponding value:

EINVALIf serv_data is invalid. 

In addition, the setservent() and setservent_r() functions can fail to open the file.  In this case, errno will be set to the failure. 

FILES

/etc/services
Contains service names.

RELATED INFORMATION

Functions: endservent(3), getservbyname(3), getservbyport(3), getservent(3). 

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026