0

I understand that, for example, calling the library function printf invokes the write(2) system call.

My question is: Is there a library call that can invoke more than one system call? In other words: Do system calls always map 1:1 to library calls?

Kusalananda
  • 333,661
FPSX V
  • 11

2 Answers2

4

There is no 1:1 map from system calls to library calls and vice versa.

For example, most if not all arithmetic functions (e.g. sin) don’t call any system calls; others such as posix_spawn use multiple system calls.

Going the other way, some system calls such as init_module don’t have any corresponding library call and need to be called “manually” through syscall.

Kusalananda
  • 333,661
Stephen Kitt
  • 434,908
2

Counter-example getpwent(3) invokes many system calls

Chris Davies
  • 116,213
  • 16
  • 160
  • 287