.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
-.TH UNAME 2 2001-12-15 "Linux 2.5.0" "Linux Programmer's Manual"
+.\" 2007-07-05 mtk: Added details on underlying system call interfaces
+.\"
+.TH UNAME 2 2007-07-05 "Linux" "Linux Programmer's Manual"
.SH NAME
uname \- get name and information about current kernel
.SH SYNOPSIS
.I utsname
struct is defined in
.IR <sys/utsname.h> :
-.in +0.5i
+.in +4n
.nf
struct utsname {
};
.fi
-.in -0.5i
+.in
The length of the arrays in a
.I struct utsname
-is unspecified; the fields are terminated by a null byte ('\\0').
+is unspecified; the fields are terminated by a null byte (\(aq\\0\(aq).
.SH "RETURN VALUE"
On success, zero is returned.
On error, \-1 is returned, and
Some operating systems
or libraries use a hardcoded 9 or 33 or 65 or 257.
Other systems use
-SYS_NMLN or _SYS_NMLN or UTSLEN or _UTSNAME_LENGTH.
+.B SYS_NMLN
+or
+.B _SYS_NMLN
+or
+.B UTSLEN
+or
+.BR _UTSNAME_LENGTH .
Clearly, it is a bad
idea to use any of these constants; just use sizeof(...).
Often 257 is chosen in order to have room for an internet hostname.
.LP
-There have been three Linux system calls \fIuname\fP().
-The first one
-used length 9, the second one used 65, the third one also uses 65 but
-adds the \fIdomainname\fP field.
-.LP
Part of the utsname information is also accessible via
.BR sysctl (2)
and via
.IR osrelease ,
.IR version ,
.IR domainname }.
+.SS Underlying kernel interface
+.LP
+Over time, increases in the size of the
+.I utsuname
+structure have led to three successive versions of
+.BR uname ():
+.IR sys_olduname ()
+(slot
+.IR __NR_oldolduname ),
+.IR sys_uname ()
+(slot
+.IR __NR_olduname ),
+and
+.IR sys_newuname ()
+(slot
+.IR __NR_uname) .
+The first one used length 9 for all fields;
+the second used 65;
+the third also uses 65 but adds the \fIdomainname\fP field.
+The glibc
+.BR uname ()
+wrapper function hides these details from applications,
+invoking the most recent version of the system call provided by the kernel.
.SH "SEE ALSO"
.BR uname (1),
.BR getdomainname (2),