irods
4.2.8
About: iRODS (the integrated Rule Oriented Data System) is a distributed data-management system for creating data grids, digital libraries, persistent archives, and real-time data systems.
![]() ![]() |
#include "rcMisc.h"
#include "rodsServer.hpp"
#include "sharedmemory.hpp"
#include "initServer.hpp"
#include "miscServerFunct.hpp"
#include <syslog.h>
#include <pthread.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include "irods_exception.hpp"
#include "irods_server_state.hpp"
#include "irods_client_server_negotiation.hpp"
#include "irods_network_factory.hpp"
#include "irods_re_plugin.hpp"
#include "irods_server_properties.hpp"
#include "irods_server_control_plane.hpp"
#include "procLog.h"
#include "rsGlobalExtern.hpp"
#include "locks.hpp"
#include <boost/filesystem.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/convenience.hpp>
#include <boost/range/iterator_range.hpp>
#include "sockCommNetworkInterface.hpp"
#include "sys/un.h"
#include "irods_random.hpp"
#include <boost/thread/thread.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/condition.hpp>
Go to the source code of this file.
Classes | |
struct | local_addr |
Variables | |
int | agent_conn_socket {} |
bool | connected_to_agent {} |
pid_t | agent_spawning_pid {} |
const char | socket_dir_template [] {"/tmp/irods_sockets_XXXXXX"} |
char | agent_factory_socket_dir [sizeof(socket_dir_template)] {} |
char | agent_factory_socket_file [sizeof(local_addr.sun_path)] {} |
uint | ServerBootTime |
int | SvrSock |
agentProc_t * | ConnectedAgentHead = 0 |
agentProc_t * | ConnReqHead = 0 |
agentProc_t * | SpawnReqHead = 0 |
agentProc_t * | BadReqHead = 0 |
boost::mutex | ConnectedAgentMutex |
boost::mutex | BadReqMutex |
boost::thread * | ReadWorkerThread [5] |
boost::thread * | SpawnManagerThread |
boost::thread * | PurgeLockFileThread |
boost::mutex | ReadReqCondMutex |
boost::mutex | SpawnReqCondMutex |
boost::condition_variable | ReadReqCond |
boost::condition_variable | SpawnReqCond |
Definition at line 1288 of file rodsServer.cpp.
References BOTTOM_POS, ConnReqHead, queAgentProc(), ReadReqCond, ReadReqCondMutex, rsComm_t::remoteAddr, agentProc::remoteAddr, and agentProc::sock.
Referenced by serverMain().
int chkAgentProcCnt | ( | ) |
Definition at line 1021 of file rodsServer.cpp.
References chkConnectedAgentProcQue(), terminate_irods_processes::e, getAgentProcCnt(), KEY_NOT_FOUND, irods::log(), NO_MAX_CONNECTION_LIMIT, and SYS_MAX_CONNECT_COUNT_EXCEEDED.
Referenced by serverMain().
int chkConnectedAgentProcQue | ( | ) |
Definition at line 1047 of file rodsServer.cpp.
References ConnectedAgentHead, ConnectedAgentMutex, irods::experimental::administration::client::v1::exists(), LOG_DEBUG, MAX_NAME_LEN, agentProc::next, NULL, pid_age::p, agentProc::pid, ProcLogDir, and rodsLog().
Referenced by chkAgentProcCnt().
int execAgent | ( | int | newSock, |
startupPack_t * | startupPack | ||
) |
Definition at line 801 of file rodsServer.cpp.
References agent_conn_socket, agent_factory_socket_dir, startupPack::apiVersion, irods::CFG_RE_CACHE_SALT_KW(), startupPack::clientRodsZone, startupPack::clientUser, irods.pypyodbc::connect, startupPack::connectCnt, get64RandomBytes(), startupPack::irodsProt, LOG_DEBUG, LOG_ERROR, startupPack::option, startupPack::proxyRodsZone, startupPack::proxyUser, startupPack::reconnFlag, startupPack::relVersion, REQ_SVR_NEG, irods::RODS_CS_NEG, rodsLog(), sendEnvironmentVarIntToSocket(), sendEnvironmentVarStrToSocket(), sendSocketOverSocket(), SERVER_BOOT_TIME, ServerBootTime, SP_API_VERSION, SP_CLIENT_RODS_ZONE, SP_CLIENT_USER, SP_CONNECT_CNT, SP_NEW_SOCK, SP_OPTION, SP_PROTOCOL, SP_PROXY_RODS_ZONE, SP_PROXY_USER, SP_RE_CACHE_SALT, SP_RECONN_FLAG, SP_REL_VERSION, irods.pypyodbc::status, SYS_SOCK_CONNECT_ERR, and SYS_SOCK_READ_ERR.
Referenced by spawnAgent().
agentProc_t* getAgentProcByPid | ( | int | childPid, |
agentProc_t ** | agentProcHead | ||
) |
Definition at line 695 of file rodsServer.cpp.
References ConnectedAgentMutex, agentProc::next, NULL, and agentProc::pid.
int getAgentProcCnt | ( | ) |
Definition at line 985 of file rodsServer.cpp.
References ConnectedAgentHead, ConnectedAgentMutex, agentProc::next, and NULL.
Referenced by chkAgentProcCnt(), and irods::server_operation_shutdown().
Definition at line 1001 of file rodsServer.cpp.
References ConnectedAgentHead, ConnectedAgentMutex, agentProc::next, NULL, and agentProc::pid.
Referenced by irods::operation_status().
agentProc_t* getConnReqFromQue | ( | ) |
Definition at line 1310 of file rodsServer.cpp.
References ConnReqHead, irods::server_state::EXITED, irods::server_state::instance(), agentProc::next, NULL, ReadReqCond, ReadReqCondMutex, and irods::server_state::STOPPED.
Referenced by readWorkerTask().
int initConnThreadEnv | ( | ) |
Definition at line 1305 of file rodsServer.cpp.
Referenced by startProcConnReqThreads().
Definition at line 1086 of file rodsServer.cpp.
References irods::CFG_SERVICE_ROLE_PROVIDER(), irods::error::code(), rodsServerHost::conn, disconnectRcat(), get_catalog_service_role(), getRcatHost(), initServerInfo(), LOCAL_HOST, rodsServerHost::localFlag, irods::log(), LOG_NOTICE, MASTER_RCAT, NULL, irods::error::ok(), PASS, irods::resource_manager::print_local_resources(), printZoneInfo(), purgeLockFileDir(), rcDisconnect(), resc_mgr, rodsLog(), and irods.pypyodbc::status.
Referenced by initServerMain().
Definition at line 1189 of file rodsServer.cpp.
References irods::CFG_ZONE_PORT(), terminate_irods_processes::e, getReHost(), getRodsEnv(), getXmsgHost(), initAndClearProcLog(), initServer(), LOCAL_HOST, rodsServerHost::localFlag, irods::log(), LOG_ERROR, LOG_NOTICE, MAX_LISTEN_QUE, rsComm_t::myEnv, NAME_LEN, NULL, irods::RE_PID_KW(), recordServerProcess(), RODS_FORK, rodsLog(), setRsCommFromRodsEnv(), rsComm_t::sock, sockOpenForInConn(), irods.pypyodbc::status, SYS_SOCK_LISTEN_ERR, and irods::XMSG_PID_KW().
Referenced by serverMain().
|
static |
Definition at line 376 of file rodsServer.cpp.
References irods::CFG_PLUGIN_CONFIGURATION_KW(), terminate_irods_processes::e, ERROR, error, irods::get_server_property(), instantiate_shared_memory_for_plugin(), INVALID_ANY_CAST, irods::PLUGIN_TYPE_RULE_ENGINE(), and SUCCESS.
Referenced by serverMain().
|
static |
Definition at line 354 of file rodsServer.cpp.
References irods::CFG_SHARED_MEMORY_INSTANCE_KW(), detachSharedMemory(), and prepareServerSharedMemory().
Referenced by instantiate_shared_memory().
Definition at line 161 of file rodsServer.cpp.
References agent_conn_socket, agent_factory_socket_dir, agent_factory_socket_file, AGENT_PT, agent_spawning_pid, irods.pypyodbc::connect, get64RandomBytes(), LOG_DEBUG10, LOG_ERROR, LOG_NOTICE, NULL, optarg, ProcessType, rodsLog(), rodsLogLevel(), rodsLogSqlReq(), runIrodsAgentFactory(), SERVER_PT, ServerBootTime, serverExit(), serverize(), serverMain(), socket_dir_template, SP_LOG_LEVEL, SP_LOG_SQL, irods.pypyodbc::status, SYS_FORK_ERROR, SYS_INTERNAL_ERR, SYS_SOCK_CONNECT_ERR, and usage().
int procBadReq | ( | ) |
Definition at line 1599 of file rodsServer.cpp.
References BadReqHead, BadReqMutex, agentProc::next, and NULL.
Referenced by spawnManagerTask().
int procChildren | ( | agentProc_t ** | agentProcHead | ) |
Definition at line 663 of file rodsServer.cpp.
References ConnectedAgentMutex, agentProc::next, NULL, and agentProc::pid.
Referenced by serverMain().
int procSingleConnReq | ( | agentProc_t * | connReq | ) |
Definition at line 1534 of file rodsServer.cpp.
References startupPack::clientUser, irods::error::code(), startupPack::connectCnt, ConnectedAgentHead, irods::log(), LOG_DEBUG, LOG_NOTICE, MAX_SVR_SVR_CONNECT_CNT, mySockClose(), irods::network_factory(), NULL, irods::error::ok(), PASS, agentProc::pid, startupPack::proxyUser, readStartupPack(), agentProc::remoteAddr, rodsLog(), sendVersion(), agentProc::sock, spawnAgent(), agentProc::startupPack, irods.pypyodbc::status, SYS_EXCEED_CONNECT_CNT, and USER__NULL_INPUT_ERR.
void purgeLockFileWorkerTask | ( | ) |
Definition at line 1620 of file rodsServer.cpp.
References irods::server_state::EXITED, irods::server_state::instance(), LOCK_FILE_PURGE_TIME, LOG_ERROR, purgeLockFileDir(), rodsLogError(), rodsSleep(), irods::SERVER_CONTROL_POLLING_TIME_MILLI_SEC, irods.pypyodbc::status, and irods::server_state::STOPPED.
Referenced by serverMain().
int queueConnectedAgentProc | ( | int | childPid, |
agentProc_t * | connReq, | ||
agentProc_t ** | agentProcHead | ||
) |
Definition at line 967 of file rodsServer.cpp.
References ConnectedAgentMutex, NULL, agentProc::pid, queAgentProc(), TOP_POS, and USER__NULL_INPUT_ERR.
Referenced by spawnAgent().
void readWorkerTask | ( | ) |
Definition at line 1386 of file rodsServer.cpp.
References BadReqHead, BadReqMutex, BOTTOM_POS, chkAllowedUser(), startupPack::clientRodsZone, startupPack::clientUser, irods::error::code(), startupPack::connectCnt, irods::server_state::EXITED, getConnReqFromQue(), irods::server_state::instance(), irods::log(), LOG_ERROR, MAX_SVR_SVR_CONNECT_CNT, mySockClose(), irods::network_factory(), NULL, irods::error::ok(), startupPack::option, PASS, queAgentProc(), READ_STARTUP_PACK_TOUT_SEC, readStartupPack(), RODS_HEARTBEAT_T, rodsLog(), sendVersion(), agentProc::sock, SpawnReqCond, SpawnReqCondMutex, SpawnReqHead, agentProc::startupPack, irods.pypyodbc::status, irods::server_state::STOPPED, SYS_EXCEED_CONNECT_CNT, and TOP_POS.
Referenced by startProcConnReqThreads().
Definition at line 1140 of file rodsServer.cpp.
References LOG_ERROR, rsComm_t::myEnv, myPid, NULL, rodsLog(), and rodsEnv::rodsPort.
Referenced by initServerMain(), and serverExit().
int runIrodsAgentFactory | ( | sockaddr_un | agent_addr | ) |
Definition at line 188 of file rodsAgent.cpp.
References agentMain(), rsComm_t::auth_scheme, irods::environment_properties::capture(), irods::server_properties::capture(), irods::CFG_SERVICE_ROLE_PROVIDER(), chkAllowedUser(), chkLogfileName(), chlDebug(), cleanup(), cleanupAndExit(), irods::client_server_negotiation_for_server(), rsComm_t::clientUser, irods::error::code(), rsComm_t::cookie, irods::CS_NEG_FAILURE(), get_catalog_service_role(), irods::get_client_api_table(), irods::get_pack_table(), irods::get_server_api_table(), getLogfileName(), getRodsEnv(), irods::init_api_table(), initAgent(), initProcLog(), initRsCommWithStartupPack(), irods::environment_properties::instance(), irods::server_properties::instance(), irodsAgentSignalExit(), irods::log(), LOG_DEBUG, LOG_ERROR, LOG_NOTICE, logAgentProc(), LogFd, rsComm_t::myEnv, rsComm_t::negotiation_results, irods::network_factory(), NULL, irods::error::ok(), PASS, irods::re_plugin_globals, receiveDataFromServer(), rsComm_t::reconnAddr, rsComm_t::reconnPort, register_handlers(), irods::error::result(), rmProcLog(), RODS_LOGFILE, rodsEnv::rodsDebug, rodsLog(), userInfo_t::rodsZone, RsApiTable, RULE_ENGINE_TRY_CACHE, sendVersion(), SERVER_NEGOTIATION_ERROR, setRECacheSaltFromEnv(), sockAgentStart, sockAgentStop, irods.pypyodbc::status, SYS_AGENT_INIT_ERR, SYS_FORK_ERROR, SYS_INTERNAL_ERR, SYS_SOCK_ACCEPT_ERR, SYS_SOCK_BIND_ERR, SYS_SOCK_LISTEN_ERR, SYS_SOCK_OPEN_ERR, SYS_SOCK_READ_ERR, SYS_SOCK_SELECT_ERR, rsComm_t::thread_ctx, and userInfo_t::userName.
Referenced by main().
Definition at line 743 of file rodsServer.cpp.
References LOG_DEBUG, LOG_ERROR, rodsLog(), and irods.pypyodbc::status.
Referenced by execAgent().
Definition at line 756 of file rodsServer.cpp.
References LOG_DEBUG, LOG_ERROR, rodsLog(), and irods.pypyodbc::status.
Referenced by execAgent().
Definition at line 769 of file rodsServer.cpp.
References terminate_irods_processes::control, and NULL.
Referenced by execAgent().
void serverExit | ( | ) |
Definition at line 633 of file rodsServer.cpp.
References agent_conn_socket, agent_factory_socket_dir, agent_factory_socket_file, agent_spawning_pid, LOG_NOTICE, NULL, recordServerProcess(), and rodsLog().
Referenced by main().
int serverize | ( | char * | logDir | ) |
Definition at line 308 of file rodsServer.cpp.
References getLogfileName(), LOG_NOTICE, LogFd, NULL, RODS_SERVER_LOGFILE, and rodsLog().
Referenced by main().
int serverMain | ( | char * | logDir | ) |
Definition at line 421 of file rodsServer.cpp.
References addConnReqToQue(), agent_conn_socket, agent_factory_socket_dir, agent_factory_socket_file, agent_spawning_pid, irods::CFG_SERVER_CONTROL_PLANE_PORT(), irods::CFG_SERVICE_ROLE_PROVIDER(), chkAgentProcCnt(), chkLogfileName(), irods::error::code(), irods::exception::code(), ConnectedAgentHead, irods::server_state::EXITED, get_catalog_service_role(), initServerMain(), irods::server_state::instance(), instantiate_shared_memory(), irods::log(), LOG_ERROR, LOG_NOTICE, LOGFILE_CHK_CNT, loopCnt, MAX_ACCEPT_ERR_CNT, mySockClose(), irods::network_factory(), NULL, irods::error::ok(), PASS, irods::server_state::PAUSED, procChildren(), PurgeLockFileThread, purgeLockFileWorkerTask(), irods::re_plugin_globals, irods::error::result(), RODS_SERVER_LOGFILE, rodsLog(), rodsSleep(), rsAcceptConn(), irods::server_state::RUNNING, sendVersion(), irods::SERVER_CONTROL_FWD_SLEEP_TIME_MILLI_SEC, irods::SERVER_CONTROL_POLLING_TIME_MILLI_SEC, rsComm_t::sock, startProcConnReqThreads(), irods.pypyodbc::status, irods::server_state::STOPPED, stopProcConnReqThreads(), SvrSock, uninstantiate_shared_memory(), and irods::exception::what().
Referenced by main().
|
static |
Definition at line 152 of file rodsServer.cpp.
References InformationRequiredToSafelyRenameProcess::argv0, and InformationRequiredToSafelyRenameProcess::argv0_size.
std::vector< std::string > setExecArg | ( | const char * | commandArgv | ) |
Definition at line 1647 of file rodsServer.cpp.
References NULL.
int spawnAgent | ( | agentProc_t * | connReq, |
agentProc_t ** | agentProcHead | ||
) |
Definition at line 723 of file rodsServer.cpp.
References execAgent(), NULL, queueConnectedAgentProc(), agentProc::sock, agentProc::startupPack, and USER__NULL_INPUT_ERR.
Referenced by procSingleConnReq(), and spawnManagerTask().
void spawnManagerTask | ( | ) |
Definition at line 1482 of file rodsServer.cpp.
References AGENT_QUE_CHK_INT, startupPack::clientUser, ConnectedAgentHead, irods::server_state::EXITED, irods::server_state::instance(), LOG_DEBUG, LOG_NOTICE, agentProc::next, NULL, agentProc::pid, procBadReq(), startupPack::proxyUser, agentProc::remoteAddr, rodsLog(), agentProc::sock, spawnAgent(), SpawnReqCond, SpawnReqCondMutex, SpawnReqHead, agentProc::startupPack, irods.pypyodbc::status, and irods::server_state::STOPPED.
Referenced by startProcConnReqThreads().
int startProcConnReqThreads | ( | ) |
Definition at line 1342 of file rodsServer.cpp.
References initConnThreadEnv(), LOG_ERROR, NUM_READ_WORKER_THR, readWorkerTask(), ReadWorkerThread, rodsLog(), spawnManagerTask(), SpawnManagerThread, and SYS_THREAD_RESOURCE_ERR.
Referenced by serverMain().
void stopProcConnReqThreads | ( | ) |
Definition at line 1365 of file rodsServer.cpp.
References LOG_ERROR, NUM_READ_WORKER_THR, ReadReqCond, ReadWorkerThread, rodsLog(), SpawnManagerThread, and SpawnReqCond.
Referenced by serverMain().
|
static |
Definition at line 398 of file rodsServer.cpp.
References irods::CFG_PLUGIN_CONFIGURATION_KW(), terminate_irods_processes::e, ERROR, error, irods::get_server_property(), INVALID_ANY_CAST, irods::PLUGIN_TYPE_RULE_ENGINE(), SUCCESS, and uninstantiate_shared_memory_for_plugin().
Referenced by serverMain().
|
static |
Definition at line 365 of file rodsServer.cpp.
References irods::CFG_SHARED_MEMORY_INSTANCE_KW(), removeSharedMemory(), and resetMutex().
Referenced by uninstantiate_shared_memory().
void usage | ( | char * | prog | ) |
Definition at line 653 of file rodsServer.cpp.
Referenced by main().
int agent_conn_socket {} |
Definition at line 46 of file rodsServer.cpp.
Referenced by execAgent(), main(), serverExit(), and serverMain().
char agent_factory_socket_dir[sizeof(socket_dir_template)] {} |
Definition at line 51 of file rodsServer.cpp.
Referenced by execAgent(), main(), serverExit(), and serverMain().
char agent_factory_socket_file[sizeof(local_addr.sun_path)] {} |
Definition at line 52 of file rodsServer.cpp.
Referenced by main(), serverExit(), and serverMain().
pid_t agent_spawning_pid {} |
Definition at line 49 of file rodsServer.cpp.
Referenced by main(), serverExit(), and serverMain().
agentProc_t* BadReqHead = 0 |
Definition at line 60 of file rodsServer.cpp.
Referenced by procBadReq(), and readWorkerTask().
boost::mutex BadReqMutex |
Definition at line 66 of file rodsServer.cpp.
Referenced by procBadReq(), and readWorkerTask().
bool connected_to_agent {} |
Definition at line 47 of file rodsServer.cpp.
agentProc_t* ConnectedAgentHead = 0 |
Definition at line 57 of file rodsServer.cpp.
Referenced by chkConnectedAgentProcQue(), getAgentProcCnt(), getAgentProcPIDs(), procSingleConnReq(), serverMain(), and spawnManagerTask().
boost::mutex ConnectedAgentMutex |
Definition at line 65 of file rodsServer.cpp.
Referenced by chkConnectedAgentProcQue(), getAgentProcByPid(), getAgentProcCnt(), getAgentProcPIDs(), procChildren(), and queueConnectedAgentProc().
agentProc_t* ConnReqHead = 0 |
Definition at line 58 of file rodsServer.cpp.
Referenced by addConnReqToQue(), and getConnReqFromQue().
boost::thread* PurgeLockFileThread |
Definition at line 70 of file rodsServer.cpp.
Referenced by serverMain().
boost::condition_variable ReadReqCond |
Definition at line 74 of file rodsServer.cpp.
Referenced by addConnReqToQue(), getConnReqFromQue(), and stopProcConnReqThreads().
boost::mutex ReadReqCondMutex |
Definition at line 72 of file rodsServer.cpp.
Referenced by addConnReqToQue(), and getConnReqFromQue().
boost::thread* ReadWorkerThread[5] |
Definition at line 67 of file rodsServer.cpp.
Referenced by startProcConnReqThreads(), and stopProcConnReqThreads().
uint ServerBootTime |
Definition at line 54 of file rodsServer.cpp.
Referenced by execAgent(), and main().
const char socket_dir_template[] {"/tmp/irods_sockets_XXXXXX"} |
Definition at line 50 of file rodsServer.cpp.
Referenced by main().
boost::thread* SpawnManagerThread |
Definition at line 68 of file rodsServer.cpp.
Referenced by startProcConnReqThreads(), and stopProcConnReqThreads().
boost::condition_variable SpawnReqCond |
Definition at line 75 of file rodsServer.cpp.
Referenced by readWorkerTask(), spawnManagerTask(), and stopProcConnReqThreads().
boost::mutex SpawnReqCondMutex |
Definition at line 73 of file rodsServer.cpp.
Referenced by readWorkerTask(), and spawnManagerTask().
agentProc_t* SpawnReqHead = 0 |
Definition at line 59 of file rodsServer.cpp.
Referenced by readWorkerTask(), and spawnManagerTask().
int SvrSock |
Definition at line 55 of file rodsServer.cpp.
Referenced by serverMain().