So you want us to Google for you
gerard4143
Nearly a Posting Maven
2,272 posts since Jan 2008
Reputation Points: 512
Solved Threads: 387
I've used a debugger to step through some of the printf() code on MS-Windows and found that eventually it calls win32 api WriteFile(). From that experience I would imagine other functions also eventually call win32 api functions. But those are the details that are compiler-implementation specific. There is nothing in the c or c++ standards that tell compiler writers how to implement the standard functions; they are free to do it any way they want to.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
If your looking for the source code for Linux system calls then download the kernel source code for your Linux distro and you'll find it there...The first file you want to investigate is - Entry.S - this file has all the code for the interrupt/syscall call that handles the dispatch....
Also this link may shed some light
http://asm.sourceforge.net/syscall.html#p3
gerard4143
Nearly a Posting Maven
2,272 posts since Jan 2008
Reputation Points: 512
Solved Threads: 387
( confused here on how the mapping is done between read ,write and scanf ,printf. because read/write takes file descriptors, buffers and size of data where as printf and scanf takes the variable lenght args: format strings and arguments)
printf() also takes a file descriptor -- stdin, stdout, and stderr are three file descriptors always available to C/C++ console programs. printf(), scanf() etc do a lot of pre-processing before sending the strings on to the system functions. All the system functions do is read or write data -- they don't do anything else with it. Formatting the data has to be done by the calling functions.similarly all the dma functions(malloc,calloc, realloc, memset,memcpy, memmove) also uses some built in system calls.
i just want to know is there any source that describes the library functions and whose corresponding system calls on different OS's.
There are descriptions of the system functions for each operating system, but you won't find them all in one convenient document. You will have to study each os that you are interested in.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
Hey man -- do a lot of research then write a book so that you can make millions of money :)
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343