Hacker News new | ask | show | jobs
by andy_threos_io 1912 days ago
There are other more portable way to do OS wrapper, and maybe faster (but it's not an issue).

Just write the wrapper as a C extension module, and in the module make the system call with proper library call.

like in the following code:

https://github.com/torvalds/linux/blob/master/samples/vfs/te...

This way it will be portable!

A couple of weeks ago, I just made for our OS's system calls. It's only a first draft, but works fine.

You could also parse the C header for constant values.

(Actually, I wrote a python script to generate the C extension for the system calls also, not just for the constants)