|
Blender V5.0
|
#include "BLI_mmap.h"#include "BLI_assert.h"#include "BLI_fileops.h"#include "BLI_mutex.hh"#include "BLI_string_utils.hh"#include "BLI_vector.hh"#include "MEM_guardedalloc.h"#include <atomic>#include <cstring>#include <csignal>#include <cstdlib>#include <sys/mman.h>#include <unistd.h>Go to the source code of this file.
Classes | |
| struct | BLI_mmap_file |
Functions | |
| static blender::Vector< BLI_mmap_file * > & | open_mmaps_vector () |
| static void | print_error (const char *message) |
| static bool | try_map_zeros (BLI_mmap_file *file) |
| static bool | try_handle_error_for_address (const void *address) |
| static void | sigbus_handler (int sig, siginfo_t *siginfo, void *ptr) noexcept |
| static bool | ensure_mmap_initialized () |
| static void | error_handler_add (BLI_mmap_file *file) |
| static void | error_handler_remove (BLI_mmap_file *file) |
| BLI_mmap_file * | BLI_mmap_open (int fd) |
| bool | BLI_mmap_read (BLI_mmap_file *file, void *dest, size_t offset, size_t length) |
| void * | BLI_mmap_get_pointer (BLI_mmap_file *file) |
| size_t | BLI_mmap_get_length (const BLI_mmap_file *file) |
| bool | BLI_mmap_any_io_error (const BLI_mmap_file *file) |
| void | BLI_mmap_free (BLI_mmap_file *file) |
Variables | |
| static blender::Mutex | mmap_mutex |
| static struct sigaction | next_handler = {} |
| bool BLI_mmap_any_io_error | ( | const BLI_mmap_file * | file | ) |
Definition at line 482 of file BLI_mmap.cc.
References BLI_mmap_file::io_error.
Referenced by blender::bke::id_hash::compute_file_hash_with_memory_map(), imb_load_filepath_thumbnail_webp(), and IMB_load_image_from_file_descriptor().
| void BLI_mmap_free | ( | BLI_mmap_file * | file | ) |
Definition at line 487 of file BLI_mmap.cc.
References error_handler_remove(), BLI_mmap_file::handle, BLI_mmap_file::length, MEM_freeN(), and BLI_mmap_file::memory.
Referenced by blender::bke::id_hash::compute_file_hash_with_memory_map(), imb_load_filepath_thumbnail_webp(), IMB_load_image_from_file_descriptor(), memory_close_mmap(), and IMMapStream::~IMMapStream().
| size_t BLI_mmap_get_length | ( | const BLI_mmap_file * | file | ) |
Definition at line 477 of file BLI_mmap.cc.
References BLI_mmap_file::length.
Referenced by BLI_filereader_new_mmap(), blender::bke::id_hash::compute_file_hash_with_memory_map(), imb_load_filepath_thumbnail_webp(), IMB_load_image_from_file_descriptor(), and IMMapStream::IMMapStream().
| void * BLI_mmap_get_pointer | ( | BLI_mmap_file * | file | ) |
Definition at line 472 of file BLI_mmap.cc.
References BLI_mmap_file::memory.
Referenced by blender::bke::id_hash::compute_file_hash_with_memory_map(), imb_load_filepath_thumbnail_webp(), and IMB_load_image_from_file_descriptor().
| BLI_mmap_file * BLI_mmap_open | ( | int | fd | ) |
Definition at line 367 of file BLI_mmap.cc.
References BLI_lseek(), ensure_mmap_initialized(), error_handler_add(), BLI_mmap_file::handle, BLI_mmap_file::id, BLI_mmap_file::length, length(), MEM_callocN(), BLI_mmap_file::memory, and UNLIKELY.
Referenced by BLI_filereader_new_mmap(), blender::bke::id_hash::compute_file_hash_with_memory_map(), imb_load_filepath_thumbnail_webp(), IMB_load_image_from_file_descriptor(), and IMMapStream::IMMapStream().
| bool BLI_mmap_read | ( | BLI_mmap_file * | file, |
| void * | dest, | ||
| size_t | offset, | ||
| size_t | length ) |
Definition at line 459 of file BLI_mmap.cc.
References BLI_mmap_file::io_error, BLI_mmap_file::length, length(), and BLI_mmap_file::memory.
Referenced by memory_read_mmap(), and IMMapStream::read().
|
static |
Definition at line 325 of file BLI_mmap.cc.
References initialized, lock, mmap_mutex, next_handler, and sigbus_handler().
Referenced by BLI_mmap_open().
|
static |
Definition at line 354 of file BLI_mmap.cc.
References lock, mmap_mutex, and open_mmaps_vector().
Referenced by BLI_mmap_open().
|
static |
Definition at line 361 of file BLI_mmap.cc.
References lock, mmap_mutex, and open_mmaps_vector().
Referenced by BLI_mmap_free().
|
static |
Definition at line 64 of file BLI_mmap.cc.
Referenced by error_handler_add(), error_handler_remove(), and try_handle_error_for_address().
|
static |
Definition at line 274 of file BLI_mmap.cc.
References BLI_string_join, and length().
Referenced by sigbus_handler(), and try_handle_error_for_address().
|
staticnoexcept |
Definition at line 297 of file BLI_mmap.cc.
References BLI_assert, ELEM, next_handler, print_error(), ptr, and try_handle_error_for_address().
Referenced by ensure_mmap_initialized().
|
static |
Definition at line 82 of file BLI_mmap.cc.
References BLI_mmap_file::id, BLI_mmap_file::io_error, lock, mmap_mutex, open_mmaps_vector(), print_error(), and try_map_zeros().
Referenced by sigbus_handler().
|
static |
Definition at line 283 of file BLI_mmap.cc.
References BLI_mmap_file::length, and BLI_mmap_file::memory.
Referenced by try_handle_error_for_address().
|
static |
Definition at line 52 of file BLI_mmap.cc.
Referenced by ensure_mmap_initialized(), error_handler_add(), error_handler_remove(), and try_handle_error_for_address().
|
static |
Definition at line 295 of file BLI_mmap.cc.
Referenced by ensure_mmap_initialized(), and sigbus_handler().