]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man2/getdomainname.2
_exit.2, bpf.2, cacheflush.2, capget.2, chdir.2, chmod.2, chroot.2, clock_getres...
[thirdparty/man-pages.git] / man2 / getdomainname.2
1 .\" Copyright 1993 Rickard E. Faith (faith@cs.unc.edu)
2 .\"
3 .\" %%%LICENSE_START(VERBATIM)
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.
12 .\"
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.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" %%%LICENSE_END
24 .\"
25 .\" Modified 1997-08-25 by Nicolás Lichtmaier <nick@debian.org>
26 .\" Modified 2004-06-17 by Michael Kerrisk <mtk.manpages@gmail.com>
27 .\" Modified 2008-11-27 by mtk
28 .\"
29 .TH GETDOMAINNAME 2 2016-10-08 "Linux" "Linux Programmer's Manual"
30 .SH NAME
31 getdomainname, setdomainname \- get/set NIS domain name
32 .SH SYNOPSIS
33 .B #include <unistd.h>
34 .PP
35 .BI "int getdomainname(char *" name ", size_t " len );
36 .br
37 .BI "int setdomainname(const char *" name ", size_t " len );
38 .PP
39 .in -4n
40 Feature Test Macro Requirements for glibc (see
41 .BR feature_test_macros (7)):
42 .in
43 .PP
44 .ad l
45 .BR getdomainname (),
46 .BR setdomainname ():
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
56 .ad
57 .SH DESCRIPTION
58 These functions are used to access or to change the NIS domain name of the
59 host system.
60
61 .BR setdomainname ()
62 sets the domain name to the value given in the character array
63 .IR name .
64 The
65 .I len
66 argument specifies the number of bytes in
67 .IR name .
68 (Thus,
69 .I name
70 does not require a terminating null byte.)
71
72 .BR getdomainname ()
73 returns the null-terminated domain name in the character array
74 .IR name ,
75 which has a length of
76 .I len
77 bytes.
78 If the null-terminated domain name requires more than \fIlen\fP bytes,
79 .BR getdomainname ()
80 returns the first \fIlen\fP bytes (glibc) or gives an error (libc).
81 .SH RETURN VALUE
82 On success, zero is returned.
83 On error, \-1 is returned, and
84 .I errno
85 is set appropriately.
86 .SH ERRORS
87 .BR setdomainname ()
88 can fail with the following errors:
89 .TP
90 .B EFAULT
91 .I name
92 pointed outside of user address space.
93 .TP
94 .B EINVAL
95 .I len
96 was negative or too large.
97 .TP
98 .B EPERM
99 The caller did not have the
100 .B CAP_SYS_ADMIN
101 capability in the user namespace associated with its UTS namespace (see
102 .BR namespaces (7)).
103 .PP
104 .BR getdomainname ()
105 can fail with the following errors:
106 .TP
107 .B EINVAL
108 For
109 .BR getdomainname ()
110 under libc:
111 .I name
112 is NULL or
113 .I name
114 is longer than
115 .I len
116 bytes.
117 .SH CONFORMING TO
118 POSIX does not specify these calls.
119 .\" But they appear on most systems...
120 .SH NOTES
121 Since Linux 1.0, the limit on the length of a domain name,
122 including the terminating null byte, is 64 bytes.
123 In older kernels, it was 8 bytes.
124
125 On most Linux architectures (including x86),
126 there is no
127 .BR getdomainname ()
128 system call; instead, glibc implements
129 .BR getdomainname ()
130 as a library function that returns a copy of the
131 .I domainname
132 field returned from a call to
133 .BR uname (2).
134 .SH SEE ALSO
135 .BR gethostname (2),
136 .BR sethostname (2),
137 .BR uname (2)