You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by jp...@apache.org on 2015/01/15 06:18:11 UTC

trafficserver git commit: TS-3295: remove obsolete Compatability.h

Repository: trafficserver
Updated Branches:
  refs/heads/master a477ad721 -> c1c680459


TS-3295: remove obsolete Compatability.h


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/c1c68045
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/c1c68045
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/c1c68045

Branch: refs/heads/master
Commit: c1c680459bc69d0e2293eb64fff92485e8dd06f9
Parents: a477ad7
Author: James Peach <jp...@apache.org>
Authored: Thu Jan 8 13:21:56 2015 -0800
Committer: James Peach <jp...@apache.org>
Committed: Wed Jan 14 21:18:04 2015 -0800

----------------------------------------------------------------------
 CHANGES                       |  4 ++-
 iocore/cache/Cache.cc         |  5 +--
 lib/records/I_RecDefs.h       |  1 -
 lib/ts/Compatability.h        | 73 --------------------------------------
 lib/ts/Diags.cc               |  2 --
 lib/ts/List.h                 |  1 -
 lib/ts/Makefile.am            |  1 -
 lib/ts/MatcherUtils.cc        |  2 +-
 lib/ts/ink_defs.h             | 22 ++++++++++++
 lib/ts/ink_hrtime.h           | 16 ++-------
 lib/ts/libts.h                |  1 -
 mgmt/LocalManager.cc          |  1 -
 mgmt/MultiFile.cc             |  1 -
 proxy/InkAPI.cc               |  6 ++--
 proxy/Plugin.cc               |  1 -
 proxy/StatSystem.cc           |  3 +-
 proxy/hdrs/HdrToken.cc        |  1 -
 proxy/http/HttpBodyFactory.cc |  4 +--
 proxy/http/HttpConfig.cc      |  9 +----
 proxy/logging/LogUtils.cc     | 11 ------
 20 files changed, 38 insertions(+), 127 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c1c68045/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 001c687..7173d78 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,7 +1,9 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 5.3.0
 
-  *) [TS-3292] Make tr-pass work for SSL. 
+  *) [TS-3295] Remove obsolete Compatability.h header.
+
+  *) [TS-3292] Make tr-pass work for SSL.
    Author: Lev Stipakov <ls...@gmail.com>
 
   *) [TS-3291] Remove remnants from "dev" builds from configure.ac.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c1c68045/iocore/cache/Cache.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/Cache.cc b/iocore/cache/Cache.cc
index 50b2fc7..fd99aa7 100644
--- a/iocore/cache/Cache.cc
+++ b/iocore/cache/Cache.cc
@@ -577,7 +577,7 @@ CacheProcessor::start(int, size_t)
   return start_internal(0);
 }
 
-static const int DEFAULT_CACHE_OPTIONS = (O_RDWR | _O_ATTRIB_OVERLAPPED);
+static const int DEFAULT_CACHE_OPTIONS = (O_RDWR);
 
 int
 CacheProcessor::start_internal(int flags)
@@ -633,10 +633,11 @@ CacheProcessor::start_internal(int flags)
       ink_strlcat(path, "/cache.db", sizeof(path));
       opts |= O_CREAT;
     }
-    opts |= _O_ATTRIB_OVERLAPPED;
+
 #ifdef O_DIRECT
     opts |= O_DIRECT;
 #endif
+
 #ifdef O_DSYNC
     opts |= O_DSYNC;
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c1c68045/lib/records/I_RecDefs.h
----------------------------------------------------------------------
diff --git a/lib/records/I_RecDefs.h b/lib/records/I_RecDefs.h
index d423cec..94b3a06 100644
--- a/lib/records/I_RecDefs.h
+++ b/lib/records/I_RecDefs.h
@@ -24,7 +24,6 @@
 #ifndef _I_REC_DEFS_H_
 #define _I_REC_DEFS_H_
 
-#include "Compatability.h"
 #include "ink_mutex.h"
 #include "ink_rwlock.h"
 #include "I_RecMutex.h"

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c1c68045/lib/ts/Compatability.h
----------------------------------------------------------------------
diff --git a/lib/ts/Compatability.h b/lib/ts/Compatability.h
deleted file mode 100644
index c88d4ba..0000000
--- a/lib/ts/Compatability.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/** @file
-
-  A brief file description
-
-  @section license 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.
- */
-
-#if !defined (_Compatability_h_)
-#define _Compatability_h_
-
-#include <sys/types.h>
-#include <sys/uio.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <strings.h>
-
-#include "ink_defs.h"
-
-// We can't use #define for min and max becuase it will conflict with
-// other declarations of min and max functions.  This conflict
-// occurs with STL
-template<class T> T min(const T a, const T b)
-{
-  return a < b ? a : b;
-}
-
-template<class T> T max(const T a, const T b)
-{
-  return a > b ? a : b;
-}
-
-#define _O_ATTRIB_NORMAL  0x0000
-#define _O_ATTRIB_OVERLAPPED 0x0000
-
-//
-// If you the gethostbyname() routines on your system are automatically
-// re-entrent (as in Digital Unix), define the following
-//
-#if defined(linux)
-#define NEED_ALTZONE_DEFINED
-#define MAP_SHARED_MAP_NORESERVE (MAP_SHARED)
-#elif defined(darwin)
-#define MAP_SHARED_MAP_NORESERVE (MAP_SHARED)
-#elif defined(solaris)
-#define NEED_ALTZONE_DEFINED
-#define MAP_SHARED_MAP_NORESERVE (MAP_SHARED | MAP_NORESERVE)
-#else
-#define MAP_SHARED_MAP_NORESERVE (MAP_SHARED | MAP_NORESERVE)
-#endif
-
-#if defined(darwin)
-typedef uint32_t in_addr_t;
-#endif
-
-#define NEED_HRTIME
-
-#endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c1c68045/lib/ts/Diags.cc
----------------------------------------------------------------------
diff --git a/lib/ts/Diags.cc b/lib/ts/Diags.cc
index ba84941..a7ce61d 100644
--- a/lib/ts/Diags.cc
+++ b/lib/ts/Diags.cc
@@ -42,8 +42,6 @@
 #include "ink_time.h"
 #include "ink_hrtime.h"
 #include "Diags.h"
-#include "Compatability.h"
-
 
 int diags_on_for_plugins = 0;
 bool DiagsConfigState::enabled[2] = { false, false };

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c1c68045/lib/ts/List.h
----------------------------------------------------------------------
diff --git a/lib/ts/List.h b/lib/ts/List.h
index 4faa327..f447b15 100644
--- a/lib/ts/List.h
+++ b/lib/ts/List.h
@@ -58,7 +58,6 @@
 
 #include "ink_assert.h"
 #include "ink_queue.h"
-#include "Compatability.h"
 #include "defalloc.h"
 
 //

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c1c68045/lib/ts/Makefile.am
----------------------------------------------------------------------
diff --git a/lib/ts/Makefile.am b/lib/ts/Makefile.am
index 150182d..d5ca4ac 100644
--- a/lib/ts/Makefile.am
+++ b/lib/ts/Makefile.am
@@ -45,7 +45,6 @@ libtsutil_la_SOURCES = \
   Arena.h \
   Bitops.cc \
   Bitops.h \
-  Compatability.h \
   ConsistentHash.cc \
   ConsistentHash.h \
   Cryptohash.h \

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c1c68045/lib/ts/MatcherUtils.cc
----------------------------------------------------------------------
diff --git a/lib/ts/MatcherUtils.cc b/lib/ts/MatcherUtils.cc
index 2254738..0ef3e4f 100644
--- a/lib/ts/MatcherUtils.cc
+++ b/lib/ts/MatcherUtils.cc
@@ -54,7 +54,7 @@ readIntoBuffer(const char *file_path, const char *module_name, int *read_size_pt
   }
   // Open the file for Blocking IO.  We will be reading this
   //   at start up and infrequently afterward
-  if ((fd = open(file_path, O_RDONLY | _O_ATTRIB_NORMAL)) < 0) {
+  if ((fd = open(file_path, O_RDONLY)) < 0) {
     Error("%s Can not open %s file : %s", module_name, file_path, strerror(errno));
     return NULL;
   }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c1c68045/lib/ts/ink_defs.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_defs.h b/lib/ts/ink_defs.h
index ff03b61..478d78a 100644
--- a/lib/ts/ink_defs.h
+++ b/lib/ts/ink_defs.h
@@ -27,6 +27,7 @@
 
 #include "ink_config.h"
 #include <stddef.h>
+#include <sys/mman.h>
 
 #ifdef HAVE_STDINT_H
 # include <stdint.h>
@@ -100,6 +101,21 @@ countof(const T (&)[N]) {
 #define MIN(x,y) (((x) <= (y)) ? (x) : (y))
 #endif
 
+#ifdef __cplusplus
+// We can't use #define for min and max because it will conflict with
+// other declarations of min and max functions.  This conflict
+// occurs with STL
+template<class T> T min(const T a, const T b)
+{
+  return a < b ? a : b;
+}
+
+template<class T> T max(const T a, const T b)
+{
+  return a > b ? a : b;
+}
+#endif
+
 #define ATS_UNUSED __attribute__ ((unused))
 #define ATS_WARN_IF_UNUSED __attribute__ ((warn_unused_result))
 #define	ATS_UNUSED_RETURN(x)	if (x) {}
@@ -120,6 +136,12 @@ countof(const T (&)[N]) {
 #define ROUNDUP(x, y) ((((x)+((y)-1))/(y))*(y))
 #endif
 
+#if defined(MAP_NORESERVE)
+#define MAP_SHARED_MAP_NORESERVE (MAP_SHARED | MAP_NORESERVE)
+#else
+#define MAP_SHARED_MAP_NORESERVE (MAP_SHARED)
+#endif
+
 /* Variables
 */
 extern int debug_level;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c1c68045/lib/ts/ink_hrtime.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_hrtime.h b/lib/ts/ink_hrtime.h
index bf7c9b7..8fb3300 100644
--- a/lib/ts/ink_hrtime.h
+++ b/lib/ts/ink_hrtime.h
@@ -33,21 +33,13 @@
 
 #include "ink_config.h"
 #include "ink_assert.h"
-#include "Compatability.h"
-
-int squid_timestamp_to_buf(char *buf, unsigned int buf_size, long timestamp_sec, long timestamp_usec);
-char *int64_to_str(char *buf, unsigned int buf_size, int64_t val, unsigned int *total_chars, unsigned int req_width=0, char pad_char='0');
-
-#ifdef NEED_HRTIME
 #include <time.h>
 #include <sys/time.h>
 #include <stdlib.h>
 typedef int64_t ink_hrtime;
-#else /* !defined (NEED_HRTIME) */
-#include <sys/time.h>
-typedef hrtime_t ink_hrtime;
-#endif
 
+int squid_timestamp_to_buf(char *buf, unsigned int buf_size, long timestamp_sec, long timestamp_usec);
+char *int64_to_str(char *buf, unsigned int buf_size, int64_t val, unsigned int *total_chars, unsigned int req_width=0, char pad_char='0');
 
 //////////////////////////////////////////////////////////////////////////////
 //
@@ -255,7 +247,6 @@ ink_hrtime_to_timeval2(ink_hrtime t, struct timeval *tv)
 static inline ink_hrtime
 ink_get_hrtime_internal()
 {
-#if defined (NEED_HRTIME)
 #if defined (USE_TIME_STAMP_COUNTER_HRTIME)
   return get_hrtime_rdtsc();
 #elif defined(freebsd)
@@ -267,9 +258,6 @@ ink_get_hrtime_internal()
   gettimeofday(&tv, NULL);
   return ink_hrtime_from_timeval(&tv);
 #endif
-#else /* !defined (NEED_HRTIME) */
-  return gethrtime();
-#endif
 }
 
 static inline ink_hrtime

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c1c68045/lib/ts/libts.h
----------------------------------------------------------------------
diff --git a/lib/ts/libts.h b/lib/ts/libts.h
index c7cbc5e..8a3d9fa 100644
--- a/lib/ts/libts.h
+++ b/lib/ts/libts.h
@@ -78,7 +78,6 @@
 #include "Allocator.h"
 #include "Arena.h"
 #include "Bitops.h"
-#include "Compatability.h"
 #include "ConsistentHash.h"
 #include "DynArray.h"
 #include "EventNotify.h"

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c1c68045/mgmt/LocalManager.cc
----------------------------------------------------------------------
diff --git a/mgmt/LocalManager.cc b/mgmt/LocalManager.cc
index bb54405..6bd1acf 100644
--- a/mgmt/LocalManager.cc
+++ b/mgmt/LocalManager.cc
@@ -26,7 +26,6 @@
 #include "ink_platform.h"
 #include "MgmtUtils.h"
 #include "I_Layout.h"
-#include "Compatability.h"
 #include "LocalManager.h"
 #include "MgmtSocket.h"
 #include "ink_cap.h"

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c1c68045/mgmt/MultiFile.cc
----------------------------------------------------------------------
diff --git a/mgmt/MultiFile.cc b/mgmt/MultiFile.cc
index 38c0bb2..2c88202 100644
--- a/mgmt/MultiFile.cc
+++ b/mgmt/MultiFile.cc
@@ -29,7 +29,6 @@
 #include "ink_string.h"
 #include "ink_time.h"
 
-#include "Compatability.h"
 #include "MgmtUtils.h"
 #include "MultiFile.h"
 #include "ExpandingArray.h"

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c1c68045/proxy/InkAPI.cc
----------------------------------------------------------------------
diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc
index 93cb80d..c59573e 100644
--- a/proxy/InkAPI.cc
+++ b/proxy/InkAPI.cc
@@ -721,19 +721,19 @@ FileImpl::fopen(const char *filename, const char *mode)
       return 0;
     }
     m_mode = READ;
-    m_fd = open(filename, O_RDONLY | _O_ATTRIB_NORMAL);
+    m_fd = open(filename, O_RDONLY);
   } else if (mode[0] == 'w') {
     if (mode[1] != '\0') {
       return 0;
     }
     m_mode = WRITE;
-    m_fd = open(filename, O_WRONLY | O_CREAT | _O_ATTRIB_NORMAL, 0644);
+    m_fd = open(filename, O_WRONLY | O_CREAT, 0644);
   } else if (mode[0] == 'a') {
     if (mode[1] != '\0') {
       return 0;
     }
     m_mode = WRITE;
-    m_fd = open(filename, O_WRONLY | O_CREAT | O_APPEND | _O_ATTRIB_NORMAL, 0644);
+    m_fd = open(filename, O_WRONLY | O_CREAT | O_APPEND, 0644);
   }
 
   if (m_fd < 0) {

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c1c68045/proxy/Plugin.cc
----------------------------------------------------------------------
diff --git a/proxy/Plugin.cc b/proxy/Plugin.cc
index 4b0780f..dd675cc 100644
--- a/proxy/Plugin.cc
+++ b/proxy/Plugin.cc
@@ -24,7 +24,6 @@
 #include <stdio.h>
 #include "ink_platform.h"
 #include "ink_file.h"
-#include "Compatability.h"
 #include "ParseRules.h"
 #include "I_RecCore.h"
 #include "I_Layout.h"

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c1c68045/proxy/StatSystem.cc
----------------------------------------------------------------------
diff --git a/proxy/StatSystem.cc b/proxy/StatSystem.cc
index 87e4d5e..45e6076 100644
--- a/proxy/StatSystem.cc
+++ b/proxy/StatSystem.cc
@@ -182,8 +182,7 @@ persistent_stat(int i)
 static int
 open_stats_snap()
 {
-  int fd = socketManager.open(snap_filename,
-                              O_CREAT | O_RDWR | _O_ATTRIB_NORMAL);
+  int fd = socketManager.open(snap_filename, O_CREAT | O_RDWR);
   if (fd < 0) {
     Warning("unable to open %s: %s", snap_filename, strerror(-fd));
     return -1;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c1c68045/proxy/hdrs/HdrToken.cc
----------------------------------------------------------------------
diff --git a/proxy/hdrs/HdrToken.cc b/proxy/hdrs/HdrToken.cc
index c1de6a1..4bcf956 100644
--- a/proxy/hdrs/HdrToken.cc
+++ b/proxy/hdrs/HdrToken.cc
@@ -24,7 +24,6 @@
 #include "libts.h"
 #include <stdio.h>
 #include "Allocator.h"
-#include "Compatability.h"
 #include "HTTP.h"
 #include "HdrToken.h"
 #include "MIME.h"

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c1c68045/proxy/http/HttpBodyFactory.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpBodyFactory.cc b/proxy/http/HttpBodyFactory.cc
index 05e774b..7c3fbc5 100644
--- a/proxy/http/HttpBodyFactory.cc
+++ b/proxy/http/HttpBodyFactory.cc
@@ -772,7 +772,7 @@ HttpBodySet::init(char *set, char *dir)
   char buffer[1024], name[1025], value[1024];
 
   ink_filepath_make(info_path, sizeof(info_path), dir, ".body_factory_info");
-  fd = open(info_path, O_RDONLY | _O_ATTRIB_NORMAL);
+  fd = open(info_path, O_RDONLY);
   if (fd < 0)
     return (-1);
 
@@ -961,7 +961,7 @@ HttpBodyTemplate::load_from_file(char *dir, char *file)
   ///////////////////
 
   // coverity[toctou]
-  fd = open(path, O_RDONLY | _O_ATTRIB_NORMAL);
+  fd = open(path, O_RDONLY);
   if (fd < 0)
     return (0);
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c1c68045/proxy/http/HttpConfig.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpConfig.cc b/proxy/http/HttpConfig.cc
index bc345d9..5ac0892 100644
--- a/proxy/http/HttpConfig.cc
+++ b/proxy/http/HttpConfig.cc
@@ -33,13 +33,6 @@
 #include "P_RecUtils.h"
 #include <records/I_RecHttp.h>
 
-#ifndef min
-#define         min(a,b)        ((a) < (b) ? (a) : (b))
-#endif
-#ifndef max
-#define         max(a,b)        ((a) > (b) ? (a) : (b))
-#endif
-
 #define HttpEstablishStaticConfigStringAlloc(_ix,_n) \
   REC_EstablishStaticConfigStringAlloc(_ix,_n); \
   REC_RegisterConfigUpdateFunc(_n, http_config_cb, NULL)
@@ -1618,7 +1611,7 @@ HttpConfig::reconfigure()
 
   params->oride.cache_heuristic_min_lifetime = m_master.oride.cache_heuristic_min_lifetime;
   params->oride.cache_heuristic_max_lifetime = m_master.oride.cache_heuristic_max_lifetime;
-  params->oride.cache_heuristic_lm_factor = min(max(m_master.oride.cache_heuristic_lm_factor, 0), 1);
+  params->oride.cache_heuristic_lm_factor = min(max(m_master.oride.cache_heuristic_lm_factor, 0.0f), 1.0f);
 
   params->oride.cache_guaranteed_min_lifetime = m_master.oride.cache_guaranteed_min_lifetime;
   params->oride.cache_guaranteed_max_lifetime = m_master.oride.cache_guaranteed_max_lifetime;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c1c68045/proxy/logging/LogUtils.cc
----------------------------------------------------------------------
diff --git a/proxy/logging/LogUtils.cc b/proxy/logging/LogUtils.cc
index f0d9a59..cd95754 100644
--- a/proxy/logging/LogUtils.cc
+++ b/proxy/logging/LogUtils.cc
@@ -43,9 +43,6 @@
 // REC_SIGNAL_LOGGING_ERROR    is defined in I_RecSignals.h
 // REC_SIGNAL_LOGGING_WARNING  is defined in I_RecSignals.h
 
-
-#include "Compatability.h"
-
 #include "LogUtils.h"
 #include "LogLimits.h"
 
@@ -104,17 +101,9 @@ LogUtils::timestamp_to_netscape_str(long timestamp)
     // most of this garbage is simply to find out the offset from GMT,
     // taking daylight savings into account.
     //
-#ifdef NEED_ALTZONE_DEFINED
-    time_t altzone = timezone;
-#endif
     struct tm res;
     struct tm *tms = ink_localtime_r((const time_t *) &timestamp, &res);
-    // TODO: Not sure this makes sense, can altzone actually be != timezone ??
-#ifdef NEED_ALTZONE_DEFINED
-    long zone = (tms->tm_isdst > 0) ? altzone : timezone;
-#else
     long zone = -tms->tm_gmtoff;        // double negative!
-#endif
     int offset;
     char sign;