| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
type ExResult<T> = Result<T, Box<dyn std::error::Error + 'static>>; |
| 14 |
|
| 15 |
fn main() -> ExResult<()> { |
| 16 |
let library_set = caps::all(); |
| 17 |
let runtime_set = caps::runtime::procfs_all_supported(None).unwrap_or_else(|e| { |
| 18 |
eprintln!("procfs introspection failed: {}", e); |
| 19 |
caps::runtime::thread_all_supported() |
| 20 |
}); |
| 21 |
|
| 22 |
println!("Capabilities tally:"); |
| 23 |
println!(" -> known by this library: {}.", library_set.len()); |
| 24 |
println!(" -> known by the current kernel: {}.\n", runtime_set.len()); |
| 25 |
|
| 26 |
println!("Library vs kernel differences:"); |
| 27 |
println!( |
| 28 |
" -> newer caps only in the library set: {:?}.", |
| 29 |
library_set.difference(&runtime_set) |
| 30 |
); |
| 31 |
println!( |
| 32 |
" -> newer caps only in the current kernel set: {:?}.", |
| 33 |
runtime_set.difference(&library_set) |
| 34 |
); |
| 35 |
|
| 36 |
Ok(()) |
| 37 |
} |