Changeset 83660 in vbox for trunk/src/VBox/Runtime
- Timestamp:
- Apr 9, 2020 6:06:53 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/VBox/log-vbox.cpp
r82968 r83660 497 497 */ 498 498 #ifdef IN_RING3 499 # ifndef IN_GUEST 500 char szExecName[RTPATH_MAX]; 501 if (!RTProcGetExecutablePath(szExecName, sizeof(szExecName))) 502 strcpy(szExecName, "VBox"); 499 const char *pszExeName = RTProcShortName(); 500 if (!pszExeName) 501 pszExeName = "VBox"; 503 502 RTTIMESPEC TimeSpec; 504 503 RTTIME Time; 505 504 RTTimeExplode(&Time, RTTimeNow(&TimeSpec)); 506 rc = RTLogCreate(&pLogger, 0, NULL, "VBOX_LOG", RT_ELEMENTS(g_apszGroups), &g_apszGroups[0], RTLOGDEST_FILE, 505 rc = RTLogCreate(&pLogger, 0, NULL, "VBOX_LOG", RT_ELEMENTS(g_apszGroups), &g_apszGroups[0], 506 # ifdef IN_GUEST 507 RTLOGDEST_USER /* backdoor */, 508 "./VBoxGAs-%04d-%02d-%02d-%02d-%02d-%02d.%03d-%s-%d.log", 509 # else 510 RTLOGDEST_FILE, 507 511 "./%04d-%02d-%02d-%02d-%02d-%02d.%03d-%s-%d.log", 508 Time.i32Year, Time.u8Month, Time.u8MonthDay, Time.u8Hour, Time.u8Minute, Time.u8Second, Time.u32Nanosecond / 10000000, 509 RTPathFilename(szExecName), RTProcSelf()); 512 # endif 513 Time.i32Year, Time.u8Month, Time.u8MonthDay, Time.u8Hour, Time.u8Minute, Time.u8Second, 514 Time.u32Nanosecond / 10000000, pszExeName, RTProcSelf()); 510 515 if (RT_SUCCESS(rc)) 511 516 { 517 # ifndef IN_GUEST 512 518 /* 513 519 * Write a log header. … … 516 522 RTTimeSpecToString(&TimeSpec, szBuf, sizeof(szBuf)); 517 523 RTLogLoggerEx(pLogger, 0, ~0U, "Log created: %s\n", szBuf); 518 RTLogLoggerEx(pLogger, 0, ~0U, "Executable: %s\n", szExecName);524 RTLogLoggerEx(pLogger, 0, ~0U, "Executable: %s\n", RTProcGetExecutablePath(szBuf, sizeof(szBuf))); 519 525 520 526 /* executable and arguments - tricky and all platform specific. */ … … 526 532 char szArgFileBuf[80]; 527 533 RTStrPrintf(szArgFileBuf, sizeof(szArgFileBuf), "/proc/%ld/psinfo", (long)getpid()); 528 FILE *pFile = fopen(szArgFileBuf, "rb");534 FILE *pFile = fopen(szArgFileBuf, "rb"); 529 535 if (pFile) 530 536 { … … 582 588 /* Retrieve the required length first */ 583 589 int aiName[4]; 584 # if defined(RT_OS_FREEBSD)590 # if defined(RT_OS_FREEBSD) 585 591 aiName[0] = CTL_KERN; 586 592 aiName[1] = KERN_PROC; 587 593 aiName[2] = KERN_PROC_ARGS; /* Introduced in FreeBSD 4.0 */ 588 594 aiName[3] = getpid(); 589 # elif defined(RT_OS_NETBSD)595 # elif defined(RT_OS_NETBSD) 590 596 aiName[0] = CTL_KERN; 591 597 aiName[1] = KERN_PROC_ARGS; 592 598 aiName[2] = getpid(); 593 599 aiName[3] = KERN_PROC_ARGV; 594 # endif600 # endif 595 601 size_t cchArgs = 0; 596 602 int rcBSD = sysctl(aiName, RT_ELEMENTS(aiName), NULL, &cchArgs, NULL, 0); … … 625 631 # error needs porting. 626 632 # endif 633 # endif /* IN_GUEST */ 627 634 } 628 629 # else /* IN_GUEST */630 /* The user destination is backdoor logging. */631 rc = RTLogCreate(&pLogger, 0, NULL, "VBOX_LOG", RT_ELEMENTS(g_apszGroups), &g_apszGroups[0], RTLOGDEST_USER, "VBox.log");632 # endif /* IN_GUEST */633 635 634 636 #else /* IN_RING0 */
Note:
See TracChangeset
for help on using the changeset viewer.