fork.c

Go to the documentation of this file.
00001 
00002 #include <stdlib.h>
00003 #include <signal.h>
00004 #ifndef WIN32
00005 #include <unistd.h>
00006 #endif /* WIN32 */
00007 
00008 #include "cfc.h"
00009 
00010 /* Define Fortran names */
00011 #define create_mosaic CFC_EXPORT_NAME( create_mosaic)
00012 #define wake_mosaic CFC_EXPORT_NAME( wake_mosaic)
00013 #define kill_mosaic CFC_EXPORT_NAME( kill_mosaic)
00014 #define search_mosaic CFC_EXPORT_NAME( search_mosaic)
00015 
00019 int CFC_API create_mosaic( int *mosaic, CFC_FzString home)
00020 {
00021         int pid = 0;
00022 
00023 #ifndef WIN32
00024         if ((pid = fork( )) == 0) {
00025                 execl( "/usr/local/bin/mosaic", "mosaic", "-home", CFC_fz2c_string( home), NULL);
00026                 exit( 127);
00027         }
00028 #endif
00029         *mosaic = pid;
00030         return 0;                                       /* return statement needed (DB) */
00031 }
00032 
00036 int CFC_API wake_mosaic( int *mosaic)
00037 {
00038 #ifndef WIN32
00039         return kill( *mosaic, SIGUSR1);
00040 #else
00041     return 1;
00042 #endif
00043 }
00044 
00048 int CFC_API kill_mosaic( int *mosaic)
00049 {
00050 #ifndef WIN32
00051         return kill( *mosaic, SIGKILL);
00052 #else
00053     return 1;
00054 #endif
00055 }
00056 
00060 int CFC_API search_mosaic( int *task)
00061 {
00062 #ifndef WIN32
00063         return kill( *task, 0);
00064 #else
00065     return 1;
00066 #endif
00067 }

Generated on Tue Mar 13 15:15:39 2007 for SIC by  doxygen 1.5.1