glibc的源代码的结构是什么

时间:2022-11-29 16:00:09

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.

我试图寻找一个特定的函数e。g fstatfs,但是我找到了下面的代码,它几乎什么都不做,我检查了__set_errno宏,它只是设置了错误号。

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 ?

一组核心库是在ASM中实现的,但是它是如何工作的,如果是的话,为什么这些弱函数会存在呢?

1 个解决方案

#1


3  

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.

我猜这个调用依赖于操作系统,所以你看到的只是一个存根。在io/sys/statfs中似乎有某种别名。h, Linux实现的一个候选是sysdeps/unix/sysv/ Linux /fstatfs64。c文件。

#1


3  

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.

我猜这个调用依赖于操作系统,所以你看到的只是一个存根。在io/sys/statfs中似乎有某种别名。h, Linux实现的一个候选是sysdeps/unix/sysv/ Linux /fstatfs64。c文件。