[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: KProcess eats SIGCHLD, so pclose() fails
From:       aleXXX <alexander.neundorf () gmx ! net>
Date:       2001-11-28 21:57:28
[Download RAW message or body]

On Wed 28 Nov 01 22:18, David Faure wrote:
> On Wednesday 28 November 2001 20:28, aleXXX wrote:
> > On Wed 28 Nov 01 18:32, David Faure wrote:
> > > KProcessController, instantiated by KProcess, seems to grab all SIGCHLD
> > > events, even the ones that have nothing to do with KProcess.
> >
> > After looking at the code, it grabs exactly SIGCHLD and SIGPIPE since it
> > has to know when its child dies.
>
> Yes, but maybe there's a way to tell it to ignore a certain pid, or to
> forward unknown signals, or...
>
> > And it probably is only caught as long as a KProcess exists.
>
> No, the first KProcess creates a KProcessController, but then that one
> remains around... Well, I haven't tested this for sure, but from the code I
> think it doesn't matter if there are still kprocesses running or not.
>
> > You could ignore that pclose() returns -1.
>
> I can't, I want the exit code from the process.
>
> > Do you want to run arbitrary "unknown" programs or a special program ?
>
> A special one, that's why I care about the exit code, it has a very precise
> meaning.

So you are probably better with pipe() - fork() -exec() maybe.

But from the sigaction() man page:
"The siginfo_t parameter to sa_sigaction is a struct with the following 
elements 

siginfo_t {
    int      si_signo;  /* Signal number */
    int      si_errno;  /* An errno value */
    int      si_code;   /* Signal code */
    pid_t    si_pid;    /* Sending process ID */
    uid_t    si_uid;    /* Real user ID of sending process */
    int      si_status; /* Exit value or signal */
    clock_t  si_utime;  /* User time consumed */
    clock_t  si_stime;  /* System time consumed */
    sigval_t si_value;  /* Signal value */
    int      si_int;    /* POSIX.1b signal */
    void *   si_ptr;    /* POSIX.1b signal */
    void *   si_addr;   /* Memory location which caused fault */
    int      si_band;   /* Band event */
    int      si_fd;     /* File descriptor */
}"

looks interesting, I think.
It seems here we can specify the pids we are interested in.

Bye
Alex

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic