Exemple #1
0
status_t
Job::_CreateAndTransferPorts()
{
	// TODO: prefix system ports with "system:"

	bool defaultPort = false;

	for (PortMap::iterator iterator = fPortMap.begin();
			iterator != fPortMap.end(); iterator++) {
		BString name(Name());
		const char* suffix = iterator->second.GetString("name");
		if (suffix != NULL)
			name << ':' << suffix;
		else
			defaultPort = true;

		const int32 capacity = iterator->second.GetInt32("capacity",
			B_LOOPER_PORT_DEFAULT_CAPACITY);

		port_id port = create_port(capacity, name.String());
		if (port < 0)
			return port;

		status_t result = set_port_owner(port, fTeam);
		if (result != B_OK)
			return result;

		iterator->second.SetInt32("port", port);

		if (name == "x-vnd.haiku-registrar:auth") {
			// Allow the launch_daemon to access the registrar authentication
			BPrivate::set_registrar_authentication_port(port);
		}
	}

	if (fCreateDefaultPort && !defaultPort) {
		BMessage data;
		data.AddInt32("capacity", B_LOOPER_PORT_DEFAULT_CAPACITY);

		port_id port = create_port(B_LOOPER_PORT_DEFAULT_CAPACITY, Name());
		if (port < 0)
			return port;

		status_t result = set_port_owner(port, fTeam);
		if (result != B_OK)
			return result;

		data.SetInt32("port", port);
		AddPort(data);
	}

	return B_OK;
}
Exemple #2
0
port_id
Job::_CreateAndTransferPort(const char* name, int32 capacity)
{
    port_id port = create_port(B_LOOPER_PORT_DEFAULT_CAPACITY, Name());
    if (port < 0)
        return port;

    status_t status = set_port_owner(port, fTeam);
    if (status != B_OK) {
        delete_port(port);
        return status;
    }

    return port;
}
Exemple #3
0
status_t
_user_set_port_owner(port_id port, team_id team)
{
	return set_port_owner(port, team);
}