Patches for FreeBSD 5.x compilation

Francois Gouget fgouget at
Mon Nov 19 14:20:29 CST 2001

On Mon, 19 Nov 2001, Steve Kargl wrote:
> What does wine need from <sys/user.h>?

   I had a look at it on Linux and it is needed for the DR_OFFSET macro
(line 80 and others).

   We define DR_OFFSET as:
#define DR_OFFSET(dr) ((int)((((struct user *)0)->u_debugreg) + (dr)))

   And 'struct user' is defined in 'sys/user.h'. So without this
#include we are 'dereferencing pointer to incomplete type'. But actually
this code is in a '#ifdef linux' so it is the #include <sys/user.h> that
should be moved in the same #ifdef. Just like the corresponding FreeBSD
'#include <machine/reg.h>'!
   Hmm... sending a patch.

   I guess that one day Alexandre is going to argue that Linux should
stop polluting the namespace with 'struct user'... Actually something
similar also happened not very long ago with 'struct option', another
good struct name to put in a system header!

> Note, I've also posted to the FreeBSD-current mailing list about
> this conflict.  Some developers have suggested the #ifdef _KERNEL
> protection you mention, and I suspect that this will be 
> implemented at some point in the future.  The stumbling block
> is that certain system utilities (gdb, ps, ptrace, etc.) need
> access to struct proc, which uses struct thread.  Until these
> utilities are updated, I doubt the #ifdef _KERNEL will be
> used.

   That's why I initially proposed to change Wine: it's unrealistic to
expect FreeBSD or any other OS to change their system headers... at
least in any reasonable time frame. Plus it means that Wine would not
work on such platforms.

> I suspect that most people build wine from the FreeBSD Ports
> Collection.  Perhaps, it is best to let the FreeBSD porters
> worry about this problem until FreeBSD 5.x settles down.

   I would like Wine to compile out of the box on more platforms. People
seem to think that Wine is a 'Linux-only' thing and leaving this kind of
problem in the main tree only reinforces this perception.

Francois Gouget         fgouget at
      Any sufficiently advanced bug is indistinguishable from a feature.
                            -- from some indian guy

More information about the wine-devel mailing list