Commit | Line | Data |
---|---|---|
2cf6fecc C |
1 | |
2 | ||
3 | ||
4 | GETHOSTNAME(2) UNIX Programmer's Manual GETHOSTNAME(2) | |
5 | ||
6 | ||
7 | ||
8 | N\bNA\bAM\bME\bE | |
9 | gethostname, sethostname - get/set name of current host | |
10 | ||
11 | S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS | |
12 | g\bge\bet\bth\bho\bos\bst\btn\bna\bam\bme\be(\b(n\bna\bam\bme\be,\b, n\bna\bam\bme\bel\ble\ben\bn)\b) | |
13 | c\bch\bha\bar\br *\b*n\bna\bam\bme\be;\b; | |
14 | i\bin\bnt\bt n\bna\bam\bme\bel\ble\ben\bn;\b; | |
15 | ||
16 | s\bse\bet\bth\bho\bos\bst\btn\bna\bam\bme\be(\b(n\bna\bam\bme\be,\b, n\bna\bam\bme\bel\ble\ben\bn)\b) | |
17 | c\bch\bha\bar\br *\b*n\bna\bam\bme\be;\b; | |
18 | i\bin\bnt\bt n\bna\bam\bme\bel\ble\ben\bn;\b; | |
19 | ||
20 | D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN | |
21 | _\bG_\be_\bt_\bh_\bo_\bs_\bt_\bn_\ba_\bm_\be returns the standard host name for the current | |
22 | processor, as previously set by _\bs_\be_\bt_\bh_\bo_\bs_\bt_\bn_\ba_\bm_\be. The parameter | |
23 | _\bn_\ba_\bm_\be_\bl_\be_\bn specifies the size of the _\bn_\ba_\bm_\be array. The returned | |
24 | name is null-terminated unless insufficient space is pro- | |
25 | vided. | |
26 | ||
27 | _\bS_\be_\bt_\bh_\bo_\bs_\bt_\bn_\ba_\bm_\be sets the name of the host machine to be _\bn_\ba_\bm_\be, | |
28 | which has length _\bn_\ba_\bm_\be_\bl_\be_\bn. This call is restricted to the | |
29 | super-user and is normally used only when the system is | |
30 | bootstrapped. | |
31 | ||
32 | R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bE | |
33 | If the call succeeds a value of 0 is returned. If the call | |
34 | fails, then a value of -1 is returned and an error code is | |
35 | placed in the global location _\be_\br_\br_\bn_\bo. | |
36 | ||
37 | E\bER\bRR\bRO\bOR\bRS\bS | |
38 | The following errors may be returned by these calls: | |
39 | ||
40 | [EFAULT] The _\bn_\ba_\bm_\be or _\bn_\ba_\bm_\be_\bl_\be_\bn parameter gave an invalid | |
41 | address. | |
42 | ||
43 | [EPERM] The caller tried to set the hostname and was | |
44 | not the super-user. | |
45 | ||
46 | S\bSE\bEE\bE A\bAL\bLS\bSO\bO | |
47 | gethostid(2) | |
48 | ||
49 | B\bBU\bUG\bGS\bS | |
50 | Host names are limited to MAXHOSTNAMELEN (from | |
51 | <_\bs_\by_\bs/_\bp_\ba_\br_\ba_\bm._\bh>) characters, currently 64. | |
52 | ||
53 | ||
54 | ||
55 | ||
56 | ||
57 | ||
58 | ||
59 | ||
60 | ||
61 | ||
62 | ||
63 | Printed 7/9/88 May 22, 1986 1 | |
64 | ||
65 | ||
66 |