Thread overview
mir-linux-kernel 1.0.0: Linux system call numbers for different architectures
Nov 10
Nathan S.
6 days ago
Adrian Matoga
6 days ago
Ilya Yaroshenko
November 10
About package
--------------
Linux system call numbers for different architectures. That's all.

https://code.dlang.org/packages/mir-linux-kernel


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.


Example
--------------
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);
}

November 11
On Friday, 10 November 2017 at 18:27:36 UTC, Nathan S. wrote:
> About package
> --------------
> Linux system call numbers for different architectures. That's all.
>
> [...]

Was there anything wrong with https://code.dlang.org/packages/syscall-d ?
November 11
On Saturday, 11 November 2017 at 08:43:32 UTC, Adrian Matoga wrote:
> On Friday, 10 November 2017 at 18:27:36 UTC, Nathan S. wrote:
>> About package
>> --------------
>> Linux system call numbers for different architectures. That's all.
>>
>> [...]
>
> Was there anything wrong with https://code.dlang.org/packages/syscall-d ?

From it's readme:

    Supported Platforms:
        Linux-x86_64
        Linux-x86
        OSX-x86_64
        FreeBSD-x86_64

i.e. x86[_64] only.
mir-linux-kernel has all the supported archs.
6 days ago
On Saturday, 11 November 2017 at 08:54:54 UTC, Nicholas Wilson wrote:
> On Saturday, 11 November 2017 at 08:43:32 UTC, Adrian Matoga wrote:
>> On Friday, 10 November 2017 at 18:27:36 UTC, Nathan S. wrote:
>>> About package
>>> --------------
>>> Linux system call numbers for different architectures. That's all.
>>>
>>> [...]
>>
>> Was there anything wrong with https://code.dlang.org/packages/syscall-d ?
>
> From it's readme:
>
>     Supported Platforms:
>         Linux-x86_64
>         Linux-x86
>         OSX-x86_64
>         FreeBSD-x86_64
>
> i.e. x86[_64] only.
> mir-linux-kernel has all the supported archs.

Still, I would first try to submit a PR to syscall-d, and only go for a new package if syscall-d owners refuse to extend the list of platforms.
Now we have two different packages that are supposed to do the same but have different arbitrary limitations.
6 days ago
On Tuesday, 14 November 2017 at 13:08:14 UTC, Adrian Matoga wrote:
> On Saturday, 11 November 2017 at 08:54:54 UTC, Nicholas Wilson wrote:
>> On Saturday, 11 November 2017 at 08:43:32 UTC, Adrian Matoga wrote:
>>> On Friday, 10 November 2017 at 18:27:36 UTC, Nathan S. wrote:
>>>> About package
>>>> --------------
>>>> Linux system call numbers for different architectures. That's all.
>>>>
>>>> [...]
>>>
>>> Was there anything wrong with https://code.dlang.org/packages/syscall-d ?
>>
>> From it's readme:
>>
>>     Supported Platforms:
>>         Linux-x86_64
>>         Linux-x86
>>         OSX-x86_64
>>         FreeBSD-x86_64
>>
>> i.e. x86[_64] only.
>> mir-linux-kernel has all the supported archs.
>
> Still, I would first try to submit a PR to syscall-d, and only go for a new package if syscall-d owners refuse to extend the list of platforms.
> Now we have two different packages that are supposed to do the same but have different arbitrary limitations.

The goal of this package is linux support, and the code is autogenerated from Linux sources. It may include other linux kernel headers in the future.

I don't see any problem here. The syscall-d can import mir-linux-kernel if they want to have the best linux support and provide something for other OS.

Best,
Ilya