> > #define SYS_MMAP(addr, len, prot, flags, fd, off) \ > > __syscall(SYS_mmap, (void *)(addr), (size_t)(len), \ > > (int)(prot), (int)(flags), (int)(fd), (__off_t)(off)) > > #elif defined(__FreeBSD_kernel__) > > #define SYS_MMAP(addr, len, prot, flags, fd, off) \ > > syscall(SYS_mmap, (void *)(addr), (size_t)(len), \ > > (int)(prot), (int)(flags), (int)(fd), (__off_t)(off)) > > > > sys/sys/syscallargs.h tells me that in OpenBSD there is a further > > argument "long pad" at sixth position. Just setting it to "(long) 0" > > gives a segmentation fault. > > Actually, it's an int. But it only matters if you are wrapping the > system call. If you are wrapping the mmap() symbol, it's already doing > the right thing and does not need any extra parameter. See > src/lib/libc/sys/mmap.c for yourself.
Indeed, you should probably ask yourself why it is wrapping in this way. Does it intentionally want to be non-POSIX? I cannot see any benefit. It looks like some coder drilled down deeper than they should, and don't understand that below some level, interfaces become non-portable.

