Add needed include, make it compile without -D_BSD_SOURCE.