Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

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?

share|improve this question
2  
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

3 Answers 3

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

share|improve this answer

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.

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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