Syntax
#include <sys/types.h>
#include <sys/socket.h>
int setdomainname(char *name,
int length)
Threadsafe: Yes
|
The setdomainname() function is
used to set the name of the domain.
Parameters
- name
- (Input) The pointer to a character array where the
domain name is stored.
- length
- (Input) The length of the name parameter.
The length can be from 0 to 255 bytes.
Return Value
setdomainname() returns an integer. Possible values are:
- -1 (unsuccessful)
- 0 (successful)
Error Conditions
When setdomainname() 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.
This error code indicates one of the following:
-
The length parameter specifies a negative value
or a value that is greater than the allowed maximum length.
-
The domain name pointed to by the name parameter contains characters
that do not belong to the invariant character set.
- [EIO]
- Input/output error.
- [EPERM]
- Operation not permitted.
The process does not have the appropriate privileges to use
setdomainname().
- [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
-
A process must have the *IOSYSCFG special authority to use
setdomainname().
- The name of the domain is
set to NULL when the pointer to the domain name (pointed to by
the name parameter) is set to NULL.
- setdomainname() only allows domain names that are made up of
invariant characters.
In addition, the domain name is assumed to be in the default coded
character set identifier (CCSID) currently in effect for the job.
Note: For exceptions to the invariant character set for some CCSIDs,
see National Language Support.
Related Information