Path: utzoo!utgpu!water!watmath!clyde!att!pacbell!ames!necntc!ima!cfisun!lakart!dg From: dg@lakart.UUCP (David Goodenough) Newsgroups: comp.unix.wizards Subject: Re: Finding where an executable was run Message-ID: <126@lakart.UUCP> Date: 20 May 88 14:11:26 GMT Organization: Lake - The systems people Lines: 27 Net-people: I am wrong - I am wrong - I am wrong - I admit it. I have had more mail telling me this than you can shake a stick at. Two points: A) Valid objection: with a path == ( . /bin /usr/bin /usr/local ) I get into trouble. This is a real problem, because it happens whenever I fire up something that is not a full path, or not in the current directory (i.e. /bin/cat). B) Less often a problem, but still irritating - things like csh / sh / getty whose argv[0] is something real weird (e.g. - -u or whatever). This rarely happens for user programs, except when doing a su perhaps. An interesting notion :-) On BSD 4.3, most binaries are demand page loaded. This means that the "text image" is very closely linked to the executable (Let's forget shell scripts for a moment :-). Does this mean that the kernel's process tables have some reference to the filesystem and inode number of the executable, because if so you could do a real neato job with find - popen("find /filesystem -inum %d", "r"); :-) :-) :-) -- dg@lakart.UUCP - David Goodenough +---+ | +-+-+ ....... !harvard!adelie!cfisun!lakart!dg +-+-+ | +---+