trying to follow the call chain for a simple lib routine

Robert P. J. Day
Fri Sep 11 19:44:00 GMT 2009

  hi, i'm hoping this is the right place to ask this.

  i'm writing a tutorial piece on how linux system calls work, and i'd
like to have a lead-in section on the call chain for how an invocation
of a glibc routine works its way down to the appropriate system
call(s).  (if there are docs somewhere on the architecture of glibc,
i'd be grateful for that pointer.)

  for example, i'd like to show how a call to getpid() translates into
a call to the corresponding system call.  i've got the source for
glibc spread out in front of me, but i'm having trouble following how
that call would be processed.  on my x86_64 system, i've found files
like syscalls.list, whose format is somewhat readable but i'm not sure
how it's consulted.

  i've noticed what seems like a simpler example -- gettid() -- that
looks like it's being defined simply as an inline syscall. and, as
another example, i wanted to follow the invocation of sysinfo().

  is there a guide for how all of this holds together?  thanks.


p.s.  i've found the source files for the direct calls to syscall() --
in my case, that appears to be
sysdeps/unix/sysv/linux/x86_64/syscall.S.  so i've figured out bits
and pieces, i just need a better grip on the bigger picture.


Robert P. J. Day                               Waterloo, Ontario, CANADA

        Linux Consulting, Training and Annoying Kernel Pedantry.

Web page:                                

More information about the Libc-help mailing list