Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Oct 2002 19:34:09 -0700 (PDT)
From:      Lamont Granquist <lamont@scriptkiddie.org>
To:        freebsd-current@freebsd.org
Subject:   sys/event.h EV_SET macro suggestion
Message-ID:  <20021003190315.W8258-100000@coredump.scriptkiddie.org>

next in thread | raw e-mail | index | archive | help

I'd suggest this:

#define EV_SET(kevpin, a, b, c, d, e, f) do {   \
        struct kevent *kevp = kevpin;           \
        (kevp)->ident = (a);                    \
        (kevp)->filter = (b);                   \
        (kevp)->flags = (c);                    \
        (kevp)->fflags = (d);                   \
        (kevp)->data = (e);                     \
        (kevp)->udata = (f);                    \
} while(0)

As opposed to what it is currently defined as:

#define EV_SET(kevp, a, b, c, d, e, f) do {     \
        (kevp)->ident = (a);                    \
        (kevp)->filter = (b);                   \
        (kevp)->flags = (c);                    \
        (kevp)->fflags = (d);                   \
        (kevp)->data = (e);                     \
        (kevp)->udata = (f);                    \
} while(0)

The alternative I'm suggesting will work in the use case:

EV_SET(&kev_in[numchanges++], fd, EVFILT_READ, EV_DELETE, 0, 0, 0);

Which is probably a common way to try to use the macro, and the existing
behavior can certainly catch you off guard...


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021003190315.W8258-100000>