[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re:



ps|grep -v ls
:)


man execl [skip]

RETURN VALUES
If any of the exec functions return, an error has occurred.  The return
value is -1, and the global variable errno will be set to indicate the
error.


John D. wrote:
/*
How can I stop a process from being listed in ps?
My program calls system functions (i.e. system("ls -lR")), how can I stop this internal function call from showing
up with the ps command?


Also, out of curiosity, the exec{l*,v*} commands don't seem
to return to the calling program, but instead exit
directly back to the OS. This seems strange.
Using OpenBSD 3.2 with gcc, if anyone cares.
*/

/*Demonstrates how execl() never returns!*/
#include <unistd.h>

int main(void) {
	printf("Good file listing:\n");
	execl("/bin/ls","ls",0);
	printf("never gets here!\n");
}



Visit your host, monkey.org