Antonello Cruz has just integrated its work about "Process Contract Decoration" into Solaris Nevada build 85
PSARC 2008/046 Process Contract Decorations
5079353 RFE: contract 'decoration' with service FMRI
----------------------------------------------------------------------------------------------------------------------------------------------------------
Contracts in Solaris are mainly used by SMF(4) to restart services (eg. when they die). Contract information
can be accessed through several commands: ctstat(1), ptree(1) , ps(1) , svcs(1)
For more details about contracts and services, read Victor Latushkin's Weblog
The interesting thing about Antonello's enhancement is that FMRIs are now available at the contract level.
Since contracts are known by the kernel, it means that relationship between contracts and FMRIs is now
available within the kernel.
This allows observation and debugging (e.g. with DTrace) in both userland and the kernel. Also, post-mortem
tools (eg. mdb) are able to identify the ownership of contracts.
When previously, we would go from the instance FMRI to find the contract id and the processes associated
# svcs -o CTID,FMRI,STATE ssh
CTID FMRI STATE
73 svc:/network/ssh:default online
# svcs -p ssh
STATE STIME FMRI
online 10:21:51 svc:/network/ssh:default
10:21:51 590 sshd
Now, we can do the opposite and go from the process to its FMRI associated and ctid
# ps -ae -o pid,ctid,comm | grep sshd
590 73 /usr/lib/ssh/sshd# ctstat -v -i 73
CTID ZONEID TYPE STATE HOLDER EVENTS QTIME NTIME
73 0 process owned 7 0 - -
cookie: 0x20
informative event set: none
critical event set: hwerr empty
fatal event set: none
parameter set: inherit regent
member processes: 590
inherited contracts: none
service fmri: svc:/network/ssh:default
svc_fmri ctid: 73
creator: svc.startd
aux: start
Here is a Dtrace example for aggregating system calls by FMRI
#!/usr/sbin/dtrace -qs
syscall:::entry
{
@[stringof(curthread->t_procp->p_ct_process>conp_svc_fmri->rs_string)] = count();
}
^C
svc:/system/fmd:default 7
svc:/system/utmp:default 11
svc:/system/system-log:default 18
svc:/network/rpc/keyserv:default 20
svc:/system/hal:default 20
svc:/system/intrd:default 36
svc:/system/zones:default 72
svc:/network/smtp:sendmail 122
svc:/network/inetd:default 292
svc:/network/rpc/bind:default 372
svc:/system/cryptosvc:default 394
svc:/network/nfs/mapid:default 439
svc:/network/rpc/gss:default 623
svc:/network/nfs/cbd:default 668
svc:/system/filesystem/autofs:default 1402
svc:/network/nfs/status:default 1556
svc:/system/webconsole:console 1842
svc:/network/nfs/nlockmgr:default 1977
svc:/application/graphical-login/cde-login:default 2449
svc:/system/svc/restarter:default 2851
svc:/system/name-service-cache:default 3819
svc:/system/console-login:default 5124
svc:/system/svc/repository:default 9686
svc:/network/ssh:default 10819