免费注册 查看新帖 |

Chinaunix

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

求助:关于AIX V5.2 sytem error log的程序 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-07-30 14:08 |只看该作者 |倒序浏览
环境:AIX V5.2
compile:IBM VAC enterprise V7.0

程序代码:

root@zhguowen_sv:/asmdev/asm#cat errlog_find.c
#include <stdio.h>
#include <fcntl.h>
#include <sys/errlog.h>

int mode=0;
unsigned int magic;

errlog_handle_t errlog_va;
errlog_handle_t *hdl=&errlog_va;

int begintime=0710000007,endtime=0727000007;

/*MMDDHHMMYY (month, day, hour, minute, and year).*/

main()
{

magic=LE_MAGIC;
int rc;
rc=errlog_open(NULL,mode,magic,hdl);
if (rc==0)
{
printf("\nopen errlog sucessful!\n";
}
else
{
printf("\nopen errlog failed!\n";
}




extern int begintime, endtime;


errlog_match_t beginstamp, endstamp, andstamp;

errlog_match_t hardclass, softclass, orclass;

errlog_match_t andtop;
errlog_match_t *p=&andtop;

int ret;

errlog_entry_t result;


/* * Select begin and end times */

beginstamp.em_op = LE_OP_GT; /* Expression &iexcl;&macr;A&iexcl;&macr; */
beginstamp.em_field = LE_MATCH_TIMESTAMP;
beginstamp.em_intvalue=begintime;
endstamp.em_op = LE_OP_LT; /* Expression &iexcl;&macr;B&iexcl;&macr; */
endstamp.em_field = LE_MATCH_TIMESTAMP;
endstamp.em_intvalue=endtime;
andstamp.em_op = LE_OP_AND; /* &iexcl;&macr;A&iexcl;&macr; and &iexcl;&macr;B&iexcl;&macr; */
andstamp.em_left = &beginstamp;
andstamp.em_right = &endstamp; /* * Select the classes we&iexcl;&macr;re interested in. */
hardclass.em_op = LE_OP_EQUAL; /* Expression &iexcl;&macr;C&iexcl;&macr; */
hardclass.em_field = LE_MATCH_CLASS;
hardclass.em_strvalue = "H";
softclass.em_op = LE_OP_EQUAL; /* Expression &iexcl;&macr;D&iexcl;&macr; */
softclass.em_field = LE_MATCH_CLASS;
softclass.em_strvalue = "S";
orclass.em_op = LE_OP_OR; /* &iexcl;&macr;C&iexcl;&macr; or &iexcl;&macr;D&iexcl;&macr; */


orclass.em_left = &hardclass;
orclass.em_right = &softclass;
andtop.em_op = LE_OP_AND; /* (&iexcl;&macr;A&iexcl;&macr; and &iexcl;&macr;B&iexcl;&macr and (&iexcl;&macr;C&iexcl;&macr; or &iexcl;&macr;D&iexcl;&macr */
andtop.em_left = &andstamp;
andtop.em_right = &orclass;

int direction=LE_REVERSE;
rc=errlog_set_direction(hdl, direction);
if (rc==0)
{
printf("\ndirection errlog sucessful!\n";
}
else
{
printf("\ndirection errlog failed!\n";
}

ret = errlog_find_first(hdl,&andtop,&result);


if (ret==0)
{
printf("\nfind errlog sucessful!\n";
}
else
{
printf("\nfind errlog failed!\n";
}



if (LE_ERR_INVARG == ret)
printf("\n\n return LE_ERR_INVARG \n";

if (LE_ERR_NOMEM == ret)
printf("\n\n return LE_ERR_NOMEM \n";
if (LE_ERR_IO == ret)
printf("\n\n return LE_ERR_IO \n");
if (LE_ERR_DONE == ret)
printf("\n\n return LE_ERR_INVFILE \n");

}

执行结果:
root@zhguowen_sv:/asmdev/asm#xlc errlog_find.c /usr/lib/liberrlog.a

root@zhguowen_sv:/asmdev/asm#./a.out

open errlog sucessful!

direction errlog sucessful!

find errlog failed!


return LE_ERR_IO
root@zhguowen_sv:/asmdev/asm#

问题:
此段程序的大部门代码摘自《Technical Reference: Base Operating System and Extensions, Volume 1》,少部分由自己编写。关于errlog_open errlog_find_first API见此书P212页。
程序运行返回错误代码 LE_ERR_IO 书上解释是An i/o error occurred.
因资料有限,请教这样的错误应当如何解决?或者是否有其它相关资料可以查询?

多谢!

[ 本帖最后由 zhguowen 于 2007-7-31 09:53 编辑 ]

论坛徽章:
0
2 [报告]
发表于 2007-07-30 17:13 |只看该作者
自己顶一下。

论坛徽章:
0
3 [报告]
发表于 2007-07-31 09:54 |只看该作者
再顶。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP