forkexec3.c File Reference

Include dependency graph for forkexec3.c:

Go to the source code of this file.

Functions

int main (int argc, char **argv)

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 27 of file forkexec3.c.

00028 {
00029     int retval;
00030     int status;
00031 
00032     tests_quiet( argc, argv );  /* Set TESTS_QUIET variable */
00033 
00034     if ( ( argc > 1 ) && ( strcmp( argv[1], "xxx" ) == 0 ) ) {
00035         retval = PAPI_library_init( PAPI_VER_CURRENT );
00036         if ( retval != PAPI_VER_CURRENT )
00037             test_fail( __FILE__, __LINE__, "execed PAPI_library_init", retval );
00038     } else {
00039         retval = PAPI_library_init( PAPI_VER_CURRENT );
00040         if ( retval != PAPI_VER_CURRENT )
00041             test_fail( __FILE__, __LINE__, "main PAPI_library_init", retval );
00042 
00043         PAPI_shutdown(  );
00044 
00045         if ( fork(  ) == 0 ) {
00046             retval = PAPI_library_init( PAPI_VER_CURRENT );
00047             if ( retval != PAPI_VER_CURRENT )
00048                 test_fail( __FILE__, __LINE__, "forked PAPI_library_init",
00049                            retval );
00050 
00051             if ( execlp( argv[0], argv[0], "xxx", NULL ) == -1 )
00052                 test_fail( __FILE__, __LINE__, "execlp", PAPI_ESYS );
00053         } else {
00054             wait( &status );
00055             if ( WEXITSTATUS( status ) != 0 )
00056                 test_fail( __FILE__, __LINE__, "fork", WEXITSTATUS( status ) );
00057         }
00058     }
00059 
00060     test_pass( __FILE__, NULL, 0 );
00061     exit( 1 );
00062 }

Here is the call graph for this function:


Generated on 26 Jan 2016 for PAPI by  doxygen 1.6.1