Pass tid through to ptrace operations

This change is equivalent to the Linux threading support.