runc
runc copied to clipboard
refactor init and setns process
Because the initProcess
and setnsProcess
have many same fields, and they are all in a big file process_linux.go
, so let's do some refactor to this file:
-
Introduce a common parent struct
containerProcess
, let bothinitProcess
andsetnsProcess
are inherited from it; -
~~Move
initProcess
andsetnsProcess
definition and implementation out ofprocess_linux.go
, let them in their own seperate files:init_process_linux.go
andsetns_process_linux.go
, it will make more clear when reading and changing the code.~~ EDIT: the second refactor could be refactored after the release-1.1 is EOL.
This refactor doesn't change any logic, and it's the first step of #4309 . After this refactor, both initProcess
and setnsProcess
can be treated as containerProcess
, we can only need to write some logic for containerProcess
, and then could be used for both initProcess
and setnsProcess
.