Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add LIMIT_BREAKAWAY_OK as available flag #8

Merged
merged 1 commit into from
Jan 23, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/limits.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
use windows::Win32::System::{
JobObjects::{
JOBOBJECT_EXTENDED_LIMIT_INFORMATION, JOB_OBJECT_LIMIT_AFFINITY,
JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE, JOB_OBJECT_LIMIT_PRIORITY_CLASS,
JOB_OBJECT_LIMIT_SCHEDULING_CLASS, JOB_OBJECT_LIMIT_WORKINGSET,
JOB_OBJECT_LIMIT_BREAKAWAY_OK, JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE,
JOB_OBJECT_LIMIT_PRIORITY_CLASS, JOB_OBJECT_LIMIT_SCHEDULING_CLASS,
JOB_OBJECT_LIMIT_WORKINGSET,
},
Threading::{
ABOVE_NORMAL_PRIORITY_CLASS, BELOW_NORMAL_PRIORITY_CLASS, HIGH_PRIORITY_CLASS,
Expand Down Expand Up @@ -61,6 +62,14 @@ impl ExtendedLimitInfo {
self
}

/// If any process associated with the job creates a child process using
/// this flag, the child process is not associated with the job.
pub fn limit_breakaway_ok(&mut self) -> &mut Self {
self.0.BasicLimitInformation.LimitFlags |= JOB_OBJECT_LIMIT_BREAKAWAY_OK;

self
}

/// Causes all processes associated with the job to use the same priority class.
/// Note: Processes and threads cannot modify their priority class.
/// The calling process must enable the `SE_INC_BASE_PRIORITY_NAME` privilege.
Expand Down
Loading