MyWebUniversity.com Home Page
 



OpenSolaris man pages main menu


CPU Performance Counters Library Functions     cpcseterrfn(3CPC)



NAME
     cpcseterrfn - control libcpc error reporting

SYNOPSIS
     cc [ flag... ] file... -lcpc [ library... ]
     #include 

     typedef void (cpcerrfnt)(const char *fn, const char *fmt, valist ap);


     void cpcseterrfn(cpcerrfnt *errfn);


DESCRIPTION
     For the convenience of programmers instrumenting their code,
     several  libcpc(3LIB) functions automatically emit to stderr
     error messages that  attempt  to  provide  a  more  detailed
     explanation of their error return values.  While this can be
     useful for simple programs, some applications  may  wish  to
     report  their errors differently-for example, to a window or
     to a log file.


     The cpcseterrfn() function allows the caller to provide  an
     alternate  function for reporting errors; the type signature
     is shown above.  The fn argument is passed the library func-
     tion name that detected the error, the format string fmt and
     argument pointer ap can be passed directly to  vsnprintf(3C)
     or similar varargs-based routine for formatting.


     The default printing routine can be restored by calling  the
     routine with an errfn argument of NUL.

EXAMPLES
     Example 1 Debugging example.


     This example produces error messages only when debugging the
     program  containing  it, or when the  cpcstrtoevent() func-
     tion is reporting an error when parsing an event  specifica-
     tion


       int debugging;
       void
       myapperrfn(const char *fn, const char *fmt, valist ap)
       {
               if (strcmp(fn, "strtoevent") != 0 && !debugging)
                   return;
               (void) fprintf(stderr, "myapp: cpc%s(): ", fn);
               (void) vfprintf(stderr, fmt, ap);



SunOS 5.11          Last change: 28 Mar 2005                    1






CPU Performance Counters Library Functions     cpcseterrfn(3CPC)



       }


ATRIBUTES
     See attributes(5) for descriptions of the  following  attri-
     butes:



     
           ATRIBUTE TYPE               ATRIBUTE VALUE       
    
     MT-Level                     Unsafe                      
    
     Interface Stability          Obsolete                    
    


SEE ALSO
     cpc(3CPC),       cpcseterrhndlr(3CPC),        libcpc(3LIB),
     vsnprintf(3C), attributes(5)

NOTES
     The cpcseterrfn() function exists for binary  compatibility
     only. Source containing this function will not compile. This
     function is obsolete  and  might  be  removed  in  a  future
     release.   Applications   should  use  cpcseterrhndlr(3CPC)
     instead.



























SunOS 5.11          Last change: 28 Mar 2005                    2



OpenSolaris man pages main menu

Contact us      |       About us      |       Term of use      |       Copyright © 2000-2010 MyWebUniversity.com ™