From a85a5f638479d7fd8f1214b4dc1b4c673393d568 Mon Sep 17 00:00:00 2001
From: dd86k
Date: Mon, 16 Mar 2026 19:37:01 -0400
Subject: [PATCH 1/3] Define dirfd macro for NetBSD
---
std/process.d | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/std/process.d b/std/process.d
index d359ca0bae4..6711d3d6759 100644
--- a/std/process.d
+++ b/std/process.d
@@ -1048,9 +1048,21 @@ private Pid spawnProcessPosix(scope const(char[])[] args,
immutable maxDescriptors = cast(int) r.rlim_cur;
- // Missing druntime declaration
- pragma(mangle, "dirfd")
- extern(C) nothrow @nogc int dirfd(DIR* dir);
+ // dirfd: On NetBSD, this is a macro in dirent.h, not a function,
+ // so provide a D implementation instead.
+ version (NetBSD)
+ {
+ static int dirfd(DIR* dir) nothrow @nogc
+ {
+ return *(cast(int*) dir);
+ }
+ }
+ else
+ {
+ // Missing druntime declaration
+ pragma(mangle, "dirfd")
+ extern(C) nothrow @nogc int dirfd(DIR* dir);
+ }
DIR* dir = null;
From 9f63d475e7b33a09dd7a59bae98d691a1d6b78a6 Mon Sep 17 00:00:00 2001
From: dd86k
Date: Tue, 17 Mar 2026 08:55:21 -0400
Subject: [PATCH 2/3] std.process: Locally import dirfd for spawnProcessPosix
---
std/process.d | 18 +-----------------
1 file changed, 1 insertion(+), 17 deletions(-)
diff --git a/std/process.d b/std/process.d
index 6711d3d6759..ba3788d9c03 100644
--- a/std/process.d
+++ b/std/process.d
@@ -1036,7 +1036,7 @@ private Pid spawnProcessPosix(scope const(char[])[] args,
{
void fallback (int lowfd)
{
- import core.sys.posix.dirent : dirent, opendir, readdir, closedir, DIR;
+ import core.sys.posix.dirent : dirfd, dirent, opendir, readdir, closedir, DIR;
import core.sys.posix.unistd : close;
import core.sys.posix.stdlib : atoi, malloc, free;
import core.sys.posix.sys.resource : rlimit, getrlimit, RLIMIT_NOFILE;
@@ -1048,22 +1048,6 @@ private Pid spawnProcessPosix(scope const(char[])[] args,
immutable maxDescriptors = cast(int) r.rlim_cur;
- // dirfd: On NetBSD, this is a macro in dirent.h, not a function,
- // so provide a D implementation instead.
- version (NetBSD)
- {
- static int dirfd(DIR* dir) nothrow @nogc
- {
- return *(cast(int*) dir);
- }
- }
- else
- {
- // Missing druntime declaration
- pragma(mangle, "dirfd")
- extern(C) nothrow @nogc int dirfd(DIR* dir);
- }
-
DIR* dir = null;
// We read from /dev/fd or /proc/self/fd only if the limit is high enough
From 769707f407a09c669fd59a78fc96c2126cfc3c65 Mon Sep 17 00:00:00 2001
From: Mindy Batek
Date: Wed, 18 Mar 2026 16:39:02 +0100
Subject: [PATCH 3/3] Bump