Skip to content

Commit

Permalink
Merge pull request #62 from lucab/ups/cap-checkpoint-restore
Browse files Browse the repository at this point in the history
nr: add CAP_CHECKPOINT_RESTORE
  • Loading branch information
lucab authored Sep 21, 2020
2 parents 90772be + bcdcf48 commit f0a202b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "caps"
version = "0.4.1-alpha.0"
version = "0.5.0-alpha.0"
edition = "2018"
authors = ["Luca Bruno <lucab@lucabruno.net>"]
license = "MIT/Apache-2.0"
Expand Down
5 changes: 5 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ pub enum Capability {
CAP_PERFMON = nr::CAP_PERFMON,
/// `CAP_BPF` (from Linux, >= 5.8).
CAP_BPF = nr::CAP_BPF,
/// `CAP_CHECKPOINT_RESTORE` (from Linux, >= 5.9).
CAP_CHECKPOINT_RESTORE = nr::CAP_CHECKPOINT_RESTORE,
#[doc(hidden)]
__Nonexhaustive,
}
Expand Down Expand Up @@ -183,6 +185,7 @@ impl std::fmt::Display for Capability {
Capability::CAP_AUDIT_READ => "CAP_AUDIT_READ",
Capability::CAP_PERFMON => "CAP_PERFMON",
Capability::CAP_BPF => "CAP_BPF",
Capability::CAP_CHECKPOINT_RESTORE => "CAP_CHECKPOINT_RESTORE",
Capability::__Nonexhaustive => unreachable!("invalid capability"),
};
write!(f, "{}", name)
Expand Down Expand Up @@ -234,6 +237,7 @@ impl std::str::FromStr for Capability {
"CAP_AUDIT_READ" => Ok(Capability::CAP_AUDIT_READ),
"CAP_PERFMON" => Ok(Capability::CAP_PERFMON),
"CAP_BPF" => Ok(Capability::CAP_BPF),
"CAP_CHECKPOINT_RESTORE" => Ok(Capability::CAP_CHECKPOINT_RESTORE),
_ => Err(format!("invalid capability: {}", s).into()),
}
}
Expand Down Expand Up @@ -389,6 +393,7 @@ pub fn all() -> CapsHashSet {
Capability::CAP_AUDIT_READ,
Capability::CAP_PERFMON,
Capability::CAP_BPF,
Capability::CAP_CHECKPOINT_RESTORE,
];
CapsHashSet::from_iter(slice)
}
Expand Down
1 change: 1 addition & 0 deletions src/nr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ pub const CAP_BLOCK_SUSPEND: u8 = 36;
pub const CAP_AUDIT_READ: u8 = 37;
pub const CAP_PERFMON: u8 = 38;
pub const CAP_BPF: u8 = 39;
pub const CAP_CHECKPOINT_RESTORE: u8 = 40;

/* from <sys/prctl.h> */

Expand Down

0 comments on commit f0a202b

Please sign in to comment.