summaryrefslogtreecommitdiffstats
path: root/osdep/io.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-12-26 17:14:48 +0100
committerwm4 <wm4@nowhere>2014-12-26 17:30:10 +0100
commit3fdb6be3166790ff3aad68dd4d4bb83963815e4b (patch)
treed114681f0209288e69120c4d253304214c2699dd /osdep/io.h
parent9317071bc309dfe22cf3b295de20e18ae9b80c26 (diff)
downloadmpv-3fdb6be3166790ff3aad68dd4d4bb83963815e4b.tar.bz2
mpv-3fdb6be3166790ff3aad68dd4d4bb83963815e4b.tar.xz
win32: add mmap() emulation
Makes all of overlay_add work on windows/mingw. Since we now don't explicitly check for mmap() anymore (it's always present), this also requires us to make af_export.c compile, but I haven't tested it.
Diffstat (limited to 'osdep/io.h')
-rw-r--r--osdep/io.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/osdep/io.h b/osdep/io.h
index c3fc0cf9cb..0348d3d1a3 100644
--- a/osdep/io.h
+++ b/osdep/io.h
@@ -135,6 +135,17 @@ void mp_globfree(mp_glob_t *pglob);
#undef fstat
#define fstat(...) mp_fstat(__VA_ARGS__)
+void *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset);
+int munmap(void *addr, size_t length);
+int msync(void *addr, size_t length, int flags);
+#define PROT_READ 1
+#define PROT_WRITE 2
+#define MAP_SHARED 1
+#define MAP_FAILED ((void *)-1)
+#define MS_ASYNC 1
+#define MS_SYNC 2
+#define MS_INVALIDATE 4
+
#ifndef GLOB_NOMATCH
#define GLOB_NOMATCH 3
#endif
@@ -143,6 +154,10 @@ void mp_globfree(mp_glob_t *pglob);
#define glob(...) mp_glob(__VA_ARGS__)
#define globfree(...) mp_globfree(__VA_ARGS__)
+#else /* __MINGW32__ */
+
+#include <sys/mman.h>
+
#endif /* __MINGW32__ */
#endif