Compile rr with g++.

NB: this commit doesn't attempt rewrite rr in the C++ idiom, it only
prepares the codebase for future evolution to C++.

This commit includes quite a few code changes required for C++ compile
cleanliness.  The changes are mostly mechanical and minor

* using byte* instead of void* for pointer arithmetic
* removing sys_malloc and sys_free
* using struct task* t params consistently instead of pid_t

The latter change allowed removing some redundant code.

In a few places, the edits that would have been required were more
substantial than the effort to wholesale rewrite the code.  So the
code was rewritten.