System Calls: UNIX, Linux, BSD, and Solaris Flavors

Are there any differences between the number of system calls in the major * NIX variants?

What syscalls will be universally supported?

+1


source to share


2 answers


Anything that is not posix standard could be an extra system call, or maybe extra library functions above the system call level. If your goal is to write a portable finger of posix code and make the most of the c library (as opposed to direct system calls).

In case you're just wondering, they vary quite widely. You don't need much system call support to be posix compliant. It specifies the interfaces that need to be supported, but whether you do this through a call to the kernel or a jump to a shared library is largely up to you.

Mac OS X doesn't even guarantee binary compatibility of system calls between releases, they treat them as private interfaces between system libraries and OS. What most people think of as system calls are actually small stubs in the dynamic library that access the kernel, and if you make the system calls directly and don't link to that dynamic library and call stub functions, then your code can break down between OS releases.



This flexibility means that a number of operating systems implement system calls that are completely different from what they need to support posix, and then deal with the differences in their libraries. For example, the Linux threading implementation is based on the clone () system call, and they do most of the accounting for the pthreads interface to work in their libraries.

So, if your goal is to embed the standard library, it doesn't link to anything else, and works with multiple unixes, you may find that in some cases some things are a little tricky. If your goal is to write something that is related to the standard libraries on different Unixes, you can end up with a generally uniform interface.

+10


source


The best I can find is the Unix-Linux-BSD Cheat-Sheets , for the various syscall variations to be compared to Solaris syscalls .



For Unix alone, the number of system calls is four times that or less, depending on what you mean by "system call".
The first release of Advanced UNIX Programming contains only about 70 genuine system calls β€” for example, open, read, and write; but not library calls like fopen, fread and fwrite.
The second edition includes about 300. (There are about 1100 standard function calls in total, but many of them are part of the standard C library or are clearly not the core).
UNIX today has streams, real-time signals, asynchronous I / O, and new inter-process communication (POSIX IPC) features, none of which existed 20 years ago.

+5


source







All Articles