When we attach a process using `reptyr -T`, we create a tempdir and create a unix socket therein, which the target needs to be able to connect() to. If `reptyr -T` is run as root, the directory will only be available to root by default. chown the directory to the target, which should work for both common cases of attaching a target of the same uid, and root attaching a lesser uid's process.
Notably, sshd does this, and we need to be sure to grab all of them.
Such as i386. closes #43.
We rely on the assumption that if a syscall returns an error, errno will be nonzero. See http://llvm.org/bugs/show_bug.cgi?id=18701
The explicit CONT on attach is needed in order for wait() to work on older kernels, and the STOP/CONT after attach is better at making bash notice the process is running again.
This causes bash to notice that the process is backgrounded, which prevents it from sending a SIGTERM when the original shell exits.