⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gdk_posix.h

📁 这个是内存数据库中的一个管理工具
💻 H
字号:
#ifndef GDK_POSIX_H#define GDK_POSIX_H#include "gdk_system.h"#include <sys/types.h>#ifdef HAVE_MALLOC_H# include <malloc.h>		/* mallopt, mallinfo, and  malloc, free etc. */#endif#ifdef HAVE_FTIME#include <sys/timeb.h>#endif#if TIME_WITH_SYS_TIME# include <sys/time.h># include <time.h>#else# if HAVE_SYS_TIME_H#  include <sys/time.h># else#  include <time.h># endif#endif#if defined(HAVE_WINSOCK_H) && defined(NATIVE_WIN32)#include <winsock.h>		/* for timeval */#endif#ifdef NATIVE_WIN32#include <io.h>#include <direct.h>#else#ifdef PROFILE/* Linux gprof messes up on multithreaded programs */gdk_export int gprof_pthread_create(pthread_t *__restrict, __const pthread_attr_t *__restrict,                                     void * (*fcn)(void *), void *__restrict);#endif#endif/* Some systems (SGI, Sun) call malloc before we get a chance to call   mallopt, and mallopt should be called before the first call to   malloc.  Therefore we do as if we don't have mallopt, even though   in reality we do. */#ifdef HAVE_MALLOPT#undef HAVE_MALLOPT#endif#ifndef HAVE_MALLINFO#ifndef M_MXFAST#define M_MXFAST	1	/* set size of blocks to be fast */#endif#ifndef M_NLBLKS#define M_NLBLKS	2	/* set number of block in a holding block */#endif#ifndef M_GRAIN#define M_GRAIN		3	/* set number of sizes mapped to one, for */			   /* small blocks */#endif#ifndef M_KEEP#define M_KEEP		4	/* retain contents of block after a free */			   /* until another allocation */#endif#ifndef HAVE_STRUCT_MALLINFOstruct mallinfo {	int arena;		/* total space in arena */	int ordblks;		/* number of ordinary blocks */	int smblks;		/* number of small blocks */	int hblks;		/* number of holding blocks */	int hblkhd;		/* space in holding block headers */	int usmblks;		/* space in small blocks in use */	int fsmblks;		/* space in free small blocks */	int uordblks;		/* space in ordinary blocks in use */	int fordblks;		/* space in free ordinary blocks */	int keepcost;		/* cost of enabling keep option */};#endif#define mallinfo() 		{0}#define mallopt(cmd,value)	0#endif /* ! HAVE_MALLINFO */gdk_export struct mallinfo MT_mallinfo(void);#define F_TLOCK 2		/* test and lock a region for exclusive use */#define F_ULOCK 0		/* unlock a previously locked region */#define F_LOCK 1		/* lock a region for exclusive use */gdk_export int MT_lockf(char *filename, int mode, off_t off, off_t len);gdk_export void MT_sleep_ms(unsigned int ms);#define MT_VMUNITLOG 	16#define MT_VMUNITSIZE 	(1 << MT_VMUNITLOG)#ifdef DEBUG_ALLOCgdk_export int MT_alloc_register(void *p, size_t size, char mode);gdk_export int MT_alloc_print(void);gdk_export int MT_alloc_table(void);#else#define MT_alloc_register(p, size, mode) (void)p; (void)size; (void)mode#define MT_alloc_print()#define MT_alloc_table()#endif /* make sure POSIX_MADV_* and posix_madvise() are defined somehow */#ifdef HAVE_SYS_MMAN_H#  define __USE_BSD# include <sys/mman.h>#endif#ifndef HAVE_POSIX_MADVISE# ifdef HAVE_MADVISE#  define posix_madvise madvise#  ifndef MADV_RANDOM#   define MADV_RANDOM	0#  endif#  ifndef POSIX_MADV_NORMAL#   define POSIX_MADV_NORMAL     MADV_NORMAL#   define POSIX_MADV_RANDOM     MADV_RANDOM#   define POSIX_MADV_SEQUENTIAL MADV_SEQUENTIAL#   define POSIX_MADV_WILLNEED   MADV_WILLNEED#   define POSIX_MADV_DONTNEED   MADV_DONTNEED#  endif# else#  define posix_madvise(x,y,z)	0#  ifndef POSIX_MADV_NORMAL#   define POSIX_MADV_NORMAL     0#   define POSIX_MADV_RANDOM     0#   define POSIX_MADV_SEQUENTIAL 0#   define POSIX_MADV_WILLNEED   0#   define POSIX_MADV_DONTNEED   0#  endif# endif#endif/* in case they are still not defined, define these values as   something that doesn't do anything */#ifndef POSIX_MADV_NORMAL#define POSIX_MADV_NORMAL 0#endif#ifndef POSIX_MADV_RANDOM#define POSIX_MADV_RANDOM 0#endif#ifndef POSIX_MADV_SEQUENTIAL#define POSIX_MADV_SEQUENTIAL 0#endif#ifndef POSIX_MADV_WILLNEED#define POSIX_MADV_WILLNEED 0#endif#ifndef POSIX_MADV_DONTNEED#define POSIX_MADV_DONTNEED 0#endif/* the new mmap modes, mimic default MADV_* madvise POSIX constants */#define MMAP_NORMAL     	POSIX_MADV_NORMAL	/* no further special treatment */#define MMAP_RANDOM     	POSIX_MADV_RANDOM	/* expect random page references */#define MMAP_SEQUENTIAL 	POSIX_MADV_SEQUENTIAL	/* expect sequential page references */#define MMAP_WILLNEED   	POSIX_MADV_WILLNEED	/* will need these pages */#define MMAP_DONTNEED   	POSIX_MADV_DONTNEED	/* don't need these pages */#define MMAP_READ		1024	/* region is readable (default if ommitted) */#define MMAP_WRITE		2048	/* region may be written into */#define MMAP_COPY		4096	/* writable, but changes never reach file */#define MMAP_ASYNC		8192	/* asynchronous writes (default if ommitted) */#define MMAP_SYNC		16384	/* writing is done synchronously *//* in order to be sure of madvise and msync modes, pass them to mmap() call as well *//* a hook function to add any initialization required for the MT_ functionality */gdk_export char *MT_heapbase;gdk_export char *MT_heapcur(void);gdk_export void MT_init_posix(int alloc_map);gdk_export size_t MT_getrss(void);gdk_export void *MT_mmap(char *path, int mode, off_t off, size_t len);gdk_export int MT_munmap(void *p, size_t len);gdk_export int MT_msync(void *p, size_t len, int mode);gdk_export int MT_madvise(void *p, size_t len, int advise);typedef struct MT_mmap_hdl_t {	void *hdl;	int mode;	void *fixed;#ifdef NATIVE_WIN32	int hasLock;	void *map;#endif} MT_mmap_hdl;gdk_export void *MT_mmap_open(MT_mmap_hdl *hdl, char *path, int mode, off_t off, size_t len, size_t nremaps);gdk_export void *MT_mmap_remap(MT_mmap_hdl *hdl, off_t off, size_t len);gdk_export void MT_mmap_close(MT_mmap_hdl *hdl);gdk_export int MT_mmap_trim(size_t lim, void *err);gdk_export void MT_mmap_pin(void *p, size_t len);gdk_export void MT_mmap_unpin(void *p, size_t len);gdk_export void *MT_vmalloc(size_t size, size_t * maxsize);gdk_export void MT_vmfree(void *p, size_t size);gdk_export void *MT_vmrealloc(void *voidptr, size_t oldsize, size_t newsize, size_t oldmaxsize, size_t * newmaxsize);gdk_export int MT_path_absolute(char *path);#ifdef NATIVE_WIN32#define RTLD_LAZY	1#define RTLD_NOW	2#define RTLD_GLOBAL	4gdk_export void *dlopen(const char *file, int mode);gdk_export int dlclose(void *handle);gdk_export void *dlsym(void *handle, const char *name);gdk_export char *dlerror(void);#ifndef HAVE_GETTIMEOFDAYgdk_export int gettimeofday(struct timeval *tv, int *ignore_zone);#endifgdk_export int win_stat(const char *, struct stat *);gdk_export int win_rmdir(const char *);gdk_export int win_mkdir(const char *, const int mode);#define stat(x,y)	win_stat(x,y)#define mkdir		win_mkdir#define rmdir		win_rmdir#if _WIN32_WINNT >= 0x500#define link		win_link#endif#define NAME_MAX 255#ifndef HAVE_OPENDIRstruct DIR {	char *dir_name;	int just_opened;	unsigned int find_file_handle;	char *find_file_data;};typedef struct DIR DIR;struct direct {	char d_name[NAME_MAX + 1];	int d_namelen;};#endif#ifndef HAVE_FTRUNCATEgdk_export int ftruncate(int fd, off_t size);#endif#ifndef HAVE_OPENDIRgdk_export DIR *opendir(const char *dirname);gdk_export struct direct *readdir(DIR *dir);gdk_export void rewinddir(DIR *dir);gdk_export int closedir(DIR *dir);#endif#endif#endif /* GDK_POSIX_H */#define _errno		win_errnogdk_export int *win_errno(void);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -