Skip to content

Commit

Permalink
better handling of get_mce_kill return value
Browse files Browse the repository at this point in the history
  • Loading branch information
DOhlsson committed Mar 27, 2022
1 parent 57d7fe1 commit 238a79d
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
32 changes: 32 additions & 0 deletions TODO
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# TODO
* after PR is made, create changelog
* 32bit support?
* fix https://github.com/nix-rust/nix/pull/1550/checks?check_run_id=4637943143
* https://cirrus-ci.com/task/6249061924732928


# refactor
* skriv helper functions för att deduplicera
* red ut om c_int / c_ulong skall användas
* greppa på c_ulong?
* maybeuninit memory alloc?


# intressanta kodreferenser
* sys/signal.rs wait() & killpg()


# not implemented
* capability stuff avoided
* powerpc, arm64, mips etc. stuff avoided


# questions
* how many of the prctl options should be implemented, considering i do not have the means to test all architectures
* should the naming be changed to be more user friendly, or remain as it is, as close to the original name as possible
* which feature (if any) should prctl be under. and should it be enabled by default
* should prctl be exported as unsafe function or not?


# argumentation för min impl
* nix unified syscalls
5 changes: 4 additions & 1 deletion src/sys/prctl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,5 +211,8 @@ pub fn get_mce_kill() -> Result<PrctlMCEKillPolicy> {
libc::prctl(PR_MCE_KILL_GET as c_int, 0, 0, 0, 0)
};

Errno::result(res).map(|res| PrctlMCEKillPolicy::try_from(res).unwrap())
match Errno::result(res) {
Ok(val) => Ok(PrctlMCEKillPolicy::try_from(val)?),
Err(e) => Err(e),
}
}

0 comments on commit 238a79d

Please sign in to comment.