Thread View: gnu.gdb.bug
1 messages
1 total messages
Started by Scott Pakin
Tue, 05 Mar 2002 20:52
libmmalloc chokes on /dev/zero
Author: Scott Pakin
Date: Tue, 05 Mar 2002 20:52
Date: Tue, 05 Mar 2002 20:52
20 lines
2199 bytes
2199 bytes
When I use libmmalloc to allocate memory from /dev/zero (e.g., by using "mmalloc_attach (-1, NULL)" to mmap() it), libmmalloc bus errors when it tries to write to the allocated region. The mmalloc library works fine when I use an ordinary file, however. I'm using the libmmalloc.a that comes with gdb-5.1, and I'm running under Linux 2.4.2. /dev/zero has 0666 permissions. I believe the bug is that libmmalloc always mmap()s memory with MAP_SHARED, but it ought to map /dev/zero with MAP_PRIVATE. A quick search-and-replace does seem to fix the problem. I'm guessing that a clean solution (selecting MAP_SHARED or MAP_PRIVATE based on whether /dev/zero is being used) should take <10 lines of code. However, before doing this and submitting a patch file, I was wondering if there's some subtle reason the code was written the way it was -- or if I'm the only one who's had trouble with /dev/zero. Comments? -- Scott
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads