tags 506303 help
thankyou
On Fri, Nov 21, 2008 at 09:41:04AM +1100, Russell Coker wrote:
> What program do you think it fits better?
> 
> > > Currently if you have a process with a supplementary GID of 0 then
> > > grepping /proc seems to be the only way to discover this fact.
Actually re-looking at this, with an output flag (-o sgid maybe) it
could fit into ps.

ps is not the problem, that bit of code is relatively simple.  The real
trick is working with proc/readproc.c, specifically status2proc()

If I had written this, I would read each line in a while loop and match
with a strncmp. This function uses a hash based of the 1st,3rd and 4th
letters in the line and then it does a comparison.  It's probably a lot
quicker.

However, to me its a *LOT* more difficult when you want to add another
field in the table, like what we want to do here.

I think that you have to extract a /proc/##/status file, leave only the
lines you want and then run gperf over it. Then take that output and
munge it into the code that is there.

Not simple, if anyone reading this actually understands gperf (or wants
to) they can have a crack at it. I can write the code that then copies
the value in the status file and fiddles with the ps flags but that
hashing has got me stuck.

 - Craig
-- 
Craig Small      GnuPG:1C1B D893 1418 2AF4 45EE  95CB C76C E5AC 12CA DFA5
http://www.enc.com.au/                             csmall at : enc.com.au
http://www.debian.org/          Debian GNU/Linux, software should be Free 



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to