Skip to content
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

Add netbsd's syscall.h. #2760

Closed
wants to merge 2 commits into from
Closed

Conversation

m-ou-se
Copy link
Member

@m-ou-se m-ou-se commented Apr 19, 2022

This adds https://ftp.netbsd.org/pub/NetBSD/NetBSD-current/src/sys/sys/syscall.h

(I only need SYS___futex, but I added the rest as well.)

@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Amanieu (or someone else) soon.

Please see the contribution instructions for more information.

@m-ou-se
Copy link
Member Author

m-ou-se commented Apr 19, 2022

I don't know if these are stable, or how to find out if we can rely on these constants.

@thomcc
Copy link
Member

thomcc commented Apr 19, 2022

I think asking on one of the NetBSD mailing lists might1 be appropriate. Perhaps tech-userlevel? (I'm not familiar, this may be the wrong place).

Footnotes

  1. Just because common wisdom is that BSDs don't have a stable syscall ABI.

@semarie
Copy link
Contributor

semarie commented Apr 20, 2022

from cvs syscall.h history, the values seems relatively stable (in sense they doesn't change). but beware that it isn't the same stability than Linux: values could be removed if the syscall gone.

if you need some of them (because no libc wrapper), just adding the minimum required constants should be safe. else, you could lead to problems regarding the stability provided by rust libc crate (no symbols removed) versus the stability provided by the target (where symbols could be removed between major OS version).

@thomcc
Copy link
Member

thomcc commented Apr 20, 2022

Hm, I wonder if it's better to just put it inside the stdlib, where it's not exposed publicly and would just be used for the internal implementation... we'd have to fix it if it were removed, but it wouldn't break anybody downstream.

(Well... sort of. I guess it would mean if it were removed, code using older libstd would stop working, hm...)

@m-ou-se
Copy link
Member Author

m-ou-se commented Apr 20, 2022

Hm, I wonder if it's better to just put it inside the stdlib

Yeah maybe. In that case we should only merge #2762 and keep SYS___futex inside std.

@Amanieu
Copy link
Member

Amanieu commented Apr 20, 2022

Boost seems to use the syscall (and syscall.h) directly, so it's fine to add these definitions to libc.

@bors r+

@bors
Copy link
Contributor

bors commented Apr 20, 2022

📌 Commit f08e26c has been approved by Amanieu

@bors
Copy link
Contributor

bors commented Apr 20, 2022

⌛ Testing commit f08e26c with merge 3404b50...

bors added a commit that referenced this pull request Apr 20, 2022
Add netbsd's syscall.h.

This adds https://ftp.netbsd.org/pub/NetBSD/NetBSD-current/src/sys/sys/syscall.h

(I only need `SYS___futex`, but I added the rest as well.)
@semarie
Copy link
Contributor

semarie commented Apr 20, 2022

@Amanieu but does Boost why refuse to remove them if NetBSD do a breaking change ?

@Amanieu
Copy link
Member

Amanieu commented Apr 20, 2022

The syscalls are part of the public headers so I guess you would just be expected to rebuild boost with the updated headers.

@thomcc
Copy link
Member

thomcc commented Apr 20, 2022

Boost also uses __ulock functions for macOS, even though they are unstable (and will get you rejected from app stores: boostorg/atomic#55 for that reason).

So I don't know if boost using something is indicative of its stability. Or at least, it is not indicative that we can use them.

@bors
Copy link
Contributor

bors commented Apr 20, 2022

💔 Test failed - checks-actions

@semarie
Copy link
Contributor

semarie commented Apr 20, 2022

@Amanieu for me, the problem is if all of these defines are commited in rust libc, it means that problems will arrived when NetBSD will remove one of them: rust libc stability will not permit to remove them.

Please note that importing only SYS_futex (or what it is effectivily required for rust-lang/rust/issues/93740) would be fine. as it is limiting the possible problems.

@Amanieu
Copy link
Member

Amanieu commented Apr 22, 2022

In that case I'll just close this for now, we can just hard-code the sycall number in the standard library.

@Amanieu Amanieu closed this Apr 22, 2022
@m-ou-se m-ou-se deleted the netbsd-syscall-h branch April 22, 2022 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants