From 3d08cd331c1adcf0d917392f7e527b3f00511748 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 24 May 2024 06:52:22 +0200 Subject: Merging upstream version 6.8. Signed-off-by: Daniel Baumann --- man/man2/uname.2 | 134 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 man/man2/uname.2 (limited to 'man/man2/uname.2') diff --git a/man/man2/uname.2 b/man/man2/uname.2 new file mode 100644 index 0000000..3f7ada9 --- /dev/null +++ b/man/man2/uname.2 @@ -0,0 +1,134 @@ +.\" Copyright (C) 2001 Andries Brouwer . +.\" +.\" SPDX-License-Identifier: Linux-man-pages-copyleft +.\" +.\" 2007-07-05 mtk: Added details on underlying system call interfaces +.\" +.TH uname 2 2024-05-02 "Linux man-pages (unreleased)" +.SH NAME +uname \- get name and information about current kernel +.SH LIBRARY +Standard C library +.RI ( libc ", " \-lc ) +.SH SYNOPSIS +.nf +.B #include +.P +.BI "int uname(struct utsname *" buf ); +.fi +.SH DESCRIPTION +.BR uname () +returns system information in the structure pointed to by +.IR buf . +The +.I utsname +struct is defined in +.IR : +.P +.in +4n +.EX +struct utsname { + char sysname[]; /* Operating system name (e.g., "Linux") */ + char nodename[]; /* Name within communications network + to which the node is attached, if any */ + char release[]; /* Operating system release + (e.g., "2.6.28") */ + char version[]; /* Operating system version */ + char machine[]; /* Hardware type identifier */ +#ifdef _GNU_SOURCE + char domainname[]; /* NIS or YP domain name */ +#endif +}; +.EE +.in +.P +The length of the arrays in a +.I struct utsname +is unspecified (see NOTES); +the fields are terminated by a null byte (\[aq]\e0\[aq]). +.SH RETURN VALUE +On success, zero is returned. +On error, \-1 is returned, and +.I errno +is set to indicate the error. +.SH ERRORS +.TP +.B EFAULT +.I buf +is not valid. +.SH VERSIONS +The +.I domainname +member (the NIS or YP domain name) is a GNU extension. +.P +The length of the fields in the struct varies. +Some operating systems +or libraries use a hardcoded 9 or 33 or 65 or 257. +Other systems use +.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(...). +SVr4 uses 257, "to support Internet hostnames" +\[em] this is the largest value likely to be encountered in the wild. +.SH STANDARDS +POSIX.1-2008. +.SH HISTORY +POSIX.1-2001, SVr4, 4.4BSD. +.SS C library/kernel differences +Over time, increases in the size of the +.I utsname +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 +.\" That was back before Linux 1.0 +used length 9 for all fields; +the second +.\" That was also back before Linux 1.0 +used 65; +the third also uses 65 but adds the +.I domainname +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 NOTES +The kernel has the name, release, version, and supported machine type built in. +Conversely, the +.I nodename +field is configured by the administrator to match the network +(this is what the BSD historically calls the "hostname", +and is set via +.BR sethostname (2)). +Similarly, the +.I domainname +field is set via +.BR setdomainname (2). +.P +Part of the utsname information is also accessible via +.IR /proc/sys/kernel/ { ostype , +.IR hostname , +.IR osrelease , +.IR version , +.IR domainname }. +.SH SEE ALSO +.BR uname (1), +.BR getdomainname (2), +.BR gethostname (2), +.BR uts_namespaces (7) -- cgit v1.2.3