mmap Questions

5

Solved

I'm trying to find out how to remap memory-mapped files on a Mac (when I want to expand the available space). I see our friends in the Linux world have mremap but I can find no such function in t...
Plumose asked 19/8, 2010 at 11:34

2

Solved

what is the main difference between File-backed mapping & Anonymous mapping. How can we choose between File-backed mapping or Anonymous mapping, when we need an IPC between processes. W...
Darbee asked 8/1, 2017 at 4:20

2

I have the issue that I cannot properly close mmap-s in Python after I created a pointer to them. My use case is that I open files (usually that is UIO-devices to work with hardware, but the issue ...
Teague asked 16/11, 2018 at 14:38

2

According to mmap() manpage: MAP_PRIVATE Create a private copy-on-write mapping. Updates to the mapping are not visible to other processes mapping the same file, and are not carried through t...
Bullyrag asked 7/6, 2019 at 17:42

2

Solved

I'm trying to model a basic CPU by mmapping a 1 MiB file, corresponding to the RAM size. I want to read/write this file. Currently I'm getting a SIGBUS error with ram[2] = 1 which I gather is from ...
Benedikta asked 14/6, 2017 at 20:11

13

Solved

I'm working on a program that will be processing files that could potentially be 100GB or more in size. The files contain sets of variable length records. I've got a first implementation up and run...
Fracture asked 5/9, 2008 at 14:52

5

Solved

Is seems that the mmap interface only supports readline(). If I try to iterate over the object I get character instead of complete lines. What would be the "pythonic" method of reading a mmap'ed ...
Passmore asked 16/11, 2011 at 12:27

2

Solved

I want to allocate memory on the hugepages being used by a Linux machine. I see that there are two ways to do this, using mmap and madvise. That is, using the MAP_HUGETLB flag with the mmap call ...
Region asked 26/5, 2015 at 23:59

4

Solved

So, I understand that if you need some dynamically allocated memory, you can use malloc(). For example, your program reads a variable length file into a char[]. You don't know in advance how big to...
Turmoil asked 23/8, 2012 at 15:34

1

This code works on linux and prints 43, how could I code a script with similar functionality to be run on windows without errors? import ctypes import mmap buf = mmap.mmap(-1, mmap.PAGESIZE, prot...
Warwickshire asked 14/11, 2019 at 7:41

1

I am trying to run a program on Valgrind. But I am getting this error: valgrind: mmap(0x67d000, 1978638336) failed in UME with error 22 (Invalid argument). valgrind: this can be caused by executab...
Sporulate asked 8/2, 2017 at 22:17

1

Is there a way in python to get the path to the in-memory file, so it'll behave as a normal file for methods which needs file path? My objective is to protect the file, so avoiding dumping into /t...
Uela asked 6/2, 2018 at 11:9

4

Solved

Due to some obscure reasons which are not relevant for this question, I need to resort to use MAP_FIXED in order to obtain a page close to where the text section of libc lives in memory. Before re...
Fustian asked 18/2, 2013 at 19:37

1

I am mapping DMA coherent memory from kernel to user space. At user level I use mmap() and in kernel driver I use dma_alloc_coherent() and afterwards remap_pfn_range() to remap the pages. This basi...
Piperpiperaceous asked 7/11, 2018 at 19:20

7

I built two programs, one using malloc and other one using mmap. The execution time using mmap is much less than using malloc. I know for example that when you're using mmap you avoid read/writes ...
Agretha asked 15/11, 2009 at 23:35

3

Solved

I'm getting -EINVAL for some reason, and it's not clear to me why. Here's where I open and attempt to mmap the file: if ((fd = open(argv[1], O_RDWR)) < 0) { fprintf(stderr, "Failed to open %s:...
Paola asked 24/8, 2013 at 16:5

3

Solved

Editor's note: This code example is from a version of Rust prior to 1.0 and the code it uses does not exist in Rust 1.0. Some answers have been updated to answer the core question for newer versi...
Inseminate asked 14/2, 2015 at 15:14

1

I'm writing a small program for Wayland that uses software rendering and wl_shm for display. This requires that I pass a file descriptor for my screen buffer to the Wayland server, which then calls...
Molecule asked 8/8, 2022 at 13:25

2

why doesn't following pseudo-code work (O_DIRECT results in EFAULT) in_fd = open("/dev/mem"); in_mmap = mmap(in_fd); out_fd = open("/tmp/file", O_DIRECT); write(out_fd, in_mmap, PAGE_SIZE); whil...
Steen asked 22/6, 2011 at 18:31

1

I have a device which writes to a video buffer. This buffer is allocated in system memory using CMA and I want to implement streaming write from this buffer to a block device. My application opens ...
Ultimatum asked 19/4, 2017 at 18:44

3

I want to map device memory (NIC) to the kernel space memory region by using ioremap_wc(). And then I want to remap memory region from kernel space to user space, and I can use 2 functions for this...
Bedford asked 14/12, 2014 at 9:44

1

I'm assuming if this is possible it would most likely be via mmap My original question was can mmap() return the same pointer for each user of the same piece of shared memory? Ultimately an address...
Ronni asked 11/5, 2022 at 0:37

2

Solved

I've spent some time investigating memory mapped IO for an application I'm working on. I have some very large (TB scale) files, and I want to map segments from them into memory, for both reading an...
Cristacristabel asked 21/11, 2011 at 17:22

4

Solved

What's the advantage of doing: shm_open followed a mmap? Why not create a regular file, and then pass that fd to mmap? I can't see the advantage of shm_open - these are just references, are they no...
Drayman asked 21/7, 2014 at 21:36

4

Solved

I want to be able to map memory to a file descriptor so I can use some existing functions that need a file descriptor. Here's essentially what I'm looking for: void do_operation1(int fd); char da...
Succentor asked 12/5, 2010 at 19:18

© 2022 - 2024 — McMap. All rights reserved.