intro(2)
๐ NAME ๐
okay so bestie, welcome to intro(2) โ this is literally the intro to system calls, and it lives in Section 2 of the manual, aka the System Calls Manual. it's giving "table of contents but make it a vibe." ๐ฆ
๐ธ DESCRIPTION ๐ธ
so like. Section 2 of the manual is all about the Linux system calls. and what even is a system call? it's an entry point into the Linux kernel. that's it, that's the whole thing. ๐
but here's the tea: usually you do not invoke system calls directly. nope! instead, most system calls have a matching C library wrapper function that does the little ritual for you (like, y'know, trapping to kernel mode) so the syscall actually gets invoked. which means calling a system call looks exactly the same as calling a normal library function. no cap. โจ
and in a lot of cases, that C library wrapper function literally does nothing more than:
- copying the arguments and the unique system call number into the registers where the kernel expects them ๐
- trapping to kernel mode โ and that's where the kernel does the real work of the system call ๐
- setting
errnoif the system call returns an error number when the kernel hands the CPU back to user mode ๐
however (plot twist ๐ซถ), in a few cases a wrapper function does a lil more than that โ for example, doing some preprocessing of the arguments before trapping to kernel mode, or postprocessing the values the system call returns. when that happens, the man pages in Section 2 generally try to note the deets of both the (usually GNU) C library API interface and the raw system call. most commonly, the main DESCRIPTION is all about the C library interface, and the differences for the actual system call get covered over in the NOTES section. iykyk. ๐
for a list of the Linux system calls, see syscalls(2). โญ
๐ฅ RETURN VALUE ๐ฅ
on error, most system calls return a negative error number โ like, the negated value of one of those constants described in errno(3). but the C library wrapper is doing the most to hide that from you: when a system call returns a negative value, the wrapper copies the absolute value into the errno variable and returns -1 as the return value of the wrapper. sneaky but iconic. ๐
the value returned by a successful system call depends entirely on the call. many system calls return 0 on success, but some can return nonzero values from a successful call. the details live in the individual manual pages. no shortcuts bestie ๐
and in some cases, the programmer has to define a feature test macro in order to get the declaration of a system call from the header file specified in the man page SYNOPSIS section. (and where those are required? they must be defined before including any header files. periodt.) in those cases, the required macro is described in the man page. for further info on feature test macros, see feature_test_macros(7). ๐ง
โจ STANDARDS โจ
certain terms and abbreviations get used to indicate UNIX variants and standards that calls in this section conform to. see standards(7). ๐
๐ NOTES ๐
๐ซ Calling directly ๐ซ
in most cases it's unnecessary to invoke a system call directly, but there are times when the Standard C library just doesn't implement a nice wrapper function for you. and in that case, the programmer has to manually invoke the system call using syscall(2). historically, this was also possible using one of the _syscall macros described in _syscall(2). throwback fr fr ๐ฐ๏ธ
๐ซ Authors and copyright conditions ๐ซ
look at the header of the manual page source for the author(s) and copyright conditions. and note that these can be different from page to page! yes bestie, every single one. check it yourself. ๐
๐ SEE ALSO ๐
_syscall(2)syscall(2)syscalls(2)errno(3)intro(3)capabilities(7)credentials(7)feature_test_macros(7)mq_overview(7)path_resolution(7)pipe(7)pty(7)sem_overview(7)shm_overview(7)signal(7)socket(7)standards(7)symlink(7)system_data_types(7)sysvipc(7)time(7)
and that's the whole page babe ๐ซถ this one's from Linux man-pages 6.20, dated 2026-02-08 โ so if you were wondering when this vibe check happened, now you know. go read syscalls(2) next, ily, 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
- Copyright 2007, Michael Kerrisk <mtk.manpages@gmail.com>
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms