proc_self 0.1.0

Cross-platform `/proc/self` functionality. This library enables limited `/proc/self` functionality, including getting the current executable, open file descriptors, and paths for open file descriptors that can be passed to e.g. `exec` (for those systems without `fexecve`).
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
extern crate proc_self;

use proc_self::*;
use std::fs;

fn main() {
	let _ = exe().unwrap();
	#[cfg(not(target_family = "windows"))]
	{
		// Rust testing framework occasionally gives us 0, 1, 2, 6 ???
		assert_eq!(FdIter::new().unwrap().collect::<Vec<_>>()[..3], [0, 1, 2]);
		for fd in FdIter::new().unwrap() {
			println!("{:?}", fd);
			let _ = fs::File::open(fd_path(fd).unwrap()).unwrap();
		}
	}
}