Module: Mesa
Branch: master
Commit: ecbb179c57a7873dfb55dad64314084c8f7fd321
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ecbb179c57a7873dfb55dad64314084c8f7fd321

Author: Michael Tang <[email protected]>
Date:   Mon Dec 21 14:57:48 2020 -0800

util: Implement os_read_file for Windows

Reviewed-by: Jesse Natalie <[email protected]>
Reviewed-by: Erik Faye-Lund <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8043>

---

 src/util/os_file.c | 27 +++++++++++----------------
 1 file changed, 11 insertions(+), 16 deletions(-)

diff --git a/src/util/os_file.c b/src/util/os_file.c
index c5970ddb243..9fd3f68e3dc 100644
--- a/src/util/os_file.c
+++ b/src/util/os_file.c
@@ -79,16 +79,12 @@ os_dupfd_cloexec(int fd)
 }
 #endif
 
-
-#if DETECT_OS_LINUX
-
 #include <fcntl.h>
 #include <sys/stat.h>
-#include <sys/syscall.h>
-#include <unistd.h>
 
-/* copied from <linux/kcmp.h> */
-#define KCMP_FILE 0
+#if DETECT_OS_WINDOWS
+typedef ptrdiff_t ssize_t;
+#endif
 
 static ssize_t
 readN(int fd, char *buf, size_t len)
@@ -185,6 +181,14 @@ os_read_file(const char *filename, size_t *size)
    return buf;
 }
 
+#if DETECT_OS_LINUX
+
+#include <sys/syscall.h>
+#include <unistd.h>
+
+/* copied from <linux/kcmp.h> */
+#define KCMP_FILE 0
+
 int
 os_same_file_description(int fd1, int fd2)
 {
@@ -199,15 +203,6 @@ os_same_file_description(int fd1, int fd2)
 
 #else
 
-#include "u_debug.h"
-
-char *
-os_read_file(const char *filename, size_t *size)
-{
-   errno = -ENOSYS;
-   return NULL;
-}
-
 int
 os_same_file_description(int fd1, int fd2)
 {

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to