diff options
author | Vincent Torri <vincent.torri@gmail.com> | 2019-08-19 09:55:12 -0400 |
---|---|---|
committer | Mike Blumenkrantz <zmike@samsung.com> | 2019-08-19 09:55:13 -0400 |
commit | 01b987df59154f87a5ed8688c272f0a04bc8c4c9 (patch) | |
tree | fb8f8fa042ab81e824db5a4c0fbda1614fb3056d | |
parent | ce3d1ec7e7c5574651dbf5c278356308528e2ea9 (diff) | |
download | efl-01b987df59154f87a5ed8688c272f0a04bc8c4c9.tar.gz |
make mman.h private
Summary:
integrate mman.h to make Evil private to the EFL, as mman.h does not exist on Windows. After a discussion with raster, i include sys/mman.h only on non Windows platform.
One issue, though, is that src/modules/emotion/generic/Emotion_Generic_Plugin.h has inlined functions using mmap()
Test Plan: compilation on Windows
Reviewers: cedric, raster, zmike
Subscribers: #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D9542
36 files changed, 105 insertions, 78 deletions
diff --git a/header_checks/meson.build b/header_checks/meson.build index 520b4ea843..c83f48b897 100644 --- a/header_checks/meson.build +++ b/header_checks/meson.build @@ -248,8 +248,6 @@ config_h.set('SIZEOF_INT', cc.sizeof('int')) config_h.set('SIZEOF_LONG', cc.sizeof('long')) if sys_windows == true - config_h.set('HAVE_DLSYM', '1') config_h.set('HAVE_NOTIFY_WIN32', '1') - config_h.set10('HAVE_WINDOWS_H', true) config_h.set10('HAVE_DDRAW_H', true) endif diff --git a/src/bin/edje/edje_cc_handlers.c b/src/bin/edje/edje_cc_handlers.c index 9e4f0427ff..c9bbc1744a 100644 --- a/src/bin/edje/edje_cc_handlers.c +++ b/src/bin/edje/edje_cc_handlers.c @@ -34,9 +34,13 @@ #include <errno.h> #include <sys/stat.h> #include <fcntl.h> -#include <sys/mman.h> #include <unistd.h> #include <ctype.h> +#ifdef _WIN32 +# include <evil_private.h> /* mmap */ +#else +# include <sys/mman.h> +#endif #include "edje_cc.h" diff --git a/src/bin/elementary/elm_prefs_cc_handlers.c b/src/bin/elementary/elm_prefs_cc_handlers.c index a400d5bca9..ce5c01210b 100644 --- a/src/bin/elementary/elm_prefs_cc_handlers.c +++ b/src/bin/elementary/elm_prefs_cc_handlers.c @@ -32,7 +32,6 @@ #include <errno.h> #include <sys/stat.h> #include <fcntl.h> -#include <sys/mman.h> #include <unistd.h> #include "elm_prefs_cc.h" diff --git a/src/generic/emotion/vlc/emotion_generic_vlc.c b/src/generic/emotion/vlc/emotion_generic_vlc.c index 456509e673..dcfcbe9e8c 100644 --- a/src/generic/emotion/vlc/emotion_generic_vlc.c +++ b/src/generic/emotion/vlc/emotion_generic_vlc.c @@ -8,7 +8,6 @@ #include <stdlib.h> #include <unistd.h> #include <string.h> -#include <sys/mman.h> #include <sys/stat.h> #include <fcntl.h> #include <pthread.h> diff --git a/src/generic/evas/common/shmfile.c b/src/generic/evas/common/shmfile.c index 0f9361397c..6fe9eb30d6 100644 --- a/src/generic/evas/common/shmfile.c +++ b/src/generic/evas/common/shmfile.c @@ -11,16 +11,19 @@ # include <netinet/in.h> #endif #include <time.h> -#ifdef HAVE_SHM_OPEN -# include <sys/mman.h> -#endif #include <sys/stat.h> #include <fcntl.h> #include <string.h> #include <zlib.h> #ifdef _WIN32 +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +# endif # include <windows.h> +# undef WIN32_LEAN_AND_MEAN +#else +# include <sys/mman.h> #endif #ifdef __cplusplus diff --git a/src/generic/evas/gst/main.c b/src/generic/evas/gst/main.c index e4f9f00285..3f93507078 100644 --- a/src/generic/evas/gst/main.c +++ b/src/generic/evas/gst/main.c @@ -2,9 +2,6 @@ # include <config.h> #endif -#ifdef HAVE_SHM_OPEN -# include <sys/mman.h> -#endif #include <fcntl.h> #include <unistd.h> @@ -272,7 +269,11 @@ main(int argc, char **argv) if (!head_only) { +#ifdef _WIN32 + if (shm_fd) +#else if (shm_fd >= 0) +#endif { printf("shmfile %s\n", shmfile); } diff --git a/src/generic/evas/gst/main_0_10.c b/src/generic/evas/gst/main_0_10.c index 8e383334f6..8a197c4208 100644 --- a/src/generic/evas/gst/main_0_10.c +++ b/src/generic/evas/gst/main_0_10.c @@ -2,7 +2,6 @@ # include <config.h> #endif -#include <sys/mman.h> #include <fcntl.h> #include <unistd.h> diff --git a/src/generic/evas/pdf/main.cpp b/src/generic/evas/pdf/main.cpp index d8532fed54..c7c3ee13bd 100644 --- a/src/generic/evas/pdf/main.cpp +++ b/src/generic/evas/pdf/main.cpp @@ -2,9 +2,6 @@ # include <config.h> #endif -#ifdef HAVE_SHM_OPEN -# include <sys/mman.h> -#endif #include <fcntl.h> #include <stdio.h> #include <unistd.h> @@ -317,11 +314,13 @@ main(int argc, char **argv) if (!head_only) { -#ifdef HAVE_SHM_OPEN +#ifdef _WIN32 + if (shm_fd) +#else if (shm_fd >= 0) +#endif printf("shmfile %s\n", shmfile); else -#endif { // could also to "tmpfile %s\n" like shmfile but just // a mmaped tmp file on the system diff --git a/src/generic/evas/ps/main.c b/src/generic/evas/ps/main.c index 6fdd74ce03..586c7e8f0b 100644 --- a/src/generic/evas/ps/main.c +++ b/src/generic/evas/ps/main.c @@ -2,7 +2,6 @@ # include <config.h> #endif -#include <sys/mman.h> #include <fcntl.h> #include <libspectre/spectre.h> @@ -270,7 +269,11 @@ main(int argc, char **argv) if (!head_only) { +#ifdef _WIN32 + if (shm_fd) printf("shmfile %s\n", shmfile); +#else if (shm_fd >= 0) printf("shmfile %s\n", shmfile); +#endif else { // could also to "tmpfile %s\n" like shmfile but just diff --git a/src/generic/evas/raw/main.c b/src/generic/evas/raw/main.c index 70a1625b75..c007bf62ba 100644 --- a/src/generic/evas/raw/main.c +++ b/src/generic/evas/raw/main.c @@ -3,7 +3,6 @@ #endif #include <fcntl.h> #include <stdio.h> -#include <sys/mman.h> #include <sys/stat.h> #include <sys/types.h> #include <unistd.h> @@ -15,6 +14,12 @@ # include <unistd.h> #endif +#ifdef _WIN32 +# include <evil_private.h> /* mmap */ +#else +# include <sys/mman.h> +#endif + #include <Eina.h> @@ -204,7 +209,7 @@ int main(int argc, char **argv) } timeout_init(4); - + if (!_raw_init(file)) return -1; if (head_only != 0) { @@ -221,7 +226,11 @@ int main(int argc, char **argv) { printf("size %d %d\n", width, height); printf("alpha 1\n"); +#ifdef _WIN32 + if (shm_fd) printf("shmfile %s\n", shmfile); +#else if (shm_fd >= 0) printf("shmfile %s\n", shmfile); +#endif else { printf("data\n"); diff --git a/src/generic/evas/rsvg/main.c b/src/generic/evas/rsvg/main.c index f1973303ee..f09309f79e 100644 --- a/src/generic/evas/rsvg/main.c +++ b/src/generic/evas/rsvg/main.c @@ -214,7 +214,11 @@ int main(int argc, char **argv) { printf("size %d %d\n", width, height); printf("alpha 1\n"); +#ifdef _WIN32 + if (shm_fd) printf("shmfile %s\n", shmfile); +#else if (shm_fd >= 0) printf("shmfile %s\n", shmfile); +#endif else { printf("data\n"); diff --git a/src/generic/evas/xcf/common.h b/src/generic/evas/xcf/common.h index 34b0cad692..4e605b0022 100644 --- a/src/generic/evas/xcf/common.h +++ b/src/generic/evas/xcf/common.h @@ -14,7 +14,6 @@ # include <netinet/in.h> #endif #include <time.h> -#include <sys/mman.h> #include <sys/stat.h> #include <fcntl.h> #include <string.h> diff --git a/src/generic/evas/xcf/main.c b/src/generic/evas/xcf/main.c index 65e5e1b5b3..767c6bf4b1 100644 --- a/src/generic/evas/xcf/main.c +++ b/src/generic/evas/xcf/main.c @@ -1714,7 +1714,11 @@ main(int argc, char **argv) printf("alpha 1\n"); if (!head_only) { +#ifdef _WIN32 + if (shm_fd) printf("shmfile %s\n", shmfile); +#else if (shm_fd >= 0) printf("shmfile %s\n", shmfile); +#endif else { // could also to "tmpfile %s\n" like shmfile but just diff --git a/src/lib/ecore/ecore.c b/src/lib/ecore/ecore.c index 7aa987b271..b2ca8aa649 100644 --- a/src/lib/ecore/ecore.c +++ b/src/lib/ecore/ecore.c @@ -15,7 +15,9 @@ # include <langinfo.h> #endif -#if defined(HAVE_SYS_MMAN_H) || defined(_WIN32) +#ifdef _WIN32 +# include <evil_private.h> /* mmap */ +#else # include <sys/mman.h> #endif diff --git a/src/lib/ecore_evas/ecore_evas.c b/src/lib/ecore_evas/ecore_evas.c index 18c251f007..9d2d4d10f1 100644 --- a/src/lib/ecore_evas/ecore_evas.c +++ b/src/lib/ecore_evas/ecore_evas.c @@ -14,7 +14,9 @@ #include <fcntl.h> #include <unistd.h> -#if defined(HAVE_SYS_MMAN_H) || defined(_WIN32) +#ifdef _WIN32 +# include <evil_private.h> /* mmap */ +#else # include <sys/mman.h> #endif diff --git a/src/lib/eet/eet_cipher.c b/src/lib/eet/eet_cipher.c index 3bdab4c2f1..2314c24e03 100644 --- a/src/lib/eet/eet_cipher.c +++ b/src/lib/eet/eet_cipher.c @@ -9,7 +9,11 @@ #include <unistd.h> #ifdef HAVE_SIGNATURE -# include <sys/mman.h> +# ifdef _WIN32 +# include <evil_private.h> /* mmap */ +# else +# include <sys/mman.h> +# endif # ifdef HAVE_GNUTLS # include <gnutls/gnutls.h> # include <gnutls/x509.h> diff --git a/src/lib/efreet/efreet_mime.c b/src/lib/efreet/efreet_mime.c index e4e1ba896f..9eba8c8db9 100644 --- a/src/lib/efreet/efreet_mime.c +++ b/src/lib/efreet/efreet_mime.c @@ -6,7 +6,6 @@ #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> -#include <sys/mman.h> #include <fnmatch.h> #include <Ecore.h> diff --git a/src/lib/efreet/efreet_xml.c b/src/lib/efreet/efreet_xml.c index 4f4cd2fea8..97a44aa9de 100644 --- a/src/lib/efreet/efreet_xml.c +++ b/src/lib/efreet/efreet_xml.c @@ -6,7 +6,12 @@ #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> -#include <sys/mman.h> + +#ifdef _WIN32 +# include <evil_private.h> /* mmap */ +#else +# include <sys/mman.h> +#endif #include <Ecore_File.h> diff --git a/src/lib/eina/eina_debug_chunk.c b/src/lib/eina/eina_debug_chunk.c index 4ee9655140..1c6c028647 100644 --- a/src/lib/eina/eina_debug_chunk.c +++ b/src/lib/eina/eina_debug_chunk.c @@ -29,8 +29,13 @@ # include <memcheck.h> #endif -#ifdef HAVE_MMAP +#ifdef _WIN32 +# include <evil_private.h> /* mmap */ +#else # include <sys/mman.h> +#endif + +#ifdef HAVE_MMAP // custom memory allocators to avoid malloc/free during backtrace handling // just in case we're inside some signal handler due to mem corruption and diff --git a/src/lib/eina/eina_evlog.c b/src/lib/eina/eina_evlog.c index 994a370779..4dba784ff1 100644 --- a/src/lib/eina/eina_evlog.c +++ b/src/lib/eina/eina_evlog.c @@ -36,9 +36,11 @@ #include <time.h> #include <unistd.h> -# ifdef HAVE_MMAP -# include <sys/mman.h> -# endif +#ifdef _WIN32 +# include <evil_private.h> /* mmap */ +#else +# include <sys/mman.h> +#endif #if __BYTE_ORDER == __LITTLE_ENDIAN #define SWAP_64(x) x diff --git a/src/lib/eina/eina_safepointer.c b/src/lib/eina/eina_safepointer.c index 8f9d4b62a9..9016aab27a 100644 --- a/src/lib/eina/eina_safepointer.c +++ b/src/lib/eina/eina_safepointer.c @@ -10,10 +10,15 @@ #include <stdint.h> #include <stdio.h> #include <stdlib.h> -#include <sys/mman.h> #include <fcntl.h> #include <inttypes.h> +#ifdef _WIN32 +# include <evil_private.h> /* mmap */ +#else +# include <sys/mman.h> +#endif + #include "eina_config.h" #include "eina_private.h" diff --git a/src/lib/eio/eio_private.h b/src/lib/eio/eio_private.h index 36d784752d..aa75336124 100644 --- a/src/lib/eio/eio_private.h +++ b/src/lib/eio/eio_private.h @@ -23,7 +23,6 @@ #include <errno.h> #include <sys/types.h> #include <sys/stat.h> -#include <sys/mman.h> #include <unistd.h> #include <fcntl.h> diff --git a/src/lib/elementary/efl_ui_selection_manager.c b/src/lib/elementary/efl_ui_selection_manager.c index 49b3c5a3b1..e857f4fd98 100644 --- a/src/lib/elementary/efl_ui_selection_manager.c +++ b/src/lib/elementary/efl_ui_selection_manager.c @@ -4,7 +4,10 @@ #include <Elementary.h> #include "elm_priv.h" -#ifdef HAVE_SYS_MMAN_H + +#ifdef _WIN32 +# include <evil_private.h> /* mmap */ +#else # include <sys/mman.h> #endif diff --git a/src/lib/elput/elput_private.h b/src/lib/elput/elput_private.h index 16fe305c5b..744c5a92e3 100644 --- a/src/lib/elput/elput_private.h +++ b/src/lib/elput/elput_private.h @@ -13,7 +13,6 @@ # include <Elput.h> # include <ctype.h> -# include <sys/mman.h> # include <fcntl.h> # include <unistd.h> # include <linux/vt.h> diff --git a/src/lib/elua/cache.c b/src/lib/elua/cache.c index 91fcdac658..b18d690569 100644 --- a/src/lib/elua/cache.c +++ b/src/lib/elua/cache.c @@ -2,7 +2,6 @@ #include <sys/types.h> #include <sys/stat.h> -#include <sys/mman.h> #include <fcntl.h> #include <unistd.h> diff --git a/src/lib/eo/eo_ptr_indirection.x b/src/lib/eo/eo_ptr_indirection.x index d6affe0cc6..2b3fa5a467 100644 --- a/src/lib/eo/eo_ptr_indirection.x +++ b/src/lib/eo/eo_ptr_indirection.x @@ -1,9 +1,12 @@ #include <assert.h> -#ifdef HAVE_MMAP #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> -#include <sys/mman.h> + +#ifdef _WIN32 +# include <evil_private.h> /* mmap mprotect */ +#else +# include <sys/mman.h> #endif #ifdef HAVE_VALGRIND diff --git a/src/lib/evas/canvas/evas_image_private.h b/src/lib/evas/canvas/evas_image_private.h index efd53209c8..2d468184eb 100644 --- a/src/lib/evas/canvas/evas_image_private.h +++ b/src/lib/evas/canvas/evas_image_private.h @@ -12,9 +12,6 @@ #include <sys/types.h> #include <unistd.h> -#ifdef HAVE_SYS_MMAN_H -# include <sys/mman.h> -#endif #include <math.h> #include "evas_private.h" diff --git a/src/lib/evas/common/evas_image_main.c b/src/lib/evas/common/evas_image_main.c index e42e05d816..1be23a591e 100644 --- a/src/lib/evas/common/evas_image_main.c +++ b/src/lib/evas/common/evas_image_main.c @@ -2,7 +2,9 @@ # include "config.h" /* so that EAPI in Eet.h is correctly defined */ #endif -#ifdef HAVE_SYS_MMAN_H +#ifdef _WIN32 +# include <evil_private.h> /* mmap */ +#else # include <sys/mman.h> #endif diff --git a/src/lib/evil/evil_mman.c b/src/lib/evil/evil_mman.c index b1bcf35bea..dbcfc31901 100644 --- a/src/lib/evil/evil_mman.c +++ b/src/lib/evil/evil_mman.c @@ -10,7 +10,6 @@ #include <io.h> -#include "sys/mman.h" #include "evil_private.h" /* diff --git a/src/lib/evil/sys/mman.h b/src/lib/evil/evil_mman.h index 39ebd20638..990d146058 100644 --- a/src/lib/evil/sys/mman.h +++ b/src/lib/evil/evil_mman.h @@ -3,25 +3,6 @@ #include <sys/types.h> -#ifdef EAPI -# undef EAPI -#endif - -#ifdef EFL_BUILD -# ifdef DLL_EXPORT -# define EAPI __declspec(dllexport) -# else -# define EAPI -# endif -#else -# define EAPI __declspec(dllimport) -#endif - - -#ifdef __cplusplus -extern "C" { -#endif - /** * @def PROT_NONE @@ -177,14 +158,5 @@ EAPI int munmap(void *addr, EAPI int mprotect(void *addr, size_t len, int prot); -#ifdef __cplusplus -} -#endif - - -#undef EAPI -#define EAPI - - #endif /* __EVIL_SYS_MMAN_H__ */ diff --git a/src/lib/evil/evil_private.h b/src/lib/evil/evil_private.h index a88572bf24..d87ac75423 100644 --- a/src/lib/evil/evil_private.h +++ b/src/lib/evil/evil_private.h @@ -49,6 +49,7 @@ extern "C" { #include "evil_langinfo.h" #include "evil_locale.h" #include "evil_main.h" +#include "evil_mman.h" #include "evil_stdlib.h" #include "evil_stdio.h" #include "evil_string.h" diff --git a/src/lib/evil/meson.build b/src/lib/evil/meson.build index 85978d8e9c..7877c7f914 100644 --- a/src/lib/evil/meson.build +++ b/src/lib/evil/meson.build @@ -15,9 +15,7 @@ if target_machine.system() == 'windows' 'evil_time.h', 'evil_unistd.h', 'evil_util.h', - 'dirent.h', ] - evil_header_sys_src = [join_paths('sys','mman.h')] evil_src = [ 'evil_dlfcn.c', diff --git a/src/modules/ecore_evas/engines/extn/ecore_evas_extn_engine.h b/src/modules/ecore_evas/engines/extn/ecore_evas_extn_engine.h index 511397dfdf..dd82f50293 100644 --- a/src/modules/ecore_evas/engines/extn/ecore_evas_extn_engine.h +++ b/src/modules/ecore_evas/engines/extn/ecore_evas_extn_engine.h @@ -14,9 +14,13 @@ #include <unistd.h> #include <math.h> #include <time.h> -#ifdef HAVE_SYS_MMAN_H + +#ifdef _WIN32 +# include <evil_private.h> /* mmap */ +#else # include <sys/mman.h> #endif + #include <sys/stat.h> #include <fcntl.h> #include <string.h> diff --git a/src/modules/evas/engines/software_generic/evas_native_dmabuf.c b/src/modules/evas/engines/software_generic/evas_native_dmabuf.c index c71e1b2276..e7c2e162aa 100644 --- a/src/modules/evas/engines/software_generic/evas_native_dmabuf.c +++ b/src/modules/evas/engines/software_generic/evas_native_dmabuf.c @@ -2,15 +2,17 @@ #include "evas_private.h" #include "evas_native_common.h" -#if defined HAVE_DLSYM && ! defined _WIN32 +#if defined HAVE_DLSYM # include <dlfcn.h> /* dlopen,dlclose,etc */ #elif _WIN32 -# include <evil_private.h> /* dlopen dlclose dlsym */ +# include <evil_private.h> /* dlopen dlclose dlsym mmap */ #else # warning native_dmabuf should not get compiled if dlsym is not found on the system! #endif -#include <sys/mman.h> +#ifndef _WIN32 +# include <sys/mman.h> +#endif #define DRM_FORMAT_ARGB8888 0x34325241 #define DRM_FORMAT_XRGB8888 0x34325258 diff --git a/src/modules/evas/image_loaders/generic/evas_image_load_generic.c b/src/modules/evas/image_loaders/generic/evas_image_load_generic.c index 7d0c8e3609..94b935bc20 100644 --- a/src/modules/evas/image_loaders/generic/evas_image_load_generic.c +++ b/src/modules/evas/image_loaders/generic/evas_image_load_generic.c @@ -7,11 +7,16 @@ #include <stdio.h> #include <sys/types.h> -#include <sys/mman.h> #include <sys/stat.h> #include <fcntl.h> #include <ctype.h> +#ifdef _WIN32 +# include <evil_private.h> /* mmap */ +#else +# include <sys/mman.h> +#endif + #ifndef O_BINARY # define O_BINARY 0 #endif diff --git a/src/tests/efreet/efreet_icon_cache_dump.c b/src/tests/efreet/efreet_icon_cache_dump.c index 313c890933..a1b71eb855 100644 --- a/src/tests/efreet/efreet_icon_cache_dump.c +++ b/src/tests/efreet/efreet_icon_cache_dump.c @@ -5,7 +5,6 @@ #include <stdio.h> #include <limits.h> #include <sys/stat.h> -#include <sys/mman.h> #include <fcntl.h> #include <unistd.h> #include <errno.h> |