.\" Hey Emacs! This file is -*- nroff -*- source. .\" .\" Copyright 1993 Rickard E. Faith (faith@cs.unc.edu) .\" .\" Permission is granted to make and distribute verbatim copies of this .\" manual provided the copyright notice and this permission notice are .\" preserved on all copies. .\" .\" Permission is granted to copy and distribute modified versions of this .\" manual under the conditions for verbatim copying, provided that the .\" entire resulting derived work is distributed under the terms of a .\" permission notice identical to this one .\" .\" Since the Linux kernel and libraries are constantly changing, this .\" manual page may be incorrect or out-of-date. The author(s) assume no .\" responsibility for errors or omissions, or for damages resulting from .\" the use of the information contained herein. The author(s) may not .\" have taken the same level of care in the production of this manual, .\" which is licensed free of charge, as they might when working .\" professionally. .\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" .\" Modified 22 July 1995 by Michael Chastain (mec@duracef.shout.net): .\" 'gethostname' is real system call on Linux/Alpha. .\" .\" German translation by René Tschirley (gremlin@cs.tu-berlin.de) .\" .TH GETHOSTNAME 2 "22. July 1995" "Linux 1.3.6" "Systemaufrufe" .SH BEZEICHNUNG gethostname, sethostname \- hole/setze Hostname .SH ÜBERSICHT .B #include .sp .BI "int gethostname(char *" name ", size_t " len ); .br .BI "int sethostname(const char *" name ", size_t " len ); .SH BESCHREIBUNG Diese Funktionen werden dazu benutzt, den Hostnamen des Systems abzufragen oder zu setzen. .SH "RÜCKGABEWERT" Bei Erfolg wird 0 zurückgeliefert, bei aufgetretenem Fehler -1 und .I errno wird entsprechend gesetzt. .SH FEHLER .TP .B EINVAL .I len ist negativ, oder bei .BR sethostname ist .I len größer als die maximal zulässige Größe, oder bei .BR gethostname unter Linux/i386 ist .I len kleiner als die aktuelle Größe. .TP .B EPERM .BR sethostname wurde nicht vom Superuser aufgerufen. .TP .B EFAULT .I name ist eine ungültige Adresse. .SH "KOMPATIBEL ZU" Diese Funktionen werden nicht in POSIX.1 definiert, doch werden sie in B.4.4.1 der ISO/IEC 9945-1:1990 erwähnt. .SH BUGS Einige andere Implementationen von .B gethostname liefern erfolgreich .I len bytes, auch wenn .I name länger ist. Linux/Alpha verhält sich analog, während Linux/i386 in diesem Falle .B EINVAL zurückliefert. .SH ANMERKUNGEN In Linux/Alpha ist .B gethostname ein System Call, in Linux/i386 ist .B gethostname auf Libraryebene als Aufruf von .BR uname (2) realisiert. .SH "SIEHE AUCH" .BR getdomainname (2), .BR setdomainname (2), .BR uname (2).