]> granicus.if.org Git - procps-ng/commitdiff
new -M and Z options for security data
authoralbert <>
Sat, 27 Mar 2004 03:55:52 +0000 (03:55 +0000)
committeralbert <>
Sat, 27 Mar 2004 03:55:52 +0000 (03:55 +0000)
NEWS
ps/global.c
ps/help.c
ps/output.c
ps/parser.c
ps/ps.1
ps/sortformat.c

diff --git a/NEWS b/NEWS
index 6c00fc8d981d87c70e04feb37bc2e3f6ce179c65..2f3eeb3c0a8009905ad89daabb3c04b9b206c9ec 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,7 +1,9 @@
 procps-3.2.0 --> procps-3.2.1
 
-build w/ curses in odd location
+build even w/ curses in an odd location
 ps: STAT flags for fg process group and session leader
+ps: STAT flags for swapped out process dropped (was broken)
+ps: new -M and Z options for security data (SE Linux, etc.)
 
 procps-3.1.15 --> procps-3.2.0
 
index ea77d91631372b24bb83a9120ca553e02c990858..07d9f85add77810ebb0e64181945178d8e1430ec 100644 (file)
@@ -264,6 +264,8 @@ static const char *set_personality(void){
   case_tru64:
   case_compaq:
   case_digital:
+    // no PER_NO_DEFAULT_g even though man page claims it
+    // Reality: the g is a NOP
     personality = PER_GOOD_o | PER_BSD_h;
     prefer_bsd_defaults = 1;
     sysv_f_format  = "F5FMT";
index db18ee4ccc7a0e3c03e9d4b764a8ccd2488130d9..65686aaee2d8f49a41d0ad26c505fb1804aff085 100644 (file)
--- a/ps/help.c
+++ b/ps/help.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 1998-2002 by Albert Cahalan; all rights reserved.
+ * Copyright 1998-2004 by Albert Cahalan; all rights reserved.
  * This file may be used subject to the terms and conditions of the
  * GNU Library General Public License Version 2, or any later version
  * at your option, as published by the Free Software Foundation.
@@ -31,21 +31,21 @@ const char *help_message =
 "x  processes w/o controlling ttys     t  by tty\n"
 "*********** output format **********  *********** long options ***********\n"
 "-o,o user-defined  -f full            --Group --User --pid --cols --ppid\n"
-"-j,j job control   s  signal          --group --user --sid --rows\n"
+"-j,j job control   s  signal          --group --user --sid --rows --info\n"
 "-O,O preloaded -o  v  virtual memory  --cumulative --format --deselect\n"
 "-l,l long          u  user-oriented   --sort --tty --forest --version\n"
 "-F   extra full    X  registers       --heading --no-heading --context\n"
 "                    ********* misc options *********\n"
 "-V,V  show version      L  list format codes  f  ASCII art forest\n"
 "-m,m,-L,-T,H  threads   S  children in sum    -y change -l format\n"
-"-c    scheduling class  c  true command name  n  numeric WCHAN,UID\n"
-"-w,w  wide output       e  show environment   -H process hierarchy\n"
+"-M,Z  security data     c  true command name  -c scheduling class\n"
+"-w,w  wide output       n  numeric WCHAN,UID  -H process hierarchy\n"
 ;
 
 
 
 /* Missing:
  *
- * -P -M --info
+ * -P e
  *
  */
index 10413ab9c87bba50ce59ce53700fee0fa82f2a42..b56e1d949d0157f24ee047617cd329e217996d1e 100644 (file)
@@ -1054,7 +1054,7 @@ static const format_struct format_array[] = {
 {"cnswap",    "-",       pr_nop,      sr_cnswap,  1,   0,    LNX, AN|RIGHT},
 {"comm",      "COMMAND", pr_comm,     sr_nop,    16, COM,    U98, PO|UNLIMITED}, /*ucomm*/
 {"command",   "COMMAND", pr_args,     sr_nop,    16, ARG,    XXX, PO|UNLIMITED}, /*args*/
-{"context",   "CONTEXT", pr_context,  sr_nop,    40,   0,    LNX, PO|LEFT},
+{"context",   "CONTEXT", pr_context,  sr_nop,    40,   0,    LNX, ET|LEFT},
 {"cp",        "CP",      pr_cp,       sr_pcpu,    3,   0,    DEC, ET|RIGHT}, /*cpu*/
 {"cpu",       "CPU",     pr_nop,      sr_nop,     3,   0,    BSD, AN|RIGHT}, /* FIXME ... HP-UX wants this as the CPU number for SMP? */
 {"cputime",   "TIME",    pr_time,     sr_nop,     8,   0,    DEC, ET|RIGHT}, /*time*/
@@ -1094,7 +1094,7 @@ static const format_struct format_array[] = {
 {"jobc",      "JOBC",    pr_nop,      sr_nop,     4,   0,    XXX, AN|RIGHT},
 {"ktrace",    "KTRACE",  pr_nop,      sr_nop,     8,   0,    BSD, AN|RIGHT},
 {"ktracep",   "KTRACEP", pr_nop,      sr_nop,     8,   0,    BSD, AN|RIGHT},
-{"label",     "LABEL",   pr_nop,      sr_nop,    25,  0,     SGI, PO|LEFT},
+{"label",     "LABEL",   pr_context,  sr_nop,    25,  0,     SGI, ET|LEFT},
 {"lim",       "LIM",     pr_lim,      sr_rss_rlim, 5,  0,    BSD, AN|RIGHT},
 {"login",     "LOGNAME", pr_nop,      sr_nop,     8,   0,    BSD, AN|LEFT}, /*logname*/   /* double check */
 {"logname",   "LOGNAME", pr_nop,      sr_nop,     8,   0,    XXX, AN|LEFT}, /*login*/
index 02f9fdaa7ef2593eb3fdc5af55c62a410ab789a6..8bb81d616221b88c71c32c3d8b46d130a79044f6 100644 (file)
@@ -270,7 +270,6 @@ static const char *parse_sysv_option(void){
     case 'M':  /* someday, maybe, we will have MAC like SGI's Irix */
       trace("-M Print security label for Mandatory Access Control.\n");
       format_modifiers |= FM_M;
-      return "Sorry, no Mandatory Access Control support.";
       break;
     case 'N':
       trace("-N negates.\n");
@@ -568,6 +567,10 @@ static const char *parse_bsd_option(void){
       trace("X Old Linux i386 register format\n");
       format_flags |= FF_LX;
       break;
+    case 'Z':  /* FreeBSD does MAC like SGI's Irix does it */
+      trace("Z Print security label for Mandatory Access Control.\n");
+      format_modifiers |= FM_M;
+      break;
     case 'a':
       trace("a Select all w/tty, including other users\n");
       simple_select |= SS_B_a;
diff --git a/ps/ps.1 b/ps/ps.1
index bfaae5244bca89e67081369b3b5a3153978205af..6cb9d43d9e01575bb75d93fb052fe86f805c2b21 100644 (file)
--- a/ps/ps.1
+++ b/ps/ps.1
@@ -82,6 +82,7 @@ t            select by tty
 OUTPUT FORMAT CONTROL
 -O           is preloaded "-o"
 -F           extra full format
+-M           add column for security data
 -c           different scheduler info for -l option
 -f           does full listing
 -j           jobs format
@@ -90,6 +91,7 @@ OUTPUT FORMAT CONTROL
 -y           do not show flags; show rss in place of addr
 O            is preloaded "o" (overloaded)
 X            old Linux i386 register format
+Z            add column for security data
 j            job control format
 l            display long format
 o            specify user-defined format
index 64fb6bf71d2a6debe717ed039aeba216fc700e87..a7bfe43bfd2e8755943cc26eee162c2927913edf 100644 (file)
@@ -925,6 +925,11 @@ did_lwp:
       fn = do_one_spec("nlwp", NULL);
       fmt_add_after("%CPU",  fn);
     }
+    if(format_modifiers & FM_M){    // Mandatory Access Control, IRIX style
+      fn = do_one_spec("label", NULL);
+      fn->next=format_list;
+      format_list=fn;
+    }
     /* Do personality-specific translations not covered by format_flags.
      * Generally, these only get hit when personality overrides unix output.
      * That (mostly?) means the Digital and Debian personalities.