I am sponsoring the following for fast track approval. The timer expires Thursday 4 June 2009.
PSARC 2009/323 - rpcgen error reporting Name: rpcgen error reporting Submitter: Jordan Brown Owner: Jordan Brown Interest: Robert.Thurlow at sun.com Status: waiting fast-track 06/04/2009 Exposure: open SUMMARY Adds a mechanism to allow an application using rpcgen-created server code to control how errors are reported. BACKGROUND rpcgen's generated service code (*_svc.c) includes a function _msgout that it calls to report errors it encounters. The application is provided only limited and ill-documented ways to control the operation of this function; it either calls syslog() or writes to standard error. PROBLEM If the developer wants more control over error reporting it is necessary to statically create the file, edit it to replace _msgout, and check in the resulting file. This creates an ongoing maintenance headache, since changes to the *.x file must be hand-merged into this file. PROPOSAL Define a public interface allowing the developer to intercept message output, by allowing the use of a compile-time macro to specify an alternate routine. DETAILS If the *_svc.c file is compiled with a macro RPC_MSGOUT defined, perhaps using a compiler option like -DRPC_MSGOUT=mymsgfunc, the value specified will be used as the name of a printf-like function to be called with any errors to be reported. That function must conform to the signature extern void RPC_MSGOUT(const char *fmt, ...); COMMENTS The existing _msgout function takes a single argument, a message to be printed. If we're making this a public interface, it seems to make sense to provide for future expansion, which is why this case proposes to define the function as a printf-like function. Current error reporting behavior is formally undefined. The suggested manual page text below slightly defines it, by specifying that standard error and/or the system log are used, but avoids specifying how that decision is made. DELIVERY VEHICLE Solaris RELEASE Patch COMMITMENT LEVEL Committed TESTIMONIALS Rob Thurlow has reviewed this proposal and endorses it. MANUAL PAGE Add to the manual page text along the lines of: SERVER ERROR REPORTING By default, errors detected by proto_svc.c will be reported to standard error and/or the system log. This behavior can be overridden by compiling the file with a definition of RPC_MSGOUT, e.g. -DRPC_MSGOUT=mymsgfunc. The function specified will be called to report errors. It must conform to this printf-like signature: extern void RPC_MSGOUT(const char *fmt, ...);