aboutsummaryrefslogtreecommitdiff
path: root/src/random.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* fix(random): on old glibc < 2.25, falback to /dev/urandomThijs Schreijer3 days1-4/+9
|
* Reverse conditional compilation of non-POSIXcos2025-02-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As https://www.openbsd.org/faq/ports/guide.html#PortsGeneric states, it is inappropriate to base feature inclusion on a growing list (60b66fc, 9160d12) of excluded platforms. Thus this commit attempts to switch the assumption from Linux to a modern POSIX as the default target. Firstly, merely checking for __unix__ should be functionally equivalent of having a long lists of practically "all" operating systems. Apart from Windows, the primary non-standard code covers these termios related constants: I_IUCLC, O_OLCUC, O_OFILL, O_OFDEL, O_NLDLY, O_CRDLY and L_XCASE. A few of them are documented as LEGACY as they were removed from POSIX https://pubs.opengroup.org/onlinepubs/007904875/basedefs/termios.h.html over two decades ago. The other constants are part of the X/Open System Interfaces, which supposedly should be available when _XOPEN_UNIX is set to another value than -1. However on Linux they exist, yet the variable indicating their presence is undefined. In summary; It is hard to find any feature specific preprocessor variables indicating availability, but it is quite safe to limit their inclusion to Linux until patches arrive for other platforms. Executing `cpp -dM </dev/null | grep -i linux` on contemporary glibc and musl based distributions tend to give a few constants, where __linux__ likely is the one most suitable. Based on the previous state of the code, the following constants are expected to be available also on Apple: O_BSDLY, O_VTDLY and O_FFDLY. They do not appear be documented in termios(4) on macOS 13, but they actually exist in /Library/Developer/…/sys/termios.h. Lastly, O_TABDLY is kept excluded exclusively for NetBSD as that is the only currently supported platform lacking it.
* refactor(random): on linux+bsd use api instead of /dev/urandomThijs Schreijer2025-02-101-5/+29
| | | | the api is faster and equally good
* chore(random): replace deprecated Windows APIThijs Schreijer2025-02-101-15/+4
|
* fix docs, merging modulesThijs2024-06-031-1/+6
|
* feat(*): add environment variable and random functionsThijs Schreijer2023-11-151-0/+117