Skip to content

Commit cc91030

Browse files
committed
utils: simplify newProcess
This code is not in libcontainer, IOW it is only used by a short lived binary (runc start/run/exec). Unlike libcontainer code, here we don't have to care about copying the structures supplied as input, meaning we can just reuse the pointers directly. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
1 parent 0aeca24 commit cc91030

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

utils_linux.go

+2-10
Original file line numberDiff line numberDiff line change
@@ -55,23 +55,15 @@ func newProcess(p specs.Process) (*libcontainer.Process, error) {
5555
Label: p.SelinuxLabel,
5656
NoNewPrivileges: &p.NoNewPrivileges,
5757
AppArmorProfile: p.ApparmorProfile,
58+
Scheduler: p.Scheduler,
59+
IOPriority: p.IOPriority,
5860
}
5961

6062
if p.ConsoleSize != nil {
6163
lp.ConsoleWidth = uint16(p.ConsoleSize.Width)
6264
lp.ConsoleHeight = uint16(p.ConsoleSize.Height)
6365
}
6466

65-
if p.Scheduler != nil {
66-
s := *p.Scheduler
67-
lp.Scheduler = &s
68-
}
69-
70-
if p.IOPriority != nil {
71-
ioPriority := *p.IOPriority
72-
lp.IOPriority = &ioPriority
73-
}
74-
7567
if p.Capabilities != nil {
7668
lp.Capabilities = &configs.Capabilities{}
7769
lp.Capabilities.Bounding = p.Capabilities.Bounding

0 commit comments

Comments
 (0)