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

reboot api for openbsd #3403

Closed
CountryMegs opened this issue Oct 23, 2023 · 4 comments · Fixed by #3426
Closed

reboot api for openbsd #3403

CountryMegs opened this issue Oct 23, 2023 · 4 comments · Fixed by #3426
Labels
C-API-request Category: API request

Comments

@CountryMegs
Copy link

CountryMegs commented Oct 23, 2023

on openbsd 7.4 trying to build the nix crate reboot feature. missing a bunch of stuff from libc. https://man.openbsd.org/reboot.2

can it be added please for amd64?

error[E0425]: cannot find value `RB_HALT_SYSTEM` in crate `libc`
  --> /nix/src/sys/reboot.rs:17:9
   |
17 |         RB_HALT_SYSTEM,
   |         ^^^^^^^^^^^^^^ not found in `libc`
   |
help: consider importing this unit variant
   |
3  + use crate::sys::reboot::RebootMode::RB_HALT_SYSTEM;
   |

error[E0425]: cannot find value `RB_KEXEC` in crate `libc`
  --> /nix/src/sys/reboot.rs:20:9
   |
20 |         RB_KEXEC,
   |         ^^^^^^^^ not found in `libc`
   |
help: consider importing this unit variant
   |
3  + use crate::sys::reboot::RebootMode::RB_KEXEC;
   |

error[E0425]: cannot find value `RB_POWER_OFF` in crate `libc`
  --> /nix/src/sys/reboot.rs:22:9
   |
22 |         RB_POWER_OFF,
   |         ^^^^^^^^^^^^ not found in `libc`
   |
help: consider importing this unit variant
   |
3  + use crate::sys::reboot::RebootMode::RB_POWER_OFF;
   |

error[E0425]: cannot find value `RB_AUTOBOOT` in crate `libc`
  --> /nix/src/sys/reboot.rs:24:9
   |
24 |         RB_AUTOBOOT,
   |         ^^^^^^^^^^^ not found in `libc`
   |
help: consider importing this unit variant
   |
3  + use crate::sys::reboot::RebootMode::RB_AUTOBOOT;
   |

error[E0425]: cannot find value `RB_SW_SUSPEND` in crate `libc`
  --> /nix/src/sys/reboot.rs:27:9
   |
27 |         RB_SW_SUSPEND,
   |         ^^^^^^^^^^^^^ not found in `libc`
   |
help: consider importing this unit variant
   |
3  + use crate::sys::reboot::RebootMode::RB_SW_SUSPEND;
   |

error[E0425]: cannot find function `reboot` in crate `libc`
  --> /nix/src/sys/reboot.rs:33:20
   |
33 |     unsafe { libc::reboot(how as libc::c_int) };
   |                    ^^^^^^ not found in `libc`

error[E0425]: cannot find value `RB_ENABLE_CAD` in crate `libc`
  --> /nix/src/sys/reboot.rs:42:15
   |
42 |         libc::RB_ENABLE_CAD
   |               ^^^^^^^^^^^^^ not found in `libc`

error[E0425]: cannot find value `RB_DISABLE_CAD` in crate `libc`
  --> /nix/src/sys/reboot.rs:44:15
   |
44 |         libc::RB_DISABLE_CAD
   |               ^^^^^^^^^^^^^^ not found in `libc`

error[E0425]: cannot find function `reboot` in crate `libc`
  --> /nix/src/sys/reboot.rs:46:30
   |
46 |     let res = unsafe { libc::reboot(cmd) };
   |                              ^^^^^^ not found in `libc`

For more information about this error, try `rustc --explain E0425`.
error: could not compile `nix` (lib) due to 9 previous errors
@SteveLauC
Copy link
Contributor

Would you like to file a PR for these missing symbols? Then after a version of libc with these symbols included is released, we can add it to Nix :)

@CountryMegs
Copy link
Author

@SteveLauC yes but i wouldnt know where to start with it. so open the issue in case someone does and wants to help in the meantime

@devnexen
Copy link
Contributor

Feel free to open a PR, it s mostly a call and a handful of constants, someone will review nonetheless :)

@SteveLauC
Copy link
Contributor

From your error info (which seems to be incomplete though), you have some missing constants and a function reboot to add, things for OpenBSD should be added to the files under this directory, if these things are not arch-dependent, then it should be added to mod.rs

Missing constants should go to this area

Missing function should go here

devnexen added a commit to devnexen/libc that referenced this issue Nov 7, 2023
bors added a commit that referenced this issue Nov 8, 2023
adding reboot to netbsd/openbsd.

close #3403
@bors bors closed this as completed in 5494582 Nov 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-API-request Category: API request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants