ntdll: Improve character device type detection on FreeBSD and macOS.

Signed-off-by: Damjan Jovanovic <damjan.jov@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Damjan Jovanovic 2020-11-09 03:47:21 +02:00 committed by Alexandre Julliard
parent a563f584f5
commit bf8da00ee0
4 changed files with 33 additions and 2 deletions

2
configure vendored
View File

@ -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>

View File

@ -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>

View File

@ -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 ))

View File

@ -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