docker-systemctl-replacement
docker-systemctl-replacement copied to clipboard
feature: please support "Nice"
Is it something that goes into execve_from() to modify the child processes?
def execve_from(self, conf, cmd, env):
""" this code is commonly run in a child process // returns exit-code"""
inp = open("/dev/zero")
out = self.open_journal_log(conf)
os.dup2(inp.fileno(), sys.stdin.fileno())
os.dup2(out.fileno(), sys.stdout.fileno())
os.dup2(out.fileno(), sys.stderr.fileno())
runuser = self.get_User(conf)
rungroup = self.get_Group(conf)
xgroups = self.get_SupplementaryGroups(conf)
envs = shutil_setuid(runuser, rungroup, xgroups)
badpath = self.chdir_workingdir(conf) # some dirs need setuid before
if badpath:
logg.error("(%s): bad workingdir: '%s'", shell_cmd(cmd), badpath)
sys.exit(1)
env = self.extend_exec_env(env)
env.update(envs) # set $HOME to ~$USER
os.execve(cmd[0], cmd, env)
I'm not familiar enough with codebase to have an opinion, if the question was addressed to me...
I think that Python does export the nice-API but I am not expert either. The problem here is that I don't have a use case for it and I don't know how to test the thing to actually work. So for the time being I am skipping the implementation on my own - may be someone else can provide a patch somewhen.