66 lines
2.2 KiB
C
66 lines
2.2 KiB
C
#ifndef VLIBC_SYS_UTSNAME_H
|
|
#define VLIBC_SYS_UTSNAME_H
|
|
|
|
/*
|
|
* vlibc — <sys/utsname.h>.
|
|
*
|
|
* System identification: uname() and struct utsname. uname is XSI [CX] in
|
|
* POSIX.1-2008 (glibc gates it behind _XOPEN_SOURCE, not _POSIX_C_SOURCE),
|
|
* so the whole surface sits at level 2 — nothing here is POSIX.1-2008 base.
|
|
*
|
|
* Level 2 (muslmimic): uname, struct utsname.
|
|
*
|
|
* struct utsname mirrors the x86_64 kernel's struct new_utsname exactly: six
|
|
* NUL-terminated 65-byte character arrays (the kernel's _UTSNAME_LENGTH, 64
|
|
* usable characters plus the terminator). The kernel's uname syscall copies
|
|
* all 390 bytes, so the layout is an ABI fact, not a style choice.
|
|
* domainname is a Linux extension (the kernel's uts namespace domain name)
|
|
* and is not part of the POSIX struct; it is included for glibc
|
|
* compatibility — POSIX only requires the first five fields.
|
|
*
|
|
* The declaration carries no intent attribute: uname performs I/O with side
|
|
* effects and reports failures through errno, so const/pure would be
|
|
* unsound (see the rationale in <unistd.h>).
|
|
*/
|
|
|
|
#include <vlibc/features.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#if VLIBC_LEVEL_GE(2)
|
|
|
|
/*
|
|
* The system identification strings. Each field is NUL-terminated; the
|
|
* 65-byte width matches the kernel buffer (64 characters plus the NUL).
|
|
* sysname is the operating system name ("Linux"), nodename the host name,
|
|
* release the kernel release, version the kernel build, machine the
|
|
* hardware identifier ("x86_64"), and domainname the NIS/UTS domain name.
|
|
*/
|
|
struct utsname
|
|
{
|
|
char sysname[65]; /* operating system name */
|
|
char nodename[65]; /* name within the communications network */
|
|
char release[65]; /* operating system release level */
|
|
char version[65]; /* operating system version */
|
|
char machine[65]; /* hardware type */
|
|
char domainname[65]; /* NIS/UTS domain name (Linux extension) */
|
|
};
|
|
|
|
/*
|
|
* Fill the buffer with the current system identification strings; return
|
|
* 0, or -1 with errno set when the buffer points outside the address
|
|
* space. The strings are copies from the kernel's UTS namespace.
|
|
*/
|
|
int
|
|
uname(struct utsname *buf);
|
|
|
|
#endif /* VLIBC_LEVEL_GE(2) */
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* VLIBC_SYS_UTSNAME_H */
|