38 lines
685 B
Groff
38 lines
685 B
Groff
.TH SETHOSTNAME 2
|
|
.UC 4
|
|
.SH NAME
|
|
sethostname \- sethostname
|
|
.SH SYNOPSIS
|
|
.nf
|
|
.B #include <unistd.h>
|
|
.B int sethostname (const char *name, int len)
|
|
.fi
|
|
.SH DESCRIPTION
|
|
.B sethostname()
|
|
sets hostname of length
|
|
.I len
|
|
to
|
|
.I name.
|
|
Note that only the super user may
|
|
.B sethostname().
|
|
0 is returned on success, a negative value on error.
|
|
.SH ERRORS
|
|
.B -EINVAL
|
|
is returned if
|
|
.I len
|
|
is greater than
|
|
.B MAXHOSTNAMELEN
|
|
which is defined in /usr/include/sys/param.h,
|
|
and can easily be overridden.
|
|
.PP
|
|
.B -EPERM
|
|
is returned if a non-root user attempts to set hostname.
|
|
.SH FILES
|
|
linux/kernel/sys.c
|
|
.br
|
|
/usr/include/linux/sys.h
|
|
.br
|
|
/usr/include/unistd.h
|
|
.SH SEE ALSO
|
|
uname(2)
|