runc icon indicating copy to clipboard operation
runc copied to clipboard

refactor init and setns process

Open lifubang opened this issue 2 months ago • 3 comments

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:

  1. Introduce a common parent struct containerProcess, let both initProcess and setnsProcess are inherited from it;

  2. ~~Move initProcess and setnsProcess definition and implementation out of process_linux.go, let them in their own seperate files: init_process_linux.go and setns_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.

lifubang avatar Jun 06 '24 15:06 lifubang