Hi,
if any one has the idea of the internal system calls which gets activated by using high level statements ( like printf ,scanf or malloc and so on) please provide me the links or any related info.

i have an idea that the internal system calls depends on the OS/Compiler.

but i want a comprehensive description of all or few poupular OS system calls/ high level statements.

So you want us to Google for you

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.

So you want us to Google for you

i googled for some time but dint find any use full rather related information about different OS system calls.

what i got was these below links but these are not having much related info.

<http://www.google.co.in/search?hl=en&q=system+calls+in+operating+system&meta=&aq=2&oq=system+calls+>

http://www.google.co.in/search?hl=en&q=system+calls+in+unix+used+by+c+compiler&btnG=Search&meta=&aq=f&oq=

http://www.google.co.in/search?hl=en&q=system+call+information+used+by+c+compilers&meta=&aq=f&oq=


so i thought some one else would be having some other info.

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.

Thanks for your response Dragon.

actually i work on linux OS and here i can find that read and write system calls are used as internal functions of scanf and printf.
( 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)

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.
i googled for some time but dint get any appropriate info.

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

commented: its so nice of you +1

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

It is not a direct mapping. printf() for example does a lot of work to parse the format string and the variable arguments. It also handles output formatting because write() does not do any of that. The file descriptor is usually stored in the FILE object for stdout that printf() uses along with other information needed to make the system calls.

commented: Thank a lot Tom U have been so helpfull +1

( 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.

commented: your post are so help full, thanks a lot +1

Thank you All for your time

i will do some research on these according to your suggestions and get back to you soon
:)

Thanks again.

Hey man -- do a lot of research then write a book so that you can make millions of money :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.