Do they? for example, I was thinking of the simple system call chown. Does it call other system calls like read and write? How can we find out?


Sort of.

Kernel (e.g. Linux) has own internal system call interface, so one system call can usually call other system call, without need to setup the entire system call procedure.

How to find out? You have the kernel sources, you have probably grep, so you could find out.

| improve this answer | |
  • 1
    or truss/strace the first command/call... – Jeff Schaller Dec 20 '16 at 13:21
  • 4
    @JeffSchaller: How's strace going to show you subsequent internal calls? AFAIK, strace only shows system calls from userspace to kernel. If you can also trace internal calls, I'd like to know how. – dirkt Dec 20 '16 at 14:28
  • @JeffSchaller: Exactly. I use strace for my tracing purposes. and as said, it doesn't give me the internal calls – MoeKav Dec 20 '16 at 15:06
  • perf can show you stack traces that include the internal kernel calls – Alnitak Dec 20 '16 at 16:08
  • good point, @dirkt - I was stuck in userspace :) – Jeff Schaller Dec 20 '16 at 16:26

Yes they do. For example the fork system call actually calls the clone system call. We can also use the clone system call for finer control over the child process.

| improve this answer | |
  • 2
    No, the fork() syscall doesn't call the clone() syscall. No syscall is calling another syscall, which doesn't even make sense. What's probably confusing you is that glibc (ie. the userland C library) now implements the fork() function as a wrapper around the clone() not the fork() system call, which is clearly showing when strace-ing or debugging a program (fork() = clone(CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD)) – mosvy Jun 23 '19 at 7:14
  • Sorry for the mistake. The old fork() syscall doesn't call clone(). The the glibc wrapper function fork() calls the syscall : clone(). Thanks @mosvy for pointing that out. – Tezeswar Jun 23 '19 at 7:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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