cvs commit: src/bin/ps

YONETANI Tomokazu qhwt+dfly at les.ath.cx
Mon Nov 15 18:36:01 PST 2004


On Mon, Nov 15, 2004 at 03:05:49PM +0100, Eirik Nygaard wrote:
> On Mon, Nov 15, 2004 at 10:59:18PM +0900, YONETANI Tomokazu wrote:
> > On Sun, Nov 14, 2004 at 05:58:42AM -0800, Eirik Nygaard wrote:
> > > eirikn      2004/11/14 05:58:42 PST
> > > 
> > > DragonFly src repository
> > > 
> > >   Modified files:
> > >     bin/ps               Makefile extern.h keyword.c print.c 
> > >   Log:
> > >   Constify VAR.
> > >   
> > >   Submitted by: joerg
> > >   
> > >   WARNS=6 cleanup.
> > >   
> > >   Revision  Changes    Path
> > >   1.3       +3 -1      src/bin/ps/Makefile
> > >   1.8       +1 -1      src/bin/ps/extern.h
> > >   1.13      +118 -107  src/bin/ps/keyword.c
> > >   1.16      +1 -1      src/bin/ps/print.c
> > 
> > No, you can't do this constification yet. Try `ps u' and it catches
> > SIGBUS because scanvars() tries to write to a member of var[].
> > The reason you aren't seeing warning from the compiler is because bsearch()
> > returns void * even though it's passed const void * as its second argument.
> > 
> 
> I see, thanks for noticing. I backed it out for now. Joerg can deal with it
> later if he wants.

I wrote a patch for this:
    http://les.ath.cx/DragonFly/ps.diff.gz

- add three fields header, dwidth, width in VARENT and split off run-time
  modifications to VAR. original fields in VAR are renamed by adding prefix
  `default_' to help finding references to those fields in VAR.
- fix a bug in `ps -oKEYWORD=alternative' case where free()'ed string
  is used in header line.
- make var[] static as it's not referenced outside keyword.c .





More information about the Commits mailing list