1GETDOMAINNAME(2)           Linux Programmer's Manual          GETDOMAINNAME(2)
2
3
4

NAME

6       getdomainname, setdomainname - get/set NIS domain name
7

SYNOPSIS

9       #include <unistd.h>
10
11       int getdomainname(char *name, size_t len);
12       int setdomainname(const char *name, size_t len);
13
14   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
15
16       getdomainname(), setdomainname():
17           Since glibc 2.21:
18               _DEFAULT_SOURCE
19           In glibc 2.19 and 2.20:
20               _DEFAULT_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE < 500)
21           Up to and including glibc 2.19:
22               _BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE < 500)
23

DESCRIPTION

25       These  functions are used to access or to change the NIS domain name of
26       the host system.
27
28       setdomainname() sets the domain name to the value given in the  charac‐
29       ter  array  name.   The  len  argument specifies the number of bytes in
30       name.  (Thus, name does not require a terminating null byte.)
31
32       getdomainname() returns the null-terminated domain name in the  charac‐
33       ter  array  name,  which has a length of len bytes.  If the null-termi‐
34       nated domain name requires more than len bytes, getdomainname() returns
35       the first len bytes (glibc) or gives an error (libc).
36

RETURN VALUE

38       On  success,  zero is returned.  On error, -1 is returned, and errno is
39       set appropriately.
40

ERRORS

42       setdomainname() can fail with the following errors:
43
44       EFAULT name pointed outside of user address space.
45
46       EINVAL len was negative or too large.
47
48       EPERM  The caller did not have the CAP_SYS_ADMIN capability in the user
49              namespace associated with its UTS namespace (see namespaces(7)).
50
51       getdomainname() can fail with the following errors:
52
53       EINVAL For  getdomainname()  under libc: name is NULL or name is longer
54              than len bytes.
55

CONFORMING TO

57       POSIX does not specify these calls.
58

NOTES

60       Since Linux 1.0, the limit on the length of a  domain  name,  including
61       the  terminating  null  byte,  is 64 bytes.  In older kernels, it was 8
62       bytes.
63
64       On most Linux architectures (including x86),  there  is  no  getdomain‐
65       name()  system  call;  instead,  glibc  implements getdomainname() as a
66       library function that returns a copy of the domainname  field  returned
67       from a call to uname(2).
68

SEE ALSO

70       gethostname(2), sethostname(2), uname(2)
71

COLOPHON

73       This  page  is  part of release 5.02 of the Linux man-pages project.  A
74       description of the project, information about reporting bugs,  and  the
75       latest     version     of     this    page,    can    be    found    at
76       https://www.kernel.org/doc/man-pages/.
77
78
79
80Linux                             2017-09-15                  GETDOMAINNAME(2)
Impressum