Example #1
0
SpaceManager::SpaceManager () {
    Connection* c;
    char cwd[1024];
    int* tag;
    void* tmp;

    c = new Connection;
    if (!c->OpenLocalService(spaceman_mgr)) {
	fatal("can't connect to space manager");
    }
    chief = new ChiefDeputy(c);
    hostname[0] = '\0';
    chief->Alloc(tmp, chief->Tag(), 0, sizeof(int));
    tag = (int*)tmp;
    *tag = Tag();
    UsePath(getwd(cwd));
}
Example #2
0
Connection* SpaceManager::Find (const char* name, boolean wait) {
    int pid;
    Connection* c;
    char* local;

    chief->StringMsg(Tag(), wait ? spaceman_WaitFor : spaceman_Find, name);
    chief->GetReply(&pid, sizeof(pid));
    if (pid == 0) {
	c = nil;
    } else {
	c = new Connection;
	local = new char[spaceman_namelen];
	sprintf(local, spaceman_name, pid);
	if (!c->OpenLocalService(local)) {
	    fatal("can't open local service");
	}
    }
    return c;
}