Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the structure of glibc's source code

Tags:

c

linux

I tried to look for a specific function, e.g fstatfs, but I found the following code, it does almost nothing, I checked __set_errno macro, it's merely setting error number.

int
__fstatfs (int fd, struct statfs *buf)
{
  __set_errno (ENOSYS);
  return -1;
}

So a set of core library are implemented in ASM, but how is that working, if so why does these weak function even exist ?

like image 417
daisy Avatar asked Oct 30 '25 09:10

daisy


1 Answers

I guess that the call is OS-dependent, so what you're seeing is just a stub. There seems to be some kind of alias in io/sys/statfs.h, and a candidate for the Linux implementation is in sysdeps/unix/sysv/linux/fstatfs64.c file.

like image 82
che Avatar answered Nov 01 '25 14:11

che



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!