About package
Linux system call numbers for different architectures. That's all.


Motivating Example
Linux 3.17 added the getrandom syscall. Using it instead of /dev/[u]?random was a win. But we didn't think about all of the architectures that people might try building our library on, and soon we got a report from a user that our latest and greatest release was failing to compile on Raspberry Pi.

import mir.linux._asm.unistd: NR_getrandom;

 *   If the GRND_NONBLOCK flag is set, then
 *   getrandom() does not block in these cases, but instead
 *   immediately returns -1 with errno set to EAGAIN.
private ptrdiff_t genRandomImplSysNonBlocking(scope void* ptr, size_t len) @nogc nothrow @system
return syscall(NR_getrandom, cast(size_t) ptr, len, GRND_NONBLOCK);

Reply via email to