mmap Questions

1

Solved

While attempting to test Is it allowed to access memory that spans the zero boundary in x86? in user-space on Linux, I wrote a 32-bit test program that tries to map the low and high pages of 32-bit...
Race asked 8/12, 2017 at 10:34

3

Solved

I'm in Linux 2.6. I have an environment where 2 processes simulate (using shared memory) the exchange of data through a simple implementation of the message passing mode. I have a client process (...
Lavabo asked 14/2, 2011 at 11:17

2

I'm trying to figure out if mmap'ing a file, and then using madvise() or posix_madvise() with MADV_WILLNEED/POSIX_MADV_WILLNEED actually triggers background async I/O for read-ahead. The man pages ...
Telepathist asked 3/7, 2015 at 23:23

2

Solved

How can I share memory between the parent and the child if the child has run exec() to load another program? Is it possible using mmap? By now parent and child share memory properly using mmap, b...
Tapes asked 10/1, 2018 at 15:24

0

The code snippet works fine on my machine(Linux/x86-64) int main() { char* addr; int rc; int fd; const size_t PAGE_SIZE = 4096; // assuming the page size is 4096 char buf[PAGE_SIZE]; memset...
Suture asked 28/12, 2017 at 7:26

2

For example. fd = ::open ("/test.txt", O_RDONLY, 0); struct stat buf; fstat(fd, &buf); char* addr = (char*)::mmap(NULL, buf.st_size + 10, PROT_READ, MAP_PRIVATE | MAP_POPULATE, fd, 0); Notic...
Delladelle asked 2/12, 2017 at 3:57

3

Solved

I was reading the documentation of mmap and fell upon this line: PROT_NONE Pages may not be accessed. Is there any use to map a file to memory but never access it?
Epiphyte asked 16/10, 2012 at 14:11

1

Solved

I have this piece of code which segfaults when run on Ubuntu 14.04 on an AMD64 compatible CPU: #include <inttypes.h> #include <stdlib.h> #include <sys/mman.h> int main() { uin...
Unclose asked 27/11, 2017 at 12:15

1

Solved

To ask the question another way, can you confirm that when you mmap() a file that you do in fact access the exact physical pages that are already in the page cache? I ask because I’m doing testing...
Boot asked 13/9, 2017 at 6:54

3

Solved

My understanding of the semantics of volatile in C and C++ is that it turns memory access into (observable) side effects. Whenever reading or writing to a memory mapped file (or shared memory) I wo...
Latoyalatoye asked 18/8, 2017 at 10:0

4

I have a data structure that I'd like to rework to page out on-demand. mmap seems like an easy way to run some initial experiments. However, I want to limit the amount of buffer cache that the mmap...
Hilleary asked 25/7, 2017 at 18:29

1

I have recently discovered that Linux does not guarantee that memory allocated with mmap can be freed with munmap if this leads to situation when number of VMA (Virtual Memory Area) structures exce...
Inartificial asked 2/5, 2017 at 17:6

1

For some reason my mmap failed with an Invalid argument message even though my offset is page aligned. Page size is 4096 bytes. Also CONFIG_STRICT_DEVMEM is disabled, i.e. I can access memory above...
Ultimogeniture asked 25/8, 2016 at 0:36

1

Solved

I'm using XFS on Linux and have a memory mapped file to which I write once per second. I notice that the file mtime (shown by watch ls --full-time) changes periodically but irregularly. The gap bet...
Linstock asked 29/6, 2017 at 2:19

1

I'm trying to boost DMA<->CPU<->GPU data transfer by: 1. Mapping my (proprietary) device Linux Kernel allocated memory to user space 2. Registering the later (mapped memory) to Cuda with cuda...
Haworth asked 15/6, 2017 at 14:18

2

Solved

Is there a method to save a numpy memmap array into a .npy file? Apparently, there is a method to load such an array from a .npy file as follows data = numpy.load("input.npy", mmap_mode='r') but...
Stesha asked 21/4, 2016 at 12:18

3

Solved

I'm trying to make "Blinky" for STM32F1xx in Rust. I know that there are libs for it, but I want to make my own "lib" for learning purposes. I can access STM32's "registers" by their addresses lik...
Cyclamate asked 26/1, 2016 at 7:48

1

Solved

Is it possible – and if so prudent – to use sendfile() (or its Darwin/BSD cousin fcopyfile()) to shuttle data directly between a shared-memory object and a file? Functions like sendfile() and fcop...
Misanthropy asked 13/5, 2017 at 22:56

1

Solved

I'm using PCI-e port on Freescale MPC8308 processor (which is based on PowerPC architecture) and I have some problems when trying to use it. The endpoint PCI-e device has memory space equal to 256 ...
Tomkin asked 3/11, 2016 at 6:36

2

Solved

Our software builds a data structure in memory that is about 80 gigabytes large. It can then either use this data structure directly to do its computation, or dump it to disk so it can be reused se...
Shushubert asked 16/5, 2017 at 12:18

1

Solved

I'm trying to place and execute program-code into a shared-memory region. Initializing and allocating the shared memory as well as copying the shellcode into the "new" memory works as intende...
Effusive asked 8/5, 2017 at 14:7

2

Solved

In my understanding, mmap'ing a file that fits into RAM will be like having the file in memory. Say that we have 16G of RAM, and we first mmap a 10G file that we use for a while. This should be fa...
Spoonful asked 21/4, 2017 at 11:19

2

Solved

Is there any way in Linux, using c, to generate a diff/patch of two files stored in memory, using a common format (ie: unified diff, like with the command-line diff utility)? I'm working on a syst...
Harpy asked 21/2, 2017 at 20:35

1

Solved

Does mmap() guarantee that the return values are aligned to the largest alignment on the system? i.e. is it guaranteed by the POSIX standard that mmap has to return pointer values that are multiple...
Agentival asked 15/2, 2017 at 20:34

2

Solved

Here is the example code I wrote. #include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include <unistd.h> #include <sys/mman.h> int main() { int fd; long pag...
Marthmartha asked 1/1, 2017 at 13:59

© 2022 - 2024 — McMap. All rights reserved.