diff options
author | tduehr <tduehr@gmail.com> | 2015-03-19 16:44:33 -0700 |
---|---|---|
committer | tduehr <tduehr@gmail.com> | 2015-06-17 09:01:47 -0500 |
commit | e9d07620ae8ac090863998d22ab7ca0db9cd1e89 (patch) | |
tree | ba0c75a8e11e88123926cb9817a3bb0a7c1b157b /ext/ffi_c/libffi/testsuite/libffi.special/ffitestcxx.h | |
parent | 194784d60f53e242a8aab88c216126785dc047dd (diff) | |
download | ffi-libffi-3.2.1.tar.gz |
update libffilibffi-3.2.1
Diffstat (limited to 'ext/ffi_c/libffi/testsuite/libffi.special/ffitestcxx.h')
-rw-r--r-- | ext/ffi_c/libffi/testsuite/libffi.special/ffitestcxx.h | 96 |
1 files changed, 0 insertions, 96 deletions
diff --git a/ext/ffi_c/libffi/testsuite/libffi.special/ffitestcxx.h b/ext/ffi_c/libffi/testsuite/libffi.special/ffitestcxx.h deleted file mode 100644 index 83f5442..0000000 --- a/ext/ffi_c/libffi/testsuite/libffi.special/ffitestcxx.h +++ /dev/null @@ -1,96 +0,0 @@ -#include <stdlib.h> -#include <stdio.h> -#include <fcntl.h> -#include <ffi.h> -#include "fficonfig.h" - -#define MAX_ARGS 256 - - -/* Define __UNUSED__ that also other compilers than gcc can run the tests. */ -#undef __UNUSED__ -#if defined(__GNUC__) -#define __UNUSED__ __attribute__((__unused__)) -#else -#define __UNUSED__ -#endif - -#define CHECK(x) (!(x) ? abort() : (void)0) - -/* Prefer MAP_ANON(YMOUS) to /dev/zero, since we don't need to keep a - file open. */ -#ifdef HAVE_MMAP_ANON -# undef HAVE_MMAP_DEV_ZERO - -# include <sys/mman.h> -# ifndef MAP_FAILED -# define MAP_FAILED -1 -# endif -# if !defined (MAP_ANONYMOUS) && defined (MAP_ANON) -# define MAP_ANONYMOUS MAP_ANON -# endif -# define USING_MMAP - -#endif - -#ifdef HAVE_MMAP_DEV_ZERO - -# include <sys/mman.h> -# ifndef MAP_FAILED -# define MAP_FAILED -1 -# endif -# define USING_MMAP - -#endif - - -/* MinGW kludge. */ -#ifdef _WIN64 -#define PRIdLL "I64d" -#define PRIuLL "I64u" -#else -#define PRIdLL "lld" -#define PRIuLL "llu" -#endif - -#ifdef USING_MMAP -static inline void * -allocate_mmap (size_t size) -{ - void *page; -#if defined (HAVE_MMAP_DEV_ZERO) - static int dev_zero_fd = -1; -#endif - -#ifdef HAVE_MMAP_DEV_ZERO - if (dev_zero_fd == -1) - { - dev_zero_fd = open ("/dev/zero", O_RDONLY); - if (dev_zero_fd == -1) - { - perror ("open /dev/zero: %m"); - exit (1); - } - } -#endif - - -#ifdef HAVE_MMAP_ANON - page = mmap (NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC, - MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); -#endif -#ifdef HAVE_MMAP_DEV_ZERO - page = mmap (NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC, - MAP_PRIVATE, dev_zero_fd, 0); -#endif - - if (page == (char *) MAP_FAILED) - { - perror ("virtual memory exhausted"); - exit (1); - } - - return page; -} - -#endif |