|
|||||||||||
|
(no subject)
From: Marcus Watts <mdw(at)umich.edu>
Date: Mon Dec 02 2002 - 22:15:43 EST
To not have something listed in ps? You can't, at least not against "ps alxwwwk". You can hide process arguments by scribbling over them. You can discourage some versions of ps (v7, but not openbsd) from listing some things by setting the 1st character of argv[0] to '-'. Normally, this is used to identify a user's login shell process. Regarding execl behavior, you have it confused with QNX spawnl: http://www.qnx.com/developer/docs/qnx_6.1_docs/neutrino/lib_ref/s/spawnl.html You might want to read Kernighan, Ritchie _Unix Programming -- second edition which should be in openbsd under /usr/share/doc/04.uprog but isn't. You can find a copy in the 4.3bsd source: http://ftp.lug.udel.edu/pub/oldunix/4BSD/Distributions/4.3BSD/ in the file "usr.tar.gz", in the directory "doc/ps2/03.uprog". [ Is there a reason this isn't in openbsd? There is also a copy in current distributions of freebsd. ] There is source to "system()" at the end of this paper, but beware: it's out of date. The "system()" function in openbsd does scary stuff with sigprocmask, and uses vfork/execve/waitpid not fork/execl/wait. (For that matter, I'm surprised it still uses signal not sigaction.) If you install openbsd source, you can find the current code in /usr/src/lib/libc/stdlib/system.c . You seem to think that running "/bin/ls" is cheap. Well, it's relatively cheap on modern hardware. It's still doing nontrivial stuff, which is why it deserves to run in its own process and not pollute your program's name space and memory with stuff. If you are just trying to get a list of files for further processing and don't want the overhead of spawning "ls" you might want to look at these: getdirentries(2) getdirentries directory(3) opendir, readdir, closedir fts(3) fts glob(3) scandir(3) scandir, alphasort If you really do just want to dump everything to stdout, spawning ls is probably still the way to go, and there's no point feeling embarassed about it showing up in "ps". -Marcus Watts Received on Mon Dec 2 22:19:58 2002 This archive was generated by hypermail 2.1.8 : Wed Aug 23 2006 - 13:31:50 EDT |
||||||||||
|
|||||||||||