2014-05-28 11:39:13 +08:00
|
|
|
#ifndef JEMALLOC_INTERNAL_DECLS_H
|
|
|
|
#define JEMALLOC_INTERNAL_DECLS_H
|
|
|
|
|
|
|
|
#include <math.h>
|
|
|
|
#ifdef _WIN32
|
|
|
|
# include <windows.h>
|
2015-07-08 04:12:05 +08:00
|
|
|
# ifndef ENOENT
|
|
|
|
# define ENOENT ERROR_PATH_NOT_FOUND
|
|
|
|
# endif
|
|
|
|
# ifndef EINVAL
|
|
|
|
# define EINVAL ERROR_BAD_ARGUMENTS
|
|
|
|
# endif
|
|
|
|
# ifndef EAGAIN
|
|
|
|
# define EAGAIN ERROR_OUTOFMEMORY
|
|
|
|
# endif
|
|
|
|
# ifndef EPERM
|
|
|
|
# define EPERM ERROR_WRITE_FAULT
|
|
|
|
# endif
|
|
|
|
# ifndef EFAULT
|
|
|
|
# define EFAULT ERROR_INVALID_ADDRESS
|
|
|
|
# endif
|
|
|
|
# ifndef ENOMEM
|
|
|
|
# define ENOMEM ERROR_NOT_ENOUGH_MEMORY
|
|
|
|
# endif
|
|
|
|
# ifndef ERANGE
|
|
|
|
# define ERANGE ERROR_INVALID_DATA
|
|
|
|
# endif
|
2014-05-28 11:39:13 +08:00
|
|
|
#else
|
|
|
|
# include <sys/param.h>
|
|
|
|
# include <sys/mman.h>
|
2014-05-29 10:37:02 +08:00
|
|
|
# if !defined(__pnacl__) && !defined(__native_client__)
|
|
|
|
# include <sys/syscall.h>
|
|
|
|
# if !defined(SYS_write) && defined(__NR_write)
|
|
|
|
# define SYS_write __NR_write
|
|
|
|
# endif
|
|
|
|
# include <sys/uio.h>
|
2014-05-28 11:39:13 +08:00
|
|
|
# endif
|
|
|
|
# include <pthread.h>
|
|
|
|
# include <errno.h>
|
|
|
|
#endif
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
|
|
|
#include <limits.h>
|
|
|
|
#ifndef SIZE_T_MAX
|
|
|
|
# define SIZE_T_MAX SIZE_MAX
|
|
|
|
#endif
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#ifndef offsetof
|
|
|
|
# define offsetof(type, member) ((size_t)&(((type *)NULL)->member))
|
|
|
|
#endif
|
|
|
|
#include <inttypes.h>
|
2015-07-08 04:12:05 +08:00
|
|
|
#ifdef _WIN32
|
|
|
|
# define PRIzu "Iu"
|
|
|
|
# define PRIzd "Id"
|
|
|
|
# define PRIzx "Ix"
|
|
|
|
#else
|
|
|
|
# define PRIzu "zu"
|
|
|
|
# define PRIzd "zd"
|
|
|
|
# define PRIzx "zx"
|
|
|
|
#endif
|
2014-05-28 11:39:13 +08:00
|
|
|
#include <string.h>
|
|
|
|
#include <strings.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
#ifdef _MSC_VER
|
|
|
|
# include <io.h>
|
|
|
|
typedef intptr_t ssize_t;
|
|
|
|
# define PATH_MAX 1024
|
|
|
|
# define STDERR_FILENO 2
|
|
|
|
# define __func__ __FUNCTION__
|
2014-12-09 06:40:14 +08:00
|
|
|
/* Disable warnings about deprecated system functions. */
|
2014-05-28 11:39:13 +08:00
|
|
|
# pragma warning(disable: 4996)
|
2014-12-18 14:01:21 +08:00
|
|
|
#if _MSC_VER < 1800
|
|
|
|
static int
|
|
|
|
isblank(int c)
|
|
|
|
{
|
|
|
|
|
|
|
|
return (c == '\t' || c == ' ');
|
|
|
|
}
|
|
|
|
#endif
|
2014-05-28 11:39:13 +08:00
|
|
|
#else
|
|
|
|
# include <unistd.h>
|
|
|
|
#endif
|
|
|
|
#include <fcntl.h>
|
|
|
|
|
|
|
|
#endif /* JEMALLOC_INTERNAL_H */
|