Project

General

Profile

Actions

Feature #13103

open

[PATCH] random.c: use "__NR_" syscall prefix on Linux (instead of "SYS_")

Added by normalperson (Eric Wong) almost 8 years ago. Updated almost 8 years ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:78972]

Description

[PATCH] random.c (fill_random_bytes_syscall): use "_NR" prefix on Linux

glibc still does not define the SYS_getrandom alias for
__NR_getrandom in the Linux kernel. However, installing
up-to-date Linux kernel headers (linux-libc-dev >= 3.17 package
on Debian) will get the __NR_getrandom syscall number defined
properly without relying on glibc.

This allows users with a modern kernel+headers to use the getrandom
syscall without waiting on glibc support.


Files

Updated by normalperson (Eric Wong) almost 8 years ago

wrote:


Feature #13103: [PATCH] random.c: use "NR" syscall prefix on Linux (instead of "SYS")
https://bugs.ruby-lang.org/issues/13103

Any comments? I may commit, someday...

Updated by kosaki (Motohiro KOSAKI) almost 8 years ago

SYS_getrandom and __NR_getrandom are defined in different headers. but your patch doesn't change any #include directive. It seems odd.

Anyway I have no objection.

Updated by normalperson (Eric Wong) almost 8 years ago

wrote:

SYS_getrandom and __NR_getrandom are defined in different headers. but
your patch doesn't change any #include directive. It seems odd.

Yes. sys/syscall.h (glibc, libc6-dev on Debian) pulls in
asm/unistd_#{ARCH}.h (provided by Linux kernel headers,
linux-libc-dev on Debian) where NR_* is defined.

Anyway I have no objection.

Thanks, r57307

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0