Global var program_invocation_short_name doesn't exist on *BSD

Instead, we compute it from getprogname(3) return value.
ERESTART doesn't exist on *BSD; use EINTR instead