Where are syscalls located in glibc source

前端 未结 4 1571
挽巷
挽巷 2020-12-05 07:42

So I was looking through the linux glibc source and I don\'t see where it actually does anything. The following is from io/chdir.c but it is indicative of many

4条回答
  •  借酒劲吻你
    2020-12-05 07:54

    That's a generic stub that is used if another definition doesn't exist; weak_alias is a cpp macro which tells the linker that __chdir should be used when chdir is requested, but only if no other definition is found. (See weak symbols for more details.)

    chdir is actually a system call; there will be per-OS system call bindings in the gibc source tree, which will override the stub definition with a real one that calls into the kernel. This allows glibc to present a stable interface across systems which may not have all of the system calls that glibc knows about.

提交回复
热议问题