You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2011/05/20 00:49:50 UTC
svn commit: r1125155 - in /trafficserver/traffic/trunk: lib/ts/ink_cap.cc
mgmt/Main.cc mgmt/RecordsConfig.cc proxy/Main.cc
Author: zwoop
Date: Thu May 19 22:49:50 2011
New Revision: 1125155
URL: http://svn.apache.org/viewvc?rev=1125155&view=rev
Log:
TS-792 Add a config option (disabled by default) to support mlock() and mlockall()
Modified:
trafficserver/traffic/trunk/lib/ts/ink_cap.cc
trafficserver/traffic/trunk/mgmt/Main.cc
trafficserver/traffic/trunk/mgmt/RecordsConfig.cc
trafficserver/traffic/trunk/proxy/Main.cc
Modified: trafficserver/traffic/trunk/lib/ts/ink_cap.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/lib/ts/ink_cap.cc?rev=1125155&r1=1125154&r2=1125155&view=diff
==============================================================================
--- trafficserver/traffic/trunk/lib/ts/ink_cap.cc (original)
+++ trafficserver/traffic/trunk/lib/ts/ink_cap.cc Thu May 19 22:49:50 2011
@@ -76,7 +76,7 @@ RestrictCapabilities() {
# if TS_USE_POSIX_CAP
cap_t caps = cap_init(); // start with nothing.
// Capabilities we need.
- cap_value_t cap_list[] = { CAP_NET_ADMIN, CAP_NET_BIND_SERVICE };
+ cap_value_t cap_list[] = { CAP_NET_ADMIN, CAP_NET_BIND_SERVICE, CAP_IPC_LOCK };
static int const CAP_COUNT = sizeof(cap_list)/sizeof(*cap_list);
cap_set_flag(caps, CAP_PERMITTED, CAP_COUNT, cap_list, CAP_SET);
Modified: trafficserver/traffic/trunk/mgmt/Main.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/mgmt/Main.cc?rev=1125155&r1=1125154&r2=1125155&view=diff
==============================================================================
--- trafficserver/traffic/trunk/mgmt/Main.cc (original)
+++ trafficserver/traffic/trunk/mgmt/Main.cc Thu May 19 22:49:50 2011
@@ -1224,7 +1224,7 @@ restoreCapabilities() {
int zret = 0; // return value.
cap_t cap_set = cap_get_proc(); // current capabilities
// Make a list of the capabilities we want turned on.
- cap_value_t cap_list[] = { CAP_NET_ADMIN, CAP_NET_BIND_SERVICE };
+ cap_value_t cap_list[] = { CAP_NET_ADMIN, CAP_NET_BIND_SERVICE, CAP_IPC_LOCK };
static int const CAP_COUNT = sizeof(cap_list)/sizeof(*cap_list);
cap_set_flag(cap_set, CAP_EFFECTIVE, CAP_COUNT, cap_list, CAP_SET);
Modified: trafficserver/traffic/trunk/mgmt/RecordsConfig.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/mgmt/RecordsConfig.cc?rev=1125155&r1=1125154&r2=1125155&view=diff
==============================================================================
--- trafficserver/traffic/trunk/mgmt/RecordsConfig.cc (original)
+++ trafficserver/traffic/trunk/mgmt/RecordsConfig.cc Thu May 19 22:49:50 2011
@@ -82,6 +82,9 @@ RecordElement RecordsConfig[] = {
,
{RECT_CONFIG, "proxy.config.stack_dump_enabled", RECD_INT, "1", RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL}
,
+ // 0 - Disabled, 1 - enabled for important pages (e.g. cache directory), 2 - enabled for all pages
+ {RECT_CONFIG, "proxy.config.mlock_enabled", RECD_INT, "0", RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL}
+ ,
{RECT_CONFIG, "proxy.config.cop.core_signal", RECD_INT, "0", RECU_NULL, RR_REQUIRED, RECC_NULL, NULL, RECA_NULL}
, // needed by traffic_cop
{RECT_CONFIG, "proxy.config.cop.linux_min_swapfree_kb", RECD_INT, "10240", RECU_NULL, RR_REQUIRED, RECC_NULL, NULL, RECA_NULL}
Modified: trafficserver/traffic/trunk/proxy/Main.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/Main.cc?rev=1125155&r1=1125154&r2=1125155&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/Main.cc (original)
+++ trafficserver/traffic/trunk/proxy/Main.cc Thu May 19 22:49:50 2011
@@ -326,7 +326,7 @@ init_system()
RecInt stackDump;
bool found = (RecGetRecordInt("proxy.config.stack_dump_enabled", &stackDump) == REC_ERR_OKAY);
- if(found == false) {
+ if (found == false) {
Warning("Unable to determine stack_dump_enabled , assuming enabled");
stackDump = 1;
}
@@ -337,9 +337,6 @@ init_system()
syslog(LOG_NOTICE, "NOTE: Server Version: %s", appVersionInfo.FullVersionInfoStr);
//
- // Check cycle counter resolution
- //
- //
// Delimit file Descriptors
//
fds_limit = set_rlimit(RLIMIT_NOFILE, true, false);
@@ -1655,6 +1652,7 @@ main(int argc, char **argv)
RestrictCapabilities();
xfree(user);
}
+
// Can't generate a log message yet, do that right after Diags is
// setup.
@@ -1678,6 +1676,19 @@ main(int argc, char **argv)
diags->dump();
DebugCapabilities("server"); // Can do this now, logging is up.
+ // Check if we should do mlockall()
+#if defined(MCL_FUTURE)
+ int mlock_flags = 0;
+ TS_ReadConfigInteger(mlock_flags, "proxy.config.mlock_enabled");
+
+ if (mlock_flags == 2) {
+ if (0 != mlockall(MCL_CURRENT | MCL_FUTURE))
+ Warning("Unable to mlockall() on startup");
+ else
+ Debug("server", "Succesfully called mlockall()");
+ }
+#endif
+
// Check for core file
if (core_file[0] != '\0') {
process_core(core_file);