]>
Commit | Line | Data |
---|---|---|
fea681da MK |
1 | .\" Copyright 1993 Rickard E. Faith (faith@cs.unc.edu) |
2 | .\" | |
93015253 | 3 | .\" %%%LICENSE_START(VERBATIM) |
fea681da MK |
4 | .\" Permission is granted to make and distribute verbatim copies of this |
5 | .\" manual provided the copyright notice and this permission notice are | |
6 | .\" preserved on all copies. | |
7 | .\" | |
8 | .\" Permission is granted to copy and distribute modified versions of this | |
9 | .\" manual under the conditions for verbatim copying, provided that the | |
10 | .\" entire resulting derived work is distributed under the terms of a | |
11 | .\" permission notice identical to this one. | |
c13182ef | 12 | .\" |
fea681da MK |
13 | .\" Since the Linux kernel and libraries are constantly changing, this |
14 | .\" manual page may be incorrect or out-of-date. The author(s) assume no | |
15 | .\" responsibility for errors or omissions, or for damages resulting from | |
16 | .\" the use of the information contained herein. The author(s) may not | |
17 | .\" have taken the same level of care in the production of this manual, | |
18 | .\" which is licensed free of charge, as they might when working | |
19 | .\" professionally. | |
c13182ef | 20 | .\" |
fea681da MK |
21 | .\" Formatted or processed versions of this manual, if unaccompanied by |
22 | .\" the source, must acknowledge the copyright and authors of this work. | |
4b72fb64 | 23 | .\" %%%LICENSE_END |
fea681da | 24 | .\" |
e00c3a07 | 25 | .\" Modified 1997-08-25 by Nicolás Lichtmaier <nick@debian.org> |
c11b1abf | 26 | .\" Modified 2004-06-17 by Michael Kerrisk <mtk.manpages@gmail.com> |
2d08404c | 27 | .\" Modified 2008-11-27 by mtk |
fea681da | 28 | .\" |
867c9b34 | 29 | .TH GETDOMAINNAME 2 2019-10-10 "Linux" "Linux Programmer's Manual" |
fea681da | 30 | .SH NAME |
47cfbecf | 31 | getdomainname, setdomainname \- get/set NIS domain name |
fea681da MK |
32 | .SH SYNOPSIS |
33 | .B #include <unistd.h> | |
68e4db0a | 34 | .PP |
fea681da MK |
35 | .BI "int getdomainname(char *" name ", size_t " len ); |
36 | .br | |
37 | .BI "int setdomainname(const char *" name ", size_t " len ); | |
68e4db0a | 38 | .PP |
cc4615cc MK |
39 | .in -4n |
40 | Feature Test Macro Requirements for glibc (see | |
41 | .BR feature_test_macros (7)): | |
42 | .in | |
68e4db0a | 43 | .PP |
cc4615cc | 44 | .ad l |
520f92e7 MK |
45 | .BR getdomainname (), |
46 | .BR setdomainname (): | |
d0544534 MK |
47 | .nf |
48 | Since glibc 2.21: | |
49 | .\" commit 266865c0e7b79d4196e2cc393693463f03c90bd8 | |
50 | _DEFAULT_SOURCE | |
51 | In glibc 2.19 and 2.20: | |
52 | _DEFAULT_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE\ <\ 500) | |
53 | Up to and including glibc 2.19: | |
54 | _BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE\ <\ 500) | |
55 | .fi | |
5871b69b | 56 | .ad |
fea681da | 57 | .SH DESCRIPTION |
47cfbecf | 58 | These functions are used to access or to change the NIS domain name of the |
a8974b6d | 59 | host system. |
16ea6936 MK |
60 | More precisely, they operate on the NIS domain name associated with the calling |
61 | process's UTS namespace. | |
efeece04 | 62 | .PP |
2d08404c MK |
63 | .BR setdomainname () |
64 | sets the domain name to the value given in the character array | |
65 | .IR name . | |
66 | The | |
67 | .I len | |
68 | argument specifies the number of bytes in | |
69 | .IR name . | |
70 | (Thus, | |
71 | .I name | |
72 | does not require a terminating null byte.) | |
efeece04 | 73 | .PP |
2d08404c MK |
74 | .BR getdomainname () |
75 | returns the null-terminated domain name in the character array | |
76 | .IR name , | |
77 | which has a length of | |
78 | .I len | |
79 | bytes. | |
28d88c17 | 80 | If the null-terminated domain name requires more than \fIlen\fP bytes, |
e511ffb6 | 81 | .BR getdomainname () |
2d08404c | 82 | returns the first \fIlen\fP bytes (glibc) or gives an error (libc). |
47297adb | 83 | .SH RETURN VALUE |
c13182ef MK |
84 | On success, zero is returned. |
85 | On error, \-1 is returned, and | |
fea681da MK |
86 | .I errno |
87 | is set appropriately. | |
88 | .SH ERRORS | |
2d08404c MK |
89 | .BR setdomainname () |
90 | can fail with the following errors: | |
fea681da MK |
91 | .TP |
92 | .B EFAULT | |
fea681da MK |
93 | .I name |
94 | pointed outside of user address space. | |
95 | .TP | |
96 | .B EINVAL | |
2d08404c MK |
97 | .I len |
98 | was negative or too large. | |
99 | .TP | |
100 | .B EPERM | |
2ff964df | 101 | The caller did not have the |
2d08404c | 102 | .B CAP_SYS_ADMIN |
2ff964df MK |
103 | capability in the user namespace associated with its UTS namespace (see |
104 | .BR namespaces (7)). | |
2d08404c MK |
105 | .PP |
106 | .BR getdomainname () | |
107 | can fail with the following errors: | |
108 | .TP | |
109 | .B EINVAL | |
fea681da | 110 | For |
e511ffb6 | 111 | .BR getdomainname () |
fea681da MK |
112 | under libc: |
113 | .I name | |
8478ee02 | 114 | is NULL or |
fea681da MK |
115 | .I name |
116 | is longer than | |
117 | .I len | |
118 | bytes. | |
47297adb | 119 | .SH CONFORMING TO |
fea681da | 120 | POSIX does not specify these calls. |
97c1eac8 | 121 | .\" But they appear on most systems... |
2d08404c MK |
122 | .SH NOTES |
123 | Since Linux 1.0, the limit on the length of a domain name, | |
124 | including the terminating null byte, is 64 bytes. | |
125 | In older kernels, it was 8 bytes. | |
efeece04 | 126 | .PP |
2d08404c MK |
127 | On most Linux architectures (including x86), |
128 | there is no | |
129 | .BR getdomainname () | |
130 | system call; instead, glibc implements | |
131 | .BR getdomainname () | |
132 | as a library function that returns a copy of the | |
133 | .I domainname | |
134 | field returned from a call to | |
135 | .BR uname (2). | |
47297adb | 136 | .SH SEE ALSO |
fea681da MK |
137 | .BR gethostname (2), |
138 | .BR sethostname (2), | |
16ea6936 MK |
139 | .BR uname (2), |
140 | .BR uts_namespaces (7) |