1 /** @file
2 
3   A brief file description
4 
5   @section license License
6 
7   Licensed to the Apache Software Foundation (ASF) under one
8   or more contributor license agreements.  See the NOTICE file
9   distributed with this work for additional information
10   regarding copyright ownership.  The ASF licenses this file
11   to you under the Apache License, Version 2.0 (the
12   "License"); you may not use this file except in compliance
13   with the License.  You may obtain a copy of the License at
14 
15       http://www.apache.org/licenses/LICENSE-2.0
16 
17   Unless required by applicable law or agreed to in writing, software
18   distributed under the License is distributed on an "AS IS" BASIS,
19   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20   See the License for the specific language governing permissions and
21   limitations under the License.
22  */
23 
24 /****************************************************************************
25 
26    EventSystem.cc --
27 
28 
29 ****************************************************************************/
30 
31 #include "P_EventSystem.h"
32 
33 void
34 ink_event_system_init(ts::ModuleVersion v)
35 {
36   ink_release_assert(v.check(EVENT_SYSTEM_MODULE_INTERNAL_VERSION));
37   int config_max_iobuffer_size = DEFAULT_MAX_BUFFER_SIZE;
38   int iobuffer_advice          = 0;
39 
40   // For backwards compatibility make sure to allow thread_freelist_size
41   // This needs to change in 6.0
42   REC_EstablishStaticConfigInt32(thread_freelist_high_watermark, "proxy.config.allocator.thread_freelist_size");
43 
44   REC_EstablishStaticConfigInt32(thread_freelist_low_watermark, "proxy.config.allocator.thread_freelist_low_watermark");
45 
46   REC_ReadConfigInteger(config_max_iobuffer_size, "proxy.config.io.max_buffer_size");
47 
48   max_iobuffer_size = buffer_size_to_index(config_max_iobuffer_size, DEFAULT_BUFFER_SIZES - 1);
49   if (default_small_iobuffer_size > max_iobuffer_size) {
50     default_small_iobuffer_size = max_iobuffer_size;
51   }
52   if (default_large_iobuffer_size > max_iobuffer_size) {
53     default_large_iobuffer_size = max_iobuffer_size;
54   }
55 
56 #ifdef MADV_DONTDUMP // This should only exist on Linux 3.4 and higher.
57   RecBool dont_dump_enabled = true;
58   RecGetRecordBool("proxy.config.allocator.dontdump_iobuffers", &dont_dump_enabled, false);
59 
60   if (dont_dump_enabled) {
61     iobuffer_advice |= MADV_DONTDUMP;
62   }
63 #endif
64 
65   init_buffer_allocators(iobuffer_advice);
66 }
67