getdomainname()--Retrieve Domain Name


  Syntax
 #include <sys/types.h>
 #include <sys/socket.h>

 int getdomainname(char *name,
                   int length)

  Service Program Name: QSOSRV1

  Default Public Authority: *USE

  Threadsafe: Yes

The getdomainname() function is used to retrieve the name of the domain from the system.

Parameters

name
(Output) The name parameter can be one of the following:
  • The pointer to a character array where the domain name is to be stored. The domain name is NULL-terminated unless the length of the domain name exceeds the length of the name parameter. In that case the domain name is truncated to the size of the name parameter.

  • A NULL string when a sethostname() has not been previously issued since the last initial program load.


length
(Input) The length of the name parameter. Maximum length of domain names is 255.

Authorities

None.


Return Value

getdomainname() returns an integer. Possible values are:


Error Conditions

When getdomainname() fails, errno can be set to one of the following:



Error Messages



Usage Notes

  1. When a process issues a setdomainname(), the name of the domain can be accessed by any process that issues a getdomainname().

  2. The name of the domain is reset to NULL when an initial program load is performed.

    Note: The domain name returned by this function is NOT related to the domain name of the domain name server that is configured using the Configure TCP/IP (CFGTCP) menu.

  3. The domain name is returned in the default coded character set identifier (CCSID) currently in effect for the job.

Related Information



API introduced: V3R1

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