[Issue 17666] std.c.linux.socket has no replacement

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Sep 1 02:43:50 PDT 2017


https://issues.dlang.org/show_bug.cgi?id=17666

--- Comment #9 from Jonathan M Davis <issues.dlang at jmdavisProg.com> ---
(In reply to Sebastiaan Koppe from comment #8)
> Finally had some time to take a look. Pretty awesome. Thanks.
> 
> But why in core.sys.linux.netinet.in_ is some stuff behind static
> if(__USE_MISC)? As far as I can tell that conditional evaluates to false,
> and there is a structure in there - ip_mreq - that I need.

Unless I screwed it up, it follows what's defined in the header file. And yes,
looking at core.sys.posix.config, it looks like it always evaluates to false.
It needs either _BSD_SOURCE or _SVID_SOURCE to be true, but they're both false.
I don't know whether that's correct or not. But if __USE_MISC is normally
defined on a Linux system using glibc, then that implies that either how we're
defining it is wrong or that we're doing the wrong thing with _BSD_SOURCE
and/or _SVID_SOURCE.

> Also, the static if(__USE_MISC) at
> https://github.com/dlang/druntime/blob/master/src/core/sys/linux/netinet/in_.
> d#L168 is already inside a static if (__USE_MISC) conditional block.

That does look odd. Rechecking the file, it looks like I missed an #endif when
reading it and thought that that section went longer than it did (braces with
staci if are _so_ much better for figuring out when a section begins and ends).
I've created a PR to fix it:

https://github.com/dlang/druntime/pull/1911

That doesn't get you ip_mreq though. It's clearly in the __USE_MISC section.
So, if we're going to have it, we need to figure out what the deal with
__USE_MISC is and how we should be handling it such that it's true if it's true
on Linux, but I really don't know anything about it.

--


More information about the Digitalmars-d-bugs mailing list