예제 #1
0
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;
	}
}
예제 #2
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;
	}
}