220 lines
4.6 KiB
HTML
220 lines
4.6 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of GETDOMAINNAME</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>GETDOMAINNAME</H1>
|
|
Section: Linux Programmer's Manual (2)<BR>Updated: 2019-10-10<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
getdomainname, setdomainname - get/set NIS domain name
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<B>#include <<A HREF="file:///usr/include/unistd.h">unistd.h</A>></B>
|
|
|
|
<P>
|
|
|
|
<B>int getdomainname(char *</B><I>name</I><B>, size_t </B><I>len</I><B>);</B>
|
|
|
|
<BR>
|
|
|
|
<B>int setdomainname(const char *</B><I>name</I><B>, size_t </B><I>len</I><B>);</B>
|
|
|
|
<P>
|
|
|
|
|
|
Feature Test Macro Requirements for glibc (see
|
|
<B><A HREF="/cgi-bin/man/man2html?7+feature_test_macros">feature_test_macros</A></B>(7)):
|
|
|
|
|
|
<P>
|
|
|
|
|
|
<B>getdomainname</B>(),
|
|
|
|
<B>setdomainname</B>():
|
|
|
|
<PRE>
|
|
Since glibc 2.21:
|
|
_DEFAULT_SOURCE
|
|
In glibc 2.19 and 2.20:
|
|
_DEFAULT_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE < 500)
|
|
Up to and including glibc 2.19:
|
|
_BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE < 500)
|
|
</PRE>
|
|
|
|
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
These functions are used to access or to change the NIS domain name of the
|
|
host system.
|
|
More precisely, they operate on the NIS domain name associated with the calling
|
|
process's UTS namespace.
|
|
<P>
|
|
|
|
<B>setdomainname</B>()
|
|
|
|
sets the domain name to the value given in the character array
|
|
<I>name</I>.
|
|
|
|
The
|
|
<I>len</I>
|
|
|
|
argument specifies the number of bytes in
|
|
<I>name</I>.
|
|
|
|
(Thus,
|
|
<I>name</I>
|
|
|
|
does not require a terminating null byte.)
|
|
<P>
|
|
|
|
<B>getdomainname</B>()
|
|
|
|
returns the null-terminated domain name in the character array
|
|
<I>name</I>,
|
|
|
|
which has a length of
|
|
<I>len</I>
|
|
|
|
bytes.
|
|
If the null-terminated domain name requires more than <I>len</I> bytes,
|
|
<B>getdomainname</B>()
|
|
|
|
returns the first <I>len</I> bytes (glibc) or gives an error (libc).
|
|
<A NAME="lbAE"> </A>
|
|
<H2>RETURN VALUE</H2>
|
|
|
|
On success, zero is returned.
|
|
On error, -1 is returned, and
|
|
<I>errno</I>
|
|
|
|
is set appropriately.
|
|
<A NAME="lbAF"> </A>
|
|
<H2>ERRORS</H2>
|
|
|
|
<B>setdomainname</B>()
|
|
|
|
can fail with the following errors:
|
|
<DL COMPACT>
|
|
<DT id="1"><B>EFAULT</B>
|
|
|
|
<DD>
|
|
<I>name</I>
|
|
|
|
pointed outside of user address space.
|
|
<DT id="2"><B>EINVAL</B>
|
|
|
|
<DD>
|
|
<I>len</I>
|
|
|
|
was negative or too large.
|
|
<DT id="3"><B>EPERM</B>
|
|
|
|
<DD>
|
|
The caller did not have the
|
|
<B>CAP_SYS_ADMIN</B>
|
|
|
|
capability in the user namespace associated with its UTS namespace (see
|
|
<B><A HREF="/cgi-bin/man/man2html?7+namespaces">namespaces</A></B>(7)).
|
|
|
|
</DL>
|
|
<P>
|
|
|
|
<B>getdomainname</B>()
|
|
|
|
can fail with the following errors:
|
|
<DL COMPACT>
|
|
<DT id="4"><B>EINVAL</B>
|
|
|
|
<DD>
|
|
For
|
|
<B>getdomainname</B>()
|
|
|
|
under libc:
|
|
<I>name</I>
|
|
|
|
is NULL or
|
|
<I>name</I>
|
|
|
|
is longer than
|
|
<I>len</I>
|
|
|
|
bytes.
|
|
</DL>
|
|
<A NAME="lbAG"> </A>
|
|
<H2>CONFORMING TO</H2>
|
|
|
|
POSIX does not specify these calls.
|
|
|
|
<A NAME="lbAH"> </A>
|
|
<H2>NOTES</H2>
|
|
|
|
Since Linux 1.0, the limit on the length of a domain name,
|
|
including the terminating null byte, is 64 bytes.
|
|
In older kernels, it was 8 bytes.
|
|
<P>
|
|
|
|
On most Linux architectures (including x86),
|
|
there is no
|
|
<B>getdomainname</B>()
|
|
|
|
system call; instead, glibc implements
|
|
<B>getdomainname</B>()
|
|
|
|
as a library function that returns a copy of the
|
|
<I>domainname</I>
|
|
|
|
field returned from a call to
|
|
<B><A HREF="/cgi-bin/man/man2html?2+uname">uname</A></B>(2).
|
|
|
|
<A NAME="lbAI"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+gethostname">gethostname</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sethostname">sethostname</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+uname">uname</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?7+uts_namespaces">uts_namespaces</A></B>(7)
|
|
|
|
<A NAME="lbAJ"> </A>
|
|
<H2>COLOPHON</H2>
|
|
|
|
This page is part of release 5.05 of the Linux
|
|
<I>man-pages</I>
|
|
|
|
project.
|
|
A description of the project,
|
|
information about reporting bugs,
|
|
and the latest version of this page,
|
|
can be found at
|
|
<A HREF="https://www.kernel.org/doc/man-pages/.">https://www.kernel.org/doc/man-pages/.</A>
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="5"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="6"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="7"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="8"><A HREF="#lbAE">RETURN VALUE</A><DD>
|
|
<DT id="9"><A HREF="#lbAF">ERRORS</A><DD>
|
|
<DT id="10"><A HREF="#lbAG">CONFORMING TO</A><DD>
|
|
<DT id="11"><A HREF="#lbAH">NOTES</A><DD>
|
|
<DT id="12"><A HREF="#lbAI">SEE ALSO</A><DD>
|
|
<DT id="13"><A HREF="#lbAJ">COLOPHON</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:32 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|