length = -1; // Length of the structure we are going to send overprintf("[+] Calculating the size of the message we are about to send across=%d\n", length);
// msgrcv(int msqid, void *msgp, size_t
不过,我在找到解决方案时遇到了严重的问题,因为即使对于带有标志SA_RESTART的SIGINT,msgrcv函数也会出现EINTR错误。我的问题是-除了在某些"if“中指定错误条件之外,还有什么方法可以避免使用msgrcv函数的EINTR,例如: if (errno == EINTR){ perror("error in msgget");
我遇到的问题是,当我运行msgrcv()时,它将我的全局int msqid设置为0。当然,我在其他方法中也需要它,比如信号处理器。while (1) printf("before the read local:%d goval:%d\n", msgQid, msgQ);
int ret = msgrcv您可以看到,在运行msgrcv()之后,msgQ的值将变为0,尽管我使用一个变量将该值传递给方法read_msgs()。