-@node System Information, System Configuration Limits, Users and Groups, Top
+@node System Information, System Configuration, Users and Groups, Top
@chapter System Information
This chapter describes functions that return information about the
This section explains how to identify the particular machine that your
program is running on. The identification of a machine consists of its
-Internet host name and Internet address; see @ref{Internet Domain}.
+Internet host name and Internet address; see @ref{Internet Namespace}.
@pindex hostname
@pindex hostid
The return value is @code{0} on success and @code{-1} on failure. In
the GNU C library, @code{gethostname} fails if @var{size} is not large
-enough; then you can try again with a larger array.
+enough; then you can try again with a larger array. The following
+@code{errno} error condition is defined for this function:
+
+@table @code
+@item ENAMETOOLONG
+The @var{size} argument is less than the size of the host name plus one.
+@end table
@pindex sys/param.h
On some systems, there is a symbol for the maximum possible host name
-length: @code{MAXHOSTNAMELENGTH}. It is defined in @file{sys/param.h}.
-But you can't count on this to exist, and it is cleaner to handle
+length: @code{MAXHOSTNAMELEN}. It is defined in @file{sys/param.h}.
+But you can't count on this to exist, so it is cleaner to handle
failure and try again.
+
+@code{gethostname} stores the beginning of the host name in @var{name}
+even if the host name won't entirely fit. For some purposes, a
+truncated host name is good enough. If it is, you can ignore the
+error code.
@end deftypefun
@comment unistd.h
system boot time.
The return value is @code{0} on success and @code{-1} on failure.
+The following @code{errno} error condition is defined for this function:
+
+@table @code
+@item EPERM
+This process cannot set the host name because it is not privileged.
+@end table
@end deftypefun
@comment unistd.h
@comment BSD
-@deftypefun {long int} gethostid ()
+@deftypefun {long int} gethostid (void)
This function returns the Internet address of the machine the program is
running on.
+@c !!! this is not necessarily the IP address. it is whatever was set
+@c with sethostid (or the `hostid' program). on sun4s, it is an
+@c unchangeable constant that is unique for each machine.
+@c making it the primary IP address is a convention.
@end deftypefun
@comment unistd.h
@var{id}. Only privileged processes are allowed to do this. Usually it
happens just once, at system boot time.
-@strong{Incomplete:} Is the return type from this function really
-@code{void}? The BSD man page does not document a return value.
-@end deftypefun
+The return value is @code{0} on success and @code{-1} on failure.
+The following @code{errno} error condition is defined for this function:
+@table @code
+@item EPERM
+This process cannot set the host name because it is not privileged.
+@end table
+@end deftypefun
@node Hardware/Software Type ID
@section Hardware/Software Type Identification
@table @code
@item char sysname[]
-This is the name of the operating system implementation. In the
-GNU library, the value is the string @code{"GNU C Library"}.
-@strong{Incomplete:} That had better not be true.
+This is the name of the operating system in use.
@item char nodename[]
This is the network name of this particular computer. In the GNU
system.
@item char machine[]
-This is a description of the hardware type that the operating system
-is running on.
-
-The possible values for the GNU C library are as follows:
+This is a description of the type of hardware that is in use.
+
+@c !!! this is only true if the operating system has no uname system call.
+The GNU C Library fills in this field based on the configuration name
+that was specified when building and installing the library. GNU uses a
+three-part name to describe a system configuration; the three parts are
+@var{cpu}, @var{manufacturer} and @var{system-type}, and they are
+separated with dashes. Any possible combination of three names is
+potentially meaningful, but most such combinations are meaningless in
+practice and even the meaningful ones are not necessarily supported by
+any particular GNU program.
+
+Since the value in @code{machine} is supposed to describe just the
+hardware, it consists of the first two parts of the configuration name:
+@samp{@var{cpu}-@var{manufacturer}}.
+
+@c !!! this is yet another case where you are losing massively because
+@c you want to have an explicit list. many others are possible.
+Here is a list of all the possible alternatives:
@quotation
-@code{"i386"}, @code{"m68k"}, @code{"sparc"}
+@code{"i386-@var{anything}"}, @code{"m68k-hp"}, @code{"sparc-sun"},
+@code{"m68k-sun"}, @code{"m68k-sony"}, @code{"mips-dec"}
@end quotation
-
-We try to keep these strings' contents the same as the symbols that the
-GNU C compiler defines to indicate the type of machine.
@end table
@end deftp
The @code{uname} function fills in the structure pointed to by
@var{info} with information about the operating system and host machine.
A non-negative value indicates that the data was successfully stored.
-@code{-1} as the value indicates an error.
-@strong{Incomplete:} What can cause an error in this function?
+@code{-1} as the value indicates an error. The only error possible is
+@code{EFAULT}, which we normally don't mention as it is always a
+possibility.
@end deftypefun
-
-
-
-