-2

Where do I find all system calls and library calls?

Can I list them?

How to find out which ones occur most often?

closed as too broad by Thomas Dickey, Stephen Harris, thrig, Jeff Schaller, jasonwryan Sep 7 '16 at 1:11

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

1

I take it you want the system/library calls which are made from a particular program, not all of them.

strace shows all the external calls from an executable program. If the program has a graphic user interface, there'll be thousands of them - make it difficult to analyze them 'on-screen'.

To save all the calls, you can redirect strace's output to a file:

strace your_executable 2> my_log_file

which will close when exiting the program. You can then view/search the file in any text viewer/editor. More information is available from man strace, or from eg. linux.die.net/man/1/strace. This page shows some interesting ways to use strace.

For completeness: Stephen Harris suggested below:

FWIW, strace -o log_file -f your_executable may be better; the -o flag causes strace to send output there, and the -ff means that if the program calls fork() then this child process is also followed. Depending on the app -ff might be better, so each child process data is in its own log file. strace shows system calls; ltrace can show library calls.

And even more from Mark Plotnick:

Yeah, ltrace -c -S command... is what to use to show a count of library and system calls.

  • You are right! I need the system/library calls of /bin/date. Now it makes sense. This assignment should have been more clear. Thank you! – surveyCorps Sep 6 '16 at 23:07
  • FWIW, strace -o log_file -f your_executable may be better; the -o flag causes strace to send output there, and the -ff means that if the program calls fork() then this child process is also followed. Depending on the app -ff might be better, so each child process data is in its own log file. strace shows system calls; ltrace can show library calls. – Stephen Harris Sep 6 '16 at 23:11
  • Yeah, ltrace -c -S command... is what to use to show a count of library and system calls. – Mark Plotnick Sep 6 '16 at 23:19

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