Mark some more variables as static or include the appropriate header

Detected by clang's -Wmissing-variable-declarations.

From: Andres Freund <andres@anarazel.de>