4 ms·
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?
by planckscnst 14y ago
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?
- JoachimSchipper 14y agoType-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.
- binarycrusader 14y agoI 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.
- throwaway54-762 14y agoHow 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).