mirror of
https://github.com/isar/libmdbx.git
synced 2025-08-25 21:54:28 +08:00
mdbx: rework using of mdbx_mmap_t and mdbx_msync().
This commit is contained in:
25
src/osal.h
25
src/osal.h
@@ -420,8 +420,6 @@ int mdbx_pwrite(mdbx_filehandle_t fd, const void *buf, size_t count,
|
||||
uint64_t offset);
|
||||
int mdbx_write(mdbx_filehandle_t fd, const void *buf, size_t count);
|
||||
|
||||
int mdbx_msync(void *addr, size_t length, int async);
|
||||
|
||||
int mdbx_thread_create(mdbx_thread_t *thread,
|
||||
THREAD_RESULT(THREAD_CALL *start_routine)(void *),
|
||||
void *arg);
|
||||
@@ -440,19 +438,24 @@ int mdbx_openfile(const char *pathname, int flags, mode_t mode,
|
||||
int mdbx_closefile(mdbx_filehandle_t fd);
|
||||
|
||||
typedef struct mdbx_mmap_param {
|
||||
void *address;
|
||||
union {
|
||||
void *address;
|
||||
uint8_t *dxb;
|
||||
struct MDBX_lockinfo *lck;
|
||||
};
|
||||
mdbx_filehandle_t fd;
|
||||
#ifdef MDBX_OSAL_SECTION
|
||||
MDBX_OSAL_SECTION section;
|
||||
#endif
|
||||
mdbx_filehandle_t fd;
|
||||
} mdbx_mmap_param_t;
|
||||
int mdbx_mmap(int flags, mdbx_mmap_param_t *map, size_t length, size_t limit);
|
||||
int mdbx_munmap(mdbx_mmap_param_t *map, size_t length);
|
||||
int mdbx_mlock(mdbx_mmap_param_t *map, size_t length);
|
||||
int mdbx_mresize(int flags, mdbx_mmap_param_t *map, size_t current,
|
||||
size_t wanna);
|
||||
int mdbx_mremap(int flags, mdbx_mmap_param_t *map, size_t old_limit,
|
||||
} mdbx_mmap_t;
|
||||
|
||||
int mdbx_mmap(int flags, mdbx_mmap_t *map, size_t length, size_t limit);
|
||||
int mdbx_munmap(mdbx_mmap_t *map, size_t length);
|
||||
int mdbx_mlock(mdbx_mmap_t *map, size_t length);
|
||||
int mdbx_mresize(int flags, mdbx_mmap_t *map, size_t current, size_t wanna);
|
||||
int mdbx_mremap(int flags, mdbx_mmap_t *map, size_t old_limit,
|
||||
size_t new_limit);
|
||||
int mdbx_msync(mdbx_mmap_t *map, size_t offset, size_t length, int async);
|
||||
|
||||
static __inline mdbx_pid_t mdbx_getpid(void) {
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
|
Reference in New Issue
Block a user