Should ps -p list threads?

Daniel Eischen eischen at vigrid.com
Thu Feb 12 12:26:26 PST 2004


On Thu, 12 Feb 2004, Scott Long wrote:

> On Thu, 12 Feb 2004, Daniel Eischen wrote:
> > On Thu, 12 Feb 2004, Julian Elischer wrote:
> > >
> > > The origianlpatch had _H show threads and normal ps did not..
> > > I don't know why this is as it is...
> >
> > Because it didn't take into account other 'ps' options.  Enabling
> > or disabling thread info should be an option for all KERN_PROC_foo,
> > not a separate option.  If I were to change it, I would add
> >
> > 	#define	KERN_PROC_THREADS	0x10000
> >
> > to <sys/sysctl.h>.  Then allow:
> >
> > 	mib[0] = CTL_KERN;
> > 	mib[1] = KERN_PROC;
> > 	mib[2] = KERN_PROC_UID | KERN_PROC_THREADS;
> > 	mib[3] = pid;
> >
> > ...
> >
> 
> Yeah, it's probably cleaner that way.  Still, you'll have to deal with
> KERN_PROC_PROC vs. KERN_PROC_ALL.  Maybe just remove both and have
> KERN_PROC_THREAD be a modifier for KERN_PROC_PID.

I was just going to allow them for backward compatibility.  Using
KERN_PROC_ALL would imply KERN_PROC_THREADS.

> Are you
> willing to do the kernel work for this too?

Preliminary (untested) patch just to show you where I was headed:

  http://people.freebsd.org/~deischen/kse/sys.diffs.021204

I'll test and debug it, make associated changes in libkvm and
ps if you think the idea is OK.

-- 
Dan Eischen



More information about the freebsd-threads mailing list