Examples

The following examples shows how to register and include a component for live dumps.

  1. In the following example, a component is registered for live dumps with the ras_register and ras_control kernel services:
    
    /* Register a component as dump aware */
    rv = ras_register(&Rascb,(char*)Compname,(ras_block_t)0,RAS_TYPE_OTHER,
         "sample component",RASF_DUMP_AWARE,sample_callback,NULL);
    if (rv) return(KERROR2ERRNO(rv));
    
    /* Make the component live dump aware. */
    rv = ras_control(Rascb, RASCD_SET_LDMP_ON, 0, 0);
    if (rv) return(KERROR2ERRNO(rv));
    
  2. In the following example, a component is included in a live dump from software programs:
    
    {
    	...
    	ldmp_parms_t parms;
    	extern ras_block_t Rascb;	/* The ras_block_t from above */
    
    	/* Setup the live dump parms structure. */
    	if (ldmp_setupparms(&parm)) {
    		/* serious error */
    		...
    	}
    
    	/* Each live dump must have a symptom. */
    	parms.ldp_symptom = "sample dump";
    
    	/* Include sample_comp in this dump as the failing component. */
    	if (dmp_compspec(DCF_FAILING|DCF_BYCB, Rascb, &parm, NULL, NULL)) {
    		/* error */
    		...
    	}
    
    	/* Add other components and/or pseudo components. */
    	...
    
    	/* Take the dump. */
    	if (livedump(&parm)) {
    		/* error */
    		...
    	}
    
    	...
    }