b732c395b7
Add missing #include <time.h>. The critical time facilities appear to have been transitively included via unistd.h and sys/time.h, but in principle this omission was capable of having caused clock_gettime(CLOCK_MONOTONIC, ...) to have been overlooked in favor of gettimeofday(), which in turn could cause spurious non-monotonic time updates. Refactor nstime_get() out of nstime_update() and add configure tests for all variants. Add CLOCK_MONOTONIC_RAW support (Linux-specific) and mach_absolute_time() support (OS X-specific). Do not fall back to clock_gettime(CLOCK_REALTIME, ...). This was a fragile Linux-specific workaround, which we're unlikely to use at all now that clock_gettime(CLOCK_MONOTONIC_RAW, ...) is supported, and if we have no choice besides non-monotonic clocks, gettimeofday() is only incrementally worse.
70 lines
1.4 KiB
C
70 lines
1.4 KiB
C
#ifndef JEMALLOC_INTERNAL_DECLS_H
|
|
#define JEMALLOC_INTERNAL_DECLS_H
|
|
|
|
#include <math.h>
|
|
#ifdef _WIN32
|
|
# include <windows.h>
|
|
# include "msvc_compat/windows_extra.h"
|
|
|
|
#else
|
|
# include <sys/param.h>
|
|
# include <sys/mman.h>
|
|
# 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>
|
|
# endif
|
|
# include <pthread.h>
|
|
# include <errno.h>
|
|
# include <sys/time.h>
|
|
# include <time.h>
|
|
# ifdef JEMALLOC_HAVE_MACH_ABSOLUTE_TIME
|
|
# include <mach/mach_time.h>
|
|
# endif
|
|
#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 <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__
|
|
# ifdef JEMALLOC_HAS_RESTRICT
|
|
# define restrict __restrict
|
|
# endif
|
|
/* Disable warnings about deprecated system functions. */
|
|
# pragma warning(disable: 4996)
|
|
#if _MSC_VER < 1800
|
|
static int
|
|
isblank(int c)
|
|
{
|
|
|
|
return (c == '\t' || c == ' ');
|
|
}
|
|
#endif
|
|
#else
|
|
# include <unistd.h>
|
|
#endif
|
|
#include <fcntl.h>
|
|
|
|
#endif /* JEMALLOC_INTERNAL_H */
|