#linux #abstraction #interface #flags #linux-process #access #root-test

prctl

此包为 Linux prctl() 接口提供安全的抽象。某些功能可能特定于架构。

6 个版本 (1 个稳定版)

使用旧的 Rust 2015

1.0.0 2015年10月13日
0.2.0 2015年2月24日
0.1.1 2015年2月8日
0.1.0 2015年1月11日
0.0.2 2014年12月14日

#871Rust 模式

Download history • Rust 包仓库 39295/week @ 2024-03-14 • Rust 包仓库 34415/week @ 2024-03-21 • Rust 包仓库 32506/week @ 2024-03-28 • Rust 包仓库 24722/week @ 2024-04-04 • Rust 包仓库 31930/week @ 2024-04-11 • Rust 包仓库 24511/week @ 2024-04-18 • Rust 包仓库 29414/week @ 2024-04-25 • Rust 包仓库 20305/week @ 2024-05-02 • Rust 包仓库 22685/week @ 2024-05-09 • Rust 包仓库 21220/week @ 2024-05-16 • Rust 包仓库 36757/week @ 2024-05-23 • Rust 包仓库 42596/week @ 2024-05-30 • Rust 包仓库 50179/week @ 2024-06-06 • Rust 包仓库 32208/week @ 2024-06-13 • Rust 包仓库 41602/week @ 2024-06-20 • Rust 包仓库 22061/week @ 2024-06-27 • Rust 包仓库

152,142 每月下载量
11 包中使用 (7 个直接使用)

MIT 许可证

21KB
549

prctl

Rust 库,提供 prctl 抽象

模块提供了对 prctl 接口的安全抽象。提供的函数映射到一个单独的 prctl() 调用,尽管其中一些可能只能在特定架构或只有 root 权限时使用。此包提供了所有已知的可能用作参数的枚举。

每个函数都提供结果,如果 prctl() 调用失败,则结果将为 Err(errno)

要运行需要 root 权限的测试,启用功能 "root_test"。

用法

大多数函数设置/获取标志或设置/获取选项。它们可以使用以下方式使用

// 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:

模块提供了对 prctl 接口的安全抽象。提供的函数映射到一个单独的 prctl() 调用,尽管其中一些可能只能在特定架构或只有 root 权限时使用。此包提供了所有已知的可能用作参数的枚举。

每个函数都提供结果,如果 prctl() 调用失败,则结果将为 Err(errno)

要运行需要 root 权限的测试,启用功能 "root_test"。

依赖项

~1.5MB
~36K SLoC