getdomainnameのヘルプ・マニュアル
日本語 英語
getdomainname --help
man getdomainname
GETDOMAINNAME(2) Linux Programmer’s Manual GETDOMAINNAME(2)
名前
getdomainname, setdomainname - ドメイン名の取得・設定をする
書式
#include
int getdomainname(char *name, size_t len);
int setdomainname(const char *name, size_t len);
glibc 向けの機能検査マクロの要件 (feature_test_macros(7) 参照):
getdomainname(), setdomainname(): _BSD_SOURCE || (_XOPEN_SOURCE &&
_XOPEN_SOURCE < 500)
説明
これらの関数は、現在のプロセッサのドメイン名を取得・変更するために使 わ
れる。
setdomainname() は、ドメイン名を、文字配列 name で指定された値に設定す
る。引き数 len には、 name のバイト数を指定する (そのため、 name では文
字列終端の NULL バイトは必要ない)。
getdomainname() は、NULL 終端されたドメイン名を、 len バイトの長さの文
字配列 name に格納して返す。 NULL 終端されたドメイン名が len バイトより
長 い 場 合 、 getdomainname() は、(glibc では) 始めの len バイトを返し
、(libc では) エラーとなる。
返り値
成功した場合 0 が返る。失敗した場合 -1 が返り、 errno がエラーの内容 に
従って設定される。
エラー
setdomainname() は以下のエラーで失敗する可能性がある。
EFAULT name がユーザアドレス空間の外を指した。
EINVAL len が負であるか、長すぎる。
EPERM setdomainname() において、呼び出した人に特権がない (Linux では
CAP_SYS_ADMIN ケーパビリティ (capability) がない)。
getdomainname() は以下のエラーで失敗する可能性がある。
EINVAL libc での getdomainname() において、 name が NULL ポインタである
か、 len バイトより長い。
準拠
POSIX では、これら関数は定義されていない。
注意
Linux 1.0 以降では、ドメイン名の長さの上限は終端の NULL バイトを含めて
64 バイトである。もっと古いカーネルでは 8 バイトであった。
(x86 を含む) Linux のほとんどのアーキテクチャでは、 getdomainname() と
いうシステムコールは存在しない。その代わり、glibc で getdomainname() が
ライブラリ関数として実装されており、この関数は uname(2) の呼び出しで 返
された domainname フィールドのコピーを返す。
関連項目
gethostname(2), sethostname(2), uname(2)
Linux 2008-11-27 GETDOMAINNAME(2)
GETDOMAINNAME(2) Linux Programmer’s Manual GETDOMAINNAME(2)
NAME
getdomainname, setdomainname - get/set domain name
SYNOPSIS
#include
int getdomainname(char *name, size_t len);
int setdomainname(const char *name, size_t len);
Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
getdomainname(), setdomainname(): _BSD_SOURCE || (_XOPEN_SOURCE &&
_XOPEN_SOURCE < 500)
DESCRIPTION
These functions are used to access or to change the domain name of the
current processor.
setdomainname() sets the domain name to the value given in the charac-
ter array name. The len argument specifies the number of bytes in
name. (Thus, name does not require a terminating null byte.)
getdomainname() returns the null-terminated domain name in the charac-
ter array name, which has a length of len bytes. If the null-termi-
nated domain name requires more than len bytes, getdomainname() returns
the first len bytes (glibc) or gives an error (libc).
RETURN VALUE
On success, zero is returned. On error, -1 is returned, and errno is
set appropriately.
ERRORS
setdomainname() can fail with the following errors:
EFAULT name pointed outside of user address space.
EINVAL len was negative or too large.
EPERM the caller is unprivileged (Linux: does not have the
CAP_SYS_ADMIN capability).
getdomainname() can fail with the following errors:
EINVAL For getdomainname() under libc: name is NULL or name is longer
than len bytes.
CONFORMING TO
POSIX does not specify these calls.
NOTES
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.
On most Linux architectures (including x86), there is no getdomain-
name() system call; instead, glibc implements getdomainname() as a
library function that returns a copy of the domainname field returned
from a call to uname(2).
SEE ALSO
gethostname(2), sethostname(2), uname(2)
COLOPHON
This page is part of release 3.22 of the Linux man-pages project. A
description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
Linux 2008-11-27 GETDOMAINNAME(2)