Portability fixes.
diff --git a/configure b/configure
index 1dc0122..ae9c44e 100755
--- a/configure
+++ b/configure
@@ -10934,6 +10934,8 @@
+
+
for ac_header in \
arpa/inet.h \
arpa/nameser.h \
@@ -10971,6 +10973,7 @@
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 @@
sys/vm86.h \
sys/wait.h \
syscall.h \
+ termios.h \
ucontext.h \
unistd.h \
diff --git a/configure.ac b/configure.ac
index 61fc815..250e545 100644
--- a/configure.ac
+++ b/configure.ac
@@ -968,6 +968,7 @@
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 @@
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 ef2c257..fc98f98 100644
--- a/dlls/kernel/comm.c
+++ b/dlls/kernel/comm.c
@@ -54,7 +54,9 @@
#include <stdlib.h>
#include <stdio.h>
+#ifdef HAVE_TERMIOS_H
#include <termios.h>
+#endif
#include <fcntl.h>
#include <string.h>
#ifdef HAVE_STRINGS_H
@@ -66,7 +68,9 @@
#ifdef HAVE_SYS_FILIO_H
# include <sys/filio.h>
#endif
+#ifdef HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
+#endif
#include <unistd.h>
#include <sys/poll.h>
#ifdef HAVE_SYS_MODEM_H
@@ -145,12 +149,16 @@
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 a3bffe3..65dce6e 100644
--- a/dlls/netapi32/netapi32.c
+++ b/dlls/netapi32/netapi32.c
@@ -34,7 +34,9 @@
#ifdef HAVE_SYS_FILE_H
# include <sys/file.h>
#endif
-#include <sys/ioctl.h>
+#ifdef HAVE_SYS_IOCTL_H
+# include <sys/ioctl.h>
+#endif
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
diff --git a/dlls/ntdll/cdrom.c b/dlls/ntdll/cdrom.c
index 19730cc..f0bf01a 100644
--- a/dlls/ntdll/cdrom.c
+++ b/dlls/ntdll/cdrom.c
@@ -27,19 +27,12 @@
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
-#include <sys/ioctl.h>
#include <sys/stat.h>
#include <sys/types.h>
-#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 <sys/ioctl.h>
+#endif
#ifdef HAVE_SCSI_SG_H
# include <scsi/sg.h>
#endif
@@ -62,8 +55,44 @@
# include <sys/cdio.h>
#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 @@
{
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 @@
break;
default:
return STATUS_INVALID_PARAMETER;
- break;
}
io = ioctl(dev, CDROM_SEND_PACKET, &cmd);
@@ -1100,7 +1128,7 @@
{
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 @@
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 f974cd9..ac31532 100644
--- a/dlls/rpcrt4/rpcrt4_main.c
+++ b/dlls/rpcrt4/rpcrt4_main.c
@@ -40,7 +40,9 @@
#ifdef HAVE_SYS_FILE_H
# include <sys/file.h>
#endif
-#include <sys/ioctl.h>
+#ifdef HAVE_SYS_IOCTL_H
+# include <sys/ioctl.h>
+#endif
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
diff --git a/include/config.h.in b/include/config.h.in
index c6706f6..6343b39 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -440,6 +440,9 @@
/* Define to 1 if you have the <sys/inttypes.h> header file. */
#undef HAVE_SYS_INTTYPES_H
+/* Define to 1 if you have the <sys/ioctl.h> header file. */
+#undef HAVE_SYS_IOCTL_H
+
/* Define to 1 if you have the <sys/ipc.h> 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 <termios.h> 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 029e9a9..bedab96 100644
--- a/library/loader.c
+++ b/library/loader.c
@@ -185,6 +185,7 @@
/* 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 @@
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 37e7dd9..6d15147 100644
--- a/library/port.c
+++ b/library/port.c
@@ -40,10 +40,14 @@
# include <sys/time.h>
#endif
#include <sys/stat.h>
+#ifdef HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
+#endif
#include <errno.h>
#include <fcntl.h>
+#ifdef HAVE_TERMIOS_H
#include <termios.h>
+#endif
#ifdef HAVE_SYS_MMAN_H
#include <sys/mman.h>
#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 @@
*/
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 @@
#endif
return mmap( start, size, prot, flags, fdzero, 0 );
+#else
+ return (void *)-1;
+#endif
}