Changeset 24830 in vbox for trunk/src/VBox/Main/xpcom
- Timestamp:
- Nov 20, 2009 3:05:10 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/xpcom/server.cpp
r24828 r24830 42 42 #include <iprt/critsect.h> 43 43 #include <iprt/getopt.h> 44 #include <iprt/message.h> 45 #include <iprt/stream.h> 44 46 #include <iprt/path.h> 45 47 #include <iprt/timer.h> 46 48 47 #include <stdio.h>48 49 #include <signal.h> // for the signal handler 49 50 #include <stdlib.h> … … 285 286 286 287 LogFlowFunc(("VirtualBox object deleted.\n")); 287 printf("Informational: VirtualBox object deleted.\n");288 RTPrintf("Informational: VirtualBox object deleted.\n"); 288 289 } 289 290 … … 505 506 sInstance->AddRef(); /* protect FinalConstruct() */ 506 507 rv = sInstance->FinalConstruct(); 507 printf("Informational: VirtualBox object created (rc=%08X).\n", rv);508 RTPrintf("Informational: VirtualBox object created (rc=%Rhrc).\n", rv); 508 509 if (NS_FAILED(rv)) 509 510 { … … 816 817 if (pipe(daemon_pipe_fds) < 0) 817 818 { 818 printf("ERROR: pipe() failed (errno = %d)\n", errno);819 RTMsgError("pipe() failed (errno = %d)", errno); 819 820 return 1; 820 821 } … … 825 826 if (childpid == -1) 826 827 { 827 printf("ERROR: fork() failed (errno = %d)\n", errno);828 RTMsgError("fork() failed (errno = %d)", errno); 828 829 return 1; 829 830 } … … 845 846 fSuccess = true; 846 847 else 847 printf("ERROR: Unknown message from child process (%s)\n", msg);848 RTMsgError("Unknown message from child process (%s)", msg); 848 849 } 849 850 else 850 printf("ERROR: 0 bytes read from child process\n");851 RTMsgError("0 bytes read from child process"); 851 852 852 853 /* close the reading end of the pipe as well and exit */ … … 860 861 if (sid < 0) 861 862 { 862 printf("ERROR: setsid() failed (errno = %d)\n", errno);863 RTMsgError("setsid() failed (errno = %d)", errno); 863 864 return 1; 864 865 } … … 870 871 if (childpid == -1) 871 872 { 872 printf("ERROR: second fork() failed (errno = %d)\n", errno);873 RTMsgError("second fork() failed (errno = %d)", errno); 873 874 return 1; 874 875 } … … 945 946 if (NS_FAILED(rc)) 946 947 { 947 printf("ERROR: Failed to initialize XPCOM! (rc=%08X)\n", rc);948 RTMsgError("Failed to initialize XPCOM! (rc=%Rhrc)\n", rc); 948 949 break; 949 950 } … … 953 954 if (NS_FAILED(rc)) 954 955 { 955 printf("ERROR: Failed to get component registrar! (rc=%08X)\n", rc);956 RTMsgError("Failed to get component registrar! (rc=%Rhrc)", rc); 956 957 break; 957 958 } … … 962 963 if (NS_FAILED(rc)) 963 964 { 964 printf("ERROR: Failed to register server components! (rc=%08X)\n", rc);965 RTMsgError("Failed to register server components! (rc=%Rhrc)", rc); 965 966 break; 966 967 } … … 972 973 if (NS_FAILED(rc)) 973 974 { 974 printf("ERROR: Failed to get the main event queue! (rc=%08X)\n", rc);975 RTMsgError("Failed to get the main event queue! (rc=%Rhrc)", rc); 975 976 break; 976 977 } … … 979 980 if (NS_FAILED (rc)) 980 981 { 981 printf("ERROR: Failed to get IPC service! (rc=%08X)\n", rc);982 RTMsgError("Failed to get IPC service! (rc=%Rhrc)", rc); 982 983 break; 983 984 } … … 993 994 "Is another server already running?\n", rc, rc)); 994 995 995 printf("ERROR: Failed to register the server name \"%s\" (rc=%08X)!\n"996 "Is another server already running?\n",997 VBOXSVC_IPC_NAME, rc);996 RTMsgError("Failed to register the server name \"%s\" (rc=%Rhrc)!\n" 997 "Is another server already running?\n", 998 VBOXSVC_IPC_NAME, rc); 998 999 NS_RELEASE(gIpcServ); 999 1000 break; … … 1021 1022 for (int i = iSize; i > 0; i--) 1022 1023 putchar('*'); 1023 printf("\n%s\n", szBuf);1024 printf("(C) 2008-2009 Sun Microsystems, Inc.\n"1025 "All rights reserved.\n");1024 RTPrintf("\n%s\n", szBuf); 1025 RTPrintf("(C) 2008-2009 Sun Microsystems, Inc.\n" 1026 "All rights reserved.\n"); 1026 1027 #ifdef DEBUG 1027 printf("Debug version.\n");1028 RTPrintf("Debug version.\n"); 1028 1029 #endif 1029 1030 } … … 1031 1032 if (daemon_pipe_wr >= 0) 1032 1033 { 1033 printf("\nStarting event loop....\n[send TERM signal to quit]\n");1034 RTPrintf("\nStarting event loop....\n[send TERM signal to quit]\n"); 1034 1035 /* now we're ready, signal the parent process */ 1035 1036 write(daemon_pipe_wr, "READY", strlen("READY")); 1036 1037 } 1037 1038 else 1038 printf("\nStarting event loop....\n[press Ctrl-C to quit]\n");1039 RTPrintf("\nStarting event loop....\n[press Ctrl-C to quit]\n"); 1039 1040 1040 1041 if (g_pszPidFile) 1041 1042 { 1042 RTFILE pidFile = NIL_RTFILE;1043 vrc = RTFileOpen(& pidFile, g_pszPidFile, RTFILE_O_WRITE | RTFILE_O_CREATE_REPLACE | RTFILE_O_DENY_NONE);1043 RTFILE hPidFile = NIL_RTFILE; 1044 vrc = RTFileOpen(&hPidFile, g_pszPidFile, RTFILE_O_WRITE | RTFILE_O_CREATE_REPLACE | RTFILE_O_DENY_NONE); 1044 1045 if (RT_SUCCESS(vrc)) 1045 1046 { … … 1047 1048 const char *lf = "\n"; 1048 1049 RTStrFormatNumber(szBuf, getpid(), 10, 0, 0, 0); 1049 RTFileWrite( pidFile, szBuf, strlen(szBuf), NULL);1050 RTFileWrite( pidFile, lf, strlen(lf), NULL);1051 RTFileClose( pidFile);1050 RTFileWrite(hPidFile, szBuf, strlen(szBuf), NULL); 1051 RTFileWrite(hPidFile, lf, strlen(lf), NULL); 1052 RTFileClose(hPidFile); 1052 1053 } 1053 1054 } … … 1062 1063 lim.rlim_cur = RT_MIN(lim.rlim_max, 10240); 1063 1064 if (setrlimit(RLIMIT_NOFILE, &lim) == -1) 1064 printf("WARNING: failed to increase file descriptor limit. (%d)\n", errno);1065 RTPrintf("WARNING: failed to increase file descriptor limit. (%d)\n", errno); 1065 1066 } 1066 1067 } 1067 1068 else 1068 printf("WARNING: failed to obtain per-process file-descriptor limit (%d).\n", errno);1069 RTPrintf("WARNING: failed to obtain per-process file-descriptor limit (%d).\n", errno); 1069 1070 1070 1071 PLEvent *ev; … … 1091 1092 gEventQ->ProcessPendingEvents(); 1092 1093 1093 printf("Terminated event loop.\n");1094 RTPrintf("Terminated event loop.\n"); 1094 1095 } 1095 1096 while (0); // this scopes the nsCOMPtrs … … 1104 1105 LogFlowFunc(("Finished com::Shutdown() (rc=%Rhrc)\n", rc)); 1105 1106 1106 if (NS_FAILED 1107 printf("ERROR: Failed to shutdown XPCOM! (rc=%08X)\n", rc);1108 1109 printf("XPCOM server has shutdown.\n");1107 if (NS_FAILED(rc)) 1108 RTMsgError("Failed to shutdown XPCOM! (rc=%Rhrc)", rc); 1109 1110 RTPrintf("XPCOM server has shutdown.\n"); 1110 1111 1111 1112 if (g_pszPidFile)
Note:
See TracChangeset
for help on using the changeset viewer.