Files
oldlinux-files/Linux-0.98/Yggdrasil-0.98.3/usr/man/man2/sethostname.2
2024-02-19 00:21:16 -05:00

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)