changeset 394:0ac6f0d242bc src

OS/2 support by KO Myung-Hun, komh chollian net
author diego
date Thu, 09 Oct 2008 22:20:36 +0000
parents bba82ef5d75a
children 9c5aef10d165
files vm/vm.c
diffstat 1 files changed, 26 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/vm/vm.c	Thu Oct 09 22:20:01 2008 +0000
+++ b/vm/vm.c	Thu Oct 09 22:20:36 2008 +0000
@@ -52,6 +52,11 @@
 #include <io.h>   /* read() */
 #endif /* _MSC_VER */
 
+#ifdef __OS2__
+#define INCL_DOS
+#include <os2.h>
+#endif
+
 /*
 #define STRICT
 */
@@ -131,6 +136,27 @@
 }
 #endif
 
+#ifdef __OS2__
+#define open os2_open
+
+static int os2_open(const char *name, int oflag)
+{
+    HFILE hfile;
+    ULONG ulAction;
+    ULONG rc;
+
+    rc = DosOpen( name, &hfile, &ulAction, 0, FILE_NORMAL,
+                  OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_FAIL_IF_NEW,
+                  OPEN_ACCESS_READONLY | OPEN_SHARE_DENYNONE | OPEN_FLAGS_DASD,
+                  NULL );
+
+    if( rc )
+        return -1;
+
+    return ( int )hfile;
+}
+#endif
+
 static void dvd_read_name(char *name, const char *device) {
     /* Because we are compiling with _FILE_OFFSET_BITS=64
      * all off_t are 64bit.