Print this page
7029 want per-process exploit mitigation features (secflags)
7030 want basic address space layout randomization (aslr)
7031 noexec_user_stack should be a secflag
7032 want a means to forbid mappings around NULL.
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/cmd/sgs/elfdump/common/corenote.c
+++ new/usr/src/cmd/sgs/elfdump/common/corenote.c
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21
22 22 /*
23 23 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
24 24 * Use is subject to license terms.
25 25 */
26 26 /*
↓ open down ↓ |
26 lines elided |
↑ open up ↑ |
27 27 * Copyright 2012 DEY Storage Systems, Inc. All rights reserved.
28 28 * Copyright (c) 2013, Joyent, Inc. All rights reserved.
29 29 */
30 30
31 31 #include <stdlib.h>
32 32 #include <stdio.h>
33 33 #include <string.h>
34 34 #include <sys/types.h>
35 35 #include <unistd.h>
36 36 #include <sys/corectl.h>
37 +#include <procfs.h>
37 38 #include <msg.h>
38 39 #include <_elfdump.h>
39 40 #include <struct_layout.h>
40 41 #include <conv.h>
41 42
42 43
43 44 /*
44 45 * This module contains the code that displays data from the note
45 46 * sections found in Solaris core files. The format of these
46 47 * note sections are described in the core(4) manpage.
47 48 */
48 49
49 50
50 51
51 52
52 53 /*
53 54 * Much of the code in this file uses the "%*s" format to set
54 55 * the left margin indentation. This macro combines the indent
55 56 * integer argument and the NULL string that follows it.
56 57 */
57 58 #define INDENT state->ns_indent, MSG_ORIG(MSG_STR_EMPTY)
58 59
59 60 /*
60 61 * Indent unit, used for each nesting
61 62 */
62 63 #define INDENT_STEP 4
63 64
64 65 /*
65 66 * The PRINT_ macros are convenience wrappers on print_num(),
66 67 * print_subtype(), and print_strbuf(). They reduce code
67 68 * clutter by hiding the boilerplate arguments.
68 69 *
69 70 * Assumptions:
70 71 * - A variable named "layout" exists in the compilation
71 72 * environment, referencing the layout information for the
72 73 * current type.
73 74 * - The variable "state" references the current note state.
74 75 */
75 76 #define PRINT_DEC(_title, _field) \
76 77 print_num(state, _title, &layout->_field, SL_FMT_NUM_DEC)
77 78 #define PRINT_DEC_2UP(_title1, _field1, _title2, _field2) \
78 79 print_num_2up(state, _title1, &layout->_field1, SL_FMT_NUM_DEC, \
79 80 _title2, &layout->_field2, SL_FMT_NUM_DEC)
80 81 #define PRINT_HEX(_title, _field) \
81 82 print_num(state, _title, &layout->_field, SL_FMT_NUM_HEX)
82 83 #define PRINT_HEX_2UP(_title1, _field1, _title2, _field2) \
83 84 print_num_2up(state, _title1, &layout->_field1, SL_FMT_NUM_HEX, \
84 85 _title2, &layout->_field2, SL_FMT_NUM_HEX)
85 86 #define PRINT_ZHEX(_title, _field) \
86 87 print_num(state, _title, &layout->_field, SL_FMT_NUM_ZHEX)
87 88 #define PRINT_ZHEX_2UP(_title1, _field1, _title2, _field2) \
88 89 print_num_2up(state, _title1, &layout->_field1, SL_FMT_NUM_ZHEX, \
89 90 _title2, &layout->_field2, SL_FMT_NUM_ZHEX)
90 91 #define PRINT_SUBTYPE(_title, _field, _func) \
91 92 print_subtype(state, _title, &layout->_field, _func)
92 93 #define PRINT_STRBUF(_title, _field) \
93 94 print_strbuf(state, _title, &layout->_field)
94 95
95 96
96 97
97 98 /*
98 99 * Structure used to maintain state data for a core note, or a subregion
99 100 * (sub-struct) of a core note. These values would otherwise need to be
100 101 * passed to nearly every routine.
101 102 */
102 103 typedef struct {
103 104 Half ns_mach; /* ELF machine type of core file */
104 105 const sl_arch_layout_t *ns_arch; /* structure layout def for mach */
105 106 int ns_swap; /* True if byte swapping is needed */
106 107 int ns_indent; /* Left margin indentation */
107 108 int ns_vcol; /* Column where value starts */
108 109 int ns_t2col; /* Column where 2up title starts */
109 110 int ns_v2col; /* Column where 2up value starts */
110 111 const char *ns_data; /* Pointer to struct data area */
111 112 Word ns_len; /* Length of struct data area */
112 113 } note_state_t;
113 114
114 115 /*
115 116 * Standard signature for a dump function used to process a note
116 117 * or a sub-structure within a note.
117 118 */
118 119 typedef void (* dump_func_t)(note_state_t *state, const char *title);
119 120
120 121
121 122
122 123
123 124
124 125
125 126 /*
126 127 * Some core notes contain string buffers of fixed size
127 128 * that are expected to contain NULL terminated strings.
128 129 * If the NULL is there, we can print these strings directly.
129 130 * However, the potential exists for a corrupt file to have
130 131 * a non-terminated buffer. This routine examines the given
131 132 * string, and if the string is terminated, the string itself
132 133 * is returned. Otherwise, it is copied to a static buffer,
133 134 * and a pointer to the buffer is returned.
134 135 */
135 136 static const char *
136 137 safe_str(const char *str, size_t n)
137 138 {
138 139 static char buf[512];
139 140 char *s;
140 141 size_t i;
141 142
142 143 if (n == 0)
143 144 return (MSG_ORIG(MSG_STR_EMPTY));
144 145
145 146 for (i = 0; i < n; i++)
146 147 if (str[i] == '\0')
147 148 return (str);
148 149
149 150 i = (n >= sizeof (buf)) ? (sizeof (buf) - 4) : (n - 1);
150 151 (void) memcpy(buf, str, i);
151 152 s = buf + i;
152 153 if (n >= sizeof (buf)) {
153 154 *s++ = '.';
154 155 *s++ = '.';
155 156 *s++ = '.';
156 157 }
157 158 *s = '\0';
158 159 return (buf);
↓ open down ↓ |
112 lines elided |
↑ open up ↑ |
159 160 }
160 161
161 162 /*
162 163 * Convenience wrappers on top of the corresponding sl_XXX() functions.
163 164 */
164 165 static Word
165 166 extract_as_word(note_state_t *state, const sl_field_t *fdesc)
166 167 {
167 168 return (sl_extract_as_word(state->ns_data, state->ns_swap, fdesc));
168 169 }
169 -static Word
170 +static Lword
170 171 extract_as_lword(note_state_t *state, const sl_field_t *fdesc)
171 172 {
172 173 return (sl_extract_as_lword(state->ns_data, state->ns_swap, fdesc));
173 174 }
174 175 static int
175 176 extract_as_sword(note_state_t *state, const sl_field_t *fdesc)
176 177 {
177 178 return (sl_extract_as_sword(state->ns_data, state->ns_swap, fdesc));
178 179 }
179 180 static const char *
180 181 fmt_num(note_state_t *state, const sl_field_t *fdesc,
181 182 sl_fmt_num_t fmt_type, sl_fmtbuf_t buf)
182 183 {
183 184 return (sl_fmt_num(state->ns_data, state->ns_swap, fdesc,
184 185 fmt_type, buf));
185 186 }
186 187
187 188
188 189 /*
189 190 * Return true of the data for the specified field is available.
190 191 */
191 192 inline static int
192 193 data_present(note_state_t *state, const sl_field_t *fdesc)
193 194 {
194 195 return ((fdesc->slf_offset + fdesc->slf_eltlen) <= state->ns_len);
195 196 }
196 197
197 198 /*
198 199 * indent_enter/exit are used to start/end output for a subitem.
199 200 * On entry, a title is output, and the indentation level is raised
200 201 * by one unit. On exit, the indentation level is restrored to its
201 202 * previous value.
202 203 */
203 204 static void
204 205 indent_enter(note_state_t *state, const char *title,
205 206 const sl_field_t *first_fdesc)
206 207 {
207 208 /*
208 209 * If the first field offset and extent fall past the end of the
209 210 * available data, then return without printing a title. That note
210 211 * is from an older core file that doesn't have all the fields
211 212 * that we know about.
212 213 */
213 214 if (data_present(state, first_fdesc))
214 215 dbg_print(0, MSG_ORIG(MSG_CNOTE_FMT_TITLE), INDENT, title);
215 216
216 217 state->ns_indent += INDENT_STEP;
217 218 }
218 219 static void
219 220 indent_exit(note_state_t *state)
220 221 {
221 222 state->ns_indent -= INDENT_STEP;
222 223 }
223 224
224 225
225 226 /*
226 227 * print_num outputs a field on one line, in the format:
227 228 *
228 229 * title: value
229 230 */
230 231 static void
231 232 print_num(note_state_t *state, const char *title,
232 233 const sl_field_t *fdesc, sl_fmt_num_t fmt_type)
233 234 {
234 235 sl_fmtbuf_t buf;
235 236
236 237 /*
237 238 * If the field offset and extent fall past the end of the
238 239 * available data, then return without doing anything. That note
239 240 * is from an older core file that doesn't have all the fields
240 241 * that we know about.
241 242 */
242 243 if (!data_present(state, fdesc))
243 244 return;
244 245
245 246 dbg_print(0, MSG_ORIG(MSG_CNOTE_FMT_LINE), INDENT,
246 247 state->ns_vcol - state->ns_indent, title,
247 248 fmt_num(state, fdesc, fmt_type, buf));
248 249 }
249 250
250 251 /*
251 252 * print_num_2up outputs two fields on one line, in the format:
252 253 *
253 254 * title1: value1 title2: value2
254 255 */
255 256 static void
256 257 print_num_2up(note_state_t *state, const char *title1,
257 258 const sl_field_t *fdesc1, sl_fmt_num_t fmt_type1, const char *title2,
258 259 const sl_field_t *fdesc2, sl_fmt_num_t fmt_type2)
259 260 {
260 261 sl_fmtbuf_t buf1, buf2;
261 262
262 263 /*
263 264 * If the field offset and extent fall past the end of the
264 265 * available data, then return without doing anything. That note
265 266 * is from an older core file that doesn't have all the fields
266 267 * that we know about.
267 268 */
268 269 if (!(data_present(state, fdesc1) &&
269 270 data_present(state, fdesc2)))
270 271 return;
271 272
272 273 dbg_print(0, MSG_ORIG(MSG_CNOTE_FMT_LINE_2UP), INDENT,
273 274 state->ns_vcol - state->ns_indent, title1,
274 275 state->ns_t2col - state->ns_vcol,
275 276 fmt_num(state, fdesc1, fmt_type1, buf1),
276 277 state->ns_v2col - state->ns_t2col, title2,
277 278 fmt_num(state, fdesc2, fmt_type2, buf2));
278 279 }
279 280
280 281 /*
281 282 * print_strbuf outputs a fixed sized character buffer field
282 283 * on one line, in the format:
283 284 *
284 285 * title: value
285 286 */
286 287 static void
287 288 print_strbuf(note_state_t *state, const char *title,
288 289 const sl_field_t *fdesc)
289 290 {
290 291 Word n;
291 292
292 293 /*
293 294 * If we are past the end of the data area, then return
294 295 * without doing anything. That note is from an older core
295 296 * file that doesn't have all the fields that we know about.
296 297 *
297 298 * Note that we are willing to accept a partial buffer,
298 299 * so we don't use data_present() for this test.
299 300 */
300 301 if (fdesc->slf_offset >= state->ns_len)
301 302 return;
302 303
303 304 /*
304 305 * We expect the full buffer to be present, but if there
305 306 * is less than that, we will still proceed. The use of safe_str()
306 307 * protects us from the effect of printing garbage data.
307 308 */
308 309 n = state->ns_len - fdesc->slf_offset;
309 310 if (n > fdesc->slf_nelts)
310 311 n = fdesc->slf_nelts;
311 312
312 313 dbg_print(0, MSG_ORIG(MSG_CNOTE_FMT_LINE), INDENT,
313 314 state->ns_vcol - state->ns_indent,
314 315 title, safe_str(fdesc->slf_offset + state->ns_data, n));
315 316 }
316 317
317 318 /*
318 319 * print_str outputs an arbitrary string value item
319 320 * on one line, in the format:
320 321 *
321 322 * title: str
322 323 */
323 324 static void
324 325 print_str(note_state_t *state, const char *title, const char *str)
325 326 {
326 327 dbg_print(0, MSG_ORIG(MSG_CNOTE_FMT_LINE), INDENT,
327 328 state->ns_vcol - state->ns_indent, title, str);
328 329 }
329 330
330 331 /*
331 332 * Used when one dump function needs to call another dump function
332 333 * in order to display a subitem. This routine constructs a state
333 334 * block for the sub-region, and then calls the dump function with it.
334 335 * This limits the amount of data visible to the sub-function to that
335 336 * for the sub-item.
336 337 */
337 338 static void
338 339 print_subtype(note_state_t *state, const char *title,
339 340 const sl_field_t *fdesc, dump_func_t dump_func)
340 341 {
341 342 note_state_t sub_state;
342 343
343 344 /*
344 345 * If there is no data for the sub-item, return immediately.
345 346 * Partial data is left to the dump function to handle,
346 347 * as that can be a sign of an older core file with less data,
347 348 * which can still be interpreted.
348 349 */
349 350 if (fdesc->slf_offset >= state->ns_len)
350 351 return;
351 352
352 353 /*
353 354 * Construct a state block that reflects the sub-item
354 355 */
355 356 sub_state = *state;
356 357 sub_state.ns_data += fdesc->slf_offset;
357 358 sub_state.ns_len -= fdesc->slf_offset;
358 359 if (sub_state.ns_len > fdesc->slf_eltlen)
359 360 sub_state.ns_len = fdesc->slf_eltlen;
360 361
361 362 (* dump_func)(&sub_state, title);
362 363 }
363 364
364 365
365 366 /*
366 367 * Output a sequence of array elements, giving each
367 368 * element an index, in the format:
368 369 *
369 370 * [ndx] value
370 371 *
371 372 * entry:
372 373 * state - Current state
373 374 * base_desc - Field descriptor for 1st element of array
374 375 * nelts - # of array elements to display
375 376 * check_nelts - If True (1), nelts is clipped to fdesc->slf_nelts.
376 377 * If False (1), nelts is not clipped.
377 378 * title - Name of array
378 379 */
379 380 static void
380 381 print_array(note_state_t *state, const sl_field_t *base_desc,
381 382 sl_fmt_num_t fmt_type, int nelts, int check_nelts, const char *title)
382 383 {
383 384 char index1[MAXNDXSIZE], index2[MAXNDXSIZE];
384 385 int i;
385 386 sl_field_t fdesc1, fdesc2;
386 387
387 388 if (check_nelts && (check_nelts > base_desc->slf_nelts))
388 389 nelts = base_desc->slf_nelts;
389 390 if (nelts == 0)
390 391 return;
391 392
392 393 indent_enter(state, title, base_desc);
393 394
394 395 fdesc1 = fdesc2 = *base_desc;
395 396 for (i = 0; i < nelts; ) {
396 397 if (i == (nelts - 1)) {
397 398 /* One final value is left */
398 399 if (!data_present(state, &fdesc1))
399 400 break;
400 401 (void) snprintf(index1, sizeof (index1),
401 402 MSG_ORIG(MSG_FMT_INDEX2), EC_WORD(i));
402 403 print_num(state, index1, &fdesc1, fmt_type);
403 404 fdesc1.slf_offset += fdesc1.slf_eltlen;
404 405 i++;
405 406 continue;
406 407 }
407 408
408 409 /* There are at least 2 items left. Show 2 up. */
409 410 fdesc2.slf_offset = fdesc1.slf_offset + fdesc1.slf_eltlen;
410 411 if (!(data_present(state, &fdesc1) &&
411 412 data_present(state, &fdesc2)))
412 413 break;
413 414 (void) snprintf(index1, sizeof (index1),
414 415 MSG_ORIG(MSG_FMT_INDEX2), EC_WORD(i));
415 416 (void) snprintf(index2, sizeof (index2),
416 417 MSG_ORIG(MSG_FMT_INDEX2), EC_WORD(i + 1));
417 418 print_num_2up(state, index1, &fdesc1, fmt_type,
418 419 index2, &fdesc2, fmt_type);
419 420 fdesc1.slf_offset += 2 * fdesc1.slf_eltlen;
420 421 i += 2;
421 422 }
422 423
423 424 indent_exit(state);
424 425 }
425 426
426 427
427 428 /*
428 429 * Output information from auxv_t structure.
↓ open down ↓ |
249 lines elided |
↑ open up ↑ |
429 430 */
430 431 static void
431 432 dump_auxv(note_state_t *state, const char *title)
432 433 {
433 434 const sl_auxv_layout_t *layout = state->ns_arch->auxv;
434 435 union {
435 436 Conv_cap_val_hw1_buf_t hw1;
436 437 Conv_cap_val_hw2_buf_t hw2;
437 438 Conv_cnote_auxv_af_buf_t auxv_af;
438 439 Conv_ehdr_flags_buf_t ehdr_flags;
440 + Conv_secflags_buf_t secflags;
439 441 Conv_inv_buf_t inv;
440 442 } conv_buf;
441 443 sl_fmtbuf_t buf;
442 444 int ndx, ndx_start;
443 445 Word sizeof_auxv;
444 446
445 447 sizeof_auxv = layout->sizeof_struct.slf_eltlen;
446 448
447 449 indent_enter(state, title, &layout->sizeof_struct);
448 450
449 451 /*
450 452 * Immediate indent_exit() restores the indent level to
451 453 * that of the title. We include indentation as part of
452 454 * the index string, which is right justified, and don't
453 455 * want the usual indentation spacing.
454 456 */
455 457 indent_exit(state);
456 458
457 459 ndx = 0;
458 460 while (state->ns_len > sizeof_auxv) {
459 461 char index[(MAXNDXSIZE * 2) + 1];
460 462 sl_fmt_num_t num_fmt = SL_FMT_NUM_ZHEX;
461 463 const char *vstr = NULL;
462 464 Word w;
463 465 int type;
464 466 sl_field_t a_type_next;
465 467
466 468 type = extract_as_word(state, &layout->a_type);
467 469 ndx_start = ndx;
468 470 switch (type) {
469 471 case AT_NULL:
470 472 a_type_next = layout->a_type;
471 473 a_type_next.slf_offset += sizeof_auxv;
472 474 while ((state->ns_len - sizeof_auxv) >= sizeof_auxv) {
473 475 type = extract_as_word(state, &a_type_next);
474 476 if (type != AT_NULL)
475 477 break;
476 478 ndx++;
477 479 state->ns_data += sizeof_auxv;
478 480 state->ns_len -= sizeof_auxv;
479 481 }
480 482 num_fmt = SL_FMT_NUM_HEX;
481 483 break;
482 484
483 485
484 486
485 487 case AT_IGNORE:
486 488 case AT_SUN_IFLUSH:
487 489 num_fmt = SL_FMT_NUM_HEX;
488 490 break;
489 491
490 492 case AT_EXECFD:
491 493 case AT_PHENT:
492 494 case AT_PHNUM:
493 495 case AT_PAGESZ:
494 496 case AT_SUN_UID:
495 497 case AT_SUN_RUID:
496 498 case AT_SUN_GID:
497 499 case AT_SUN_RGID:
498 500 case AT_SUN_LPAGESZ:
499 501 num_fmt = SL_FMT_NUM_DEC;
500 502 break;
501 503
502 504 case AT_FLAGS: /* processor flags */
503 505 w = extract_as_word(state, &layout->a_val);
504 506 vstr = conv_ehdr_flags(state->ns_mach, w,
505 507 0, &conv_buf.ehdr_flags);
506 508 break;
507 509
508 510 case AT_SUN_HWCAP:
509 511 w = extract_as_word(state, &layout->a_val);
510 512 vstr = conv_cap_val_hw1(w, state->ns_mach,
511 513 0, &conv_buf.hw1);
512 514 /*
513 515 * conv_cap_val_hw1() produces output like:
514 516 *
515 517 * 0xfff [ flg1 flg2 0xff]
516 518 *
517 519 * where the first hex value is the complete value,
518 520 * and the second is the leftover bits. We only
519 521 * want the part in brackets, and failing that,
520 522 * would rather fall back to formatting the full
521 523 * value ourselves.
522 524 */
523 525 while ((*vstr != '\0') && (*vstr != '['))
524 526 vstr++;
525 527 if (*vstr != '[')
526 528 vstr = NULL;
527 529 num_fmt = SL_FMT_NUM_HEX;
528 530 break;
529 531 case AT_SUN_HWCAP2:
530 532 w = extract_as_word(state, &layout->a_val);
531 533 vstr = conv_cap_val_hw2(w, state->ns_mach,
532 534 0, &conv_buf.hw2);
533 535 /*
534 536 * conv_cap_val_hw2() produces output like:
535 537 *
536 538 * 0xfff [ flg1 flg2 0xff]
537 539 *
538 540 * where the first hex value is the complete value,
539 541 * and the second is the leftover bits. We only
540 542 * want the part in brackets, and failing that,
541 543 * would rather fall back to formatting the full
542 544 * value ourselves.
543 545 */
544 546 while ((*vstr != '\0') && (*vstr != '['))
545 547 vstr++;
546 548 if (*vstr != '[')
547 549 vstr = NULL;
548 550 num_fmt = SL_FMT_NUM_HEX;
549 551 break;
550 552
551 553
552 554
553 555 case AT_SUN_AUXFLAGS:
554 556 w = extract_as_word(state, &layout->a_val);
555 557 vstr = conv_cnote_auxv_af(w, 0, &conv_buf.auxv_af);
556 558 num_fmt = SL_FMT_NUM_HEX;
557 559 break;
558 560 }
559 561
560 562 if (ndx == ndx_start)
561 563 (void) snprintf(index, sizeof (index),
562 564 MSG_ORIG(MSG_FMT_INDEX2), EC_WORD(ndx));
563 565 else
564 566 (void) snprintf(index, sizeof (index),
565 567 MSG_ORIG(MSG_FMT_INDEXRNG),
566 568 EC_WORD(ndx_start), EC_WORD(ndx));
567 569
568 570 if (vstr == NULL)
569 571 vstr = fmt_num(state, &layout->a_val, num_fmt, buf);
570 572 dbg_print(0, MSG_ORIG(MSG_CNOTE_FMT_AUXVLINE), INDENT, index,
571 573 state->ns_vcol - state->ns_indent,
572 574 conv_cnote_auxv_type(type, CONV_FMT_DECIMAL,
573 575 &conv_buf.inv), vstr);
574 576
575 577 state->ns_data += sizeof_auxv;
576 578 state->ns_len -= sizeof_auxv;
577 579 ndx++;
578 580 }
579 581 }
580 582
581 583
582 584 /*
583 585 * Output information from fltset_t structure.
584 586 */
585 587 static void
586 588 dump_fltset(note_state_t *state, const char *title)
587 589 {
588 590 #define NELTS 4
589 591
590 592 const sl_fltset_layout_t *layout = state->ns_arch->fltset;
591 593 Conv_cnote_fltset_buf_t buf;
592 594 sl_field_t fdesc;
593 595 uint32_t mask[NELTS];
594 596 int i, nelts;
595 597
596 598 if (!data_present(state, &layout->sizeof_struct))
597 599 return;
598 600
599 601 fdesc = layout->word;
600 602 nelts = fdesc.slf_nelts;
601 603 if (nelts > NELTS) /* Type has grown? Show what we understand */
602 604 nelts = NELTS;
603 605 for (i = 0; i < nelts; i++) {
604 606 mask[i] = extract_as_word(state, &fdesc);
605 607 fdesc.slf_offset += fdesc.slf_eltlen;
606 608 }
607 609
608 610 print_str(state, title, conv_cnote_fltset(mask, nelts, 0, &buf));
609 611
610 612 #undef NELTS
611 613 }
612 614
613 615
614 616 /*
615 617 * Output information from sigset_t structure.
616 618 */
617 619 static void
618 620 dump_sigset(note_state_t *state, const char *title)
619 621 {
620 622 #define NELTS 4
621 623
622 624 const sl_sigset_layout_t *layout = state->ns_arch->sigset;
623 625 Conv_cnote_sigset_buf_t buf;
624 626 sl_field_t fdesc;
625 627 uint32_t mask[NELTS];
626 628 int i, nelts;
627 629
628 630 if (!data_present(state, &layout->sizeof_struct))
629 631 return;
630 632
631 633 fdesc = layout->sigbits;
632 634 nelts = fdesc.slf_nelts;
633 635 if (nelts > NELTS) /* Type has grown? Show what we understand */
634 636 nelts = NELTS;
635 637 for (i = 0; i < nelts; i++) {
636 638 mask[i] = extract_as_word(state, &fdesc);
637 639 fdesc.slf_offset += fdesc.slf_eltlen;
638 640 }
639 641
640 642 print_str(state, title, conv_cnote_sigset(mask, nelts, 0, &buf));
641 643
642 644 #undef NELTS
643 645 }
644 646
645 647
646 648 /*
647 649 * Output information from sigaction structure.
648 650 */
649 651 static void
650 652 dump_sigaction(note_state_t *state, const char *title)
651 653 {
652 654 const sl_sigaction_layout_t *layout = state->ns_arch->sigaction;
653 655 Conv_cnote_sa_flags_buf_t conv_buf;
654 656 Word w;
655 657
656 658 indent_enter(state, title, &layout->sa_flags);
657 659
658 660 if (data_present(state, &layout->sa_flags)) {
659 661 w = extract_as_word(state, &layout->sa_flags);
660 662 print_str(state, MSG_ORIG(MSG_CNOTE_T_SA_FLAGS),
661 663 conv_cnote_sa_flags(w, 0, &conv_buf));
662 664 }
663 665
664 666 PRINT_ZHEX_2UP(MSG_ORIG(MSG_CNOTE_T_SA_HANDLER), sa_hand,
665 667 MSG_ORIG(MSG_CNOTE_T_SA_SIGACTION), sa_sigact);
666 668 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_SA_MASK), sa_mask, dump_sigset);
667 669
668 670 indent_exit(state);
669 671 }
670 672
671 673
672 674 /*
673 675 * Output information from siginfo structure.
674 676 */
675 677 static void
676 678 dump_siginfo(note_state_t *state, const char *title)
677 679 {
678 680 const sl_siginfo_layout_t *layout = state->ns_arch->siginfo;
679 681 Conv_inv_buf_t inv_buf;
680 682 Word w;
681 683 int v_si_code, v_si_signo;
682 684
683 685 if (!data_present(state, &layout->sizeof_struct))
684 686 return;
685 687
686 688 indent_enter(state, title, &layout->f_si_signo);
687 689
688 690 v_si_signo = extract_as_sword(state, &layout->f_si_signo);
689 691 print_str(state, MSG_ORIG(MSG_CNOTE_T_SI_SIGNO),
690 692 conv_cnote_signal(v_si_signo, CONV_FMT_DECIMAL, &inv_buf));
691 693
692 694 w = extract_as_word(state, &layout->f_si_errno);
693 695 print_str(state, MSG_ORIG(MSG_CNOTE_T_SI_ERRNO),
694 696 conv_cnote_errno(w, CONV_FMT_DECIMAL, &inv_buf));
695 697
696 698 v_si_code = extract_as_sword(state, &layout->f_si_code);
697 699 print_str(state, MSG_ORIG(MSG_CNOTE_T_SI_CODE),
698 700 conv_cnote_si_code(state->ns_mach, v_si_signo, v_si_code,
699 701 CONV_FMT_DECIMAL, &inv_buf));
700 702
701 703 if ((v_si_signo == 0) || (v_si_code == SI_NOINFO)) {
702 704 indent_exit(state);
703 705 return;
704 706 }
705 707
706 708 /* User generated signals have (si_code <= 0) */
707 709 if (v_si_code <= 0) {
708 710 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_SI_PID), f_si_pid);
709 711 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_SI_UID), f_si_uid);
710 712 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_SI_CTID), f_si_ctid);
711 713 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_SI_ZONEID), f_si_zoneid);
712 714 switch (v_si_code) {
713 715 case SI_QUEUE:
714 716 case SI_TIMER:
715 717 case SI_ASYNCIO:
716 718 case SI_MESGQ:
717 719 indent_enter(state, MSG_ORIG(MSG_CNOTE_T_SI_VALUE),
718 720 &layout->f_si_value_int);
719 721 PRINT_ZHEX(MSG_ORIG(MSG_CNOTE_T_SIVAL_INT),
720 722 f_si_value_int);
721 723 PRINT_ZHEX(MSG_ORIG(MSG_CNOTE_T_SIVAL_PTR),
722 724 f_si_value_ptr);
723 725 indent_exit(state);
724 726 break;
725 727 }
726 728 indent_exit(state);
727 729 return;
728 730 }
729 731
730 732 /*
731 733 * Remaining cases are kernel generated signals. Output any
732 734 * signal or code specific information.
733 735 */
734 736 if (v_si_code == SI_RCTL)
735 737 PRINT_HEX(MSG_ORIG(MSG_CNOTE_T_SI_ENTITY), f_si_entity);
736 738 switch (v_si_signo) {
737 739 case SIGILL:
738 740 case SIGFPE:
739 741 case SIGSEGV:
740 742 case SIGBUS:
741 743 PRINT_ZHEX(MSG_ORIG(MSG_CNOTE_T_SI_ADDR), f_si_addr);
742 744 break;
743 745 case SIGCHLD:
744 746 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_SI_PID), f_si_pid);
745 747 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_SI_STATUS), f_si_status);
746 748 break;
747 749 case SIGPOLL:
748 750 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_SI_BAND), f_si_band);
749 751 break;
750 752 }
751 753
752 754 indent_exit(state);
753 755 }
754 756
755 757
756 758 /*
757 759 * Output information from stack_t structure.
758 760 */
759 761 static void
760 762 dump_stack(note_state_t *state, const char *title)
761 763 {
762 764 const sl_stack_layout_t *layout = state->ns_arch->stack;
763 765 Conv_cnote_ss_flags_buf_t conv_buf;
764 766 Word w;
765 767
766 768 indent_enter(state, title, &layout->ss_size);
767 769
768 770 print_num_2up(state, MSG_ORIG(MSG_CNOTE_T_SS_SP), &layout->ss_sp,
769 771 SL_FMT_NUM_ZHEX, MSG_ORIG(MSG_CNOTE_T_SS_SIZE), &layout->ss_size,
770 772 SL_FMT_NUM_HEX);
771 773
772 774 if (data_present(state, &layout->ss_flags)) {
773 775 w = extract_as_word(state, &layout->ss_flags);
774 776 print_str(state, MSG_ORIG(MSG_CNOTE_T_SS_FLAGS),
775 777 conv_cnote_ss_flags(w, 0, &conv_buf));
776 778 }
777 779
778 780 indent_exit(state);
779 781 }
780 782
781 783
782 784 /*
783 785 * Output information from sysset_t structure.
784 786 */
785 787 static void
786 788 dump_sysset(note_state_t *state, const char *title)
787 789 {
788 790 #define NELTS 16
789 791
790 792 const sl_sysset_layout_t *layout = state->ns_arch->sysset;
791 793 Conv_cnote_sysset_buf_t buf;
792 794 sl_field_t fdesc;
793 795 uint32_t mask[NELTS];
794 796 int i, nelts;
795 797
796 798 if (!data_present(state, &layout->sizeof_struct))
797 799 return;
798 800
799 801 fdesc = layout->word;
800 802 nelts = fdesc.slf_nelts;
801 803 if (nelts > NELTS) /* Type has grown? Show what we understand */
802 804 nelts = NELTS;
803 805 for (i = 0; i < nelts; i++) {
804 806 mask[i] = extract_as_word(state, &fdesc);
805 807 fdesc.slf_offset += fdesc.slf_eltlen;
806 808 }
807 809
808 810 print_str(state, title, conv_cnote_sysset(mask, nelts, 0, &buf));
809 811
810 812 #undef NELTS
811 813 }
812 814
813 815
814 816 /*
815 817 * Output information from timestruc_t structure.
816 818 */
817 819 static void
818 820 dump_timestruc(note_state_t *state, const char *title)
819 821 {
↓ open down ↓ |
371 lines elided |
↑ open up ↑ |
820 822 const sl_timestruc_layout_t *layout = state->ns_arch->timestruc;
821 823
822 824 indent_enter(state, title, &layout->tv_sec);
823 825
824 826 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_TV_SEC), tv_sec,
825 827 MSG_ORIG(MSG_CNOTE_T_TV_NSEC), tv_nsec);
826 828
827 829 indent_exit(state);
828 830 }
829 831
832 +/*
833 + * Output information from prsecflags_t structure.
834 + */
835 +static void
836 +dump_secflags(note_state_t *state, const char *title)
837 +{
838 + const sl_prsecflags_layout_t *layout = state->ns_arch->prsecflags;
839 + Conv_secflags_buf_t inv;
840 + Word w;
841 +
842 + indent_enter(state, title, &layout->pr_version);
843 +
844 + w = extract_as_word(state, &layout->pr_version);
845 +
846 + if (w != PRSECFLAGS_VERSION_1) {
847 + PRINT_DEC(MSG_INTL(MSG_NOTE_BAD_SECFLAGS_VER), pr_version);
848 + dump_hex_bytes(state->ns_data, state->ns_len, state->ns_indent,
849 + 4, 3);
850 + } else {
851 + PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_VERSION), pr_version);
852 + w = extract_as_word(state, &layout->pr_effective);
853 + print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_EFFECTIVE),
854 + conv_prsecflags(w, 0, &inv));
855 +
856 + w = extract_as_word(state, &layout->pr_inherit);
857 + print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_INHERIT),
858 + conv_prsecflags(w, 0, &inv));
859 +
860 + w = extract_as_word(state, &layout->pr_lower);
861 + print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_LOWER),
862 + conv_prsecflags(w, 0, &inv));
863 +
864 + w = extract_as_word(state, &layout->pr_upper);
865 + print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_UPPER),
866 + conv_prsecflags(w, 0, &inv));
867 + }
868 +
869 + indent_exit(state);
870 +}
830 871
831 872 /*
832 873 * Output information from utsname structure.
833 874 */
834 875 static void
835 876 dump_utsname(note_state_t *state, const char *title)
836 877 {
837 878 const sl_utsname_layout_t *layout = state->ns_arch->utsname;
838 879
839 880 indent_enter(state, title, &layout->sysname);
840 881
841 882 PRINT_STRBUF(MSG_ORIG(MSG_CNOTE_T_UTS_SYSNAME), sysname);
842 883 PRINT_STRBUF(MSG_ORIG(MSG_CNOTE_T_UTS_NODENAME), nodename);
843 884 PRINT_STRBUF(MSG_ORIG(MSG_CNOTE_T_UTS_RELEASE), release);
844 885 PRINT_STRBUF(MSG_ORIG(MSG_CNOTE_T_UTS_VERSION), version);
845 886 PRINT_STRBUF(MSG_ORIG(MSG_CNOTE_T_UTS_MACHINE), machine);
846 887
847 888 indent_exit(state);
848 889 }
849 890
850 891
851 892 /*
852 893 * Dump register contents
853 894 */
854 895 static void
855 896 dump_prgregset(note_state_t *state, const char *title)
856 897 {
857 898 sl_field_t fdesc1, fdesc2;
858 899 sl_fmtbuf_t buf1, buf2;
859 900 Conv_inv_buf_t inv_buf1, inv_buf2;
860 901 Word w;
861 902
862 903 fdesc1 = fdesc2 = state->ns_arch->prgregset->elt0;
863 904 indent_enter(state, title, &fdesc1);
864 905
865 906 for (w = 0; w < fdesc1.slf_nelts; ) {
866 907 if (w == (fdesc1.slf_nelts - 1)) {
867 908 /* One last register is left */
868 909 if (!data_present(state, &fdesc1))
869 910 break;
870 911 dbg_print(0, MSG_ORIG(MSG_CNOTE_FMT_LINE),
871 912 INDENT, state->ns_vcol - state->ns_indent,
872 913 conv_cnote_pr_regname(state->ns_mach, w,
873 914 CONV_FMT_DECIMAL, &inv_buf1),
874 915 fmt_num(state, &fdesc1, SL_FMT_NUM_ZHEX, buf1));
875 916 fdesc1.slf_offset += fdesc1.slf_eltlen;
876 917 w++;
877 918 continue;
878 919 }
879 920
880 921 /* There are at least 2 more registers left. Show 2 up */
881 922 fdesc2.slf_offset = fdesc1.slf_offset + fdesc1.slf_eltlen;
882 923 if (!(data_present(state, &fdesc1) &&
883 924 data_present(state, &fdesc2)))
884 925 break;
885 926 dbg_print(0, MSG_ORIG(MSG_CNOTE_FMT_LINE_2UP), INDENT,
886 927 state->ns_vcol - state->ns_indent,
887 928 conv_cnote_pr_regname(state->ns_mach, w,
888 929 CONV_FMT_DECIMAL, &inv_buf1),
889 930 state->ns_t2col - state->ns_vcol,
890 931 fmt_num(state, &fdesc1, SL_FMT_NUM_ZHEX, buf1),
891 932 state->ns_v2col - state->ns_t2col,
892 933 conv_cnote_pr_regname(state->ns_mach, w + 1,
893 934 CONV_FMT_DECIMAL, &inv_buf2),
894 935 fmt_num(state, &fdesc2, SL_FMT_NUM_ZHEX, buf2));
895 936 fdesc1.slf_offset += 2 * fdesc1.slf_eltlen;
896 937 w += 2;
897 938 }
898 939
899 940 indent_exit(state);
900 941 }
901 942
902 943 /*
903 944 * Output information from lwpstatus_t structure.
904 945 */
905 946 static void
906 947 dump_lwpstatus(note_state_t *state, const char *title)
907 948 {
908 949 const sl_lwpstatus_layout_t *layout = state->ns_arch->lwpstatus;
909 950 Word w, w2;
910 951 int32_t i;
911 952 union {
912 953 Conv_inv_buf_t inv;
913 954 Conv_cnote_pr_flags_buf_t flags;
914 955 } conv_buf;
915 956
916 957 indent_enter(state, title, &layout->pr_flags);
917 958
918 959 if (data_present(state, &layout->pr_flags)) {
919 960 w = extract_as_word(state, &layout->pr_flags);
920 961 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_FLAGS),
921 962 conv_cnote_pr_flags(w, 0, &conv_buf.flags));
922 963 }
923 964
924 965 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_LWPID), pr_lwpid);
925 966
926 967 if (data_present(state, &layout->pr_why)) {
927 968 w = extract_as_word(state, &layout->pr_why);
928 969 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_WHY),
929 970 conv_cnote_pr_why(w, 0, &conv_buf.inv));
930 971
931 972 if (data_present(state, &layout->pr_what)) {
932 973 w2 = extract_as_word(state, &layout->pr_what);
933 974 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_WHAT),
934 975 conv_cnote_pr_what(w, w2, 0, &conv_buf.inv));
935 976 }
936 977 }
937 978
938 979 if (data_present(state, &layout->pr_cursig)) {
939 980 w = extract_as_word(state, &layout->pr_cursig);
940 981 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_CURSIG),
941 982 conv_cnote_signal(w, CONV_FMT_DECIMAL, &conv_buf.inv));
942 983 }
943 984
944 985 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_INFO), pr_info, dump_siginfo);
945 986 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_LWPPEND), pr_lwppend,
946 987 dump_sigset);
947 988 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_LWPHOLD), pr_lwphold,
948 989 dump_sigset);
949 990 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_ACTION), pr_action,
950 991 dump_sigaction);
951 992 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_ALTSTACK), pr_altstack,
952 993 dump_stack);
953 994
954 995 PRINT_ZHEX(MSG_ORIG(MSG_CNOTE_T_PR_OLDCONTEXT), pr_oldcontext);
955 996
956 997 if (data_present(state, &layout->pr_syscall)) {
957 998 w = extract_as_word(state, &layout->pr_syscall);
958 999 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_SYSCALL),
959 1000 conv_cnote_syscall(w, CONV_FMT_DECIMAL, &conv_buf.inv));
960 1001 }
961 1002
962 1003 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_NSYSARG), pr_nsysarg);
963 1004
964 1005 if (data_present(state, &layout->pr_errno)) {
965 1006 w = extract_as_word(state, &layout->pr_errno);
966 1007 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_ERRNO),
967 1008 conv_cnote_errno(w, CONV_FMT_DECIMAL, &conv_buf.inv));
968 1009 }
969 1010
970 1011 if (data_present(state, &layout->pr_nsysarg)) {
971 1012 w2 = extract_as_word(state, &layout->pr_nsysarg);
972 1013 print_array(state, &layout->pr_sysarg, SL_FMT_NUM_ZHEX, w2, 1,
973 1014 MSG_ORIG(MSG_CNOTE_T_PR_SYSARG));
974 1015 }
975 1016
976 1017 PRINT_HEX_2UP(MSG_ORIG(MSG_CNOTE_T_PR_RVAL1), pr_rval1,
977 1018 MSG_ORIG(MSG_CNOTE_T_PR_RVAL2), pr_rval2);
978 1019 PRINT_STRBUF(MSG_ORIG(MSG_CNOTE_T_PR_CLNAME), pr_clname);
979 1020 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_TSTAMP), pr_tstamp,
980 1021 dump_timestruc);
981 1022 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_UTIME), pr_utime, dump_timestruc);
982 1023 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_STIME), pr_stime, dump_timestruc);
983 1024
984 1025 if (data_present(state, &layout->pr_errpriv)) {
985 1026 i = extract_as_sword(state, &layout->pr_errpriv);
986 1027 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_ERRPRIV),
987 1028 conv_cnote_priv(i, CONV_FMT_DECIMAL, &conv_buf.inv));
988 1029 }
989 1030
990 1031 PRINT_ZHEX_2UP(MSG_ORIG(MSG_CNOTE_T_PR_USTACK), pr_ustack,
991 1032 MSG_ORIG(MSG_CNOTE_T_PR_INSTR), pr_instr);
992 1033
993 1034 /*
994 1035 * In order to line up all the values in a single column,
995 1036 * we would have to set vcol to a very high value, which results
996 1037 * in ugly looking output that runs off column 80. So, we use
997 1038 * two levels of vcol, one for the contents so far, and a
998 1039 * higher one for the pr_reg sub-struct.
999 1040 */
1000 1041 state->ns_vcol += 3;
1001 1042 state->ns_t2col += 3;
1002 1043 state->ns_v2col += 2;
1003 1044 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_REG), pr_reg, dump_prgregset);
1004 1045 state->ns_vcol -= 3;
1005 1046 state->ns_t2col -= 3;
1006 1047 state->ns_v2col -= 2;
1007 1048
1008 1049 /*
1009 1050 * The floating point register state is complex, and highly
1010 1051 * platform dependent. For now, we simply display it as
1011 1052 * a hex dump. This can be replaced if better information
1012 1053 * is required.
1013 1054 */
1014 1055 if (data_present(state, &layout->pr_fpreg)) {
1015 1056 indent_enter(state, MSG_ORIG(MSG_CNOTE_T_PR_FPREG),
1016 1057 &layout->pr_fpreg);
1017 1058 dump_hex_bytes(layout->pr_fpreg.slf_offset + state->ns_data,
1018 1059 layout->pr_fpreg.slf_eltlen, state->ns_indent, 4, 3);
1019 1060 indent_exit(state);
1020 1061 }
1021 1062
1022 1063 indent_exit(state);
1023 1064 }
1024 1065
1025 1066
1026 1067 /*
1027 1068 * Output information from pstatus_t structure.
1028 1069 */
1029 1070 static void
1030 1071 dump_pstatus(note_state_t *state, const char *title)
1031 1072 {
1032 1073 const sl_pstatus_layout_t *layout = state->ns_arch->pstatus;
1033 1074 Word w;
1034 1075 union {
1035 1076 Conv_inv_buf_t inv;
1036 1077 Conv_cnote_pr_flags_buf_t flags;
1037 1078 } conv_buf;
1038 1079
1039 1080 indent_enter(state, title, &layout->pr_flags);
1040 1081
1041 1082 if (data_present(state, &layout->pr_flags)) {
1042 1083 w = extract_as_word(state, &layout->pr_flags);
1043 1084 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_FLAGS),
1044 1085 conv_cnote_pr_flags(w, 0, &conv_buf.flags));
1045 1086 }
1046 1087
1047 1088 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_NLWP), pr_nlwp);
1048 1089 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_PID), pr_pid,
1049 1090 MSG_ORIG(MSG_CNOTE_T_PR_PPID), pr_ppid);
1050 1091 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_PGID), pr_pgid,
1051 1092 MSG_ORIG(MSG_CNOTE_T_PR_SID), pr_sid);
1052 1093 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_ASLWPID), pr_aslwpid,
1053 1094 MSG_ORIG(MSG_CNOTE_T_PR_AGENTID), pr_agentid);
1054 1095 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_SIGPEND), pr_sigpend,
1055 1096 dump_sigset);
1056 1097 print_num_2up(state, MSG_ORIG(MSG_CNOTE_T_PR_BRKBASE),
1057 1098 &layout->pr_brkbase, SL_FMT_NUM_ZHEX,
1058 1099 MSG_ORIG(MSG_CNOTE_T_PR_BRKSIZE),
1059 1100 &layout->pr_brksize, SL_FMT_NUM_HEX);
1060 1101 print_num_2up(state, MSG_ORIG(MSG_CNOTE_T_PR_STKBASE),
1061 1102 &layout->pr_stkbase, SL_FMT_NUM_ZHEX,
1062 1103 MSG_ORIG(MSG_CNOTE_T_PR_STKSIZE),
1063 1104 &layout->pr_stksize, SL_FMT_NUM_HEX);
1064 1105 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_UTIME), pr_utime, dump_timestruc);
1065 1106 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_STIME), pr_stime, dump_timestruc);
1066 1107 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_CUTIME), pr_cutime,
1067 1108 dump_timestruc);
1068 1109 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_CSTIME), pr_cstime,
1069 1110 dump_timestruc);
1070 1111 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_SIGTRACE), pr_sigtrace,
1071 1112 dump_sigset);
1072 1113 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_FLTTRACE), pr_flttrace,
1073 1114 dump_fltset);
1074 1115 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_SYSENTRY), pr_sysentry,
1075 1116 dump_sysset);
1076 1117 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_SYSEXIT), pr_sysexit,
1077 1118 dump_sysset);
1078 1119
1079 1120 if (data_present(state, &layout->pr_dmodel)) {
1080 1121 w = extract_as_word(state, &layout->pr_dmodel);
1081 1122 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_DMODEL),
1082 1123 conv_cnote_pr_dmodel(w, 0, &conv_buf.inv));
1083 1124 }
1084 1125
1085 1126 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_TASKID), pr_taskid,
1086 1127 MSG_ORIG(MSG_CNOTE_T_PR_PROJID), pr_projid);
1087 1128 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_NZOMB), pr_nzomb,
1088 1129 MSG_ORIG(MSG_CNOTE_T_PR_ZONEID), pr_zoneid);
1089 1130
↓ open down ↓ |
250 lines elided |
↑ open up ↑ |
1090 1131 /*
1091 1132 * In order to line up all the values in a single column,
1092 1133 * we would have to set vcol to a very high value, which results
1093 1134 * in ugly looking output that runs off column 80. So, we use
1094 1135 * two levels of vcol, one for the contents so far, and a
1095 1136 * higher one for the pr_lwp sub-struct.
1096 1137 */
1097 1138 state->ns_vcol += 5;
1098 1139 state->ns_t2col += 5;
1099 1140 state->ns_v2col += 5;
1141 +
1100 1142 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_LWP), pr_lwp, dump_lwpstatus);
1101 1143 state->ns_vcol -= 5;
1102 1144 state->ns_t2col -= 5;
1103 1145 state->ns_v2col -= 5;
1104 1146
1105 1147 indent_exit(state);
1106 1148 }
1107 1149
1108 1150
1109 1151 /*
1110 1152 * Output information from prstatus_t (<sys/old_procfs.h>) structure.
1111 1153 */
1112 1154 static void
1113 1155 dump_prstatus(note_state_t *state, const char *title)
1114 1156 {
1115 1157 const sl_prstatus_layout_t *layout = state->ns_arch->prstatus;
1116 1158 Word w, w2;
1117 1159 int i;
1118 1160 union {
1119 1161 Conv_inv_buf_t inv;
1120 1162 Conv_cnote_old_pr_flags_buf_t flags;
1121 1163 } conv_buf;
1122 1164
1123 1165 indent_enter(state, title, &layout->pr_flags);
1124 1166
1125 1167 if (data_present(state, &layout->pr_flags)) {
1126 1168 w = extract_as_word(state, &layout->pr_flags);
1127 1169 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_FLAGS),
1128 1170 conv_cnote_old_pr_flags(w, 0, &conv_buf.flags));
1129 1171 }
1130 1172
1131 1173 if (data_present(state, &layout->pr_why)) {
1132 1174 w = extract_as_word(state, &layout->pr_why);
1133 1175 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_WHY),
1134 1176 conv_cnote_pr_why(w, 0, &conv_buf.inv));
1135 1177
1136 1178
1137 1179 if (data_present(state, &layout->pr_what)) {
1138 1180 w2 = extract_as_word(state, &layout->pr_what);
1139 1181 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_WHAT),
1140 1182 conv_cnote_pr_what(w, w2, 0, &conv_buf.inv));
1141 1183 }
1142 1184 }
1143 1185
1144 1186 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_INFO), pr_info, dump_siginfo);
1145 1187
1146 1188 if (data_present(state, &layout->pr_cursig)) {
1147 1189 w = extract_as_word(state, &layout->pr_cursig);
1148 1190 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_CURSIG),
1149 1191 conv_cnote_signal(w, CONV_FMT_DECIMAL, &conv_buf.inv));
1150 1192 }
1151 1193
1152 1194 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_NLWP), pr_nlwp);
1153 1195 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_SIGPEND), pr_sigpend,
1154 1196 dump_sigset);
1155 1197 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_SIGHOLD), pr_sighold,
1156 1198 dump_sigset);
1157 1199 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_ALTSTACK), pr_altstack,
1158 1200 dump_stack);
1159 1201 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_ACTION), pr_action,
1160 1202 dump_sigaction);
1161 1203 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_PID), pr_pid,
1162 1204 MSG_ORIG(MSG_CNOTE_T_PR_PPID), pr_ppid);
1163 1205 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_PGRP), pr_pgrp,
1164 1206 MSG_ORIG(MSG_CNOTE_T_PR_SID), pr_sid);
1165 1207 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_UTIME), pr_utime, dump_timestruc);
1166 1208 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_STIME), pr_stime, dump_timestruc);
1167 1209 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_CUTIME), pr_cutime,
1168 1210 dump_timestruc);
1169 1211 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_CSTIME), pr_cstime,
1170 1212 dump_timestruc);
1171 1213 PRINT_STRBUF(MSG_ORIG(MSG_CNOTE_T_PR_CLNAME), pr_clname);
1172 1214
1173 1215 if (data_present(state, &layout->pr_syscall)) {
1174 1216 w = extract_as_word(state, &layout->pr_syscall);
1175 1217 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_SYSCALL),
1176 1218 conv_cnote_syscall(w, CONV_FMT_DECIMAL, &conv_buf.inv));
1177 1219 }
1178 1220
1179 1221 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_NSYSARG), pr_nsysarg);
1180 1222
1181 1223 if (data_present(state, &layout->pr_nsysarg)) {
1182 1224 w2 = extract_as_word(state, &layout->pr_nsysarg);
1183 1225 print_array(state, &layout->pr_sysarg, SL_FMT_NUM_ZHEX, w2, 1,
1184 1226 MSG_ORIG(MSG_CNOTE_T_PR_SYSARG));
1185 1227 }
1186 1228
1187 1229 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_WHO), pr_who);
1188 1230 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_LWPPEND), pr_sigpend,
1189 1231 dump_sigset);
1190 1232 PRINT_ZHEX(MSG_ORIG(MSG_CNOTE_T_PR_OLDCONTEXT), pr_oldcontext);
1191 1233 print_num_2up(state, MSG_ORIG(MSG_CNOTE_T_PR_BRKBASE),
1192 1234 &layout->pr_brkbase, SL_FMT_NUM_ZHEX,
1193 1235 MSG_ORIG(MSG_CNOTE_T_PR_BRKSIZE),
1194 1236 &layout->pr_brksize, SL_FMT_NUM_HEX);
1195 1237 print_num_2up(state, MSG_ORIG(MSG_CNOTE_T_PR_STKBASE),
1196 1238 &layout->pr_stkbase, SL_FMT_NUM_ZHEX,
1197 1239 MSG_ORIG(MSG_CNOTE_T_PR_STKSIZE),
1198 1240 &layout->pr_stksize, SL_FMT_NUM_HEX);
1199 1241 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_PROCESSOR), pr_processor);
1200 1242
1201 1243 if (data_present(state, &layout->pr_bind)) {
1202 1244 i = extract_as_sword(state, &layout->pr_bind);
1203 1245 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_BIND),
1204 1246 conv_cnote_psetid(i, CONV_FMT_DECIMAL, &conv_buf.inv));
1205 1247 }
1206 1248
1207 1249 PRINT_ZHEX(MSG_ORIG(MSG_CNOTE_T_PR_INSTR), pr_instr);
1208 1250 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_REG), pr_reg, dump_prgregset);
1209 1251
1210 1252 indent_exit(state);
1211 1253 }
1212 1254
1213 1255
1214 1256 /*
1215 1257 * Print percent from 16-bit binary fraction [0 .. 1]
1216 1258 * Round up .01 to .1 to indicate some small percentage (the 0x7000 below).
1217 1259 *
1218 1260 * Note: This routine was copied from ps(1) and then modified.
1219 1261 */
1220 1262 static const char *
1221 1263 prtpct_value(note_state_t *state, const sl_field_t *fdesc,
1222 1264 sl_fmtbuf_t buf)
1223 1265 {
1224 1266 uint_t value; /* need 32 bits to compute with */
1225 1267
1226 1268 value = extract_as_word(state, fdesc);
1227 1269 value = ((value * 1000) + 0x7000) >> 15; /* [0 .. 1000] */
1228 1270 if (value >= 1000)
1229 1271 value = 999;
1230 1272
1231 1273 (void) snprintf(buf, sizeof (sl_fmtbuf_t),
1232 1274 MSG_ORIG(MSG_CNOTE_FMT_PRTPCT), value / 10, value % 10);
1233 1275
1234 1276 return (buf);
1235 1277 }
1236 1278
1237 1279
1238 1280
1239 1281 /*
1240 1282 * Version of prtpct() used for a 2-up display of two adjacent percentages.
1241 1283 */
1242 1284 static void
1243 1285 prtpct_2up(note_state_t *state, const sl_field_t *fdesc1,
1244 1286 const char *title1, const sl_field_t *fdesc2, const char *title2)
1245 1287 {
1246 1288 sl_fmtbuf_t buf1, buf2;
1247 1289
1248 1290 if (!(data_present(state, fdesc1) &&
1249 1291 data_present(state, fdesc2)))
1250 1292 return;
1251 1293
1252 1294 dbg_print(0, MSG_ORIG(MSG_CNOTE_FMT_LINE_2UP), INDENT,
1253 1295 state->ns_vcol - state->ns_indent, title1,
1254 1296 state->ns_t2col - state->ns_vcol,
1255 1297 prtpct_value(state, fdesc1, buf1),
1256 1298 state->ns_v2col - state->ns_t2col, title2,
1257 1299 prtpct_value(state, fdesc2, buf2));
1258 1300 }
1259 1301
1260 1302
1261 1303 /*
1262 1304 * The psinfo_t and prpsinfo_t structs have pr_state and pr_sname
1263 1305 * fields that we wish to print in a 2up format. The pr_state is
1264 1306 * an integer, while pr_sname is a single character.
1265 1307 */
1266 1308 static void
1267 1309 print_state_sname_2up(note_state_t *state,
1268 1310 const sl_field_t *state_fdesc,
1269 1311 const sl_field_t *sname_fdesc)
1270 1312 {
1271 1313 sl_fmtbuf_t buf1, buf2;
1272 1314 int sname;
1273 1315
1274 1316 /*
1275 1317 * If the field slf_offset and extent fall past the end of the
1276 1318 * available data, then return without doing anything. That note
1277 1319 * is from an older core file that doesn't have all the fields
1278 1320 * that we know about.
1279 1321 */
1280 1322 if (!(data_present(state, state_fdesc) &&
1281 1323 data_present(state, sname_fdesc)))
1282 1324 return;
1283 1325
1284 1326 sname = extract_as_sword(state, sname_fdesc);
1285 1327 buf2[0] = sname;
1286 1328 buf2[1] = '\0';
1287 1329
1288 1330 dbg_print(0, MSG_ORIG(MSG_CNOTE_FMT_LINE_2UP), INDENT,
1289 1331 state->ns_vcol - state->ns_indent, MSG_ORIG(MSG_CNOTE_T_PR_STATE),
1290 1332 state->ns_t2col - state->ns_vcol,
1291 1333 fmt_num(state, state_fdesc, SL_FMT_NUM_DEC, buf1),
1292 1334 state->ns_v2col - state->ns_t2col, MSG_ORIG(MSG_CNOTE_T_PR_SNAME),
1293 1335 buf2);
1294 1336 }
1295 1337
1296 1338 /*
1297 1339 * Output information from lwpsinfo_t structure.
1298 1340 */
1299 1341 static void
1300 1342 dump_lwpsinfo(note_state_t *state, const char *title)
1301 1343 {
1302 1344 const sl_lwpsinfo_layout_t *layout = state->ns_arch->lwpsinfo;
1303 1345 Word w;
1304 1346 int32_t i;
1305 1347 union {
1306 1348 Conv_cnote_proc_flag_buf_t proc_flag;
1307 1349 Conv_inv_buf_t inv;
1308 1350 } conv_buf;
1309 1351
1310 1352 indent_enter(state, title, &layout->pr_flag);
1311 1353
1312 1354 if (data_present(state, &layout->pr_flag)) {
1313 1355 w = extract_as_word(state, &layout->pr_flag);
1314 1356 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_FLAG),
1315 1357 conv_cnote_proc_flag(w, 0, &conv_buf.proc_flag));
1316 1358 }
1317 1359
1318 1360 print_num_2up(state, MSG_ORIG(MSG_CNOTE_T_PR_LWPID), &layout->pr_lwpid,
1319 1361 SL_FMT_NUM_DEC, MSG_ORIG(MSG_CNOTE_T_PR_ADDR), &layout->pr_addr,
1320 1362 SL_FMT_NUM_ZHEX);
1321 1363 PRINT_HEX(MSG_ORIG(MSG_CNOTE_T_PR_WCHAN), pr_wchan);
1322 1364
1323 1365 if (data_present(state, &layout->pr_stype)) {
1324 1366 w = extract_as_word(state, &layout->pr_stype);
1325 1367 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_STYPE),
1326 1368 conv_cnote_pr_stype(w, CONV_FMT_DECIMAL, &conv_buf.inv));
1327 1369 }
1328 1370
1329 1371 print_state_sname_2up(state, &layout->pr_state, &layout->pr_sname);
1330 1372
1331 1373 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_NICE), pr_nice);
1332 1374
1333 1375 if (data_present(state, &layout->pr_syscall)) {
1334 1376 w = extract_as_word(state, &layout->pr_syscall);
1335 1377 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_SYSCALL),
1336 1378 conv_cnote_syscall(w, CONV_FMT_DECIMAL, &conv_buf.inv));
1337 1379 }
1338 1380
1339 1381 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_OLDPRI), pr_oldpri,
1340 1382 MSG_ORIG(MSG_CNOTE_T_PR_CPU), pr_cpu);
1341 1383
1342 1384 if (data_present(state, &layout->pr_pri) &&
1343 1385 data_present(state, &layout->pr_pctcpu)) {
1344 1386 sl_fmtbuf_t buf1, buf2;
1345 1387
1346 1388 dbg_print(0, MSG_ORIG(MSG_CNOTE_FMT_LINE_2UP), INDENT,
1347 1389 state->ns_vcol - state->ns_indent,
1348 1390 MSG_ORIG(MSG_CNOTE_T_PR_PRI),
1349 1391 state->ns_t2col - state->ns_vcol,
1350 1392 fmt_num(state, &layout->pr_pri, SL_FMT_NUM_DEC, buf1),
1351 1393 state->ns_v2col - state->ns_t2col,
1352 1394 MSG_ORIG(MSG_CNOTE_T_PR_PCTCPU),
1353 1395 prtpct_value(state, &layout->pr_pctcpu, buf2));
1354 1396 }
1355 1397
1356 1398 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_START), pr_start, dump_timestruc);
1357 1399 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_TIME), pr_time, dump_timestruc);
1358 1400 PRINT_STRBUF(MSG_ORIG(MSG_CNOTE_T_PR_CLNAME), pr_clname);
1359 1401 PRINT_STRBUF(MSG_ORIG(MSG_CNOTE_T_PR_NAME), pr_name);
1360 1402 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_ONPRO), pr_onpro,
1361 1403 MSG_ORIG(MSG_CNOTE_T_PR_BINDPRO), pr_bindpro);
1362 1404
1363 1405 if (data_present(state, &layout->pr_bindpset)) {
1364 1406 i = extract_as_sword(state, &layout->pr_bindpset);
1365 1407 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_BINDPSET),
1366 1408 conv_cnote_psetid(i, CONV_FMT_DECIMAL, &conv_buf.inv));
1367 1409 }
1368 1410
1369 1411 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_LGRP), pr_lgrp);
1370 1412
1371 1413 indent_exit(state);
1372 1414 }
1373 1415
1374 1416
1375 1417 /*
1376 1418 * Output information from psinfo_t structure.
1377 1419 */
1378 1420 static void
1379 1421 dump_psinfo(note_state_t *state, const char *title)
1380 1422 {
1381 1423 const sl_psinfo_layout_t *layout = state->ns_arch->psinfo;
1382 1424 Word w;
1383 1425 union {
1384 1426 Conv_cnote_proc_flag_buf_t proc_flag;
1385 1427 Conv_inv_buf_t inv;
1386 1428 } conv_buf;
1387 1429
1388 1430 indent_enter(state, title, &layout->pr_flag);
1389 1431
1390 1432 if (data_present(state, &layout->pr_flag)) {
1391 1433 w = extract_as_word(state, &layout->pr_flag);
1392 1434 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_FLAG),
1393 1435 conv_cnote_proc_flag(w, 0, &conv_buf.proc_flag));
1394 1436 }
1395 1437
1396 1438 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_NLWP), pr_nlwp);
1397 1439 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_PID), pr_pid,
1398 1440 MSG_ORIG(MSG_CNOTE_T_PR_PPID), pr_ppid);
1399 1441 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_PGID), pr_pgid,
1400 1442 MSG_ORIG(MSG_CNOTE_T_PR_SID), pr_sid);
1401 1443 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_UID), pr_uid,
1402 1444 MSG_ORIG(MSG_CNOTE_T_PR_EUID), pr_euid);
1403 1445 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_GID), pr_gid,
1404 1446 MSG_ORIG(MSG_CNOTE_T_PR_EGID), pr_egid);
1405 1447 print_num_2up(state, MSG_ORIG(MSG_CNOTE_T_PR_ADDR), &layout->pr_addr,
1406 1448 SL_FMT_NUM_ZHEX, MSG_ORIG(MSG_CNOTE_T_PR_SIZE), &layout->pr_size,
1407 1449 SL_FMT_NUM_HEX);
1408 1450 print_num_2up(state, MSG_ORIG(MSG_CNOTE_T_PR_RSSIZE),
1409 1451 &layout->pr_rssize, SL_FMT_NUM_HEX, MSG_ORIG(MSG_CNOTE_T_PR_TTYDEV),
1410 1452 &layout->pr_ttydev, SL_FMT_NUM_DEC);
1411 1453 prtpct_2up(state, &layout->pr_pctcpu, MSG_ORIG(MSG_CNOTE_T_PR_PCTCPU),
1412 1454 &layout->pr_pctmem, MSG_ORIG(MSG_CNOTE_T_PR_PCTMEM));
1413 1455 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_START), pr_start, dump_timestruc);
1414 1456 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_TIME), pr_time, dump_timestruc);
1415 1457 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_CTIME), pr_ctime, dump_timestruc);
1416 1458 PRINT_STRBUF(MSG_ORIG(MSG_CNOTE_T_PR_FNAME), pr_fname);
1417 1459 PRINT_STRBUF(MSG_ORIG(MSG_CNOTE_T_PR_PSARGS), pr_psargs);
1418 1460 print_num_2up(state, MSG_ORIG(MSG_CNOTE_T_PR_WSTAT), &layout->pr_wstat,
1419 1461 SL_FMT_NUM_HEX, MSG_ORIG(MSG_CNOTE_T_PR_ARGC), &layout->pr_argc,
1420 1462 SL_FMT_NUM_DEC);
1421 1463 PRINT_ZHEX_2UP(MSG_ORIG(MSG_CNOTE_T_PR_ARGV), pr_argv,
1422 1464 MSG_ORIG(MSG_CNOTE_T_PR_ENVP), pr_envp);
1423 1465
1424 1466 if (data_present(state, &layout->pr_dmodel)) {
1425 1467 w = extract_as_word(state, &layout->pr_dmodel);
1426 1468 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_DMODEL),
1427 1469 conv_cnote_pr_dmodel(w, 0, &conv_buf.inv));
1428 1470 }
1429 1471
1430 1472 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_TASKID), pr_taskid,
1431 1473 MSG_ORIG(MSG_CNOTE_T_PR_PROJID), pr_projid);
1432 1474 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_NZOMB), pr_nzomb,
1433 1475 MSG_ORIG(MSG_CNOTE_T_PR_POOLID), pr_poolid);
1434 1476 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_ZONEID), pr_zoneid,
1435 1477 MSG_ORIG(MSG_CNOTE_T_PR_CONTRACT), pr_contract);
1436 1478
1437 1479 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_LWP), pr_lwp, dump_lwpsinfo);
1438 1480
1439 1481 indent_exit(state);
1440 1482 }
1441 1483
1442 1484 /*
1443 1485 * Output information from prpsinfo_t structure.
1444 1486 */
1445 1487 static void
1446 1488 dump_prpsinfo(note_state_t *state, const char *title)
1447 1489 {
1448 1490 const sl_prpsinfo_layout_t *layout = state->ns_arch->prpsinfo;
1449 1491 Word w;
1450 1492 union {
1451 1493 Conv_cnote_proc_flag_buf_t proc_flag;
1452 1494 Conv_inv_buf_t inv;
1453 1495 } conv_buf;
1454 1496
1455 1497 indent_enter(state, title, &layout->pr_state);
1456 1498
1457 1499 print_state_sname_2up(state, &layout->pr_state, &layout->pr_sname);
1458 1500 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_ZOMB), pr_zomb,
1459 1501 MSG_ORIG(MSG_CNOTE_T_PR_NICE), pr_nice);
1460 1502
1461 1503 if (data_present(state, &layout->pr_flag)) {
1462 1504 w = extract_as_word(state, &layout->pr_flag);
1463 1505 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_FLAG),
1464 1506 conv_cnote_proc_flag(w, 0, &conv_buf.proc_flag));
1465 1507 }
1466 1508
1467 1509
1468 1510 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_UID), pr_uid,
1469 1511 MSG_ORIG(MSG_CNOTE_T_PR_GID), pr_gid);
1470 1512 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_PID), pr_pid,
1471 1513 MSG_ORIG(MSG_CNOTE_T_PR_PPID), pr_ppid);
1472 1514 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_PGRP), pr_pgrp,
1473 1515 MSG_ORIG(MSG_CNOTE_T_PR_SID), pr_sid);
1474 1516 print_num_2up(state, MSG_ORIG(MSG_CNOTE_T_PR_ADDR), &layout->pr_addr,
1475 1517 SL_FMT_NUM_ZHEX, MSG_ORIG(MSG_CNOTE_T_PR_SIZE), &layout->pr_size,
1476 1518 SL_FMT_NUM_HEX);
1477 1519 PRINT_HEX_2UP(MSG_ORIG(MSG_CNOTE_T_PR_RSSIZE), pr_rssize,
1478 1520 MSG_ORIG(MSG_CNOTE_T_PR_WCHAN), pr_wchan);
1479 1521 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_START), pr_start, dump_timestruc);
1480 1522 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_TIME), pr_time, dump_timestruc);
1481 1523 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_PRI), pr_pri,
1482 1524 MSG_ORIG(MSG_CNOTE_T_PR_OLDPRI), pr_oldpri);
1483 1525 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_CPU), pr_cpu);
1484 1526 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_OTTYDEV), pr_ottydev,
1485 1527 MSG_ORIG(MSG_CNOTE_T_PR_LTTYDEV), pr_lttydev);
1486 1528 PRINT_STRBUF(MSG_ORIG(MSG_CNOTE_T_PR_CLNAME), pr_clname);
1487 1529 PRINT_STRBUF(MSG_ORIG(MSG_CNOTE_T_PR_FNAME), pr_fname);
1488 1530 PRINT_STRBUF(MSG_ORIG(MSG_CNOTE_T_PR_PSARGS), pr_psargs);
1489 1531
1490 1532 if (data_present(state, &layout->pr_syscall)) {
1491 1533 w = extract_as_word(state, &layout->pr_syscall);
1492 1534 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_SYSCALL),
1493 1535 conv_cnote_syscall(w, CONV_FMT_DECIMAL, &conv_buf.inv));
1494 1536 }
1495 1537
1496 1538 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_CTIME), pr_ctime, dump_timestruc);
1497 1539 PRINT_HEX_2UP(MSG_ORIG(MSG_CNOTE_T_PR_BYSIZE), pr_bysize,
1498 1540 MSG_ORIG(MSG_CNOTE_T_PR_BYRSSIZE), pr_byrssize);
1499 1541 print_num_2up(state, MSG_ORIG(MSG_CNOTE_T_PR_ARGC), &layout->pr_argc,
1500 1542 SL_FMT_NUM_DEC, MSG_ORIG(MSG_CNOTE_T_PR_ARGV), &layout->pr_argv,
1501 1543 SL_FMT_NUM_ZHEX);
1502 1544 print_num_2up(state, MSG_ORIG(MSG_CNOTE_T_PR_ENVP), &layout->pr_envp,
1503 1545 SL_FMT_NUM_ZHEX, MSG_ORIG(MSG_CNOTE_T_PR_WSTAT), &layout->pr_wstat,
1504 1546 SL_FMT_NUM_HEX);
1505 1547 prtpct_2up(state, &layout->pr_pctcpu, MSG_ORIG(MSG_CNOTE_T_PR_PCTCPU),
1506 1548 &layout->pr_pctmem, MSG_ORIG(MSG_CNOTE_T_PR_PCTMEM));
1507 1549 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_EUID), pr_euid,
1508 1550 MSG_ORIG(MSG_CNOTE_T_PR_EGID), pr_egid);
1509 1551 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_ASLWPID), pr_aslwpid);
1510 1552
1511 1553 if (data_present(state, &layout->pr_dmodel)) {
1512 1554 w = extract_as_word(state, &layout->pr_dmodel);
1513 1555 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_DMODEL),
1514 1556 conv_cnote_pr_dmodel(w, 0, &conv_buf.inv));
1515 1557 }
1516 1558
1517 1559 indent_exit(state);
1518 1560 }
1519 1561
1520 1562
1521 1563 /*
1522 1564 * Output information from prcred_t structure.
1523 1565 */
1524 1566 static void
1525 1567 dump_prcred(note_state_t *state, const char *title)
1526 1568 {
1527 1569 const sl_prcred_layout_t *layout = state->ns_arch->prcred;
1528 1570 Word ngroups;
1529 1571
1530 1572 indent_enter(state, title, &layout->pr_euid);
1531 1573
1532 1574 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_EUID), pr_euid,
1533 1575 MSG_ORIG(MSG_CNOTE_T_PR_RUID), pr_ruid);
1534 1576 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_SUID), pr_suid,
1535 1577 MSG_ORIG(MSG_CNOTE_T_PR_EGID), pr_egid);
1536 1578 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_RGID), pr_rgid,
1537 1579 MSG_ORIG(MSG_CNOTE_T_PR_SGID), pr_sgid);
1538 1580 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_NGROUPS), pr_ngroups);
1539 1581
1540 1582 if (data_present(state, &layout->pr_ngroups)) {
1541 1583 ngroups = extract_as_word(state, &layout->pr_ngroups);
1542 1584 print_array(state, &layout->pr_groups, SL_FMT_NUM_DEC, ngroups,
1543 1585 0, MSG_ORIG(MSG_CNOTE_T_PR_GROUPS));
1544 1586 }
1545 1587
1546 1588 indent_exit(state);
1547 1589 }
1548 1590
1549 1591
1550 1592 /*
1551 1593 * Output information from prpriv_t structure.
1552 1594 */
1553 1595 static void
1554 1596 dump_prpriv(note_state_t *state, const char *title)
1555 1597 {
1556 1598 const sl_prpriv_layout_t *layout = state->ns_arch->prpriv;
1557 1599 Word nsets;
1558 1600
1559 1601 indent_enter(state, title, &layout->pr_nsets);
1560 1602
1561 1603 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_NSETS), pr_nsets);
1562 1604 PRINT_HEX(MSG_ORIG(MSG_CNOTE_T_PR_SETSIZE), pr_setsize);
1563 1605 PRINT_HEX(MSG_ORIG(MSG_CNOTE_T_PR_INFOSIZE), pr_infosize);
1564 1606
1565 1607 if (data_present(state, &layout->pr_nsets)) {
1566 1608 nsets = extract_as_word(state, &layout->pr_nsets);
1567 1609 print_array(state, &layout->pr_sets, SL_FMT_NUM_ZHEX, nsets,
1568 1610 0, MSG_ORIG(MSG_CNOTE_T_PR_SETS));
1569 1611 }
1570 1612
1571 1613 indent_exit(state);
1572 1614 }
1573 1615
1574 1616 static void
1575 1617 dump_prfdinfo(note_state_t *state, const char *title)
1576 1618 {
1577 1619 const sl_prfdinfo_layout_t *layout = state->ns_arch->prfdinfo;
1578 1620 char buf[1024];
1579 1621 uint32_t fileflags, mode;
1580 1622
1581 1623 indent_enter(state, title, &layout->pr_fd);
1582 1624
1583 1625 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_FD), pr_fd);
1584 1626 mode = extract_as_word(state, &layout->pr_mode);
1585 1627
1586 1628 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_MODE),
1587 1629 conv_cnote_filemode(mode, 0, buf, sizeof (buf)));
1588 1630
1589 1631 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_UID), pr_uid,
1590 1632 MSG_ORIG(MSG_CNOTE_T_PR_GID), pr_gid);
1591 1633
1592 1634 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_MAJOR), pr_major,
1593 1635 MSG_ORIG(MSG_CNOTE_T_PR_MINOR), pr_minor);
1594 1636 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_RMAJOR), pr_rmajor,
1595 1637 MSG_ORIG(MSG_CNOTE_T_PR_RMINOR), pr_rminor);
1596 1638
1597 1639 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_INO), pr_ino);
1598 1640
1599 1641 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_SIZE), pr_size,
1600 1642 MSG_ORIG(MSG_CNOTE_T_PR_OFFSET), pr_offset);
1601 1643
1602 1644 fileflags = extract_as_word(state, &layout->pr_fileflags);
1603 1645
1604 1646 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_FILEFLAGS),
1605 1647 conv_cnote_fileflags(fileflags, 0, buf, sizeof (buf)));
1606 1648
1607 1649 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_FDFLAGS), pr_fdflags);
1608 1650
1609 1651 PRINT_STRBUF(MSG_ORIG(MSG_CNOTE_T_PR_PATH), pr_path);
1610 1652
1611 1653 indent_exit(state);
1612 1654 }
1613 1655
1614 1656 /*
1615 1657 * Output information from priv_impl_info_t structure.
1616 1658 */
1617 1659 static void
1618 1660 dump_priv_impl_info(note_state_t *state, const char *title)
1619 1661 {
1620 1662 const sl_priv_impl_info_layout_t *layout;
1621 1663
1622 1664 layout = state->ns_arch->priv_impl_info;
1623 1665 indent_enter(state, title, &layout->priv_headersize);
1624 1666
1625 1667 PRINT_HEX_2UP(MSG_ORIG(MSG_CNOTE_T_PRIV_HEADERSIZE), priv_headersize,
1626 1668 MSG_ORIG(MSG_CNOTE_T_PRIV_FLAGS), priv_flags);
1627 1669
1628 1670 print_num_2up(state, MSG_ORIG(MSG_CNOTE_T_PRIV_NSETS),
1629 1671 &layout->priv_nsets, SL_FMT_NUM_DEC,
1630 1672 MSG_ORIG(MSG_CNOTE_T_PRIV_SETSIZE), &layout->priv_setsize,
1631 1673 SL_FMT_NUM_HEX);
1632 1674 print_num_2up(state, MSG_ORIG(MSG_CNOTE_T_PRIV_MAX), &layout->priv_max,
1633 1675 SL_FMT_NUM_DEC, MSG_ORIG(MSG_CNOTE_T_PRIV_INFOSIZE),
1634 1676 &layout->priv_infosize, SL_FMT_NUM_HEX);
1635 1677 PRINT_HEX(MSG_ORIG(MSG_CNOTE_T_PRIV_GLOBALINFOSIZE),
1636 1678 priv_globalinfosize);
1637 1679
1638 1680 indent_exit(state);
1639 1681 }
1640 1682
1641 1683
1642 1684 /*
1643 1685 * Dump information from an asrset_t array. This data
1644 1686 * structure is specific to sparcv9, and does not appear
1645 1687 * on any other platform.
1646 1688 *
1647 1689 * asrset_t is a simple array, defined in <sys/regset.h> as
1648 1690 * typedef int64_t asrset_t[16]; %asr16 - > %asr31
1649 1691 *
1650 1692 * As such, we do not make use of the struct_layout facilities
1651 1693 * for this routine.
1652 1694 */
1653 1695 static void
1654 1696 dump_asrset(note_state_t *state, const char *title)
1655 1697 {
1656 1698 static const sl_field_t ftemplate = { 0, sizeof (int64_t), 16, 0 };
1657 1699 sl_field_t fdesc1, fdesc2;
1658 1700 sl_fmtbuf_t buf1, buf2;
1659 1701 char index1[MAXNDXSIZE * 2], index2[MAXNDXSIZE * 2];
1660 1702 Word w, nelts;
1661 1703
1662 1704 fdesc1 = fdesc2 = ftemplate;
1663 1705
1664 1706 /* We expect 16 values, but will print whatever is actually there */
1665 1707 nelts = state->ns_len / ftemplate.slf_eltlen;
1666 1708 if (nelts == 0)
1667 1709 return;
1668 1710
1669 1711 indent_enter(state, title, &fdesc1);
1670 1712
1671 1713 for (w = 0; w < nelts; ) {
1672 1714 (void) snprintf(index1, sizeof (index1),
1673 1715 MSG_ORIG(MSG_FMT_ASRINDEX), w + 16);
1674 1716
1675 1717 if (w == (nelts - 1)) {
1676 1718 /* One last register is left */
1677 1719 dbg_print(0, MSG_ORIG(MSG_CNOTE_FMT_LINE),
1678 1720 INDENT, state->ns_vcol - state->ns_indent, index1,
1679 1721 fmt_num(state, &fdesc1, SL_FMT_NUM_ZHEX, buf1));
1680 1722 fdesc1.slf_offset += fdesc1.slf_eltlen;
1681 1723 w++;
1682 1724 continue;
1683 1725 }
1684 1726
1685 1727 /* There are at least 2 more registers left. Show 2 up */
1686 1728 (void) snprintf(index2, sizeof (index2),
1687 1729 MSG_ORIG(MSG_FMT_ASRINDEX), w + 17);
1688 1730
1689 1731 fdesc2.slf_offset = fdesc1.slf_offset + fdesc1.slf_eltlen;
1690 1732 dbg_print(0, MSG_ORIG(MSG_CNOTE_FMT_LINE_2UP), INDENT,
1691 1733 state->ns_vcol - state->ns_indent, index1,
1692 1734 state->ns_t2col - state->ns_vcol,
1693 1735 fmt_num(state, &fdesc1, SL_FMT_NUM_ZHEX, buf1),
1694 1736 state->ns_v2col - state->ns_t2col, index2,
1695 1737 fmt_num(state, &fdesc2, SL_FMT_NUM_ZHEX, buf2));
1696 1738 fdesc1.slf_offset += 2 * fdesc1.slf_eltlen;
1697 1739 w += 2;
1698 1740 }
1699 1741
1700 1742 indent_exit(state);
1701 1743 }
1702 1744
1703 1745 corenote_ret_t
1704 1746 corenote(Half mach, int do_swap, Word type,
1705 1747 const char *desc, Word descsz)
1706 1748 {
1707 1749 note_state_t state;
1708 1750
1709 1751 /*
1710 1752 * Get the per-architecture layout definition
1711 1753 */
1712 1754 state.ns_mach = mach;
1713 1755 state.ns_arch = sl_mach(state.ns_mach);
1714 1756 if (sl_mach(state.ns_mach) == NULL)
1715 1757 return (CORENOTE_R_BADARCH);
1716 1758
1717 1759 state.ns_swap = do_swap;
1718 1760 state.ns_indent = 4;
1719 1761 state.ns_t2col = state.ns_v2col = 0;
1720 1762 state.ns_data = desc;
1721 1763 state.ns_len = descsz;
1722 1764
1723 1765 switch (type) {
1724 1766 case NT_PRSTATUS: /* prstatus_t <sys/old_procfs.h> */
1725 1767 state.ns_vcol = 26;
1726 1768 state.ns_t2col = 46;
1727 1769 state.ns_v2col = 60;
1728 1770 dump_prstatus(&state, MSG_ORIG(MSG_CNOTE_DESC_PRSTATUS_T));
1729 1771 return (CORENOTE_R_OK);
1730 1772
1731 1773 case NT_PRFPREG: /* prfpregset_t <sys/procfs_isa.h> */
1732 1774 return (CORENOTE_R_OK_DUMP);
1733 1775
1734 1776 case NT_PRPSINFO: /* prpsinfo_t <sys/old_procfs.h> */
1735 1777 state.ns_vcol = 20;
1736 1778 state.ns_t2col = 41;
1737 1779 state.ns_v2col = 54;
1738 1780 dump_prpsinfo(&state, MSG_ORIG(MSG_CNOTE_DESC_PRPSINFO_T));
1739 1781 return (CORENOTE_R_OK);
1740 1782
1741 1783 case NT_PRXREG: /* prxregset_t <sys/procfs_isa.h> */
1742 1784 return (CORENOTE_R_OK_DUMP);
1743 1785
1744 1786 case NT_PLATFORM: /* string from sysinfo(SI_PLATFORM) */
1745 1787 dbg_print(0, MSG_ORIG(MSG_NOTE_DESC));
1746 1788 dbg_print(0, MSG_ORIG(MSG_FMT_INDENT), safe_str(desc, descsz));
1747 1789 return (CORENOTE_R_OK);
1748 1790
1749 1791 case NT_AUXV: /* auxv_t array <sys/auxv.h> */
1750 1792 state.ns_vcol = 18;
1751 1793 dump_auxv(&state, MSG_ORIG(MSG_CNOTE_DESC_AUXV_T));
1752 1794 return (CORENOTE_R_OK);
1753 1795
1754 1796 case NT_GWINDOWS: /* gwindows_t SPARC only */
1755 1797 return (CORENOTE_R_OK_DUMP);
1756 1798
1757 1799 case NT_ASRS: /* asrset_t <sys/regset> sparcv9 only */
1758 1800 state.ns_vcol = 18;
1759 1801 state.ns_t2col = 38;
1760 1802 state.ns_v2col = 46;
1761 1803 dump_asrset(&state, MSG_ORIG(MSG_CNOTE_DESC_ASRSET_T));
1762 1804 return (CORENOTE_R_OK);
1763 1805
1764 1806 case NT_LDT: /* ssd array <sys/sysi86.h> IA32 only */
1765 1807 return (CORENOTE_R_OK_DUMP);
1766 1808
1767 1809 case NT_PSTATUS: /* pstatus_t <sys/procfs.h> */
1768 1810 state.ns_vcol = 22;
1769 1811 state.ns_t2col = 42;
1770 1812 state.ns_v2col = 54;
1771 1813 dump_pstatus(&state, MSG_ORIG(MSG_CNOTE_DESC_PSTATUS_T));
1772 1814 return (CORENOTE_R_OK);
1773 1815
1774 1816 case NT_PSINFO: /* psinfo_t <sys/procfs.h> */
1775 1817 state.ns_vcol = 25;
1776 1818 state.ns_t2col = 45;
1777 1819 state.ns_v2col = 58;
1778 1820 dump_psinfo(&state, MSG_ORIG(MSG_CNOTE_DESC_PSINFO_T));
1779 1821 return (CORENOTE_R_OK);
1780 1822
1781 1823 case NT_PRCRED: /* prcred_t <sys/procfs.h> */
1782 1824 state.ns_vcol = 20;
1783 1825 state.ns_t2col = 34;
1784 1826 state.ns_v2col = 44;
1785 1827 dump_prcred(&state, MSG_ORIG(MSG_CNOTE_DESC_PRCRED_T));
1786 1828 return (CORENOTE_R_OK);
1787 1829
1788 1830 case NT_UTSNAME: /* struct utsname <sys/utsname.h> */
1789 1831 state.ns_vcol = 18;
1790 1832 dump_utsname(&state, MSG_ORIG(MSG_CNOTE_DESC_STRUCT_UTSNAME));
1791 1833 return (CORENOTE_R_OK);
1792 1834
1793 1835 case NT_LWPSTATUS: /* lwpstatus_t <sys/procfs.h> */
1794 1836 state.ns_vcol = 24;
1795 1837 state.ns_t2col = 44;
1796 1838 state.ns_v2col = 54;
1797 1839 dump_lwpstatus(&state, MSG_ORIG(MSG_CNOTE_DESC_LWPSTATUS_T));
1798 1840 return (CORENOTE_R_OK);
1799 1841
1800 1842 case NT_LWPSINFO: /* lwpsinfo_t <sys/procfs.h> */
1801 1843 state.ns_vcol = 22;
1802 1844 state.ns_t2col = 42;
1803 1845 state.ns_v2col = 54;
1804 1846 dump_lwpsinfo(&state, MSG_ORIG(MSG_CNOTE_DESC_LWPSINFO_T));
1805 1847 return (CORENOTE_R_OK);
1806 1848
1807 1849 case NT_PRPRIV: /* prpriv_t <sys/procfs.h> */
1808 1850 state.ns_vcol = 21;
1809 1851 state.ns_t2col = 34;
1810 1852 state.ns_v2col = 38;
1811 1853 dump_prpriv(&state, MSG_ORIG(MSG_CNOTE_DESC_PRPRIV_T));
1812 1854 return (CORENOTE_R_OK);
1813 1855
1814 1856 case NT_PRPRIVINFO: /* priv_impl_info_t <sys/priv.h> */
1815 1857 state.ns_vcol = 29;
1816 1858 state.ns_t2col = 41;
1817 1859 state.ns_v2col = 56;
1818 1860 dump_priv_impl_info(&state,
1819 1861 MSG_ORIG(MSG_CNOTE_DESC_PRIV_IMPL_INFO_T));
1820 1862 return (CORENOTE_R_OK);
1821 1863
1822 1864 case NT_CONTENT: /* core_content_t <sys/corectl.h> */
1823 1865 if (sizeof (core_content_t) > descsz)
1824 1866 return (CORENOTE_R_BADDATA);
1825 1867 {
1826 1868 static sl_field_t fdesc = { 0, 8, 0, 0 };
1827 1869 Conv_cnote_cc_content_buf_t conv_buf;
1828 1870 core_content_t content;
1829 1871
1830 1872 state.ns_vcol = 8;
1831 1873 indent_enter(&state,
1832 1874 MSG_ORIG(MSG_CNOTE_DESC_CORE_CONTENT_T),
1833 1875 &fdesc);
1834 1876 content = extract_as_lword(&state, &fdesc);
1835 1877 print_str(&state, MSG_ORIG(MSG_STR_EMPTY),
1836 1878 conv_cnote_cc_content(content, 0, &conv_buf));
1837 1879 indent_exit(&state);
1838 1880 }
1839 1881 return (CORENOTE_R_OK);
1840 1882
1841 1883 case NT_ZONENAME: /* string from getzonenamebyid(3C) */
1842 1884 dbg_print(0, MSG_ORIG(MSG_NOTE_DESC));
1843 1885 dbg_print(0, MSG_ORIG(MSG_FMT_INDENT), safe_str(desc, descsz));
1844 1886 return (CORENOTE_R_OK);
1845 1887
1846 1888
1847 1889 case NT_FDINFO:
1848 1890 state.ns_vcol = 22;
1849 1891 state.ns_t2col = 41;
↓ open down ↓ |
740 lines elided |
↑ open up ↑ |
1850 1892 state.ns_v2col = 54;
1851 1893 dump_prfdinfo(&state, MSG_ORIG(MSG_CNOTE_DESC_PRFDINFO_T));
1852 1894 return (CORENOTE_R_OK);
1853 1895
1854 1896 case NT_SPYMASTER:
1855 1897 state.ns_vcol = 25;
1856 1898 state.ns_t2col = 45;
1857 1899 state.ns_v2col = 58;
1858 1900 dump_psinfo(&state, MSG_ORIG(MSG_CNOTE_DESC_PSINFO_T));
1859 1901 return (CORENOTE_R_OK);
1902 +
1903 + case NT_SECFLAGS:
1904 + state.ns_vcol = 23;
1905 + state.ns_t2col = 41;
1906 + state.ns_v2col = 54;
1907 + dump_secflags(&state, MSG_ORIG(MSG_CNOTE_DESC_PRSECFLAGS_T));
1908 + return (CORENOTE_R_OK);
1860 1909 }
1861 1910
1862 1911 return (CORENOTE_R_BADTYPE);
1863 1912 }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX