How to find the source code from header declaration?
I want to browse the source code in of the symbols in my header files in /usr/include/ . For example, in netdb.h, there's a function named getaddrinfo(...). I want to know where the source code is stored at least by using the shell.
I will be more appreciate if you tell me how to do it specifically in Emacs and/or Cscope.
The definition (with the function body) of standard C library's functions is (usually on Linux) inside the GNU Libc. Several functions (those in the section 2 of man pages for syscalls, with syscall numbers listed in <asm/unistd.h>) are tiny wrappers to system calls, so the actual work is done inside the linux kernel whose source is on kernel.org. For instance, write(2) is a system call (mostly done in the kernel) which may be used by the printf(3) library function (whose code is in GNU Libc). You could install GNU Libc source code and use ctags to find symbols there.
The declaration of standard C library's functions are in header files under /usr/include, so utilities like ctags can help you find them.