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...

>         - 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? :)

> 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.

-- 
Lauri Tirkkonen | +358 50 5341376 | lotheac @ IRCnet
? bin/ps/ps
? bin/ps/ps.1.manlint
Index: bin/ps/ps.1
===================================================================
RCS file: /cvs/src/bin/ps/ps.1,v
retrieving revision 1.83
diff -u -r1.83 ps.1
--- bin/ps/ps.1 2 Aug 2012 03:18:48 -0000       1.83
+++ bin/ps/ps.1 23 Oct 2013 23:56:34 -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
@@ -73,6 +73,9 @@
 .Bl -tag -width Ds
 .It Fl a
 Display information about other users' processes as well as your own.
+.It Fl A
+Display information about all processes, including those without controlling
+terminals.
 .It Fl C
 Change the way the CPU percentage is calculated by using a
 .Dq raw
Index: bin/ps/ps.c
===================================================================
RCS file: /cvs/src/bin/ps/ps.c,v
retrieving revision 1.55
diff -u -r1.55 ps.c
--- bin/ps/ps.c 21 Apr 2012 03:14:50 -0000      1.55
+++ bin/ps/ps.c 23 Oct 2013 23:56:34 -0000
@@ -116,11 +116,15 @@
        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;
                        break;
+               case 'A':
+                       all = 1;
+                       xflg = 1;
+                       break;
                case 'c':
                        commandonly = 1;
                        break;
@@ -462,7 +466,7 @@
 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