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 <stdarg.h>
#include <unistd.h>
#include <signal.h>
#include <sys/wait.h>
#include "rods.h"
#include "rcGlobalExtern.h"
#include "rsLog.hpp"
#include "rodsLog.h"
#include "sockComm.h"
#include "rsIcatOpr.hpp"
#include "getRodsEnv.h"
#include "rcConnect.h"
#include <vector>
Go to the source code of this file.
Macros | |
#define | MAX_EXEC_ENV 10 /* max number of env for execv */ |
#define | MAX_SVR_SVR_CONNECT_CNT 7 /* avoid recurive connect */ |
#define | MIN_AGENT_TIMEOUT_TIME 7200 |
#define | MAX_ACCEPT_ERR_CNT 1000 |
#define | NUM_READ_WORKER_THR 5 |
#define | RE_CACHE_SALT_NUM_RANDOM_BYTES 40 |
#define | AGENT_QUE_CHK_INT |
Functions | |
int | serverize (char *logDir) |
int | serverMain (char *logDir) |
int | procChildren (agentProc_t **agentProcHead) |
agentProc_t * | getAgentProcByPid (int childPid, agentProc_t **agentProcHead) |
void | serverExit () |
void | usage (char *prog) |
int | initServer (rsComm_t *svrComm) |
int | spawnAgent (agentProc_t *connReq, agentProc_t **agentProcHead) |
int | execAgent (int newSock, startupPack_t *startupPack) |
int | getAgentProcCnt () |
int | chkAgentProcCnt () |
int | getAgentProcPIDs (std::vector< int > &_pids) |
int | chkConnectedAgentProcQue () |
int | recordServerProcess (rsComm_t *svrComm) |
int | initServerMain (rsComm_t *svrComm) |
int | addConnReqToQue (rsComm_t *rsComm, int sock) |
int | initConnThreadEnv () |
agentProc_t * | getConnReqFromQue () |
void | readWorkerTask () |
int | procSingleConnReq (agentProc_t *connReq) |
int | startProcConnReqThreads () |
void | stopProcConnReqThreads () |
void | spawnManagerTask () |
int | procBadReq () |
void | purgeLockFileWorkerTask () |
Variables | |
char * | optarg |
int | optind |
int | opterr |
int | optopt |
#define AGENT_QUE_CHK_INT |
Definition at line 45 of file rodsServer.hpp.
#define MAX_ACCEPT_ERR_CNT 1000 |
Definition at line 39 of file rodsServer.hpp.
#define MAX_EXEC_ENV 10 /* max number of env for execv */ |
Definition at line 34 of file rodsServer.hpp.
#define MAX_SVR_SVR_CONNECT_CNT 7 /* avoid recurive connect */ |
Definition at line 35 of file rodsServer.hpp.
#define MIN_AGENT_TIMEOUT_TIME 7200 |
Definition at line 37 of file rodsServer.hpp.
#define NUM_READ_WORKER_THR 5 |
Definition at line 41 of file rodsServer.hpp.
#define RE_CACHE_SALT_NUM_RANDOM_BYTES 40 |
Definition at line 43 of file rodsServer.hpp.
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().
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().
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().
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().
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().
void usage | ( | char * | prog | ) |
Definition at line 97 of file irodsXmsgServer.cpp.
Referenced by main().
char* optarg |
Referenced by main(), and parseCmdLineOpt().
int opterr |
Definition at line 32 of file rodsServer.hpp.
Referenced by parseCmdLineOpt().
int optind |
Referenced by parseCmdLineOpt().
int optopt |
Definition at line 32 of file rodsServer.hpp.
Referenced by parseCmdLineOpt().