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
This commit is contained in:
Vincent Torri 2019-08-19 09:55:12 -04:00 committed by Mike Blumenkrantz
parent ce3d1ec7e7
commit 01b987df59
36 changed files with 105 additions and 78 deletions

View File

@ -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

View File

@ -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"

View File

@ -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"

View File

@ -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>

View File

@ -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

View File

@ -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);
}

View File

@ -2,7 +2,6 @@
# include <config.h>
#endif
#include <sys/mman.h>
#include <fcntl.h>
#include <unistd.h>

View File

@ -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

View File

@ -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

View File

@ -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");

View File

@ -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");

View File

@ -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>

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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>

View File

@ -6,7 +6,6 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/mman.h>
#include <fnmatch.h>
#include <Ecore.h>

View File

@ -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>

View File

@ -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

View File

@ -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

View File

@ -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"

View File

@ -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>

View File

@ -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

View File

@ -13,7 +13,6 @@
# include <Elput.h>
# include <ctype.h>
# include <sys/mman.h>
# include <fcntl.h>
# include <unistd.h>
# include <linux/vt.h>

View File

@ -2,7 +2,6 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <unistd.h>

View File

@ -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

View File

@ -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"

View File

@ -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

View File

@ -10,7 +10,6 @@
#include <io.h>
#include "sys/mman.h"
#include "evil_private.h"
/*

View File

@ -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__ */

View File

@ -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"

View File

@ -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',

View File

@ -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>

View File

@ -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

View File

@ -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

View File

@ -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>