Bug 13747 – Linux CMSG_NXTHDR is private, since alias doesn't change protection level

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2014-11-18T19:17:00Z
Last change time
2014-12-12T10:25:31Z
Assigned to
nobody
Creator
redballoon36

Comments

Comment #0 by redballoon36 — 2014-11-18T19:17:40Z
CMSG_NXTHDR on Linux is defined as a macro wrapping the __csmg_nxthdr function. The translation to D in core.sys.posix.sys.socket.d has an extern __cmsg_nxthdr() function, which is private. This is "exposed" using an alias, CMSG_NXTHDR. But since the alias doesn't change the protection, so CMSG_NXTHDR is not usable. I'm putting together a pull request for a bunch of CMSG changes & fixes, but I don't know what the right way to fix this part is.
Comment #1 by redballoon36 — 2014-11-21T20:16:01Z
Comment #2 by redballoon36 — 2014-12-10T20:30:35Z
Per Martin's comments (https://github.com/D-Programming-Language/druntime/pull/1034), this is a compiler bug, not a problem with the code as originally written in druntime. private inout(cmsghdr)* __cmsg_nxthdr(inout(msghdr)*, inout(cmsghdr)*) pure nothrow @nogc; alias __cmsg_nxthdr CMSG_NXTHDR; CMSG_NXTHDR should have default protection instead of private. In the meantime, PR 1034 has been merged; it uses a one-line function for CMSG_NXTHDR instead of an alias.
Comment #3 by code — 2014-12-12T10:25:31Z
Thanks