I wasn't actually doing looking at debug info about struct queue, just looking 
up the symbol qt.
On Solaris 9, nm -D /usr/sbin/cron can see that, on Solaris 10 it can't.

It's declared static (in OpenSolaris; it wasn't in the pseudo-release of 
Solaris 8 FCS source,
so I can't be sure that it wasn't different before, although I don't think so).

    206 static struct   queue
    207 {
    208         int njob;       /* limit */
    209         int nice;       /* nice for execution */
    210         int nwait;      /* wait time to next execution attempt */
    211         int nrun;       /* number running */
    212 }
    213         qd = {100, 2, 60},              /* default values for queue 
defs */
    214         qt[NQUEUE];


Script follows (only works <= Solaris 9):
#! /bin/ksh

if [ -x /usr/bin/zonename ]; then
    ZONEARGS="-z $(zonename)"
else
    ZONEARGS=""
fi

# not an ideal solution to getting just the parent, but
# better than taking it for granted that we never see one
# between fork and exec
CRON_PID="$(pgrep -u 0 ${ZONEARGS} -xf /usr/sbin/cron)"
while (( $(print "${CRON_PID}"|wc -w) > 1 ))
do
    sleep 1
    CRON_PID="$(pgrep -u 0 ${ZONEARGS} -xf /usr/sbin/cron)"
done
if [ -z "${CRON_PID}" ]; then
    print -u 2 "cron not running"
    exit 1
fi

mdb -p "${CRON_PID}" <<EOF | \
    awk 'BEGIN {printf "%10s %10s %10s %10s\n","NJOB","NICE","NWAIT","NRUN"}
         NF>=4 {printf "%10d %10d %10d %10d\n",$(NF-3),$(NF-2),$(NF-1),$NF}'
qt,0t26/DDDD
EOF
-- 
This message posted from opensolaris.org
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to