linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luiz Fernando Capitulino <lcapitulino@conectiva.com.br>
To: "Matías Aguirre" <matiasaguirre@gmail.com>
Cc: linux prg <linux-c-programming@vger.kernel.org>
Subject: Re: process information
Date: Thu, 07 Jul 2005 09:09:54 -0300	[thread overview]
Message-ID: <42CD1B92.1070806@conectiva.com.br> (raw)
In-Reply-To: <a3c4234105070613154993e652@mail.gmail.com>

Hi Matías,

Matías Aguirre wrote:
> a little question, is there any way to get a process current children count?

 Yes, there is. But I can only think in a 'brute force' way: you can scan the
/proc file-system.

 Let's say you want to know how many children the X process has. You open
each '/proc/PID/status' and read the 'Ppid' field. If it's equals X, you
count it.

 As I said, it's ugly, but I cannot think in another solution.

 You can try to read the code of 'pstree' program, but I guess it
scans the /proc file-system too.

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

  parent reply	other threads:[~2005-07-07 12:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-06 20:15 process information Matías Aguirre
2005-07-07  4:46 ` sumit kalra
2005-07-07 12:09 ` Luiz Fernando Capitulino [this message]
2005-07-07 16:26   ` Matías Aguirre
2005-07-08 19:48     ` Luiz Fernando Capitulino
2005-07-07 18:48   ` x86 Endiannes and libc printf Nanakos Chrysostomos
2005-07-09 17:43     ` Glynn Clements

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=42CD1B92.1070806@conectiva.com.br \
    --to=lcapitulino@conectiva.com.br \
    --cc=linux-c-programming@vger.kernel.org \
    --cc=matiasaguirre@gmail.com \
    /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).