|
15 | 15 |
|
16 | 16 | #include "base_alloc_global.h"
|
17 | 17 | #include "critnib.h"
|
18 |
| -#include "provider_file_memory_internal.h" |
19 | 18 | #include "provider_os_memory_internal.h"
|
20 | 19 | #include "utils_common.h"
|
21 | 20 | #include "utils_concurrency.h"
|
|
27 | 26 |
|
28 | 27 | #define TLS_MSG_BUF_LEN 1024
|
29 | 28 |
|
| 29 | +typedef struct file_memory_provider_t { |
| 30 | + os_mutex_t lock; // lock for file parameters (size and offsets) |
| 31 | + |
| 32 | + char path[PATH_MAX]; // a path to the file |
| 33 | + int fd; // file descriptor for memory mapping |
| 34 | + size_t size_fd; // size of the file used for memory mappings |
| 35 | + size_t offset_fd; // offset in the file used for memory mappings |
| 36 | + |
| 37 | + void *base_mmap; // base address of the current memory mapping |
| 38 | + size_t size_mmap; // size of the current memory mapping |
| 39 | + size_t offset_mmap; // data offset in the current memory mapping |
| 40 | + |
| 41 | + unsigned protection; // combination of OS-specific protection flags |
| 42 | + unsigned visibility; // memory visibility mode |
| 43 | + size_t page_size; // minimum page size |
| 44 | + |
| 45 | + critnib *mmaps; // a critnib map storing mmap mappings (addr, size) |
| 46 | + |
| 47 | + // A critnib map storing (ptr, fd_offset + 1) pairs. We add 1 to fd_offset |
| 48 | + // in order to be able to store fd_offset equal 0, because |
| 49 | + // critnib_get() returns value or NULL, so a value cannot equal 0. |
| 50 | + // It is needed mainly in the get_ipc_handle and open_ipc_handle hooks |
| 51 | + // to mmap a specific part of a file. |
| 52 | + critnib *fd_offset_map; |
| 53 | +} file_memory_provider_t; |
| 54 | + |
30 | 55 | typedef struct file_last_native_error_t {
|
31 | 56 | int32_t native_error;
|
32 | 57 | int errno_value;
|
|
0 commit comments