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 of the source files. What's going on here? Obviously I am missing something. What's the secret, where does it make a system call or actually do something?
stub_warning
is some legacy craziness. __set_errno
seems to be a simple macro that sets errno
. And while I find a million usages of weak_alias
I don't see it defined anywhere.
Is there a helpful guide to understanding how glibc works somewhere?
#include <errno.h>
#include <stddef.h>
#include <unistd.h>
/* Change the current directory to PATH. */
int
__chdir (path)
const char *path;
{
if (path == NULL)
{
__set_errno (EINVAL);
return -1;
}
__set_errno (ENOSYS);
return -1;
}
stub_warning (chdir)
weak_alias (__chdir, chdir)
#include <stub-tag.h>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…