Questions tagged [mmap]

mmap is a POSIX-compliant Unix system call that maps files or devices into memory.

mmap() creates a new mapping in the virtual address space of the calling process.

https://en.wikipedia.org/wiki/Mmap

1936 questions
0
votes
1 answer

mmap, axi and multiple reads from pcie

I am trying to optimize the reading of data via pcie via mmap. We have some tools that allow for reading/writing one word from the PCIe communication at the time, but I would like to get/write as many words as require in one request. My project uses…
r0b0t1
  • 1
  • 1
0
votes
0 answers

How to parse mmap file on new lines effieciently?

I have a program that reads in a dictionary file (1 word per line) and load it into a hash table as fast as possible, currently I'm using mmap() to read in the whole file then to parse it I just use a loop to check every single character and if…
Ojou Nii
  • 244
  • 4
  • 11
0
votes
3 answers

Using mmap with hint address is the address of a global variable and MAP_FIXED

I have 2 or more processes accessing to a shared memory. I want to create a global variable in each process and then mapping the address of this variable to the shared memory using mmap API with MAP_FIXED flag. So that, when reading/ writing to this…
0
votes
1 answer

How does LMDB write to the database with a read-only mmap?

I am starting to learn about LMDB, but I am having trouble understanding how LMDB writes to a read-only mmap (read-only is the default configuration). Does anyone have a simple explanation as to how this works?
Alex
  • 1
0
votes
2 answers

Program crashing in munmap

I am working at an Android app that, among other things, must send background data to a ftp server. The code that does this is written in native code, using standard Linux functions. Most of the time it works fine, but every once in a while it…
Radu
  • 923
  • 2
  • 9
  • 21
0
votes
1 answer

Bus error attempting to access memory mapped circle buffer

I'm using a queue created with a circle buffer in C by mapping a file to two halves of the same underlying buffer, one after the other. If I attempt to access the buffer immediately after creating it (both before and after mapping the file on top),…
muke
  • 306
  • 2
  • 11
0
votes
1 answer

how to flush page data in python using mmap

I am trying to map a region of fpga memory to host system, resource0 = os.open("/sys/bus/pci/devices/0000:0b:00.0/resource0", os.O_RDWR | os.O_SYNC) resource_size = os.fstat(resource0).st_size mem = mmap.mmap(resource0, 65536, flags=mmap.MAP_SHARED,…
0
votes
1 answer

Writing and reading structs from file using mmap

I am trying to read and write a struct using mmap, however the changes I do after the mmap are not being persisted to the disk or are not being loaded correctly. Here's my code sample, when run the first time the file is created and the prints show…
0
votes
1 answer

How can I modify memory and write to disk?

I am new to ELF and C programming. I wanna set e_shstrndx which locates ELF header to 0 to avoid debugging by using msync system call. I program this code, but it seems not…
coolder
  • 144
  • 2
  • 9
0
votes
1 answer

memset large memory region allocated by shm_open/ftruncate/mmap crashes with bus error

I have a demo program which uses shm_open/ftruncate/mmap to allocate memory: #include #include #include #include #include #include #include #include void…
Kelvin Hu
  • 1,299
  • 16
  • 31
0
votes
1 answer

How can I share a large array of data between processes without duplicating? (IPC)

I have a process that makes an http get request to some API every single second. This process then does some sort of work with the JSON string that is returned from the request. At the same time, I want to pass this JSON string to another process to…
user3567004
  • 117
  • 1
  • 12
0
votes
2 answers

mmap call works on one system but fails with "Cannot allocate memory" on another. Both running same linux image, with plenty of memory

I'm trying to run some code I didn't write, that needs a large chunk (~1GB) of contiguous memory. I'm trying it on two different hardware configurations, but with the same linux binary. It runs on one system but gives an error "Cannot allocate…
kw1
  • 3
  • 3
0
votes
2 answers

How to change value at address from mmap without malloc?

Having this: #include #include #include #include #include #include #include int main (void) { int fd = open("./sometext.txt", O_RDONLY); struct stat sb; …
autistic456
  • 183
  • 1
  • 10
0
votes
1 answer

mmap behaviour changed after OS upgrade?

After a major OS upgrade this C code behaviour has changed: ... if ((fd = open(argv[1], O_RDWR | O_SYNC)) == -1) FATAL; printf("character device %s opened.\n", argv[1]); fflush(stdout); /* map one page */ map_base = mmap(0xe0000000, MAP_SIZE,…
qmastery
  • 77
  • 1
  • 10
0
votes
0 answers

How to allocate block of physical memory?

As in title I need to allocate at least 32MB block of physical memory. I have a hardware that saves it's trace data with 32MB blocks at given physical address. So I thought of allocating enough space with virtual address and translating it's…
Kankarollo
  • 15
  • 5
1 2 3
99
100