daisy
daisy

Reputation: 23581

What's the structure of glibc's source code

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 ?

Upvotes: 4

Views: 534

Answers (1)

che
che

Reputation: 12273

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.

Upvotes: 4

Related Questions