Skip to content

Add NR_GETRANDOM syscall numbers #111

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

Closed
wants to merge 2 commits into from
Closed

Add NR_GETRANDOM syscall numbers #111

wants to merge 2 commits into from

Conversation

mmcco
Copy link
Contributor

@mmcco mmcco commented Dec 24, 2015

Pulled directly from src/libstd/rand/os.rs in the main rust repo. We can
delete them from there once this commit is added in rust's liblibc
submodule.

Pulled directly from src/libstd/rand/os.rs in the main rust repo. We can
delete them from there once this commit is added in rust's liblibc
submodule.
@mmcco
Copy link
Contributor Author

mmcco commented Dec 28, 2015

@alexcrichton What am I misunderstanding? I can't tell why the Linux builds are failing with NR_GETRANDOM undefined, despite the fact that they have supported architectures.

@semarie
Copy link
Contributor

semarie commented Dec 28, 2015

The testsuite searchs for NR_GETRANDOM definition, but under Linux the name of the define is __NR_getrandom.

So you need either use the proper name (and change rustc calls after that) or define exceptions in libc-test/build.rs.

@nagisa
Copy link
Member

nagisa commented Dec 29, 2015

NR_GETRANDOM should be SYS_getrandom.

@mmcco
Copy link
Contributor Author

mmcco commented Dec 29, 2015

I'll probably commit that to make sure it passes the build. However, I think @alexcrichton should confirm that that weird mixed-case naming scheme is acceptable here. I don't see it elsewhere in liblibc, so (as someone mentioned on IRC) it may be preferable to make an alias.

This way it matches the #define in the system header sys/syscall.h,
which allows liblibc's test code to verify its value.

We may make an alias if people find this naming scheme too ugly or
irregular.
@mmcco
Copy link
Contributor Author

mmcco commented Dec 29, 2015

Only one nightly build on Linux - ARM, specifically - succeeded.

And now, I remember that getrandom(2) is brand new and therefore probably isn't even supported by the Travis workers' kernels. My mind was still off in OpenBSD land.

So, we can either leave things the way they are and wait for the API to mature, or we can add an exception to make liblibc take these values on faith.

@alexcrichton
Copy link
Member

Thanks @mmcco! Could this also split out the definitions into appropriate files instead of using #[cfg]? This'll also have to use the name that's available in C as opposed to one we made up.

@mmcco
Copy link
Contributor Author

mmcco commented Jan 23, 2016

Does anyone want to adopt this? The complexity of adding the definitions to libc compared with the current solution, combined with the fact that I'm not much of a Linux person, makes me lean toward leaving things as-is.

@kamalmarhubi
Copy link
Contributor

@mmcco I can adopt this and pick up #121.

@mmcco
Copy link
Contributor Author

mmcco commented Mar 11, 2016

@kamalmarhubi Sounds good to me. Thanks!

@bors
Copy link
Contributor

bors commented Apr 3, 2016

☔ The latest upstream changes (presumably #246) made this pull request unmergeable. Please resolve the merge conflicts.

@alexcrichton
Copy link
Member

Closing due to inactivity, but feel free to resubmit with comments addressed!

danielverkamp pushed a commit to danielverkamp/libc that referenced this pull request Apr 28, 2020
* Add _mm_cmp*_ps variant (SSE)

* Add _mm_comi{eq,lt,le,gt,ge,neq}_ss instructions (sse)

* Add _mm_ucomi*_ss instructions SSE

They all compile down to the same x86 instruction, UCOMISS, whereas the
_mm_comi*_ss instructions compile down to COMISS. The outputs of both
sets of instructions are exactly the same. The only difference is in
exception handling. I therefore added a single test case which tests
their different effect on the MXCSR register (_mm_getcsr) of
_mm_comieq_ss vs. _mm_ucomieq_ss. Together with the tests about emitting
the right instruction, no tests further tests are needed for the other
variants.

* Avoid constant-folding test case
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants