简体   繁体   English

posix_memalign的系统调用中断

[英]Interrupted system call for posix_memalign

I am getting this exception with posix_memalign. 我正在使用posix_memalign获得此异常。 Any idea as to why we get it? 关于我们为什么得到它的任何想法?

Thanks in advance. 提前致谢。

Interrupted system calls are usually the result of a system call being interrupted. 中断的系统调用通常是系统调用被中断的结果。 In other words, the process is receiving a signal while the call is executing. 换句话说,该过程正在执行呼叫的同时接收信号。

The issue is resolved: The thing is the alignment boundary should be a multiple of 2 and sizeof(void *) . 问题已解决:问题是对齐边界应为2和sizeof(void *)的倍数。 So if posinter size is 4 bytes, the second argument should be 4, 8, 16 etc. Instead of that i was putting it as only multiple of 2, and hence it was crashing. 因此,如果posinter大小为4个字节,则第二个参数应为4、8、16等。相反,我将其仅设置为2的倍数,因此崩溃了。

Wrong usage: crashes
posix_memalign(&addr, 2, 8);

Correct usage:
 posix_memalign(&addr, 4, 8); // Second argument multiple of void* and 2

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM