Sujet : Re: Basic ps Tips
De : naddy (at) *nospam* mips.inka.de (Christian Weisgerber)
Groupes : comp.unix.shellDate : 04. Aug 2024, 13:04:53
Autres entêtes
Message-ID : <slrnvauo2l.1ruo.naddy@lorvorc.mips.inka.de>
References : 1 2 3 4 5 6 7
User-Agent : slrn/1.0.3 (FreeBSD)
On 2024-08-03, Joerg Mertens <
joerg-mertens@t-online.de> wrote:
[OpenBSD ps(1)]
$ ps -C ksh
ps: /dev/mem: Permission denied'
>
The error message also is printed, when you run ps with a valid
flag plus some string, like `ps -a xyz´, so it seems to be independent
of the `-C´-option. Maybe it has to do with parsing of the old-style
flags vs. the dashed ones.
A quick look at the options parsing shows that
ps xxx [yyy [zzz]]
is equivalent to
ps -N xxx [-M yyy [-W zzz]]
This has been unchanged since the initial fork from NetBSD in 1995.
Digging further, I see that this comes straight from 4.4BSD, and
that the -M, -N, -W flags were added in 1991 and the older argument
syntax was left in place for backward compatibility.
FreeBSD changed this twenty years ago and now treats additional
arguments as a list of PIDs.
A further complication, going back to 4.4BSD, is that the arguments
are run through a function kludge_oldps_options() before actual
argument parsing, again for backward compatibility:
ps foo -> ps -foo
ps 34 -> ps -p34
-- Christian "naddy" Weisgerber naddy@mips.inka.de