[comp.unix.questions] ps -c num bug or feature ?

hans@duttnph.tudelft.nl (Hans Buurman) (01/15/90)

I don't understand the following behaviour of ps (SunOs 4.0.1):

hans52> ps
  PID TT STAT  TIME COMMAND
23706 p0 S     0:03 -csh (csh)
23728 p0 R     0:00 ps
hans53> ps -c
  PID TT STAT  TIME COMMAND
23706 p0 S     0:03 csh
23731 p0 R     0:00 ps
hans54> ps 23706
  PID TT STAT  TIME COMMAND
23706 p0 S     0:03 -csh (csh)
hans55> ps -c 23706
ps: cannot open 23706: No such file or directory

This should be correct according to the manual, I think.
From the SunOS manual:

     num  A process number may be given, in which case the output
          is  restricted  to that process.  This option must also
          be last.


It happens with other options as well.
Can anybody tell me whether this is a bug or a feature ?

	Hans

(willing to summarise)
========================================================================
Hans Buurman               | hans@duttnph.tudelft.nl | hans@duttnph.UUCP
Pattern Recognition Group  | 31-(0)15-78 46 94       |
Faculty of Applied Physics | Delft University of Technology

jik@athena.mit.edu (Jonathan I. Kamens) (01/15/90)

In article <1072@dutrun.UUCP>, hans@duttnph.tudelft.nl (Hans Buurman) writes:
> 
> I don't understand the following behaviour of ps (SunOs 4.0.1):
> 
> hans55> ps -c 23706
> ps: cannot open 23706: No such file or directory
> 
> This should be correct according to the manual, I think.
> From the SunOS manual:
> 
>      num  A process number may be given, in which case the output
>           is  restricted  to that process.  This option must also
>           be last.

  The manual also says (at the top):

     SYNOPSIS
          ps [ acegklnstuvwxU# ]

This means that the pid number should be part of the first argument
passed to ps, not in a second argument.  In other words, you should have typed:

     ps -c23706

I'm also not convinced that the '-' is even necessary, although it
probably can't hurt.

  The error you received is due to the fact that if ps is given a second
argument, it treats that argument as the file containing the system's
namelist.  Again, from the man page:

     A second argument is taken to be the file containing the
     system's namelist.  Otherwise, /vmunix is used.  A third
     argument tells ps where to look for core if the k option is
     given, instead of /vmcore.  If a fourth argument is given,
     it is taken to be the name of a swap file to use instead of
     the default /dev/drum.

Jonathan Kamens			              USnail:
MIT Project Athena				11 Ashford Terrace
jik@Athena.MIT.EDU				Allston, MA  02134
Office: 617-253-8495			      Home: 617-782-0710

hans@duttnph.tudelft.nl (Hans Buurman) (01/16/90)

In article <1990Jan15.094339.4254@athena.mit.edu> jik@athena.mit.edu (Jonathan I. Kamens) writes:
>
>In article <1072@dutrun.UUCP>, hans@duttnph.tudelft.nl (Hans Buurman) writes:
>> 
>> I don't understand the following behaviour of ps (SunOs 4.0.1):
>> 
>> hans55> ps -c 23706
>> ps: cannot open 23706: No such file or directory

>  The manual also says (at the top):
>
>     SYNOPSIS
>          ps [ acegklnstuvwxU# ]
>
>This means that the pid number should be part of the first argument
>passed to ps, not in a second argument.  In other words, you should have typed:
>
>     ps -c23706

Er, yes and no.

You are quite right, ps -c23706 works perfectly.
However, my SunOs 4.0.1 manual says:

SYNOPSIS
     ps [ -acCegklnrStuvwxU ] [ num ]
          [ kernel_name ] [ c_dump_file ] [ swap_file ]

Sun Release 4.0   Last change: 14 January 1988                  1

So obviously, the manual is incorrect.

You go on to explain why exactly we get this error message.
Your explanation is no doubt correct, but again, you quote from
a different manual. Which manual are you using ?

Thanks for the reply,

	Hans

>Jonathan Kamens			              USnail:
>MIT Project Athena				11 Ashford Terrace
>jik@Athena.MIT.EDU				Allston, MA  02134
>Office: 617-253-8495			      Home: 617-782-0710


========================================================================
Hans Buurman               | hans@duttnph.tudelft.nl | hans@duttnph.UUCP
Pattern Recognition Group  | 31-(0)15-78 46 94       |
Faculty of Applied Physics | Delft University of Technology

jik@athena.mit.edu (Jonathan I. Kamens) (01/17/90)

In article <1073@dutrun.UUCP>, hans@duttnph.tudelft.nl (Hans Buurman) writes:
> You go on to explain why exactly we get this error message.
> Your explanation is no doubt correct, but again, you quote from
> a different manual. Which manual are you using ?

  BSD 4.3.  I should have mentioned that....

Jonathan Kamens			              USnail:
MIT Project Athena				11 Ashford Terrace
jik@Athena.MIT.EDU				Allston, MA  02134
Office: 617-253-8495			      Home: 617-782-0710