C library provides functions such as write(),read(),open()...that we can use in our C program to make system calls. where can I find source code for these functions?

  • 3
    In the source code for the C library ;) The one normally used on GNU/Linux systems is gnu.org/software/libc/download.html – goldilocks Jul 16 '14 at 14:33
  • The book The C Programming Language 2nd Edition also known as K&R Book Discusses the implmentation of some of these implementations it is listed in Chapter 8 – vfbsilva Jul 16 '14 at 15:07

If you want source code for standard C library, look at the link @goldilocks provided.

If you want source code for linux system call, you must search through the linux source code. System call is defined in many locations of linux source. You can grep for string macro SYSCALL_DEFINE:

grep -r -n SYSCALL_DEFINE /path/to/linux_source

Some of them you can see here.


There is good deep and detailed description about system call at kernel side in recent lwn article: http://lwn.net/Articles/604287/ .


After GNU's libc, you can look at source code for other libc implementions:

Musl has source code on-line for browsing: most system calls are in here.

Someone has put Diet Libc into github. It's noted as unofficial, though.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.