Move scratch-buf allocation state into syscall events.