Print this page




   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;


 437                 str = "PR_REQUESTED";
 438                 break;
 439         case PR_SIGNALLED:
 440                 str = "PR_SIGNALLED";
 441                 break;
 442         case PR_SYSENTRY:
 443                 str = "PR_SYSENTRY";
 444                 break;
 445         case PR_SYSEXIT:
 446                 str = "PR_SYSEXIT";
 447                 break;
 448         case PR_JOBCONTROL:
 449                 str = "PR_JOBCONTROL";
 450                 break;
 451         case PR_FAULTED:
 452                 str = "PR_FAULTED";
 453                 break;
 454         case PR_SUSPENDED:
 455                 str = "PR_SUSPENDED";
 456                 break;



 457         default:
 458                 str = buf;
 459                 (void) sprintf(str, "%d", why);
 460                 break;
 461         }
 462 
 463         return (str);
 464 }
 465 
 466 static char *
 467 prwhat(int why, int what)
 468 {
 469         static char buf[32];
 470         char *str;
 471 
 472         switch (why) {
 473         case PR_SIGNALLED:
 474         case PR_JOBCONTROL:
 475                 str = proc_signame(what, buf, sizeof (buf));
 476                 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;


 437                 str = "PR_REQUESTED";
 438                 break;
 439         case PR_SIGNALLED:
 440                 str = "PR_SIGNALLED";
 441                 break;
 442         case PR_SYSENTRY:
 443                 str = "PR_SYSENTRY";
 444                 break;
 445         case PR_SYSEXIT:
 446                 str = "PR_SYSEXIT";
 447                 break;
 448         case PR_JOBCONTROL:
 449                 str = "PR_JOBCONTROL";
 450                 break;
 451         case PR_FAULTED:
 452                 str = "PR_FAULTED";
 453                 break;
 454         case PR_SUSPENDED:
 455                 str = "PR_SUSPENDED";
 456                 break;
 457         case PR_BRAND:
 458                 str = "PR_BRAND";
 459                 break;
 460         default:
 461                 str = buf;
 462                 (void) sprintf(str, "%d", why);
 463                 break;
 464         }
 465 
 466         return (str);
 467 }
 468 
 469 static char *
 470 prwhat(int why, int what)
 471 {
 472         static char buf[32];
 473         char *str;
 474 
 475         switch (why) {
 476         case PR_SIGNALLED:
 477         case PR_JOBCONTROL:
 478                 str = proc_signame(what, buf, sizeof (buf));
 479                 break;