Hacker News new | past | comments | ask | show | jobs | submit login

I like the idea of a header file with macros distributed with the kernel for providing basic syscall functions. Is there any reason that couldn't work?



Type-safety is hard with macros; you can't use a macro as a function pointer, for the obvious reason that it's not a function; such macros would tend to trample all over libc functionality, and glibc is not the only libc; the kernel and userland should arguably be separate.

It wouldn't be too hard to create (generate) a "libwrapsyscall" that just provided syscalls; if this is worth doing, it's worth doing properly.


How about 'static inline' functions distributed along with the libc header files? You get type / number of arguments correctness and no ABI bloat, at the cost of having (minimal) code in header files and per-object code duplication (possibly solved by an intelligent cc/ld).


I would think that the new generic selection macro capability in C11 would help here:

  http://www.robertgamble.net/2012/01/c11-generic-selections.html
I haven't taken the time to prototype an implementation, but it seems like at least some cases could be solved.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: