Freebsd support

Hi, I've added a quick commit which provides functionality on freebsd.