OSF DCE Application Development Guide--Core Components
Using the DCE Serviceability Application Interface
• dce_svc_register()
This is the function call for registering a serviceability message table. Either it or
DCE_SVC_DEFINE_HANDLE( ) must be called before any routines can be called
to display or log messages. An example of its use can be seen in the illustrated
hello_svc.c code.
• dce_svc_unregister()
This is the function call for destroying a serviceability handle. Calling it closes any
open message routes and frees all allocated resources associated with the handle.
However, it is not usually necessary to call this routine since the normal process exit
will perform the required cleanup.
The routine could have been called at the end of the hello_svc.c application as
follows:
dce_svc_unregister(hel_svc_handle, &status);
where hel_svc_handle is the serviceability handle that was originally returned by the
call to dce_svc_register(), or filled in by the DCE_SVC_DEFINE_HANDLE( )
call.
• dce_svc_set_progname( )
This function sets the application’s program name, which is included in all messages.
In this way, multiple programs can write messages to the same file and the messages
will remain distinguishable.
For example, this routine could have been called in the hello_svc.c code, as follows:
dce_svc_set_progname("hello_program", &status);
The message printed by the program would, as a result, have looked like the
following:
1994-04-05-20:13:34.500+00:00I----- hello_program NOTICE hel main ...
Hello World
instead of looking like this:
1994-04-05-20:13:34.500+00:00I----- PID#9467 NOTICE hel main ...
Hello World
where the default process ID information has been replaced by the string
hello_program in the first example. The second example shows what the message
looks like if the routine is not called. The PID#nnnn value is the value returned by
getpid( ).
This call is optional.
124245 Tandem Computers Incorporated 4− 17