Explorar el Código

Pass O_BINARY for windows

Samuel Thibault hace 11 años
padre
commit
192abc3b7f

+ 1 - 1
src/core/disk_ops/disk_stdio.c

@@ -66,7 +66,7 @@ starpu_stdio_alloc (void *base, size_t size)
 
 #ifdef STARPU_HAVE_WINDOWS
         _mktemp(baseCpy);
-        id = open(baseCpy, O_RDWR);
+        id = open(baseCpy, O_RDWR | O_BINARY);
 #else
 	id = mkstemp(baseCpy);
 

+ 2 - 2
src/core/disk_ops/disk_unistd.c

@@ -35,7 +35,7 @@ starpu_unistd_alloc (void *base, size_t size)
         struct starpu_unistd_global_obj * obj = malloc(sizeof(struct starpu_unistd_global_obj));
         STARPU_ASSERT(obj != NULL);
 	/* only flags change between unistd and unistd_o_direct */
-	obj->flags = O_RDWR;
+	obj->flags = O_RDWR | O_BINARY;
 	return starpu_unistd_global_alloc (obj, base, size);
 }
 
@@ -46,7 +46,7 @@ starpu_unistd_open (void *base, void *pos, size_t size)
 	struct starpu_unistd_global_obj * obj = malloc(sizeof(struct starpu_unistd_global_obj));
 	STARPU_ASSERT(obj != NULL);
 	/* only flags change between unistd and unistd_o_direct */
-	obj->flags = O_RDWR;
+	obj->flags = O_RDWR | O_BINARY;
 	return starpu_unistd_global_open (obj, base, pos, size);	
 
 }

+ 2 - 2
src/core/disk_ops/disk_unistd_o_direct.c

@@ -35,7 +35,7 @@ starpu_unistd_o_direct_alloc (void *base, size_t size)
         struct starpu_unistd_global_obj * obj = malloc(sizeof(struct starpu_unistd_global_obj));
         STARPU_ASSERT(obj != NULL);
         /* only flags change between unistd and unistd_o_direct */
-        obj->flags = O_RDWR | O_DIRECT;
+        obj->flags = O_RDWR | O_DIRECT | O_BINARY;
         return starpu_unistd_global_alloc (obj, base, size);
 }
 
@@ -46,7 +46,7 @@ starpu_unistd_o_direct_open (void *base, void *pos, size_t size)
         struct starpu_unistd_global_obj * obj = malloc(sizeof(struct starpu_unistd_global_obj));
         STARPU_ASSERT(obj != NULL);
         /* only flags change between unistd and unistd_o_direct */
-        obj->flags = O_RDWR | O_DIRECT;
+        obj->flags = O_RDWR | O_DIRECT | O_BINARY;
         return starpu_unistd_global_open (obj, base, pos, size);
 
 }

+ 6 - 0
src/core/disk_ops/unistd/disk_unistd_global.h

@@ -17,6 +17,12 @@
 #ifndef __DISK_UNISTD_GLOBAL_H__
 #define __DISK_UNISTD_GLOBAL_H__
 
+#include <fcntl.h>
+
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
 struct starpu_unistd_global_obj {
         int descriptor;
         char * path;