1 .\" Copyright 1993 Rickard E. Faith (faith@cs.unc.edu)
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.
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.
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
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
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
29 .TH GETDOMAINNAME 2 2012-10-25 "Linux" "Linux Programmer's Manual"
31 getdomainname, setdomainname \- get/set NIS domain name
33 .B #include <unistd.h>
35 .BI "int getdomainname(char *" name ", size_t " len );
37 .BI "int setdomainname(const char *" name ", size_t " len );
40 Feature Test Macro Requirements for glibc (see
41 .BR feature_test_macros (7)):
48 _BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE\ <\ 500)
52 These functions are used to access or to change the NIS domain name of the
56 sets the domain name to the value given in the character array
60 argument specifies the number of bytes in
64 does not require a terminating null byte.)
67 returns the null-terminated domain name in the character array
72 If the null-terminated domain name requires more than \fIlen\fP bytes,
74 returns the first \fIlen\fP bytes (glibc) or gives an error (libc).
76 On success, zero is returned.
77 On error, \-1 is returned, and
82 can fail with the following errors:
86 pointed outside of user address space.
90 was negative or too large.
93 the caller is unprivileged (Linux: does not have the
98 can fail with the following errors:
111 POSIX does not specify these calls.
112 .\" But they appear on most systems...
114 Since Linux 1.0, the limit on the length of a domain name,
115 including the terminating null byte, is 64 bytes.
116 In older kernels, it was 8 bytes.
118 On most Linux architectures (including x86),
121 system call; instead, glibc implements
123 as a library function that returns a copy of the
125 field returned from a call to