tpsvrinit - System/T server initialization routine
#include <atmi.h> inttpsvrinit(int argc, char **argv)
The System/T server abstraction calls tpsvrinit() during its initialization. This routine is called after the thread of control has become a server but before it handles any service requests; thus, System/T communication may be performed and transactions may be defined in this routine. However, if tpsvrinit() returns with open connections, asynchronous replies pending, or while still in transaction mode, System/T will close the connections, ignore replies pending, and abort the transaction; the server will exit gracefully.
If an application does not provide this routine in a server, then the default version provided by System/T is called instead. The default tpsvrinit() calls tx_open() and userlog() to announce that the server has successfully started.
Application-specific options can be passed into a server and processed in tpsvrinit() (see servopts(5)). The options are passed through argc and argv. Since getopt(3C) is used in a System/T server abstraction, optarg, optind, and opterr may be used to control option parsing and error detection in tpsvrinit().
If an error occurs in tpsvrinit(), the application can cause the server to exit gracefully (and not take any service requests) by returning -1. The application should not call exit(2) itself.
A negative return value will cause the server to exit gracefully.
If either tpreturn() or tpforward() are used outside of a service routine (e.g., in clients, or in tpsvrinit() or tpsvrdone()), then these routines simply return having no effect.
servopts(5),
tx_open(3c),
tpsvrdone(3c),
getopt(3C) in a Unix System reference manual