LINUX.ORG.RU

mmap


0

0
пытаюсь создать файл замапить его и записать туда данные f1 = open("m1", O_RDWR | O_CREAT, S_IWUSR| S_IRUSR); p1.addr = mmap(0, 3*SIZE, PROT_WRITE, MAP_SHARED, f1, 0); memset(p1.addr, 'a' + p1.num, 12); - вываливается в кору тут --- SIGBUS (Bus error) @ 0 (0) --- +++ killed by SIGBUS (core dumped) +++ как заставить его работать
anonymous
man mmap(2):

SIGBUS: Attempted access to a portion of the buffer that does not correspond to the file (for example, beyond the end of the file, including the case where another process has truncated the file).

Забейте файл чем-нибудь до mmap.

sf ★★★
()
Вдобавок к предыдущему - можно попробовать не забивать файл чем-то, а просто увеличить ему размер ftruncate
tailgunner ★★★★★
()
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.