getdomainname()--Retrieve Domain Name



Syntax

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

int getdomainname(char *name,
                  int length)


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:

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

Return Value

getdomainname() returns an integer. Possible values are:

Error Conditions

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

[EFAULT]
Bad address.

The system detected an address which was not valid while attempting to access the name parameter.

[EINVAL]
Parameter not valid.

The length parameter specifies a negative value.

[EIO]
Input/output error.
[EUNKNOWN]
Unknown system state.

Error Messages

CPE3418 E
Possible APAR condition or hardware failure.
CPF9872 E
Program or service program &1 in library &2 ended. Reason code &3.
CPFA081 E
Unable to set return value or error code.

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


Top | Sockets APIs | APIs by category


[Information Center Home Page | Feedback ] [Legal | AS/400 Glossary]