diff --git a/druntime/src/core/sys/freebsd/unistd.d b/druntime/src/core/sys/freebsd/unistd.d index 493cda1c8c9f..ebb7afa2726c 100644 --- a/druntime/src/core/sys/freebsd/unistd.d +++ b/druntime/src/core/sys/freebsd/unistd.d @@ -17,3 +17,5 @@ extern(C): nothrow: int getosreldate() pure @trusted; + +void closefrom(int); diff --git a/druntime/src/core/sys/linux/unistd.d b/druntime/src/core/sys/linux/unistd.d index faa226cf407c..548870268dbf 100644 --- a/druntime/src/core/sys/linux/unistd.d +++ b/druntime/src/core/sys/linux/unistd.d @@ -5,6 +5,7 @@ public import core.sys.posix.unistd; version (linux): extern(C): nothrow: +@nogc: // Additional seek constants for sparse file handling // from Linux's unistd.h, stdio.h, and linux/fs.h @@ -21,3 +22,6 @@ char* getpass(const(char)* prompt); // Exit all threads in a process void exit_group(int status); + +/// Close all open file descriptors greater or equal to `lowfd` +void closefrom(int lowfd); diff --git a/druntime/src/core/sys/openbsd/unistd.d b/druntime/src/core/sys/openbsd/unistd.d index 4232c0360497..9618543d8da8 100644 --- a/druntime/src/core/sys/openbsd/unistd.d +++ b/druntime/src/core/sys/openbsd/unistd.d @@ -19,3 +19,5 @@ int getthrname(pid_t, char*, size_t); int pledge(const scope char*, const scope char*); int setthrname(pid_t, const scope char*); int unveil(const scope char*, const scope char*); + +int closefrom(int);