Print this page
11693 Document mdb(1) ::ps flags
Reviewed by: John Levon <john.levon@joyent.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/mdb/common/modules/genunix/genunix.c
          +++ new/usr/src/cmd/mdb/common/modules/genunix/genunix.c
↓ open down ↓ 349 lines elided ↑ open up ↑
 350  350          mdb_printf("%6d 0x%08x %0?p %s\n",
 351  351              cred.cr_uid, pr.p_flag, addr,
 352  352              (prt_flags & PS_PSARGS) ? pr.p_user.u_psargs : pr.p_user.u_comm);
 353  353  
 354  354          if (prt_flags & ~PS_PSARGS)
 355  355                  (void) mdb_pwalk("thread", ps_threadprint, &prt_flags, addr);
 356  356  
 357  357          return (DCMD_OK);
 358  358  }
 359  359  
      360 +static void
      361 +ps_help(void)
      362 +{
      363 +        mdb_printf("Display processes.\n\n"
      364 +            "Options:\n"
      365 +            "    -f\tDisplay command arguments\n"
      366 +            "    -l\tDisplay LWPs\n"
      367 +            "    -T\tDisplay tasks\n"
      368 +            "    -P\tDisplay projects\n"
      369 +            "    -z\tDisplay zones\n"
      370 +            "    -t\tDisplay threads\n\n");
      371 +
      372 +        mdb_printf("The resulting output is a table of the processes on the "
      373 +            "system.  The\n"
      374 +            "columns in the output consist of a combination of the "
      375 +            "following fields:\n\n");
      376 +        mdb_printf("S\tProcess state.  Possible states are:\n"
      377 +            "\tS\tSleeping (SSLEEP)\n"
      378 +            "\tR\tRunnable (SRUN)\n"
      379 +            "\tZ\tZombie (SZOMB)\n"
      380 +            "\tI\tIdle (SIDL)\n"
      381 +            "\tO\tOn Cpu (SONPROC)\n"
      382 +            "\tT\tStopped (SSTOP)\n"
      383 +            "\tW\tWaiting (SWAIT)\n");
      384 +
      385 +        mdb_printf("PID\tProcess id.\n");
      386 +        mdb_printf("PPID\tParent process id.\n");
      387 +        mdb_printf("PGID\tProcess group id.\n");
      388 +        mdb_printf("SID\tProcess id of the session leader.\n");
      389 +        mdb_printf("TASK\tThe task id of the process.\n");
      390 +        mdb_printf("PROJ\tThe project id of the process.\n");
      391 +        mdb_printf("ZONE\tThe zone id of the process.\n");
      392 +        mdb_printf("UID\tThe user id of the process.\n");
      393 +        mdb_printf("FLAGS\tThe process flags (see ::pflags).\n");
      394 +        mdb_printf("ADDR\tThe kernel address of the proc_t structure of the "
      395 +            "process\n");
      396 +        mdb_printf("NAME\tThe name (p_user.u_comm field) of the process.  If "
      397 +            "the -f flag\n"
      398 +            "\tis specified, the arguments of the process are displayed.\n");
      399 +}
      400 +
 360  401  #define PG_NEWEST       0x0001
 361  402  #define PG_OLDEST       0x0002
 362  403  #define PG_PIPE_OUT     0x0004
 363  404  #define PG_EXACT_MATCH  0x0008
 364  405  
 365  406  typedef struct pgrep_data {
 366  407          uint_t pg_flags;
 367  408          uint_t pg_psflags;
 368  409          uintptr_t pg_xaddr;
 369  410          hrtime_t pg_xstart;
↓ open down ↓ 3688 lines elided ↑ open up ↑
4058 4099          { "did2thread", "? kt_did", "find kernel thread for this id",
4059 4100                  did2thread },
4060 4101          { "errorq", "?[-v]", "display kernel error queues", errorq },
4061 4102          { "fd", ":[fd num]", "get a file pointer from an fd", fd },
4062 4103          { "flipone", ":", "the vik_rev_level 2 special", flipone },
4063 4104          { "lminfo", NULL, "print lock manager information", lminfo },
4064 4105          { "ndi_event_hdl", "?", "print ndi_event_hdl", ndi_event_hdl },
4065 4106          { "panicinfo", NULL, "print panic information", panicinfo },
4066 4107          { "pid2proc", "?", "convert PID to proc_t address", pid2proc },
4067 4108          { "project", NULL, "display kernel project(s)", project },
4068      -        { "ps", "[-fltzTP]", "list processes (and associated thr,lwp)", ps },
     4109 +        { "ps", "[-fltzTP]", "list processes (and associated thr,lwp)", ps,
     4110 +            ps_help },
4069 4111          { "pflags", NULL, "display various proc_t flags", pflags },
4070 4112          { "pgrep", "[-x] [-n | -o] pattern",
4071 4113                  "pattern match against all processes", pgrep },
4072 4114          { "ptree", NULL, "print process tree", ptree },
4073 4115          { "sysevent", "?[-sv]", "print sysevent pending or sent queue",
4074 4116                  sysevent},
4075 4117          { "sysevent_channel", "?", "print sysevent channel database",
4076 4118                  sysevent_channel},
4077 4119          { "sysevent_class_list", ":", "print sysevent class list",
4078 4120                  sysevent_class_list},
↓ open down ↓ 761 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX