macOS doesn't have a way to detect this via the FIODTYPE ioctl(), so we have to resort to detecting the NUL device via major and minor version number. Fortunately, that hasn't changed since the inception of macOS.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55568
-- v4: ntdll: correctly detect the NUL device under macOS
From: John Szakmeister john@szakmeister.net
macOS doesn't have a way to detect this via the FIODTYPE ioctl(), so we have to resort to detecting the NUL device via major and minor device number. Fortunately, that hasn't changed since the inception of macOS.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55568 --- dlls/ntdll/unix/file.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c index a475fcc3225..7e6363c5aa7 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -6793,7 +6793,13 @@ NTSTATUS get_device_info( int fd, FILE_FS_DEVICE_INFORMATION *info ) break; #endif } - /* no special d_type for parallel ports */ + /* no special d_type for parallel ports */ + +#if defined(__APPLE__) + /* /dev/null on has been 3, 2 since the start of OSX */ + if (d_type == D_DISK && major(st.st_rdev) == 3 && minor(st.st_rdev) == 2) + info->DeviceType = FILE_DEVICE_NULL; +#endif } } #endif
On Thu Apr 10 20:50:51 2025 +0000, John Szakmeister wrote:
I'll give it a go tomorrow and see what it looks like. I had it where it was to avoid the unnecessary call to ioctl() as we can fully make the decision about the type right then and there. But you have much more experience with Wine and what's more in line with what's preferred by the project, so I'm happy to defer to that experience. :-)
@bshanks Updated the merge request with your suggestion. Thanks for the feedback!