It is currently Tue, 30 Nov 2021 17:22:00 GMT



 
Author Message
 How to find out all the input args of a long command line

Hi,

I am wondering how I can find out the complete list of input arguments
of a long command line.  I tried to use the ps command but it only
reports the first 80 characters of a command line.

Any information will be very appreciated.

Thank you in advance for your information.

Shih-Ming Wang                         AT&T Wireless Services, Inc.
sw...@mccaw-stg.com                    Wireless Local Technology Group
Tel: 425-702-3996                      P.O. Box 97059
Fax: 425-702-3990                      Redmond, WA 98073-9759



 Wed, 12 Feb 2003 03:00:00 GMT   
 How to find out all the input args of a long command line
In article <yzz4s476yyh....@okanogan.mccaw-stg.com>,
Shih-Ming Wang  <sw...@mccaw-stg.com> wrote:

This probably ought to be in the FAQ.

Short answer: use /usr/ucb/ps -w or -ww, see the ps(1b) man page for
details. This assumes that you have the BSD compatibility packages
(SUNWscpr & SUNWscpu) installed.

Longer answer: you can't, in principle. /bin/ps is using a copy of
the arguments made by the kernel at exec time: the same data that is
available in the pr_psargs field in /proc/[PID]/psinfo (see proc(4)).
That's just the first 80 bytes, and that's it. /usr/ucb/ps with the
above-mentioned options is peeking at the victim's addess space (for
which it needs its setuid=root privilege, unless you are looking at
your own processes) and examining the storage area at the top of the
stack segment where the arguments were originally stored for passing
to main(argc,argv,envp). However, there's nothing to stop the program
overwriting this area during execution.

Chris Thompson
Email: cet1 [at] cam.ac.uk



 Thu, 13 Feb 2003 03:00:00 GMT   
 
   [ 2 post ] 

Similar Threads

1. CGI commands with command line args?

2. Processing args from a single line input...??

3. Command line: How long is too long?

4. how to set argv command line args for ps

5. Script/Command line args for FTP needed!!

6. How to hide command line args under Solaris

7. Command-line args in C

8. Command line args

9. command line args and 'if'

10. space in command line args


 
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software