GDAL
cpl_userfaultfd.h
1/******************************************************************************
2 *
3 * Name: cpl_userfault.h
4 * Project: CPL - Common Portability Library
5 * Purpose: Use userfaultfd and VSIL to service page faults
6 * Author: James McClain, <james.mcclain@gmail.com>
7 *
8 ******************************************************************************
9 * Copyright (c) 2018, Dr. James McClain <james.mcclain@gmail.com>
10 *
11 * SPDX-License-Identifier: MIT
12 ****************************************************************************/
13
14#ifndef CPL_USERFAULTFD
15#define CPL_USERFAULTFD
16
17#include <stdint.h>
18
19#include <fcntl.h>
20#include <unistd.h>
21
22#include <sys/mman.h>
23#include <sys/stat.h>
24#include <sys/types.h>
25#include <linux/userfaultfd.h>
26
27#define GDAL_UFFD_LIMIT "GDAL_UFFD_LIMIT"
28
29typedef struct cpl_uffd_context cpl_uffd_context;
30
31bool CPL_DLL CPLIsUserFaultMappingSupported();
32cpl_uffd_context CPL_DLL *CPLCreateUserFaultMapping(const char *pszFilename,
33 void **ppVma,
34 uint64_t *pnVmaSize);
35void CPL_DLL CPLDeleteUserFaultMapping(cpl_uffd_context *ctx);
36
37#endif