Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

BOFH excuse #71: The file system is full of it


comp / comp.unix.shell / Re: Basic ps Tips

SubjectAuthor
* Basic ps TipsLawrence D'Oliveiro
`* Re: Basic ps TipsLawrence D'Oliveiro
 `* Re: Basic ps TipsJerry Peters
  +- Re: Basic ps TipsLawrence D'Oliveiro
  `* Re: Basic ps TipsRene Kita
   +* Re: Basic ps TipsEd Morton
   |`* Re: Basic ps TipsRene Kita
   | +* Re: Basic ps TipsJoerg Mertens
   | |+* Re: Basic ps TipsRene Kita
   | ||`* Re: Basic ps TipsJoerg Mertens
   | || +* Re: Basic ps TipsLawrence D'Oliveiro
   | || |+* Re: Basic ps TipsJoerg Mertens
   | || ||`- The whole point of the BSDs is to be retro (Was: Basic ps Tips)Kenny McCormack
   | || |`- Re: Basic ps TipsChristian Weisgerber
   | || `- Re: Basic ps TipsRene Kita
   | |`* Re: Basic ps TipsChristian Weisgerber
   | | `- Re: Basic ps TipsRene Kita
   | `* Re: Basic ps TipsLawrence D'Oliveiro
   |  `- Re: Basic ps TipsJohn D Groenveld
   `* Re: Basic ps TipsChristian Weisgerber
    `* Re: Basic ps TipsChristian Weisgerber
     `- Re: Basic ps TipsLawrence D'Oliveiro

1
Subject: Basic ps Tips
From: Lawrence D'Oliv
Newsgroups: comp.unix.shell
Organization: A noiseless patient Spider
Date: Sat, 27 Jul 2024 00:40 UTC
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.unix.shell
Subject: Basic ps Tips
Date: Sat, 27 Jul 2024 00:40:49 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 30
Message-ID: <v81fmh$32fuh$5@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 27 Jul 2024 02:40:50 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="923de006914fc707793912d16389c2d1";
logging-data="3227601"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19TQI6BOn3t66rFcpjCXNB4"
User-Agent: Pan/0.159 (Vovchansk; )
Cancel-Lock: sha1:B8bSQqOUT/FcajSm4TnLE8f1Oh4=
View all headers

One look at the man page for ps(1)
<https://manpages.debian.org/1/ps.1.en.html> and you see all the
different traditional option syntaxes it tries to be compatible with.
The BSD style doesn’t even prefix options with dashes, which can lead
to ambiguities and is best avoided. If this is what you’re used to,
try to wean yourself off it.

To list some useful info about all processes, you can do

ps -ef

or, for even more info, try

ps -eF

One thing I find annoying about this it reports less precision in
process start times for long-running processes. To get around this, you
can use a custom format. For example

ps -eo pid,ppid,lstart,tty,etime,cmd

shows some similar info to the default “-f” format, but always includes
start time and elapsed time to the nearest second, regardless of how
long the process has been running.

Another useful command to use with ps is pgrep(1)
<https://manpages.debian.org/1/pgrep.1.en.html>, which lets you filter
processes to get information for according to various criteria. Or you
could just use grep(1) on the output from ps, as I suspect a lot of
people do. ;)

Subject: Re: Basic ps Tips
From: Lawrence D'Oliv
Newsgroups: comp.unix.shell
Organization: A noiseless patient Spider
Date: Tue, 30 Jul 2024 20:43 UTC
References: 1
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.unix.shell
Subject: Re: Basic ps Tips
Date: Tue, 30 Jul 2024 20:43:52 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 13
Message-ID: <v8bja7$16ghh$1@dont-email.me>
References: <v81fmh$32fuh$5@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 30 Jul 2024 22:43:52 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="1fbb37dbc5397d698139d650eacef59c";
logging-data="1262129"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18bCUNA8+qTKspDiMklrQAj"
User-Agent: Pan/0.159 (Vovchansk; )
Cancel-Lock: sha1:a9VqEsZsIFxKHmcT5jEfpVKovo4=
View all headers

On Sat, 27 Jul 2024 00:40:49 -0000 (UTC), I wrote:

> Another useful command to use with ps is pgrep(1)
> <https://man7.org/linux/man-pages/man1/pgrep.1.html>

If you are expecting more than one process to match your criteria, it
is easy enough to use the “-d,” option to comma-separate them. Then the
output becomes acceptable to the “-p” option in ps, e.g.

ps -p$(pgrep -d, bash) -wwo pid,ppid,lstart,tty,etime,cmd

to report all the bash sessions I have running (quite a lot). The “ww”
says not to truncate the output, which is handy for long command lines.

Subject: Re: Basic ps Tips
From: Jerry Peters
Newsgroups: comp.unix.shell
Organization: A noiseless patient Spider
Date: Fri, 2 Aug 2024 00:19 UTC
References: 1 2
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: jerry@example.invalid (Jerry Peters)
Newsgroups: comp.unix.shell
Subject: Re: Basic ps Tips
Date: Fri, 2 Aug 2024 00:19:58 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 38
Message-ID: <v8h8ne$2eq4k$1@dont-email.me>
References: <v81fmh$32fuh$5@dont-email.me> <v8bja7$16ghh$1@dont-email.me>
Injection-Date: Fri, 02 Aug 2024 02:19:58 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="18e3a5cc4d85c725ab979b469026f8a0";
logging-data="2582676"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19MnBFnSdvUaeB81WdolnBZEQqHSAEfQFs="
User-Agent: tin/2.4.5-20201224 ("Glen Albyn") (Linux/6.6.41 (x86_64))
Cancel-Lock: sha1:J+YE3cxOyzIcLPZbW8atIcqx0xg=
View all headers

Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
> On Sat, 27 Jul 2024 00:40:49 -0000 (UTC), I wrote:
>
>> Another useful command to use with ps is pgrep(1)
>> <https://man7.org/linux/man-pages/man1/pgrep.1.html>
>
> If you are expecting more than one process to match your criteria, it
> is easy enough to use the ???-d,??? option to comma-separate them. Then the
> output becomes acceptable to the ???-p??? option in ps, e.g.
>
> ps -p$(pgrep -d, bash) -wwo pid,ppid,lstart,tty,etime,cmd
>
> to report all the bash sessions I have running (quite a lot). The ???ww???
> says not to truncate the output, which is handy for long command lines.
Or just use ps -C <command>:

ps -p$(pgrep -d, bash) -wwo pid,ppid,lstart,tty,etime,cmd
PID PPID STARTED TT ELAPSED CMD
1332 1327 Thu Jul 18 10:12:28 2024 pts/1 14-10:02:20 bash
2019 2018 Thu Jul 18 20:20:31 2024 pts/3 13-23:54:17 bash
2237 2236 Thu Jul 18 20:39:49 2024 pts/4 13-23:34:59 bash
10821 10820 Sat Jul 20 14:45:57 2024 pts/6 12-05:28:51 bash
20342 20341 Wed Jul 31 09:58:54 2024 pts/7 1-10:15:54 bash

ps -C bash -wwo pid,ppid,lstart,tty,etime,cmd
PID PPID STARTED TT ELAPSED CMD
1332 1327 Thu Jul 18 10:12:28 2024 pts/1 14-10:02:35 bash
2019 2018 Thu Jul 18 20:20:31 2024 pts/3 13-23:54:32 bash
2237 2236 Thu Jul 18 20:39:49 2024 pts/4 13-23:35:14 bash
10821 10820 Sat Jul 20 14:45:57 2024 pts/6 12-05:29:06 bash
20342 20341 Wed Jul 31 09:58:54 2024 pts/7 1-10:16:09 bash

Does noone know about -C? I keep seeing things like 'ps -ef | grep
<something> in scripts to see if <something is running, rather than
using 'ps -C'.

Jerry

Subject: Re: Basic ps Tips
From: Lawrence D'Oliv
Newsgroups: comp.unix.shell
Organization: A noiseless patient Spider
Date: Fri, 2 Aug 2024 02:15 UTC
References: 1 2 3
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.unix.shell
Subject: Re: Basic ps Tips
Date: Fri, 2 Aug 2024 02:15:37 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 12
Message-ID: <v8hfg8$2ju49$1@dont-email.me>
References: <v81fmh$32fuh$5@dont-email.me> <v8bja7$16ghh$1@dont-email.me>
<v8h8ne$2eq4k$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 02 Aug 2024 04:15:37 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="480e27b3b4cc073acc0e6062d3b4dc69";
logging-data="2750601"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+WAReR2eaRG2zxqLeyOnhi"
User-Agent: Pan/0.159 (Vovchansk; )
Cancel-Lock: sha1:AlnXQbgPeQqSwPBqPTLPuQLZRXY=
View all headers

On Fri, 2 Aug 2024 00:19:58 -0000 (UTC), Jerry Peters wrote:

> Or just use ps -C <command>:

Neat. But note this <https://manpages.debian.org/1/ps.1.en.html>:

-C cmdlist
Select by command name. This selects the processes whose
executable name is given in cmdlist. NOTE: The command name is not
the same as the command line.

That might matter in some cases.

Subject: Re: Basic ps Tips
From: Rene Kita
Newsgroups: comp.unix.shell
Organization: A noiseless patient Spider
Date: Sat, 3 Aug 2024 07:08 UTC
References: 1 2 3
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: mail@rkta.de (Rene Kita)
Newsgroups: comp.unix.shell
Subject: Re: Basic ps Tips
Date: Sat, 3 Aug 2024 07:08:50 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 29
Sender: Rene Kita <kt@ob.rkta.de>
Message-ID: <v8kl22$3ajo6$1@dont-email.me>
References: <v81fmh$32fuh$5@dont-email.me> <v8bja7$16ghh$1@dont-email.me> <v8h8ne$2eq4k$1@dont-email.me>
Injection-Date: Sat, 03 Aug 2024 09:08:50 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="97e2ffe9698576b37fdb104cea396460";
logging-data="3493638"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+CF/2BkOvtGO/Ui80/U8jQ"
User-Agent: tin/2.6.2-20221225 ("Pittyvaich") (OpenBSD/7.5 (amd64))
Cancel-Lock: sha1:GDJPvn6wNuxj5qGgFez54wWo5Vo=
View all headers

Jerry Peters <jerry@example.invalid> wrote:
> Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
>> On Sat, 27 Jul 2024 00:40:49 -0000 (UTC), I wrote:
[...]
>> ps -p$(pgrep -d, bash) -wwo pid,ppid,lstart,tty,etime,cmd
>>
>> to report all the bash sessions I have running (quite a lot). The ???ww???
>> says not to truncate the output, which is handy for long command lines.
>
> Or just use ps -C <command>:
[...]
> Does noone know about -C? I keep seeing things like 'ps -ef | grep
> <something> in scripts to see if <something is running, rather than
> using 'ps -C'.

I did not know about it.

The man page on OpenBSD does not mention -C, but calling 'ps -C' does
not give an error. But:
#v+
$ ps -C ksh
ps: /dev/mem: Permission denied'
#v-

Dunno what to make out of it, but apparently one reason to use grep
instead of -C is portability.

> Jerry
Rene

Subject: Re: Basic ps Tips
From: Ed Morton
Newsgroups: comp.unix.shell
Organization: A noiseless patient Spider
Date: Sat, 3 Aug 2024 11:55 UTC
References: 1 2 3 4
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: mortonspam@gmail.com (Ed Morton)
Newsgroups: comp.unix.shell
Subject: Re: Basic ps Tips
Date: Sat, 3 Aug 2024 06:55:33 -0500
Organization: A noiseless patient Spider
Lines: 47
Message-ID: <v8l5rk$3e995$1@dont-email.me>
References: <v81fmh$32fuh$5@dont-email.me> <v8bja7$16ghh$1@dont-email.me>
<v8h8ne$2eq4k$1@dont-email.me> <v8kl22$3ajo6$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 03 Aug 2024 13:55:33 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="962ee472fcd5dfd69f4f24ddafa656bc";
logging-data="3613989"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19oegCXZJJYqW47MtTxX/QU"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:ilwhNwg7u21ggfuwe0h69tSlDY8=
In-Reply-To: <v8kl22$3ajo6$1@dont-email.me>
Content-Language: en-US
X-Antivirus-Status: Clean
X-Antivirus: Avast (VPS 240802-4, 8/2/2024), Outbound message
View all headers

On 8/3/2024 2:08 AM, Rene Kita wrote:
> Jerry Peters <jerry@example.invalid> wrote:
>> Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
>>> On Sat, 27 Jul 2024 00:40:49 -0000 (UTC), I wrote:
> [...]
>>> ps -p$(pgrep -d, bash) -wwo pid,ppid,lstart,tty,etime,cmd
>>>
>>> to report all the bash sessions I have running (quite a lot). The ???ww???
>>> says not to truncate the output, which is handy for long command lines.
>>
>> Or just use ps -C <command>:
> [...]
>> Does noone know about -C? I keep seeing things like 'ps -ef | grep
>> <something> in scripts to see if <something is running, rather than
>> using 'ps -C'.
>
> I did not know about it.
>
> The man page on OpenBSD does not mention -C, but calling 'ps -C' does
> not give an error. But:
> #v+
> $ ps -C ksh
> ps: /dev/mem: Permission denied'
> #v-
>
> Dunno what to make out of it, but apparently one reason to use grep
> instead of -C is portability.

Its described in the man page for FreeBSD ps,
https://man.freebsd.org/cgi/man.cgi?ps(1), as:

-C Change the way the CPU percentage is calculated by
using a
"raw" CPU calculation that ignores "resident" time (this nor-
mally has no effect).

so maybe you're running FreeBSD instead of the OpenBSD version.

Using `-C` to select a command isn't supported by POSIX, GNU, FreeBSD,
OpenBSD, etc. so yes - portability would be a significant issue if you
relied on it in your scripts.

Ed.
>
>> Jerry
> Rene

Subject: Re: Basic ps Tips
From: Rene Kita
Newsgroups: comp.unix.shell
Organization: A noiseless patient Spider
Date: Sat, 3 Aug 2024 15:51 UTC
References: 1 2 3 4 5
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: mail@rkta.de (Rene Kita)
Newsgroups: comp.unix.shell
Subject: Re: Basic ps Tips
Date: Sat, 3 Aug 2024 15:51:12 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 60
Sender: Rene Kita <kt@ob.rkta.de>
Message-ID: <v8ljlg$3gs0o$1@dont-email.me>
References: <v81fmh$32fuh$5@dont-email.me> <v8bja7$16ghh$1@dont-email.me> <v8h8ne$2eq4k$1@dont-email.me> <v8kl22$3ajo6$1@dont-email.me> <v8l5rk$3e995$1@dont-email.me>
Injection-Date: Sat, 03 Aug 2024 17:51:12 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="97e2ffe9698576b37fdb104cea396460";
logging-data="3698712"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/C9j02BFcRD2VECjOr1Vfq"
User-Agent: tin/2.6.2-20221225 ("Pittyvaich") (OpenBSD/7.5 (amd64))
Cancel-Lock: sha1:w70nikBa3OAGxmsfnbkUt403bAI=
View all headers

Ed Morton <mortonspam@gmail.com> wrote:
> On 8/3/2024 2:08 AM, Rene Kita wrote:
>> Jerry Peters <jerry@example.invalid> wrote:
>>> Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
>>>> On Sat, 27 Jul 2024 00:40:49 -0000 (UTC), I wrote:
>> [...]
>>>> ps -p$(pgrep -d, bash) -wwo pid,ppid,lstart,tty,etime,cmd
>>>>
>>>> to report all the bash sessions I have running (quite a lot). The ???ww???
>>>> says not to truncate the output, which is handy for long command lines.
>>>
>>> Or just use ps -C <command>:
>> [...]
>>> Does noone know about -C? I keep seeing things like 'ps -ef | grep
>>> <something> in scripts to see if <something is running, rather than
>>> using 'ps -C'.
>>
>> I did not know about it.
>>
>> The man page on OpenBSD does not mention -C, but calling 'ps -C' does
>> not give an error. But:
>> #v+
>> $ ps -C ksh
>> ps: /dev/mem: Permission denied'
>> #v-
>>
>> Dunno what to make out of it, but apparently one reason to use grep
>> instead of -C is portability.
>
> Its described in the man page for FreeBSD ps,
> https://man.freebsd.org/cgi/man.cgi?ps(1), as:
>
> -C Change the way the CPU percentage is calculated by
> using a
> "raw" CPU calculation that ignores "resident" time (this nor-
> mally has no effect).
>
> so maybe you're running FreeBSD instead of the OpenBSD version.

I'm pretty sure I know which version of BSD I'm running and I would be
very surprised if OpenBSD would ship the FreeBSD version of ps...

But let's have a look at the source:
#v+
while ((ch = getopt(argc, argv,
"AaCcefgHhjkLlM: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':
break; /* no-op */
#v-

'-C' does nothing. I did not look further to see where that error is
coming from.

Subject: Re: Basic ps Tips
From: Joerg Mertens
Newsgroups: comp.unix.shell
Organization: A noiseless patient Spider
Date: Sat, 3 Aug 2024 17:34 UTC
References: 1 2 3 4 5 6
Path: eternal-september.org!news.eternal-september.org!jmertens.eternal-september.org!.POSTED!not-for-mail
From: joerg-mertens@t-online.de (Joerg Mertens)
Newsgroups: comp.unix.shell
Subject: Re: Basic ps Tips
Date: Sat, 3 Aug 2024 19:34:02 +0200
Organization: A noiseless patient Spider
Lines: 67
Message-ID: <v8lpmb$3i4us$1@jmertens.eternal-september.org>
References: <v81fmh$32fuh$5@dont-email.me> <v8bja7$16ghh$1@dont-email.me> <v8h8ne$2eq4k$1@dont-email.me> <v8kl22$3ajo6$1@dont-email.me> <v8l5rk$3e995$1@dont-email.me> <v8ljlg$3gs0o$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 03 Aug 2024 19:34:05 +0200 (CEST)
Injection-Info: jmertens.eternal-september.org; posting-host="fd52e7130434360a2d6fe7d1a52b2dd3";
logging-data="3740658"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/JhIvaBPc/0RgQdH3DgOnWIWXcJm2nuU0="
User-Agent: tin/2.6.2-20221225 ("Pittyvaich") (OpenBSD/7.5 (amd64)) tinews.pl/1.1.61
Cancel-Lock: sha1:ybQpTazH4vhiwIwVkt+qjcs7gic=
View all headers

Rene Kita <mail@rkta.de> wrote:
> Ed Morton <mortonspam@gmail.com> wrote:
>> On 8/3/2024 2:08 AM, Rene Kita wrote:
>>> Jerry Peters <jerry@example.invalid> wrote:
>>>> Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
>>>>> On Sat, 27 Jul 2024 00:40:49 -0000 (UTC), I wrote:
>>> [...]
>>>>> ps -p$(pgrep -d, bash) -wwo pid,ppid,lstart,tty,etime,cmd
>>>>>
>>>>> says not to truncate the output, which is handy for long command lines.
>>>>
>>>> Or just use ps -C <command>:
>>> [...]
>>>> Does noone know about -C? I keep seeing things like 'ps -ef | grep
>>>> <something> in scripts to see if <something is running, rather than
>>>> using 'ps -C'.
>>>
>>> I did not know about it.
>>>
>>> The man page on OpenBSD does not mention -C, but calling 'ps -C' does
>>> not give an error. But:
>>> #v+
>>> $ ps -C ksh
>>> ps: /dev/mem: Permission denied'
>>> #v-
>>>
>>> Dunno what to make out of it, but apparently one reason to use grep
>>> instead of -C is portability.
>>
>> Its described in the man page for FreeBSD ps,
>> https://man.freebsd.org/cgi/man.cgi?ps(1), as:
>>
>> -C Change the way the CPU percentage is calculated by
>> using a
>> "raw" CPU calculation that ignores "resident" time (this nor-
>> mally has no effect).
>>
>> so maybe you're running FreeBSD instead of the OpenBSD version.
>
> I'm pretty sure I know which version of BSD I'm running and I would be
> very surprised if OpenBSD would ship the FreeBSD version of ps...
>
> But let's have a look at the source:
> #v+
> while ((ch = getopt(argc, argv,
> "AaCcefgHhjkLlM: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':
> break; /* no-op */
> #v-
>
> '-C' does nothing. I did not look further to see where that error is
> coming from.

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.

Regards

Subject: Re: Basic ps Tips
From: Lawrence D'Oliv
Newsgroups: comp.unix.shell
Organization: A noiseless patient Spider
Date: Sat, 3 Aug 2024 19:37 UTC
References: 1 2 3 4 5 6
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.unix.shell
Subject: Re: Basic ps Tips
Date: Sat, 3 Aug 2024 19:37:01 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 6
Message-ID: <v8m0ss$3jh1j$1@dont-email.me>
References: <v81fmh$32fuh$5@dont-email.me> <v8bja7$16ghh$1@dont-email.me>
<v8h8ne$2eq4k$1@dont-email.me> <v8kl22$3ajo6$1@dont-email.me>
<v8l5rk$3e995$1@dont-email.me> <v8ljlg$3gs0o$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 03 Aug 2024 21:37:01 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="461a22efc661e416b053d4dcc2a44527";
logging-data="3785779"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Z+SnTBl72fmkWwdwYtXyF"
User-Agent: Pan/0.159 (Vovchansk; )
Cancel-Lock: sha1:aVsqa/J0+J8SXkkdsYT1SlXBgTo=
View all headers

On Sat, 3 Aug 2024 15:51:12 -0000 (UTC), Rene Kita wrote:

> I'm pretty sure I know which version of BSD I'm running and I would be
> very surprised if OpenBSD would ship the FreeBSD version of ps...

I wonder why they need different versions?

Subject: Re: Basic ps Tips
From: John D Groenveld
Newsgroups: comp.unix.shell
Organization: Groenveld.US
Date: Sat, 3 Aug 2024 23:00 UTC
References: 1 2 3 4
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: groenveld@acm.org (John D Groenveld)
Newsgroups: comp.unix.shell
Subject: Re: Basic ps Tips
Date: 3 Aug 2024 23:00:57 GMT
Organization: Groenveld.US
Lines: 10
Message-ID: <lh7r58F5lsdU1@mid.individual.net>
References: <v81fmh$32fuh$5@dont-email.me> <v8l5rk$3e995$1@dont-email.me> <v8ljlg$3gs0o$1@dont-email.me> <v8m0ss$3jh1j$1@dont-email.me>
X-Trace: individual.net kWlhFRJrEZTCnHIVQnbeOAbk5DEwqMI62tEV/KXRghsysCEFI/
Cancel-Lock: sha1:oQdBMyF+Qis/1ZU1HmmJSZCdMwg= sha256:1kySiKtegiLvA8FsTplvZz3mCfbEJReWgL6bCAm+ts4=
View all headers

In article <v8m0ss$3jh1j$1@dont-email.me>,
Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
>I wonder why they need different versions?

Illumos includes ps(1) and ps(1B)
<URL:https://illumos.org/man/1/ps>
<URL:https://illumos.org/man/1B/ps>

John
groenveld@acm.org

Subject: Re: Basic ps Tips
From: Rene Kita
Newsgroups: comp.unix.shell
Organization: A noiseless patient Spider
Date: Sun, 4 Aug 2024 06:56 UTC
References: 1 2 3 4 5 6 7
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: mail@rkta.de (Rene Kita)
Newsgroups: comp.unix.shell
Subject: Re: Basic ps Tips
Date: Sun, 4 Aug 2024 06:56:36 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 80
Sender: Rene Kita <kt@ob.rkta.de>
Message-ID: <v8n8n4$3ugbk$1@dont-email.me>
References: <v81fmh$32fuh$5@dont-email.me> <v8bja7$16ghh$1@dont-email.me> <v8h8ne$2eq4k$1@dont-email.me> <v8kl22$3ajo6$1@dont-email.me> <v8l5rk$3e995$1@dont-email.me> <v8ljlg$3gs0o$1@dont-email.me> <v8lpmb$3i4us$1@jmertens.eternal-september.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 04 Aug 2024 08:56:36 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="5bb73beb76f131e1add5191ddcbdb302";
logging-data="4145524"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Jo97c8d2tLGuPCy6erZoZ"
User-Agent: tin/2.6.2-20221225 ("Pittyvaich") (OpenBSD/7.5 (amd64))
Cancel-Lock: sha1:ThawIk5dWmnNDeslRR2ulR0CUZ0=
View all headers

Joerg Mertens <joerg-mertens@t-online.de> wrote:
> Rene Kita <mail@rkta.de> wrote:
>> Ed Morton <mortonspam@gmail.com> wrote:
>>> On 8/3/2024 2:08 AM, Rene Kita wrote:
>>>> Jerry Peters <jerry@example.invalid> wrote:
>>>>> Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
>>>>>> On Sat, 27 Jul 2024 00:40:49 -0000 (UTC), I wrote:
>>>> [...]
>>>>>> ps -p$(pgrep -d, bash) -wwo pid,ppid,lstart,tty,etime,cmd
>>>>>>
>>>>>> says not to truncate the output, which is handy for long command lines.
>>>>>
>>>>> Or just use ps -C <command>:
>>>> [...]
>>>>> Does noone know about -C? I keep seeing things like 'ps -ef | grep
>>>>> <something> in scripts to see if <something is running, rather than
>>>>> using 'ps -C'.
>>>>
>>>> I did not know about it.
>>>>
>>>> The man page on OpenBSD does not mention -C, but calling 'ps -C' does
>>>> not give an error. But:
>>>> #v+
>>>> $ ps -C ksh
>>>> ps: /dev/mem: Permission denied'
>>>> #v-
>>>>
>>>> Dunno what to make out of it, but apparently one reason to use grep
>>>> instead of -C is portability.
>>>
>>> Its described in the man page for FreeBSD ps,
>>> https://man.freebsd.org/cgi/man.cgi?ps(1), as:
>>>
>>> -C Change the way the CPU percentage is calculated by
>>> using a
>>> "raw" CPU calculation that ignores "resident" time (this nor-
>>> mally has no effect).
>>>
>>> so maybe you're running FreeBSD instead of the OpenBSD version.
>>
>> I'm pretty sure I know which version of BSD I'm running and I would be
>> very surprised if OpenBSD would ship the FreeBSD version of ps...
>>
>> But let's have a look at the source:
>> #v+
>> while ((ch = getopt(argc, argv,
>> "AaCcefgHhjkLlM: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':
>> break; /* no-op */
>> #v-
>>
>> '-C' does nothing. I did not look further to see where that error is
>> coming from.
>
> 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.

You got me curious and I got my debugger out for my morning coffee.

The error message comes from a function kvm_openfiles, which is called
after the flag parsing is done. From a quick glance, this function takes
what looks like three file names. If the second one is NULL, it will
default to /dev/mem. Trying to open /dev/mem it will error out - which
could be due to me being on a VPS.

While the man page mentions kvm(3) in the SEE ALSO section, there is no
mentioning nor explanation what additional arguments can be passed to
ps.

> Regards

Subject: Re: Basic ps Tips
From: Joerg Mertens
Newsgroups: comp.unix.shell
Organization: A noiseless patient Spider
Date: Sun, 4 Aug 2024 11:01 UTC
References: 1 2 3 4 5 6 7 8
Path: eternal-september.org!news.eternal-september.org!jmertens.eternal-september.org!.POSTED!not-for-mail
From: joerg-mertens@t-online.de (Joerg Mertens)
Newsgroups: comp.unix.shell
Subject: Re: Basic ps Tips
Date: Sun, 4 Aug 2024 13:01:25 +0200
Organization: A noiseless patient Spider
Lines: 64
Message-ID: <v8nn26$1252$1@jmertens.eternal-september.org>
References: <v81fmh$32fuh$5@dont-email.me> <v8bja7$16ghh$1@dont-email.me> <v8h8ne$2eq4k$1@dont-email.me> <v8kl22$3ajo6$1@dont-email.me> <v8l5rk$3e995$1@dont-email.me> <v8ljlg$3gs0o$1@dont-email.me> <v8lpmb$3i4us$1@jmertens.eternal-september.org> <v8n8n4$3ugbk$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 04 Aug 2024 13:01:28 +0200 (CEST)
Injection-Info: jmertens.eternal-september.org; posting-host="2969d05de60a43aad1508eb5be2e3418";
logging-data="34982"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+VUDkpUDcEaouKocgOnMQ+Tg185ym/flQ="
User-Agent: tin/2.6.2-20221225 ("Pittyvaich") (OpenBSD/7.5 (amd64)) tinews.pl/1.1.61
Cancel-Lock: sha1:R5/75/vdLq7/K0LD9M6ujf97QII=
View all headers

Rene Kita <mail@rkta.de> wrote:
> Joerg Mertens <joerg-mertens@t-online.de> wrote:
>> Rene Kita <mail@rkta.de> wrote:
>>>
>>> I'm pretty sure I know which version of BSD I'm running and I would be
>>> very surprised if OpenBSD would ship the FreeBSD version of ps...
>>>
>>> But let's have a look at the source:
>>> #v+
>>> while ((ch = getopt(argc, argv,
>>> "AaCcefgHhjkLlM: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':
>>> break; /* no-op */
>>> #v-
>>>
>>> '-C' does nothing. I did not look further to see where that error is
>>> coming from.
>>
>> 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.
>
> You got me curious and I got my debugger out for my morning coffee.
>
> The error message comes from a function kvm_openfiles, which is called
> after the flag parsing is done. From a quick glance, this function takes
> what looks like three file names. If the second one is NULL, it will
> default to /dev/mem. Trying to open /dev/mem it will error out - which
> could be due to me being on a VPS.
>
> While the man page mentions kvm(3) in the SEE ALSO section, there is no
> mentioning nor explanation what additional arguments can be passed to
> ps.

As I understand it, `ps´ can not only be used to examine the processes
of your currently running system, but also those of another system
represented by an image file. Normally you would use the `N´ option
plus a filename to tell ps to do this, but the original way seems to
have been to just add the filename to the commandline as an additional
argument.

Now when you call `ps xy´, the argument xy is interpreted as a string
of old style options which can be written without dashes. Some
people still write `ps aux´ for example to look at their processes.

But when you write `ps a xy´ (or `ps -a xy´), xy is interpreted as
a "kernel image to be examined" (see the first argument to
kvm_openfiles(3)), which leads to the `permission denied´ error.

To get back to the `-C´ option - it is there for compatibility
reasons with old scripts. You can find the relevant commit message
under http://cvsweb.openbsd.org/src/bin/ps/ps.c when you search for the
string `-C´.

Joerg

Subject: Re: Basic ps Tips
From: Christian Weisgerber
Newsgroups: comp.unix.shell
Date: Sun, 4 Aug 2024 10:38 UTC
References: 1 2 3 4
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!news.szaf.org!inka.de!mips.inka.de!.POSTED.localhost!not-for-mail
From: naddy@mips.inka.de (Christian Weisgerber)
Newsgroups: comp.unix.shell
Subject: Re: Basic ps Tips
Date: Sun, 4 Aug 2024 10:38:50 -0000 (UTC)
Message-ID: <slrnvaumhq.1ruo.naddy@lorvorc.mips.inka.de>
References: <v81fmh$32fuh$5@dont-email.me> <v8bja7$16ghh$1@dont-email.me>
<v8h8ne$2eq4k$1@dont-email.me> <v8kl22$3ajo6$1@dont-email.me>
Injection-Date: Sun, 4 Aug 2024 10:38:50 -0000 (UTC)
Injection-Info: lorvorc.mips.inka.de; posting-host="localhost:::1";
logging-data="61401"; mail-complaints-to="usenet@mips.inka.de"
User-Agent: slrn/1.0.3 (FreeBSD)
View all headers

On 2024-08-03, Rene Kita <mail@rkta.de> wrote:

> Dunno what to make out of it, but apparently one reason to use grep
> instead of -C is portability.

ps(1)'s arguments are not portable in practice anyway.

--
Christian "naddy" Weisgerber naddy@mips.inka.de

Subject: Re: Basic ps Tips
From: Christian Weisgerber
Newsgroups: comp.unix.shell
Date: Sun, 4 Aug 2024 11:04 UTC
References: 1 2 3 4 5 6 7
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!news.szaf.org!inka.de!mips.inka.de!.POSTED.localhost!not-for-mail
From: naddy@mips.inka.de (Christian Weisgerber)
Newsgroups: comp.unix.shell
Subject: Re: Basic ps Tips
Date: Sun, 4 Aug 2024 11:04:53 -0000 (UTC)
Message-ID: <slrnvauo2l.1ruo.naddy@lorvorc.mips.inka.de>
References: <v81fmh$32fuh$5@dont-email.me> <v8bja7$16ghh$1@dont-email.me>
<v8h8ne$2eq4k$1@dont-email.me> <v8kl22$3ajo6$1@dont-email.me>
<v8l5rk$3e995$1@dont-email.me> <v8ljlg$3gs0o$1@dont-email.me>
<v8lpmb$3i4us$1@jmertens.eternal-september.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 4 Aug 2024 11:04:53 -0000 (UTC)
Injection-Info: lorvorc.mips.inka.de; posting-host="localhost:::1";
logging-data="61401"; mail-complaints-to="usenet@mips.inka.de"
User-Agent: slrn/1.0.3 (FreeBSD)
View all headers

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

Subject: Re: Basic ps Tips
From: Christian Weisgerber
Newsgroups: comp.unix.shell
Date: Sun, 4 Aug 2024 12:55 UTC
References: 1 2 3 4 5
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!news.szaf.org!inka.de!mips.inka.de!.POSTED.localhost!not-for-mail
From: naddy@mips.inka.de (Christian Weisgerber)
Newsgroups: comp.unix.shell
Subject: Re: Basic ps Tips
Date: Sun, 4 Aug 2024 12:55:27 -0000 (UTC)
Message-ID: <slrnvauuhv.1ua4.naddy@lorvorc.mips.inka.de>
References: <v81fmh$32fuh$5@dont-email.me> <v8bja7$16ghh$1@dont-email.me>
<v8h8ne$2eq4k$1@dont-email.me> <v8kl22$3ajo6$1@dont-email.me>
<slrnvaumhq.1ruo.naddy@lorvorc.mips.inka.de>
Injection-Date: Sun, 4 Aug 2024 12:55:27 -0000 (UTC)
Injection-Info: lorvorc.mips.inka.de; posting-host="localhost:::1";
logging-data="64535"; mail-complaints-to="usenet@mips.inka.de"
User-Agent: slrn/1.0.3 (FreeBSD)
View all headers

On 2024-08-04, Christian Weisgerber <naddy@mips.inka.de> wrote:

>> Dunno what to make out of it, but apparently one reason to use grep
>> instead of -C is portability.
>
> ps(1)'s arguments are not portable in practice anyway.

I'll just quote the OpenBSD man page:

------------------->
STANDARDS
The ps utility is compliant with the IEEE Std 1003.1-2008 ("POSIX.1")
specification, except that the flag [-G] is unsupported and the flags
[-ptU] support only single arguments, not lists.

The flags [-defglnu] are marked by IEEE Std 1003.1-2008 ("POSIX.1") as
being an X/Open System Interfaces option. Of these, [-dfgn] are not
supported by this implementation of ps; behaviour for the flags [-elu]
differs between this implementation and the X/Open System Interfaces
option of IEEE Std 1003.1-2008 ("POSIX.1").

The flags [-cfHhjkLMmNOrSTvWwx] are extensions to IEEE Std 1003.1-2008
("POSIX.1").

Only the following keywords are recognised by IEEE Std 1003.1-2008
("POSIX.1"): args, comm, etime, group, nice, pcpu, pgid, pid, ppid,
rgroup, ruser, time, tty, user, and vsz.
<-------------------

--
Christian "naddy" Weisgerber naddy@mips.inka.de

Subject: Re: Basic ps Tips
From: Lawrence D'Oliv
Newsgroups: comp.unix.shell
Organization: A noiseless patient Spider
Date: Sun, 4 Aug 2024 22:07 UTC
References: 1 2 3 4 5 6 7 8 9
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.unix.shell
Subject: Re: Basic ps Tips
Date: Sun, 4 Aug 2024 22:07:50 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 6
Message-ID: <v8ou3m$8t63$2@dont-email.me>
References: <v81fmh$32fuh$5@dont-email.me> <v8bja7$16ghh$1@dont-email.me>
<v8h8ne$2eq4k$1@dont-email.me> <v8kl22$3ajo6$1@dont-email.me>
<v8l5rk$3e995$1@dont-email.me> <v8ljlg$3gs0o$1@dont-email.me>
<v8lpmb$3i4us$1@jmertens.eternal-september.org>
<v8n8n4$3ugbk$1@dont-email.me>
<v8nn26$1252$1@jmertens.eternal-september.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 05 Aug 2024 00:07:50 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="9703e35b9105f1543e11e482bcc52d23";
logging-data="292035"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX195LKohVOZ7lJMozcuJekvk"
User-Agent: Pan/0.159 (Vovchansk; )
Cancel-Lock: sha1:HdIt8oG6OXPg8PDiNzNPtwaPThM=
View all headers

On Sun, 4 Aug 2024 13:01:25 +0200, Joerg Mertens wrote:

> You can find the relevant commit message under
> http://cvsweb.openbsd.org/src/bin/ps/ps.c ...

Why are they still using CVS? And not HTTPS?

Subject: Re: Basic ps Tips
From: Lawrence D'Oliv
Newsgroups: comp.unix.shell
Organization: A noiseless patient Spider
Date: Sun, 4 Aug 2024 22:11 UTC
References: 1 2 3 4 5 6
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.unix.shell
Subject: Re: Basic ps Tips
Date: Sun, 4 Aug 2024 22:11:27 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 26
Message-ID: <v8ouae$8t63$3@dont-email.me>
References: <v81fmh$32fuh$5@dont-email.me> <v8bja7$16ghh$1@dont-email.me>
<v8h8ne$2eq4k$1@dont-email.me> <v8kl22$3ajo6$1@dont-email.me>
<slrnvaumhq.1ruo.naddy@lorvorc.mips.inka.de>
<slrnvauuhv.1ua4.naddy@lorvorc.mips.inka.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 05 Aug 2024 00:11:27 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="9703e35b9105f1543e11e482bcc52d23";
logging-data="292035"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18VGbWsTI4XtQlgaHKExva4"
User-Agent: Pan/0.159 (Vovchansk; )
Cancel-Lock: sha1:NVRVZPSnyZQRMtPZnzuO860nVxs=
View all headers

On Sun, 4 Aug 2024 12:55:27 -0000 (UTC), Christian Weisgerber wrote:

> I'll just quote the OpenBSD man page:
>
> ------------------->
> STANDARDS
> The ps utility is compliant with the IEEE Std 1003.1-2008
> ("POSIX.1") specification, except that the flag [-G] is unsupported
> and the flags [-ptU] support only single arguments, not lists.
>
> The flags [-defglnu] are marked by IEEE Std 1003.1-2008 ("POSIX.1")
> as being an X/Open System Interfaces option. Of these, [-dfgn] are
> not supported by this implementation of ps; behaviour for the flags
> [-elu] differs between this implementation and the X/Open System
> Interfaces option of IEEE Std 1003.1-2008 ("POSIX.1").

Compare the Linux version <https://manpages.debian.org/1/ps.1.en.html>:

STANDARDS
This ps conforms to:

1 Version 2 of the Single Unix Specification
2 The Open Group Technical Standard Base Specifications, Issue 6
3 IEEE Std 1003.1, 2004 Edition
4 X/Open System Interfaces Extension [UP XSI]
5 ISO/IEC 9945:2003

Subject: Re: Basic ps Tips
From: Rene Kita
Newsgroups: comp.unix.shell
Organization: A noiseless patient Spider
Date: Mon, 5 Aug 2024 05:55 UTC
References: 1 2 3 4 5 6 7 8
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: mail@rkta.de (Rene Kita)
Newsgroups: comp.unix.shell
Subject: Re: Basic ps Tips
Date: Mon, 5 Aug 2024 05:55:12 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 23
Sender: Rene Kita <kt@ob.rkta.de>
Message-ID: <v8ppg0$h6kb$1@dont-email.me>
References: <v81fmh$32fuh$5@dont-email.me> <v8bja7$16ghh$1@dont-email.me> <v8h8ne$2eq4k$1@dont-email.me> <v8kl22$3ajo6$1@dont-email.me> <v8l5rk$3e995$1@dont-email.me> <v8ljlg$3gs0o$1@dont-email.me> <v8lpmb$3i4us$1@jmertens.eternal-september.org> <slrnvauo2l.1ruo.naddy@lorvorc.mips.inka.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 05 Aug 2024 07:55:13 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="519d53e75290e06f10db6418a2587a1d";
logging-data="563851"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+BluVh6G2TppOLPh1lkHT/"
User-Agent: tin/2.6.2-20221225 ("Pittyvaich") (OpenBSD/7.5 (amd64))
Cancel-Lock: sha1:LZEzZTLLUhh7AnqtGclKblKyciQ=
View all headers

Christian Weisgerber <naddy@mips.inka.de> wrote:
> 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]]
[...]

Thanks for this explanation. Might be worth to document this in the man
page.

Subject: Re: Basic ps Tips
From: Rene Kita
Newsgroups: comp.unix.shell
Organization: A noiseless patient Spider
Date: Mon, 5 Aug 2024 06:08 UTC
References: 1 2 3 4 5 6 7 8 9
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: mail@rkta.de (Rene Kita)
Newsgroups: comp.unix.shell
Subject: Re: Basic ps Tips
Date: Mon, 5 Aug 2024 06:08:30 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 46
Sender: Rene Kita <kt@ob.rkta.de>
Message-ID: <v8pq8u$h6kb$2@dont-email.me>
References: <v81fmh$32fuh$5@dont-email.me> <v8bja7$16ghh$1@dont-email.me> <v8h8ne$2eq4k$1@dont-email.me> <v8kl22$3ajo6$1@dont-email.me> <v8l5rk$3e995$1@dont-email.me> <v8ljlg$3gs0o$1@dont-email.me> <v8lpmb$3i4us$1@jmertens.eternal-september.org> <v8n8n4$3ugbk$1@dont-email.me> <v8nn26$1252$1@jmertens.eternal-september.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 05 Aug 2024 08:08:31 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="519d53e75290e06f10db6418a2587a1d";
logging-data="563851"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/cQBE+45KiMBMorR9mGLMH"
User-Agent: tin/2.6.2-20221225 ("Pittyvaich") (OpenBSD/7.5 (amd64))
Cancel-Lock: sha1:EcY+bcqMDoNl2MTGwPNVLAtSAI0=
View all headers

Joerg Mertens <joerg-mertens@t-online.de> wrote:
> Rene Kita <mail@rkta.de> wrote:
>> Joerg Mertens <joerg-mertens@t-online.de> wrote:
[...]
>>> 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.
>>
>> You got me curious and I got my debugger out for my morning coffee.
>>
>> The error message comes from a function kvm_openfiles, which is called
>> after the flag parsing is done. From a quick glance, this function takes
>> what looks like three file names. If the second one is NULL, it will
>> default to /dev/mem. Trying to open /dev/mem it will error out - which
>> could be due to me being on a VPS.
>>
>> While the man page mentions kvm(3) in the SEE ALSO section, there is no
>> mentioning nor explanation what additional arguments can be passed to
>> ps.
>
> As I understand it, `ps´ can not only be used to examine the processes
> of your currently running system, but also those of another system
> represented by an image file. Normally you would use the `N´ option
> plus a filename to tell ps to do this, but the original way seems to
> have been to just add the filename to the commandline as an additional
> argument.
>
> Now when you call `ps xy´, the argument xy is interpreted as a string
> of old style options which can be written without dashes. Some
> people still write `ps aux´ for example to look at their processes.

Guilty. :-)

> But when you write `ps a xy´ (or `ps -a xy´), xy is interpreted as
> a "kernel image to be examined" (see the first argument to
> kvm_openfiles(3)), which leads to the `permission denied´ error.
>
> To get back to the `-C´ option - it is there for compatibility
> reasons with old scripts. You can find the relevant commit message
> under http://cvsweb.openbsd.org/src/bin/ps/ps.c when you search for the
> string `-C´.

That's what I thought. I was just surprised that it's not documented.
But the man page seems to be silent about all old style things. Looks
like it's by design.

Subject: Re: Basic ps Tips
From: Joerg Mertens
Newsgroups: comp.unix.shell
Organization: A noiseless patient Spider
Date: Mon, 5 Aug 2024 19:29 UTC
References: 1 2 3 4 5 6 7 8 9 10
Path: eternal-september.org!news.eternal-september.org!jmertens.eternal-september.org!.POSTED!not-for-mail
From: joerg-mertens@t-online.de (Joerg Mertens)
Newsgroups: comp.unix.shell
Subject: Re: Basic ps Tips
Date: Mon, 5 Aug 2024 21:29:42 +0200
Organization: A noiseless patient Spider
Lines: 14
Message-ID: <v8r977$10rjj$1@jmertens.eternal-september.org>
References: <v81fmh$32fuh$5@dont-email.me> <v8bja7$16ghh$1@dont-email.me> <v8h8ne$2eq4k$1@dont-email.me> <v8kl22$3ajo6$1@dont-email.me> <v8l5rk$3e995$1@dont-email.me> <v8ljlg$3gs0o$1@dont-email.me> <v8lpmb$3i4us$1@jmertens.eternal-september.org> <v8n8n4$3ugbk$1@dont-email.me> <v8nn26$1252$1@jmertens.eternal-september.org> <v8ou3m$8t63$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 05 Aug 2024 21:29:45 +0200 (CEST)
Injection-Info: jmertens.eternal-september.org; posting-host="c692e4208e9b9a42ee0832ab053d8dcf";
logging-data="1076869"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+5sD+NEcuwR3khryrIEoSozh48wdHVo5w="
User-Agent: tin/2.6.2-20221225 ("Pittyvaich") (OpenBSD/7.5 (amd64)) tinews.pl/1.1.61
Cancel-Lock: sha1:BShjp259CugeQ0ydYYg0uMa5McI=
View all headers

Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
> On Sun, 4 Aug 2024 13:01:25 +0200, Joerg Mertens wrote:
>
>> You can find the relevant commit message under
>> http://cvsweb.openbsd.org/src/bin/ps/ps.c ...
>
> Why are they still using CVS? And not HTTPS?

I know that both topics have been discussed on the OpenBSD `misc´
mailing list (probably more than once) but this was some time ago
and I did not pay much attention. If you search the list archive
you should be able to find some answers.

Regards

Subject: The whole point of the BSDs is to be retro (Was: Basic ps Tips)
From: Kenny McCormack
Newsgroups: comp.unix.shell
Organization: The official candy of the new Millennium
Date: Mon, 5 Aug 2024 19:34 UTC
References: 1 2 3 4
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail
From: gazelle@shell.xmission.com (Kenny McCormack)
Newsgroups: comp.unix.shell
Subject: The whole point of the BSDs is to be retro (Was: Basic ps Tips)
Date: Mon, 5 Aug 2024 19:34:31 -0000 (UTC)
Organization: The official candy of the new Millennium
Message-ID: <v8r9g7$bn3s$2@news.xmission.com>
References: <v81fmh$32fuh$5@dont-email.me> <v8nn26$1252$1@jmertens.eternal-september.org> <v8ou3m$8t63$2@dont-email.me> <v8r977$10rjj$1@jmertens.eternal-september.org>
Injection-Date: Mon, 5 Aug 2024 19:34:31 -0000 (UTC)
Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4";
logging-data="384124"; mail-complaints-to="abuse@xmission.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: gazelle@shell.xmission.com (Kenny McCormack)
View all headers

In article <v8r977$10rjj$1@jmertens.eternal-september.org>,
Joerg Mertens <joerg-mertens@t-online.de> wrote:
>Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
>> On Sun, 4 Aug 2024 13:01:25 +0200, Joerg Mertens wrote:
>>
>>> You can find the relevant commit message under
>>> http://cvsweb.openbsd.org/src/bin/ps/ps.c ...
>>
>> Why are they still using CVS? And not HTTPS?
>
>I know that both topics have been discussed on the OpenBSD `misc
>mailing list (probably more than once) but this was some time ago
>and I did not pay much attention. If you search the list archive
>you should be able to find some answers.

I think the whole point of the BSDs is to be retro.

If they wanted to be modern, they'd be Linux.

--
In Usenet, as in life, as you go through it, you will run into lots of nonsense.
Each time, you will have to decide from the following courses of action:
1) Argue with it or 2) Ignore it.
Experience shows that the later course is usually the best.

Subject: Re: Basic ps Tips
From: Christian Weisgerber
Newsgroups: comp.unix.shell
Date: Mon, 5 Aug 2024 21:50 UTC
References: 1 2 3 4 5 6 7 8 9 10
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!news.szaf.org!inka.de!mips.inka.de!.POSTED.localhost!not-for-mail
From: naddy@mips.inka.de (Christian Weisgerber)
Newsgroups: comp.unix.shell
Subject: Re: Basic ps Tips
Date: Mon, 5 Aug 2024 21:50:35 -0000 (UTC)
Message-ID: <slrnvb2i9b.5c5.naddy@lorvorc.mips.inka.de>
References: <v81fmh$32fuh$5@dont-email.me> <v8bja7$16ghh$1@dont-email.me>
<v8h8ne$2eq4k$1@dont-email.me> <v8kl22$3ajo6$1@dont-email.me>
<v8l5rk$3e995$1@dont-email.me> <v8ljlg$3gs0o$1@dont-email.me>
<v8lpmb$3i4us$1@jmertens.eternal-september.org>
<v8n8n4$3ugbk$1@dont-email.me>
<v8nn26$1252$1@jmertens.eternal-september.org>
<v8ou3m$8t63$2@dont-email.me>
Injection-Date: Mon, 5 Aug 2024 21:50:35 -0000 (UTC)
Injection-Info: lorvorc.mips.inka.de; posting-host="localhost:::1";
logging-data="5510"; mail-complaints-to="usenet@mips.inka.de"
User-Agent: slrn/1.0.3 (FreeBSD)
View all headers

On 2024-08-04, Lawrence D'Oliveiro <ldo@nz.invalid> wrote:

>> http://cvsweb.openbsd.org/src/bin/ps/ps.c ...
>
> Why are they still using CVS? And not HTTPS?

The second question is counterfactual:
https://cvsweb.openbsd.org/

--
Christian "naddy" Weisgerber naddy@mips.inka.de

1

rocksolid light 0.9.8
clearnet tor