Damjan Jovanovic : ntdll: Improve character device type detection on FreeBSD and macOS.
Alexandre Julliard
julliard at winehq.org
Mon Nov 9 15:11:51 CST 2020
Module: wine
Branch: master
Commit: bf8da00ee02ea33c4a7d0a9a5fc32c2a4e08866e
URL: https://source.winehq.org/git/wine.git/?a=commit;h=bf8da00ee02ea33c4a7d0a9a5fc32c2a4e08866e
Author: Damjan Jovanovic <damjan.jov at gmail.com>
Date: Mon Nov 9 03:47:21 2020 +0200
ntdll: Improve character device type detection on FreeBSD and macOS.
Signed-off-by: Damjan Jovanovic <damjan.jov at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
configure | 2 +-
configure.ac | 2 +-
dlls/ntdll/unix/file.c | 28 ++++++++++++++++++++++++++++
include/config.h.in | 3 +++
4 files changed, 33 insertions(+), 2 deletions(-)
diff --git a/configure b/configure
index 943d4c5d8f4..2d92f52b4c6 100755
--- a/configure
+++ b/configure
@@ -7589,7 +7589,7 @@ fi
-for ac_header in sys/mount.h sys/statfs.h sys/user.h sys/vfs.h
+for ac_header in sys/conf.h sys/mount.h sys/statfs.h sys/user.h sys/vfs.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "#include <sys/types.h>
diff --git a/configure.ac b/configure.ac
index 923d5e3b0f3..666219f5f36 100644
--- a/configure.ac
+++ b/configure.ac
@@ -540,7 +540,7 @@ AC_HEADER_STAT()
dnl **** Checks for headers that depend on other ones ****
-AC_CHECK_HEADERS([sys/mount.h sys/statfs.h sys/user.h sys/vfs.h],,,
+AC_CHECK_HEADERS([sys/conf.h sys/mount.h sys/statfs.h sys/user.h sys/vfs.h],,,
[#include <sys/types.h>
#ifdef HAVE_SYS_PARAM_H
# include <sys/param.h>
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index d12a3ffb119..d6a7b0c1550 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -99,6 +99,9 @@
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
+#ifdef HAVE_SYS_CONF_H
+#include <sys/conf.h>
+#endif
#ifdef HAVE_SYS_MOUNT_H
#include <sys/mount.h>
#endif
@@ -6065,6 +6068,31 @@ static NTSTATUS get_device_info( int fd, FILE_FS_DEVICE_INFORMATION *info )
info->DeviceType = FILE_DEVICE_TAPE;
break;
}
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__APPLE__)
+ {
+ int d_type;
+ if (ioctl(fd, FIODTYPE, &d_type) == 0)
+ {
+ switch(d_type)
+ {
+ case D_TAPE:
+ info->DeviceType = FILE_DEVICE_TAPE;
+ break;
+ case D_DISK:
+ info->DeviceType = FILE_DEVICE_DISK;
+ break;
+ case D_TTY:
+ info->DeviceType = FILE_DEVICE_SERIAL_PORT;
+ break;
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+ case D_MEM:
+ info->DeviceType = FILE_DEVICE_NULL;
+ break;
+#endif
+ }
+ /* no special d_type for parallel ports */
+ }
+ }
#endif
}
else if (S_ISBLK( st.st_mode ))
diff --git a/include/config.h.in b/include/config.h.in
index 4adb6325e14..9b52424ae85 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -1001,6 +1001,9 @@
/* Define to 1 if you have the <sys/cdio.h> header file. */
#undef HAVE_SYS_CDIO_H
+/* Define to 1 if you have the <sys/conf.h> header file. */
+#undef HAVE_SYS_CONF_H
+
/* Define to 1 if you have the <sys/epoll.h> header file. */
#undef HAVE_SYS_EPOLL_H
More information about the wine-cvs
mailing list