Print this page
8158 Want named threads API
9857 proc manpages should have LIBRARY section


1239             &layout->pr_brksize, SL_FMT_NUM_HEX);
1240         print_num_2up(state, MSG_ORIG(MSG_CNOTE_T_PR_STKBASE),
1241             &layout->pr_stkbase, SL_FMT_NUM_ZHEX,
1242             MSG_ORIG(MSG_CNOTE_T_PR_STKSIZE),
1243             &layout->pr_stksize, SL_FMT_NUM_HEX);
1244         PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_PROCESSOR), pr_processor);
1245 
1246         if (data_present(state, &layout->pr_bind)) {
1247                 i = extract_as_sword(state, &layout->pr_bind);
1248                 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_BIND),
1249                     conv_cnote_psetid(i, CONV_FMT_DECIMAL, &conv_buf.inv));
1250         }
1251 
1252         PRINT_ZHEX(MSG_ORIG(MSG_CNOTE_T_PR_INSTR), pr_instr);
1253         PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_REG), pr_reg, dump_prgregset);
1254 
1255         indent_exit(state);
1256 }
1257 
1258 














1259 /*
1260  * Print percent from 16-bit binary fraction [0 .. 1]
1261  * Round up .01 to .1 to indicate some small percentage (the 0x7000 below).
1262  *
1263  * Note: This routine was copied from ps(1) and then modified.
1264  */
1265 static const char *
1266 prtpct_value(note_state_t *state, const sl_field_t *fdesc,
1267     sl_fmtbuf_t buf)
1268 {
1269         uint_t value;           /* need 32 bits to compute with */
1270 
1271         value = extract_as_word(state, fdesc);
1272         value = ((value * 1000) + 0x7000) >> 15;  /* [0 .. 1000] */
1273         if (value >= 1000)
1274                 value = 999;
1275 
1276         (void) snprintf(buf, sizeof (sl_fmtbuf_t),
1277             MSG_ORIG(MSG_CNOTE_FMT_PRTPCT), value / 10, value % 10);
1278 


1892         case NT_FDINFO:
1893                 state.ns_vcol = 22;
1894                 state.ns_t2col = 41;
1895                 state.ns_v2col = 54;
1896                 dump_prfdinfo(&state, MSG_ORIG(MSG_CNOTE_DESC_PRFDINFO_T));
1897                 return (CORENOTE_R_OK);
1898 
1899         case NT_SPYMASTER:
1900                 state.ns_vcol = 25;
1901                 state.ns_t2col = 45;
1902                 state.ns_v2col = 58;
1903                 dump_psinfo(&state, MSG_ORIG(MSG_CNOTE_DESC_PSINFO_T));
1904                 return (CORENOTE_R_OK);
1905 
1906         case NT_SECFLAGS:
1907                 state.ns_vcol = 23;
1908                 state.ns_t2col = 41;
1909                 state.ns_v2col = 54;
1910                 dump_secflags(&state, MSG_ORIG(MSG_CNOTE_DESC_PRSECFLAGS_T));
1911                 return (CORENOTE_R_OK);





1912         }
1913 
1914         return (CORENOTE_R_BADTYPE);
1915 }


1239             &layout->pr_brksize, SL_FMT_NUM_HEX);
1240         print_num_2up(state, MSG_ORIG(MSG_CNOTE_T_PR_STKBASE),
1241             &layout->pr_stkbase, SL_FMT_NUM_ZHEX,
1242             MSG_ORIG(MSG_CNOTE_T_PR_STKSIZE),
1243             &layout->pr_stksize, SL_FMT_NUM_HEX);
1244         PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_PROCESSOR), pr_processor);
1245 
1246         if (data_present(state, &layout->pr_bind)) {
1247                 i = extract_as_sword(state, &layout->pr_bind);
1248                 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_BIND),
1249                     conv_cnote_psetid(i, CONV_FMT_DECIMAL, &conv_buf.inv));
1250         }
1251 
1252         PRINT_ZHEX(MSG_ORIG(MSG_CNOTE_T_PR_INSTR), pr_instr);
1253         PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_REG), pr_reg, dump_prgregset);
1254 
1255         indent_exit(state);
1256 }
1257 
1258 
1259 static void
1260 dump_lwpname(note_state_t *state, const char *title)
1261 {
1262         const sl_prlwpname_layout_t *layout = state->ns_arch->prlwpname;
1263 
1264         indent_enter(state, title, &layout->pr_lwpid);
1265 
1266         PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_LWPID), pr_lwpid);
1267         PRINT_STRBUF(MSG_ORIG(MSG_CNOTE_T_PR_LWPNAME), pr_lwpname);
1268 
1269         indent_exit(state);
1270 }
1271 
1272 
1273 /*
1274  * Print percent from 16-bit binary fraction [0 .. 1]
1275  * Round up .01 to .1 to indicate some small percentage (the 0x7000 below).
1276  *
1277  * Note: This routine was copied from ps(1) and then modified.
1278  */
1279 static const char *
1280 prtpct_value(note_state_t *state, const sl_field_t *fdesc,
1281     sl_fmtbuf_t buf)
1282 {
1283         uint_t value;           /* need 32 bits to compute with */
1284 
1285         value = extract_as_word(state, fdesc);
1286         value = ((value * 1000) + 0x7000) >> 15;  /* [0 .. 1000] */
1287         if (value >= 1000)
1288                 value = 999;
1289 
1290         (void) snprintf(buf, sizeof (sl_fmtbuf_t),
1291             MSG_ORIG(MSG_CNOTE_FMT_PRTPCT), value / 10, value % 10);
1292 


1906         case NT_FDINFO:
1907                 state.ns_vcol = 22;
1908                 state.ns_t2col = 41;
1909                 state.ns_v2col = 54;
1910                 dump_prfdinfo(&state, MSG_ORIG(MSG_CNOTE_DESC_PRFDINFO_T));
1911                 return (CORENOTE_R_OK);
1912 
1913         case NT_SPYMASTER:
1914                 state.ns_vcol = 25;
1915                 state.ns_t2col = 45;
1916                 state.ns_v2col = 58;
1917                 dump_psinfo(&state, MSG_ORIG(MSG_CNOTE_DESC_PSINFO_T));
1918                 return (CORENOTE_R_OK);
1919 
1920         case NT_SECFLAGS:
1921                 state.ns_vcol = 23;
1922                 state.ns_t2col = 41;
1923                 state.ns_v2col = 54;
1924                 dump_secflags(&state, MSG_ORIG(MSG_CNOTE_DESC_PRSECFLAGS_T));
1925                 return (CORENOTE_R_OK);
1926 
1927         case NT_LWPNAME:
1928                 state.ns_vcol = 20;
1929                 dump_lwpname(&state, MSG_ORIG(MSG_CNOTE_DESC_PRLWPNAME_T));
1930                 return (CORENOTE_R_OK);
1931         }
1932 
1933         return (CORENOTE_R_BADTYPE);
1934 }