|
|
1.1 root 1: .\" Copyright (c) 1983 The Regents of the University of California.
2: .\" All rights reserved.
3: .\"
4: .\" Redistribution and use in source and binary forms are permitted provided
5: .\" that: (1) source distributions retain this entire copyright notice and
6: .\" comment, and (2) distributions including binaries display the following
7: .\" acknowledgement: ``This product includes software developed by the
8: .\" University of California, Berkeley and its contributors'' in the
9: .\" documentation or other materials provided with the distribution and in
10: .\" all advertising materials mentioning features or use of this software.
11: .\" Neither the name of the University nor the names of its contributors may
12: .\" be used to endorse or promote products derived from this software without
13: .\" specific prior written permission.
14: .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
15: .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
16: .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17: .\"
18: .\" @(#)gethostname.2 6.6 (Berkeley) 6/23/90
19: .\"
20: .TH GETHOSTNAME 2 "June 23, 1990"
21: .UC 5
22: .SH NAME
23: gethostname, sethostname \- get/set name of current host
24: .SH SYNOPSIS
25: .nf
26: .ft B
27: gethostname(name, namelen)
28: char *name;
29: int namelen;
30: .PP
31: .ft B
32: sethostname(name, namelen)
33: char *name;
34: int namelen;
35: .fi
36: .SH DESCRIPTION
37: .I Gethostname
38: returns the standard host name for the current processor, as
39: previously set by
40: .IR sethostname .
41: The parameter
42: .I namelen
43: specifies the size of the
44: .I name
45: array. The returned name is null-terminated unless insufficient
46: space is provided.
47: .PP
48: .I Sethostname
49: sets the name of the host machine to be
50: .IR name ,
51: which has length
52: .IR namelen .
53: This call is restricted to the super-user and
54: is normally used only when the system is bootstrapped.
55: .SH "RETURN VALUE
56: If the call succeeds a value of 0 is returned. If the call
57: fails, then a value of \-1 is returned and an error code is
58: placed in the global location \fIerrno\fP.
59: .SH "ERRORS
60: The following errors may be returned by these calls:
61: .TP 15
62: [EFAULT]
63: The \fIname\fP or \fInamelen\fP parameter gave an
64: invalid address.
65: .TP 15
66: [EPERM]
67: The caller tried to set the hostname and was not the super-user.
68: .SH SEE ALSO
69: gethostid(2)
70: .SH BUGS
71: Host names are limited to MAXHOSTNAMELEN (from
72: .IR <sys/param.h> )
73: characters, currently 64.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.