In article <[email protected]>, Christos Zoulas <[email protected]> wrote: >On Jun 8, 1:03am, [email protected] (Rin Okuyama) wrote: >-- Subject: Re: gcc 5.3 version of libasan is broken > >| On 2016/06/07 23:42, Christos Zoulas wrote: >| > I think it is better to do what linux does and write an internal_syscall() >| > macro that just DTRT's instead of special-casing each syscall. >| >| Sorry, I cannot grasp what you mean. Let me explain more in details what I >| did. First, I defined three macros: > >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... > >static inline uptr netbsd_lseek(int fd, OFF_T offset, int whence) { > return internal_syscall64(SYS_lseek, fd, 0, offset, whence); >} > >#define internal_syscall(sys...) \ > switch (sys) { \ > case SYS_fork: \ > return syscall(sys); \ > case SYS_lseek: \ > return netbsd_lseek(__VA_ARGS__); \ > >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).
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. christos
