add _XOPEN_SOURCE=600 among the defines so that it compiles properly for netbsd too. (also covers the Hurd.)