DragonFly submit List (threaded) for 2007-08
DragonFly BSD
DragonFly submit List (threaded) for 2007-08
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: [PATCH] [V2] add options to ps(1) to display lwp data


From: "Simon 'corecode' Schubert" <corecode@xxxxxxxxxxxx>
Date: Wed, 15 Aug 2007 11:13:17 +0200

Matthew Dillon wrote:
:It wasn't ment to be a pointer, just an identifier.  And the td pointer is a perfect identifier.  Of course, it doesn't format as nicely as a small number, but so what.  pid == -1 means kernel, tid *always* means thread identifier.
:
:cheers
:  simon

    It can't be negative and I don't want to hack around the fact by masking
    it with 0x7fffffff, because that requires visibility into the machine
    layer to work properly in 64 bit environments.  Also, there's nothing
    that says the TID is going to be the same or similar in size to a pointer,
    and userland does in fact need the TID because that's what you specify
    when you send signals.

    We can't just use a thread pointer between userland and the kernel.
    The kernel has to validate the ID passed to it either way so it just
    doesn't save any work at all to do that.

We can't signal a kernel thread anyways, so this is simply just kernel->userland data export. This is anyways only informational for ps and top and thelike, and also only if they want to show kernel threads.


By setting tid to -1 we lose information. Of course not setting it to -1 means we need more intelligence in ps etc, but they need a certain amount of intelligence anyways. Adding a new field means we need this intelligence *anyways* in ps, so there is no gain *at all*.

The pointer not fitting into the tid field is a valid point, however. Still, this interface is proc and lwp centric and only as a *special case* it is being used to export kernel thread information. So we really shouldn't add a special field for that. Oh well, thinking of it, maybe we don't need the td ident at all :/

cheers
 simon

--
Serve - BSD     +++  RENT this banner advert  +++    ASCII Ribbon   /"\
Work - Mac      +++  space for low €€€ NOW!1  +++      Campaign     \ /
Party Enjoy Relax   |   http://dragonflybsd.org      Against  HTML   \
Dude 2c 2 the max   !   http://golden-apple.biz       Mail + News   / \



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