On 7/15/06, Gustavo Rios <[EMAIL PROTECTED]> wrote:
i am trying to set a process as the session leader of its own. I wrote a simple program that handles that. It is working when i call it from my shell command line:
...
But when i write a simple shell script like in :
....
The process is not put on its own session as a leader the (setsid) returns no errors.
/bin/sh doesn't change the process-group of the processes that it invokes, while interactive shells with job-control support do change it, so that's the difference between invocation from a script versus an interactive shell. Unfortunately, it would suggest the _opposite_ behavior: setsid() from a process run by an interactive shell should fail. Too bad you didn't provide a complete description of the system calls made by your program, or direct evidence (say, the output of ps -j) of the results of running it in the two cases. As is, my current guess is that you're misreading the 'ps' output and confusing the concepts of process-group leader and session leader. Philip Guenther