------------------------------------------------------

NAME
     SpeedShop_restrictions - Identifies solutions to SpeedShop ssrt error
     message

DESCRIPTION
     In some case, SpeedShop will not be able to obtain any data from your
     application.  This man page can help you identify the remedy for such
     problems.

     The SpeedShop basic block counting experiment (ideal) doesn't support the
     system() libc call.  As stated in the system(3S) man page, system causes
     the string to be given to /sbin/sh. Because /sbin/sh is non-shared,
     SpeedShop cannot work.

     During the run, SpeedShop will output the following warning:

     ssrt(12345): WARNING: Tracing of system() calls is not supported for
     basic block counting experiments and has been disabled. See
     speedshop_restrictions(5) for details.

     If the goal is to call another program and wait for its termination,
     modify your code to use the fork and exec combination instead.

     The following is an example of a system call translated into a fork/exec.

     #include <sys/types.h> #include <sys/wait.h> #include <unistd.h>

     int alt_system (char *string)
         {
             int argc;
             int i;
             char **argv;
             pid_t pid;

             argc=0;

             /* No string, return right away */
             if(string == NULL || *string == 0) return 0;

             commandToArgv( string, &argc, &argv );

             if( (pid = fork()) < 0 )
                 return -1;
             if( pid == 0 )
             {
                 if( execv( argv[0], argv ) < 0 )
                     return -1;
             }
             else
                 if (waitpid(pid, NULL, 0) < 0)
                         return -1;
             return 0;
         }


NOTES
     You should not use this if the given string is a shell command.

SEE ALSO
     sh(1), speedshop(1)

     fork(2), exec(2), waitpid(2)

     system(3S)


                                                                        Page 2