Fix build process on Debian/FreeBSD and BSD.

 * sys/prctl.h can be found only on Linux, but cmake recognizes Debian/kFreeBSD
 as Linux.
 * extern "C" for TIMEOUT_INFINITY (it is used in plugins)