Helper for syscalls getting pid2proc

Given a pid, I often want to get a proc only if p controls it.  Some uses for
pid2proc, like in wait and poke, want to do their own thing.
Fixes sys_dup_fds_to

Had a gaping hole where we didn't make sure that p controls the target (even
though proc_controls() is mostly a noop now).

Also fixes up the error reporting (set_errno and -1, instead of returning
-error).
sys_chdir() / fchdir() take a pid (XCC)

This is so parents (or any process that controls another) can change the
working directory (PWD, DOT, etc) of another process, including itself.

This does slow down chdir a little, due to the sync on pid lookup and decref,
but scalable chdir() isn't a big deal at this point.

Copy over chdir.c and fchdir.c and rebuild glibc.  Or just make clean it.