//
void MachServer::add(Port receiver)
{
- SECURITY_MACHSERVER_PORT_ADD(receiver);
+ secinfo("machserver", "port add: %d", receiver.port());
mPortSet += receiver;
}
void MachServer::remove(Port receiver)
{
- SECURITY_MACHSERVER_PORT_REMOVE(receiver);
+ secinfo("machserver", "port remove: %d", receiver.port());
mPortSet -= receiver;
}
highestWorkerCount = 1;
// run server loop in initial (immortal) thread
- SECURITY_MACHSERVER_START_THREAD(false);
+ secinfo("machserver", "start thread");
runServerThread(false);
- SECURITY_MACHSERVER_END_THREAD(false);
+ secinfo("machserver", "end thread");
// primary server thread exited somehow (not currently possible)
assert(false);
Time::Absolute rightNow = Time::now();
if (rightNow >= nextCheckTime) { // reaping period complete; process
UInt32 idlers = leastIdleWorkers;
- SECURITY_MACHSERVER_REAP(workerCount, idlers);
+ secinfo("machserver", "reaping workers: %d %d", (uint32_t) workerCount, (uint32_t) idlers);
nextCheckTime = rightNow + workerTimeout;
leastIdleWorkers = INT_MAX;
if (idlers > 1) // multiple idle threads throughout measuring interval...
timeout = workerTimeout;
}
}
- if (SECURITY_MACHSERVER_RECEIVE_ENABLED())
- SECURITY_MACHSERVER_RECEIVE(indefinite ? 0 : timeout.seconds());
-
+
// receive next IPC request (or wait for timeout)
mach_msg_return_t mr = indefinite ?
mach_msg_overwrite(bufRequest,
// process received request message below
break;
default:
- SECURITY_MACHSERVER_RECEIVE_ERROR(mr);
+ secinfo("machserver", "received error: %d", mr);
continue;
}
} else {
// normal request message
StLock<MachServer, &MachServer::busy, &MachServer::idle> _(*this);
- SECURITY_MACHSERVER_BEGIN(bufRequest.localPort(), bufRequest.msgId());
+ secinfo("machserver", "begin request: %d, %d", bufRequest.localPort().port(), bufRequest.msgId());
// try subsidiary handlers first
bool handled = false;
handle(bufRequest, bufReply);
}
- SECURITY_MACHSERVER_END();
+ secinfo("machserver", "end request");
}
// process reply generated by handler
case MACH_MSG_SUCCESS:
break;
default:
- SECURITY_MACHSERVER_SEND_ERROR(mr, bufReply.remotePort());
+ secinfo("machserver", "send error: %d %d", mr, bufReply.remotePort().port());
bufReply.destroy();
break;
}
if (memory) {
set<Allocation> &releaseSet = perThread().deferredAllocations;
assert(releaseSet.find(Allocation(memory, alloc)) == releaseSet.end());
- SECURITY_MACHSERVER_ALLOC_REGISTER(memory, &alloc);
+ secinfo("machserver", "allocing register %p with alloc %p", memory, &alloc);
releaseSet.insert(Allocation(memory, alloc));
}
}
{
set<Allocation> &releaseSet = perThread().deferredAllocations;
for (set<Allocation>::iterator it = releaseSet.begin(); it != releaseSet.end(); it++) {
- SECURITY_MACHSERVER_ALLOC_RELEASE(it->addr, it->allocator);
-
+ secinfo("machserver", "releasing alloc at %p with %p", it->addr, it->allocator);
+
// before we release the deferred allocation, zap it so that secrets aren't left in memory
size_t memSize = malloc_size(it->addr);
bzero(it->addr, memSize);
// register the worker thread and go
server.addThread(this);
try {
- SECURITY_MACHSERVER_START_THREAD(true);
+ secinfo("machserver", "start thread");
server.runServerThread(true);
- SECURITY_MACHSERVER_END_THREAD(false);
+ secinfo("machserver", "end thread");
} catch (...) {
// fell out of server loop by error. Let the thread go quietly
- SECURITY_MACHSERVER_END_THREAD(true);
+ secinfo("machserver", "end thread (due to error)");
}
server.removeThread(this);
}
return false; // nothing (more) to be done now
} // drop lock; work has been retrieved
try {
- SECURITY_MACHSERVER_TIMER_START(top, top->longTerm(), Time::now().internalForm());
+ secinfo("machserver", "timer start: %p, %d, %f", top, top->longTerm(), Time::now().internalForm());
StLock<MachServer::Timer,
&MachServer::Timer::select, &MachServer::Timer::unselect> _t(*top);
if (top->longTerm()) {
} else {
top->action();
}
- SECURITY_MACHSERVER_TIMER_END(false);
+ secinfo("machserver", "timer end (false)");
} catch (...) {
- SECURITY_MACHSERVER_TIMER_END(true);
+ secinfo("machserver", "timer end (true)");
}
return true;
}