sysinfo(2)

โœจ sysinfo(2) โœจ

okay bestie, welcome to sysinfo โ€” the System Calls Manual girlie whose whole entire job is spilling the tea on your system. that's the page we're on: section 2, system calls. no cap. ๐Ÿ’–


๐ŸŒธ NAME ๐ŸŒธ

sysinfo โ€” return system information

like, it literally just hands you the receipts on your machine. ๐Ÿ’…


๐Ÿ“š LIBRARY ๐Ÿ“š

Standard C library (libc, -lc)


๐Ÿฆ‹ SYNOPSIS ๐Ÿฆ‹

#include <sys/sysinfo.h>

int sysinfo(struct sysinfo *info);

๐Ÿ‘‘ DESCRIPTION ๐Ÿ‘‘

sysinfo() returns certain statistics on memory and swap usage, as well as the load average. it's giving "tell me everything about yourself" energy and honestly? valid. ๐Ÿซถ

Until Linux 2.3.16, sysinfo() returned information in the following structure:

struct sysinfo {
    long uptime;             /* Seconds since boot */
    unsigned long loads[3];  /* 1, 5, and 15 minute load averages */
    unsigned long totalram;  /* Total usable main memory size */
    unsigned long freeram;   /* Available memory size */
    unsigned long sharedram; /* Amount of shared memory */
    unsigned long bufferram; /* Memory used by buffers */
    unsigned long totalswap; /* Total swap space size */
    unsigned long freeswap;  /* Swap space still available */
    unsigned short procs;    /* Number of current processes */
    char _f[22];             /* Pads structure to 64 bytes */
};

In the above structure, the sizes of the memory and swap fields are given in bytes. got it? bytes. not vibes. bytes. ๐Ÿ”ฅ


Since Linux 2.3.23 (i386) and Linux 2.3.48 (all architectures) the structure is:

struct sysinfo {
    long uptime;             /* Seconds since boot */
    unsigned long loads[3];  /* 1, 5, and 15 minute load averages */
    unsigned long totalram;  /* Total usable main memory size */
    unsigned long freeram;   /* Available memory size */
    unsigned long sharedram; /* Amount of shared memory */
    unsigned long bufferram; /* Memory used by buffers */
    unsigned long totalswap; /* Total swap space size */
    unsigned long freeswap;  /* Swap space still available */
    unsigned short procs;    /* Number of current processes */
    unsigned long totalhigh; /* Total high memory size */
    unsigned long freehigh;  /* Available high memory size */
    unsigned int mem_unit;   /* Memory unit size in bytes */
    char _f[20-2*sizeof(long)-sizeof(int)];
                             /* Padding to 64 bytes */
};

In the above structure, sizes of the memory and swap fields are given as multiples of mem_unit bytes. so it's not raw bytes anymore bestie, it's bytes times mem_unit. do the math. ๐Ÿงฎโœจ


๐Ÿ’– RETURN VALUE ๐Ÿ’–

On success, sysinfo() returns zero. icon behavior. ๐ŸŽ€

On error, -1 is returned, and errno is set to indicate the error. not iconic but at least it tells you why. ๐Ÿ˜ญ


๐Ÿšจ ERRORS ๐Ÿšจ

  • EFAULT โ€” info is not a valid address. like girl, that pointer is not pointing anywhere real. ๐Ÿ’€

๐ŸŒˆ STANDARDS ๐ŸŒˆ

Linux. that's it. that's the standard. exclusive. ๐Ÿ’…


๐Ÿ“œ HISTORY ๐Ÿ“œ

Linux 0.98.pl6. ancient. vintage. a whole elder. ๐Ÿ‘‘


๐Ÿ“ NOTES ๐Ÿ“

All of the information provided by this system call is also available via /proc/meminfo and /proc/loadavg. so if the syscall isn't your thing, the proc filesystem has you covered. iykyk. ๐ŸŒธ


๐Ÿ” SEE ALSO ๐Ÿ”


and that's the whole page, bestie!! go forth and query your system. slay. periodt. ๐Ÿ’œโœจ

this was brought to you by Linux man-pages 6.20, dated 2026-02-08 โ€” mwah, love u, bye ๐Ÿซถ๐ŸŽ€

๐Ÿ“ฆ where this page comes from
  • arch rolling: man-pages 6.20-1 ยท BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
  • nixpkgs unstable: man-pages 6.20
  • ๐Ÿ“œ the page's license: Linux-man-pages-copyleft
  • ๐Ÿ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms