10Sstevel@tonic-gate/* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 52525Sdp * Common Development and Distribution License (the "License"). 62525Sdp * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 213235Sraf 220Sstevel@tonic-gate/* 23*9389SVamsi.Krishna@Sun.COM * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 240Sstevel@tonic-gate * Use is subject to license terms. 250Sstevel@tonic-gate */ 260Sstevel@tonic-gate 270Sstevel@tonic-gate/* 280Sstevel@tonic-gate * This file defines the standard set of inlines and translators to be made 290Sstevel@tonic-gate * available for all D programs to use to examine process model state. 300Sstevel@tonic-gate */ 310Sstevel@tonic-gate 320Sstevel@tonic-gate#pragma D depends_on module procfs 330Sstevel@tonic-gate 340Sstevel@tonic-gate/* 350Sstevel@tonic-gate * The following miscellaneous constants are used by the proc(4) translators 360Sstevel@tonic-gate * defined below. These are assigned the latest values from the system .h's. 370Sstevel@tonic-gate */ 380Sstevel@tonic-gateinline char SSLEEP = @SSLEEP@; 390Sstevel@tonic-gate#pragma D binding "1.0" SSLEEP 400Sstevel@tonic-gateinline char SRUN = @SRUN@; 410Sstevel@tonic-gate#pragma D binding "1.0" SRUN 420Sstevel@tonic-gateinline char SZOMB = @SZOMB@; 430Sstevel@tonic-gate#pragma D binding "1.0" SZOMB 440Sstevel@tonic-gateinline char SSTOP = @SSTOP@; 450Sstevel@tonic-gate#pragma D binding "1.0" SSTOP 460Sstevel@tonic-gateinline char SIDL = @SIDL@; 470Sstevel@tonic-gate#pragma D binding "1.0" SIDL 480Sstevel@tonic-gateinline char SONPROC = @SONPROC@; 490Sstevel@tonic-gate#pragma D binding "1.0" SONPROC 503792Sakolbinline char SWAIT = @SWAIT@; 513792Sakolb#pragma D binding "1.0" SWAIT 520Sstevel@tonic-gate 530Sstevel@tonic-gateinline int PR_STOPPED = @PR_STOPPED@; 540Sstevel@tonic-gate#pragma D binding "1.0" PR_STOPPED 550Sstevel@tonic-gateinline int PR_ISTOP = @PR_ISTOP@; 560Sstevel@tonic-gate#pragma D binding "1.0" PR_ISTOP 570Sstevel@tonic-gateinline int PR_DSTOP = @PR_DSTOP@; 580Sstevel@tonic-gate#pragma D binding "1.0" PR_DSTOP 590Sstevel@tonic-gateinline int PR_STEP = @PR_STEP@; 600Sstevel@tonic-gate#pragma D binding "1.0" PR_STEP 610Sstevel@tonic-gateinline int PR_ASLEEP = @PR_ASLEEP@; 620Sstevel@tonic-gate#pragma D binding "1.0" PR_ASLEEP 630Sstevel@tonic-gateinline int PR_PCINVAL = @PR_PCINVAL@; 640Sstevel@tonic-gate#pragma D binding "1.0" PR_PCINVAL 650Sstevel@tonic-gateinline int PR_ASLWP = @PR_ASLWP@; 660Sstevel@tonic-gate#pragma D binding "1.0" PR_ASLWP 670Sstevel@tonic-gateinline int PR_AGENT = @PR_AGENT@; 680Sstevel@tonic-gate#pragma D binding "1.0" PR_AGENT 690Sstevel@tonic-gateinline int PR_DETACH = @PR_DETACH@; 700Sstevel@tonic-gate#pragma D binding "1.0" PR_DETACH 710Sstevel@tonic-gateinline int PR_DAEMON = @PR_DAEMON@; 720Sstevel@tonic-gate#pragma D binding "1.0" PR_DAEMON 733235Srafinline int PR_IDLE = @PR_IDLE@; 743235Sraf#pragma D binding "1.4" PR_IDLE 750Sstevel@tonic-gateinline int PR_ISSYS = @PR_ISSYS@; 760Sstevel@tonic-gate#pragma D binding "1.0" PR_ISSYS 770Sstevel@tonic-gateinline int PR_VFORKP = @PR_VFORKP@; 780Sstevel@tonic-gate#pragma D binding "1.0" PR_VFORKP 790Sstevel@tonic-gateinline int PR_ORPHAN = @PR_ORPHAN@; 800Sstevel@tonic-gate#pragma D binding "1.0" PR_ORPHAN 813235Srafinline int PR_NOSIGCHLD = @PR_NOSIGCHLD@; 823235Sraf#pragma D binding "1.4" PR_NOSIGCHLD 833235Srafinline int PR_WAITPID = @PR_WAITPID@; 843235Sraf#pragma D binding "1.4" PR_WAITPID 850Sstevel@tonic-gateinline int PR_FORK = @PR_FORK@; 860Sstevel@tonic-gate#pragma D binding "1.0" PR_FORK 870Sstevel@tonic-gateinline int PR_RLC = @PR_RLC@; 880Sstevel@tonic-gate#pragma D binding "1.0" PR_RLC 890Sstevel@tonic-gateinline int PR_KLC = @PR_KLC@; 900Sstevel@tonic-gate#pragma D binding "1.0" PR_KLC 910Sstevel@tonic-gateinline int PR_ASYNC = @PR_ASYNC@; 920Sstevel@tonic-gate#pragma D binding "1.0" PR_ASYNC 930Sstevel@tonic-gateinline int PR_MSACCT = @PR_MSACCT@; 940Sstevel@tonic-gate#pragma D binding "1.0" PR_MSACCT 950Sstevel@tonic-gateinline int PR_BPTADJ = @PR_BPTADJ@; 960Sstevel@tonic-gate#pragma D binding "1.0" PR_BPTADJ 970Sstevel@tonic-gateinline int PR_PTRACE = @PR_PTRACE@; 980Sstevel@tonic-gate#pragma D binding "1.0" PR_PTRACE 990Sstevel@tonic-gateinline int PR_MSFORK = @PR_MSFORK@; 1000Sstevel@tonic-gate#pragma D binding "1.0" PR_MSFORK 1010Sstevel@tonic-gate 1020Sstevel@tonic-gateinline char PR_MODEL_ILP32 = @PR_MODEL_ILP32@; 1030Sstevel@tonic-gate#pragma D binding "1.0" PR_MODEL_ILP32 1040Sstevel@tonic-gateinline char PR_MODEL_LP64 = @PR_MODEL_LP64@; 1050Sstevel@tonic-gate#pragma D binding "1.0" PR_MODEL_LP64 1060Sstevel@tonic-gate 1070Sstevel@tonic-gateinline char SOBJ_NONE = @SOBJ_NONE@; 1080Sstevel@tonic-gate#pragma D binding "1.0" SOBJ_NONE 1090Sstevel@tonic-gateinline char SOBJ_MUTEX = @SOBJ_MUTEX@; 1100Sstevel@tonic-gate#pragma D binding "1.0" SOBJ_MUTEX 1110Sstevel@tonic-gateinline char SOBJ_RWLOCK = @SOBJ_RWLOCK@; 1120Sstevel@tonic-gate#pragma D binding "1.0" SOBJ_RWLOCK 1130Sstevel@tonic-gateinline char SOBJ_CV = @SOBJ_CV@; 1140Sstevel@tonic-gate#pragma D binding "1.0" SOBJ_CV 1150Sstevel@tonic-gateinline char SOBJ_SEMA = @SOBJ_SEMA@; 1160Sstevel@tonic-gate#pragma D binding "1.0" SOBJ_SEMA 1170Sstevel@tonic-gateinline char SOBJ_USER = @SOBJ_USER@; 1180Sstevel@tonic-gate#pragma D binding "1.0" SOBJ_USER 1190Sstevel@tonic-gateinline char SOBJ_USER_PI = @SOBJ_USER_PI@; 1200Sstevel@tonic-gate#pragma D binding "1.0" SOBJ_USER_PI 1210Sstevel@tonic-gateinline char SOBJ_SHUTTLE = @SOBJ_SHUTTLE@; 1220Sstevel@tonic-gate#pragma D binding "1.0" SOBJ_SHUTTLE 1230Sstevel@tonic-gate 1240Sstevel@tonic-gateinline int SI_USER = @SI_USER@; 1250Sstevel@tonic-gate#pragma D binding "1.0" SI_USER 1260Sstevel@tonic-gateinline int SI_LWP = @SI_LWP@; 1270Sstevel@tonic-gate#pragma D binding "1.0" SI_LWP 1280Sstevel@tonic-gateinline int SI_QUEUE = @SI_QUEUE@; 1290Sstevel@tonic-gate#pragma D binding "1.0" SI_QUEUE 1300Sstevel@tonic-gateinline int SI_TIMER = @SI_TIMER@; 1310Sstevel@tonic-gate#pragma D binding "1.0" SI_TIMER 1320Sstevel@tonic-gateinline int SI_ASYNCIO = @SI_ASYNCIO@; 1330Sstevel@tonic-gate#pragma D binding "1.0" SI_ASYNCIO 1340Sstevel@tonic-gateinline int SI_MESGQ = @SI_MESGQ@; 1350Sstevel@tonic-gate#pragma D binding "1.0" SI_MESGQ 1360Sstevel@tonic-gateinline int SI_RCTL = @SI_RCTL@; 1370Sstevel@tonic-gate#pragma D binding "1.0" SI_RCTL 1380Sstevel@tonic-gateinline int ILL_ILLOPC = @ILL_ILLOPC@; 1390Sstevel@tonic-gate#pragma D binding "1.0" ILL_ILLOPC 1400Sstevel@tonic-gateinline int ILL_ILLOPN = @ILL_ILLOPN@; 1410Sstevel@tonic-gate#pragma D binding "1.0" ILL_ILLOPN 1420Sstevel@tonic-gateinline int ILL_ILLADR = @ILL_ILLADR@; 1430Sstevel@tonic-gate#pragma D binding "1.0" ILL_ILLADR 1440Sstevel@tonic-gateinline int ILL_ILLTRP = @ILL_ILLTRP@; 1450Sstevel@tonic-gate#pragma D binding "1.0" ILL_ILLTRP 1460Sstevel@tonic-gateinline int ILL_PRVOPC = @ILL_PRVOPC@; 1470Sstevel@tonic-gate#pragma D binding "1.0" ILL_PRVOPC 1480Sstevel@tonic-gateinline int ILL_PRVREG = @ILL_PRVREG@; 1490Sstevel@tonic-gate#pragma D binding "1.0" ILL_PRVREG 1500Sstevel@tonic-gateinline int ILL_COPROC = @ILL_COPROC@; 1510Sstevel@tonic-gate#pragma D binding "1.0" ILL_COPROC 1520Sstevel@tonic-gateinline int ILL_BADSTK = @ILL_BADSTK@; 1530Sstevel@tonic-gate#pragma D binding "1.0" ILL_BADSTK 1540Sstevel@tonic-gateinline int FPE_INTDIV = @FPE_INTDIV@; 1550Sstevel@tonic-gate#pragma D binding "1.0" FPE_INTDIV 1560Sstevel@tonic-gateinline int FPE_INTOVF = @FPE_INTOVF@; 1570Sstevel@tonic-gate#pragma D binding "1.0" FPE_INTOVF 1580Sstevel@tonic-gateinline int FPE_FLTDIV = @FPE_FLTDIV@; 1590Sstevel@tonic-gate#pragma D binding "1.0" FPE_FLTDIV 1600Sstevel@tonic-gateinline int FPE_FLTOVF = @FPE_FLTOVF@; 1610Sstevel@tonic-gate#pragma D binding "1.0" FPE_FLTOVF 1620Sstevel@tonic-gateinline int FPE_FLTUND = @FPE_FLTUND@; 1630Sstevel@tonic-gate#pragma D binding "1.0" FPE_FLTUND 1640Sstevel@tonic-gateinline int FPE_FLTRES = @FPE_FLTRES@; 1650Sstevel@tonic-gate#pragma D binding "1.0" FPE_FLTRES 1660Sstevel@tonic-gateinline int FPE_FLTINV = @FPE_FLTINV@; 1670Sstevel@tonic-gate#pragma D binding "1.0" FPE_FLTINV 1680Sstevel@tonic-gateinline int FPE_FLTSUB = @FPE_FLTSUB@; 1690Sstevel@tonic-gate#pragma D binding "1.0" FPE_FLTSUB 1700Sstevel@tonic-gateinline int SEGV_MAPERR = @SEGV_MAPERR@; 1710Sstevel@tonic-gate#pragma D binding "1.0" SEGV_MAPERR 1720Sstevel@tonic-gateinline int SEGV_ACCERR = @SEGV_ACCERR@; 1730Sstevel@tonic-gate#pragma D binding "1.0" SEGV_ACCERR 1740Sstevel@tonic-gateinline int BUS_ADRALN = @BUS_ADRALN@; 1750Sstevel@tonic-gate#pragma D binding "1.0" BUS_ADRALN 1760Sstevel@tonic-gateinline int BUS_ADRERR = @BUS_ADRERR@; 1770Sstevel@tonic-gate#pragma D binding "1.0" BUS_ADRERR 1780Sstevel@tonic-gateinline int BUS_OBJERR = @BUS_OBJERR@; 1790Sstevel@tonic-gate#pragma D binding "1.0" BUS_OBJERR 1800Sstevel@tonic-gateinline int TRAP_BRKPT = @TRAP_BRKPT@; 1810Sstevel@tonic-gate#pragma D binding "1.0" TRAP_BRKPT 1820Sstevel@tonic-gateinline int TRAP_TRACE = @TRAP_TRACE@; 1830Sstevel@tonic-gate#pragma D binding "1.0" TRAP_TRACE 1840Sstevel@tonic-gateinline int CLD_EXITED = @CLD_EXITED@; 1850Sstevel@tonic-gate#pragma D binding "1.0" CLD_EXITED 1860Sstevel@tonic-gateinline int CLD_KILLED = @CLD_KILLED@; 1870Sstevel@tonic-gate#pragma D binding "1.0" CLD_KILLED 1880Sstevel@tonic-gateinline int CLD_DUMPED = @CLD_DUMPED@; 1890Sstevel@tonic-gate#pragma D binding "1.0" CLD_DUMPED 1900Sstevel@tonic-gateinline int CLD_TRAPPED = @CLD_TRAPPED@; 1910Sstevel@tonic-gate#pragma D binding "1.0" CLD_TRAPPED 1920Sstevel@tonic-gateinline int CLD_STOPPED = @CLD_STOPPED@; 1930Sstevel@tonic-gate#pragma D binding "1.0" CLD_STOPPED 1940Sstevel@tonic-gateinline int CLD_CONTINUED = @CLD_CONTINUED@; 1950Sstevel@tonic-gate#pragma D binding "1.0" CLD_CONTINUED 1960Sstevel@tonic-gateinline int POLL_IN = @POLL_IN@; 1970Sstevel@tonic-gate#pragma D binding "1.0" POLL_IN 1980Sstevel@tonic-gateinline int POLL_OUT = @POLL_OUT@; 1990Sstevel@tonic-gate#pragma D binding "1.0" POLL_OUT 2000Sstevel@tonic-gateinline int POLL_MSG = @POLL_MSG@; 2010Sstevel@tonic-gate#pragma D binding "1.0" POLL_MSG 2020Sstevel@tonic-gateinline int POLL_ERR = @POLL_ERR@; 2030Sstevel@tonic-gate#pragma D binding "1.0" POLL_ERR 2040Sstevel@tonic-gateinline int POLL_PRI = @POLL_PRI@; 2050Sstevel@tonic-gate#pragma D binding "1.0" POLL_PRI 2060Sstevel@tonic-gateinline int POLL_HUP = @POLL_HUP@; 2070Sstevel@tonic-gate#pragma D binding "1.0" POLL_HUP 2080Sstevel@tonic-gate 2090Sstevel@tonic-gate/* 2100Sstevel@tonic-gate * Translate from the kernel's proc_t structure to a proc(4) psinfo_t struct. 2110Sstevel@tonic-gate * We do not provide support for pr_size, pr_rssize, pr_pctcpu, and pr_pctmem. 2120Sstevel@tonic-gate * We also do not fill in pr_lwp (the lwpsinfo_t for the representative LWP) 2130Sstevel@tonic-gate * because we do not have the ability to select and stop any representative. 2140Sstevel@tonic-gate * Also, for the moment, pr_wstat, pr_time, and pr_ctime are not supported, 2150Sstevel@tonic-gate * but these could be supported by DTrace in the future using subroutines. 2160Sstevel@tonic-gate * Note that any member added to this translator should also be added to the 2170Sstevel@tonic-gate * kthread_t-to-psinfo_t translator, below. 2180Sstevel@tonic-gate */ 2190Sstevel@tonic-gate#pragma D binding "1.0" translator 2200Sstevel@tonic-gatetranslator psinfo_t < proc_t *T > { 2210Sstevel@tonic-gate pr_nlwp = T->p_lwpcnt; 2220Sstevel@tonic-gate pr_pid = T->p_pidp->pid_id; 2230Sstevel@tonic-gate pr_ppid = T->p_ppid; 2240Sstevel@tonic-gate pr_pgid = T->p_pgidp->pid_id; 2250Sstevel@tonic-gate pr_sid = T->p_sessp->s_sidp->pid_id; 2260Sstevel@tonic-gate pr_uid = T->p_cred->cr_ruid; 2270Sstevel@tonic-gate pr_euid = T->p_cred->cr_uid; 2280Sstevel@tonic-gate pr_gid = T->p_cred->cr_rgid; 2290Sstevel@tonic-gate pr_egid = T->p_cred->cr_gid; 2300Sstevel@tonic-gate pr_addr = (uintptr_t)T; 2310Sstevel@tonic-gate 2320Sstevel@tonic-gate pr_ttydev = (T->p_sessp->s_vp == NULL) ? (dev_t)-1 : 2330Sstevel@tonic-gate (T->p_sessp->s_dev == `rwsconsdev) ? `uconsdev : 2340Sstevel@tonic-gate (T->p_sessp->s_dev == `rconsdev) ? `uconsdev : T->p_sessp->s_dev; 2350Sstevel@tonic-gate 2360Sstevel@tonic-gate pr_start = T->p_user.u_start; 2370Sstevel@tonic-gate pr_fname = T->p_user.u_comm; 2380Sstevel@tonic-gate pr_psargs = T->p_user.u_psargs; 2390Sstevel@tonic-gate pr_argc = T->p_user.u_argc; 2400Sstevel@tonic-gate pr_argv = T->p_user.u_argv; 2410Sstevel@tonic-gate pr_envp = T->p_user.u_envp; 2420Sstevel@tonic-gate 2430Sstevel@tonic-gate pr_dmodel = (T->p_model == @DATAMODEL_ILP32@) ? 2440Sstevel@tonic-gate PR_MODEL_ILP32 : PR_MODEL_LP64; 2450Sstevel@tonic-gate 2460Sstevel@tonic-gate pr_taskid = T->p_task->tk_tkid; 2470Sstevel@tonic-gate pr_projid = T->p_task->tk_proj->kpj_id; 2480Sstevel@tonic-gate pr_poolid = T->p_pool->pool_id; 2490Sstevel@tonic-gate pr_zoneid = T->p_zone->zone_id; 250*9389SVamsi.Krishna@Sun.COM pr_contract = (T->p_ct_process == NULL) ? -1 : 251*9389SVamsi.Krishna@Sun.COM T->p_ct_process->conp_contract.ct_id; 2520Sstevel@tonic-gate}; 2530Sstevel@tonic-gate 2540Sstevel@tonic-gate/* 2550Sstevel@tonic-gate * Translate from the kernel's kthread_t structure to a proc(4) psinfo_t 2560Sstevel@tonic-gate * struct. Lacking a facility to define one translator only in terms of 2570Sstevel@tonic-gate * another, we explicitly define each member by using the proc_t-to-psinfo_t 2580Sstevel@tonic-gate * translator, above; any members added to that translator should also be 2590Sstevel@tonic-gate * added here. (The only exception to this is pr_start, which -- due to it 2600Sstevel@tonic-gate * being a structure -- cannot be defined in terms of a translator at all.) 2610Sstevel@tonic-gate */ 2620Sstevel@tonic-gate#pragma D binding "1.0" translator 2630Sstevel@tonic-gatetranslator psinfo_t < kthread_t *T > { 2640Sstevel@tonic-gate pr_nlwp = xlate <psinfo_t> (T->t_procp).pr_nlwp; 2650Sstevel@tonic-gate pr_pid = xlate <psinfo_t> (T->t_procp).pr_pid; 2660Sstevel@tonic-gate pr_ppid = xlate <psinfo_t> (T->t_procp).pr_ppid; 2670Sstevel@tonic-gate pr_pgid = xlate <psinfo_t> (T->t_procp).pr_pgid; 2680Sstevel@tonic-gate pr_sid = xlate <psinfo_t> (T->t_procp).pr_sid; 2690Sstevel@tonic-gate pr_uid = xlate <psinfo_t> (T->t_procp).pr_uid; 2700Sstevel@tonic-gate pr_euid = xlate <psinfo_t> (T->t_procp).pr_euid; 2710Sstevel@tonic-gate pr_gid = xlate <psinfo_t> (T->t_procp).pr_gid; 2720Sstevel@tonic-gate pr_egid = xlate <psinfo_t> (T->t_procp).pr_egid; 2730Sstevel@tonic-gate pr_addr = xlate <psinfo_t> (T->t_procp).pr_addr; 2740Sstevel@tonic-gate pr_ttydev = xlate <psinfo_t> (T->t_procp).pr_ttydev; 2750Sstevel@tonic-gate pr_start = (timestruc_t)xlate <psinfo_t> (T->t_procp).pr_start; 2760Sstevel@tonic-gate pr_fname = xlate <psinfo_t> (T->t_procp).pr_fname; 2770Sstevel@tonic-gate pr_psargs = xlate <psinfo_t> (T->t_procp).pr_psargs; 2780Sstevel@tonic-gate pr_argc = xlate <psinfo_t> (T->t_procp).pr_argc; 2790Sstevel@tonic-gate pr_argv = xlate <psinfo_t> (T->t_procp).pr_argv; 2800Sstevel@tonic-gate pr_envp = xlate <psinfo_t> (T->t_procp).pr_envp; 2810Sstevel@tonic-gate pr_dmodel = xlate <psinfo_t> (T->t_procp).pr_dmodel; 2820Sstevel@tonic-gate pr_taskid = xlate <psinfo_t> (T->t_procp).pr_taskid; 2830Sstevel@tonic-gate pr_projid = xlate <psinfo_t> (T->t_procp).pr_projid; 2840Sstevel@tonic-gate pr_poolid = xlate <psinfo_t> (T->t_procp).pr_poolid; 2850Sstevel@tonic-gate pr_zoneid = xlate <psinfo_t> (T->t_procp).pr_zoneid; 286*9389SVamsi.Krishna@Sun.COM pr_contract = xlate <psinfo_t> (T->t_procp).pr_contract; 2870Sstevel@tonic-gate}; 2880Sstevel@tonic-gate 2890Sstevel@tonic-gate/* 2900Sstevel@tonic-gate * Translate from the kernel's kthread_t structure to a proc(4) lwpsinfo_t. 2910Sstevel@tonic-gate * We do not provide support for pr_nice, pr_oldpri, pr_cpu, or pr_pctcpu. 2920Sstevel@tonic-gate * Also, for the moment, pr_start and pr_time are not supported, but these 2930Sstevel@tonic-gate * could be supported by DTrace in the future using subroutines. 2940Sstevel@tonic-gate */ 2950Sstevel@tonic-gate#pragma D binding "1.0" translator 2960Sstevel@tonic-gatetranslator lwpsinfo_t < kthread_t *T > { 2970Sstevel@tonic-gate pr_flag = ((T->t_state == @TS_STOPPED@) ? (PR_STOPPED | 2980Sstevel@tonic-gate ((!(T->t_schedflag & @TS_PSTART@)) ? PR_ISTOP : 0)) : 2990Sstevel@tonic-gate ((T->t_proc_flag & @TP_PRVSTOP@) ? PR_STOPPED | PR_ISTOP : 0)) | 3000Sstevel@tonic-gate ((T == T->t_procp->p_agenttp) ? PR_AGENT : 0) | 3010Sstevel@tonic-gate ((!(T->t_proc_flag & @TP_TWAIT@)) ? PR_DETACH : 0) | 3020Sstevel@tonic-gate ((T->t_proc_flag & @TP_DAEMON@) ? PR_DAEMON : 0) | 3033235Sraf ((T->t_procp->p_pidflag & @CLDNOSIGCHLD@) ? PR_NOSIGCHLD : 0) | 3043235Sraf ((T->t_procp->p_pidflag & @CLDWAITPID@) ? PR_WAITPID : 0) | 3050Sstevel@tonic-gate ((T->t_procp->p_proc_flag & @P_PR_FORK@) ? PR_FORK : 0) | 3060Sstevel@tonic-gate ((T->t_procp->p_proc_flag & @P_PR_RUNLCL@) ? PR_RLC : 0) | 3070Sstevel@tonic-gate ((T->t_procp->p_proc_flag & @P_PR_KILLCL@) ? PR_KLC : 0) | 3080Sstevel@tonic-gate ((T->t_procp->p_proc_flag & @P_PR_ASYNC@) ? PR_ASYNC : 0) | 3090Sstevel@tonic-gate ((T->t_procp->p_proc_flag & @P_PR_BPTADJ@) ? PR_BPTADJ : 0) | 3100Sstevel@tonic-gate ((T->t_procp->p_proc_flag & @P_PR_PTRACE@) ? PR_PTRACE : 0) | 3110Sstevel@tonic-gate ((T->t_procp->p_flag & @SMSACCT@) ? PR_MSACCT : 0) | 3120Sstevel@tonic-gate ((T->t_procp->p_flag & @SMSFORK@) ? PR_MSFORK : 0) | 3130Sstevel@tonic-gate ((T->t_procp->p_flag & @SVFWAIT@) ? PR_VFORKP : 0) | 3140Sstevel@tonic-gate (((T->t_procp->p_flag & @SSYS@) || 3150Sstevel@tonic-gate (T->t_procp->p_as == &`kas)) ? PR_ISSYS : 0) | 3160Sstevel@tonic-gate ((T == T->t_cpu->cpu_idle_thread) ? PR_IDLE : 0); 3170Sstevel@tonic-gate 3180Sstevel@tonic-gate pr_lwpid = T->t_tid; 3190Sstevel@tonic-gate pr_addr = (uintptr_t)T; 3200Sstevel@tonic-gate pr_wchan = (uintptr_t)T->t_lwpchan.lc_wchan; 3210Sstevel@tonic-gate pr_stype = T->t_sobj_ops ? T->t_sobj_ops->sobj_type : 0; 3220Sstevel@tonic-gate 3230Sstevel@tonic-gate pr_state = (T->t_proc_flag & @TP_PRVSTOP@) ? SSTOP : 3240Sstevel@tonic-gate (T->t_state == @TS_SLEEP@) ? SSLEEP : 3250Sstevel@tonic-gate (T->t_state == @TS_RUN@) ? SRUN : 3260Sstevel@tonic-gate (T->t_state == @TS_ONPROC@) ? SONPROC : 3270Sstevel@tonic-gate (T->t_state == @TS_ZOMB@) ? SZOMB : 3283792Sakolb (T->t_state == @TS_STOPPED@) ? SSTOP : 3293792Sakolb (T->t_state == @TS_WAIT@) ? SWAIT : 0; 3300Sstevel@tonic-gate 3310Sstevel@tonic-gate pr_sname = (T->t_proc_flag & @TP_PRVSTOP@) ? 'T' : 3320Sstevel@tonic-gate (T->t_state == @TS_SLEEP@) ? 'S' : 3330Sstevel@tonic-gate (T->t_state == @TS_RUN@) ? 'R' : 3340Sstevel@tonic-gate (T->t_state == @TS_ONPROC@) ? 'O' : 3350Sstevel@tonic-gate (T->t_state == @TS_ZOMB@) ? 'Z' : 3363792Sakolb (T->t_state == @TS_STOPPED@) ? 'T' : 3373792Sakolb (T->t_state == @TS_WAIT@) ? 'W' : '?'; 3380Sstevel@tonic-gate 3390Sstevel@tonic-gate pr_syscall = T->t_sysnum; 3400Sstevel@tonic-gate pr_pri = T->t_pri; 3410Sstevel@tonic-gate pr_clname = `sclass[T->t_cid].cl_name; 3420Sstevel@tonic-gate pr_onpro = T->t_cpu->cpu_id; 3430Sstevel@tonic-gate pr_bindpro = T->t_bind_cpu; 3440Sstevel@tonic-gate pr_bindpset = T->t_bind_pset; 3452685Sakolb pr_lgrp = T->t_lpl->lpl_lgrpid; 3460Sstevel@tonic-gate}; 3470Sstevel@tonic-gate 3480Sstevel@tonic-gateinline psinfo_t *curpsinfo = xlate <psinfo_t *> (curthread->t_procp); 3490Sstevel@tonic-gate#pragma D attributes Stable/Stable/Common curpsinfo 3500Sstevel@tonic-gate#pragma D binding "1.0" curpsinfo 3510Sstevel@tonic-gate 3520Sstevel@tonic-gateinline lwpsinfo_t *curlwpsinfo = xlate <lwpsinfo_t *> (curthread); 3530Sstevel@tonic-gate#pragma D attributes Stable/Stable/Common curlwpsinfo 3540Sstevel@tonic-gate#pragma D binding "1.0" curlwpsinfo 3550Sstevel@tonic-gate 3560Sstevel@tonic-gateinline string cwd = curthread->t_procp->p_user.u_cdir->v_path == NULL ? 3570Sstevel@tonic-gate "<unknown>" : stringof(curthread->t_procp->p_user.u_cdir->v_path); 3580Sstevel@tonic-gate#pragma D attributes Stable/Stable/Common cwd 3590Sstevel@tonic-gate#pragma D binding "1.0" cwd 3600Sstevel@tonic-gate 3610Sstevel@tonic-gateinline string root = curthread->t_procp->p_user.u_rdir == NULL ? "/" : 3620Sstevel@tonic-gate curthread->t_procp->p_user.u_rdir->v_path == NULL ? "<unknown>" : 3630Sstevel@tonic-gate stringof(curthread->t_procp->p_user.u_rdir->v_path); 3640Sstevel@tonic-gate#pragma D attributes Stable/Stable/Common root 3650Sstevel@tonic-gate#pragma D binding "1.0" root 366