Skip to content

Remove dirfd definition for spawnProcessPosix#10976

Open
dd86k wants to merge 3 commits intodlang:masterfrom
dd86k:dd86k/netbsd-dirfd
Open

Remove dirfd definition for spawnProcessPosix#10976
dd86k wants to merge 3 commits intodlang:masterfrom
dd86k:dd86k/netbsd-dirfd

Conversation

@dd86k
Copy link

@dd86k dd86k commented Mar 16, 2026

NetBSD sources define dirfd as a macro, and not a function, in (NetBSD-src) include/dirent.h, as:

#define	dirfd(dirp)	((dirp)->dd_fd)

This commit defines a macro (well, static function) akin to NetBSD's macro. Without it, there is a linker error for an undefined symbol for dirfd.

The cast is done as-is because the current ABI guarantees dd_fd as the first field of _dirdesc (with typedef struct _dirdesc DIR;), and DIR structure in Druntime is only defined as an alias to void*.

It's required to build DUB, because it spawns processes. I have compiled and used DUB on my end. It is in a working state and was able to compile my ddhx project.

@dlang-bot
Copy link
Contributor

Thanks for your pull request and interest in making D better, @dd86k! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the coverage diff by visiting the details link of the codecov check)
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

Please see CONTRIBUTING.md for more information.


If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment.

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "master + phobos#10976"

@dd86k
Copy link
Author

dd86k commented Mar 17, 2026

This PR is now waiting on dlang/dmd#22750 (dirfd definition in core.sys.posix.dirent).

@dd86k dd86k changed the title Define dirfd macro for NetBSD for spawnProcessPosix Remove dirfd definition for spawnProcessPosix Mar 17, 2026
@thewilsonator
Copy link
Contributor

dependant PR merged

@0xEAB 0xEAB requested a review from rikkimax March 18, 2026 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants