Issue 24417 - core.sys.posix.sys.select: fds_bits named __fds_bits on FreeBSD
Summary: core.sys.posix.sys.select: fds_bits named __fds_bits on FreeBSD
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: druntime (show other issues)
Version: D2
Hardware: All FreeBSD
: P1 normal
Assignee: No Owner
URL:
Keywords: pull
Depends on:
Blocks:
 
Reported: 2024-02-28 04:27 UTC by Jonathan M Davis
Modified: 2024-02-28 05:27 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Jonathan M Davis 2024-02-28 04:27:01 UTC
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 Dlang Bot 2024-02-28 04:43:25 UTC
@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 Dlang Bot 2024-02-28 05:27:17 UTC
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