PreviousNext

Serviceability Use of the __FILE__ Macro

Whenever a serviceability message is generated, information identifying the source file and line at which the invoked routine was called is included in the message information. This information appears in the text-form nonerror messages, and it is also written into the binary form serviceability logs (when binary logs are specified). The information also appears in the text form of messages announcing error situations. For example:

1994-07-20-11:11:09.906-04:00I----- sample_server FATAL smp server \
sample_server.c 2851 0xa44b0c18

server_renew_identity( ): login context has not been certified (dce / sec)

(The preprocessor variable DCE_SVC_WANT__FILE__ (in dce/dce_svc.h) will be defined or undefined depending on whether or not the serviceability component has been set up on your system to include the filename and line number information in serviceability messages.)

The serviceability routines receive the source file information from DCE_SVC__FILE__, which, by default, is defined to be the C preprocessor macro __FILE__. However, if you desire to avoid these macro expansions in your application code, you can redefine the symbol to be some kind of variable. For example:

#define DCE_SVC__FILE__ myfile

#include <dce/dce.h>

static char myfile[] = __FILE__;