mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-10 21:53:57 +08:00
utils: simplify newProcess
This code is not in libcontainer, meaning it is only used by a short lived binary (runc start/run/exec). Unlike code in libcontainer (see CreateLibcontainerConfig), here we don't have to care about copying the structures supplied as input, meaning we can just reuse the pointers directly. Fixes:bfbd0305("Add I/O priority") Fixes:770728e1("Support `process.scheduler`") Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
+2
-10
@@ -55,6 +55,8 @@ func newProcess(p specs.Process) (*libcontainer.Process, error) {
|
||||
Label: p.SelinuxLabel,
|
||||
NoNewPrivileges: &p.NoNewPrivileges,
|
||||
AppArmorProfile: p.ApparmorProfile,
|
||||
Scheduler: p.Scheduler,
|
||||
IOPriority: p.IOPriority,
|
||||
}
|
||||
|
||||
if p.ConsoleSize != nil {
|
||||
@@ -62,16 +64,6 @@ func newProcess(p specs.Process) (*libcontainer.Process, error) {
|
||||
lp.ConsoleHeight = uint16(p.ConsoleSize.Height)
|
||||
}
|
||||
|
||||
if p.Scheduler != nil {
|
||||
s := *p.Scheduler
|
||||
lp.Scheduler = &s
|
||||
}
|
||||
|
||||
if p.IOPriority != nil {
|
||||
ioPriority := *p.IOPriority
|
||||
lp.IOPriority = &ioPriority
|
||||
}
|
||||
|
||||
if p.Capabilities != nil {
|
||||
lp.Capabilities = &configs.Capabilities{}
|
||||
lp.Capabilities.Bounding = p.Capabilities.Bounding
|
||||
|
||||
Reference in New Issue
Block a user