Re: wait for childs of a child process

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

 



Gauvain Pocentek a écrit :
> Hello,
> 
> I have to monitor applications on a system (users who run the application, how
> long, etc.), but I'm having troubles with applications which fork during startup
> (openoffice for instance).
> 
> Here is a snippet of what I planned to use (checks omitted to simplify):
> 
> ####################################
> #include <stdio.h>
> #include <sys/wait.h>
> #include <sys/types.h>
> 
> int main()
> {
>     int status;
>     pid_t p = fork();
>     if (p == 0)
>         system ("soffice");
>     else if (p > 0)
>     {
>         waitpid (p, &status, 0);
>         printf ("done\n");
>     }
> 
>     return 0;
> }
> 
> ####################################
> 
> Is there a way to make wait() or an other syscall monitor the process' children,
> or is patching openoffice (and other apps behaving in the same way) the only
> solution?
> 
> Thanks,
> Gauvain Pocentek

Would not be simpler to use Unix's pacct feature ?
It may not be enabled, though, on some linux distro.

- ben
--
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Assembler]     [Git]     [Kernel List]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [C Programming]     [Yosemite Campsites]     [Yosemite News]     [GCC Help]

  Powered by Linux