From: Gauvain Pocentek <gauvainpocentek@gmail.com>
To: linux-c-programming@vger.kernel.org
Subject: wait for childs of a child process
Date: Mon, 09 Feb 2009 15:20:44 +0100 [thread overview]
Message-ID: <49903BBC.4010802@gmail.com> (raw)
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
next reply other threads:[~2009-02-09 14:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-09 14:20 Gauvain Pocentek [this message]
2009-02-09 14:56 ` wait for childs of a child process Michael Iatrou
2009-02-09 15:29 ` Gauvain Pocentek
2009-02-09 14:56 ` ben
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=49903BBC.4010802@gmail.com \
--to=gauvainpocentek@gmail.com \
--cc=linux-c-programming@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).