Previous Page Contents Page Next Page

2.5 Solaris Considerations

This section summarizes the information you need to consider when developing TPs for use in the Solaris environment.

2.5.1 Multiple Processes

If the process that issued TP_STARTED or RECEIVE_ALLOCATE then forks to create a child process, the child process cannot use the tp_id that was returned to the parent process. It can, however, issue its own TP_STARTED or RECEIVE_ALLOCATE to obtain its own tp_id.

Two or more instances of the same TP can run as different processes, but each instance is assigned its own tp_id.

You can write an application in which one process contains many TPs, each with its own tp_id. However, you need to design the application carefully to avoid deadlock situations, in which an APPC verb cannot complete because of the state of other conversations and TPs in the same process. This might happen if the program is waiting on one conversation for information to be sent to it before returning some other data, and another conversation from the same process is waiting for this data before it can send the information originally required by the first conversation. To some extent this can be avoided by using a separate process for each TP.

2.5.2 Compiling and Linking the APPC Application

Applications are compiled with different options in order to select one of the scheduling modes described in Scheduling Asynchronous Events.

Note

Applications linked with previous versions of SNAP-IX that used signal-based scheduling mode and the single-threaded library, libmgr.so, will continue to work in the current version of SNAP-IX. However, this library is provided only for back-compatibility. New applications should not use this library.

When compiling your APPC application, use the following options:

/usr/include/sna

Indicates the directory containing one or more header files your application requires.

Specifies use of the sparcv9 (64-bit) architecture instruction set. Use this option if you want to compile the application in 64-bit mode. To compile in 32-bit mode, do not specify this option.

When linking your APPC application, use the following options:

Specifies use of the sparcv9 (64-bit) architecture instruction set. Use this option if you want to link the application in 64-bit mode. To link in 32-bit mode, do not specify this option.

Indicates the directory containing one or more libraries to be used when linking the application.

This directory is normally /opt/sna/lib, except for 64-bit applications where it is /opt/sna/lib/sparcv9.

Indicates the name of a library to be used when linking the application.

Indicates the directory containing one or more libraries to be used by the application at run time. This directory is normally /opt/sna/lib, except for 64-bit applications where it is /opt/sna/lib/sparcv9 .

As an alternative to the option, you can set the environment variable LD_RUN_PATH to /opt/sna/lib or /opt/sna/lib/sparcv9 before compiling and linking the application.

Indicates a preprocessor directive to be used by the compiler. Do not include any space between and the name of the preprocessor directive.

The command you use to link the application depends on which type of application it is, as described below.

Linking Motif Applications and Applications That Use Application Scheduled Mode

For a 64-bit application, link with the following options:


-xarch=v9 -L /opt/sna/lib/sparcv9 -R /opt/sna/lib/sparcv9
 -lappc -lsna

For a 32-bit application, link with the following options:

-L /opt/sna/lib -R /opt/sna/lib -lappc -lsna

Notes

  1. If you are using the standard Solaris compiler /usr/ucb/cc, you may encounter compiler errors indicating that the library libucb.so.1 could not be found. If this occurs, add /usr/ucblib to the compiler options you use to link the program.

  2. Check your Motif documentation for information on which libraries and other options are required to link your Motif application.

Linking Multithreaded Applications

For Solaris, a multithreaded application can use either Solaris threads or POSIX threads. Refer to the Solaris Programmer's Guide for multithreaded programs for more information on using each type of threads. The following options are suitable for linking most applications:

-D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -L /opt/sna/lib -R /opt/sna/lib -lappc -lsna_r -lthread

For a 64-bit application, link with the following options:

-xarch=v9 -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -L /opt/sna/lib/sparcv9
 -R /opt/sna/lib/sparcv9 -lappc -lsna_r -lthread

Note

If you are using the standard Solaris compiler /usr/ucb/cc , you may encounter compiler errors indicating that the library libucb.so.1 could not be found. If this occurs, add /usr/ucblib to the compiler options you use to link the program.

Previous Page Contents Page Top of Page Next page