*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->Tru64 Unix man pages -> getservbyname (3)              
Title
Content
Arch
Section
 

getservbyname(3)

Contents


NAME    [Toc]    [Back]

       getservbyname,  getservbyname_r  -  Get a service entry by
       name

SYNOPSIS    [Toc]    [Back]

       #include <netdb.h>

       struct servent *getservbyname(
               const char *name,
               const char *proto

       );

       [Tru64 UNIX]  The following obsolete function is supported
       in  order to maintain backward compatibility with previous
       versions of the operating system.  You should not  use  it
       in new designs.  int getservbyname_r(
               const char *name,
               const char *proto,
               struct servent *serv,
               struct servent_data *serv_data );

LIBRARY    [Toc]    [Back]

       Standard C Library (libc)

STANDARDS    [Toc]    [Back]

       Interfaces  documented  on  this reference page conform to
       industry standards as follows:

       getservbyname():  XNS4.0, XNS5.0

       Refer to the standards(5) reference page for more information
 about industry standards and associated tags.

PARAMETERS    [Toc]    [Back]

       Specifies  the official name or alias name of the service.
       Specifies the name of the protocol to use when  contacting
       the  service.   [Tru64  UNIX]  For getservbyname_r() only,
       this points to the servent structure.  The netdb.h  header
       file  defines  the  servent  structure.  [Tru64 UNIX]  For
       getservbyname_r() only, this  is  data  for  the  services
       database.   The  netdb.h  header  file  defines  the  servent_data
 structure.

DESCRIPTION    [Toc]    [Back]

       The getservbyname() function returns a pointer to a structure
  of  type servent. Its members specify data in fields
       from a record line in either the local /etc/services  file
       or  the NIS distributed network services database file. To
       determine which file or files  to  search,  and  in  which
       order,  the  system uses the switches in the /etc/svc.conf
       file. The netdb.h header file defines the  servent  structure.


       The getservbyname() function searches the network services
       database file sequentially until a  match  with  the  name
       parameter  and  with  the proto parameter occurs. The name
       parameter can specify either  the  official  name  or  its
       alias.  When  EOF  (End-of-File)  is  reached  without the
       match, a null pointer is returned by this subroutine. When
       the  protocol  name  is  not specified (proto parameter is
       NULL), the proto parameter need not be matched during  the
       network services database file record search.

       Use  the  endservent()  function to close the network services
 database file.

NOTES    [Toc]    [Back]

       The getservbyname() function returns a pointer to  threadspecific
 data. Subsequent calls to this or a related function
 from the same thread overwrite this data.

       [Tru64 UNIX]  The getservbyname_r() function is  an  obsolete
  reentrant  version  of the getservbyname() function.
       It is supported in order to maintain backward  compatibility
  with  previous  versions  of the operating system and
       should not be used in new designs.   Note  that  you  must
       zero-fill  the  servent_data  structure  before  its first
       access by either the setservent_r()  or  getservbyname_r()
       function.

RETURN VALUES    [Toc]    [Back]

       Upon  successful  completion, the getservbyname() function
       returns a pointer to a servent structure.  If it fails  or
       reaches  the end of the network services database file, it
       returns a null pointer.

       [Tru64 UNIX]  Upon successful completion,  the  getservbyname_r()
  function  stores  the  servent  structure in the
       location pointed to by serv, and  returns  a  value  of  0
       (zero).  Upon failure, it returns a value of -1.

ERRORS    [Toc]    [Back]

       [Tru64  UNIX]  If  any of the following conditions occurs,
       the getservbyname_r() function sets errno  to  the  corresponding
   value:  The  serv  or  serv_data  parameter  is
       invalid.  The search failed.

       In addition, if the function fails to open  the  file,  it
       sets errno to indicate the cause of the failure.

FILES    [Toc]    [Back]

       The Internet network service-name database. Each record in
       the file occupies a single line and has four  fields:  the
       official  service name, the port reference, protocol name,
       and aliases.  The database service selection configuration
       file.

SEE ALSO    [Toc]    [Back]

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

       Files: services(4), svc.conf(4).

       Networks: nis_intro(7).

       Standards: standards(5).

       Network Programmer's Guide



                                                 getservbyname(3)
[ Back ]
 Similar pages
Name OS Title
rpccp_add_member HP-UX Adds a member to a group in a name service entry; if the specified entry does not exist, creates the entry
rpccp_add_element HP-UX Adds an element to a profile in a name service entry; if the specified entry does not exist, creates the entry
rpccp_add_entry HP-UX Adds a name service entry to the name service database
rpccp_remove_entry HP-UX Removes a name service entry from the name service database
getservbyport FreeBSD get service entry
endservent OpenBSD get service entry
getservent NetBSD get service entry
getservent Linux get service entry
setservent FreeBSD get service entry
setservent OpenBSD get service entry
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service