C pgm to calculate memory

C pgm to calculate memory

Post by Ynno » Fri, 05 Sep 1997 04:00:00



I've been reading/studying The Magic Garden Explained--Goodheart & Cox
and learning a great deal. However, I was looking for some assistance w/
the last
exercise in chapter #2:

using 3 system calls--open, close & read--write a C program to calculate
the amount of memory install on your UNIX installation.

Appreciate any input/advice,

 
 
 

1. should argv[0] = "/full/path/to/pgm" or "pgm"?

Should the value of argv[0] as passed to a binary executeable program
be the full path to it or just the ending (tail) part?

Should the concept be different if the binary executeable program is
an interpreter for a script language when invoked via the #! feature
of script execution?  I'm referring to the path of the interpreter as
passed to the interpreter, not the script file as seen by the script.

This issue was raised on comp.os.linux.development.system because of
the fact that Linux 2.2.X has code to intentionally remove the leading
path from the program only when it is the interpreter, but otherwise.
A couple people suggested that this was a good idea but I never saw
any substantial argument in favor (especially that focused on why an
interpreter should be treated differently).  By comparison, Solaris
does what I expect (and currently think is right).

Does anyone here have any useful feedback on this?

Are there any examples of when argv[0] being the full path is useful?

Are there any good reasons why it should not be the full path when
the program is a script interpreter via the #! line?

Are there any security issues involved?

--
| Phil Howard - KA9WGN | My current websites: linuxhomepage.com, ham.org
| phil  (at)  ipal.net +----------------------------------------------------

2. CRON jobs not running

3. calculating proportion of memory that a program is actively using

4. innd sercurity

5. calculating the memory footprint of an application

6. Where is loadlin

7. Calculating memory used by a program

8. Minicom 1.75 patch for searching history buffer

9. Calculating memory Usage

10. How to calculate Used Memory???

11. Calculating total virtual memory on Solaris 8

12. Calculating Memory - Does nobody know the answer?

13. Calculating Memory usage for xinetd services