Templatized syscall structures

I don't think this addresses everything (it occurred to me that places doing things with `syscall_defs.h` probably need to be revised, etc.), but I'd like to get this into the tree.

This patch is essentially the same patch as was last posted in #1195, but rebased to pick up the `struct mmsghdr` changes that went in recently.