Bus error vs Segmentation fault

前端 未结 7 778
梦毁少年i
梦毁少年i 2020-12-24 01:19

Difference between a bus error and a segmentation fault? Can it happen that a program gives a seg fault and stops for the first time and for the second time it may give a bu

7条回答
  •  梦毁少年i
    2020-12-24 02:00

    SIGBUS will also be raised if you mmap() a file and attempt to access part of the mapped buffer that extends past the end of the file, as well as for error conditions such as out of space. If you register a signal handler using sigaction() and you set SA_SIGINFO, it may be possible to have your program examine the faulting memory address and handle only memory mapped file errors.

提交回复
热议问题