Portability fixes.

This commit is contained in:
Alexandre Julliard 2002-05-14 23:18:23 +00:00
parent 34909c206c
commit c3e06df941
9 changed files with 80 additions and 17 deletions

4
configure vendored
View File

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

View File

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

View File

@ -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 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
}
/***********************************************************************

View File

@ -34,7 +34,9 @@
#ifdef HAVE_SYS_FILE_H
# include <sys/file.h>
#endif
#ifdef HAVE_SYS_IOCTL_H
# include <sys/ioctl.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif

View File

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

View File

@ -40,7 +40,9 @@
#ifdef HAVE_SYS_FILE_H
# include <sys/file.h>
#endif
#ifdef HAVE_SYS_IOCTL_H
# include <sys/ioctl.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif

View File

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

View File

@ -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 */
}

View File

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