|
|
1.1 root 1: .\" Copyright (c) 1983 Regents of the University of California.
2: .\" All rights reserved. The Berkeley software License Agreement
3: .\" specifies the terms and conditions for redistribution.
4: .\"
5: .\" @(#)gethostname.2 6.4 (Berkeley) 5/22/86
6: .\"
7: .TH GETHOSTNAME 2 "May 22, 1986"
8: .UC 5
9: .SH NAME
10: gethostname, sethostname \- get/set name of current host
11: .SH SYNOPSIS
12: .nf
13: .ft B
14: gethostname(name, namelen)
15: char *name;
16: int namelen;
17: .PP
18: .ft B
19: sethostname(name, namelen)
20: char *name;
21: int namelen;
22: .fi
23: .SH DESCRIPTION
24: .I Gethostname
25: returns the standard host name for the current processor, as
26: previously set by
27: .IR sethostname .
28: The parameter
29: .I namelen
30: specifies the size of the
31: .I name
32: array. The returned name is null-terminated unless insufficient
33: space is provided.
34: .PP
35: .I Sethostname
36: sets the name of the host machine to be
37: .IR name ,
38: which has length
39: .IR namelen .
40: This call is restricted to the super-user and
41: is normally used only when the system is bootstrapped.
42: .SH "RETURN VALUE
43: If the call succeeds a value of 0 is returned. If the call
44: fails, then a value of \-1 is returned and an error code is
45: placed in the global location \fIerrno\fP.
46: .SH "ERRORS
47: The following errors may be returned by these calls:
48: .TP 15
49: [EFAULT]
50: The \fIname\fP or \fInamelen\fP parameter gave an
51: invalid address.
52: .TP 15
53: [EPERM]
54: The caller tried to set the hostname and was not the super-user.
55: .SH SEE ALSO
56: gethostid(2)
57: .SH BUGS
58: Host names are limited to MAXHOSTNAMELEN (from
59: .IR <sys/param.h> )
60: characters, currently 64.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.