
The World of Linux System Calls - nkurz
http://sysdigcloud.com/fascinating-world-linux-system-calls/
======
Rapzid
For anyone craving more on syscalls, I can't recommend "The Linux Programming
Interface" enough.

~~~
rubiquity
Ditto. I love this book. It's full of all sorts of wonderful knowledge about
how Linux works. It has also served as a great way to prop my monitor up
higher from time to time!

Here's a link: [http://man7.org/tlpi/](http://man7.org/tlpi/)

------
JoeAltmaier
I wrote Linux kernel code years ago. I was struck with how similar the APIs
were for compiled-in drivers, loadable drivers and applications. They were
almost identical, with small variations in spelling and parameters. It seemed
to me that, with only a little more effort, they could have been nearly
identical. That would have greatly helped make code portable and reusable e.g.
write a library that could be used by apps and drivers both.

~~~
fit2rule
IMHO, portable code is the reason for the different nomenclature. There is
also something to be said for the cognizant development of those API's in such
a manner .. new words control ownership.

------
frou_dh
Learning the general idea of system calls was a revelation to me since it
implied that, in a sense, every language was ultimately a scripting language
for the kernel.

------
justincormack
If you want to explore system calls without C or assembler, I wrote a LuaJIT
library [1]. You could port it to another language too.

[1]
[https://github.com/justincormack/ljsyscall](https://github.com/justincormack/ljsyscall)

~~~
walterbell
Is this comparable to Erlang on Xen and OpenMirage (ocaml)?

Are there any examples of network-facing services which use this library to
execute on a minimal Linux kernel+userspace? What do you think of supporting
MiniOS in the future?

~~~
justincormack
It runs on Xen via the rump kernel
[http://rumpkernel.org](http://rumpkernel.org). it should run on OSv too but
will need some work as that uses the glibc ABI not the kernel ABI which differ
slightly.

~~~
fit2rule
Wow, thank you for this work - I'm very interested in using LuaJIT and kernel
services in this way, so I will spend some research hours this week reading it
and running it .. and using it for things. I guess I'll PM you with a report
from the field at some point ..

~~~
justincormack
Get in touch if you need help or to let me know what you get up to with it -
email is in profile, or via github...

------
greenleafjacob
Nitpick:

> For example, x86 processors usually call interrupt 80, while x64 processors
> use the syscall processor instruction.

It's 0x80, or 128 in decimal.

~~~
chjj
Further Nitpick:

Nowdays they don't use INT 0x80 for syscalls anymore. It's faster to use
something called "virtual system calls" from what I understand (I am not a
kernel dev, so don't quote me). It's just what it sounds like. If you ldd a
linux binary, you'll see a shared object called `linux-gate.so` or `linux-
vdso.so` (it's been renamed a few times). This file doesn't actually exist.
It's an imaginary library that exists as the doorway into the kernel for
making these calls.

I tried to dig up something I read on this. This is what I found if anyone is
interested: [http://www.trilithium.com/johan/2005/08/linux-
gate/](http://www.trilithium.com/johan/2005/08/linux-gate/)

