computing userland pointers
drhodus at catpa.com
drhodus at catpa.com
Fri Sep 12 18:33:49 PDT 2003
Quoting "David P. Reese, Jr." <daver at xxxxxxxxxxxx>:
> In separating recvmsg() I want to be able to copyout to a single member of
> a struct msghdr that lives in userland. I'm currently using code like
>
> ucontrollenp = (socklen_t *)((caddr_t)uap->msg + offsetof(struct
msghdr,
> msg_controllen));
>
> I'm curious if anything like this already exists as a macro. If it such
> a macro doesn't exist, would there be any argument against adding one?
>
> #define UADDRESS(cast, type, addr, member) \
> (cast)((caddr_t)addr + offsetof(type, member))
>
> I think it could be placed in sys/systm.h.
What is the approximate calculation of the use frequency if this
macro if implemented ?
-DR
More information about the Kernel
mailing list