Changeset 6826 in vbox
- Timestamp:
- Feb 6, 2008 12:03:22 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/linux/server.cpp
r6361 r6826 758 758 const struct option options[] = 759 759 { 760 { "automate", no_argument, NULL, 'a' }, 761 { "daemonize", no_argument, NULL, 'd' }, 762 { "pidfile", required_argument, NULL, 'p' }, 760 { "automate", no_argument, NULL, 'a' }, 763 761 #ifdef RT_OS_DARWIN 764 { "pipe", required_argument, NULL, 'P' }, 765 #endif 766 { NULL, 0, NULL, 0 } 762 { "auto-shutdown", no_argument, NULL, 'A' }, 763 #endif 764 { "daemonize", no_argument, NULL, 'd' }, 765 { "pidfile", required_argument, NULL, 'p' }, 766 #ifdef RT_OS_DARWIN 767 { "pipe", required_argument, NULL, 'P' }, 768 #endif 769 { NULL, 0, NULL, 0 } 767 770 }; 768 771 int c; … … 790 793 } 791 794 795 #ifdef RT_OS_DARWIN 796 /* Used together with '-P', see below. Internal use only. */ 797 case 'A': 798 { 799 gAutoShutdown = true; 800 break; 801 } 802 #endif 803 792 804 case 'd': 793 805 { … … 912 924 * On leopard we're no longer allowed to use some of the core API's 913 925 * after forking - this will cause us to hit an int3. 914 * So, we'll have to execv VBoxSVC once again and hand it the pipe. 926 * So, we'll have to execv VBoxSVC once again and hand it the pipe 927 * and all other relevant options. 915 928 */ 916 const char *apszArgs[6]; 917 apszArgs[0] = argv[0]; 918 apszArgs[1] = "--pipe"; 929 const char *apszArgs[7]; 930 int i = 0; 931 apszArgs[i++] = argv[0]; 932 apszArgs[i++] = "--pipe"; 919 933 char szPipeArg[32]; 920 RTStrPrintf (szPipeArg, sizeof(szPipeArg), "%d", daemon_pipe_fds[1]);921 apszArgs[ 2] = szPipeArg;934 RTStrPrintf (szPipeArg, sizeof (szPipeArg), "%d", daemon_pipe_fds[1]); 935 apszArgs[i++] = szPipeArg; 922 936 if (pszPidFile) 923 937 { 924 apszArgs[ 3] = "--pidfile";925 apszArgs[ 4] = pszPidFile;926 apszArgs[5] = NULL;927 }928 else929 apszArgs[3] = NULL;930 execv (apszArgs[0], (char * const *)apszArgs);931 exit (0);938 apszArgs[i++] = "--pidfile"; 939 apszArgs[i++] = pszPidFile; 940 } 941 if (gAutoShutdown) 942 apszArgs[i++] = "--auto-shutdown"; 943 apszArgs[i++] = NULL; Assert(i <= RT_ELEMENTS(apszArgs)); 944 execv (apszArgs[0], (char * const *)apszArgs); 945 exit (0); 932 946 # endif 933 947 }
Note:
See TracChangeset
for help on using the changeset viewer.