|
Message-ID: <CAPLrYESLeg5Egci1mD1GOmPFYrvyTm9X6L+=2U+7eHTbdApOAg@mail.gmail.com> Date: Wed, 28 Jan 2015 13:42:23 +0100 From: Daniel Cegiełka <daniel.cegielka@...il.com> To: musl@...ts.openwall.com Subject: Re: getrandom syscall 2015-01-28 13:26 GMT+01:00 Szabolcs Nagy <nsz@...t70.net>: > * Daniel Cegie??ka <daniel.cegielka@...il.com> [2015-01-28 10:10:53 +0100]: >> 2015-01-28 10:02 GMT+01:00 Szabolcs Nagy <nsz@...t70.net>: >> > >> > #ifdef SYS_getrandom > ... >> > #endif >> > >> > eg sh does not have the syscall (linux is not consistent with >> > syscalls for whatever reason) >> >> SYS_getrandom is defined on musl, so #ifdef SYS_getrandom is not a >> good solution: >> >> http://git.musl-libc.org/cgit/musl/tree/arch/x86_64/bits/syscall.h#n657 >> >> It's better to return an error. > > no > > you should return runtime error if the syscall fails > (eg you are on old kernel that does not support the syscall) > > but you cannot use this code if SYS_getrandom is not > defined (eg. sh arch) because it will be a musl > compile time failure (sadly linux does not allocate > syscall numbers on all archs so musl cannot define > all SYS_ macros consistently on all archs either) Indeed. I considered the kernel version check, but it is ugly approach. #ifdef SYS_getrandom we should add also add to the header file (stdlib.h?). Is this code will be approved for musl? Daniel
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.