8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 /*
28 * Copyright (c) 2013, Joyent, Inc. All rights reserved.
29 */
30
31 #include <stdio.h>
32 #include <stdio_ext.h>
33 #include <stdlib.h>
34 #include <unistd.h>
35 #include <ctype.h>
36 #include <fcntl.h>
37 #include <strings.h>
38 #include <dirent.h>
39 #include <errno.h>
40 #include <sys/types.h>
41 #include <sys/int_fmtio.h>
42 #include <libproc.h>
43
44 typedef struct look_arg {
45 int pflags;
46 const char *lwps;
47 int count;
48 } look_arg_t;
452 str = "PR_REQUESTED";
453 break;
454 case PR_SIGNALLED:
455 str = "PR_SIGNALLED";
456 break;
457 case PR_SYSENTRY:
458 str = "PR_SYSENTRY";
459 break;
460 case PR_SYSEXIT:
461 str = "PR_SYSEXIT";
462 break;
463 case PR_JOBCONTROL:
464 str = "PR_JOBCONTROL";
465 break;
466 case PR_FAULTED:
467 str = "PR_FAULTED";
468 break;
469 case PR_SUSPENDED:
470 str = "PR_SUSPENDED";
471 break;
472 default:
473 str = buf;
474 (void) sprintf(str, "%d", why);
475 break;
476 }
477
478 return (str);
479 }
480
481 static char *
482 prwhat(int why, int what)
483 {
484 static char buf[32];
485 char *str;
486
487 switch (why) {
488 case PR_SIGNALLED:
489 case PR_JOBCONTROL:
490 str = proc_signame(what, buf, sizeof (buf));
491 break;
|
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 /*
28 * Copyright 2015, Joyent, Inc.
29 */
30
31 #include <stdio.h>
32 #include <stdio_ext.h>
33 #include <stdlib.h>
34 #include <unistd.h>
35 #include <ctype.h>
36 #include <fcntl.h>
37 #include <strings.h>
38 #include <dirent.h>
39 #include <errno.h>
40 #include <sys/types.h>
41 #include <sys/int_fmtio.h>
42 #include <libproc.h>
43
44 typedef struct look_arg {
45 int pflags;
46 const char *lwps;
47 int count;
48 } look_arg_t;
452 str = "PR_REQUESTED";
453 break;
454 case PR_SIGNALLED:
455 str = "PR_SIGNALLED";
456 break;
457 case PR_SYSENTRY:
458 str = "PR_SYSENTRY";
459 break;
460 case PR_SYSEXIT:
461 str = "PR_SYSEXIT";
462 break;
463 case PR_JOBCONTROL:
464 str = "PR_JOBCONTROL";
465 break;
466 case PR_FAULTED:
467 str = "PR_FAULTED";
468 break;
469 case PR_SUSPENDED:
470 str = "PR_SUSPENDED";
471 break;
472 case PR_BRAND:
473 str = "PR_BRAND";
474 break;
475 default:
476 str = buf;
477 (void) sprintf(str, "%d", why);
478 break;
479 }
480
481 return (str);
482 }
483
484 static char *
485 prwhat(int why, int what)
486 {
487 static char buf[32];
488 char *str;
489
490 switch (why) {
491 case PR_SIGNALLED:
492 case PR_JOBCONTROL:
493 str = proc_signame(what, buf, sizeof (buf));
494 break;
|