(file) Return to Process.c CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Executor

Diff for /pegasus/src/Executor/Process.c between version 1.2 and 1.3

version 1.2, 2007/05/25 18:35:07 version 1.3, 2007/06/12 18:19:46
Line 114 
Line 114 
 #else #else
 # error "not implemented on this platform." # error "not implemented on this platform."
 #endif /* PEGASUS_PLATFORM_LINUX_GENERIC_GNU */ #endif /* PEGASUS_PLATFORM_LINUX_GENERIC_GNU */
   
   /*
   **==============================================================================
   **
   ** ReadPidFile()
   **
   **==============================================================================
   */
   
   int ReadPidFile(const char* pidFilePath, int* pid)
   {
       FILE* is = fopen(pidFilePath, "r");
   
       if (!is)
           return -1;
   
       *pid = 0;
   
       fscanf(is, "%d\n", pid);
       fclose(is);
   
       if (*pid == 0)
           return -1;
   
       return 0;
   }
   
   /*
   **==============================================================================
   **
   ** TestProcessRunning()
   **
   **     Returns 0 if a process is running with the ID in the specified PID file
   **     and with the specified process name.
   **
   **==============================================================================
   */
   
   int TestProcessRunning(
       const char* pidFilePath,
       const char* processName)
   {
       int pid;
       char name[EXECUTOR_BUFFER_SIZE];
   
       if (ReadPidFile(pidFilePath, &pid) != 0)
           return -1;
   
       if (GetProcessName(pid, name) != 0 || strcmp(name, processName) != 0)
           return -1;
   
       return 0;
   }


Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2