r/cprogramming • u/DryAdministration158 • Oct 16 '26
How important is knowing syscalls in C?
Hello, idk if its just me I have been trying to get more and more into C but every video or concept or project I see people bring out 3 different syscalls that I have never heard of (that's a bit exaggerating but you know what I mean)
Am i supposed to know all of them? Memorise them?
Is there something I'm missing in terms of these bc I even realised they can be up to 500 different ones which is a lot to memorise, and even so how should I start learning them?
16
Upvotes
6
u/pjl1967 Oct 16 '26 edited Oct 16 '26
Perhaps instead of watching various videos with varying levels of focus, detail, quality, and accuracy, just pick a good book on C.
No and no. For the details of any syscall, that's what man pages are for. BTW, a good book will also hopefully list only those syscalls you need to know about since you're more likely to encounter the often-used ones.
37
u/mrtlo Oct 16 '26
Knowing C, and knowing "syscalls", would be separate topics IMHO
3
u/ripulejejs Oct 16 '26
what's your usecase?
most people hide behind the c standard library, or some higher abstraction.
so why not just do that? if you use manual syscalls, your code won't be portable between OS-es unless you spend a lot of extra time dealing with that.
11
u/SmokeMuch7356 Oct 16 '26
Know where to look them up if or when you actually need them. You'll memorize the stuff you use every day; for everything else, that's why man pages exist.
3
u/zhivago Oct 17 '26
Syscalls are not part of C.
Learn them like any other API.
2
u/SuperBoysenberry3660 Oct 16 '26 edited Oct 16 '26
There is a libc library with functions for c language (available on Linux and Windows). Syscalls is interface of operating system - on Linux there are linux syscalls (you can use these on Linux from c). On Windows you have some platform library like Win32 - to access platform/os functionality (you can use it on windows from c).
2
u/pjl1967 Oct 16 '26
Sorry for the separate reply, but — and to muddy the water even further — there's the C standard library, POSIX, and syscalls. Many syscalls are part of POSIX, but not all, e.g., Linux-specific ones.
Learning POSIX is more important than learning non-POSIX, platform-specific syscalls.
2
u/Runt1m3_ Oct 16 '26
Only if you require it or are doing lower level stuff, you have the libc as an abstraction already.
Still it's fun to sometimes read syscall tables and messing with them using assembly hahahah
2
u/serge-mv Oct 16 '26
It depends on what software you are writing and the OS you are writing it for. Syscalls are OS specific (mostly). So using them will make your program less portable, if you care about it. On the other hand, maybe you are writing a system tool for a particular OS, then you kinda have to know them.
In general case, you are better of either using build-in libraries or external ones.
2
u/DumDee-Dum Oct 17 '26
Not at all no one can memorise all syscalls and they are even different from every OS so definitely not
If you need one you will constantly run into it and so you will naturally memorise it just like you memorise standard functions like printf
Personally I write bare-metal code for embedded systems and haven’t used syscalls because I work with devices that don’t even have an OS! However, other embedded developers use an OS and so they need certain functions that are common for them
In short: you can be an excellentC developer without syscalls. And if your line of work requires you to know some then you pick them up as you go
2
u/TheChief275 Oct 19 '26
Not at all important. Unless you want something obscure and non-portable, just stick to the functions defined in <unistd.h>. These are lightly abstracted syscalls, but the benefit is that even OS's like Windows define a compatibility function for a large portion of these functions
0
u/esaule Oct 17 '26
let me put it this way, if I am interviewing a C programmer and he doesn't know the standard syscall; I'm not hiring them!