43 lines
3.1 KiB
HTML
43 lines
3.1 KiB
HTML
<html><!-- This HTML file has been created by texi2html 1.29
|
|
from syscalls.texi on 4 June 1994 -->
|
|
|
|
<TITLE>Syscall specifications of Linux - gethostname</TITLE>
|
|
<P>Go to the <A HREF="javascript:if(confirm('http://www.infran.ru/TechInfo/syscalls/syscalls_45.html \n\nThis file was not retrieved by Teleport Pro, because the server reports that an error occurred that prevented retrieval. \n\nDo you want to open it from the server?'))window.location='http://www.infran.ru/TechInfo/syscalls/syscalls_45.html'" tppabs="http://www.infran.ru/TechInfo/syscalls/syscalls_45.html">previous</A>, <A HREF="javascript:if(confirm('http://www.infran.ru/TechInfo/syscalls/syscalls_47.html \n\nThis file was not retrieved by Teleport Pro, because the server reports that an error occurred that prevented retrieval. \n\nDo you want to open it from the server?'))window.location='http://www.infran.ru/TechInfo/syscalls/syscalls_47.html'" tppabs="http://www.infran.ru/TechInfo/syscalls/syscalls_47.html">next</A> section.<P>
|
|
<H2><A NAME="SEC46" HREF="syscalls_toc.html#SEC46" tppabs="http://www.infran.ru/TechInfo/syscalls/syscalls_toc.html#SEC46">gethostname and sethostname</A></H2>
|
|
<P>
|
|
<H3>SYNOPSIS</H3>
|
|
<P>
|
|
<CODE>int gethostname(char *<VAR>name</VAR>, size_t <VAR>len</VAR>);</CODE>
|
|
<P>
|
|
<CODE>int sethostname(const char *<VAR>name</VAR>, size_t <VAR>len</VAR>);</CODE>
|
|
<P>
|
|
<H3>PARAMETERS</H3>
|
|
<P>
|
|
<VAR>name</VAR>: (For <CODE>gethostname</CODE>) [out] points to a buffer where to
|
|
put the host name. (For <CODE>sethostname</CODE>) [in] points to the new host
|
|
name.
|
|
<P>
|
|
<VAR>len</VAR>: [in] the maximum length of <VAR>name</VAR>.
|
|
<P>
|
|
<H3>DESCRIPTION</H3>
|
|
<P>
|
|
<CODE>gethostname</CODE> returns the host name of the current host and
|
|
<CODE>sethostname</CODE> sets it. Only the superuser may call <CODE>sethostname</CODE>.
|
|
<P>
|
|
<H3>RETURN VALUE</H3>
|
|
<P>
|
|
On success zero is returned. On error, -1 is returned and <CODE>errno</CODE> is
|
|
set to one of the following values:
|
|
<P>
|
|
In the case of <CODE>gethostname</CODE>: <CODE>EINVAL</CODE>: <VAR>name</VAR> is
|
|
<CODE>NULL</CODE> or the host name is longer than <VAR>len</VAR>.
|
|
<P>
|
|
In the case of <CODE>sethostname</CODE>:
|
|
<P>
|
|
<UL>
|
|
<LI><CODE>EPERM</CODE>: the caller is not superuser.
|
|
<LI><CODE>EINVAL</CODE>: <VAR>len</VAR> is too long.
|
|
</UL>
|
|
<P>
|
|
<P>Go to the <A HREF="javascript:if(confirm('http://www.infran.ru/TechInfo/syscalls/syscalls_45.html \n\nThis file was not retrieved by Teleport Pro, because the server reports that an error occurred that prevented retrieval. \n\nDo you want to open it from the server?'))window.location='http://www.infran.ru/TechInfo/syscalls/syscalls_45.html'" tppabs="http://www.infran.ru/TechInfo/syscalls/syscalls_45.html">previous</A>, <A HREF="javascript:if(confirm('http://www.infran.ru/TechInfo/syscalls/syscalls_47.html \n\nThis file was not retrieved by Teleport Pro, because the server reports that an error occurred that prevented retrieval. \n\nDo you want to open it from the server?'))window.location='http://www.infran.ru/TechInfo/syscalls/syscalls_47.html'" tppabs="http://www.infran.ru/TechInfo/syscalls/syscalls_47.html">next</A> section.<P>
|