Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

cpc_seterrfn(3cpc) [opensolaris man page]

cpc_seterrfn(3CPC)				    CPU Performance Counters Library Functions					cpc_seterrfn(3CPC)

NAME
cpc_seterrfn - control libcpc error reporting SYNOPSIS
cc [ flag... ] file... -lcpc [ library... ] #include <libcpc.h> typedef void (cpc_errfn_t)(const char *fn, const char *fmt, va_list ap); void cpc_seterrfn(cpc_errfn_t *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 cpc_seterrfn() 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 function 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 NULL. EXAMPLES
Example 1 Debugging example. This example produces error messages only when debugging the program containing it, or when the cpc_strtoevent() function is reporting an error when parsing an event specification int debugging; void myapp_errfn(const char *fn, const char *fmt, va_list ap) { if (strcmp(fn, "strtoevent") != 0 && !debugging) return; (void) fprintf(stderr, "myapp: cpc_%s(): ", fn); (void) vfprintf(stderr, fmt, ap); } ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |MT-Level |Unsafe | +-----------------------------+-----------------------------+ |Interface Stability |Obsolete | +-----------------------------+-----------------------------+ SEE ALSO
cpc(3CPC), cpc_seterrhndlr(3CPC), libcpc(3LIB), vsnprintf(3C), attributes(5) NOTES
The cpc_seterrfn() function exists for binary compatibility only. Source containing this function will not compile. This function is obso- lete and might be removed in a future release. Applications should use cpc_seterrhndlr(3CPC) instead. SunOS 5.11 28 Mar 2005 cpc_seterrfn(3CPC)

Check Out this Related Man Page

cpc_event_diff(3CPC)				    CPU Performance Counters Library Functions				      cpc_event_diff(3CPC)

NAME
cpc_event_diff, cpc_event_accum - simple difference and accumulate operations SYNOPSIS
cc [ flag... ] file... -lcpc [ library... ] #include <libcpc.h> void cpc_event_accum(cpc_event_t *accum, cpc_event_t *event); void cpc_event_diff(cpc_event_t *diff, cpc_event_t *after, cpc_event_t *before); DESCRIPTION
The cpc_event_accum() and cpc_event_diff() functions perform common accumulate and difference operations on cpc_event(3CPC) data struc- tures. Use of these functions increases program portability, since structure members are not referenced directly . cpc_event_accum() The cpc_event_accum() function adds the ce_pic fields of event into the corresponding fields of accum. The ce_hrt field of accum is set to the later of the times in event and accum. SPARC: The function adds the contents of the ce_tick field of event into the corresponding field of accum. x86: The function adds the contents of the ce_tsc field of event into the corresponding field of accum. cpc_event_diff() The cpc_event_diff() function places the difference between the ce_pic fields of after and before and places them in the corresponding field of diff. The ce_hrt field of diff is set to the ce_hrt field of after. SPARC: Additionally, the function computes the difference between the ce_tick fields of after and before, and places it in the corresponding field of diff. x86: Additionally, the function computes the difference between the ce_tsc fields of after and before, and places it in the corresponding field of diff. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Obsolete | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
cpc(3CPC), cpc_buf_add(3CPC), cpc_buf_sub(3CPC), cpc_event(3CPC), libcpc(3LIB), attributes(5) NOTES
The cpc_event_accum() and cpc_event_diff() functions exist for binary compatibility only. Source containing these functions will not com- pile. These functions are obsolete and might be removed in a future release. Applications should use cpc_buf_add(3CPC) and cpc_buf_sub(3CPC) instead. SunOS 5.11 28 Mar 2005 cpc_event_diff(3CPC)
Man Page