- Timestamp:
- Mar 26, 2010 2:50:55 PM (15 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
r27682 r27743 888 888 rc = RTProcCreate (path, args, env, 0, &pid); 889 889 # else 890 rc = RTProcCreate (path, args, env, RTPROC_FLAGS_DAEMONIZE , &pid);890 rc = RTProcCreate (path, args, env, RTPROC_FLAGS_DAEMONIZE_DEPRECATED, &pid); 891 891 # endif 892 892 if (RT_FAILURE (rc)) … … 936 936 strcpy (cmd, VirtualBox_exe); 937 937 const char * args[] = {path, "-systray", 0 }; 938 938 # ifdef RT_OS_WINDOWS /** @todo drop this once the RTProcCreate bug has been fixed */ 939 939 rc = RTProcCreate (path, args, env, 0, &pid); 940 941 rc = RTProcCreate (path, args, env, RTPROC_FLAGS_DAEMONIZE , &pid);942 940 # else 941 rc = RTProcCreate (path, args, env, RTPROC_FLAGS_DAEMONIZE_DEPRECATED, &pid); 942 # endif 943 943 944 944 if (RT_FAILURE (rc)) -
trunk/src/VBox/Installer/solaris/VBoxZoneAccess.c
r17324 r27743 45 45 46 46 /* Daemonize... */ 47 RTProcDaemonize (false /* fNoChDir */,48 false /* fNoClose */,49 NULL /* pszPidfile */);47 RTProcDaemonizeUsingFork(false /* fNoChDir */, 48 false /* fNoClose */, 49 NULL /* pszPidfile */); 50 50 51 51 /* Open the device */ -
trunk/src/VBox/Main/webservice/vboxweb.cpp
r26562 r27743 654 654 if (g_fDaemonize) 655 655 { 656 rc = RTProcDaemonize(false /* fNoChDir */, false /* fNoClose */, 657 NULL); 656 rc = RTProcDaemonizeUsingFork(false /* fNoChDir */, false /* fNoClose */, NULL); 658 657 if (RT_FAILURE(rc)) 659 658 { -
trunk/src/VBox/Runtime/Makefile.kmk
r27618 r27743 443 443 generic/semrw-$(if-expr defined(VBOX_WITH_LOCKLESS_SEMRW),lockless-,)generic.cpp \ 444 444 generic/uuid-generic.cpp \ 445 generic/RTProcDaemonize-generic.cpp \ 445 446 generic/RTProcIsRunningByName-generic.cpp \ 446 447 generic/RTThreadGetNativeState-generic.cpp \ … … 486 487 generic/RTFileMove-generic.cpp \ 487 488 generic/RTLogWriteDebugger-generic.cpp \ 489 generic/RTProcDaemonize-generic.cpp \ 488 490 generic/RTTimeLocalNow-generic.cpp \ 489 491 generic/RTTimerCreate-generic.cpp \ … … 550 552 generic/RTFileMove-generic.cpp \ 551 553 generic/RTLogWriteDebugger-generic.cpp \ 554 generic/RTProcDaemonize-generic.cpp \ 552 555 generic/RTRandAdvCreateSystemFaster-generic.cpp \ 553 556 generic/RTRandAdvCreateSystemTruer-generic.cpp \ … … 604 607 generic/RTFileMove-generic.cpp \ 605 608 generic/RTLogWriteDebugger-generic.cpp \ 609 generic/RTProcDaemonize-generic.cpp \ 606 610 generic/RTTimeLocalNow-generic.cpp \ 607 611 generic/RTTimerCreate-generic.cpp \ … … 665 669 generic/RTMpGetSet-generic.cpp \ 666 670 generic/RTMpIsCpuOnline-generic.cpp \ 671 generic/RTProcDaemonize-generic.cpp \ 667 672 generic/RTProcIsRunningByName-generic.cpp \ 668 673 generic/RTThreadGetNativeState-generic.cpp \ … … 703 708 generic/RTFileMove-generic.cpp \ 704 709 generic/RTLogWriteDebugger-generic.cpp \ 710 generic/RTProcDaemonize-generic.cpp \ 711 generic/RTProcIsRunningByName-generic.cpp \ 705 712 generic/RTTimeLocalNow-generic.cpp \ 706 713 generic/RTTimerCreate-generic.cpp \ … … 709 716 generic/utf16locale-generic.cpp \ 710 717 generic/uuid-generic.cpp \ 711 generic/RTProcIsRunningByName-generic.cpp \712 718 generic/RTThreadGetNativeState-generic.cpp \ 713 719 r3/posix/RTFileQueryFsSizes-posix.cpp \ … … 763 769 generic/RTFileMove-generic.cpp \ 764 770 generic/RTLogWriteDebugger-generic.cpp \ 771 generic/RTProcDaemonize-generic.cpp \ 765 772 generic/RTSystemQueryOSInfo-generic.cpp \ 766 773 generic/RTSystemQueryDmiString-generic.cpp \ -
trunk/src/VBox/Runtime/r3/posix/process-posix.cpp
r27667 r27743 87 87 AssertPtrReturn(pszExec, VERR_INVALID_POINTER); 88 88 AssertReturn(*pszExec, VERR_INVALID_PARAMETER); 89 AssertReturn(!(fFlags & ~RTPROC_FLAGS_DAEMONIZE), VERR_INVALID_PARAMETER); 89 AssertReturn(!(fFlags & ~(RTPROC_FLAGS_DAEMONIZE_DEPRECATED | RTPROC_FLAGS_DETACHED)), VERR_INVALID_PARAMETER); 90 AssertReturn(!(fFlags & RTPROC_FLAGS_DETACHED) || !phProcess, VERR_INVALID_PARAMETER); 90 91 AssertReturn(hEnv != NIL_RTENV, VERR_INVALID_PARAMETER); 91 92 const char * const *papszEnv = RTEnvGetExecEnvP(hEnv); … … 175 176 pid_t pid = -1; 176 177 #ifdef HAVE_POSIX_SPAWN 177 if ( !(fFlags & RTPROC_FLAGS_DAEMONIZE)178 if ( !(fFlags & (RTPROC_FLAGS_DAEMONIZE_DEPRECATED | RTPROC_FLAGS_DETACHED)) 178 179 && uid == ~(uid_t)0 179 180 && gid == ~(gid_t)0 … … 303 304 * Daemonize the process if requested. 304 305 */ 305 if (fFlags & RTPROC_FLAGS_DAEMONIZE) 306 { 307 rc = RTProcDaemonize(true /* fNoChDir */, false /* fNoClose */, NULL /* pszPidFile */); 306 if (fFlags & (RTPROC_FLAGS_DAEMONIZE_DEPRECATED | RTPROC_FLAGS_DETACHED)) 307 { 308 rc = RTProcDaemonizeUsingFork(true /*fNoChDir*/, 309 !(fFlags & RTPROC_FLAGS_DAEMONIZE_DEPRECATED) /*fNoClose*/, 310 NULL /* pszPidFile */); 308 311 if (RT_FAILURE(rc)) 309 312 { 313 /* parent */ 310 314 AssertReleaseMsgFailed(("RTProcDaemonize returns %Rrc errno=%d\n", rc, errno)); 311 315 exit(127); 312 316 } 317 /* daemonized child */ 313 318 } 314 319 … … 424 429 425 430 426 /** 427 * Daemonize the current process, making it a background process. The current 428 * process will exit if daemonizing is successful. 429 * 430 * @returns iprt status code. 431 * @param fNoChDir Pass false to change working directory to "/". 432 * @param fNoClose Pass false to redirect standard file streams to the null device. 433 * @param pszPidfile Path to a file to write the process id of the daemon 434 * process to. Daemonizing will fail if this file already 435 * exists or cannot be written. May be NULL. 436 */ 437 RTR3DECL(int) RTProcDaemonize(bool fNoChDir, bool fNoClose, const char *pszPidfile) 431 RTR3DECL(int) RTProcDaemonizeUsingFork(bool fNoChDir, bool fNoClose, const char *pszPidfile) 438 432 { 439 433 /* -
trunk/src/VBox/Runtime/r3/win/process-win.cpp
r27667 r27743 240 240 241 241 static int rtProcCreateAsUserHlp(PRTUTF16 pwszUser, PRTUTF16 pwszPassword, PRTUTF16 pwszExec, PRTUTF16 pwszCmdLine, 242 PRTUTF16 pwszzBlock, STARTUPINFOW *pStartupInfo, PROCESS_INFORMATION *pProcInfo) 242 PRTUTF16 pwszzBlock, DWORD dwCreationFlags, 243 STARTUPINFOW *pStartupInfo, PROCESS_INFORMATION *pProcInfo) 243 244 { 244 245 /** @todo On NT4 we need to enable the SeTcbPrivilege to act as part of the operating system. Otherwise … … 271 272 NULL, /* pThreadAttributes */ 272 273 TRUE, /* fInheritHandles */ 273 CREATE_UNICODE_ENVIRONMENT, /* dwCreationFlags */274 dwCreationFlags, 274 275 pwszzBlock, 275 276 NULL, /* pCurrentDirectory */ … … 307 308 pwszExec, 308 309 pwszCmdLine, 309 CREATE_UNICODE_ENVIRONMENT, /* dwCreationFlags */310 dwCreationFlags, 310 311 pwszzBlock, 311 312 NULL, /* pCurrentDirectory */ … … 338 339 AssertPtrReturn(pszExec, VERR_INVALID_POINTER); 339 340 AssertReturn(*pszExec, VERR_INVALID_PARAMETER); 340 AssertReturn(!(fFlags & ~RTPROC_FLAGS_DAEMONIZE), VERR_INVALID_PARAMETER); 341 AssertReturn(!(fFlags & ~(RTPROC_FLAGS_DAEMONIZE_DEPRECATED | RTPROC_FLAGS_DETACHED)), VERR_INVALID_PARAMETER); 342 AssertReturn(!(fFlags & RTPROC_FLAGS_DETACHED) || !phProcess, VERR_INVALID_PARAMETER); 341 343 AssertReturn(hEnv != NIL_RTENV, VERR_INVALID_PARAMETER); 342 344 AssertPtrReturn(papszArgs, VERR_INVALID_PARAMETER); … … 451 453 * Get going... 452 454 */ 455 DWORD dwCreationFlags = CREATE_UNICODE_ENVIRONMENT; 456 if (fFlags & RTPROC_FLAGS_DETACHED) 457 dwCreationFlags |= DETACHED_PROCESS; 458 453 459 PROCESS_INFORMATION ProcInfo; 454 460 RT_ZERO(ProcInfo); … … 460 466 NULL, /* pThreadAttributes */ 461 467 TRUE, /* fInheritHandles */ 462 CREATE_UNICODE_ENVIRONMENT, /* dwCreationFlags */468 dwCreationFlags, 463 469 pwszzBlock, 464 470 NULL, /* pCurrentDirectory */ … … 484 490 { 485 491 rc = rtProcCreateAsUserHlp(pwszUser, pwszPassword, 486 pwszExec, pwszCmdLine, pwszzBlock, 492 pwszExec, pwszCmdLine, pwszzBlock, dwCreationFlags 487 493 &StartupInfo, &ProcInfo); 488 494
Note:
See TracChangeset
for help on using the changeset viewer.