#include <unistd.h>int getdomainname(char *name, size_t%uA0len)%uA0
int setdomainname(const char *name, size_t%uA0len)
描述
These functions are used to access or to change the domain name of the current processor. If the null-terminated domain name requires more than%uA0len%uA0bytes,getdomainname() returns the first%uA0len%uA0bytes (glibc) or returns an error (libc).
返回值
On success, zero is returned. On error, -1 is returned, and%uA0errno%uA0is set appropriately.
错误
标签
描述
EFAULT
For%uA0setdomainname():%uA0name%uA0yiibaied outside of user address space.
EINVAL
For%uA0getdomainname() under libc:%uA0name%uA0is NULL or%uA0name%uA0is longer than%uA0len%uA0bytes.
EINVAL
For%uA0setdomainname():%uA0len%uA0was negative or too large.
EPERM
For%uA0setdomainname(): the caller is unprivileged (Linux: does not have the%uA0CAP_SYS_ADMINꃊpability).