A brief file description. More...
#include "ink_config.h"
#include "libts.h"
#include "ink_sys_control.h"
#include <syslog.h>
#include <sys/lock.h>
#include <sys/filio.h>
#include <mcheck.h>
#include "Main.h"
#include "signals.h"
#include "Error.h"
#include "StatSystem.h"
#include "P_EventSystem.h"
#include "P_Net.h"
#include "P_UDPNet.h"
#include "P_DNS.h"
#include "P_SplitDNS.h"
#include "P_Cluster.h"
#include "P_HostDB.h"
#include "P_Cache.h"
#include "I_Layout.h"
#include "I_Machine.h"
#include "RecordsConfig.h"
#include "I_RecProcess.h"
#include "Transform.h"
#include "ProcessManager.h"
#include "ProxyConfig.h"
#include "HttpProxyServerMain.h"
#include "HttpBodyFactory.h"
#include "logging/Log.h"
#include "ICPProcessor.h"
#include "CacheControl.h"
#include "IPAllow.h"
#include "ParentSelection.h"
#include "MgmtUtils.h"
#include "StatPages.h"
#include "HTTP.h"
#include "Plugin.h"
#include "DiagsConfig.h"
#include "CoreUtils.h"
#include "Update.h"
#include "congest/Congestion.h"
#include "RemapProcessor.h"
#include "I_Tasks.h"
#include "InkAPIInternal.h"
#include <ts/ink_cap.h>
#include "HdrTest.h"
Go to the source code of this file.
Data Structures | |
struct | CmdCacheCont |
struct | CMD |
struct | ShowStats |
struct | AutoStopCont |
struct | RegressionCont |
Defines | |
#define | DEFAULT_HTTP_ACCEPT_PORT_NUMBER 0 |
#define | DEFAULT_COMMAND_FLAG 0 |
#define | DEFAULT_VERBOSE_FLAG 0 |
#define | DEFAULT_VERSION_FLAG 0 |
#define | DEFAULT_STACK_TRACE_FLAG 0 |
#define | DEFAULT_COMMAND_FLAG_TYPE "F" |
#define | DEFAULT_REMOTE_MANAGEMENT_FLAG 0 |
#define | DIAGS_LOG_FILENAME "diags.log" |
#define | CMD_ERROR -2 |
#define | CMD_FAILED -1 |
#define | CMD_OK 0 |
#define | CMD_HELP 1 |
#define | CMD_IN_PROGRESS 2 |
#define | SET_INTERVAL(scope, name, var) |
Functions | |
static void * | mgmt_restart_shutdown_callback (void *, char *, int data_len) |
static void * | mgmt_storage_device_cmd_callback (void *x, char *data, int len) |
static void | init_ssl_ctx_callback (void *ctx, bool server) |
static void | init_system () |
static void | check_lockfile () |
static void | check_config_directories (void) |
static void | initialize_process_manager () |
void | shutdown_system () |
static int | cmd_list (char *) |
static char * | skip (char *cmd, int null_ok=0) |
static void | CB_After_Cache_Init () |
static int | cmd_check_internal (char *, bool fix=false) |
static int | cmd_check (char *cmd) |
static int | cmd_clear (char *cmd) |
static int | cmd_help (char *cmd) |
static int | cmd_index (char *p) |
static void | check_fd_limit () |
static int | cmd_mode () |
static int | set_core_size (const char *, RecDataT, RecData data, void *) |
static void | init_core_size () |
static void | adjust_sys_settings (void) |
static void | syslog_log_configure () |
static void | check_system_constants () |
static void | init_http_header () |
static void | run_AutoStop () |
static void | run_RegressionTest () |
static void | chdir_root () |
static int | getNumSSLThreads (void) |
static int | adjust_num_of_net_threads (int nthreads) |
static void | change_uid_gid (const char *user) |
Change the uid and gid to what is in the passwd entry for supplied user name. | |
int | main (int, char **argv) |
REGRESSION_TEST() | Hdrs (RegressionTest *t, int atype, int *pstatus) |
Variables | |
static const long | MAX_LOGIN = sysconf(_SC_LOGIN_NAME_MAX) <= 0 ? _POSIX_LOGIN_NAME_MAX : sysconf(_SC_LOGIN_NAME_MAX) |
static int | version_flag = DEFAULT_VERSION_FLAG |
static int | num_of_net_threads = ink_number_of_processors() |
static int | num_of_udp_threads = 0 |
static int | num_accept_threads = 0 |
static int | num_task_threads = 0 |
int | num_of_cluster_threads |
static char * | http_accept_port_descriptor |
int | http_accept_file_descriptor = NO_FD |
static char | core_file [255] = "" |
static bool | enable_core_file_p = false |
int | command_flag = DEFAULT_COMMAND_FLAG |
static char | regression_test [1024] = "" |
int | auto_clear_hostdb_flag = 0 |
int | fds_limit |
int | cluster_port_number |
int | cache_clustering_enabled |
char | cluster_host [MAXDNAME+1] = DEFAULT_CLUSTER_HOST |
static char | command_string [512] = "" |
int | remote_management_flag = DEFAULT_REMOTE_MANAGEMENT_FLAG |
static char | error_tags [1024] = "" |
static char | action_tags [1024] = "" |
static int | show_statistics = 0 |
static inkcoreapi DiagsConfig * | diagsConfig = NULL |
HttpBodyFactory * | body_factory = NULL |
static int | accept_mss = 0 |
static int | cmd_line_dprintf_level = 0 |
static int | poll_timeout = -1 |
static volatile int | delay_listen_for_cache_p = 0 |
AppVersionInfo | appVersionInfo |
static const ArgumentDescription | argument_descriptions [] |
static struct CMD | commands [] |
static int | syslog_facility = LOG_DAEMON |
A brief file description.
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Definition in file Main.cc.
#define DIAGS_LOG_FILENAME "diags.log" |
#define SET_INTERVAL | ( | scope, | ||
name, | ||||
var | ||||
) |
do { \ RecInt tmpint; \ Debug("statsproc", "Looking for %s\n", name); \ if (RecGetRecordInt(name, &tmpint) == REC_ERR_OKAY) { \ Debug("statsproc", "Found %s\n", name); \ scope##_set_##var(tmpint); \ } \ } while(0)
Referenced by main().
static int adjust_num_of_net_threads | ( | int | nthreads | ) | [static] |
Definition at line 1139 of file Main.cc.
References Debug, MAX_EVENT_THREADS, REC_ReadConfigFloat, REC_ReadConfigInteger, unlikely, and Warning.
Referenced by main().
static void adjust_sys_settings | ( | void | ) | [static] |
Definition at line 797 of file Main.cc.
References ats_mallopt(), ATS_MMAP_MAX, ATS_UNUSED_RETURN, fds_limit, fds_throttle, ink_max_out_rlimit(), REC_ReadConfigFloat, REC_ReadConfigInteger, and THROTTLE_FD_HEADROOM.
Referenced by main().
static void CB_After_Cache_Init | ( | ) | [static] |
Definition at line 386 of file Main.cc.
References CACHE_DB_MAJOR_VERSION, cacheProcessor, Debug, delay_listen_for_cache_p, FeatureAPIHooks< ID, N >::get(), VersionNumber::ink_major, VersionNumber::ink_minor, APIHook::invoke(), lifecycle_hooks, CacheProcessor::min_stripe_version, APIHook::next(), RecSetRecordInt(), URLHashContext::Setting, start, start_HttpProxyServer(), TS_EVENT_LIFECYCLE_CACHE_READY, and TS_LIFECYCLE_CACHE_READY_HOOK.
Referenced by main().
static void change_uid_gid | ( | const char * | user | ) | [static] |
Change the uid and gid to what is in the passwd entry for supplied user name.
user | User name in the passwd file to change the uid and gid to. |
Definition at line 1188 of file Main.cc.
References ats_free(), ats_malloc(), ATS_UNUSED_RETURN, enable_core_file_p, EnableCoreFile(), and ink_fatal_die().
Referenced by main().
static void chdir_root | ( | ) | [static] |
Definition at line 1090 of file Main.cc.
References Layout::get(), and Layout::prefix.
Referenced by main().
static void check_config_directories | ( | void | ) | [static] |
Definition at line 272 of file Main.cc.
References Layout::get(), and RecConfigReadRuntimeDir().
Referenced by initialize_process_manager().
static void check_fd_limit | ( | ) | [static] |
Definition at line 697 of file Main.cc.
References fds_limit, fds_throttle, MachineFatal, REC_ReadConfigInteger, and THROTTLE_FD_HEADROOM.
Referenced by main().
static void check_lockfile | ( | ) | [static] |
Definition at line 242 of file Main.cc.
References Lockfile::Get(), RecConfigReadRuntimeDir(), Layout::relative_to(), and SERVER_LOCK.
Referenced by main().
static void check_system_constants | ( | ) | [static] |
static int cmd_check | ( | char * | cmd | ) | [static] |
Definition at line 518 of file Main.cc.
References cmd_check_internal().
static int cmd_check_internal | ( | char * | , | |
bool | fix = false | |||
) | [static] |
Definition at line 481 of file Main.cc.
References cacheProcessor, MultiCacheBase::check(), Store::delete_all(), eventProcessor, hostdb_current_interval, HRTIME_SECONDS, ink_get_based_hrtime(), Store::read_config(), MultiCacheBase::reset(), EventProcessor::schedule_every(), CacheProcessor::start(), HostDBCache::start(), and theStore.
Referenced by cmd_check().
static int cmd_clear | ( | char * | cmd | ) | [static] |
Definition at line 532 of file Main.cc.
References HostDBProcessor::cache(), cacheProcessor, Store::delete_all(), eventProcessor, hostDBProcessor, HRTIME_SECONDS, Note, PROCESSOR_RECONFIGURE, Store::read_config(), RecConfigReadRuntimeDir(), Layout::relative_to(), MultiCacheBase::reset(), EventProcessor::schedule_every(), HostDBCache::start(), CacheProcessor::start_internal(), and theStore.
static int cmd_help | ( | char * | cmd | ) | [static] |
static int cmd_index | ( | char * | p | ) | [static] |
Definition at line 656 of file Main.cc.
References commands, countof, and CMD::n.
Referenced by cmd_help(), and cmd_mode().
static int cmd_list | ( | char * | ) | [static] |
Definition at line 347 of file Main.cc.
References Note, Store::read_config(), REC_ReadConfigInteger, and Store::write_config_data().
static int cmd_mode | ( | ) | [static] |
Definition at line 717 of file Main.cc.
References cmd_index(), command_string, commands, CMD::f, and Warning.
Referenced by main().
static int getNumSSLThreads | ( | void | ) | [static] |
Definition at line 1106 of file Main.cc.
References HttpProxyPort::hasSSL(), ink_number_of_processors(), REC_ReadConfigFloat, and REC_ReadConfigInteger.
Referenced by main().
REGRESSION_TEST() Hdrs | ( | RegressionTest * | t, | |
int | atype, | |||
int * | pstatus | |||
) |
Definition at line 1701 of file Main.cc.
References HdrTest::go().
static void init_core_size | ( | ) | [static] |
Definition at line 778 of file Main.cc.
References ink_assert, RecData::rec_int, REC_RegisterConfigUpdateFunc, RECD_INT, RecGetRecordInt(), set_core_size(), and Warning.
Referenced by main().
static void init_http_header | ( | ) | [static] |
Definition at line 1019 of file Main.cc.
References http_init(), mime_init(), and url_init().
Referenced by main().
static void init_ssl_ctx_callback | ( | void * | ctx, | |
bool | server | |||
) | [static] |
Definition at line 1735 of file Main.cc.
References FeatureAPIHooks< ID, N >::get(), APIHook::invoke(), lifecycle_hooks, APIHook::next(), TS_EVENT_LIFECYCLE_SERVER_SSL_CTX_INITIALIZED, TS_LIFECYCLE_CLIENT_SSL_CTX_INITIALIZED_HOOK, and TS_LIFECYCLE_SERVER_SSL_CTX_INITIALIZED_HOOK.
static void init_system | ( | ) | [static] |
Definition at line 220 of file Main.cc.
References AppVersionInfo::AppStr, fds_limit, AppVersionInfo::FullVersionInfoStr, init_signals(), ink_max_out_rlimit(), RecGetRecordInt(), and Warning.
Referenced by main().
static void initialize_process_manager | ( | ) | [static] |
Definition at line 296 of file Main.cc.
References AppVersionInfo::BldDateStr, AppVersionInfo::BldMachineStr, AppVersionInfo::BldNumStr, AppVersionInfo::BldPersonStr, AppVersionInfo::BldTimeStr, check_config_directories(), diags, AppVersionInfo::FullVersionInfoStr, RECM_CLIENT, RECM_STAND_ALONE, RECP_NON_PERSISTENT, RecProcessInit(), RecProcessInitMessage(), RecRegisterStatString, RECT_PROCESS, remote_management_flag, and AppVersionInfo::VersionStr.
Referenced by main().
int main | ( | int | , | |
char ** | argv | |||
) |
Definition at line 1266 of file Main.cc.
References socks_conf_struct::accept_enabled, NetProcessor::accept_mss, accept_mss, socks_conf_struct::accept_port, action_tags, adjust_num_of_net_threads(), adjust_sys_settings(), IpEndpoint::assign(), BUILD_MACHINE, BUILD_PERSON, cache_clustering_enabled, cacheProcessor, CB_After_Cache_Init(), change_uid_gid(), chdir_root(), check_fd_limit(), check_lockfile(), check_system_constants(), clusterProcessor, CMD_IN_PROGRESS, cmd_line_dprintf_level, cmd_mode(), command_flag, command_string, core_file, countof, Layout::create(), Debug, DebugCapabilities(), delay_listen_for_cache_p, DiagsConfig::diags, diags, DIAGS_LOG_FILENAME, diagsConfig, dnsProcessor, error_tags, ET_CALL, eventProcessor, Thread::execute(), AppVersionInfo::FullVersionInfoStr, FeatureAPIHooks< ID, N >::get(), getNumSSLThreads(), global_config_cbs, HOSTDB_MODULE_MAJOR_VERSION, HOSTDB_MODULE_MINOR_VERSION, hostDBProcessor, HRTIME_SECONDS, http_accept_port_descriptor, icpProcessor, HttpConfigParams::inbound_ip4, HttpConfigParams::inbound_ip6, Log::init(), ClusterProcessor::init(), StatPagesManager::init(), Machine::init(), init_core_size(), init_http_header(), init_HttpProxyServer(), init_signals2(), SSLConfigParams::init_ssl_ctx_cb, init_system(), initCacheControl(), initCongestionControl(), initialize_all_global_stats(), initialize_process_manager(), initialize_store(), ink_aio_init(), ink_cache_init(), ink_dns_init(), ink_event_system_init(), ink_hostdb_init(), ink_net_init(), ink_set_dprintf_level(), ink_set_thread_name(), ink_split_dns_init(), APIHook::invoke(), is_debug_tag_set, lifecycle_hooks, HttpProxyPort::loadConfig(), HttpProxyPort::loadDefaultIfEmpty(), HttpProxyPort::loadValue(), HttpConfig::m_master, makeModuleVersion, MAX_LOGIN, mgmt_restart_shutdown_callback(), mgmt_storage_device_cmd_callback(), net_config_poll_timeout, netProcessor, APIHook::next(), NO_FD, Log::NO_REMOTE_MANAGEMENT, Note, num_accept_threads, num_of_net_threads, num_of_udp_threads, num_task_threads, HttpConfigParams::outbound_ip4, HttpConfigParams::outbound_ip6, PACKAGE_NAME, PACKAGE_VERSION, plugin_init(), poll_timeout, Diags::prefix_str, PreserveCapabilities(), PRIVATE_MODULE_HEADER, process_args(), process_core(), ProcessFatal, REC_ERR_OKAY, REC_ReadConfigInteger, REC_ReadConfigString, RecDebugOff(), RecGetRecordInt(), RecProcessStart(), RecSetDiags(), remapProcessor, remote_management_flag, res_track_memory, RestrictCapabilities(), TransformTest::run(), run_AutoStop(), run_HostDBTest(), run_RegressionTest(), IpEndpoint::sa, EventProcessor::schedule_every(), CacheProcessor::set_after_init_callback(), SET_INTERVAL, Thread::set_specific(), AppVersionInfo::setup(), RemapProcessor::setUseSeparateThread(), show_statistics, NetProcessor::socks_conf_stuff, spdy_config_load(), sslNetProcessor, UpdateManager::start(), TasksProcessor::start(), ICPProcessorExt::start(), TransformProcessor::start(), UDPNetProcessor::start(), CacheProcessor::start(), HostDBProcessor::start(), DNSProcessor::start(), NetProcessor::start(), RemapProcessor::start(), EventProcessor::start(), start_HttpProxyServer(), start_HttpProxyServerBackDoor(), start_SocksProxy(), start_stats_snap(), SplitDNSConfig::startup(), ParentConfig::startup(), IpAllow::startup(), HttpConfig::startup(), statPagesManager, syslog_log_configure(), tasksProcessor, this_thread(), transformProcessor, TS_EVENT_LIFECYCLE_PORTS_INITIALIZED, TS_LIFECYCLE_PORTS_INITIALIZED_HOOK, ts_session_protocol_well_known_name_indices_init(), udpNet, updateManager, version_flag, and Warning.
static void * mgmt_restart_shutdown_callback | ( | void * | , | |
char * | , | |||
int | data_len | |||
) | [static] |
Definition at line 1709 of file Main.cc.
References sync_cache_dir_on_shutdown().
Referenced by main().
static void * mgmt_storage_device_cmd_callback | ( | void * | x, | |
char * | data, | |||
int | len | |||
) | [static] |
Definition at line 1716 of file Main.cc.
References cacheProcessor, Debug, CacheProcessor::find_by_path(), and CacheProcessor::mark_storage_offline().
Referenced by main().
static void run_AutoStop | ( | ) | [static] |
Definition at line 1042 of file Main.cc.
References eventProcessor, HRTIME_SECONDS, and EventProcessor::schedule_in().
Referenced by main().
static void run_RegressionTest | ( | ) | [static] |
Definition at line 1081 of file Main.cc.
References eventProcessor, HRTIME_SECONDS, regression_level, and EventProcessor::schedule_every().
Referenced by main().
Definition at line 749 of file Main.cc.
References enable_core_file_p, EnableCoreFile(), RecData::rec_int, and Warning.
Referenced by init_core_size().
static char* skip | ( | char * | cmd, | |
int | null_ok = 0 | |||
) | [static] |
Definition at line 371 of file Main.cc.
Referenced by cmd_help(), HostDBContinuation::dnsEvent(), CacheProcessor::start_internal(), and HttpSM::update_stats().
static void syslog_log_configure | ( | ) | [static] |
Definition at line 994 of file Main.cc.
References ats_free(), Debug, facility_string_to_int(), and REC_ReadConfigStringAlloc.
Referenced by main().
int accept_mss = 0 [static] |
char action_tags[1024] = "" [static] |
const ArgumentDescription argument_descriptions[] [static] |
int auto_clear_hostdb_flag = 0 |
HttpBodyFactory* body_factory = NULL |
Definition at line 154 of file Main.cc.
Referenced by config_callback().
Definition at line 35 of file ClusterProcessor.cc.
char cluster_host[MAXDNAME+1] = DEFAULT_CLUSTER_HOST |
Definition at line 34 of file ClusterProcessor.cc.
int cmd_line_dprintf_level = 0 [static] |
int command_flag = DEFAULT_COMMAND_FLAG |
char command_string[512] = "" [static] |
Referenced by cmd_help(), cmd_index(), and cmd_mode().
volatile int delay_listen_for_cache_p = 0 [static] |
Definition at line 163 of file Main.cc.
Referenced by CB_After_Cache_Init(), and main().
inkcoreapi DiagsConfig* diagsConfig = NULL [static] |
bool enable_core_file_p = false [static] |
Definition at line 135 of file Main.cc.
Referenced by change_uid_gid(), and set_core_size().
char error_tags[1024] = "" [static] |
int fds_limit |
Definition at line 31 of file UnixNet.cc.
char* http_accept_port_descriptor [static] |
const long MAX_LOGIN = sysconf(_SC_LOGIN_NAME_MAX) <= 0 ? _POSIX_LOGIN_NAME_MAX : sysconf(_SC_LOGIN_NAME_MAX) [static] |
int num_accept_threads = 0 [static] |
Definition at line 36 of file ClusterProcessor.cc.
int num_of_net_threads = ink_number_of_processors() [static] |
int num_of_udp_threads = 0 [static] |
int num_task_threads = 0 [static] |
int poll_timeout = -1 [static] |
Definition at line 158 of file Main.cc.
Referenced by main(), and NetHandler::mainNetEvent().
char regression_test[1024] = "" [static] |
Definition at line 138 of file Main.cc.
Referenced by RegressionCont::mainEvent().
int remote_management_flag = DEFAULT_REMOTE_MANAGEMENT_FLAG |
int show_statistics = 0 [static] |
int syslog_facility = LOG_DAEMON [static] |
int version_flag = DEFAULT_VERSION_FLAG [static] |