Scroll to navigation

uname(2) System Calls Manual uname(2)

NOME

uname - restituisce nome e informazioni sul kernel attuale

LIBRARY

Standard C library (libc, -lc)

SINTASSI

#include <sys/utsname.h>
int uname(struct utsname *buf);

DESCRIZIONE

uname() restituisce informazioni sul sistema attraverso il puntatore buf. La struttura utsname è definita in <sys/utsname.h>:


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 };

La lunghezza degli array in una struttura utsname non è specificata (vedere NOTE); i campi sono terminati con un byte nullo ('\0').

VALORE RESTITUITO

In caso di successo restituisce zero. In caso di errore restituisce -1, e errno verrà impostato per indicare l'errore.

ERRORI

bufnon è valido.

VERSIONI

Il membro domainname (il nome di dominio NIS o YP) è un'estensione GNU.

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 SYS_NMLN or _SYS_NMLN or UTSLEN or _UTSNAME_LENGTH. Clearly, it is a bad idea to use any of these constants; just use sizeof(...). SVr4 uses 257, "to support Internet hostnames" — this is the largest value likely to be encountered in the wild.

STANDARDS

POSIX.1-2008.

STORIA

POSIX.1-2001, SVr4, 4.4BSD.

Differenze tra la libreria C e il kernel

Col tempo, aumenti nella dimensione della struttura utsname hanno portato a tre versioni successive di uname(): sys_olduname() (slot __NR_oldolduname), sys_uname() (slot __NR_olduname), e sys_newuname() (slot __NR_uname). La prima usava la lunghezza 9 per tutti i campi; la seconda usava 65; anche la terza usava 65, aggiungendo però il campo domainname. La funzione wrapper di glibc, uname (), nasconde questi dettagli alle applicazioni, invocando la versione più recente della chiamata di sistema fornita dal kernel.

NOTE

The kernel has the name, release, version, and supported machine type built in. Conversely, the nodename field is configured by the administrator to match the network (this is what the BSD historically calls the "hostname", and is set via sethostname(2)). Similarly, the domainname field is set via setdomainname(2).

Parte dell'informazione utsname è anche accessibile attraverso /proc/sys/kernel/{ostype, hostname, osrelease, version, domainname}.

VEDERE ANCHE

uname(1), getdomainname(2), gethostname(2), uts_namespaces(7)

TRADUZIONE

La traduzione italiana di questa pagina di manuale è stata creata da Goffredo Baroncelli <kreijack@usa.net>, Giulio Daprelà <giulio@pluto.it>, Elisabetta Galli <lab@kkk.it> e Marco Curreli <marcocurreli@tiscali.it>

Questa traduzione è documentazione libera; leggere la GNU General Public License Versione 3 o successiva per le condizioni di copyright. Non ci assumiamo alcuna responsabilità.

Per segnalare errori nella traduzione di questa pagina di manuale inviare un messaggio a pluto-ildp@lists.pluto.it.

30 marzo 2023 Linux man-pages 6.05.01