-
Notifications
You must be signed in to change notification settings - Fork 683
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
Fix nix on FreeBSD #396
Closed
Closed
Fix nix on FreeBSD #396
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
e746d7f
Add the initial implementation of reboot()
bugaevc 1a5f20b
Add some basic docs for reboot::set_cad_enabled()
bugaevc f5989ce
Ignore the overflow for constants
bugaevc aa2d66f
Stop targeting Android
bugaevc 3c52d88
Use libc's declarations
bugaevc d0a2e5e
Manually match on RebootMode::*
bugaevc c53c6c5
Switch Clone and Copy
bugaevc c208860
Add some documentation
bugaevc 52f5325
Revert "Manually match on RebootMode::*"
bugaevc fb82a5e
Name enum variants after the libc constants
bugaevc 7950027
Fix NetBSD build
tbu- d4ae8f8
Introduce CHANGELOG.md
fiveop 11e68f5
No longer support Rust 1.1
fiveop 5daab1e
Fix the sethostname binding on FreeBSD and DragonflyBSD
asomers 096235f
Fix the sockopt_impl matcher rule order.
asomers d9d6608
Fix nix on FreeBSD amd64
asomers File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
# Change Log | ||
|
||
All notable changes to this project will be documented in this file. | ||
This project adheres to [Semantic Versioning](http://semver.org/). | ||
|
||
## [Unreleased] | ||
|
||
### Added | ||
- Added `lseek` and `lseek64` in `::nix::unistd` | ||
([#377](https://github.com/nix-rust/nix/pull/377)) | ||
- Added accessors `sigmask_mut` and `sigmask` to `UContext` in | ||
`::nix::ucontext`. | ||
([#370](https://github.com/nix-rust/nix/pull/370)) | ||
- Added `WUNTRACED` to `WaitPidFlag` in `::nix::sys::wait` for non-_linux_ | ||
targets. | ||
([#379](https://github.com/nix-rust/nix/pull/379)) | ||
- Added new module `::nix::sys::reboot` with enumeration `RebootMode` and | ||
functions `reboot` and `set_cad_enabled`. Currently for _linux_ only. | ||
([#386](https://github.com/nix-rust/nix/pull/386)) | ||
|
||
### Changed | ||
- Replaced the reexported integer constants for signals by the enumeration | ||
`Signal` in `::nix::sys::signal`. | ||
([#362](https://github.com/nix-rust/nix/pull/362)) | ||
- Renamed `EventFdFlag` to `EfdFlags` in `::nix::sys::eventfd`. | ||
([#383](https://github.com/nix-rust/nix/pull/383)) | ||
|
||
### Removed | ||
- Type alias `SigNum` from `::nix::sys::signal`. | ||
([#362](https://github.com/nix-rust/nix/pull/362)) | ||
|
||
### Fixed | ||
- Fixed the build problem for NetBSD (Note, that we currently do not support | ||
it, so it might already be broken again). | ||
([#389](https://github.com/nix-rust/nix/pull/389)) | ||
|
||
## [0.6.0] 2016-06-10 | ||
|
||
### Added | ||
- Added `gettid` in `::nix::unistd` for _linux_ and _android_. | ||
([#293](https://github.com/nix-rust/nix/pull/293)) | ||
- Some _mips_ support in `::nix::sched` and `::nix::sys::syscall`. | ||
([#301](https://github.com/nix-rust/nix/pull/301)) | ||
- Added `SIGNALFD_SIGINFO_SIZE` in `::nix::sys::signalfd`. | ||
([#309](https://github.com/nix-rust/nix/pull/309)) | ||
- Added new module `::nix::ucontext` with struct `UContext`. Currently for | ||
_linux_ only. | ||
([#311](https://github.com/nix-rust/nix/pull/311)) | ||
- Added `EPOLLEXCLUSIVE` to `EpollEventKind` in `::nix::sys::epoll`. | ||
([#330](https://github.com/nix-rust/nix/pull/330)) | ||
- Added `pause` to `::nix::unistd`. | ||
([#336](https://github.com/nix-rust/nix/pull/336)) | ||
- Added `sleep` to `::nix::unistd`. | ||
([#351](https://github.com/nix-rust/nix/pull/351)) | ||
- Added `S_IFDIR`, `S_IFLNK`, `S_IFMT` to `SFlag` in `::nix::sys::stat`. | ||
([#359](https://github.com/nix-rust/nix/pull/359)) | ||
- Added `clear` and `extend` functions to `SigSet`'s implementation in | ||
`::nix::sys::signal`. | ||
([#347](https://github.com/nix-rust/nix/pull/347)) | ||
- `sockaddr_storage_to_addr` in `::nix::sys::socket` now supports `sockaddr_nl` | ||
on _linux_ and _android_. | ||
([#366](https://github.com/nix-rust/nix/pull/366)) | ||
- Added support for `SO_ORIGINAL_DST` in `::nix::sys::socket` on _linux_. | ||
([#367](https://github.com/nix-rust/nix/pull/367)) | ||
- Added `SIGINFO` in `::nix::sys::signal` for the _macos_ target as well as | ||
`SIGPWR` and `SIGSTKFLT` in `::nix::sys::signal` for non-_macos_ targets. | ||
([#361](https://github.com/nix-rust/nix/pull/361)) | ||
|
||
### Changed | ||
- Changed the structure `IoVec` in `::nix::sys::uio`. | ||
([#304](https://github.com/nix-rust/nix/pull/304)) | ||
- Replaced `CREATE_NEW_FD` by `SIGNALFD_NEW` in `::nix::sys::signalfd`. | ||
([#309](https://github.com/nix-rust/nix/pull/309)) | ||
- Renamed `SaFlag` to `SaFlags` and `SigFlag` to `SigFlags` in | ||
`::nix::sys::signal`. | ||
([#314](https://github.com/nix-rust/nix/pull/314)) | ||
- Renamed `Fork` to `ForkResult` and changed its fields in `::nix::unistd`. | ||
([#332](https://github.com/nix-rust/nix/pull/332)) | ||
- Added the `signal` parameter to `clone`'s signature in `::nix::sched`. | ||
([#344](https://github.com/nix-rust/nix/pull/344)) | ||
- `execv`, `execve`, and `execvp` now return `Result<Void>` instead of | ||
`Result<()>` in `::nix::unistd`. | ||
([#357](https://github.com/nix-rust/nix/pull/357)) | ||
|
||
### Fixed | ||
- Improved the conversion from `std::net::SocketAddr` to `InetAddr` in | ||
`::nix::sys::socket::addr`. | ||
([#335](https://github.com/nix-rust/nix/pull/335)) | ||
|
||
## [0.5.0] 2016-03-01 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
This document lists the steps that lead to a successful release of the Nix | ||
library. | ||
|
||
# Before Release | ||
|
||
The release is prepared by a commit with the following changes. | ||
|
||
- In CHANGELOG.md, rename the Unreleased section to the new version followed by | ||
the date of the release. | ||
|
||
# Create Release | ||
|
||
# After Release | ||
|
||
After the release a commit with the following changes is added to the master | ||
branch. | ||
|
||
- Add a new Unreleased section header to CHANGELOG.md. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
//! Reboot/shutdown or enable/disable Ctrl-Alt-Delete. | ||
|
||
use {Errno, Error, Result}; | ||
use libc; | ||
use void::Void; | ||
use std::mem::drop; | ||
|
||
/// How exactly should the system be rebooted. | ||
/// | ||
/// See [`set_cad_enabled()`](fn.set_cad_enabled.html) for | ||
/// enabling/disabling Ctrl-Alt-Delete. | ||
#[repr(i32)] | ||
#[derive(Clone, Copy, Debug, Eq, PartialEq)] | ||
pub enum RebootMode { | ||
RB_HALT_SYSTEM = libc::RB_HALT_SYSTEM, | ||
RB_KEXEC = libc::RB_KEXEC, | ||
RB_POWER_OFF = libc::RB_POWER_OFF, | ||
RB_AUTOBOOT = libc::RB_AUTOBOOT, | ||
// we do not support Restart2, | ||
RB_SW_SUSPEND = libc::RB_SW_SUSPEND, | ||
} | ||
|
||
pub fn reboot(how: RebootMode) -> Result<Void> { | ||
unsafe { | ||
libc::reboot(how as libc::c_int) | ||
}; | ||
Err(Error::Sys(Errno::last())) | ||
} | ||
|
||
/// Enable or disable the reboot keystroke (Ctrl-Alt-Delete). | ||
/// | ||
/// Corresponds to calling `reboot(RB_ENABLE_CAD)` or `reboot(RB_DISABLE_CAD)` in C. | ||
pub fn set_cad_enabled(enable: bool) -> Result<()> { | ||
let cmd = if enable { | ||
libc::RB_ENABLE_CAD | ||
} else { | ||
libc::RB_DISABLE_CAD | ||
}; | ||
let res = unsafe { | ||
libc::reboot(cmd) | ||
}; | ||
Errno::result(res).map(drop) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 change is fine, but regarding
usize
(see above)