5.2.2 System-Supplied Services: tpsvrinit( ) Function

When a server is booted, the Oracle Tuxedo system main() calls tpsvrinit(3c) during its initialization phase, before handling any service requests.

If an application does not provide a custom version of this function within the server, the system uses the default function provided by main(), which opens the resource manager and logs an entry in the central event log indicating that the server has successfully started. The central user log is an automatically generated file to which processes can write messages by calling the userlog(3c) function. Refer to Managing Errors for more information on the central event log.

You can use the tpsvrinit() function for any initialization processes that might be required by an application, such as the following:

  • Receiving command-line options
  • Opening a database

The following sections provide code samples showing how these initialization tasks are performed through calls to tpsvrinit(). Although it is not illustrated in the following examples, message exchanges can also be performed within this routine. However, tpsvrinit() fails if it returns with asynchronous replies pending. In this case, the replies are ignored by the Oracle Tuxedo system, and the server exits gracefully.

You can also use the tpsvrinit() function to start and complete transactions, as described in Managing Errors.

Use the following signature to call the tpsvrinit() function:

int
tpsvrinit(int argc, char **argv)