getservent man page on HP-UX

Man page or keyword search:  
man Server   10987 pages
apropos Keyword Search (all sections)
Output format
HP-UX logo
[printable version]

getservent(3N)							getservent(3N)

       getservent(),  getservbyport(),	getservbyname(), setservent(), endser‐
       vent() - get, set, or end service entry

       The and functions each return a pointer to a structure of type  servent
       containing the broken-out fields of a line in the network services data

       The members of this structure are:

	      The official name of the service.

	      A null-terminated list of alternate names for the service.

	      The port number at which the service resides.

	      The name of the protocol to use when contacting the

       Functions behave as follows:

	      Reads the next line of the file, opening the file if necessary.

	      Opens and rewinds the file.
				       If the stayopen flag is	non-zero,  the
				       services	 data base is not closed after
				       each call to (either directly or	 indi‐
				       rectly through one of the other calls).

	      Closes the file.

	      Each sequentially searches from the beginning of the file
				       until  a	 matching  service name (among
				       either  the  official  names   or   the
				       aliases)	 or  port  number is found, or
				       until EOF is encountered.   If  a  non-
				       NULL  protocol  name  is	 also supplied
				       (such as or searches  must  also	 match
				       the protocol.
       If  the	system	is running the Network Information Service (NIS), gets
       the service  information	 from  the  NIS	 server	 (see  ypserv(1M)  and

       In a multithreaded application, and use thread-specific storage that is
       re-used in each call. The return value should be unique for each thread
       and should be saved, if desired, before the thread makes the next call.

       For  enumeration in multithreaded applications, the position within the
       enumeration is a process-wide property shared by all threads.   may  be
       used  in	 a multithreaded application, but resets the enumeration posi‐
       tion for all threads. If	 multiple  threads  interleave	calls  to  the
       threads will enumerate disjoint subsets of the service database.

   Name Service Switch-Based Operation
       The  library routines and their reentrant counterparts, internally call
       the name service switch to access the "services" database lookup policy
       configured  in  the  file  (see	nsswitch.conf(4)).   The lookup policy
       defines the order and the criteria of the supported name services  used
       to resolve service names and ports.

       The  above  reentrant  interfaces  have	been   moved  from to They are
       included to support existing applications  and  may  be	removed	 in  a
       future  release.	 New multithreaded applications should use the regular
       APIs without the suffix.

       The reentrant interfaces performs the same operations as their  regular
       counterpart  (those  without  the  suffix.)   However, and expect to be
       passed the address of a and will store the address  of  the  result  at
       this  supplied  parameter.   An	additional  parameter, an address to a
       struct servent_data, which is  defined in the file  cannot  be  a  NULL

       The  reentrant routines return if the operation is unsuccessful, or, in
       the case of if the end of the  services	list  has  been	 reached.   is
       returned otherwise.

       and return a null pointer (0) on EOF or when they are unable to open

       The following code excerpt counts the number of service entries:

       Programs	 that  use  the interfaces described in this manpage cannot be
       linked statically because the implementations of these functions employ
       dynamic loading and linking of shared objects at run time.

       was developed by Sun Microsystems Inc.

       ypserv(1M),	 services(4),	    ypfiles(4),	     nsswitch.conf(4),


List of man pages available for HP-UX

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
Vote for polarhome
Free Shell Accounts :: the biggest list on the net