tech-kern archive

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

Re: kern/42030 - tracking of file descriptors by ktrace/kdump



In article <20110530232006.GA674@x1000.localdomain>,
Alexander Nasonov  <alnsn%yandex.ru@localhost> wrote:
>-=-=-=-=-=-
>
>Hi,
>Can I commit the patches from my kern/42030?

> static void
>+ktrexecfd(struct ktr_execfd *ktr)
>+{
>+      static const char *dnames[] = { DTYPE_NAMES };
>+      const size_t dnames_sz = sizeof(dnames) / sizeof(dnames[0]);
>+      if (ktr->ktr_dtype > 0 && ktr->ktr_dtype < dnames_sz)

This is just:

        if (ktr->ktr_dtype < __arraycount(dnames))
>+              printf("%s %d\n", dnames[ktr->ktr_dtype], ktr->ktr_fd);
>+      else
>+              printf("%d\n", ktr->ktr_fd);

I would print:
                printf("%d *%u*\n", ktr->ktr_fd, ktr->ktr_dtype);


Looks good to me.

christos



Home | Main Index | Thread Index | Old Index