Results 1 to 6 of 6
In Linux, a library call is a "normal" function call, while a system call goes through the kernel.
Library functions do not go to kernel mode for the call instruction, ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 04-27-2011 #1Just Joined!
- Join Date
- Mar 2011
- Posts
- 5
how do I know what system calls are invoked by a specific library call
In Linux, a library call is a "normal" function call, while a system call goes through the kernel.
Library functions do not go to kernel mode for the call instruction, but often do so within the actual library function. In fact, a single library function may make zero, one, or several system calls and do context switches to kernel mode.
My question is how do I know what system calls are invoked by a specific library to fulfill the library function?
For example, fgets() is a shared library function. What system calls are invoked by fgets() to really do its job? What is the implementation detail for the library?
Your response will be appreciated.
- 04-27-2011 #2strace. Run the program with prefix strace.how do I know what system calls are invoked by a specific library call
It show you the system calls used by that binary.strace ./a.outFirst they ignore you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
-----
FOSS India Award winning ext3fs Undelete tool www.giis.co.in. Online Linux Terminal http://www.webminal.org
- 04-27-2011 #3Just Joined!
- Join Date
- Mar 2011
- Posts
- 5
I know if I use "ltrace " and "strace" as a prefix, I will get all the library calls and system calls used by the executables. Since I will have a list of library calls and a list of system calls used, how do I know which system calls are invoked by a specific library call?
Thanks.
- 04-28-2011 #4
I don't know about group by glibc call options - One option would be create simple programs with specific glibc function call and use strace to debug.
But ,I think if you go through the strace checking system calls along with its arguments and return types. you can know which glibc call invoked what kind of sys.call.First they ignore you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
-----
FOSS India Award winning ext3fs Undelete tool www.giis.co.in. Online Linux Terminal http://www.webminal.org
- 04-29-2011 #5Just Joined!
- Join Date
- Mar 2011
- Posts
- 5
- 05-04-2011 #6
If you want to know for a specific library function, can't you just make 3 or so tiny programs that run one library call and then exit.
Then you run those trace things over them and compare the results. The differences will probably be of most interest.


Reply With Quote

