Data Structures | Defines | Functions | Variables

Main.cc File Reference

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"
Include dependency graph for Main.cc:

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 DiagsConfigdiagsConfig = NULL
HttpBodyFactorybody_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

Detailed Description

A brief file description.

License

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 Documentation

#define CMD_ERROR   -2

Definition at line 340 of file Main.cc.

#define CMD_FAILED   -1

Definition at line 341 of file Main.cc.

#define CMD_HELP   1

Definition at line 343 of file Main.cc.

#define CMD_IN_PROGRESS   2

Definition at line 344 of file Main.cc.

Referenced by main().

#define CMD_OK   0

Definition at line 342 of file Main.cc.

#define DEFAULT_COMMAND_FLAG   0

Definition at line 102 of file Main.cc.

#define DEFAULT_COMMAND_FLAG_TYPE   "F"

Definition at line 111 of file Main.cc.

#define DEFAULT_HTTP_ACCEPT_PORT_NUMBER   0

Definition at line 101 of file Main.cc.

#define DEFAULT_REMOTE_MANAGEMENT_FLAG   0

Definition at line 114 of file Main.cc.

#define DEFAULT_STACK_TRACE_FLAG   0

Definition at line 106 of file Main.cc.

#define DEFAULT_VERBOSE_FLAG   0

Definition at line 104 of file Main.cc.

#define DEFAULT_VERSION_FLAG   0

Definition at line 105 of file Main.cc.

#define DIAGS_LOG_FILENAME   "diags.log"

Definition at line 115 of file Main.cc.

Referenced by main().

#define SET_INTERVAL (   scope,
  name,
  var 
)
Value:
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().


Function Documentation

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]
static void CB_After_Cache_Init (  )  [static]
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.

Parameters:
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]

Definition at line 1014 of file Main.cc.

Referenced by main().

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]
static int cmd_clear ( char *  cmd  )  [static]
static int cmd_help ( char *  cmd  )  [static]

Definition at line 675 of file Main.cc.

References cmd_index(), commands, countof, and skip().

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]
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]
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]
static void init_system (  )  [static]
static void initialize_process_manager (  )  [static]
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().

static int set_core_size ( const char *  ,
RecDataT  ,
RecData  data,
void *   
) [static]

Definition at line 749 of file Main.cc.

References enable_core_file_p, EnableCoreFile(), RecData::rec_int, and Warning.

Referenced by init_core_size().

void shutdown_system (  ) 

Definition at line 336 of file Main.cc.

static char* skip ( char *  cmd,
int  null_ok = 0 
) [static]
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().


Variable Documentation

int accept_mss = 0 [static]

Definition at line 156 of file Main.cc.

Referenced by main().

char action_tags[1024] = "" [static]

Definition at line 151 of file Main.cc.

Definition at line 165 of file Main.cc.

Definition at line 167 of file Main.cc.

Definition at line 140 of file Main.cc.

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 144 of file Main.cc.

Definition at line 34 of file ClusterProcessor.cc.

int cmd_line_dprintf_level = 0 [static]

Definition at line 157 of file Main.cc.

Referenced by main().

int command_flag = DEFAULT_COMMAND_FLAG

Definition at line 136 of file Main.cc.

char command_string[512] = "" [static]

Definition at line 147 of file Main.cc.

struct CMD commands[] [static]

Referenced by cmd_help(), cmd_index(), and cmd_mode().

char core_file[255] = "" [static]

Definition at line 134 of file Main.cc.

Referenced by main().

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]

Definition at line 153 of file Main.cc.

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]

Definition at line 150 of file Main.cc.

int fds_limit

Definition at line 31 of file UnixNet.cc.

Definition at line 133 of file Main.cc.

Definition at line 132 of file Main.cc.

Referenced by main().

const long MAX_LOGIN = sysconf(_SC_LOGIN_NAME_MAX) <= 0 ? _POSIX_LOGIN_NAME_MAX : sysconf(_SC_LOGIN_NAME_MAX) [static]

Definition at line 117 of file Main.cc.

Referenced by main().

int num_accept_threads = 0 [static]

Definition at line 127 of file Main.cc.

Referenced by main().

Definition at line 36 of file ClusterProcessor.cc.

int num_of_net_threads = ink_number_of_processors() [static]

Definition at line 125 of file Main.cc.

Referenced by main().

int num_of_udp_threads = 0 [static]

Definition at line 126 of file Main.cc.

Referenced by main().

int num_task_threads = 0 [static]

Definition at line 128 of file Main.cc.

Referenced by main().

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

Definition at line 148 of file Main.cc.

int show_statistics = 0 [static]

Definition at line 152 of file Main.cc.

Referenced by main().

int syslog_facility = LOG_DAEMON [static]

Definition at line 984 of file Main.cc.

int version_flag = DEFAULT_VERSION_FLAG [static]

Definition at line 123 of file Main.cc.

Referenced by main().