#linux #process #abstraction #flags #interface #set #name

prctl

This package provides safe abstraction to the linux prctl() interface. Some functions may be architecture-specific.

6 releases (1 stable)

Uses old Rust 2015

1.0.0 Oct 13, 2015
0.2.0 Feb 24, 2015
0.1.1 Feb 8, 2015
0.1.0 Jan 11, 2015
0.0.2 Dec 14, 2014

#1727 in Rust patterns

Download history 42067/week @ 2024-07-21 41577/week @ 2024-07-28 14263/week @ 2024-08-04 10545/week @ 2024-08-11 14885/week @ 2024-08-18 13676/week @ 2024-08-25 14593/week @ 2024-09-01 17441/week @ 2024-09-08 15250/week @ 2024-09-15 9564/week @ 2024-09-22 22027/week @ 2024-09-29 14670/week @ 2024-10-06 14078/week @ 2024-10-13 17540/week @ 2024-10-20 14477/week @ 2024-10-27 19196/week @ 2024-11-03

66,884 downloads per month
Used in 12 crates (8 directly)

MIT license

21KB
549 lines

prctl

Rust library providing the prctl abstraction

Module provides safe abstraction over the prctl interface. Provided functions map to a single prctl() call, although some of them may be usable only on a specific architecture or only with root privileges. All known enums that may be used as parameters are provided in this crate.

Each function provides result which will be Err(errno) in case the prctl() call fails.

To run tests requiring root privileges, enable feature "root_test".

Usage

Most functions set/get flags or set/get options. They can be used in the following way:

// Allow core dumping
!try(prctl::set_dumpable(true));

// Get current timer slack
let slack = !try(prctl::get_timer_slack());

// Send signal 6 after dying
!try(prctl::set_death_signal(6));

// Set current process name
!try(prctl::set_name("new_process"));

// Disable access to the timestamp counter
use prctl::PrctlTsc;
!try(prctl::set_tsc(PrctlTsc::PR_TSC_SIGSEGV));

lib.rs:

Module provides safe abstraction over the prctl interface. Provided functions map to a single prctl() call, although some of them may be usable only on a specific architecture or only with root privileges. All known enums that may be used as parameters are provided in this crate.

Each function provides result which will be Err(errno) in case the prctl() call fails.

To run tests requiring root privileges, enable feature "root_test".

Dependencies

~1.5MB
~35K SLoC