Created
July 18, 2014 11:14
-
-
Save pluswave/1503265e68c6c4443c70 to your computer and use it in GitHub Desktop.
odd SIGBUS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <fcntl.h> | |
#include <sys/stat.h> | |
#include <sys/mman.h> | |
#include <stdlib.h> | |
#include <string.h> | |
int main() | |
{ | |
int fileDescriptor; | |
int size = 4*1024*1024; | |
fileDescriptor = shm_open("/test", O_CREAT | O_CLOEXEC | O_RDWR, S_IRUSR | S_IWUSR); | |
ftruncate(fileDescriptor, size); | |
void* data = mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, fileDescriptor, 0); | |
memset(data, 'a', size); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
OK it is a system integration issue, the tmpfs of /dev/shm has a mount option size=1M which can't have a 4M shared memory.