+void output_status(STATUS_PKT *sp)
+{
+ list_status_header(sp);
+ list_running_jobs(sp);
+ list_terminated_jobs(sp);
+}
+
+static void list_status_header(STATUS_PKT *sp)
+{
+ POOL_MEM msg(PM_MESSAGE);
+ char b1[32], b2[32], b3[32], b4[32], b5[35];
+ int len;
+ char dt[MAX_TIME_LENGTH];
+
+ len = Mmsg(msg, _("%s Version: %s (%s) %s %s %s %s\n"),
+ my_name, VERSION, BDATE, VSS, HOST_OS, DISTNAME, DISTVER);
+ sendit(msg.c_str(), len, sp);
+ bstrftime_nc(dt, sizeof(dt), daemon_start_time);
+ len = Mmsg(msg, _("Daemon started %s, %d Job%s run since started.\n"),
+ dt, num_jobs_run, num_jobs_run == 1 ? "" : "s");
+ sendit(msg.c_str(), len, sp);
+#if defined(HAVE_WIN32)
+ if (debug_level > 0) {
+ if (!privs) {
+ privs = enable_backup_privileges(NULL, 1);
+ }
+ len = Mmsg(msg, "VSS %s, Priv 0x%x\n", g_pVSSClient?"enabled":"disabled", privs);
+ sendit(msg.c_str(), len, sp);
+ len = Mmsg(msg, "APIs=%sOPT,%sATP,%sLPV,%sCFA,%sCFW,\n",
+ p_OpenProcessToken?"":"!",
+ p_AdjustTokenPrivileges?"":"!",
+ p_LookupPrivilegeValue?"":"!",
+ p_CreateFileA?"":"!",
+ p_CreateFileW?"":"!");
+ sendit(msg.c_str(), len, sp);
+ len = Mmsg(msg, " %sWUL,%sWMKD,%sGFAA,%sGFAW,%sGFAEA,%sGFAEW,%sSFAA,%sSFAW,%sBR,%sBW,%sSPSP,\n",
+ p_wunlink?"":"!",
+ p_wmkdir?"":"!",
+ p_GetFileAttributesA?"":"!",
+ p_GetFileAttributesW?"":"!",
+ p_GetFileAttributesExA?"":"!",
+ p_GetFileAttributesExW?"":"!",
+ p_SetFileAttributesA?"":"!",
+ p_SetFileAttributesW?"":"!",
+ p_BackupRead?"":"!",
+ p_BackupWrite?"":"!",
+ p_SetProcessShutdownParameters?"":"!");
+ sendit(msg.c_str(), len, sp);
+ len = Mmsg(msg, " %sWC2MB,%sMB2WC,%sFFFA,%sFFFW,%sFNFA,%sFNFW,%sSCDA,%sSCDW,\n",
+ p_WideCharToMultiByte?"":"!",
+ p_MultiByteToWideChar?"":"!",
+ p_FindFirstFileA?"":"!",
+ p_FindFirstFileW?"":"!",
+ p_FindNextFileA?"":"!",
+ p_FindNextFileW?"":"!",
+ p_SetCurrentDirectoryA?"":"!",
+ p_SetCurrentDirectoryW?"":"!");
+ sendit(msg.c_str(), len, sp);
+ len = Mmsg(msg, " %sGCDA,%sGCDW,%sGVPNW,%sGVNFVMPW\n",
+ p_GetCurrentDirectoryA?"":"!",
+ p_GetCurrentDirectoryW?"":"!",
+ p_GetVolumePathNameW?"":"!",
+ p_GetVolumeNameForVolumeMountPointW?"":"!");
+ sendit(msg.c_str(), len, sp);
+ }
+#endif
+ len = Mmsg(msg, _(" Heap: heap=%s smbytes=%s max_bytes=%s bufs=%s max_bufs=%s\n"),
+ edit_uint64_with_commas((char *)sbrk(0)-(char *)start_heap, b1),
+ edit_uint64_with_commas(sm_bytes, b2),
+ edit_uint64_with_commas(sm_max_bytes, b3),
+ edit_uint64_with_commas(sm_buffers, b4),
+ edit_uint64_with_commas(sm_max_buffers, b5));
+ sendit(msg.c_str(), len, sp);
+ len = Mmsg(msg, _(" Sizeof: boffset_t=%d size_t=%d debug=%d trace=%d\n"),
+ sizeof(boffset_t), sizeof(size_t), debug_level, get_trace());
+ sendit(msg.c_str(), len, sp);
+ if (debug_level > 0 && plugin_list->size() > 0) {
+ Plugin *plugin;
+ int len;
+ pm_strcpy(msg, "Plugin: ");
+ foreach_alist(plugin, plugin_list) {
+ len = pm_strcat(msg, plugin->file);
+ if (len > 80) {
+ pm_strcat(msg, "\n ");
+ } else {
+ pm_strcat(msg, " ");
+ }
+ }
+ len = pm_strcat(msg, "\n");
+ sendit(msg.c_str(), len, sp);
+ }
+}
+
+static void list_running_jobs(STATUS_PKT *sp)