I'm working through some homework, and I need to report which system calls a C program makes use of.
I noticed though that exit
doesn't show up in strace
reports.
#include <stdlib.h>
int main() {
exit(0);
}
┌─[brendon@parrot]─[~/Desktop/Classes/OSInternals/Lab3]
└──╼ $gcc exit.c
┌─[brendon@parrot]─[~/Desktop/Classes/OSInternals/Lab3]
└──╼ $strace -c ./a.out
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
38.74 0.001056 150 7 mmap
11.12 0.000303 151 2 openat
10.20 0.000278 139 2 fstat
10.09 0.000275 137 2 close
9.21 0.000251 251 1 arch_prctl
7.45 0.000203 67 3 mprotect
6.20 0.000169 169 1 munmap
5.25 0.000143 143 1 read
1.76 0.000048 48 1 1 access
0.00 0.000000 0 1 brk
0.00 0.000000 0 1 execve
------ ----------- ----------- --------- --------- ----------------
100.00 0.002726 22 1 total
As you can see, exit
doesn't show up in the report. Am I wrong that it's a system call? Reading usr/include/x86_64-linux-gnu/asm/unistd_64.h
, I can see an exit
entry:
. . .
#define __NR_execve 59
#define __NR_exit 60
#define __NR_wait4 61
. . .
What am I missing here?
Running on Parrot OS.
I was hesitant to post this because it's not clear if this is ontopic enough. I can delete this promptly if it's decided that it's not.