On Thu, Apr 3, 2008 at 9:51 AM, Jonathan Adams <[EMAIL PROTECTED]> wrote:
>
> I did notice that in .../uts/common/dtrace/dtrace.c you did:
>
>     9580 +                case DTRACEACT_BRENDAN:
>     9581 +                        size = sizeof (uint64_t);
>     9582 +                        break;
>     9583 +
>
> I think you should be leaving size alone;  you aren't returning any data.

That was one of the oddities about implementing an action that doesn't
actually return data out of the kernel.  If I didn't set a size here,
the brendan() action wouldn't be consumed (or it would only be
consumed upon hitting a subsequent action.)  The main loop in
dt_consume_cpu() (.../lib/libdtrace/common/dt_consume.c) wasn't
running, as it appeared that there was no data to consume:

  1578  static int
  1579  dt_consume_cpu(dtrace_hdl_t *dtp, FILE *fp, int cpu,
dtrace_bufdesc_t *buf,
  1580      dtrace_consume_probe_f *efunc, dtrace_consume_rec_f *rfunc, void *ar
g)
  1581  {
  1582          dtrace_epid_t id;
  1583          size_t offs, start = buf->dtbd_oldest, end = buf->dtbd_size;
[ ... ]
  1596  again:
  1597          for (offs = start; offs < end; ) {
[ ... ]
  1808                          if (act == DTRACEACT_BRENDAN) {
  1809                                  if (dt_printf(dtp, fp,
"Tracing... Hit Ctrl-C "
  1810                                      "to end.\n") < 0)
  1811                                          return (-1);
  1812                                  goto nextrec;
  1813                          }
  1814
  1815                          if (DTRACEACT_ISPRINTFLIKE(act)) {

Of course, this wasn't necessarily the optimal way to implement this.
I could also have implemented it similarly to printf, passing the
string into and back out of the kernel, or I could have done it
entirely in the compiler.

Unfortunately, I had a hard deadline, and I couldn't really ask for
help without tipping my hand.  ;-)

Chad
_______________________________________________
dtrace-discuss mailing list
[email protected]

Reply via email to