Skip to content

Commit 238a79d

Browse files
committed
better handling of get_mce_kill return value
1 parent 57d7fe1 commit 238a79d

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

TODO

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# TODO
2+
* after PR is made, create changelog
3+
* 32bit support?
4+
* fix https://github.com/nix-rust/nix/pull/1550/checks?check_run_id=4637943143
5+
* https://cirrus-ci.com/task/6249061924732928
6+
7+
8+
# refactor
9+
* skriv helper functions för att deduplicera
10+
* red ut om c_int / c_ulong skall användas
11+
* greppa på c_ulong?
12+
* maybeuninit memory alloc?
13+
14+
15+
# intressanta kodreferenser
16+
* sys/signal.rs wait() & killpg()
17+
18+
19+
# not implemented
20+
* capability stuff avoided
21+
* powerpc, arm64, mips etc. stuff avoided
22+
23+
24+
# questions
25+
* how many of the prctl options should be implemented, considering i do not have the means to test all architectures
26+
* should the naming be changed to be more user friendly, or remain as it is, as close to the original name as possible
27+
* which feature (if any) should prctl be under. and should it be enabled by default
28+
* should prctl be exported as unsafe function or not?
29+
30+
31+
# argumentation för min impl
32+
* nix unified syscalls

src/sys/prctl.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,5 +211,8 @@ pub fn get_mce_kill() -> Result<PrctlMCEKillPolicy> {
211211
libc::prctl(PR_MCE_KILL_GET as c_int, 0, 0, 0, 0)
212212
};
213213

214-
Errno::result(res).map(|res| PrctlMCEKillPolicy::try_from(res).unwrap())
214+
match Errno::result(res) {
215+
Ok(val) => Ok(PrctlMCEKillPolicy::try_from(val)?),
216+
Err(e) => Err(e),
217+
}
215218
}

0 commit comments

Comments
 (0)