openwrt / procd

[MIRROR] OpenWrt service / process manager
https://git.openwrt.org/?p=project/procd.git;
4 stars 13 forks source link

procfs flag doesn't work properly #12

Closed morytyann closed 2 weeks ago

morytyann commented 2 weeks ago

I am using procd_add_jail in init script, the program need to read /proc/${pid}, so i set procfs flag to the jail, but it doesn't work properly, i can't find any folder named by pid under /proc which is need by the program.

I tried to use procd_add_jail_mount /proc, but another bug appeared, program can't read the memory usage of itself.

So is this a bug or a feature? If it's a bug, is there any workaround?

morytyann commented 2 weeks ago

I'm not a native English speaker, sorry for my poor English.

dangowrt commented 2 weeks ago

It's a feature :wink: procd jail uses PID namespaces, which means that the process will only see itself as PID 1 and no other processes in /proc/.

morytyann commented 2 weeks ago

I see, and this is also why memory usage is wrong when i mount /proc by procd_add_jail_mount /proc, it will read the memory usage of process which pid is 1.