svn commit: r355600 - in head: share/man/man9 sys/kern sys/sys

Alexey Dokuchaev danfe at freebsd.org
Wed Dec 11 09:26:17 UTC 2019


On Tue, Dec 10, 2019 at 11:09:41PM +0100, Hans Petter Selasky wrote:
> On 2019-12-10 22:58, John Baldwin wrote:
> >   While here, add <sys/callout.h> to the manpage.
> 
> FYI:
> 
> Linux guys eliminated the "void *c_arg" in their timer implementation by
> using container_of() to get callback argument. We could possibly do the
> same!

#define container_of(ptr, type, member) ({                              \
        void *__mptr = (void *)(ptr);                                   \
        BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
                         !__same_type(*(ptr), void),                    \
                         "pointer type mismatch in container_of()");    \
        ((type *)(__mptr - offsetof(type, member))); })

That's one of those things that make Linux so unpleasant to work with.
Frankly, I don't think we want that for FreeBSD.

./danfe


More information about the svn-src-head mailing list