Changeset 54010 in vbox for trunk/src/VBox/Additions
- Timestamp:
- Jan 28, 2015 12:21:54 PM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 97918
- Location:
- trunk/src/VBox/Additions
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibDaemonize.cpp
r53421 r54010 69 69 * @param fRespawn Restart the daemonised process after five seconds if it 70 70 * terminates abnormally. 71 * @param pcRespawn Where to store a count of how often we have respawned, 72 * intended for avoiding error spamming. Optional. 71 73 * 72 74 * @todo Use RTProcDaemonize instead of this. … … 75 77 * actually needs that. 76 78 */ 77 VBGLR3DECL(int) VbglR3Daemonize(bool fNoChDir, bool fNoClose, bool fRespawn )79 VBGLR3DECL(int) VbglR3Daemonize(bool fNoChDir, bool fNoClose, bool fRespawn, unsigned *pcRespawn) 78 80 { 79 81 #if defined(RT_OS_OS2) … … 219 221 220 222 if (fRespawn) 223 { 221 224 /* We implement re-spawning as a third fork(), with the parent process 222 225 * monitoring the child and re-starting it after a delay if it exits 223 226 * abnormally. */ 227 unsigned cRespawn = 0; 224 228 for (;;) 225 229 { 226 230 int iStatus, rcWait; 227 231 232 if (pcRespawn != NULL) 233 *pcRespawn = cRespawn; 228 234 pid = fork(); 229 235 if (pid == -1) … … 239 245 exit(0); 240 246 sleep(5); 247 ++cRespawn; 241 248 } 249 } 242 250 return VINF_SUCCESS; 243 251 #endif -
trunk/src/VBox/Additions/common/VBoxService/VBoxService.cpp
r53764 r54010 1099 1099 VBoxServiceVerbose(1, "Daemonizing...\n"); 1100 1100 rc = VbglR3Daemonize(false /* fNoChDir */, false /* fNoClose */, 1101 false /* fRespawn */ );1101 false /* fRespawn */, NULL /* pcRespawn */); 1102 1102 if (RT_FAILURE(rc)) 1103 1103 return VBoxServiceError("Daemon failed: %Rrc\n", rc); -
trunk/src/VBox/Additions/x11/VBoxClient/main.cpp
r54008 r54010 371 371 VBClFatalError(("Creating pid-file path: %Rrc\n", rc)); 372 372 if (fDaemonise) 373 rc = VbglR3Daemonize(false /* fNoChDir */, false /* fNoClose */, fRespawn );373 rc = VbglR3Daemonize(false /* fNoChDir */, false /* fNoClose */, fRespawn, NULL); 374 374 if (RT_FAILURE(rc)) 375 375 VBClFatalError(("Daemonizing: %Rrc\n", rc));
Note:
See TracChangeset
for help on using the changeset viewer.