- Using strace
- access: Testing File Permissions
- fcntl: Locks and Other File Operations
- fsync and fdatasync: Flushing Disk Buffers
- getrlimit and setrlimit: Resource Limits
- getrusage: Process Statistics
- gettimeofday: Wall-Clock Time
- The mlock Family: Locking Physical Memory
- mprotect: Setting Memory Permissions
- nanosleep: High-Precision Sleeping
- readlink: Reading Symbolic Links
- sendfile: Fast Data Transfers
- setitimer: Setting Interval Timers
- sysinfo: Obtaining System Statistics
- uname
8.15 uname
The uname system call fills a structure with various system information, including the computer's network name and domain name, and the operating system version it's running. Pass uname a single argument, a pointer to a struct utsname object. Include <sys/utsname.h> if you use uname.
The call to uname fills in these fields:
sysname—The name of the operating system (such as Linux).
release, version—The Linux kernel release number and version level.
machine—Some information about the hardware platform running Linux. For x86 Linux, this is i386 or i686, depending on the processor.
node—The computer's unqualified hostname.
__domain—The computer's domain name.
Each of these fields is a character string.
The small program in Listing 8.13 prints the Linux release and version number and the hardware information.
Listing 8.13 (print-uname) Print Linux Version Number and Hardware Information
#include <stdio.h> #include <sys/utsname.h> int main () { struct utsname u; uname (&u); printf ("%s release %s (version %s) on %s\n", u.sysname, u.release, u.version, u.machine); return 0; }