1GETDOMAINNAME(2) Linux Programmer's Manual GETDOMAINNAME(2)
2
3
4
6 getdomainname, setdomainname - get/set domain name
7
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(): _BSD_SOURCE || (_XOPEN_SOURCE &&
17 _XOPEN_SOURCE < 500)
18
20 These functions are used to access or to change the domain name of the
21 current processor.
22
23 setdomainname() sets the domain name to the value given in the charac‐
24 ter array name. The len argument specifies the number of bytes in
25 name. (Thus, name does not require a terminating null byte.)
26
27 getdomainname() returns the null-terminated domain name in the charac‐
28 ter array name, which has a length of len bytes. If the null-termi‐
29 nated domain name requires more than len bytes, getdomainname() returns
30 the first len bytes (glibc) or gives an error (libc).
31
33 On success, zero is returned. On error, -1 is returned, and errno is
34 set appropriately.
35
37 setdomainname() can fail with the following errors:
38
39 EFAULT name pointed outside of user address space.
40
41 EINVAL len was negative or too large.
42
43 EPERM the caller is unprivileged (Linux: does not have the
44 CAP_SYS_ADMIN capability).
45
46 getdomainname() can fail with the following errors:
47
48 EINVAL For getdomainname() under libc: name is NULL or name is longer
49 than len bytes.
50
52 POSIX does not specify these calls.
53
55 Since Linux 1.0, the limit on the length of a domain name, including
56 the terminating null byte, is 64 bytes. In older kernels, it was 8
57 bytes.
58
59 On most Linux architectures (including x86), there is no getdomain‐
60 name() system call; instead, glibc implements getdomainname() as a
61 library function that returns a copy of the domainname field returned
62 from a call to uname(2).
63
65 gethostname(2), sethostname(2), uname(2)
66
68 This page is part of release 3.22 of the Linux man-pages project. A
69 description of the project, and information about reporting bugs, can
70 be found at http://www.kernel.org/doc/man-pages/.
71
72
73
74Linux 2008-11-27 GETDOMAINNAME(2)