int
psg_agents_starter_start(PSG_AgentsStarter *as,
	const char *passengerRoot,
	PSG_VariantMap *extraParams,
	const PSG_AfterForkCallback afterFork,
	void *callbackArgument,
	char **errorMessage)
{
	Passenger::AgentsStarter *agentsStarter = (Passenger::AgentsStarter *) as;
	this_thread::disable_syscall_interruption dsi;
	try {
		function<void ()> afterForkFunctionObject;
		
		if (afterFork != NULL) {
			afterForkFunctionObject = boost::bind(afterFork, callbackArgument);
		}
		agentsStarter->start(passengerRoot,
			*((Passenger::VariantMap *) extraParams),
			afterForkFunctionObject);
		return 1;
	} catch (const Passenger::SystemException &e) {
		errno = e.code();
		*errorMessage = strdup(e.what());
		return 0;
	} catch (const std::exception &e) {
		errno = -1;
		*errorMessage = strdup(e.what());
		return 0;
	}
}
const char *
psg_agents_starter_get_request_socket_password(PSG_AgentsStarter *as, unsigned int *size) {
	Passenger::AgentsStarter *agentsStarter = (Passenger::AgentsStarter *) as;
	if (size != NULL) {
		*size = agentsStarter->getRequestSocketPassword().size();
	}
	return agentsStarter->getRequestSocketPassword().c_str();
}
const char *
pp_agents_starter_get_instance_dir(PP_AgentsStarter *as, unsigned int *size) {
	Passenger::AgentsStarter *agentsStarter = (Passenger::AgentsStarter *) as;
	if (size != NULL) {
		*size = agentsStarter->getInstanceDir().size();
	}
	return agentsStarter->getInstanceDir().c_str();
}
const char *
pp_agents_starter_get_core_password(PP_AgentsStarter *as, unsigned int *size) {
	Passenger::AgentsStarter *agentsStarter = (Passenger::AgentsStarter *) as;
	if (size != NULL) {
		*size = agentsStarter->getCorePassword().size();
	}
	return agentsStarter->getCorePassword().c_str();
}
Exemple #5
0
const char *
agents_starter_get_request_socket_filename(AgentsStarter *as, unsigned int *size) {
	Passenger::AgentsStarter *agentsStarter = (Passenger::AgentsStarter *) as;
	if (size != NULL) {
		*size = agentsStarter->getRequestSocketFilename().size();
	}
	return agentsStarter->getRequestSocketFilename().c_str();
}
void
psg_agents_starter_detach(PSG_AgentsStarter *as) {
	Passenger::AgentsStarter *agentsStarter = (Passenger::AgentsStarter *) as;
	agentsStarter->detach();
}
pid_t
psg_agents_starter_get_pid(PSG_AgentsStarter *as) {
	Passenger::AgentsStarter *agentsStarter = (Passenger::AgentsStarter *) as;
	return agentsStarter->getPid();
}
const char *
psg_agents_starter_get_generation_dir(PSG_AgentsStarter *as) {
	Passenger::AgentsStarter *agentsStarter = (Passenger::AgentsStarter *) as;
	return agentsStarter->getGeneration()->getPath().c_str();
}
const char *
psg_agents_starter_get_server_instance_dir(PSG_AgentsStarter *as) {
	Passenger::AgentsStarter *agentsStarter = (Passenger::AgentsStarter *) as;
	return agentsStarter->getServerInstanceDir()->getPath().c_str();
}
Exemple #10
0
int
agents_starter_start(AgentsStarter *as,
                     int logLevel, const char *debugLogFile,
                     pid_t webServerPid,
                     const char *tempDir, int userSwitching,
                     const char *defaultUser, const char *defaultGroup,
                     uid_t webServerWorkerUid, gid_t webServerWorkerGid,
                     const char *passengerRoot,
                     const char *rubyCommand, unsigned int maxPoolSize,
                     unsigned int maxInstancesPerApp,
                     unsigned int poolIdleTime,
                     const char *analyticsServer,
                     const char *analyticsLogDir, const char *analyticsLogUser,
                     const char *analyticsLogGroup, const char *analyticsLogPermissions,
                     const char *unionStationGatewayAddress,
                     unsigned short unionStationGatewayPort,
                     const char *unionStationGatewayCert,
                     const char *unionStationProxyAddress,
                     const char *unionStationProxyType,
                     const char **prestartURLs, unsigned int prestartURLsCount,
                     const AfterForkCallback afterFork,
                     void *callbackArgument,
                     char **errorMessage)
{
	Passenger::AgentsStarter *agentsStarter = (Passenger::AgentsStarter *) as;
	this_thread::disable_syscall_interruption dsi;
	try {
		function<void ()> afterForkFunctionObject;
		set<string> setOfprestartURLs;
		unsigned int i;
		
		if (afterFork != NULL) {
			afterForkFunctionObject = boost::bind(afterFork, callbackArgument);
		}
		for (i = 0; i < prestartURLsCount; i++) {
			setOfprestartURLs.insert(prestartURLs[i]);
		}
		agentsStarter->start(logLevel, debugLogFile,
			webServerPid, tempDir, userSwitching,
			defaultUser, defaultGroup,
			webServerWorkerUid, webServerWorkerGid,
			passengerRoot, rubyCommand,
			maxPoolSize, maxInstancesPerApp, poolIdleTime,
			analyticsServer,
			analyticsLogDir, analyticsLogUser,
			analyticsLogGroup, analyticsLogPermissions,
			unionStationGatewayAddress,
			unionStationGatewayPort,
			unionStationGatewayCert,
			unionStationProxyAddress,
			unionStationProxyType,
			setOfprestartURLs,
			afterForkFunctionObject);
		return 1;
	} catch (const Passenger::SystemException &e) {
		errno = e.code();
		*errorMessage = strdup(e.what());
		return 0;
	} catch (const std::exception &e) {
		errno = -1;
		*errorMessage = strdup(e.what());
		return 0;
	}
}
Exemple #11
0
void
agents_starter_detach(AgentsStarter *as) {
	Passenger::AgentsStarter *agentsStarter = (Passenger::AgentsStarter *) as;
	agentsStarter->detach();
}