> #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.

Reply via email to