* Fix debug build of the registrar.
* Make the macros use varargs so we avoid multiple invokations of the print function (to properly use with debug_printf for example). * Minor cleanup to the macros. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42848 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -35,28 +35,42 @@
|
||||
|
||||
#define DEBUG_APP "REG"
|
||||
#if DEBUG
|
||||
#define PRINT(x) { __out(DEBUG_APP ": "); __out x; }
|
||||
#define REPORT_ERROR(status) __out(DEBUG_APP ": %s:%d: %s\n",__FUNCTION__,__LINE__,strerror(status));
|
||||
#define RETURN_ERROR(err) { status_t _status = err; if (_status < B_OK) REPORT_ERROR(_status); return _status;}
|
||||
#define SET_ERROR(var, err) { status_t _status = err; if (_status < B_OK) REPORT_ERROR(_status); var = _status; }
|
||||
#define FATAL(x) { __out(DEBUG_APP ": "); __out x; }
|
||||
#define ERROR(x) { __out(DEBUG_APP ": "); __out x; }
|
||||
#define WARNING(x) { __out(DEBUG_APP ": "); __out x; }
|
||||
#define INFORM(x) { __out(DEBUG_APP ": "); __out x; }
|
||||
#define PRINT(x...) { __out(DEBUG_APP ": " x); }
|
||||
#define REPORT_ERROR(status) \
|
||||
__out(DEBUG_APP ": %s:%d: %s\n", __FUNCTION__, __LINE__, \
|
||||
strerror(status));
|
||||
#define RETURN_ERROR(err) \
|
||||
{ \
|
||||
status_t _status = err; \
|
||||
if (_status < B_OK) \
|
||||
REPORT_ERROR(_status); \
|
||||
return _status; \
|
||||
}
|
||||
#define SET_ERROR(var, err) \
|
||||
{ \
|
||||
status_t _status = err; \
|
||||
if (_status < B_OK) \
|
||||
REPORT_ERROR(_status); \
|
||||
var = _status; \
|
||||
}
|
||||
#define FATAL(x...) { __out(DEBUG_APP ": " x); }
|
||||
#define ERROR(x...) { __out(DEBUG_APP ": " x); }
|
||||
#define WARNING(x...) { __out(DEBUG_APP ": " x); }
|
||||
#define INFORM(x...) { __out(DEBUG_APP ": " x); }
|
||||
#define FUNCTION(x) { __out(DEBUG_APP ": %s() ",__FUNCTION__); __out x; }
|
||||
#define FUNCTION_START() { __out(DEBUG_APP ": %s()\n",__FUNCTION__); }
|
||||
#define FUNCTION_END() { __out(DEBUG_APP ": %s() done\n",__FUNCTION__); }
|
||||
#define D(x) {x;};
|
||||
#else
|
||||
#define PRINT(x) ;
|
||||
#define PRINT(x...) ;
|
||||
#define REPORT_ERROR(status) ;
|
||||
#define RETURN_ERROR(status) return status;
|
||||
#define SET_ERROR(var, err) var = err;
|
||||
#define FATAL(x) { __out(DEBUG_APP ": "); __out x; }
|
||||
#define ERROR(x) { __out(DEBUG_APP ": "); __out x; }
|
||||
#define WARNING(x) { __out(DEBUG_APP ": "); __out x; }
|
||||
#define INFORM(x) { __out(DEBUG_APP ": "); __out x; }
|
||||
#define FUNCTION(x) ;
|
||||
#define FATAL(x...) { __out(DEBUG_APP ": " x); }
|
||||
#define ERROR(x...) { __out(DEBUG_APP ": " x); }
|
||||
#define WARNING(x...) { __out(DEBUG_APP ": " x); }
|
||||
#define INFORM(x...) { __out(DEBUG_APP ": " x); }
|
||||
#define FUNCTION(x...) ;
|
||||
#define FUNCTION_START() ;
|
||||
#define FUNCTION_END() ;
|
||||
#define D(x) ;
|
||||
|
||||
@@ -356,8 +356,8 @@ public:
|
||||
|
||||
status_t PushMessage(Message *message, int32 token)
|
||||
{
|
||||
PRINT(("MessageDeliverer::TargetPort::PushMessage(port: %ld, %p, %ld)\n",
|
||||
fPortID, message, token));
|
||||
PRINT("MessageDeliverer::TargetPort::PushMessage(port: %ld, %p, %ld)\n",
|
||||
fPortID, message, token);
|
||||
// create a target message
|
||||
TargetMessage *targetMessage
|
||||
= new(nothrow) TargetMessage(message, token);
|
||||
@@ -390,8 +390,8 @@ fPortID, message, token));
|
||||
void PopMessage()
|
||||
{
|
||||
if (fMessages.Head()) {
|
||||
PRINT(("MessageDeliverer::TargetPort::PopMessage(): port: %ld, %p\n",
|
||||
fPortID, fMessages.Head()->GetMessage()));
|
||||
PRINT("MessageDeliverer::TargetPort::PopMessage(): port: %ld, %p\n",
|
||||
fPortID, fMessages.Head()->GetMessage());
|
||||
_RemoveMessage(fMessages.Head());
|
||||
}
|
||||
}
|
||||
@@ -405,8 +405,8 @@ fPortID, fMessages.Head()->GetMessage()));
|
||||
if (message->GetMessage()->TimeoutTime() > now)
|
||||
break;
|
||||
|
||||
PRINT(("MessageDeliverer::TargetPort::DropTimedOutMessages(): port: %ld: "
|
||||
"message %p timed out\n", fPortID, message->GetMessage()));
|
||||
PRINT("MessageDeliverer::TargetPort::DropTimedOutMessages(): port: %ld: "
|
||||
"message %p timed out\n", fPortID, message->GetMessage());
|
||||
_RemoveMessage(message);
|
||||
}
|
||||
}
|
||||
@@ -433,15 +433,15 @@ private:
|
||||
{
|
||||
// message count
|
||||
while (fMessageCount > kMaxMessagesPerPort) {
|
||||
PRINT(("MessageDeliverer::TargetPort::_EnforceLimits(): port: %ld: hit maximum "
|
||||
"message count limit.\n", fPortID));
|
||||
PRINT("MessageDeliverer::TargetPort::_EnforceLimits(): port: %ld: hit maximum "
|
||||
"message count limit.\n", fPortID);
|
||||
PopMessage();
|
||||
}
|
||||
|
||||
// message size
|
||||
while (fMessageSize > kMaxDataPerPort) {
|
||||
PRINT(("MessageDeliverer::TargetPort::_EnforceLimits(): port: %ld: hit maximum "
|
||||
"message size limit.\n", fPortID));
|
||||
PRINT("MessageDeliverer::TargetPort::_EnforceLimits(): port: %ld: hit maximum "
|
||||
"message size limit.\n", fPortID);
|
||||
PopMessage();
|
||||
}
|
||||
}
|
||||
@@ -735,8 +735,8 @@ MessageDeliverer::_SendMessage(Message *message, port_id portID, int32 token)
|
||||
{
|
||||
status_t error = BMessage::Private::SendFlattenedMessage(message->Data(),
|
||||
message->DataSize(), portID, token, 0);
|
||||
//PRINT(("MessageDeliverer::_SendMessage(%p, port: %ld, token: %ld): %lx\n",
|
||||
//message, portID, token, error));
|
||||
//PRINT("MessageDeliverer::_SendMessage(%p, port: %ld, token: %ld): %lx\n",
|
||||
//message, portID, token, error);
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -773,8 +773,8 @@ MessageDeliverer::_DelivererThread()
|
||||
error = _SendMessage(message, port->PortID(), token);
|
||||
// } else {
|
||||
// // timeout, drop message
|
||||
// PRINT(("MessageDeliverer::_DelivererThread(): port %ld, "
|
||||
// "message %p timed out\n", port->PortID(), message));
|
||||
// PRINT("MessageDeliverer::_DelivererThread(): port %ld, "
|
||||
// "message %p timed out\n", port->PortID(), message);
|
||||
// }
|
||||
|
||||
if (error == B_OK) {
|
||||
|
||||
@@ -751,8 +751,8 @@ MessageRunnerManager::_ScheduleEvent(RunnerInfo *info)
|
||||
info->event->SetTime(info->time);
|
||||
scheduled = fEventQueue->AddEvent(info->event);
|
||||
|
||||
PRINT(("runner %ld (%lld, %ld) rescheduled: %d, time: %lld, now: %lld\n",
|
||||
info->token, info->interval, info->count, scheduled, info->time, system_time()));
|
||||
PRINT("runner %ld (%lld, %ld) rescheduled: %d, time: %lld, now: %lld\n",
|
||||
info->token, info->interval, info->count, scheduled, info->time, system_time());
|
||||
}
|
||||
return scheduled;
|
||||
}
|
||||
|
||||
@@ -408,13 +408,13 @@ MessagingService::_CommandProcessor()
|
||||
const messaging_command *command = area->PopCommand();
|
||||
if (!command) {
|
||||
// something's seriously wrong
|
||||
ERROR(("MessagingService::_CommandProcessor(): area %p (%ld) "
|
||||
ERROR("MessagingService::_CommandProcessor(): area %p (%ld) "
|
||||
"has command count %ld, but doesn't return any more "
|
||||
"commands.", area, area->ID(), area->CountCommands()));
|
||||
"commands.", area, area->ID(), area->CountCommands());
|
||||
break;
|
||||
}
|
||||
PRINT(("MessagingService::_CommandProcessor(): got command %lu\n",
|
||||
command->command));
|
||||
PRINT("MessagingService::_CommandProcessor(): got command %lu\n",
|
||||
command->command);
|
||||
|
||||
// dispatch the command
|
||||
MessagingCommandHandler *handler
|
||||
@@ -423,8 +423,8 @@ command->command));
|
||||
handler->HandleMessagingCommand(command->command, command->data,
|
||||
command->size - sizeof(messaging_command));
|
||||
} else {
|
||||
WARNING(("MessagingService::_CommandProcessor(): No handler "
|
||||
"found for command %lu\n", command->command));
|
||||
WARNING("MessagingService::_CommandProcessor(): No handler "
|
||||
"found for command %lu\n", command->command);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -439,9 +439,9 @@ command->command));
|
||||
commandWaiting = true;
|
||||
} else {
|
||||
// Bad, but what can we do?
|
||||
ERROR(("MessagingService::_CommandProcessor(): Failed to clone "
|
||||
ERROR("MessagingService::_CommandProcessor(): Failed to clone "
|
||||
"kernel area %ld: %s\n", area->NextKernelAreaID(),
|
||||
strerror(error)));
|
||||
strerror(error));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -130,8 +130,8 @@ Registrar::ReadyToRun()
|
||||
// create message deliverer
|
||||
status_t error = MessageDeliverer::CreateDefault();
|
||||
if (error != B_OK) {
|
||||
FATAL(("Registrar::ReadyToRun(): Failed to create the message "
|
||||
"deliverer: %s\n", strerror(error)));
|
||||
FATAL("Registrar::ReadyToRun(): Failed to create the message "
|
||||
"deliverer: %s\n", strerror(error));
|
||||
}
|
||||
|
||||
// create event queue
|
||||
@@ -162,8 +162,8 @@ Registrar::ReadyToRun()
|
||||
// create the messaging service
|
||||
error = MessagingService::CreateDefault();
|
||||
if (error != B_OK) {
|
||||
ERROR(("Registrar::ReadyToRun(): Failed to init messaging service "
|
||||
"(that's by design when running under R5): %s\n", strerror(error)));
|
||||
ERROR("Registrar::ReadyToRun(): Failed to init messaging service "
|
||||
"(that's by design when running under R5): %s\n", strerror(error));
|
||||
}
|
||||
|
||||
// create and schedule the sanity message event
|
||||
@@ -215,7 +215,7 @@ Registrar::_MessageReceived(BMessage *message)
|
||||
// general requests
|
||||
case B_REG_GET_MIME_MESSENGER:
|
||||
{
|
||||
PRINT(("B_REG_GET_MIME_MESSENGER\n"));
|
||||
PRINT("B_REG_GET_MIME_MESSENGER\n");
|
||||
BMessenger messenger(NULL, fMIMEManager);
|
||||
BMessage reply(B_REG_SUCCESS);
|
||||
reply.AddMessenger("messenger", messenger);
|
||||
@@ -225,7 +225,7 @@ Registrar::_MessageReceived(BMessage *message)
|
||||
|
||||
case B_REG_GET_CLIPBOARD_MESSENGER:
|
||||
{
|
||||
PRINT(("B_REG_GET_CLIPBOARD_MESSENGER\n"));
|
||||
PRINT("B_REG_GET_CLIPBOARD_MESSENGER\n");
|
||||
BMessenger messenger(fClipboardHandler);
|
||||
BMessage reply(B_REG_SUCCESS);
|
||||
reply.AddMessenger("messenger", messenger);
|
||||
@@ -236,7 +236,7 @@ Registrar::_MessageReceived(BMessage *message)
|
||||
// shutdown process
|
||||
case B_REG_SHUT_DOWN:
|
||||
{
|
||||
PRINT(("B_REG_SHUT_DOWN\n"));
|
||||
PRINT("B_REG_SHUT_DOWN\n");
|
||||
|
||||
_HandleShutDown(message);
|
||||
break;
|
||||
@@ -425,7 +425,7 @@ main()
|
||||
// rename the main thread
|
||||
rename_thread(find_thread(NULL), kRosterThreadName);
|
||||
|
||||
PRINT(("app->Run()...\n"));
|
||||
PRINT("app->Run()...\n");
|
||||
|
||||
try {
|
||||
app->Run();
|
||||
@@ -438,7 +438,7 @@ main()
|
||||
debugger("registrar main() caught unknown exception");
|
||||
}
|
||||
|
||||
PRINT(("delete app...\n"));
|
||||
PRINT("delete app...\n");
|
||||
delete app;
|
||||
|
||||
FUNCTION_END();
|
||||
|
||||
@@ -670,7 +670,7 @@ ShutdownProcess::~ShutdownProcess()
|
||||
status_t
|
||||
ShutdownProcess::Init(BMessage* request)
|
||||
{
|
||||
PRINT(("ShutdownProcess::Init()\n"));
|
||||
PRINT("ShutdownProcess::Init()\n");
|
||||
|
||||
// create and add the quit request reply handler
|
||||
fQuitRequestReplyHandler = new(nothrow) QuitRequestReplyHandler(this);
|
||||
@@ -720,7 +720,7 @@ ShutdownProcess::Init(BMessage* request)
|
||||
|
||||
resume_thread(fWorker);
|
||||
|
||||
PRINT(("ShutdownProcess::Init() done\n"));
|
||||
PRINT("ShutdownProcess::Init() done\n");
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
@@ -739,8 +739,8 @@ ShutdownProcess::MessageReceived(BMessage* message)
|
||||
return;
|
||||
}
|
||||
|
||||
PRINT(("ShutdownProcess::MessageReceived(): B_SOME_APP_QUIT: %ld\n",
|
||||
team));
|
||||
PRINT("ShutdownProcess::MessageReceived(): B_SOME_APP_QUIT: %ld\n",
|
||||
team);
|
||||
|
||||
// remove the app info from the respective list
|
||||
int32 phase;
|
||||
@@ -774,7 +774,7 @@ ShutdownProcess::MessageReceived(BMessage* message)
|
||||
// get the phase the event is intended for
|
||||
int32 phase = TimeoutEvent::GetMessagePhase(message);
|
||||
team_id team = TimeoutEvent::GetMessageTeam(message);;
|
||||
PRINT(("MSG_PHASE_TIMED_OUT: phase: %ld, team: %ld\n", phase, team));
|
||||
PRINT("MSG_PHASE_TIMED_OUT: phase: %ld, team: %ld\n", phase, team);
|
||||
|
||||
BAutolock _(fWorkerLock);
|
||||
|
||||
@@ -837,10 +837,10 @@ ShutdownProcess::MessageReceived(BMessage* message)
|
||||
|
||||
BAutolock _(fWorkerLock);
|
||||
if (open) {
|
||||
PRINT(("B_REG_TEAM_DEBUGGER_ALERT: insert %ld\n", team));
|
||||
PRINT("B_REG_TEAM_DEBUGGER_ALERT: insert %ld\n", team);
|
||||
fDebuggedTeams.insert(team);
|
||||
} else {
|
||||
PRINT(("B_REG_TEAM_DEBUGGER_ALERT: remove %ld\n", team));
|
||||
PRINT("B_REG_TEAM_DEBUGGER_ALERT: remove %ld\n", team);
|
||||
fDebuggedTeams.erase(team);
|
||||
_PushEvent(DEBUG_EVENT, -1, fCurrentPhase);
|
||||
}
|
||||
@@ -947,8 +947,8 @@ ShutdownProcess::_InitShutdownWindow()
|
||||
_AddShutdownWindowApps(fUserApps);
|
||||
_AddShutdownWindowApps(fSystemApps);
|
||||
} else {
|
||||
WARNING(("ShutdownProcess::Init(): Failed to create or init "
|
||||
"shutdown window."));
|
||||
WARNING("ShutdownProcess::Init(): Failed to create or init "
|
||||
"shutdown window.");
|
||||
|
||||
fHasGUI = false;
|
||||
}
|
||||
@@ -969,18 +969,18 @@ ShutdownProcess::_AddShutdownWindowApps(AppInfoList& infos)
|
||||
BFile file;
|
||||
status_t error = file.SetTo(&info->ref, B_READ_ONLY);
|
||||
if (error != B_OK) {
|
||||
WARNING(("ShutdownProcess::_AddShutdownWindowApps(): Failed to "
|
||||
WARNING("ShutdownProcess::_AddShutdownWindowApps(): Failed to "
|
||||
"open file for app %s: %s\n", info->signature,
|
||||
strerror(error)));
|
||||
strerror(error));
|
||||
continue;
|
||||
}
|
||||
|
||||
BAppFileInfo appFileInfo;
|
||||
error = appFileInfo.SetTo(&file);
|
||||
if (error != B_OK) {
|
||||
WARNING(("ShutdownProcess::_AddShutdownWindowApps(): Failed to "
|
||||
WARNING("ShutdownProcess::_AddShutdownWindowApps(): Failed to "
|
||||
"init app file info for app %s: %s\n", info->signature,
|
||||
strerror(error)));
|
||||
strerror(error));
|
||||
}
|
||||
|
||||
// get the application icons
|
||||
@@ -1017,8 +1017,8 @@ ShutdownProcess::_AddShutdownWindowApps(AppInfoList& infos)
|
||||
// add the app
|
||||
error = fWindow->AddApp(info->team, miniIcon, largeIcon);
|
||||
if (error != B_OK) {
|
||||
WARNING(("ShutdownProcess::_AddShutdownWindowApps(): Failed to "
|
||||
"add app to the shutdown window: %s\n", strerror(error)));
|
||||
WARNING("ShutdownProcess::_AddShutdownWindowApps(): Failed to "
|
||||
"add app to the shutdown window: %s\n", strerror(error));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1126,7 +1126,7 @@ ShutdownProcess::_PrepareShutdownMessage(BMessage& message) const
|
||||
status_t
|
||||
ShutdownProcess::_ShutDown()
|
||||
{
|
||||
PRINT(("Invoking _kern_shutdown(%d)\n", fReboot));
|
||||
PRINT("Invoking _kern_shutdown(%d)\n", fReboot);
|
||||
RETURN_ERROR(_kern_shutdown(fReboot));
|
||||
}
|
||||
|
||||
@@ -1136,7 +1136,7 @@ ShutdownProcess::_PushEvent(uint32 eventType, team_id team, int32 phase)
|
||||
{
|
||||
InternalEvent* event = new(nothrow) InternalEvent(eventType, team, phase);
|
||||
if (!event) {
|
||||
ERROR(("ShutdownProcess::_PushEvent(): Failed to create event!\n"));
|
||||
ERROR("ShutdownProcess::_PushEvent(): Failed to create event!\n");
|
||||
|
||||
return B_NO_MEMORY;
|
||||
}
|
||||
@@ -1214,8 +1214,8 @@ ShutdownProcess::_Worker()
|
||||
_WorkerDoShutdown();
|
||||
fShutdownError = B_OK;
|
||||
} catch (status_t error) {
|
||||
PRINT(("ShutdownProcess::_Worker(): error while shutting down: %s\n",
|
||||
strerror(error)));
|
||||
PRINT("ShutdownProcess::_Worker(): error while shutting down: %s\n",
|
||||
strerror(error));
|
||||
|
||||
fShutdownError = error;
|
||||
}
|
||||
@@ -1232,7 +1232,7 @@ ShutdownProcess::_Worker()
|
||||
void
|
||||
ShutdownProcess::_WorkerDoShutdown()
|
||||
{
|
||||
PRINT(("ShutdownProcess::_WorkerDoShutdown()\n"));
|
||||
PRINT("ShutdownProcess::_WorkerDoShutdown()\n");
|
||||
|
||||
// If we are here, the shutdown process has been initiated successfully,
|
||||
// that is, if an asynchronous BRoster::Shutdown() was requested, we
|
||||
@@ -1336,7 +1336,7 @@ ShutdownProcess::_WorkerDoShutdown()
|
||||
_ShutDown();
|
||||
_SetShutdownWindowWaitForShutdown();
|
||||
|
||||
PRINT((" _kern_shutdown() failed\n"));
|
||||
PRINT(" _kern_shutdown() failed\n");
|
||||
|
||||
// shutdown failed: This can happen for power off mode -- reboot should
|
||||
// always work.
|
||||
@@ -1397,8 +1397,8 @@ ShutdownProcess::_WaitForApp(team_id team, AppInfoList* list, bool systemApps)
|
||||
return false;
|
||||
} else {
|
||||
// The app returned false in QuitRequested().
|
||||
PRINT(("ShutdownProcess::_WaitForApp(): shutdown cancelled "
|
||||
"by team %ld (-1 => user)\n", eventTeam));
|
||||
PRINT("ShutdownProcess::_WaitForApp(): shutdown cancelled "
|
||||
"by team %ld (-1 => user)\n", eventTeam);
|
||||
|
||||
_DisplayAbortingApp(team);
|
||||
throw_error(B_SHUTDOWN_CANCELLED);
|
||||
@@ -1417,8 +1417,8 @@ ShutdownProcess::_WaitForApp(team_id team, AppInfoList* list, bool systemApps)
|
||||
void
|
||||
ShutdownProcess::_QuitApps(AppInfoList& list, bool systemApps)
|
||||
{
|
||||
PRINT(("ShutdownProcess::_QuitApps(%s)\n",
|
||||
(systemApps ? "system" : "user")));
|
||||
PRINT("ShutdownProcess::_QuitApps(%s)\n",
|
||||
(systemApps ? "system" : "user"));
|
||||
|
||||
if (systemApps) {
|
||||
_SetShutdownWindowCancelButtonEnabled(false);
|
||||
@@ -1433,8 +1433,8 @@ ShutdownProcess::_QuitApps(AppInfoList& list, bool systemApps)
|
||||
throw_error(error);
|
||||
|
||||
if (event == ABORT_EVENT) {
|
||||
PRINT(("ShutdownProcess::_QuitApps(): shutdown cancelled by "
|
||||
"team %ld (-1 => user)\n", team));
|
||||
PRINT("ShutdownProcess::_QuitApps(): shutdown cancelled by "
|
||||
"team %ld (-1 => user)\n", team);
|
||||
|
||||
_DisplayAbortingApp(team);
|
||||
throw_error(B_SHUTDOWN_CANCELLED);
|
||||
@@ -1459,8 +1459,8 @@ ShutdownProcess::_QuitApps(AppInfoList& list, bool systemApps)
|
||||
throw_error(error);
|
||||
|
||||
if (!systemApps && event == ABORT_EVENT) {
|
||||
PRINT(("ShutdownProcess::_QuitApps(): shutdown cancelled by "
|
||||
"team %ld (-1 => user)\n", team));
|
||||
PRINT("ShutdownProcess::_QuitApps(): shutdown cancelled by "
|
||||
"team %ld (-1 => user)\n", team);
|
||||
|
||||
_DisplayAbortingApp(team);
|
||||
throw_error(B_SHUTDOWN_CANCELLED);
|
||||
@@ -1488,7 +1488,7 @@ ShutdownProcess::_QuitApps(AppInfoList& list, bool systemApps)
|
||||
}
|
||||
|
||||
if (team < 0) {
|
||||
PRINT(("ShutdownProcess::_QuitApps() done\n"));
|
||||
PRINT("ShutdownProcess::_QuitApps() done\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1499,8 +1499,8 @@ ShutdownProcess::_QuitApps(AppInfoList& list, bool systemApps)
|
||||
_SetShutdownWindowCurrentApp(team);
|
||||
|
||||
// send the shutdown message to the app
|
||||
PRINT((" sending team %ld (port: %ld) a shutdown message\n", team,
|
||||
port));
|
||||
PRINT(" sending team %ld (port: %ld) a shutdown message\n", team,
|
||||
port);
|
||||
SingleMessagingTargetSet target(port, B_PREFERRED_TOKEN);
|
||||
MessageDeliverer::Default()->DeliverMessage(&message, target);
|
||||
|
||||
@@ -1533,7 +1533,7 @@ ShutdownProcess::_QuitApps(AppInfoList& list, bool systemApps)
|
||||
void
|
||||
ShutdownProcess::_QuitBackgroundApps()
|
||||
{
|
||||
PRINT(("ShutdownProcess::_QuitBackgroundApps()\n"));
|
||||
PRINT("ShutdownProcess::_QuitBackgroundApps()\n");
|
||||
|
||||
_SetShutdownWindowText(
|
||||
B_TRANSLATE("Asking background applications to quit."));
|
||||
@@ -1548,26 +1548,26 @@ ShutdownProcess::_QuitBackgroundApps()
|
||||
AppInfoListMessagingTargetSet targetSet(fBackgroundApps);
|
||||
|
||||
if (targetSet.HasNext()) {
|
||||
PRINT((" sending shutdown message to %ld apps\n",
|
||||
fBackgroundApps.CountInfos()));
|
||||
PRINT(" sending shutdown message to %ld apps\n",
|
||||
fBackgroundApps.CountInfos());
|
||||
|
||||
status_t error = MessageDeliverer::Default()->DeliverMessage(
|
||||
&message, targetSet);
|
||||
if (error != B_OK) {
|
||||
WARNING(("_QuitBackgroundApps::_Worker(): Failed to deliver "
|
||||
WARNING("_QuitBackgroundApps::_Worker(): Failed to deliver "
|
||||
"shutdown message to all applications: %s\n",
|
||||
strerror(error)));
|
||||
strerror(error));
|
||||
}
|
||||
}
|
||||
|
||||
PRINT(("ShutdownProcess::_QuitBackgroundApps() done\n"));
|
||||
PRINT("ShutdownProcess::_QuitBackgroundApps() done\n");
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ShutdownProcess::_WaitForBackgroundApps()
|
||||
{
|
||||
PRINT(("ShutdownProcess::_WaitForBackgroundApps()\n"));
|
||||
PRINT("ShutdownProcess::_WaitForBackgroundApps()\n");
|
||||
|
||||
// wait for user apps
|
||||
bool moreApps = true;
|
||||
@@ -1594,14 +1594,14 @@ ShutdownProcess::_WaitForBackgroundApps()
|
||||
}
|
||||
}
|
||||
|
||||
PRINT(("ShutdownProcess::_WaitForBackgroundApps() done\n"));
|
||||
PRINT("ShutdownProcess::_WaitForBackgroundApps() done\n");
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ShutdownProcess::_KillBackgroundApps()
|
||||
{
|
||||
PRINT(("ShutdownProcess::_KillBackgroundApps()\n"));
|
||||
PRINT("ShutdownProcess::_KillBackgroundApps()\n");
|
||||
|
||||
while (true) {
|
||||
// eat events (we need to be responsive for an abort event)
|
||||
@@ -1631,7 +1631,7 @@ ShutdownProcess::_KillBackgroundApps()
|
||||
|
||||
|
||||
if (team < 0) {
|
||||
PRINT(("ShutdownProcess::_KillBackgroundApps() done\n"));
|
||||
PRINT("ShutdownProcess::_KillBackgroundApps() done\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1645,7 +1645,7 @@ ShutdownProcess::_KillBackgroundApps()
|
||||
void
|
||||
ShutdownProcess::_QuitNonApps()
|
||||
{
|
||||
PRINT(("ShutdownProcess::_QuitNonApps()\n"));
|
||||
PRINT("ShutdownProcess::_QuitNonApps()\n");
|
||||
|
||||
_SetShutdownWindowText(B_TRANSLATE("Asking other processes to quit."));
|
||||
|
||||
@@ -1654,7 +1654,7 @@ ShutdownProcess::_QuitNonApps()
|
||||
team_info teamInfo;
|
||||
while (get_next_team_info(&cookie, &teamInfo) == B_OK) {
|
||||
if (fVitalSystemApps.find(teamInfo.team) == fVitalSystemApps.end()) {
|
||||
PRINT((" sending team %ld TERM signal\n", teamInfo.team));
|
||||
PRINT(" sending team %ld TERM signal\n", teamInfo.team);
|
||||
|
||||
#ifdef __HAIKU__
|
||||
// Note: team ID == team main thread ID under Haiku
|
||||
@@ -1675,7 +1675,7 @@ ShutdownProcess::_QuitNonApps()
|
||||
cookie = 0;
|
||||
while (get_next_team_info(&cookie, &teamInfo) == B_OK) {
|
||||
if (fVitalSystemApps.find(teamInfo.team) == fVitalSystemApps.end()) {
|
||||
PRINT((" killing team %ld\n", teamInfo.team));
|
||||
PRINT(" killing team %ld\n", teamInfo.team);
|
||||
|
||||
#ifdef __HAIKU__
|
||||
kill_team(teamInfo.team);
|
||||
@@ -1686,7 +1686,7 @@ ShutdownProcess::_QuitNonApps()
|
||||
}
|
||||
}
|
||||
|
||||
PRINT(("ShutdownProcess::_QuitNonApps() done\n"));
|
||||
PRINT("ShutdownProcess::_QuitNonApps() done\n");
|
||||
}
|
||||
|
||||
|
||||
@@ -1735,8 +1735,8 @@ ShutdownProcess::_QuitBlockingApp(AppInfoList& list, team_id team,
|
||||
|
||||
if (event == ABORT_EVENT) {
|
||||
if (cancelAllowed || debugged) {
|
||||
PRINT(("ShutdownProcess::_QuitBlockingApp(): shutdown "
|
||||
"cancelled by team %ld (-1 => user)\n", eventTeam));
|
||||
PRINT("ShutdownProcess::_QuitBlockingApp(): shutdown "
|
||||
"cancelled by team %ld (-1 => user)\n", eventTeam);
|
||||
|
||||
if (!debugged)
|
||||
_DisplayAbortingApp(eventTeam);
|
||||
@@ -1758,7 +1758,7 @@ ShutdownProcess::_QuitBlockingApp(AppInfoList& list, team_id team,
|
||||
}
|
||||
|
||||
// kill the app
|
||||
PRINT((" killing team %ld\n", team));
|
||||
PRINT(" killing team %ld\n", team);
|
||||
|
||||
kill_team(team);
|
||||
|
||||
@@ -1797,8 +1797,8 @@ ShutdownProcess::_DisplayAbortingApp(team_id team)
|
||||
}
|
||||
|
||||
if (!foundApp) {
|
||||
PRINT(("ShutdownProcess::_DisplayAbortingApp(): Didn't find the app "
|
||||
"that has cancelled the shutdown.\n"));
|
||||
PRINT("ShutdownProcess::_DisplayAbortingApp(): Didn't find the app "
|
||||
"that has cancelled the shutdown.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1842,14 +1842,14 @@ ShutdownProcess::_DisplayAbortingApp(team_id team)
|
||||
void
|
||||
ShutdownProcess::_WaitForDebuggedTeams()
|
||||
{
|
||||
PRINT(("ShutdownProcess::_WaitForDebuggedTeams()\n"));
|
||||
PRINT("ShutdownProcess::_WaitForDebuggedTeams()\n");
|
||||
{
|
||||
BAutolock _(fWorkerLock);
|
||||
if (fDebuggedTeams.empty())
|
||||
return;
|
||||
}
|
||||
|
||||
PRINT((" not empty!\n"));
|
||||
PRINT(" not empty!\n");
|
||||
|
||||
// wait for something to happen
|
||||
while (true) {
|
||||
@@ -1865,7 +1865,7 @@ ShutdownProcess::_WaitForDebuggedTeams()
|
||||
|
||||
BAutolock _(fWorkerLock);
|
||||
if (fDebuggedTeams.empty()) {
|
||||
PRINT((" out empty"));
|
||||
PRINT(" out empty");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -185,8 +185,8 @@ TRoster::HandleAddApplication(BMessage* request)
|
||||
if (request->FindBool("full_registration", &fullReg) != B_OK)
|
||||
fullReg = false;
|
||||
|
||||
PRINT(("team: %ld, signature: %s\n", team, signature));
|
||||
PRINT(("full registration: %d\n", fullReg));
|
||||
PRINT("team: %ld, signature: %s\n", team, signature);
|
||||
PRINT("full registration: %d\n", fullReg);
|
||||
|
||||
if (fShuttingDown)
|
||||
error = B_SHUTTING_DOWN;
|
||||
@@ -205,8 +205,8 @@ TRoster::HandleAddApplication(BMessage* request)
|
||||
|
||||
// entry_ref
|
||||
if (error == B_OK) {
|
||||
PRINT(("flags: %lx\n", flags));
|
||||
PRINT(("ref: %ld, %lld, %s\n", ref.device, ref.directory, ref.name));
|
||||
PRINT("flags: %lx\n", flags);
|
||||
PRINT("ref: %ld, %lld, %s\n", ref.device, ref.directory, ref.name);
|
||||
// check single/exclusive launchers
|
||||
RosterAppInfo* info = NULL;
|
||||
if ((launchFlags == B_SINGLE_LAUNCH
|
||||
@@ -255,15 +255,15 @@ TRoster::HandleAddApplication(BMessage* request)
|
||||
// add it to the right list
|
||||
bool addingSuccess = false;
|
||||
if (team >= 0) {
|
||||
PRINT(("added ref: %ld, %lld, %s\n", info->ref.device,
|
||||
info->ref.directory, info->ref.name));
|
||||
PRINT("added ref: %ld, %lld, %s\n", info->ref.device,
|
||||
info->ref.directory, info->ref.name);
|
||||
addingSuccess = (AddApp(info) == B_OK);
|
||||
if (addingSuccess && fullReg)
|
||||
_AppAdded(info);
|
||||
} else {
|
||||
token = info->token = _NextToken();
|
||||
addingSuccess = fEarlyPreRegisteredApps.AddInfo(info);
|
||||
PRINT(("added to early pre-regs, token: %lu\n", token));
|
||||
PRINT("added to early pre-regs, token: %lu\n", token);
|
||||
}
|
||||
if (!addingSuccess)
|
||||
SET_ERROR(error, B_NO_MEMORY);
|
||||
@@ -387,8 +387,8 @@ TRoster::HandleIsAppRegistered(BMessage* request)
|
||||
if (request->FindInt32("token", (int32*)&token) != B_OK)
|
||||
token = 0;
|
||||
|
||||
PRINT(("team: %ld, token: %lu\n", team, token));
|
||||
PRINT(("ref: %ld, %lld, %s\n", ref.device, ref.directory, ref.name));
|
||||
PRINT("team: %ld, token: %lu\n", team, token);
|
||||
PRINT("ref: %ld, %lld, %s\n", ref.device, ref.directory, ref.name);
|
||||
|
||||
// check the parameters
|
||||
// entry_ref
|
||||
@@ -402,24 +402,24 @@ TRoster::HandleIsAppRegistered(BMessage* request)
|
||||
RosterAppInfo* info = NULL;
|
||||
if (error == B_OK) {
|
||||
if ((info = fRegisteredApps.InfoFor(team)) != NULL) {
|
||||
PRINT(("found team in fRegisteredApps\n"));
|
||||
PRINT("found team in fRegisteredApps\n");
|
||||
_ReplyToIARRequest(request, info);
|
||||
} else if (token > 0
|
||||
&& (info = fEarlyPreRegisteredApps.InfoForToken(token)) != NULL) {
|
||||
PRINT(("found ref in fEarlyRegisteredApps (by token)\n"));
|
||||
PRINT("found ref in fEarlyRegisteredApps (by token)\n");
|
||||
// pre-registered and has no team ID assigned yet -- queue the
|
||||
// request
|
||||
be_app->DetachCurrentMessage();
|
||||
_AddIARRequest(fIARRequestsByToken, token, request);
|
||||
} else if (team >= 0
|
||||
&& (info = fEarlyPreRegisteredApps.InfoFor(&ref)) != NULL) {
|
||||
PRINT(("found ref in fEarlyRegisteredApps (by ref)\n"));
|
||||
PRINT("found ref in fEarlyRegisteredApps (by ref)\n");
|
||||
// pre-registered and has no team ID assigned yet -- queue the
|
||||
// request
|
||||
be_app->DetachCurrentMessage();
|
||||
_AddIARRequest(fIARRequestsByID, team, request);
|
||||
} else {
|
||||
PRINT(("didn't find team or ref\n"));
|
||||
PRINT("didn't find team or ref\n");
|
||||
// team not registered, ref/token not early pre-registered
|
||||
_ReplyToIARRequest(request, NULL);
|
||||
}
|
||||
@@ -488,7 +488,7 @@ TRoster::HandleRemoveApp(BMessage* request)
|
||||
if (request->FindInt32("team", &team) != B_OK)
|
||||
team = -1;
|
||||
|
||||
PRINT(("team: %ld\n", team));
|
||||
PRINT("team: %ld\n", team);
|
||||
|
||||
// remove the app
|
||||
if (error == B_OK) {
|
||||
@@ -540,7 +540,7 @@ TRoster::HandleSetThreadAndTeam(BMessage* request)
|
||||
if (error == B_OK && team < 0)
|
||||
SET_ERROR(error, B_BAD_VALUE);
|
||||
|
||||
PRINT(("team: %ld, thread: %ld, token: %lu\n", team, thread, token));
|
||||
PRINT("team: %ld, thread: %ld, token: %lu\n", team, thread, token);
|
||||
|
||||
// update the app_info
|
||||
if (error == B_OK) {
|
||||
@@ -669,11 +669,11 @@ TRoster::HandleGetAppInfo(BMessage* request)
|
||||
hasSignature = false;
|
||||
|
||||
if (hasTeam)
|
||||
PRINT(("team: %ld\n", team));
|
||||
PRINT("team: %ld\n", team);
|
||||
if (hasRef)
|
||||
PRINT(("ref: %ld, %lld, %s\n", ref.device, ref.directory, ref.name));
|
||||
PRINT("ref: %ld, %lld, %s\n", ref.device, ref.directory, ref.name);
|
||||
if (hasSignature)
|
||||
PRINT(("signature: %s\n", signature));
|
||||
PRINT("signature: %s\n", signature);
|
||||
|
||||
// get the info
|
||||
RosterAppInfo* info = NULL;
|
||||
@@ -985,7 +985,7 @@ TRoster::HandleGetRecentApps(BMessage* request)
|
||||
BAutolock _(fLock);
|
||||
|
||||
if (!request) {
|
||||
D(PRINT(("WARNING: TRoster::HandleGetRecentApps(NULL) called\n")));
|
||||
D(PRINT("WARNING: TRoster::HandleGetRecentApps(NULL) called\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1013,7 +1013,7 @@ TRoster::HandleAddToRecentDocuments(BMessage* request)
|
||||
BAutolock _(fLock);
|
||||
|
||||
if (!request) {
|
||||
D(PRINT(("WARNING: TRoster::HandleAddToRecentDocuments(NULL) called\n")));
|
||||
D(PRINT("WARNING: TRoster::HandleAddToRecentDocuments(NULL) called\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1044,7 +1044,7 @@ TRoster::HandleAddToRecentFolders(BMessage* request)
|
||||
BAutolock _(fLock);
|
||||
|
||||
if (!request) {
|
||||
D(PRINT(("WARNING: TRoster::HandleAddToRecentFolders(NULL) called\n")));
|
||||
D(PRINT("WARNING: TRoster::HandleAddToRecentFolders(NULL) called\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1075,7 +1075,7 @@ TRoster::HandleAddToRecentApps(BMessage* request)
|
||||
BAutolock _(fLock);
|
||||
|
||||
if (!request) {
|
||||
D(PRINT(("WARNING: TRoster::HandleAddToRecentApps(NULL) called\n")));
|
||||
D(PRINT("WARNING: TRoster::HandleAddToRecentApps(NULL) called\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1100,7 +1100,7 @@ TRoster::HandleLoadRecentLists(BMessage* request)
|
||||
BAutolock _(fLock);
|
||||
|
||||
if (!request) {
|
||||
D(PRINT(("WARNING: TRoster::HandleLoadRecentLists(NULL) called\n")));
|
||||
D(PRINT("WARNING: TRoster::HandleLoadRecentLists(NULL) called\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1125,7 +1125,7 @@ TRoster::HandleSaveRecentLists(BMessage* request)
|
||||
BAutolock _(fLock);
|
||||
|
||||
if (!request) {
|
||||
D(PRINT(("WARNING: TRoster::HandleSaveRecentLists(NULL) called\n")));
|
||||
D(PRINT("WARNING: TRoster::HandleSaveRecentLists(NULL) called\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1687,7 +1687,7 @@ TRoster::_ReplyToIARRequest(BMessage* request, const RosterAppInfo* info)
|
||||
BMessage reply(B_REG_SUCCESS);
|
||||
reply.AddBool("registered", (bool)info);
|
||||
reply.AddBool("pre-registered", preRegistered);
|
||||
PRINT(("_ReplyToIARRequest(): pre-registered: %d\n", preRegistered));
|
||||
PRINT("_ReplyToIARRequest(): pre-registered: %d\n", preRegistered);
|
||||
if (info)
|
||||
_AddMessageAppInfo(&reply, info);
|
||||
request->SendReply(&reply);
|
||||
@@ -1702,7 +1702,7 @@ TRoster::_HandleGetRecentEntries(BMessage* request)
|
||||
{
|
||||
FUNCTION_START();
|
||||
if (!request) {
|
||||
D(PRINT(("WARNING: TRoster::HandleGetRecentFolders(NULL) called\n")));
|
||||
D(PRINT("WARNING: TRoster::HandleGetRecentFolders(NULL) called\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1763,9 +1763,9 @@ TRoster::_HandleGetRecentEntries(BMessage* request)
|
||||
break;
|
||||
|
||||
default:
|
||||
D(PRINT(("WARNING: TRoster::_HandleGetRecentEntries(): "
|
||||
D(PRINT("WARNING: TRoster::_HandleGetRecentEntries(): "
|
||||
"unexpected request->what value of 0x%lx\n",
|
||||
request->what)));
|
||||
request->what));
|
||||
error = B_BAD_VALUE;
|
||||
break;
|
||||
}
|
||||
@@ -1984,8 +1984,8 @@ TRoster::_LoadRosterSettings(const char* path)
|
||||
);
|
||||
}
|
||||
if (error) {
|
||||
D(PRINT(("WARNING: TRoster::_LoadRosterSettings(): error loading roster "
|
||||
"settings from '%s', 0x%lx\n", settingsPath, error)));
|
||||
D(PRINT("WARNING: TRoster::_LoadRosterSettings(): error loading roster "
|
||||
"settings from '%s', 0x%lx\n", settingsPath, error));
|
||||
}
|
||||
return error;
|
||||
}
|
||||
@@ -2007,18 +2007,18 @@ TRoster::_SaveRosterSettings(const char* path)
|
||||
status_t saveError;
|
||||
saveError = fRecentDocuments.Save(file, "Recent documents", "RecentDoc");
|
||||
if (saveError) {
|
||||
D(PRINT(("TRoster::_SaveRosterSettings(): recent documents save "
|
||||
"failed with error 0x%lx\n", saveError)));
|
||||
D(PRINT("TRoster::_SaveRosterSettings(): recent documents save "
|
||||
"failed with error 0x%lx\n", saveError));
|
||||
}
|
||||
saveError = fRecentFolders.Save(file, "Recent folders", "RecentFolder");
|
||||
if (saveError) {
|
||||
D(PRINT(("TRoster::_SaveRosterSettings(): recent folders save "
|
||||
"failed with error 0x%lx\n", saveError)));
|
||||
D(PRINT("TRoster::_SaveRosterSettings(): recent folders save "
|
||||
"failed with error 0x%lx\n", saveError));
|
||||
}
|
||||
saveError = fRecentApps.Save(file);
|
||||
if (saveError) {
|
||||
D(PRINT(("TRoster::_SaveRosterSettings(): recent folders save "
|
||||
"failed with error 0x%lx\n", saveError)));
|
||||
D(PRINT("TRoster::_SaveRosterSettings(): recent folders save "
|
||||
"failed with error 0x%lx\n", saveError));
|
||||
}
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user