1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Please help to solve error return code:LE_ERR_IO of subroutine errlog_find_first

Discussion in 'C' started by zhguowen, Jul 31, 2007.

  1. zhguowen

    zhguowen New Member

    Joined:
    Jul 31, 2007
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Enviroment:AIX V5.2
    compile:IBM VAC enterprise V7.0

    programe code:

    root@zhguowen_sv:/asmdev/asm#cat errlog_find.c
    Code:
    #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 0„30…4A0„30…4 */
    	beginstamp.em_field = LE_MATCH_TIMESTAMP;
    	beginstamp.em_intvalue=begintime;
    	endstamp.em_op = LE_OP_LT; /* Expression 0„30…4B0„30…4 */
    	endstamp.em_field = LE_MATCH_TIMESTAMP;
    	endstamp.em_intvalue=endtime;
    	andstamp.em_op = LE_OP_AND; /* 0„30…4A0„30…4 and 0„30…4B0„30…4 */
    	andstamp.em_left = &beginstamp;
    	andstamp.em_right = &endstamp; /* * Select the classes we0„30…4re interested in. */
    	hardclass.em_op = LE_OP_EQUAL; /* Expression 0„30…4C0„30…4 */
    	hardclass.em_field = LE_MATCH_CLASS;
    	hardclass.em_strvalue = "H";
    	softclass.em_op = LE_OP_EQUAL; /* Expression 0„30…4D0„30…4 */
    	softclass.em_field = LE_MATCH_CLASS;
    	softclass.em_strvalue = "S";
    	orclass.em_op = LE_OP_OR; /* 0„30…4C0„30…4 or 0„30…4D0„30…4 */
    	
    	orclass.em_left = &hardclass;
    	orclass.em_right = &softclass;
    	andtop.em_op = LE_OP_AND; /* (0„30…4A0„30…4 and 0„30…4B0„30…4;) and (0„30…4C0„30…4 or 0„30…4D0„30…4;) */
    	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");
    	
    }
    ------------------------------------------------------------------------------
    execute result0„50†2
    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#
    -------------------------------------------------------------------------------------


    Problem:

    errlog_open,errlog_directory and errlog_find_first subroutine come from the book of Technical Reference: Base Operating System and Extensions, Volume 1.

    1.Return error code:LE_ERR_IO, means An i/o error occurred. How to solve this question?
    2.Are there any other book to explain errlog subroutine? It has too little infomation in Technical Reference: Base Operating System and Extensions, Volume 1.
    3.My mail address:zhguowen0103@hotmail.com

    Thanks alot!
     
    Last edited by a moderator: Jul 31, 2007

Share This Page