Include <sys/socket.h> for AF_INET*.
Use SYS_ from <sys/syscall.h>.

__NR_ are not portable.
Define LIBC_SYSCALL_ for FreeBSD.