mmap_file() = #file_descriptor{}
open_option() = anon | auto_unlink | create | debug | direct | fixed | lock | nocache | nolock | noreserve | populate | private | read | shared | shared_validate | sync | truncate | uninitialized | write | {address, pos_integer()} | {chmod, pos_integer()} | {size, pos_integer()}
Options for opening a memory mapped file:
/dev/shm/...)
and is mapped in direct mode to free the memory after the data was gc'dsync to precisely control when
updates are carried through to the underlying file.shared except that shared mappings ignore
unknown flags in flags. By contrast, when creating a mapping using shared_validate,
the kernel verifies all passed flags are known and fails the mapping with the error
eopnotsupp for unknown flags. This mapping type is also required to be able to use
some mapping flags (e.g., sync)shared_validate mapping type; mappings of type
shared will silently ignore this flag. This flag is supported only for files
supporting DAX (direct mapping of persistent memory). For other files, creating a
mapping with this flag results in an eopnotsupp error.
Shared file mappings with this flag provide the guarantee that while some memory is
mapped writable in the address space of the process, it will be visible in the same
file at the same offset even after the system crashes or is rebooted. In conjunction
with the use of appropriate CPU instructions, this provides users of such mappings
with a more efficient way of making data modifications persistent.CONFIG_MMAP_ALLOW_UNINITIALIZED option.MAP_FIXED on the memory mapped file)0600)resource() = binary()
| close/1 | |
| close_counters/1 | Close persistent memory-mapped file previously open with open_counters/2 |
| dec_counter/2 | Decrement a counter number CounterNum in the mmap file by one and return old value. |
| dec_counter/3 | Decrement a counter number CounterNum in the mmap file by Count and return old value. |
| inc_counter/2 | Increment a counter number CounterNum in the mmap file by one and return old value. |
| inc_counter/3 | Increment a counter number CounterNum in the mmap file by Count and return old value. |
| init/0 | |
| open/2 | Open/create a memory-mapped file. |
| open/4 | Open/create a memory-mapped file. |
| open_counters/1 | Open a persistent memory-mapped file with space for one 64-bit integer counter. |
| open_counters/2 | Open a persistent memory-mapped file with space for several 64-bit integer counters. |
| patomic/4 | Perform an atomic operation on a 64-bit integer value at given Position
using specified argument Value. |
| patomic_read_integer/2 | Perform an atomic load operation on a 64-bit integer value at given Position. |
| patomic_write_integer/3 | Perform an atomic store operation of a 64-bit integer Value at given Position. |
| position/2 | Write Data bytes to a memory-mapped file at a given offset At. |
| pread/3 | Read Len bytes from a memory-mapped file at a given offset Off. |
| pwrite/3 | Write Data bytes to a memory-mapped file at a given offset Off. |
| read/2 | Read next Len bytes from a memory-mapped file. |
| read_counter/2 | |
| read_line/1 | |
| set_counter/3 | Set a counter number CounterNum in the mmap file and return the old value. |
close(File::mmap_file()) -> ok
close_counters(X1) -> any()
Close persistent memory-mapped file previously open with open_counters/2
dec_counter(X1, CounterNum) -> any()
Decrement a counter number CounterNum in the mmap file by one and return old value.
dec_counter(X1, CounterNum, Count) -> any()
Decrement a counter number CounterNum in the mmap file by Count and return old value.
inc_counter(X1, CounterNum) -> any()
Increment a counter number CounterNum in the mmap file by one and return old value.
inc_counter(X1, CounterNum, Count) -> any()
Increment a counter number CounterNum in the mmap file by Count and return old value.
init() -> any()
open(FileName::string() | binary(), Options::[open_option()]) -> {ok, mmap_file()} | {error, term()}
Open/create a memory-mapped file.
If creating a new file, [create, read, write, {size, N}] options are required.
For opening an existing file for writing [read, write] options are required.
open(File::string() | binary(), Offset::pos_integer(), Length::pos_integer(), Options::[open_option()]) -> {ok, mmap_file()} | {error, term()}
Open/create a memory-mapped file.
If creating a new file, [create, read, write] options and the Len parameter
are required.
For opening an existing file for writing [read, write] options are required, and Len
can be 0.
open_counters(Filename) -> any()
Open a persistent memory-mapped file with space for one 64-bit integer counter
open_counters(Filename, NumCounters) -> any()
Open a persistent memory-mapped file with space for several 64-bit integer counters
patomic(File::mmap_file(), Position::pos_integer(), Op::add | sub | 'band' | 'bor' | 'bxor' | xchg, Value::integer()) -> OldValue::integer()
Perform an atomic operation on a 64-bit integer value at given Position
using specified argument Value. The function returns an old value at that
location. This function is thread-safe and can be used for implementing
persistent counters.
patomic_read_integer(File::mmap_file(), Position::pos_integer()) -> Value::integer()
Perform an atomic load operation on a 64-bit integer value at given Position.
This function is thread-safe and can be used for implementing persistent counters.
patomic_write_integer(File::mmap_file(), Position::pos_integer(), Value::integer()) -> ok
Perform an atomic store operation of a 64-bit integer Value at given Position.
This function is thread-safe and can be used for implementing persistent counters.
position(File::mmap_file(), Position::pos_integer() | {bof | cur | eof, Position::integer()}) -> {ok, pos_integer()} | {error, term()}
Write Data bytes to a memory-mapped file at a given offset At.
pread(File::mmap_file(), Offset::pos_integer(), Length::pos_integer()) -> {ok, binary()} | {error, term()} | eof
Read Len bytes from a memory-mapped file at a given offset Off.
pwrite(File::mmap_file(), Position::pos_integer(), Data::binary()) -> ok | {error, term()}
Write Data bytes to a memory-mapped file at a given offset Off.
read(File::mmap_file(), Length::pos_integer()) -> {ok, binary()} | {error, term()} | eof
Read next Len bytes from a memory-mapped file.
Internally the new position within the file is incremented by Len.
read_counter(X1, CounterNum) -> any()
read_line(File::mmap_file()) -> {ok, binary()} | {error, term()} | eof
set_counter(X1, CounterNum, Value) -> any()
Set a counter number CounterNum in the mmap file and return the old value.
Generated by EDoc