]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - doc/html/ref/net-common-tcpip-manpages-gethostname.html
RedBoot TX53 Release 2012-02-15
[karo-tx-redboot.git] / doc / html / ref / net-common-tcpip-manpages-gethostname.html
1 <!-- Copyright (C) 2003 Red Hat, Inc.                                -->
2 <!-- This material may be distributed only subject to the terms      -->
3 <!-- and conditions set forth in the Open Publication License, v1.0  -->
4 <!-- or later (the latest version is presently available at          -->
5 <!-- http://www.opencontent.org/openpub/).                           -->
6 <!-- Distribution of the work or derivative of the work in any       -->
7 <!-- standard (paper) book form is prohibited unless prior           -->
8 <!-- permission is obtained from the copyright holder.               -->
9 <HTML
10 ><HEAD
11 ><TITLE
12 >gethostname</TITLE
13 ><meta name="MSSmartTagsPreventParsing" content="TRUE">
14 <META
15 NAME="GENERATOR"
16 CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
17 "><LINK
18 REL="HOME"
19 TITLE="eCos Reference Manual"
20 HREF="ecos-ref.html"><LINK
21 REL="UP"
22 TITLE="TCP/IP Library Reference"
23 HREF="tcpip-library-reference.html"><LINK
24 REL="PREVIOUS"
25 TITLE="TCP/IP Library Reference"
26 HREF="tcpip-library-reference.html"><LINK
27 REL="NEXT"
28 TITLE="byteorder"
29 HREF="net-common-tcpip-manpages-byteorder.html"></HEAD
30 ><BODY
31 CLASS="SECT1"
32 BGCOLOR="#FFFFFF"
33 TEXT="#000000"
34 LINK="#0000FF"
35 VLINK="#840084"
36 ALINK="#0000FF"
37 ><DIV
38 CLASS="NAVHEADER"
39 ><TABLE
40 SUMMARY="Header navigation table"
41 WIDTH="100%"
42 BORDER="0"
43 CELLPADDING="0"
44 CELLSPACING="0"
45 ><TR
46 ><TH
47 COLSPAN="3"
48 ALIGN="center"
49 >eCos Reference Manual</TH
50 ></TR
51 ><TR
52 ><TD
53 WIDTH="10%"
54 ALIGN="left"
55 VALIGN="bottom"
56 ><A
57 HREF="tcpip-library-reference.html"
58 ACCESSKEY="P"
59 >Prev</A
60 ></TD
61 ><TD
62 WIDTH="80%"
63 ALIGN="center"
64 VALIGN="bottom"
65 >Chapter 38. TCP/IP Library Reference</TD
66 ><TD
67 WIDTH="10%"
68 ALIGN="right"
69 VALIGN="bottom"
70 ><A
71 HREF="net-common-tcpip-manpages-byteorder.html"
72 ACCESSKEY="N"
73 >Next</A
74 ></TD
75 ></TR
76 ></TABLE
77 ><HR
78 ALIGN="LEFT"
79 WIDTH="100%"></DIV
80 ><DIV
81 CLASS="SECT1"
82 ><H1
83 CLASS="SECT1"
84 ><A
85 NAME="NET-COMMON-TCPIP-MANPAGES-GETHOSTNAME">gethostname</H1
86 ><TABLE
87 BORDER="5"
88 BGCOLOR="#E0E0F0"
89 WIDTH="70%"
90 ><TR
91 ><TD
92 ><PRE
93 CLASS="SCREEN"
94 >GETHOSTNAME(3)          System Library Functions Manual         GETHOSTNAME(3)
95
96 NAME
97      gethostname, sethostname - get/set name of current host
98
99 SYNOPSIS
100      #include &lt;unistd.h&#62;
101
102      int
103      gethostname(char *name, size_t namelen);
104
105      int
106      sethostname(const char *name, size_t namelen);
107
108 DESCRIPTION
109      The gethostname() function returns the standard host name for the current
110      processor, as previously set by sethostname().  The parameter namelen
111      specifies the size of the name array.  If insufficient space is provided,
112      the returned name is truncated.  The returned name is always null termi-
113      nated.
114
115      sethostname() sets the name of the host machine to be name, which has
116      length namelen.  This call is restricted to the superuser and is normally
117      used only when the system is bootstrapped.
118
119 RETURN VALUES
120      If the call succeeds a value of 0 is returned.  If the call fails, a
121      value of -1 is returned and an error code is placed in the global vari-
122      able errno.
123
124 ERRORS
125      The following errors may be returned by these calls:
126
127      [EFAULT]           The name or namelen parameter gave an invalid address.
128
129      [EPERM]            The caller tried to set the hostname and was not the
130                         superuser.
131
132 SEE ALSO
133      hostname(1), getdomainname(3), gethostid(3), sysctl(3), sysctl(8), yp(8)
134
135 STANDARDS
136      The gethostname() function call conforms to X/Open Portability Guide
137      Issue 4.2 (``XPG4.2'').
138
139 HISTORY
140      The gethostname() function call appeared in 4.2BSD.
141
142 BUGS
143      Host names are limited to MAXHOSTNAMELEN (from &lt;sys/param.h&#62;) characters,
144      currently 256.  This includes the terminating NUL character.
145
146      If the buffer passed to gethostname() is smaller than MAXHOSTNAMELEN,
147      other operating systems may not guarantee termination with NUL.
148
149 BSD                              June 4, 1993                              BSD
150     </PRE
151 ></TD
152 ></TR
153 ></TABLE
154 ></DIV
155 ><DIV
156 CLASS="NAVFOOTER"
157 ><HR
158 ALIGN="LEFT"
159 WIDTH="100%"><TABLE
160 SUMMARY="Footer navigation table"
161 WIDTH="100%"
162 BORDER="0"
163 CELLPADDING="0"
164 CELLSPACING="0"
165 ><TR
166 ><TD
167 WIDTH="33%"
168 ALIGN="left"
169 VALIGN="top"
170 ><A
171 HREF="tcpip-library-reference.html"
172 ACCESSKEY="P"
173 >Prev</A
174 ></TD
175 ><TD
176 WIDTH="34%"
177 ALIGN="center"
178 VALIGN="top"
179 ><A
180 HREF="ecos-ref.html"
181 ACCESSKEY="H"
182 >Home</A
183 ></TD
184 ><TD
185 WIDTH="33%"
186 ALIGN="right"
187 VALIGN="top"
188 ><A
189 HREF="net-common-tcpip-manpages-byteorder.html"
190 ACCESSKEY="N"
191 >Next</A
192 ></TD
193 ></TR
194 ><TR
195 ><TD
196 WIDTH="33%"
197 ALIGN="left"
198 VALIGN="top"
199 >TCP/IP Library Reference</TD
200 ><TD
201 WIDTH="34%"
202 ALIGN="center"
203 VALIGN="top"
204 ><A
205 HREF="tcpip-library-reference.html"
206 ACCESSKEY="U"
207 >Up</A
208 ></TD
209 ><TD
210 WIDTH="33%"
211 ALIGN="right"
212 VALIGN="top"
213 >byteorder</TD
214 ></TR
215 ></TABLE
216 ></DIV
217 ></BODY
218 ></HTML
219 >