On Thu 2013.10.24 at 21:38 +0100, Jason McIntyre wrote:
> On Thu, Oct 24, 2013 at 03:13:24AM +0300, Lauri Tirkkonen wrote:
> > On Tue, Oct 22 2013 22:07:37 +0059, Jason McIntyre wrote:
> > > On Tue, Oct 22, 2013 at 08:37:06PM +0300, loth...@iki.fi wrote:
> > > > >Synopsis:      ps(1) does not support -A, -o comm=foo
> > > > >Category:      user
> > > > >Environment:
> > > >         System      : OpenBSD 5.3
> > > >         Details     : OpenBSD 5.3 (GENERIC) #50: Tue Mar 12 18:35:23 
> > > > MDT 2013
> > > >                          
> > > > dera...@i386.openbsd.org:/usr/src/sys/arch/i386/compile/GENERIC
> > > > 
> > > >         Architecture: OpenBSD.i386
> > > >         Machine     : i386
> > > > >Description:
> > > >         ps(1) manual claims that the implementation is compliant to 
> > > > POSIX 2008, but: 
> > > >           * -A is not supported (see below)
> > > >           * '-o comm=foo' gives an error (see below; interestingly '-o
> > > >             ucomm=foo' and '-o comm' work as expected)
> > > > 
> > > >         POSIX specifies both -A and the 'comm' field name; see
> > > >         
> > > > http://pubs.opengroup.org/onlinepubs/9699919799/utilities/ps.html
> > > > >How-To-Repeat:
> > > >         $ ps -A
> > > >         ps: unknown option -- A
> > > >         usage: ps [-aCceHhjkLlmrSTuvwx] [-M core] [-N system] [-O fmt] 
> > > > [-o fmt] [-p pid]
> > > >                   [-t tty] [-U username] [-W swap]
> > > > 
> > > >         $ ps -o comm=foo >/dev/null
> > > >         ps: comm: illegal keyword specification
> > > > >Fix:
> > > >         Add support for these options.
> > > > 
> > > 
> > > i suspect you'd make a better case if you supplied a diff, and your
> > > reasoning for wanting their inclusion.
> > 
> > Attached patch for the -A flag (hopefully it's like it should be; I suck
> > at CVS). I don't have a fix for the comm=foo issue, sorry. It looks like
> > that applies to other fields designated aliases as well (such as 'args'
> > which is an alias for command).
> > 
> > The reason for wanting these is of course the desire to run programs
> > that depend on this behavior (what are standards for :). As far as I can
> > tell there is no other cross-platform way to get a process list than
> > using ps, and if ps does not conform to the standard, well...
> > 
> 
> philip guenther committed a fix for the comm=foo issue. hopefully
> someone can look at your diff and commit it, or explain why it isn;t
> wanted.
> 
> > >         - my hope for the posix compat claim is more that readers will
> > >           know that a specific app is specified by posix, that they
> > >           can safely use any of the options except those documented
> > >           as being extensions, and they can go read the spec
> > >           themselves if they want fine detail. i reasoned that if
> > >           people reported differences in behaviour we could document
> > >           them (and we do), but i simply did not document non-supported
> > >           options.
> > 
> > What exactly does "safely" mean here? If you mean that as in "will be
> > portable to other platforms" expecting their implementations to be
> > fully conformant, shouldn't that go the other way around too? :)
> > 
> 
> yes, safely as in if you use an option we document, and don;t say it's
> an extension, it should work on other (compliant) systems.
> 
> > > i guess we could document where posix mandates an option but we don;t
> > > support it. there are very few, so it wouldn;t be a great deal of work.
> > > not sure if i feel it's worth it though.
> > 
> > That would be good in my opinion.
> > 
> 
> yes, i think i probably should do this. i'll try and find time...

[snip]

> -A goes before -a in SYNOPSIS, the option list, and usage().

...and move 'C' back/up as well:

Index: ps.1
===================================================================
RCS file: /home/open/cvs/src/bin/ps/ps.1,v
retrieving revision 1.85
diff -u -p -r1.85 ps.1
--- ps.1        8 Oct 2013 03:50:08 -0000       1.85
+++ ps.1        24 Oct 2013 16:50:01 -0000
@@ -39,7 +39,7 @@
 .Sh SYNOPSIS
 .Nm ps
 .Sm off
-.Op Fl aCceHhjkLlmrSTuvwx
+.Op Fl AaCceHhjkLlmrSTuvwx
 .Sm on
 .Op Fl M Ar core
 .Op Fl N Ar system
@@ -71,6 +71,9 @@ and associated command.
 .Pp
 The options are as follows:
 .Bl -tag -width Ds
+.It Fl A
+Display information about all processes, including those without controlling
+terminals.
 .It Fl a
 Display information about other users' processes as well as your own.
 .It Fl C
Index: ps.c
===================================================================
RCS file: /home/open/cvs/src/bin/ps/ps.c,v
retrieving revision 1.56
diff -u -p -r1.56 ps.c
--- ps.c        22 Sep 2013 17:28:34 -0000      1.56
+++ ps.c        24 Oct 2013 16:58:19 -0000
@@ -116,20 +116,24 @@ main(int argc, char *argv[])
        ttydev = NODEV;
        memf = nlistf = swapf = NULL;
        while ((ch = getopt(argc, argv,
-           "acCegHhjkLlM:mN:O:o:p:rSTt:U:uvW:wx")) != -1)
+           "AaCcegHhjkLlM:mN:O:o:p:rSTt:U:uvW:wx")) != -1)
                switch (ch) {
+               case 'A':
+                       all = 1;
+                       xflg = 1;
+                       break;
                case 'a':
                        all = 1;
                        break;
+               case 'C':
+                       rawcpu = 1;
+                       break;
                case 'c':
                        commandonly = 1;
                        break;
                case 'e':                       /* XXX set ufmt */
                        needenv = 1;
                        break;
-               case 'C':
-                       rawcpu = 1;
-                       break;
                case 'g':
                        break;                  /* no-op */
                case 'H':
@@ -462,7 +466,7 @@ static void
 usage(void)
 {
        (void)fprintf(stderr,
-           "usage: %s [-aCceHhjkLlmrSTuvwx] [-M core] [-N system] [-O fmt] [-o 
fmt] [-p pid]\n",
+           "usage: %s [-AaCceHhjkLlmrSTuvwx] [-M core] [-N system] [-O fmt] 
[-o fmt] [-p pid]\n",
            __progname);        
        (void)fprintf(stderr,
            "%-*s[-t tty] [-U username] [-W swap]\n", (int)strlen(__progname) + 
8, "");

Reply via email to