func (self *Job) SetExtendedLimitInfo(info *JobExtendedLimitInfo) error { rawInfo := wrappers.JOBOBJECT_EXTENDED_LIMIT_INFORMATION{ BasicLimitInformation: wrappers.JOBOBJECT_BASIC_LIMIT_INFORMATION{ PerProcessUserTimeLimit: info.PerProcessUserTimeLimit, PerJobUserTimeLimit: info.PerJobUserTimeLimit, LimitFlags: uint32(info.LimitFlags), MinimumWorkingSetSize: info.MinimumWorkingSetSize, MaximumWorkingSetSize: info.MaximumWorkingSetSize, ActiveProcessLimit: uint32(info.ActiveProcessLimit), Affinity: info.Affinity, PriorityClass: uint32(info.PriorityClass), SchedulingClass: uint32(info.SchedulingClass), }, ProcessMemoryLimit: info.ProcessMemoryLimit, JobMemoryLimit: info.JobMemoryLimit, PeakProcessMemoryUsed: info.PeakProcessMemoryUsed, PeakJobMemoryUsed: info.PeakJobMemoryUsed, } err := wrappers.SetInformationJobObject( self.handle, wrappers.JobObjectExtendedLimitInformation, (*byte)(unsafe.Pointer(&rawInfo)), uint32(unsafe.Sizeof(rawInfo))) if err != nil { return NewWindowsError("SetInformationJobObject", err) } return nil }
func (self *Job) SetBasicUIRestrictions(flags JobUILimitFlags) error { info := wrappers.JOBOBJECT_BASIC_UI_RESTRICTIONS{ UIRestrictionsClass: uint32(flags), } err := wrappers.SetInformationJobObject( self.handle, wrappers.JobObjectBasicUIRestrictions, (*byte)(unsafe.Pointer(&info)), uint32(unsafe.Sizeof(info))) if err != nil { return NewWindowsError("SetInformationJobObject", err) } return nil }