ptree with service names

A nice tool to get some understanding of the dependencies of processes is ptree tool. With the -c option the contract id (the contract filesystem is one of the features many people use because other features use it, but many are not really aware it’s there) of the process and - for many people more - the FMRI of the service by it has beeen started (that said it’s technically not the FMRI of the process but of the contract, which is the same)

When you know the the contract id of an process, you can check which service created this contract.

root@solaris:~# ps -ef -o pid,ctid,args | grep "1108"
 1108   151 /usr/bin/coremond
root@solaris:~#  ctstat -vi 151
CTID    ZONEID  TYPE    STATE   HOLDER  EVENTS  QTIME   NTIME
151     0       process owned   14      0       -       -
        cookie:                0x20
        informative event set: none
        critical event set:    core signal hwerr empty
        fatal event set:       none
        parameter set:         inherit regent
        member processes:      1108
        inherited contracts:   none
        service fmri:          svc:/system/coremon:default
        service fmri ctid:     151
        creator:               svc.startd
        aux:                   start

With ptree you get the most interesting information in a better overview representation:

jmoekamp@solaris:~$ ptree -c 1108
[process contract 1 svc:/system/init:default]
      1 /usr/sbin/init
    [process contract 4 svc:/system/svc/restarter:default]
         14 /lib/svc/bin/svc.startd
        [process contract 151 svc:/system/coremon:default]
           1108 /usr/bin/coremond