SYSCALL(2)
π SYSCALL(2) π
okay bestie, welcome to the System Calls Manual entry for SYSCALL(2) β yes we're going indirect, it's giving β¨middleware energyβ¨ and honestly? iconic.
πΈ NAME πΈ
syscall, __syscall β indirect system call π¦
π LIBRARY π
Standard C Library (libc, -lc) π
β¨ SYNOPSIS β¨
#include <sys/syscall.h>
#include <unistd.h>
int
syscall(int number, ...);
off_t
__syscall(quad_t number, ...);
π DESCRIPTION π
so the way that syscall() works is: it performs the system call whose assembly language interface has the specified number with the specified arguments. fr fr, that's the whole vibe. π«Ά
the symbolic constants for system calls can be found in the header file <sys/syscall.h>. go look, they're all in there, no cap. π₯
now, the __syscall() form should be used when one or more of the arguments is a 64-bit argument β that's the one that makes sure your argument alignment is correct. don't skip it, bestie, alignment matters. π
and like, what is this even for? this system call is useful for testing new system calls that do not have entries in the C library. it's the VIP backstage pass for syscalls that haven't been officially introduced to libc yet. main character energy for real. π
π RETURN VALUES π
the return values are defined by the system call being invoked β so like, it's not a fixed thing, it depends on which syscall you poked. π
in general:
- a 0 return value indicates success β¨
- a -1 return value indicates an error, and an error code is stored in
errnoπ
π°οΈ HISTORY π°οΈ
the syscall() function appeared in 4.0BSD. vintage. antique. historical queen. π
π BUGS π
there is no way to simulate system calls that have multiple return values such as pipe(2). that's it, that's the bug, we're all just living with it. π
and that's the whole page, bestie π this one came to you from Debian, dated June 16, 1993 β yeah it's older than us but it still ate. mwah. πβ¨π¦
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- Copyright (c) 1980, 1991, 1993 The Regents of the University of California. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms