Raii remote syscalls

Resolves #793.

New interface is in remote_syscalls.h.  Remaining changes are ~mechanical rewrites.

@rocallahan care to take a look? (at the interface)