Bug 24417 – core.sys.posix.sys.select: fds_bits named __fds_bits on FreeBSD
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
druntime
Product
D
Version
D2
Platform
All
OS
FreeBSD
Creation time
2024-02-28T04:27:01Z
Last change time
2024-02-28T05:27:17Z
Keywords
pull
Assigned to
No Owner
Creator
Jonathan M Davis
Comments
Comment #0 by issues.dlang — 2024-02-28T04:27:01Z
It looks like on FreeBSD (and on the BSDs in general) fds_bits is declared using a #define - e.g.
---
typedef struct fd_set {
__fd_mask __fds_bits[_howmany(FD_SETSIZE, _NFDBITS)];
} fd_set;
#if __BSD_VISIBLE
#define fds_bits __fds_bits
#endif
---
rather than having the standard name used directly - probably due in part to the quirks of C with typedef-ing structs and unions. But the standard name is fds_bits, not __fds_bits, so either the field needs to be renamed to fds_bits, or it needs to be aliased, otherwise the binding for fds_bits doesn't actually exist.
Comment #1 by dlang-bot — 2024-02-28T04:43:25Z
@jmdavis created dlang/dmd pull request #16261 "Fix bugzilla issue 24417: fds_bits named incorrectly on FreeBSD" fixing this issue:
- Fix bugzilla issue 24417: fds_bits named incorrectly on FreeBSD
This fixes the name of fds_bits on FreeBSD - or actually, on all of the
BSDs listed in select.d. The way that they're declared in C is with a
member named __fds_bits and then a #define for fds_bits. The D
declarations managed to copy the struct declarations with the __ name
but didn't add aliases to correspond to the #defines.
The standard name is fds_bits and is what any user code should be using,
so I don't see any reason to have the __ versions other than to avoid
breaking any code that used the __ versions, because that's what was
there. So, I fixed the names and added deprecated aliases for the old
ones.
https://github.com/dlang/dmd/pull/16261
Comment #2 by dlang-bot — 2024-02-28T05:27:17Z
dlang/dmd pull request #16261 "Fix bugzilla issue 24417: fds_bits named incorrectly on FreeBSD" was merged into master:
- fb40dcf8668af10eb6bc59c5455e2f705c61532d by Jonathan M Davis:
Fix bugzilla issue 24417: fds_bits named incorrectly on FreeBSD
This fixes the name of fds_bits on FreeBSD - or actually, on all of the
BSDs listed in select.d. The way that they're declared in C is with a
member named __fds_bits and then a #define for fds_bits. The D
declarations managed to copy the struct declarations with the __ name
but didn't add aliases to correspond to the #defines.
The standard name is fds_bits and is what any user code should be using,
so I don't see any reason to have the __ versions other than to avoid
breaking any code that used the __ versions, because that's what was
there. So, I fixed the names and added deprecated aliases for the old
ones.
https://github.com/dlang/dmd/pull/16261