On 2016/06/08 1:20, Christos Zoulas wrote:
I am trying to avoid having all these ifdefs in the common code, so that the upstream has a better chance to accept them. My idea was to do something like it is done in sanitizer_syscall_linux_x86_64.inc (but differently) In our case I think we could provide a varyadic macro that switched on the syscall number and DTRT...
(snip)
This could all go in a separate header for NetBSD. Alternatively, we just provide a separate header for all the syscall interception function that is NetBSD-specific, instead of sprinkling ifdefs in the common code (sanitizer_syscall_netbsd.inc).
On 2016/06/08 1:57, Christos Zoulas wrote:
Or perhaps what you have is better... I think that the file is full of messy ifdefs, and a couple of more won't hurt. It would be better if someone refactored it. I'll commit your changes for now.
I understand your idea. I agree that it is better to avoid the ifdef dance and DTRT by providing NetBSD-specific files in the future. But it also requires more work. IMO, it is not a bad choice to adopt my workaround tentatively. On 2016/06/08 4:47, Christos Zoulas wrote:
Also: 1. Can you please explain the removal of the (uptr) casts in some of the syscall arguments? My understanding is that sizeof(uptr) == 4 on ILP32 and 8 in LP64, so this has no effect? 2. Also in mmap, you cast 0 to long? Is that right?
1. I removed (uptr) casts for pointer and (s)size_t from the NetBSD- specific codes, as they are meaningless. This is (partially) done also for FreeBSD. But the casts bring about no bad side effects. Please feel free to put them back, if you feel it better. 2. Yes. The padding for mmap is, somehow, long. Please refer to sys/syscallargs.h: https://nxr.netbsd.org/source/xref/src/sys/sys/syscallargs.h#1209 Thanks, Rin
