ORBIT-USER: libmac compile error?

Luis R. Rodriguez mcgrof at gmail.com
Wed Oct 25 13:03:49 EDT 2006


On 10/24/06, Rodney Berriman <Rodney.Berriman at nicta.com.au> wrote:
>
>  Hi Kishore,
>
>  I'm getting a compile error building libmac:
>
>  In file included from ./libmac_cmn.h:132,
>                   from ./libmac.h:36,
>                   from libmac_ifparams.c:13:
>  /usr/include/linux/socket.h:7:2: warning: #warning "You should include <sys/socket.h>. This time I will do it for you."
>  libmac_ifparams.c: In function `mac_append_params':
>  libmac_ifparams.c:584: error: syntax error before "__user"
>
>  the line is:
>       iwr.u.data.pointer = (void __user *) plist;
>
>  Similar error occurring at libmac_ifinfo.c:368
>
>
>  changing (void __user *) to (void *) compiles OK, but is it correct?
>
>
>  many thanks,
>  Rodney

Short and sweet:

The quick answer is you can remove it safely.

---

Warning you'll get bored, the long answer:

__user is a kernel'ism which is set there in case you include some
kernel headers in userspace. Specifically it was defined in
include/linux/compiler.h. It basically defines it as:

#ifdef __CHECKER__
# define __user         __attribute__((noderef, address_space(1)))
# define __kernel       /* default address space */
...
#else
# define __user
# define __kernel
...
#endif

__CHECKER__ is defined for the kernel when compiling the kernel make
C=1, which will run Linus' "sparse" program on all C files that get
recompiled. More boring details about sparse are available at
Documentation/sparse.txt

By kernel'ism I mean we do this in the kernel. We do it to distinguish
between userspace and kernel space addresses. In this case we can
remove this as we don't won't be running sparse anyway. I've removed
it and commited to trunk.

  Luis



More information about the orbit-user mailing list