[RFC] reworking FreeBSD's SDT implementation

Mikolaj Golub trociny at FreeBSD.org
Sun Jul 14 07:56:40 UTC 2013


On Sat, Jul 13, 2013 at 07:42:00PM -0400, Mark Johnston wrote:

> Thanks for pointing this out - I've fixed these problems in the
> following diff:
> 
> http://people.freebsd.org/~markj/patches/sdt-module-info/20130713-sdt-module-info.diff
> 
> It turns out that we typedef modctl_t to struct linker_file, so I don't
> need to have separate cases for defined(sun) and !defined(sun) in a few
> places.

Then in dtrace.h: 

  -extern void (*dtrace_modload)(modctl_t *);
  -extern void (*dtrace_modunload)(modctl_t *);
  +extern void (*dtrace_modload)(struct linker_file *);
  +extern int (*dtrace_modunload)(struct linker_file *);

you might also want to return modctl_t back? I suppose
dtrace_modunload also requires '#if defined(sun)' here.

Also, is there some reason you choose to return 1 on modunload
failure? Usually we return -1 on error, it would be nice to follow the
convention.

In sdt_disable(), before decreasing nenabled, it might be useful to
add an assertion that nenabled is not going to reach negative value.

-- 
Mikolaj Golub


More information about the freebsd-dtrace mailing list