|
藍森林 http://www.lslnet.com 2006年6月6日 10:18
msgrcv出錯,返回-1,報:Interrupted system call
msgrcv出錯,返回-1,報:Interrupted system call
是什麼原因?是收到了一個信號吧?怎麼知道是具體哪個信號?
如何解決呀? |
msgrcv出錯,返回-1,報:Interrupted system call
給出程序上下文。 |
msgrcv出錯,返回-1,報:Interrupted system call
是被誰將消息隊列delete?
還是接收到某個信號? 如超時 |
msgrcv出錯,返回-1,報:Interrupted system call
代碼:int read_message(int qid,int port_id,char *sDsn,char *sMsgTableName,int *iMsgType,int *iMsgCategory,char *sMsgLogName)
{
int length;
if(sDsn==NULL || sMsgTableName==NULL) {
printf("\nDSN and MsgTableName can't be NULL.\n\n");
return -1;
}
struct mymsgbuf *qbuf;
qbuf=(struct mymsgbuf *)malloc(sizeof(struct mymsgbuf));
length = sizeof(struct mymsgbuf) - sizeof(long);
/* Read a message from the queue */
qbuf->;mtype = (long)port_id;
if( (msgrcv(qid, (struct msgbuf *)qbuf, length, qbuf->;mtype, 0))==-1)
{
perror("msgrcv");
printf("\nread msg fail->;%s\n",strerror(errno));
return -1;
}
strcpy(sDsn,qbuf->;sDsn);
strcpy(sMsgTableName,qbuf->;sMsgTableName);
*iMsgType=qbuf->;iMsgType;
*iMsgCategory=qbuf->;iMsgCategory;
strcpy(sMsgLogName,qbuf->;sMsgLogName);
return 0;
} |
msgrcv出錯,返回-1,報:Interrupted system call
對列的權限是否正確? |
msgrcv出錯,返回-1,報:Interrupted system call
是因為在msgrcv等待的過程中收到了一個信號,引起該函數中斷 |
msgrcv出錯,返回-1,報:Interrupted system call
如何在等待過程中屏蔽所有的信號? |
msgrcv出錯,返回-1,報:Interrupted system call
man signal。 |
msgrcv出錯,返回-1,報:Interrupted system call
我怎麼知道是哪個信號引起了中斷? |
| |