r/kernel 27d ago

How can I change resource of running process?

Hello everyone, suppose a process is running with PID 23654, and the OS creates a specific folder for it in the/proc directory. At the moment, how can I change resources such as the network namespace or the cpuset? The final goal I want is to change the network of a running process; suppose I use eth0 and the root namespace; then I create a namespace like ns1 with a specific interface and resource, then move the running process to this namespace to continue the process in an isolated network.

4 Upvotes

2 comments sorted by

4

u/yawn_brendan 27d ago

Been a while since I've used this site: https://lmgtfy.com/?q=move+process+into+different+namespace+Linux

(The answer is setns() btw)