ws2_32/socket.c: Fix compile for linux systems without net/ipx.h

Felix Janda felix.janda at posteo.de
Fri Jun 13 12:14:53 CDT 2014


Bruno Jesus wrote:
> On Mon, Jun 2, 2014 at 3:01 PM, Felix Janda <felix.janda at posteo.de> wrote:
> > ---
> >  dlls/ws2_32/socket.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
> > index e31f396..cf5473d 100644
> > --- a/dlls/ws2_32/socket.c
> > +++ b/dlls/ws2_32/socket.c
> > @@ -109,6 +109,8 @@
> >  #  include <linux/types.h>
> >  # endif
> >  # include <linux/ipx.h>
> > +# define SOL_IPX 256
> > +# define IPX_TYPE 1
> >  # define HAS_IPX
> >  #endif
> 
> Hi, can you share the details about how you are compiling this? There
> may be a better solution like not defining HAS_IPX if SOL_IPX is not
> present. If you help me reproduce the issue I can help to fix it.

Thanks for your review. All my patches stem from issues when trying to
compile wine on a musl libc[1] based system.

The wiki[2] contains information on how to get a musl based distro
but in order to reproduce the issue it should be enough to rename the
netipx/ipx.h header file.

The situation is that there is no netipx/ipx.h in musls headers but if
linux headers are installed then there will be  linux/ipx.h. So except
for the definitions of SOL_IPX and IPX_TYPE everything is declared in
order to make dlls/ws2_32/socket.c compile with HAS_IPX.

Without the patch HAS_IPX will be declared anyway since linux/ipx.h
exists. Then there are passages in socket.c behind #ifdef HAS_IPX
where #ifdef SOL_IPX is used in order to determine whether to take
linux or BSD specific code. musl pulls in the BSD specific code and
so the compilation will fail.

Not defining HAS_IPX would also fix the compilation but I don't see
why one has to disable IPX because of 2 ipx specific constants not
declared in linux/ipx.h. (The 2 constants are also declared in an
kernel header not exported to userspace.)

I'm not sure what's the best solution. I guess that one of the main
remaining uses of IPX in linux is to play old network games in wine.
Other possible solutions are for musl to include a netipx/ipx.h
header (unlikely, the headers are tried to be kept as clean as
possible) or declare the constants in sys/socket.h (maybe) or for
the kernel to include the constants in linux/ipx.h.

Felix

[1]: http://musl-libc.org
[2]: http://wiki.musl-libc.org



More information about the wine-devel mailing list