免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3390 | 回复: 0
打印 上一主题 下一主题

[HP-UX 11.0]EFAULT error in msgrcv() function [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2003-03-18 11:02 |只看该作者 |倒序浏览
[HP-UX 11.0]

Recently a fatal error was encountered in one process of our HP-UX 11.0 system while the msgrcv() function was called. The error # is 14 - EFAULT. From the man page the explanation of the error is:

[EFAULT]msgp points to an illegal address.  The reliable detection of this error is implementation dependent.

However, I am confused by what causes such an error. Please check our source codes listed as below:

#include <errno.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
#include <gnrl/gnrlmsgtypes.h>
#include <gnrl/gnrlmsglib.h>
#include <gnrl/mt.h>
#include <gnrl/gnrlgerrnums.h>
#include <gnrl/gnrlparams.h>
#include \"ipctools.h\"

extern int My_uid;
extern int errno;
extern key_t get_qid();

#define FUNC \"gmsg_recv.c\"

gmsg_recv( msg )
        struct msgbuff *msg;
{
        static key_t qid = 0;

        /* If i don\'t know my id */
        if( qid == 0 )
        {
                /* Find out what queue id corresponds to my user id */
                qid = get_qid( My_uid, FUNC );
        }
        /* Block waiting for a msg */
        while( msgrcv( qid, msg, HEADER + MAX_MSG_DATA_SIZE, -PRI_20, 0) < 0 )
        {
                if( errno == EINTR )
                {
                        errno = 0;
                        continue;
                }
                ginterr( MSG_RECV_ERROR, errno, (int *)0, (int *)0, (int *)0,
                                (int *)0, FUNC, 1 );
                exit( 1 );
        }
}
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP