Commit bf8da00e authored by Damjan Jovanovic's avatar Damjan Jovanovic Committed by Alexandre Julliard

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

parent a563f584
......@@ -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>
......
......@@ -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>
......
......@@ -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 ))
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment