Linux User/Kernel ABI: the realities of how C and C++ programs really talk to the OS

By Greg Law

All programs need to interact with the wider system in order to do useful work. C and C++ programmers typically write to the C library. It provides a mapping onto the OS that is a not-quite-perfect model of the OS underneath, and surprising behaviours can result. To be an expert programmer it is important to understand the ABI you are really programming to, for such times as you find yourself debugging via strace or without source code, fine grained profiling and optimisation, writing intercept libraries, etc.

There are many gotchas. This talk covers how system calls are really implemented (int 0x80, sysenter, the vdso and the vsyscall page, and how return codes are translated into errno); how signal handlers really work (including the surprising syscall restart mechanism); how pthreads map onto OS primitives; the finer details of ptrace (the mechanism on top of which strace and gdb are built); and some interesting and surprising results when the subtleties of these various mechanism combine. Some of the other subtleties covered include what it means when things are in an uninterruptible sleep, and very useful info that can be gathered from the /proc filesystem.





Your Privacy

By clicking "Accept Non-Essential Cookies" you agree ACCU can store non-essential cookies on your device and disclose information in accordance with our Privacy Policy and Cookie Policy.

Current Setting: Non-Essential Cookies REJECTED


By clicking "Include Third Party Content" you agree ACCU can forward your IP address to third-party sites (such as YouTube) to enhance the information presented on this site, and that third-party sites may store cookies on your device.

Current Setting: Third Party Content EXCLUDED



Settings can be changed at any time from the Cookie Policy page.