On Sat, Sep 17, 2011 at 3:04 AM, Joost Roeleveld <jo...@antarean.org> wrote: > On Saturday, September 17, 2011 08:45:15 AM Joost Roeleveld wrote: >> On Friday, September 16, 2011 10:53:47 AM Canek Peláez Valdés wrote: >> > I think systemd gives you that in servers. With OpenRC and Apache with >> > user CGI scripts, ¿do you know how to list the httpd daemon spawned >> > processes, and only those? Remember that a CGI script can double fork. >> > >> > With systemd is a matter of: >> > >> > systemctl status apache-httpd.service >> >> Did you look at the output of pstree? >> Try "pstree -pu" and you see all the PIDs and whenever there is a "user- >> switch", it also lists the new user. >> > > Had a quick look to get a more detailed list: > > Specifically only for apache: > # pstree -pu `cat /var/run/apache2.pid` > > "/var/run/apache2.pid" gets the PID for the parent process automatically. > > With this list, I can get a more detailed picture of which process calls which > child-process / thread and which user(s) are used for which process.
Yeah, but apparently you have never had a rogue (or just poorly written) CGI script. If inside a CGI script you do a double fork, and kill the first child, the second child (the "grandchild" of apache) will get reattached to PID 1. This is the POSIX defined behaviour. But then your pstree -pu $(cat /var/run/apache2.pid) doesn't work. Again, with cgroups (and without systemd) you can handle it. But then you need to do it manually for every daemon in the system. systemd allows you to do it for you. And it will be the same with user sessions, because is (for all that matters) the same problem. Your desktop session will have its own cgroup, and every application run by the user will be a subgroup of the session group. With systemd, my slow laptop boots from GRUB2 to GDM in 15 seconds. That's almost three times better than with OpenRC. But from GDM to full started desktop (before lauching applications) it takes almost 45 seconds. If I get to shave 15 seconds of it (and I am sure it will be more) by using systemd --user, I will be a really, really happy man. Regards. -- Canek Peláez Valdés Posgrado en Ciencia e Ingeniería de la Computación Universidad Nacional Autónoma de México