Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how can I know if a function in C is a system call or not [closed]

Tags:

c

system

call

I really didn't understand this topic. For example, functions like

  • printf()
  • strlen()
  • malloc()

Which are a system call and which are not? How do I know it when a function is given to me? Didn't find anything on Google.

like image 282
Jesus vinicuis Avatar asked Oct 31 '25 04:10

Jesus vinicuis


1 Answers

That's system dependent. There is a man page syscalls that lists the system calls on Linux, for example: http://man7.org/linux/man-pages/man2/syscalls.2.html

This list is also version dependent: new system calls are occasionally added to Linux kernel.

None of the functions in your list are system calls. However, their implementations may use system calls: printf uses write system call, malloc uses mmap or mmap2 or brk system calls. In contrast, a typical implementation of strlen would NOT use system calls.

like image 65
kfx Avatar answered Nov 01 '25 18:11

kfx



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!