Print this page
Code review comments from jeffpc
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 + Lword lw;
841 + Word w;
842 +
843 + indent_enter(state, title, &layout->pr_version);
844 +
845 + w = extract_as_word(state, &layout->pr_version);
846 +
847 + if (w != PRSECFLAGS_VERSION_1) {
848 + PRINT_DEC(MSG_INTL(MSG_NOTE_BAD_SECFLAGS_VER), pr_version);
849 + dump_hex_bytes(state->ns_data, state->ns_len, state->ns_indent,
850 + 4, 3);
851 + } else {
852 + PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_VERSION), pr_version);
853 + lw = extract_as_lword(state, &layout->pr_effective);
854 + print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_EFFECTIVE),
855 + conv_prsecflags(lw, 0, &inv));
856 +
857 + lw = extract_as_lword(state, &layout->pr_inherit);
858 + print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_INHERIT),
859 + conv_prsecflags(lw, 0, &inv));
860 +
861 + lw = extract_as_lword(state, &layout->pr_lower);
862 + print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_LOWER),
863 + conv_prsecflags(lw, 0, &inv));
864 +
865 + lw = extract_as_lword(state, &layout->pr_upper);
866 + print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_UPPER),
867 + conv_prsecflags(lw, 0, &inv));
868 + }
869 +
870 + indent_exit(state);
871 +}
830 872
831 873 /*
832 874 * Output information from utsname structure.
833 875 */
834 876 static void
835 877 dump_utsname(note_state_t *state, const char *title)
836 878 {
837 879 const sl_utsname_layout_t *layout = state->ns_arch->utsname;
838 880
839 881 indent_enter(state, title, &layout->sysname);
840 882
841 883 PRINT_STRBUF(MSG_ORIG(MSG_CNOTE_T_UTS_SYSNAME), sysname);
842 884 PRINT_STRBUF(MSG_ORIG(MSG_CNOTE_T_UTS_NODENAME), nodename);
843 885 PRINT_STRBUF(MSG_ORIG(MSG_CNOTE_T_UTS_RELEASE), release);
844 886 PRINT_STRBUF(MSG_ORIG(MSG_CNOTE_T_UTS_VERSION), version);
845 887 PRINT_STRBUF(MSG_ORIG(MSG_CNOTE_T_UTS_MACHINE), machine);
846 888
847 889 indent_exit(state);
848 890 }
849 891
850 892
851 893 /*
852 894 * Dump register contents
853 895 */
854 896 static void
855 897 dump_prgregset(note_state_t *state, const char *title)
856 898 {
857 899 sl_field_t fdesc1, fdesc2;
858 900 sl_fmtbuf_t buf1, buf2;
859 901 Conv_inv_buf_t inv_buf1, inv_buf2;
860 902 Word w;
861 903
862 904 fdesc1 = fdesc2 = state->ns_arch->prgregset->elt0;
863 905 indent_enter(state, title, &fdesc1);
864 906
865 907 for (w = 0; w < fdesc1.slf_nelts; ) {
866 908 if (w == (fdesc1.slf_nelts - 1)) {
867 909 /* One last register is left */
868 910 if (!data_present(state, &fdesc1))
869 911 break;
870 912 dbg_print(0, MSG_ORIG(MSG_CNOTE_FMT_LINE),
871 913 INDENT, state->ns_vcol - state->ns_indent,
872 914 conv_cnote_pr_regname(state->ns_mach, w,
873 915 CONV_FMT_DECIMAL, &inv_buf1),
874 916 fmt_num(state, &fdesc1, SL_FMT_NUM_ZHEX, buf1));
875 917 fdesc1.slf_offset += fdesc1.slf_eltlen;
876 918 w++;
877 919 continue;
878 920 }
879 921
880 922 /* There are at least 2 more registers left. Show 2 up */
881 923 fdesc2.slf_offset = fdesc1.slf_offset + fdesc1.slf_eltlen;
882 924 if (!(data_present(state, &fdesc1) &&
883 925 data_present(state, &fdesc2)))
884 926 break;
885 927 dbg_print(0, MSG_ORIG(MSG_CNOTE_FMT_LINE_2UP), INDENT,
886 928 state->ns_vcol - state->ns_indent,
887 929 conv_cnote_pr_regname(state->ns_mach, w,
888 930 CONV_FMT_DECIMAL, &inv_buf1),
889 931 state->ns_t2col - state->ns_vcol,
890 932 fmt_num(state, &fdesc1, SL_FMT_NUM_ZHEX, buf1),
891 933 state->ns_v2col - state->ns_t2col,
892 934 conv_cnote_pr_regname(state->ns_mach, w + 1,
893 935 CONV_FMT_DECIMAL, &inv_buf2),
894 936 fmt_num(state, &fdesc2, SL_FMT_NUM_ZHEX, buf2));
895 937 fdesc1.slf_offset += 2 * fdesc1.slf_eltlen;
896 938 w += 2;
897 939 }
898 940
899 941 indent_exit(state);
900 942 }
901 943
902 944 /*
903 945 * Output information from lwpstatus_t structure.
904 946 */
905 947 static void
906 948 dump_lwpstatus(note_state_t *state, const char *title)
907 949 {
908 950 const sl_lwpstatus_layout_t *layout = state->ns_arch->lwpstatus;
909 951 Word w, w2;
910 952 int32_t i;
911 953 union {
912 954 Conv_inv_buf_t inv;
913 955 Conv_cnote_pr_flags_buf_t flags;
914 956 } conv_buf;
915 957
916 958 indent_enter(state, title, &layout->pr_flags);
917 959
918 960 if (data_present(state, &layout->pr_flags)) {
919 961 w = extract_as_word(state, &layout->pr_flags);
920 962 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_FLAGS),
921 963 conv_cnote_pr_flags(w, 0, &conv_buf.flags));
922 964 }
923 965
924 966 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_LWPID), pr_lwpid);
925 967
926 968 if (data_present(state, &layout->pr_why)) {
927 969 w = extract_as_word(state, &layout->pr_why);
928 970 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_WHY),
929 971 conv_cnote_pr_why(w, 0, &conv_buf.inv));
930 972
931 973 if (data_present(state, &layout->pr_what)) {
932 974 w2 = extract_as_word(state, &layout->pr_what);
933 975 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_WHAT),
934 976 conv_cnote_pr_what(w, w2, 0, &conv_buf.inv));
935 977 }
936 978 }
937 979
938 980 if (data_present(state, &layout->pr_cursig)) {
939 981 w = extract_as_word(state, &layout->pr_cursig);
940 982 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_CURSIG),
941 983 conv_cnote_signal(w, CONV_FMT_DECIMAL, &conv_buf.inv));
942 984 }
943 985
944 986 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_INFO), pr_info, dump_siginfo);
945 987 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_LWPPEND), pr_lwppend,
946 988 dump_sigset);
947 989 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_LWPHOLD), pr_lwphold,
948 990 dump_sigset);
949 991 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_ACTION), pr_action,
950 992 dump_sigaction);
951 993 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_ALTSTACK), pr_altstack,
952 994 dump_stack);
953 995
954 996 PRINT_ZHEX(MSG_ORIG(MSG_CNOTE_T_PR_OLDCONTEXT), pr_oldcontext);
955 997
956 998 if (data_present(state, &layout->pr_syscall)) {
957 999 w = extract_as_word(state, &layout->pr_syscall);
958 1000 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_SYSCALL),
959 1001 conv_cnote_syscall(w, CONV_FMT_DECIMAL, &conv_buf.inv));
960 1002 }
961 1003
962 1004 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_NSYSARG), pr_nsysarg);
963 1005
964 1006 if (data_present(state, &layout->pr_errno)) {
965 1007 w = extract_as_word(state, &layout->pr_errno);
966 1008 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_ERRNO),
967 1009 conv_cnote_errno(w, CONV_FMT_DECIMAL, &conv_buf.inv));
968 1010 }
969 1011
970 1012 if (data_present(state, &layout->pr_nsysarg)) {
971 1013 w2 = extract_as_word(state, &layout->pr_nsysarg);
972 1014 print_array(state, &layout->pr_sysarg, SL_FMT_NUM_ZHEX, w2, 1,
973 1015 MSG_ORIG(MSG_CNOTE_T_PR_SYSARG));
974 1016 }
975 1017
976 1018 PRINT_HEX_2UP(MSG_ORIG(MSG_CNOTE_T_PR_RVAL1), pr_rval1,
977 1019 MSG_ORIG(MSG_CNOTE_T_PR_RVAL2), pr_rval2);
978 1020 PRINT_STRBUF(MSG_ORIG(MSG_CNOTE_T_PR_CLNAME), pr_clname);
979 1021 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_TSTAMP), pr_tstamp,
980 1022 dump_timestruc);
981 1023 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_UTIME), pr_utime, dump_timestruc);
982 1024 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_STIME), pr_stime, dump_timestruc);
983 1025
984 1026 if (data_present(state, &layout->pr_errpriv)) {
985 1027 i = extract_as_sword(state, &layout->pr_errpriv);
986 1028 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_ERRPRIV),
987 1029 conv_cnote_priv(i, CONV_FMT_DECIMAL, &conv_buf.inv));
988 1030 }
989 1031
990 1032 PRINT_ZHEX_2UP(MSG_ORIG(MSG_CNOTE_T_PR_USTACK), pr_ustack,
991 1033 MSG_ORIG(MSG_CNOTE_T_PR_INSTR), pr_instr);
992 1034
993 1035 /*
994 1036 * In order to line up all the values in a single column,
995 1037 * we would have to set vcol to a very high value, which results
996 1038 * in ugly looking output that runs off column 80. So, we use
997 1039 * two levels of vcol, one for the contents so far, and a
998 1040 * higher one for the pr_reg sub-struct.
999 1041 */
1000 1042 state->ns_vcol += 3;
1001 1043 state->ns_t2col += 3;
1002 1044 state->ns_v2col += 2;
1003 1045 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_REG), pr_reg, dump_prgregset);
1004 1046 state->ns_vcol -= 3;
1005 1047 state->ns_t2col -= 3;
1006 1048 state->ns_v2col -= 2;
1007 1049
1008 1050 /*
1009 1051 * The floating point register state is complex, and highly
1010 1052 * platform dependent. For now, we simply display it as
1011 1053 * a hex dump. This can be replaced if better information
1012 1054 * is required.
1013 1055 */
1014 1056 if (data_present(state, &layout->pr_fpreg)) {
1015 1057 indent_enter(state, MSG_ORIG(MSG_CNOTE_T_PR_FPREG),
1016 1058 &layout->pr_fpreg);
1017 1059 dump_hex_bytes(layout->pr_fpreg.slf_offset + state->ns_data,
1018 1060 layout->pr_fpreg.slf_eltlen, state->ns_indent, 4, 3);
1019 1061 indent_exit(state);
1020 1062 }
1021 1063
1022 1064 indent_exit(state);
1023 1065 }
1024 1066
1025 1067
1026 1068 /*
1027 1069 * Output information from pstatus_t structure.
1028 1070 */
1029 1071 static void
1030 1072 dump_pstatus(note_state_t *state, const char *title)
1031 1073 {
1032 1074 const sl_pstatus_layout_t *layout = state->ns_arch->pstatus;
1033 1075 Word w;
1034 1076 union {
1035 1077 Conv_inv_buf_t inv;
1036 1078 Conv_cnote_pr_flags_buf_t flags;
1037 1079 } conv_buf;
1038 1080
1039 1081 indent_enter(state, title, &layout->pr_flags);
1040 1082
1041 1083 if (data_present(state, &layout->pr_flags)) {
1042 1084 w = extract_as_word(state, &layout->pr_flags);
1043 1085 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_FLAGS),
1044 1086 conv_cnote_pr_flags(w, 0, &conv_buf.flags));
1045 1087 }
1046 1088
1047 1089 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_NLWP), pr_nlwp);
1048 1090 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_PID), pr_pid,
1049 1091 MSG_ORIG(MSG_CNOTE_T_PR_PPID), pr_ppid);
1050 1092 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_PGID), pr_pgid,
1051 1093 MSG_ORIG(MSG_CNOTE_T_PR_SID), pr_sid);
1052 1094 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_ASLWPID), pr_aslwpid,
1053 1095 MSG_ORIG(MSG_CNOTE_T_PR_AGENTID), pr_agentid);
1054 1096 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_SIGPEND), pr_sigpend,
1055 1097 dump_sigset);
1056 1098 print_num_2up(state, MSG_ORIG(MSG_CNOTE_T_PR_BRKBASE),
1057 1099 &layout->pr_brkbase, SL_FMT_NUM_ZHEX,
1058 1100 MSG_ORIG(MSG_CNOTE_T_PR_BRKSIZE),
1059 1101 &layout->pr_brksize, SL_FMT_NUM_HEX);
1060 1102 print_num_2up(state, MSG_ORIG(MSG_CNOTE_T_PR_STKBASE),
1061 1103 &layout->pr_stkbase, SL_FMT_NUM_ZHEX,
1062 1104 MSG_ORIG(MSG_CNOTE_T_PR_STKSIZE),
1063 1105 &layout->pr_stksize, SL_FMT_NUM_HEX);
1064 1106 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_UTIME), pr_utime, dump_timestruc);
1065 1107 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_STIME), pr_stime, dump_timestruc);
1066 1108 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_CUTIME), pr_cutime,
1067 1109 dump_timestruc);
1068 1110 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_CSTIME), pr_cstime,
1069 1111 dump_timestruc);
1070 1112 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_SIGTRACE), pr_sigtrace,
1071 1113 dump_sigset);
1072 1114 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_FLTTRACE), pr_flttrace,
1073 1115 dump_fltset);
1074 1116 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_SYSENTRY), pr_sysentry,
1075 1117 dump_sysset);
1076 1118 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_SYSEXIT), pr_sysexit,
1077 1119 dump_sysset);
1078 1120
1079 1121 if (data_present(state, &layout->pr_dmodel)) {
1080 1122 w = extract_as_word(state, &layout->pr_dmodel);
1081 1123 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_DMODEL),
1082 1124 conv_cnote_pr_dmodel(w, 0, &conv_buf.inv));
1083 1125 }
1084 1126
1085 1127 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_TASKID), pr_taskid,
1086 1128 MSG_ORIG(MSG_CNOTE_T_PR_PROJID), pr_projid);
1087 1129 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_NZOMB), pr_nzomb,
1088 1130 MSG_ORIG(MSG_CNOTE_T_PR_ZONEID), pr_zoneid);
1089 1131
↓ open down ↓ |
250 lines elided |
↑ open up ↑ |
1090 1132 /*
1091 1133 * In order to line up all the values in a single column,
1092 1134 * we would have to set vcol to a very high value, which results
1093 1135 * in ugly looking output that runs off column 80. So, we use
1094 1136 * two levels of vcol, one for the contents so far, and a
1095 1137 * higher one for the pr_lwp sub-struct.
1096 1138 */
1097 1139 state->ns_vcol += 5;
1098 1140 state->ns_t2col += 5;
1099 1141 state->ns_v2col += 5;
1142 +
1100 1143 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_LWP), pr_lwp, dump_lwpstatus);
1101 1144 state->ns_vcol -= 5;
1102 1145 state->ns_t2col -= 5;
1103 1146 state->ns_v2col -= 5;
1104 1147
1105 1148 indent_exit(state);
1106 1149 }
1107 1150
1108 1151
1109 1152 /*
1110 1153 * Output information from prstatus_t (<sys/old_procfs.h>) structure.
1111 1154 */
1112 1155 static void
1113 1156 dump_prstatus(note_state_t *state, const char *title)
1114 1157 {
1115 1158 const sl_prstatus_layout_t *layout = state->ns_arch->prstatus;
1116 1159 Word w, w2;
1117 1160 int i;
1118 1161 union {
1119 1162 Conv_inv_buf_t inv;
1120 1163 Conv_cnote_old_pr_flags_buf_t flags;
1121 1164 } conv_buf;
1122 1165
1123 1166 indent_enter(state, title, &layout->pr_flags);
1124 1167
1125 1168 if (data_present(state, &layout->pr_flags)) {
1126 1169 w = extract_as_word(state, &layout->pr_flags);
1127 1170 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_FLAGS),
1128 1171 conv_cnote_old_pr_flags(w, 0, &conv_buf.flags));
1129 1172 }
1130 1173
1131 1174 if (data_present(state, &layout->pr_why)) {
1132 1175 w = extract_as_word(state, &layout->pr_why);
1133 1176 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_WHY),
1134 1177 conv_cnote_pr_why(w, 0, &conv_buf.inv));
1135 1178
1136 1179
1137 1180 if (data_present(state, &layout->pr_what)) {
1138 1181 w2 = extract_as_word(state, &layout->pr_what);
1139 1182 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_WHAT),
1140 1183 conv_cnote_pr_what(w, w2, 0, &conv_buf.inv));
1141 1184 }
1142 1185 }
1143 1186
1144 1187 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_INFO), pr_info, dump_siginfo);
1145 1188
1146 1189 if (data_present(state, &layout->pr_cursig)) {
1147 1190 w = extract_as_word(state, &layout->pr_cursig);
1148 1191 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_CURSIG),
1149 1192 conv_cnote_signal(w, CONV_FMT_DECIMAL, &conv_buf.inv));
1150 1193 }
1151 1194
1152 1195 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_NLWP), pr_nlwp);
1153 1196 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_SIGPEND), pr_sigpend,
1154 1197 dump_sigset);
1155 1198 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_SIGHOLD), pr_sighold,
1156 1199 dump_sigset);
1157 1200 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_ALTSTACK), pr_altstack,
1158 1201 dump_stack);
1159 1202 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_ACTION), pr_action,
1160 1203 dump_sigaction);
1161 1204 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_PID), pr_pid,
1162 1205 MSG_ORIG(MSG_CNOTE_T_PR_PPID), pr_ppid);
1163 1206 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_PGRP), pr_pgrp,
1164 1207 MSG_ORIG(MSG_CNOTE_T_PR_SID), pr_sid);
1165 1208 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_UTIME), pr_utime, dump_timestruc);
1166 1209 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_STIME), pr_stime, dump_timestruc);
1167 1210 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_CUTIME), pr_cutime,
1168 1211 dump_timestruc);
1169 1212 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_CSTIME), pr_cstime,
1170 1213 dump_timestruc);
1171 1214 PRINT_STRBUF(MSG_ORIG(MSG_CNOTE_T_PR_CLNAME), pr_clname);
1172 1215
1173 1216 if (data_present(state, &layout->pr_syscall)) {
1174 1217 w = extract_as_word(state, &layout->pr_syscall);
1175 1218 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_SYSCALL),
1176 1219 conv_cnote_syscall(w, CONV_FMT_DECIMAL, &conv_buf.inv));
1177 1220 }
1178 1221
1179 1222 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_NSYSARG), pr_nsysarg);
1180 1223
1181 1224 if (data_present(state, &layout->pr_nsysarg)) {
1182 1225 w2 = extract_as_word(state, &layout->pr_nsysarg);
1183 1226 print_array(state, &layout->pr_sysarg, SL_FMT_NUM_ZHEX, w2, 1,
1184 1227 MSG_ORIG(MSG_CNOTE_T_PR_SYSARG));
1185 1228 }
1186 1229
1187 1230 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_WHO), pr_who);
1188 1231 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_LWPPEND), pr_sigpend,
1189 1232 dump_sigset);
1190 1233 PRINT_ZHEX(MSG_ORIG(MSG_CNOTE_T_PR_OLDCONTEXT), pr_oldcontext);
1191 1234 print_num_2up(state, MSG_ORIG(MSG_CNOTE_T_PR_BRKBASE),
1192 1235 &layout->pr_brkbase, SL_FMT_NUM_ZHEX,
1193 1236 MSG_ORIG(MSG_CNOTE_T_PR_BRKSIZE),
1194 1237 &layout->pr_brksize, SL_FMT_NUM_HEX);
1195 1238 print_num_2up(state, MSG_ORIG(MSG_CNOTE_T_PR_STKBASE),
1196 1239 &layout->pr_stkbase, SL_FMT_NUM_ZHEX,
1197 1240 MSG_ORIG(MSG_CNOTE_T_PR_STKSIZE),
1198 1241 &layout->pr_stksize, SL_FMT_NUM_HEX);
1199 1242 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_PROCESSOR), pr_processor);
1200 1243
1201 1244 if (data_present(state, &layout->pr_bind)) {
1202 1245 i = extract_as_sword(state, &layout->pr_bind);
1203 1246 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_BIND),
1204 1247 conv_cnote_psetid(i, CONV_FMT_DECIMAL, &conv_buf.inv));
1205 1248 }
1206 1249
1207 1250 PRINT_ZHEX(MSG_ORIG(MSG_CNOTE_T_PR_INSTR), pr_instr);
1208 1251 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_REG), pr_reg, dump_prgregset);
1209 1252
1210 1253 indent_exit(state);
1211 1254 }
1212 1255
1213 1256
1214 1257 /*
1215 1258 * Print percent from 16-bit binary fraction [0 .. 1]
1216 1259 * Round up .01 to .1 to indicate some small percentage (the 0x7000 below).
1217 1260 *
1218 1261 * Note: This routine was copied from ps(1) and then modified.
1219 1262 */
1220 1263 static const char *
1221 1264 prtpct_value(note_state_t *state, const sl_field_t *fdesc,
1222 1265 sl_fmtbuf_t buf)
1223 1266 {
1224 1267 uint_t value; /* need 32 bits to compute with */
1225 1268
1226 1269 value = extract_as_word(state, fdesc);
1227 1270 value = ((value * 1000) + 0x7000) >> 15; /* [0 .. 1000] */
1228 1271 if (value >= 1000)
1229 1272 value = 999;
1230 1273
1231 1274 (void) snprintf(buf, sizeof (sl_fmtbuf_t),
1232 1275 MSG_ORIG(MSG_CNOTE_FMT_PRTPCT), value / 10, value % 10);
1233 1276
1234 1277 return (buf);
1235 1278 }
1236 1279
1237 1280
1238 1281
1239 1282 /*
1240 1283 * Version of prtpct() used for a 2-up display of two adjacent percentages.
1241 1284 */
1242 1285 static void
1243 1286 prtpct_2up(note_state_t *state, const sl_field_t *fdesc1,
1244 1287 const char *title1, const sl_field_t *fdesc2, const char *title2)
1245 1288 {
1246 1289 sl_fmtbuf_t buf1, buf2;
1247 1290
1248 1291 if (!(data_present(state, fdesc1) &&
1249 1292 data_present(state, fdesc2)))
1250 1293 return;
1251 1294
1252 1295 dbg_print(0, MSG_ORIG(MSG_CNOTE_FMT_LINE_2UP), INDENT,
1253 1296 state->ns_vcol - state->ns_indent, title1,
1254 1297 state->ns_t2col - state->ns_vcol,
1255 1298 prtpct_value(state, fdesc1, buf1),
1256 1299 state->ns_v2col - state->ns_t2col, title2,
1257 1300 prtpct_value(state, fdesc2, buf2));
1258 1301 }
1259 1302
1260 1303
1261 1304 /*
1262 1305 * The psinfo_t and prpsinfo_t structs have pr_state and pr_sname
1263 1306 * fields that we wish to print in a 2up format. The pr_state is
1264 1307 * an integer, while pr_sname is a single character.
1265 1308 */
1266 1309 static void
1267 1310 print_state_sname_2up(note_state_t *state,
1268 1311 const sl_field_t *state_fdesc,
1269 1312 const sl_field_t *sname_fdesc)
1270 1313 {
1271 1314 sl_fmtbuf_t buf1, buf2;
1272 1315 int sname;
1273 1316
1274 1317 /*
1275 1318 * If the field slf_offset and extent fall past the end of the
1276 1319 * available data, then return without doing anything. That note
1277 1320 * is from an older core file that doesn't have all the fields
1278 1321 * that we know about.
1279 1322 */
1280 1323 if (!(data_present(state, state_fdesc) &&
1281 1324 data_present(state, sname_fdesc)))
1282 1325 return;
1283 1326
1284 1327 sname = extract_as_sword(state, sname_fdesc);
1285 1328 buf2[0] = sname;
1286 1329 buf2[1] = '\0';
1287 1330
1288 1331 dbg_print(0, MSG_ORIG(MSG_CNOTE_FMT_LINE_2UP), INDENT,
1289 1332 state->ns_vcol - state->ns_indent, MSG_ORIG(MSG_CNOTE_T_PR_STATE),
1290 1333 state->ns_t2col - state->ns_vcol,
1291 1334 fmt_num(state, state_fdesc, SL_FMT_NUM_DEC, buf1),
1292 1335 state->ns_v2col - state->ns_t2col, MSG_ORIG(MSG_CNOTE_T_PR_SNAME),
1293 1336 buf2);
1294 1337 }
1295 1338
1296 1339 /*
1297 1340 * Output information from lwpsinfo_t structure.
1298 1341 */
1299 1342 static void
1300 1343 dump_lwpsinfo(note_state_t *state, const char *title)
1301 1344 {
1302 1345 const sl_lwpsinfo_layout_t *layout = state->ns_arch->lwpsinfo;
1303 1346 Word w;
1304 1347 int32_t i;
1305 1348 union {
1306 1349 Conv_cnote_proc_flag_buf_t proc_flag;
1307 1350 Conv_inv_buf_t inv;
1308 1351 } conv_buf;
1309 1352
1310 1353 indent_enter(state, title, &layout->pr_flag);
1311 1354
1312 1355 if (data_present(state, &layout->pr_flag)) {
1313 1356 w = extract_as_word(state, &layout->pr_flag);
1314 1357 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_FLAG),
1315 1358 conv_cnote_proc_flag(w, 0, &conv_buf.proc_flag));
1316 1359 }
1317 1360
1318 1361 print_num_2up(state, MSG_ORIG(MSG_CNOTE_T_PR_LWPID), &layout->pr_lwpid,
1319 1362 SL_FMT_NUM_DEC, MSG_ORIG(MSG_CNOTE_T_PR_ADDR), &layout->pr_addr,
1320 1363 SL_FMT_NUM_ZHEX);
1321 1364 PRINT_HEX(MSG_ORIG(MSG_CNOTE_T_PR_WCHAN), pr_wchan);
1322 1365
1323 1366 if (data_present(state, &layout->pr_stype)) {
1324 1367 w = extract_as_word(state, &layout->pr_stype);
1325 1368 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_STYPE),
1326 1369 conv_cnote_pr_stype(w, CONV_FMT_DECIMAL, &conv_buf.inv));
1327 1370 }
1328 1371
1329 1372 print_state_sname_2up(state, &layout->pr_state, &layout->pr_sname);
1330 1373
1331 1374 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_NICE), pr_nice);
1332 1375
1333 1376 if (data_present(state, &layout->pr_syscall)) {
1334 1377 w = extract_as_word(state, &layout->pr_syscall);
1335 1378 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_SYSCALL),
1336 1379 conv_cnote_syscall(w, CONV_FMT_DECIMAL, &conv_buf.inv));
1337 1380 }
1338 1381
1339 1382 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_OLDPRI), pr_oldpri,
1340 1383 MSG_ORIG(MSG_CNOTE_T_PR_CPU), pr_cpu);
1341 1384
1342 1385 if (data_present(state, &layout->pr_pri) &&
1343 1386 data_present(state, &layout->pr_pctcpu)) {
1344 1387 sl_fmtbuf_t buf1, buf2;
1345 1388
1346 1389 dbg_print(0, MSG_ORIG(MSG_CNOTE_FMT_LINE_2UP), INDENT,
1347 1390 state->ns_vcol - state->ns_indent,
1348 1391 MSG_ORIG(MSG_CNOTE_T_PR_PRI),
1349 1392 state->ns_t2col - state->ns_vcol,
1350 1393 fmt_num(state, &layout->pr_pri, SL_FMT_NUM_DEC, buf1),
1351 1394 state->ns_v2col - state->ns_t2col,
1352 1395 MSG_ORIG(MSG_CNOTE_T_PR_PCTCPU),
1353 1396 prtpct_value(state, &layout->pr_pctcpu, buf2));
1354 1397 }
1355 1398
1356 1399 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_START), pr_start, dump_timestruc);
1357 1400 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_TIME), pr_time, dump_timestruc);
1358 1401 PRINT_STRBUF(MSG_ORIG(MSG_CNOTE_T_PR_CLNAME), pr_clname);
1359 1402 PRINT_STRBUF(MSG_ORIG(MSG_CNOTE_T_PR_NAME), pr_name);
1360 1403 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_ONPRO), pr_onpro,
1361 1404 MSG_ORIG(MSG_CNOTE_T_PR_BINDPRO), pr_bindpro);
1362 1405
1363 1406 if (data_present(state, &layout->pr_bindpset)) {
1364 1407 i = extract_as_sword(state, &layout->pr_bindpset);
1365 1408 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_BINDPSET),
1366 1409 conv_cnote_psetid(i, CONV_FMT_DECIMAL, &conv_buf.inv));
1367 1410 }
1368 1411
1369 1412 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_LGRP), pr_lgrp);
1370 1413
1371 1414 indent_exit(state);
1372 1415 }
1373 1416
1374 1417
1375 1418 /*
1376 1419 * Output information from psinfo_t structure.
1377 1420 */
1378 1421 static void
1379 1422 dump_psinfo(note_state_t *state, const char *title)
1380 1423 {
1381 1424 const sl_psinfo_layout_t *layout = state->ns_arch->psinfo;
1382 1425 Word w;
1383 1426 union {
1384 1427 Conv_cnote_proc_flag_buf_t proc_flag;
1385 1428 Conv_inv_buf_t inv;
1386 1429 } conv_buf;
1387 1430
1388 1431 indent_enter(state, title, &layout->pr_flag);
1389 1432
1390 1433 if (data_present(state, &layout->pr_flag)) {
1391 1434 w = extract_as_word(state, &layout->pr_flag);
1392 1435 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_FLAG),
1393 1436 conv_cnote_proc_flag(w, 0, &conv_buf.proc_flag));
1394 1437 }
1395 1438
1396 1439 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_NLWP), pr_nlwp);
1397 1440 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_PID), pr_pid,
1398 1441 MSG_ORIG(MSG_CNOTE_T_PR_PPID), pr_ppid);
1399 1442 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_PGID), pr_pgid,
1400 1443 MSG_ORIG(MSG_CNOTE_T_PR_SID), pr_sid);
1401 1444 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_UID), pr_uid,
1402 1445 MSG_ORIG(MSG_CNOTE_T_PR_EUID), pr_euid);
1403 1446 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_GID), pr_gid,
1404 1447 MSG_ORIG(MSG_CNOTE_T_PR_EGID), pr_egid);
1405 1448 print_num_2up(state, MSG_ORIG(MSG_CNOTE_T_PR_ADDR), &layout->pr_addr,
1406 1449 SL_FMT_NUM_ZHEX, MSG_ORIG(MSG_CNOTE_T_PR_SIZE), &layout->pr_size,
1407 1450 SL_FMT_NUM_HEX);
1408 1451 print_num_2up(state, MSG_ORIG(MSG_CNOTE_T_PR_RSSIZE),
1409 1452 &layout->pr_rssize, SL_FMT_NUM_HEX, MSG_ORIG(MSG_CNOTE_T_PR_TTYDEV),
1410 1453 &layout->pr_ttydev, SL_FMT_NUM_DEC);
1411 1454 prtpct_2up(state, &layout->pr_pctcpu, MSG_ORIG(MSG_CNOTE_T_PR_PCTCPU),
1412 1455 &layout->pr_pctmem, MSG_ORIG(MSG_CNOTE_T_PR_PCTMEM));
1413 1456 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_START), pr_start, dump_timestruc);
1414 1457 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_TIME), pr_time, dump_timestruc);
1415 1458 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_CTIME), pr_ctime, dump_timestruc);
1416 1459 PRINT_STRBUF(MSG_ORIG(MSG_CNOTE_T_PR_FNAME), pr_fname);
1417 1460 PRINT_STRBUF(MSG_ORIG(MSG_CNOTE_T_PR_PSARGS), pr_psargs);
1418 1461 print_num_2up(state, MSG_ORIG(MSG_CNOTE_T_PR_WSTAT), &layout->pr_wstat,
1419 1462 SL_FMT_NUM_HEX, MSG_ORIG(MSG_CNOTE_T_PR_ARGC), &layout->pr_argc,
1420 1463 SL_FMT_NUM_DEC);
1421 1464 PRINT_ZHEX_2UP(MSG_ORIG(MSG_CNOTE_T_PR_ARGV), pr_argv,
1422 1465 MSG_ORIG(MSG_CNOTE_T_PR_ENVP), pr_envp);
1423 1466
1424 1467 if (data_present(state, &layout->pr_dmodel)) {
1425 1468 w = extract_as_word(state, &layout->pr_dmodel);
1426 1469 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_DMODEL),
1427 1470 conv_cnote_pr_dmodel(w, 0, &conv_buf.inv));
1428 1471 }
1429 1472
1430 1473 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_TASKID), pr_taskid,
1431 1474 MSG_ORIG(MSG_CNOTE_T_PR_PROJID), pr_projid);
1432 1475 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_NZOMB), pr_nzomb,
1433 1476 MSG_ORIG(MSG_CNOTE_T_PR_POOLID), pr_poolid);
1434 1477 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_ZONEID), pr_zoneid,
1435 1478 MSG_ORIG(MSG_CNOTE_T_PR_CONTRACT), pr_contract);
1436 1479
1437 1480 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_LWP), pr_lwp, dump_lwpsinfo);
1438 1481
1439 1482 indent_exit(state);
1440 1483 }
1441 1484
1442 1485 /*
1443 1486 * Output information from prpsinfo_t structure.
1444 1487 */
1445 1488 static void
1446 1489 dump_prpsinfo(note_state_t *state, const char *title)
1447 1490 {
1448 1491 const sl_prpsinfo_layout_t *layout = state->ns_arch->prpsinfo;
1449 1492 Word w;
1450 1493 union {
1451 1494 Conv_cnote_proc_flag_buf_t proc_flag;
1452 1495 Conv_inv_buf_t inv;
1453 1496 } conv_buf;
1454 1497
1455 1498 indent_enter(state, title, &layout->pr_state);
1456 1499
1457 1500 print_state_sname_2up(state, &layout->pr_state, &layout->pr_sname);
1458 1501 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_ZOMB), pr_zomb,
1459 1502 MSG_ORIG(MSG_CNOTE_T_PR_NICE), pr_nice);
1460 1503
1461 1504 if (data_present(state, &layout->pr_flag)) {
1462 1505 w = extract_as_word(state, &layout->pr_flag);
1463 1506 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_FLAG),
1464 1507 conv_cnote_proc_flag(w, 0, &conv_buf.proc_flag));
1465 1508 }
1466 1509
1467 1510
1468 1511 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_UID), pr_uid,
1469 1512 MSG_ORIG(MSG_CNOTE_T_PR_GID), pr_gid);
1470 1513 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_PID), pr_pid,
1471 1514 MSG_ORIG(MSG_CNOTE_T_PR_PPID), pr_ppid);
1472 1515 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_PGRP), pr_pgrp,
1473 1516 MSG_ORIG(MSG_CNOTE_T_PR_SID), pr_sid);
1474 1517 print_num_2up(state, MSG_ORIG(MSG_CNOTE_T_PR_ADDR), &layout->pr_addr,
1475 1518 SL_FMT_NUM_ZHEX, MSG_ORIG(MSG_CNOTE_T_PR_SIZE), &layout->pr_size,
1476 1519 SL_FMT_NUM_HEX);
1477 1520 PRINT_HEX_2UP(MSG_ORIG(MSG_CNOTE_T_PR_RSSIZE), pr_rssize,
1478 1521 MSG_ORIG(MSG_CNOTE_T_PR_WCHAN), pr_wchan);
1479 1522 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_START), pr_start, dump_timestruc);
1480 1523 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_TIME), pr_time, dump_timestruc);
1481 1524 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_PRI), pr_pri,
1482 1525 MSG_ORIG(MSG_CNOTE_T_PR_OLDPRI), pr_oldpri);
1483 1526 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_CPU), pr_cpu);
1484 1527 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_OTTYDEV), pr_ottydev,
1485 1528 MSG_ORIG(MSG_CNOTE_T_PR_LTTYDEV), pr_lttydev);
1486 1529 PRINT_STRBUF(MSG_ORIG(MSG_CNOTE_T_PR_CLNAME), pr_clname);
1487 1530 PRINT_STRBUF(MSG_ORIG(MSG_CNOTE_T_PR_FNAME), pr_fname);
1488 1531 PRINT_STRBUF(MSG_ORIG(MSG_CNOTE_T_PR_PSARGS), pr_psargs);
1489 1532
1490 1533 if (data_present(state, &layout->pr_syscall)) {
1491 1534 w = extract_as_word(state, &layout->pr_syscall);
1492 1535 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_SYSCALL),
1493 1536 conv_cnote_syscall(w, CONV_FMT_DECIMAL, &conv_buf.inv));
1494 1537 }
1495 1538
1496 1539 PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_CTIME), pr_ctime, dump_timestruc);
1497 1540 PRINT_HEX_2UP(MSG_ORIG(MSG_CNOTE_T_PR_BYSIZE), pr_bysize,
1498 1541 MSG_ORIG(MSG_CNOTE_T_PR_BYRSSIZE), pr_byrssize);
1499 1542 print_num_2up(state, MSG_ORIG(MSG_CNOTE_T_PR_ARGC), &layout->pr_argc,
1500 1543 SL_FMT_NUM_DEC, MSG_ORIG(MSG_CNOTE_T_PR_ARGV), &layout->pr_argv,
1501 1544 SL_FMT_NUM_ZHEX);
1502 1545 print_num_2up(state, MSG_ORIG(MSG_CNOTE_T_PR_ENVP), &layout->pr_envp,
1503 1546 SL_FMT_NUM_ZHEX, MSG_ORIG(MSG_CNOTE_T_PR_WSTAT), &layout->pr_wstat,
1504 1547 SL_FMT_NUM_HEX);
1505 1548 prtpct_2up(state, &layout->pr_pctcpu, MSG_ORIG(MSG_CNOTE_T_PR_PCTCPU),
1506 1549 &layout->pr_pctmem, MSG_ORIG(MSG_CNOTE_T_PR_PCTMEM));
1507 1550 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_EUID), pr_euid,
1508 1551 MSG_ORIG(MSG_CNOTE_T_PR_EGID), pr_egid);
1509 1552 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_ASLWPID), pr_aslwpid);
1510 1553
1511 1554 if (data_present(state, &layout->pr_dmodel)) {
1512 1555 w = extract_as_word(state, &layout->pr_dmodel);
1513 1556 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_DMODEL),
1514 1557 conv_cnote_pr_dmodel(w, 0, &conv_buf.inv));
1515 1558 }
1516 1559
1517 1560 indent_exit(state);
1518 1561 }
1519 1562
1520 1563
1521 1564 /*
1522 1565 * Output information from prcred_t structure.
1523 1566 */
1524 1567 static void
1525 1568 dump_prcred(note_state_t *state, const char *title)
1526 1569 {
1527 1570 const sl_prcred_layout_t *layout = state->ns_arch->prcred;
1528 1571 Word ngroups;
1529 1572
1530 1573 indent_enter(state, title, &layout->pr_euid);
1531 1574
1532 1575 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_EUID), pr_euid,
1533 1576 MSG_ORIG(MSG_CNOTE_T_PR_RUID), pr_ruid);
1534 1577 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_SUID), pr_suid,
1535 1578 MSG_ORIG(MSG_CNOTE_T_PR_EGID), pr_egid);
1536 1579 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_RGID), pr_rgid,
1537 1580 MSG_ORIG(MSG_CNOTE_T_PR_SGID), pr_sgid);
1538 1581 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_NGROUPS), pr_ngroups);
1539 1582
1540 1583 if (data_present(state, &layout->pr_ngroups)) {
1541 1584 ngroups = extract_as_word(state, &layout->pr_ngroups);
1542 1585 print_array(state, &layout->pr_groups, SL_FMT_NUM_DEC, ngroups,
1543 1586 0, MSG_ORIG(MSG_CNOTE_T_PR_GROUPS));
1544 1587 }
1545 1588
1546 1589 indent_exit(state);
1547 1590 }
1548 1591
1549 1592
1550 1593 /*
1551 1594 * Output information from prpriv_t structure.
1552 1595 */
1553 1596 static void
1554 1597 dump_prpriv(note_state_t *state, const char *title)
1555 1598 {
1556 1599 const sl_prpriv_layout_t *layout = state->ns_arch->prpriv;
1557 1600 Word nsets;
1558 1601
1559 1602 indent_enter(state, title, &layout->pr_nsets);
1560 1603
1561 1604 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_NSETS), pr_nsets);
1562 1605 PRINT_HEX(MSG_ORIG(MSG_CNOTE_T_PR_SETSIZE), pr_setsize);
1563 1606 PRINT_HEX(MSG_ORIG(MSG_CNOTE_T_PR_INFOSIZE), pr_infosize);
1564 1607
1565 1608 if (data_present(state, &layout->pr_nsets)) {
1566 1609 nsets = extract_as_word(state, &layout->pr_nsets);
1567 1610 print_array(state, &layout->pr_sets, SL_FMT_NUM_ZHEX, nsets,
1568 1611 0, MSG_ORIG(MSG_CNOTE_T_PR_SETS));
1569 1612 }
1570 1613
1571 1614 indent_exit(state);
1572 1615 }
1573 1616
1574 1617 static void
1575 1618 dump_prfdinfo(note_state_t *state, const char *title)
1576 1619 {
1577 1620 const sl_prfdinfo_layout_t *layout = state->ns_arch->prfdinfo;
1578 1621 char buf[1024];
1579 1622 uint32_t fileflags, mode;
1580 1623
1581 1624 indent_enter(state, title, &layout->pr_fd);
1582 1625
1583 1626 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_FD), pr_fd);
1584 1627 mode = extract_as_word(state, &layout->pr_mode);
1585 1628
1586 1629 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_MODE),
1587 1630 conv_cnote_filemode(mode, 0, buf, sizeof (buf)));
1588 1631
1589 1632 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_UID), pr_uid,
1590 1633 MSG_ORIG(MSG_CNOTE_T_PR_GID), pr_gid);
1591 1634
1592 1635 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_MAJOR), pr_major,
1593 1636 MSG_ORIG(MSG_CNOTE_T_PR_MINOR), pr_minor);
1594 1637 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_RMAJOR), pr_rmajor,
1595 1638 MSG_ORIG(MSG_CNOTE_T_PR_RMINOR), pr_rminor);
1596 1639
1597 1640 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_INO), pr_ino);
1598 1641
1599 1642 PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_PR_SIZE), pr_size,
1600 1643 MSG_ORIG(MSG_CNOTE_T_PR_OFFSET), pr_offset);
1601 1644
1602 1645 fileflags = extract_as_word(state, &layout->pr_fileflags);
1603 1646
1604 1647 print_str(state, MSG_ORIG(MSG_CNOTE_T_PR_FILEFLAGS),
1605 1648 conv_cnote_fileflags(fileflags, 0, buf, sizeof (buf)));
1606 1649
1607 1650 PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PR_FDFLAGS), pr_fdflags);
1608 1651
1609 1652 PRINT_STRBUF(MSG_ORIG(MSG_CNOTE_T_PR_PATH), pr_path);
1610 1653
1611 1654 indent_exit(state);
1612 1655 }
1613 1656
1614 1657 /*
1615 1658 * Output information from priv_impl_info_t structure.
1616 1659 */
1617 1660 static void
1618 1661 dump_priv_impl_info(note_state_t *state, const char *title)
1619 1662 {
1620 1663 const sl_priv_impl_info_layout_t *layout;
1621 1664
1622 1665 layout = state->ns_arch->priv_impl_info;
1623 1666 indent_enter(state, title, &layout->priv_headersize);
1624 1667
1625 1668 PRINT_HEX_2UP(MSG_ORIG(MSG_CNOTE_T_PRIV_HEADERSIZE), priv_headersize,
1626 1669 MSG_ORIG(MSG_CNOTE_T_PRIV_FLAGS), priv_flags);
1627 1670
1628 1671 print_num_2up(state, MSG_ORIG(MSG_CNOTE_T_PRIV_NSETS),
1629 1672 &layout->priv_nsets, SL_FMT_NUM_DEC,
1630 1673 MSG_ORIG(MSG_CNOTE_T_PRIV_SETSIZE), &layout->priv_setsize,
1631 1674 SL_FMT_NUM_HEX);
1632 1675 print_num_2up(state, MSG_ORIG(MSG_CNOTE_T_PRIV_MAX), &layout->priv_max,
1633 1676 SL_FMT_NUM_DEC, MSG_ORIG(MSG_CNOTE_T_PRIV_INFOSIZE),
1634 1677 &layout->priv_infosize, SL_FMT_NUM_HEX);
1635 1678 PRINT_HEX(MSG_ORIG(MSG_CNOTE_T_PRIV_GLOBALINFOSIZE),
1636 1679 priv_globalinfosize);
1637 1680
1638 1681 indent_exit(state);
1639 1682 }
1640 1683
1641 1684
1642 1685 /*
1643 1686 * Dump information from an asrset_t array. This data
1644 1687 * structure is specific to sparcv9, and does not appear
1645 1688 * on any other platform.
1646 1689 *
1647 1690 * asrset_t is a simple array, defined in <sys/regset.h> as
1648 1691 * typedef int64_t asrset_t[16]; %asr16 - > %asr31
1649 1692 *
1650 1693 * As such, we do not make use of the struct_layout facilities
1651 1694 * for this routine.
1652 1695 */
1653 1696 static void
1654 1697 dump_asrset(note_state_t *state, const char *title)
1655 1698 {
1656 1699 static const sl_field_t ftemplate = { 0, sizeof (int64_t), 16, 0 };
1657 1700 sl_field_t fdesc1, fdesc2;
1658 1701 sl_fmtbuf_t buf1, buf2;
1659 1702 char index1[MAXNDXSIZE * 2], index2[MAXNDXSIZE * 2];
1660 1703 Word w, nelts;
1661 1704
1662 1705 fdesc1 = fdesc2 = ftemplate;
1663 1706
1664 1707 /* We expect 16 values, but will print whatever is actually there */
1665 1708 nelts = state->ns_len / ftemplate.slf_eltlen;
1666 1709 if (nelts == 0)
1667 1710 return;
1668 1711
1669 1712 indent_enter(state, title, &fdesc1);
1670 1713
1671 1714 for (w = 0; w < nelts; ) {
1672 1715 (void) snprintf(index1, sizeof (index1),
1673 1716 MSG_ORIG(MSG_FMT_ASRINDEX), w + 16);
1674 1717
1675 1718 if (w == (nelts - 1)) {
1676 1719 /* One last register is left */
1677 1720 dbg_print(0, MSG_ORIG(MSG_CNOTE_FMT_LINE),
1678 1721 INDENT, state->ns_vcol - state->ns_indent, index1,
1679 1722 fmt_num(state, &fdesc1, SL_FMT_NUM_ZHEX, buf1));
1680 1723 fdesc1.slf_offset += fdesc1.slf_eltlen;
1681 1724 w++;
1682 1725 continue;
1683 1726 }
1684 1727
1685 1728 /* There are at least 2 more registers left. Show 2 up */
1686 1729 (void) snprintf(index2, sizeof (index2),
1687 1730 MSG_ORIG(MSG_FMT_ASRINDEX), w + 17);
1688 1731
1689 1732 fdesc2.slf_offset = fdesc1.slf_offset + fdesc1.slf_eltlen;
1690 1733 dbg_print(0, MSG_ORIG(MSG_CNOTE_FMT_LINE_2UP), INDENT,
1691 1734 state->ns_vcol - state->ns_indent, index1,
1692 1735 state->ns_t2col - state->ns_vcol,
1693 1736 fmt_num(state, &fdesc1, SL_FMT_NUM_ZHEX, buf1),
1694 1737 state->ns_v2col - state->ns_t2col, index2,
1695 1738 fmt_num(state, &fdesc2, SL_FMT_NUM_ZHEX, buf2));
1696 1739 fdesc1.slf_offset += 2 * fdesc1.slf_eltlen;
1697 1740 w += 2;
1698 1741 }
1699 1742
1700 1743 indent_exit(state);
1701 1744 }
1702 1745
1703 1746 corenote_ret_t
1704 1747 corenote(Half mach, int do_swap, Word type,
1705 1748 const char *desc, Word descsz)
1706 1749 {
1707 1750 note_state_t state;
1708 1751
1709 1752 /*
1710 1753 * Get the per-architecture layout definition
1711 1754 */
1712 1755 state.ns_mach = mach;
1713 1756 state.ns_arch = sl_mach(state.ns_mach);
1714 1757 if (sl_mach(state.ns_mach) == NULL)
1715 1758 return (CORENOTE_R_BADARCH);
1716 1759
1717 1760 state.ns_swap = do_swap;
1718 1761 state.ns_indent = 4;
1719 1762 state.ns_t2col = state.ns_v2col = 0;
1720 1763 state.ns_data = desc;
1721 1764 state.ns_len = descsz;
1722 1765
1723 1766 switch (type) {
1724 1767 case NT_PRSTATUS: /* prstatus_t <sys/old_procfs.h> */
1725 1768 state.ns_vcol = 26;
1726 1769 state.ns_t2col = 46;
1727 1770 state.ns_v2col = 60;
1728 1771 dump_prstatus(&state, MSG_ORIG(MSG_CNOTE_DESC_PRSTATUS_T));
1729 1772 return (CORENOTE_R_OK);
1730 1773
1731 1774 case NT_PRFPREG: /* prfpregset_t <sys/procfs_isa.h> */
1732 1775 return (CORENOTE_R_OK_DUMP);
1733 1776
1734 1777 case NT_PRPSINFO: /* prpsinfo_t <sys/old_procfs.h> */
1735 1778 state.ns_vcol = 20;
1736 1779 state.ns_t2col = 41;
1737 1780 state.ns_v2col = 54;
1738 1781 dump_prpsinfo(&state, MSG_ORIG(MSG_CNOTE_DESC_PRPSINFO_T));
1739 1782 return (CORENOTE_R_OK);
1740 1783
1741 1784 case NT_PRXREG: /* prxregset_t <sys/procfs_isa.h> */
1742 1785 return (CORENOTE_R_OK_DUMP);
1743 1786
1744 1787 case NT_PLATFORM: /* string from sysinfo(SI_PLATFORM) */
1745 1788 dbg_print(0, MSG_ORIG(MSG_NOTE_DESC));
1746 1789 dbg_print(0, MSG_ORIG(MSG_FMT_INDENT), safe_str(desc, descsz));
1747 1790 return (CORENOTE_R_OK);
1748 1791
1749 1792 case NT_AUXV: /* auxv_t array <sys/auxv.h> */
1750 1793 state.ns_vcol = 18;
1751 1794 dump_auxv(&state, MSG_ORIG(MSG_CNOTE_DESC_AUXV_T));
1752 1795 return (CORENOTE_R_OK);
1753 1796
1754 1797 case NT_GWINDOWS: /* gwindows_t SPARC only */
1755 1798 return (CORENOTE_R_OK_DUMP);
1756 1799
1757 1800 case NT_ASRS: /* asrset_t <sys/regset> sparcv9 only */
1758 1801 state.ns_vcol = 18;
1759 1802 state.ns_t2col = 38;
1760 1803 state.ns_v2col = 46;
1761 1804 dump_asrset(&state, MSG_ORIG(MSG_CNOTE_DESC_ASRSET_T));
1762 1805 return (CORENOTE_R_OK);
1763 1806
1764 1807 case NT_LDT: /* ssd array <sys/sysi86.h> IA32 only */
1765 1808 return (CORENOTE_R_OK_DUMP);
1766 1809
1767 1810 case NT_PSTATUS: /* pstatus_t <sys/procfs.h> */
1768 1811 state.ns_vcol = 22;
1769 1812 state.ns_t2col = 42;
1770 1813 state.ns_v2col = 54;
1771 1814 dump_pstatus(&state, MSG_ORIG(MSG_CNOTE_DESC_PSTATUS_T));
1772 1815 return (CORENOTE_R_OK);
1773 1816
1774 1817 case NT_PSINFO: /* psinfo_t <sys/procfs.h> */
1775 1818 state.ns_vcol = 25;
1776 1819 state.ns_t2col = 45;
1777 1820 state.ns_v2col = 58;
1778 1821 dump_psinfo(&state, MSG_ORIG(MSG_CNOTE_DESC_PSINFO_T));
1779 1822 return (CORENOTE_R_OK);
1780 1823
1781 1824 case NT_PRCRED: /* prcred_t <sys/procfs.h> */
1782 1825 state.ns_vcol = 20;
1783 1826 state.ns_t2col = 34;
1784 1827 state.ns_v2col = 44;
1785 1828 dump_prcred(&state, MSG_ORIG(MSG_CNOTE_DESC_PRCRED_T));
1786 1829 return (CORENOTE_R_OK);
1787 1830
1788 1831 case NT_UTSNAME: /* struct utsname <sys/utsname.h> */
1789 1832 state.ns_vcol = 18;
1790 1833 dump_utsname(&state, MSG_ORIG(MSG_CNOTE_DESC_STRUCT_UTSNAME));
1791 1834 return (CORENOTE_R_OK);
1792 1835
1793 1836 case NT_LWPSTATUS: /* lwpstatus_t <sys/procfs.h> */
1794 1837 state.ns_vcol = 24;
1795 1838 state.ns_t2col = 44;
1796 1839 state.ns_v2col = 54;
1797 1840 dump_lwpstatus(&state, MSG_ORIG(MSG_CNOTE_DESC_LWPSTATUS_T));
1798 1841 return (CORENOTE_R_OK);
1799 1842
1800 1843 case NT_LWPSINFO: /* lwpsinfo_t <sys/procfs.h> */
1801 1844 state.ns_vcol = 22;
1802 1845 state.ns_t2col = 42;
1803 1846 state.ns_v2col = 54;
1804 1847 dump_lwpsinfo(&state, MSG_ORIG(MSG_CNOTE_DESC_LWPSINFO_T));
1805 1848 return (CORENOTE_R_OK);
1806 1849
1807 1850 case NT_PRPRIV: /* prpriv_t <sys/procfs.h> */
1808 1851 state.ns_vcol = 21;
1809 1852 state.ns_t2col = 34;
1810 1853 state.ns_v2col = 38;
1811 1854 dump_prpriv(&state, MSG_ORIG(MSG_CNOTE_DESC_PRPRIV_T));
1812 1855 return (CORENOTE_R_OK);
1813 1856
1814 1857 case NT_PRPRIVINFO: /* priv_impl_info_t <sys/priv.h> */
1815 1858 state.ns_vcol = 29;
1816 1859 state.ns_t2col = 41;
1817 1860 state.ns_v2col = 56;
1818 1861 dump_priv_impl_info(&state,
1819 1862 MSG_ORIG(MSG_CNOTE_DESC_PRIV_IMPL_INFO_T));
1820 1863 return (CORENOTE_R_OK);
1821 1864
1822 1865 case NT_CONTENT: /* core_content_t <sys/corectl.h> */
1823 1866 if (sizeof (core_content_t) > descsz)
1824 1867 return (CORENOTE_R_BADDATA);
1825 1868 {
1826 1869 static sl_field_t fdesc = { 0, 8, 0, 0 };
1827 1870 Conv_cnote_cc_content_buf_t conv_buf;
1828 1871 core_content_t content;
1829 1872
1830 1873 state.ns_vcol = 8;
1831 1874 indent_enter(&state,
1832 1875 MSG_ORIG(MSG_CNOTE_DESC_CORE_CONTENT_T),
1833 1876 &fdesc);
1834 1877 content = extract_as_lword(&state, &fdesc);
1835 1878 print_str(&state, MSG_ORIG(MSG_STR_EMPTY),
1836 1879 conv_cnote_cc_content(content, 0, &conv_buf));
1837 1880 indent_exit(&state);
1838 1881 }
1839 1882 return (CORENOTE_R_OK);
1840 1883
1841 1884 case NT_ZONENAME: /* string from getzonenamebyid(3C) */
1842 1885 dbg_print(0, MSG_ORIG(MSG_NOTE_DESC));
1843 1886 dbg_print(0, MSG_ORIG(MSG_FMT_INDENT), safe_str(desc, descsz));
1844 1887 return (CORENOTE_R_OK);
1845 1888
1846 1889
1847 1890 case NT_FDINFO:
1848 1891 state.ns_vcol = 22;
1849 1892 state.ns_t2col = 41;
↓ open down ↓ |
740 lines elided |
↑ open up ↑ |
1850 1893 state.ns_v2col = 54;
1851 1894 dump_prfdinfo(&state, MSG_ORIG(MSG_CNOTE_DESC_PRFDINFO_T));
1852 1895 return (CORENOTE_R_OK);
1853 1896
1854 1897 case NT_SPYMASTER:
1855 1898 state.ns_vcol = 25;
1856 1899 state.ns_t2col = 45;
1857 1900 state.ns_v2col = 58;
1858 1901 dump_psinfo(&state, MSG_ORIG(MSG_CNOTE_DESC_PSINFO_T));
1859 1902 return (CORENOTE_R_OK);
1903 +
1904 + case NT_SECFLAGS:
1905 + state.ns_vcol = 23;
1906 + state.ns_t2col = 41;
1907 + state.ns_v2col = 54;
1908 + dump_secflags(&state, MSG_ORIG(MSG_CNOTE_DESC_PRSECFLAGS_T));
1909 + return (CORENOTE_R_OK);
1860 1910 }
1861 1911
1862 1912 return (CORENOTE_R_BADTYPE);
1863 1913 }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX