In SRU 75 of Solaris 11.4 two options were added to pgrep and pkill. The first option is -Z . With this option you can limit both commands to the current processes zone.

root@testbed:~# ps -efZ | grep utmpd
  global   daemon   200     1   0 05:58:33 ?           0:00 /usr/lib/utmpd
testzone   daemon  1837  1703   0 07:57:48 ?           0:00 /usr/lib/utmpd
root@testbed:~# pgrep utmpd
200
1837
root@testbed:~# pgrep -Z utmpd
200

The second new option is -r. This option allows you to limit pgrep to the processes dependend on the process you have specified with a PID.

root@testbed:~# pgrep -r 1703
1703
1712
1714
1793
1822
1837
1839
1874
1894
1902

If you crosscheck this with ptree you will see the same processes (except the parent process of 1703):

root@testbed:~# ptree  1703
 1648 zsched
   1703 /usr/sbin/init
     1712 /lib/svc/bin/svc.startd
       1874 /usr/bin/sh /lib/svc/method/milestone-config start
         1894 /usr/bin/python3.11 -Es ....
           1903 <defunct>
     1714 /lib/svc/bin/svc.configd
     1793 /usr/sbin/sysobjd -d 0 -b 300 -t 300 -n 5
     1822 /lib/inet/ipmgmtd
     1837 /usr/lib/utmpd
     1839 /usr/lib/rad/rad -sp
       1902 /usr/lib/rad/rad -m ....
       

The same options works for pkill.

Written by

Joerg Moellenkamp

Grey-haired, sometimes grey-bearded Windows dismissing Unix guy.