-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
gh-144130: support getrandom syscall on non-linux #144131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
47afea8
f3af163
7df1eb7
a3d4868
b203399
c333508
6d10c3b
a40fd75
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Add support for FreeBSD's implementation of getrandom, so :func:`os.getrandom` works there too. |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -151,8 +151,11 @@ | |||||
| #ifdef HAVE_LINUX_RANDOM_H | ||||||
| # include <linux/random.h> // GRND_RANDOM | ||||||
| #endif | ||||||
| #if defined(HAVE_SYS_RANDOM_H) && (defined(HAVE_GETRANDOM) || defined(HAVE_GETENTROPY)) | ||||||
| # include <sys/random.h> // getrandom(), GRND_NONBLOCK on FreeBSD and NetBSD | ||||||
| #endif | ||||||
| #ifdef HAVE_GETRANDOM_SYSCALL | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Also, in the code below which checks
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would prefer to leave the PR as it is ( |
||||||
| # include <sys/syscall.h> // syscall() | ||||||
| # include <sys/syscall.h> // SYS_getrandom | ||||||
| #endif | ||||||
|
|
||||||
| #ifdef HAVE_POSIX_SPAWN | ||||||
|
|
||||||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code below does not use
getentropy(), so it should be removed.