Sundry syscall buffer bug fixes and cleanups.

Includes the following changes

* use stronger types and less casting and pointer hackery when dealing
  with syscall records
* fix bug where record padding could lead to undetected overflow
* simply and optimize flush replay by writing the entire buffer in one
  shot, instead of restoring data per syscall

@rocallahan ought to like this patch! ;)