How do I go about finding the source code behind standard C functions (under Linux/Ubuntu 13)?

Case in point, `chdir()`. I know I have to `#include <unistd.h>` but then I encounter a bug, and I suppose the source code would help me figure out this bug.

Thanks if you point me out to the correct source - but real thanks if you give me a method for finding the correct source file every time I need one.