From: compudj@krystal.dyndns.org (Mathieu Desnoyers)
Subject: [ltt-dev] [UST PATCH] Only send the pids that are currently online in ustctl_get_online_pids().
Date: Fri, 1 Apr 2011 16:44:37 -0400 [thread overview]
Message-ID: <BLU0-SMTP997A9D747B03855656147C96BE0@phx.gbl> (raw)
In-Reply-To: <BLU0-SMTP815FCAF2AACE30776FFBF296BE0@phx.gbl>
* Mathieu Desnoyers (compudj at krystal.dyndns.org) wrote:
> * Matthew Khouzam (matthew.khouzam at gmail.com) wrote:
> > Signed-off-by: Matthew Khouzam <matthew.khouzam at ericsson.com>
> > ---
> > libustctl/libustctl.c | 19 ++++++++++++++++++-
> > 1 files changed, 18 insertions(+), 1 deletions(-)
> >
> > diff --git a/libustctl/libustctl.c b/libustctl/libustctl.c
> > index d57e645..07c81f3 100644
> > --- a/libustctl/libustctl.c
> > +++ b/libustctl/libustctl.c
> > @@ -92,6 +92,8 @@ pid_t *ustctl_get_online_pids(void)
> > {
> > struct dirent *dirent;
> > DIR *dir;
> > + DIR *proc_dir;
> > + char proc_dir_path[PATH_MAX];
> > unsigned int ret_size = 1 * sizeof(pid_t), i = 0;
> >
> > dir = opendir(SOCK_DIR);
> > @@ -117,7 +119,22 @@ pid_t *ustctl_get_online_pids(void)
> > * We need to figure out an intelligent way of solving
> > * this, maybe connect-disconnect.
> > */
> > - if (1) {
> > + snprintf(proc_dir_path, PATH_MAX, "/proc/%u/", ret[i]);
> > + proc_dir = opendir(proc_dir_path);
> > + /*
> > + * Note:
> > + * We should not remove the empty dir in this pass.
> > + * A process can die, a new process can be born and
> > + * assigned to that PID. the only way to avoid this
>
> I'll take it from here and fix the leftovers.
>
> the -> The
>
> "The only way" -> "One natural way"
>
> > + * would be to de-register and register centrally.
> > + * Ltt-sessiond would be a good candidate for such a
> > + * location.
> > + */
> > + if (proc_dir) {
>
> /* We... -> /*
> * We...
>
> I'll merge the patch with these changes.
Oh, actually, can you rebase on the latest work merged by Nils ? The
patch does not apply to the git HEAD. And while you are there, can you
fix the things I noted above ?
Thanks,
Mathieu
>
> Thanks,
>
> Mathieu
>
> > + /* We only needed to check if it's valid
> > + * so we close it here
> > + */
> > + closedir(proc_dir);
> > ret_size += sizeof(pid_t);
> > ret = (pid_t *) realloc(ret, ret_size);
> > ++i;
> > --
> > 1.7.0.4
> >
> >
> > _______________________________________________
> > ltt-dev mailing list
> > ltt-dev at lists.casi.polymtl.ca
> > http://lists.casi.polymtl.ca/cgi-bin/mailman/listinfo/ltt-dev
> >
>
> --
> Mathieu Desnoyers
> Operating System Efficiency R&D Consultant
> EfficiOS Inc.
> http://www.efficios.com
>
> _______________________________________________
> ltt-dev mailing list
> ltt-dev at lists.casi.polymtl.ca
> http://lists.casi.polymtl.ca/cgi-bin/mailman/listinfo/ltt-dev
>
--
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com
prev parent reply other threads:[~2011-04-01 20:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-01 20:35 Matthew Khouzam
2011-04-01 20:42 ` Mathieu Desnoyers
2011-04-01 20:44 ` Mathieu Desnoyers [this message]
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=BLU0-SMTP997A9D747B03855656147C96BE0@phx.gbl \
--to=compudj@krystal.dyndns.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