diff --git a/configure b/configure index 1dc0122d51d..ae9c44e7e8f 100755 --- a/configure +++ b/configure @@ -10931,6 +10931,8 @@ done + + @@ -10971,6 +10973,7 @@ for ac_header in \ sys/file.h \ sys/filio.h \ sys/inttypes.h \ + sys/ioctl.h \ sys/ipc.h \ sys/link.h \ sys/lwp.h \ @@ -10997,6 +11000,7 @@ for ac_header in \ sys/vm86.h \ sys/wait.h \ syscall.h \ + termios.h \ ucontext.h \ unistd.h \ diff --git a/configure.ac b/configure.ac index 61fc815b329..250e5458537 100644 --- a/configure.ac +++ b/configure.ac @@ -968,6 +968,7 @@ AC_CHECK_HEADERS(\ sys/file.h \ sys/filio.h \ sys/inttypes.h \ + sys/ioctl.h \ sys/ipc.h \ sys/link.h \ sys/lwp.h \ @@ -994,6 +995,7 @@ AC_CHECK_HEADERS(\ sys/vm86.h \ sys/wait.h \ syscall.h \ + termios.h \ ucontext.h \ unistd.h \ ) diff --git a/dlls/kernel/comm.c b/dlls/kernel/comm.c index ef2c2570792..fc98f98635d 100644 --- a/dlls/kernel/comm.c +++ b/dlls/kernel/comm.c @@ -54,7 +54,9 @@ #include #include +#ifdef HAVE_TERMIOS_H #include +#endif #include #include #ifdef HAVE_STRINGS_H @@ -66,7 +68,9 @@ #ifdef HAVE_SYS_FILIO_H # include #endif +#ifdef HAVE_SYS_IOCTL_H #include +#endif #include #include #ifdef HAVE_SYS_MODEM_H @@ -145,12 +149,16 @@ static void commio_async_cleanup (async_private *ovp) static int COMM_WhackModem(int fd, unsigned int andy, unsigned int orrie) { +#ifdef TIOCMGET unsigned int mstat, okay; okay = ioctl(fd, TIOCMGET, &mstat); if (okay) return okay; if (andy) mstat &= andy; mstat |= orrie; return ioctl(fd, TIOCMSET, &mstat); +#else + return 0; +#endif } /*********************************************************************** diff --git a/dlls/netapi32/netapi32.c b/dlls/netapi32/netapi32.c index a3bffe3b720..65dce6e99c6 100644 --- a/dlls/netapi32/netapi32.c +++ b/dlls/netapi32/netapi32.c @@ -34,7 +34,9 @@ #ifdef HAVE_SYS_FILE_H # include #endif -#include +#ifdef HAVE_SYS_IOCTL_H +# include +#endif #ifdef HAVE_SYS_SOCKET_H # include #endif diff --git a/dlls/ntdll/cdrom.c b/dlls/ntdll/cdrom.c index 19730ccadad..f0bf01a8a1e 100644 --- a/dlls/ntdll/cdrom.c +++ b/dlls/ntdll/cdrom.c @@ -27,19 +27,12 @@ #include #include #include -#include #include #include -#include "ntddk.h" -#include "winioctl.h" -#include "ntddstor.h" -#include "ntddcdrm.h" -#include "ntddscsi.h" -#include "drive.h" -#include "file.h" -#include "wine/debug.h" - +#ifdef HAVE_SYS_IOCTL_H +#include +#endif #ifdef HAVE_SCSI_SG_H # include #endif @@ -62,8 +55,44 @@ # include #endif +#include "ntddk.h" +#include "winioctl.h" +#include "ntddstor.h" +#include "ntddcdrm.h" +#include "ntddscsi.h" +#include "drive.h" +#include "file.h" +#include "wine/debug.h" + WINE_DEFAULT_DEBUG_CHANNEL(cdrom); +#ifdef linux + +# ifndef IDE6_MAJOR +# define IDE6_MAJOR 88 +# endif +# ifndef IDE7_MAJOR +# define IDE7_MAJOR 89 +# endif + +/* structure for CDROM_PACKET_COMMAND ioctl */ +/* not all Linux versions have all the fields, so we define the + * structure ourselves to make sure */ +struct linux_cdrom_generic_command +{ + unsigned char cmd[CDROM_PACKET_SIZE]; + unsigned char *buffer; + unsigned int buflen; + int stat; + struct request_sense *sense; + unsigned char data_direction; + int quiet; + int timeout; + void *reserved[1]; +}; + +#endif /* linux */ + /* FIXME: this is needed because we can't open simultaneously several times /dev/cdrom * this should be removed when a proper device interface is implemented */ @@ -1036,7 +1065,7 @@ static DWORD CDROM_ScsiPassThroughDirect(int dev, PSCSI_PASS_THROUGH_DIRECT pPac { int ret = STATUS_NOT_SUPPORTED; #if defined(linux) - struct cdrom_generic_command cmd; + struct linux_cdrom_generic_command cmd; struct request_sense sense; int io; @@ -1073,7 +1102,6 @@ static DWORD CDROM_ScsiPassThroughDirect(int dev, PSCSI_PASS_THROUGH_DIRECT pPac break; default: return STATUS_INVALID_PARAMETER; - break; } io = ioctl(dev, CDROM_SEND_PACKET, &cmd); @@ -1100,7 +1128,7 @@ static DWORD CDROM_ScsiPassThrough(int dev, PSCSI_PASS_THROUGH pPacket) { int ret = STATUS_NOT_SUPPORTED; #if defined(linux) - struct cdrom_generic_command cmd; + struct linux_cdrom_generic_command cmd; struct request_sense sense; int io; @@ -1144,7 +1172,6 @@ static DWORD CDROM_ScsiPassThrough(int dev, PSCSI_PASS_THROUGH pPacket) break; default: return STATUS_INVALID_PARAMETER; - break; } io = ioctl(dev, CDROM_SEND_PACKET, &cmd); diff --git a/dlls/rpcrt4/rpcrt4_main.c b/dlls/rpcrt4/rpcrt4_main.c index f974cd9b94b..ac31532f3f9 100644 --- a/dlls/rpcrt4/rpcrt4_main.c +++ b/dlls/rpcrt4/rpcrt4_main.c @@ -40,7 +40,9 @@ #ifdef HAVE_SYS_FILE_H # include #endif -#include +#ifdef HAVE_SYS_IOCTL_H +# include +#endif #ifdef HAVE_SYS_SOCKET_H # include #endif diff --git a/include/config.h.in b/include/config.h.in index c6706f6dbf2..6343b39d34a 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -440,6 +440,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_INTTYPES_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_IOCTL_H + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_IPC_H @@ -527,6 +530,9 @@ /* Define to 1 if you have the `tcgetattr' function. */ #undef HAVE_TCGETATTR +/* Define to 1 if you have the header file. */ +#undef HAVE_TERMIOS_H + /* Define to 1 if you have the `timegm' function. */ #undef HAVE_TIMEGM diff --git a/library/loader.c b/library/loader.c index 029e9a9f25a..bedab96526b 100644 --- a/library/loader.c +++ b/library/loader.c @@ -185,6 +185,7 @@ static void fixup_resources( IMAGE_RESOURCE_DIRECTORY *dir, char *root, void *ba /* map a builtin dll in memory and fixup RVAs */ static void *map_dll( const IMAGE_NT_HEADERS *nt_descr ) { +#ifdef HAVE_MMAP IMAGE_DATA_DIRECTORY *dir; IMAGE_DOS_HEADER *dos; IMAGE_NT_HEADERS *nt; @@ -292,6 +293,9 @@ static void *map_dll( const IMAGE_NT_HEADERS *nt_descr ) fixup_rva_ptrs( &exports->AddressOfNameOrdinals, addr, 1 ); } return addr; +#else /* HAVE_MMAP */ + return NULL; +#endif /* HAVE_MMAP */ } diff --git a/library/port.c b/library/port.c index 37e7dd92ed0..6d15147d78a 100644 --- a/library/port.c +++ b/library/port.c @@ -40,10 +40,14 @@ # include #endif #include +#ifdef HAVE_SYS_IOCTL_H #include +#endif #include #include +#ifdef HAVE_TERMIOS_H #include +#endif #ifdef HAVE_SYS_MMAN_H #include #endif @@ -61,7 +65,7 @@ * usleep */ #ifndef HAVE_USLEEP -unsigned int usleep (unsigned int useconds) +int usleep (unsigned int useconds) { #if defined(__EMX__) DosSleep(useconds); @@ -474,6 +478,7 @@ static int try_mmap_fixed (void *addr, size_t len, int prot, int flags, */ void *wine_anon_mmap( void *start, size_t size, int prot, int flags ) { +#ifdef HAVE_MMAP static int fdzero = -1; #ifdef MAP_ANON @@ -504,6 +509,9 @@ void *wine_anon_mmap( void *start, size_t size, int prot, int flags ) #endif return mmap( start, size, prot, flags, fdzero, 0 ); +#else + return (void *)-1; +#endif }