This is an automated email from the ASF dual-hosted git repository.
bneradt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new 29686d0556 Remove many old HAVE_*_H configure build vars (#11029)
29686d0556 is described below
commit 29686d055612881b773730ab428de114a82b8867
Author: Phong Nguyen <[email protected]>
AuthorDate: Tue Feb 6 09:27:58 2024 -0800
Remove many old HAVE_*_H configure build vars (#11029)
Replace automake-style HAVE_INCLUDE_H compile flags with #if __has_include
preprocessor directives.
---
CMakeLists.txt | 39 ++++----------------
include/tscore/ParseRules.h | 4 +-
include/tscore/ink_config.h.cmake.in | 32 ++--------------
include/tscore/ink_file.h | 4 +-
include/tscore/ink_memory.h | 11 +++---
include/tscore/ink_platform.h | 45 +++++++----------------
include/tscore/ink_thread.h | 4 +-
plugins/experimental/system_stats/system_stats.cc | 6 +--
plugins/header_rewrite/conditions.cc | 17 ++-------
plugins/tcpinfo/tcpinfo.cc | 20 ++++------
src/cripts/Connections.cc | 6 +--
src/proxy/logging/LogConfig.cc | 4 --
src/traffic_server/traffic_server.cc | 2 +-
src/tscore/ink_cap.cc | 4 +-
src/tscore/ink_file.cc | 16 --------
src/tscore/ink_hrtime.cc | 6 +--
src/tscore/ink_res_init.cc | 2 -
src/tscore/ink_res_mkquery.cc | 2 -
18 files changed, 57 insertions(+), 167 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3049bbada3..8f927dbc5a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -213,33 +213,6 @@ include(CheckSourceCompiles)
include(CheckStructHasMember)
check_include_file(ifaddrs.h HAVE_IFADDRS_H)
-check_include_file(string.h HAVE_STRING_H)
-check_include_file(malloc.h HAVE_MALLOC_H)
-check_include_file(mcheck.h HAVE_MCHECK_H)
-check_include_file(sys/disk.h HAVE_SYS_DISK_H)
-check_include_file(sys/disklabel.h HAVE_SYS_DISKLABEL_H)
-check_include_file(sys/ioctl.h HAVE_SYS_IOCTL_H)
-check_include_file(sys/sockio.h HAVE_SYS_SOCKIO_H)
-check_include_file(sys/stat.h HAVE_SYS_STAT_H)
-check_include_file(sys/statfs.h HAVE_SYS_STATFS_H)
-check_include_file(sys/statvfs.h HAVE_SYS_STATVFS_H)
-check_include_file(sys/uio.h HAVE_SYS_UIO_H)
-check_include_file(sys/sysinfo.h HAVE_SYS_SYSINFO_H)
-check_include_file(sys/sysmacros.h HAVE_SYS_SYSMACROS_H)
-check_include_file(sys/systeminfo.h HAVE_SYS_SYSTEMINFO_H)
-check_include_file(sys/sysctl.h HAVE_SYS_SYSCTL_H)
-check_include_file(sys/mman.h HAVE_SYS_MMAN_H)
-check_include_file(sys/mount.h HAVE_SYS_MOUNT_H)
-check_include_file(sys/param.h HAVE_SYS_PARAM_H)
-check_include_file(netinet/in.h HAVE_NETINET_IN_H)
-check_include_file(netinet/in_systm.h HAVE_NETINET_IN_SYSTM_H)
-check_include_file(netinet/tcp.h HAVE_NETINET_TCP_H)
-check_include_file(netinet/ip.h HAVE_NETINET_IP_H)
-check_include_file(netinet/ip_icmp.h HAVE_NETINET_IP_ICMP_H)
-check_include_file(netdb.h HAVE_NETDB_H)
-check_include_file(arpa/inet.h HAVE_ARPA_INET_H)
-check_include_file(arpa/nameser.h HAVE_ARPA_NAMESER_H)
-check_include_file(arpa/nameser_compat.h HAVE_ARPA_NAMESER_COMPAT_H)
# Find libraries
if(ENABLE_CRIPTS)
@@ -397,7 +370,7 @@ check_symbol_exists(getpeereid unistd.h HAVE_GETPEEREID)
check_symbol_exists(getpeerucred unistd.h HAVE_GETPEERUCRED)
check_symbol_exists(getresuid unistd.h HAVE_GETRESUID)
check_symbol_exists(getresgid unistd.h HAVE_GETRESGID)
-check_symbol_exists(malloc_usable_size malloc.h HAVE_MALLOC_USABLE_SIZE)
+check_symbol_exists(malloc_usable_size "malloc.h;malloc_np.h"
HAVE_MALLOC_USABLE_SIZE)
check_symbol_exists(mcheck_pedantic mcheck.h HAVE_MCHECK_PEDANTIC)
check_symbol_exists(posix_fadvise fcntl.h HAVE_POSIX_FADVISE)
check_symbol_exists(posix_fallocate fcntl.h HAVE_POSIX_FALLOCATE)
@@ -410,8 +383,7 @@ check_symbol_exists(sendmmsg sys/socket.h HAVE_SENDMMSG)
check_symbol_exists(strlcat string.h HAVE_STRLCAT)
check_symbol_exists(strlcpy string.h HAVE_STRLCPY)
check_symbol_exists(strsignal string.h HAVE_STRSIGNAL)
-check_symbol_exists(pthread_mutexattr_settype pthread.h
HAVE_PTHREAD_MUTEXATTR_SETTYPE)
-
+check_symbol_exists(sysinfo sys/sysinfo.h HAVE_SYSINFO)
if(TS_USE_HWLOC)
check_source_compiles(
C "#include <hwloc.h>
@@ -485,7 +457,12 @@ set(CMAKE_REQUIRED_INCLUDES netinet/in.h netinet/tcp.h)
check_type_size("struct tcp_info" STRUCT_TCP_INFO)
unset(CMAKE_REQUIRED_INCLUDES)
-check_struct_has_member("struct tcp_info" tcpi_data_segs_out "linux/tcp.h"
HAVE_STRUCT_LINUX_TCP_INFO)
+# Since Linux 2.6.12
+check_struct_has_member("struct tcp_info" tcpi_total_retrans "linux/tcp.h"
HAVE_STRUCT_TCP_INFO_TCPI_TOTAL_RETRANS)
+# Since Linux 4.6
+check_struct_has_member("struct tcp_info" tcpi_data_segs_out "linux/tcp.h"
HAVE_STRUCT_TCP_INFO_TCPI_DATA_SEGS_OUT)
+# Since FreeBSD 6
+check_struct_has_member("struct tcp_info" __tcpi_retrans "netinet/tcp.h"
HAVE_STRUCT_TCP_INFO___TCPI_RETRANS)
check_struct_has_member("struct sockaddr" sa_len "netinet/in.h"
HAVE_STRUCT_SOCKADDR_SA_LEN)
check_struct_has_member("struct sockaddr_in" sin_len "netinet/in.h"
HAVE_STRUCT_SOCKADDR_IN_SIN_LEN)
check_struct_has_member("struct sockaddr_in6" sin6_len "netinet/in.h"
HAVE_STRUCT_SOCKADDR_IN6_SIN6_LEN)
diff --git a/include/tscore/ParseRules.h b/include/tscore/ParseRules.h
index 31e671cc64..408e069203 100644
--- a/include/tscore/ParseRules.h
+++ b/include/tscore/ParseRules.h
@@ -24,10 +24,8 @@
#pragma once
#include <cstring>
-// I had to move this here, because I really needed to avoid including
ink_platform.h in here,
-// because of a conflict on linux/tcp.h vs netinet/tcp.h.
-#include <limits.h> // NOLINT(modernize-deprecated-headers)
+#include "tscore/ink_platform.h"
#include "tscore/ink_defs.h"
#include "tscore/ink_apidefs.h"
diff --git a/include/tscore/ink_config.h.cmake.in
b/include/tscore/ink_config.h.cmake.in
index 6f7a065685..bdb1069008 100644
--- a/include/tscore/ink_config.h.cmake.in
+++ b/include/tscore/ink_config.h.cmake.in
@@ -42,34 +42,8 @@
#cmakedefine HAVE_LZMA_H 1
#cmakedefine HAVE_IFADDRS_H 1
#cmakedefine HAVE_LINUX_HDREG_H 1
-#cmakedefine HAVE_MALLOC_H 1
-#cmakedefine HAVE_MCHECK_H 1
-#cmakedefine HAVE_SYS_DISK_H 1
-#cmakedefine HAVE_SYS_DISKLABEL_H 1
#cmakedefine HAVE_SYS_CAPABILITY_H 1
-#cmakedefine HAVE_SYS_IOCTL_H 1
#cmakedefine HAVE_SYS_PRCTL_H 1
-#cmakedefine HAVE_SYS_SOCKIO_H 1
-#cmakedefine HAVE_SYS_STAT_H 1
-#cmakedefine HAVE_SYS_STATFS_H 1
-#cmakedefine HAVE_SYS_STATVFS_H 1
-#cmakedefine HAVE_SYS_UIO_H 1
-#cmakedefine HAVE_SYS_SYSINFO_H 1
-#cmakedefine HAVE_SYS_SYSMACROS_H 1
-#cmakedefine HAVE_SYS_SYSTEMINFO_H 1
-#cmakedefine HAVE_SYS_SYSCTL_H 1
-#cmakedefine HAVE_SYS_MMAN_H 1
-#cmakedefine HAVE_SYS_MOUNT_H 1
-#cmakedefine HAVE_SYS_PARAM_H 1
-#cmakedefine HAVE_NETINET_IN_H 1
-#cmakedefine HAVE_NETINET_IN_SYSTM_H 1
-#cmakedefine HAVE_NETINET_TCP_H 1
-#cmakedefine HAVE_NETINET_IP_ICMP_H 1
-#cmakedefine HAVE_NETINET_IP_H 1
-#cmakedefine HAVE_NETDB_H 1
-#cmakedefine HAVE_ARPA_INET_H 1
-#cmakedefine HAVE_ARPA_NAMESER_H 1
-#cmakedefine HAVE_ARPA_NAMESER_COMPAT_H 1
#cmakedefine HAVE_MALLOC_USABLE_SIZE 1
#cmakedefine HAVE_MCHECK_PEDANTIC 1
#cmakedefine HAVE_POSIX_FADVISE 1
@@ -96,7 +70,7 @@
#cmakedefine01 HAVE_STRLCAT
#cmakedefine01 HAVE_STRLCPY
#cmakedefine01 HAVE_STRSIGNAL
-#cmakedefine01 HAVE_PTHREAD_MUTEXATTR_SETTYPE
+#cmakedefine01 HAVE_SYSINFO
#cmakedefine01 HAVE_HWLOC_OBJ_PU
@@ -114,7 +88,9 @@
#cmakedefine HAVE_MD5_INIT 1
#cmakedefine HAVE_STRUCT_TCP_INFO 1
-#cmakedefine HAVE_STRUCT_LINUX_TCP_INFO 1
+#cmakedefine HAVE_STRUCT_TCP_INFO_TCPI_TOTAL_RETRANS 1
+#cmakedefine HAVE_STRUCT_TCP_INFO_TCPI_DATA_SEGS_OUT 1
+#cmakedefine HAVE_STRUCT_TCP_INFO___TCPI_RETRANS 1
#cmakedefine HAVE_STRUCT_SOCKADDR_SA_LEN 1
#cmakedefine HAVE_STRUCT_SOCKADDR_IN_SIN_LEN 1
#cmakedefine HAVE_STRUCT_SOCKADDR_IN6_SIN6_LEN 1
diff --git a/include/tscore/ink_file.h b/include/tscore/ink_file.h
index a28ea5802b..d2e354df38 100644
--- a/include/tscore/ink_file.h
+++ b/include/tscore/ink_file.h
@@ -38,11 +38,11 @@
#include <dirent.h>
#include <stdint.h>
-#if HAVE_SYS_STATFS_H
+#if __has_include(<sys/statfs.h>)
#include <sys/statfs.h>
#endif
-#if HAVE_SYS_STATVFS_H
+#if __has_include(<sys/statvfs.h>)
#include <sys/statvfs.h>
#endif
diff --git a/include/tscore/ink_memory.h b/include/tscore/ink_memory.h
index 9c3f651f72..ec6b944c5a 100644
--- a/include/tscore/ink_memory.h
+++ b/include/tscore/ink_memory.h
@@ -36,13 +36,9 @@
#include <sys/types.h>
-#if HAVE_SYS_UIO_H
#include <sys/uio.h>
-#endif
-#if HAVE_SYS_MMAN_H
#include <sys/mman.h>
-#endif
#if TS_HAS_JEMALLOC
#if __has_include(<jemalloc/jemalloc.h>)
@@ -52,8 +48,13 @@
#endif
#elif TS_HAS_MIMALLOC
#include <mimalloc.h>
-#elif HAVE_MALLOC_H
+#elif __has_include(<malloc/malloc.h>)
+#include <malloc/malloc.h>
+#elif __has_include(<malloc.h>)
#include <malloc.h>
+#if __has_include(<malloc_np.h>)
+#include <malloc_np.h>
+#endif
#endif // ! TS_HAS_JEMALLOC
#ifndef MADV_NORMAL
diff --git a/include/tscore/ink_platform.h b/include/tscore/ink_platform.h
index edc2f7f50f..a7e4538ad7 100644
--- a/include/tscore/ink_platform.h
+++ b/include/tscore/ink_platform.h
@@ -63,38 +63,28 @@ struct ifafilt;
#include <stdlib.h> // NOLINT(modernize-deprecated-headers)
#include <ctype.h> // NOLINT(modernize-deprecated-headers)
#include <string.h> // NOLINT(modernize-deprecated-headers)
+
#include <sys/types.h>
-#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
-#endif
+
#include <unistd.h>
-#ifdef HAVE_NETINET_IN_H
+
#include <netinet/in.h>
-#endif
-#ifdef HAVE_NETINET_IN_SYSTM_H
#include <netinet/in_systm.h>
-#endif
-#ifdef HAVE_NETINET_TCP_H
+// This is a bit of a hack, to get the more linux specific tcp_info struct ...
+#if __has_include(<linux/tcp.h>)
+#include <linux/tcp.h>
+#else
#include <netinet/tcp.h>
#endif
-#ifdef HAVE_NETINET_IP_H
#include <netinet/ip.h>
-#endif
-#ifdef HAVE_NETINET_IP_ICMP_H
#include <netinet/ip_icmp.h>
-#endif
-#ifdef HAVE_NETDB_H
+
#include <netdb.h>
-#endif
-#ifdef HAVE_ARPA_INET_H
+
#include <arpa/inet.h>
-#endif
-#ifdef HAVE_ARPA_NAMESER_H
#include <arpa/nameser.h>
-#endif
-#ifdef HAVE_ARPA_NAMESER_COMPAT_H
#include <arpa/nameser_compat.h>
-#endif
#include <signal.h> // NOLINT(modernize-deprecated-headers)
@@ -111,36 +101,27 @@ struct ifafilt;
#include "tscore/ink_endian.h"
-#ifdef HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
-#endif
-#ifdef HAVE_SYS_SOCKIO_H
-#include <sys/sockio.h>
-#endif
#if defined(__linux__)
using in_addr_t = unsigned int;
#endif
-#ifdef HAVE_SYS_SYSINFO_H
+#if __has_include(<sys/sysinfo.h>)
#include <sys/sysinfo.h>
#endif
-#if defined(darwin) || defined(freebsd)
-#ifdef HAVE_SYS_SYSCTL_H
+#if defined(__APPLE__) || defined(__FreeBSD__)
+#if __has_include(<sys/sysctl.h>)
#include <sys/sysctl.h>
#endif
#endif
-#ifdef HAVE_SYS_SYSTEMINFO_H
-#include <sys/systeminfo.h>
-#endif
-
#include <dlfcn.h>
#include <float.h> // NOLINT(modernize-deprecated-headers)
-#ifdef HAVE_SYS_SYSMACROS_H
+#if __has_include(<sys/sysmacros.h>)
#include <sys/sysmacros.h>
#endif
diff --git a/include/tscore/ink_thread.h b/include/tscore/ink_thread.h
index e2beb4d147..f5f5743986 100644
--- a/include/tscore/ink_thread.h
+++ b/include/tscore/ink_thread.h
@@ -42,11 +42,11 @@
#include <csignal>
#include <semaphore.h>
-#if HAVE_PTHREAD_NP_H
+#if __has_include(<pthread_np.h>)
#include <pthread_np.h>
#endif
-#if HAVE_SYS_PRCTL_H && defined(PR_SET_NAME)
+#if __has_include(<sys/prctl.h>) && defined(PR_SET_NAME)
#include <sys/prctl.h>
#endif
diff --git a/plugins/experimental/system_stats/system_stats.cc
b/plugins/experimental/system_stats/system_stats.cc
index 648f7e2749..77d42f6df6 100644
--- a/plugins/experimental/system_stats/system_stats.cc
+++ b/plugins/experimental/system_stats/system_stats.cc
@@ -45,7 +45,7 @@
#include <sys/types.h>
#include <chrono>
-#ifdef HAVE_SYS_SYSINFO_H
+#if __has_include(<sys/sysinfo.h>)
#include <sys/sysinfo.h>
#endif
@@ -271,7 +271,7 @@ netStatsInfo(TSMutex stat_creation_mutex)
static void
getStats(TSMutex stat_creation_mutex)
{
-#ifdef HAVE_SYS_SYSINFO_H
+#if HAVE_SYSINFO
struct sysinfo info;
sysinfo(&info);
@@ -289,7 +289,7 @@ getStats(TSMutex stat_creation_mutex)
statSet(BUFFER_RAM, info.bufferram, stat_creation_mutex);
statSet(TOTAL_SWAP, info.totalswap, stat_creation_mutex);
statSet(FREE_SWAP, info.freeswap, stat_creation_mutex);
-#endif // #ifdef HAVE_SYS_SYSINFO_H
+#endif // #ifdef HAVE_SYSINFO
netStatsInfo(stat_creation_mutex);
return;
diff --git a/plugins/header_rewrite/conditions.cc
b/plugins/header_rewrite/conditions.cc
index c9bf0688f5..8973087a46 100644
--- a/plugins/header_rewrite/conditions.cc
+++ b/plugins/header_rewrite/conditions.cc
@@ -34,17 +34,6 @@
#include "conditions.h"
#include "lulu.h"
-// This is a bit of a hack, to get the more linux specific tcp_info struct ...
-#if HAVE_STRUCT_LINUX_TCP_INFO
-#ifndef _LINUX_TCP_H
-#define _LINUX_TCP_H
-#endif
-#elif HAVE_NETINET_IN_H
-#ifndef _NETINET_TCP_H
-#define _NETINET_TCP_H
-#endif
-#endif
-
// ConditionStatus
void
ConditionStatus::initialize(Parser &p)
@@ -1324,10 +1313,12 @@ ConditionTcpInfo::append_value(std::string &s,
Resources const &res)
if (tsSsn == TS_SUCCESS) {
if (tcp_info_len > 0) {
char buf[12 * 4 + 9]; // 4x uint32's + 4x "; " + '\0'
-#if !defined(freebsd) || defined(__GLIBC__)
+#if defined(HAVE_STRUCT_TCP_INFO_TCPI_TOTAL_RETRANS)
+ // Linux 2.6.12+
snprintf(buf, sizeof(buf), "%" PRIu32 ";%" PRIu32 ";%" PRIu32 ";%"
PRIu32 "", info.tcpi_rtt, info.tcpi_rto,
info.tcpi_snd_cwnd, info.tcpi_retrans);
-#else
+#elif defined(HAVE_STRUCT_TCP_INFO___TCPI_RETRANS)
+ // FreeBSD 6.0+
snprintf(buf, sizeof(buf), "%" PRIu32 ";%" PRIu32 ";%" PRIu32 ";%"
PRIu32 "", info.tcpi_rtt, info.tcpi_rto,
info.tcpi_snd_cwnd, info.__tcpi_retrans);
#endif
diff --git a/plugins/tcpinfo/tcpinfo.cc b/plugins/tcpinfo/tcpinfo.cc
index 7943cac659..00878f8641 100644
--- a/plugins/tcpinfo/tcpinfo.cc
+++ b/plugins/tcpinfo/tcpinfo.cc
@@ -29,12 +29,6 @@
#include <ts/ts.h>
#include <unistd.h>
#include <netinet/in.h>
-// This is a bit of a hack, to get the more linux specific tcp_info struct ...
-#if HAVE_STRUCT_LINUX_TCP_INFO
-#include <linux/tcp.h>
-#elif HAVE_NETINET_IN_H
-#include <netinet/tcp.h>
-#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <getopt.h>
@@ -63,7 +57,7 @@ static const char *tcpi_headers[] = {"timestamp event client
server rtt",
"timestamp event client server rtt rttvar
last_sent last_recv snd_cwnd "
"snd_ssthresh rcv_ssthresh unacked sacked
lost retrans fackets all_retrans"
// Additional information from linux's linux/tcp.h appended here
-#if HAVE_STRUCT_LINUX_TCP_INFO
+#if HAVE_STRUCT_TCP_INFO_TCPI_DATA_SEGS_OUT
" data_segs_in data_segs_out"
#endif
};
@@ -146,21 +140,21 @@ log_tcp_info(Config *config, const char *event_name,
TSHttpSsn ssnp)
TSReturnCode ret;
if (config->log_level == 2) {
-#if !defined(freebsd) || defined(__GLIBC__)
-#if HAVE_STRUCT_LINUX_TCP_INFO
+#if HAVE_STRUCT_TCP_INFO_TCPI_DATA_SEGS_OUT
+ // Linux 4.6+
ret = TSTextLogObjectWrite(config->log, "%s %s %s %u %u %u %u %u %u %u %u
%u %u %u %u %u %u %u", event_name, client_str,
server_str, info.tcpi_rtt, info.tcpi_rttvar,
info.tcpi_last_data_sent, info.tcpi_last_data_recv,
info.tcpi_snd_cwnd, info.tcpi_snd_ssthresh,
info.tcpi_rcv_ssthresh, info.tcpi_unacked,
info.tcpi_sacked, info.tcpi_lost,
info.tcpi_retrans, info.tcpi_fackets, info.tcpi_total_retrans,
info.tcpi_data_segs_in,
info.tcpi_data_segs_out);
-#else
+#elif HAVE_STRUCT_TCP_INFO_TCPI_TOTAL_RETRANS
+ // Linux 2.6.12+
ret = TSTextLogObjectWrite(config->log, "%s %s %s %u %u %u %u %u %u %u %u
%u %u %u %u %u", event_name, client_str, server_str,
info.tcpi_rtt, info.tcpi_rttvar,
info.tcpi_last_data_sent, info.tcpi_last_data_recv,
info.tcpi_snd_cwnd, info.tcpi_snd_ssthresh,
info.tcpi_rcv_ssthresh, info.tcpi_unacked,
info.tcpi_sacked, info.tcpi_lost,
info.tcpi_retrans, info.tcpi_fackets, info.tcpi_total_retrans);
-#endif
-#else
- // E.g. FreeBSD and macOS
+#elif HAVE_STRUCT_TCP_INFO___TCPI_RETRANS
+ // FreeBSD 6.0+
ret = TSTextLogObjectWrite(config->log, "%s %s %s %u %u %u %u %u %u %u %u
%u %u %u %u %u", event_name, client_str, server_str,
info.tcpi_rtt, info.tcpi_rttvar,
info.__tcpi_last_data_sent, info.tcpi_last_data_recv,
info.tcpi_snd_cwnd, info.tcpi_snd_ssthresh,
info.__tcpi_rcv_ssthresh, info.__tcpi_unacked,
diff --git a/src/cripts/Connections.cc b/src/cripts/Connections.cc
index 61c2e3dace..5a028a05a5 100644
--- a/src/cripts/Connections.cc
+++ b/src/cripts/Connections.cc
@@ -167,12 +167,10 @@ ConnBase::TcpInfo::log()
if (_ready) {
// A lot of this is taken verbatim from header_rewrite, may want to
rewrite this with sstreams
-#if defined(TCP_INFO) && defined(HAVE_STRUCT_TCP_INFO)
-#if !defined(freebsd) || defined(__GLIBC__)
+#if HAVE_STRUCT_TCP_INFO_TCPI_TOTAL_RETRANS
_logging = fmt::format("{};{};{};{}", info.tcpi_rtt, info.tcpi_rto,
info.tcpi_snd_cwnd, info.tcpi_retrans);
-#else
+#elif HAVE_STRUCT_TCP_INFO___TCPI_RETRANS
_logging = fmt::format("{};{};{};{}", info.tcpi_rtt, info.tcpi_rto,
info.tcpi_snd_cwnd, info.__tcpi_retrans);
-#endif
#endif
}
diff --git a/src/proxy/logging/LogConfig.cc b/src/proxy/logging/LogConfig.cc
index bd80f6b91c..e45c9791d5 100644
--- a/src/proxy/logging/LogConfig.cc
+++ b/src/proxy/logging/LogConfig.cc
@@ -25,10 +25,6 @@
#include "tscore/Layout.h"
#include "iocore/utils/Machine.h"
-#ifdef HAVE_SYS_PARAM_H
-#include <sys/param.h>
-#endif
-
#include <memory>
#include "tscore/ink_platform.h"
diff --git a/src/traffic_server/traffic_server.cc
b/src/traffic_server/traffic_server.cc
index 83614b1c47..68bf17bdcb 100644
--- a/src/traffic_server/traffic_server.cc
+++ b/src/traffic_server/traffic_server.cc
@@ -62,7 +62,7 @@ extern "C" int plock(int);
#include <sys/filio.h>
#endif
-#if HAVE_MCHECK_H
+#if __has_include(<mcheck.h>)
#include <mcheck.h>
#endif
diff --git a/src/tscore/ink_cap.cc b/src/tscore/ink_cap.cc
index f5a9b7c319..9b28428400 100644
--- a/src/tscore/ink_cap.cc
+++ b/src/tscore/ink_cap.cc
@@ -24,11 +24,11 @@
#include "tscore/ink_config.h"
#include <grp.h>
-#if HAVE_SYS_CAPABILITY_H
+#if __has_include(<sys/capability.h>)
#include <sys/capability.h>
#endif
-#if HAVE_SYS_PRCTL_H
+#if __has_include(<sys/prctl.h>)
#include <sys/prctl.h>
#endif
diff --git a/src/tscore/ink_file.cc b/src/tscore/ink_file.cc
index 5721362fc0..98d45cd88e 100644
--- a/src/tscore/ink_file.cc
+++ b/src/tscore/ink_file.cc
@@ -28,25 +28,9 @@
#include "tscore/ink_string.h"
#include "tscore/ink_memory.h"
-#if HAVE_SYS_STAT_H
#include <sys/stat.h>
-#endif
-
-#if HAVE_SYS_PARAM_H
-#include <sys/param.h>
-#endif
-
-#if HAVE_SYS_DISK_H
-#include <sys/disk.h>
-#endif
-
-#if HAVE_SYS_DISKLABEL_H
-#include <sys/disklabel.h>
-#endif
-#if HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
-#endif
#if __has_include(<sys/mount.h>)
#include <sys/mount.h> /* for BLKGETSIZE */
diff --git a/src/tscore/ink_hrtime.cc b/src/tscore/ink_hrtime.cc
index e646bbda68..aff9e35302 100644
--- a/src/tscore/ink_hrtime.cc
+++ b/src/tscore/ink_hrtime.cc
@@ -32,13 +32,11 @@
#include "tscore/ink_assert.h"
#include "tscore/ink_defs.h"
-#if defined(freebsd)
+#if defined(__FreeBSD__)
#include <sys/types.h>
#include <sys/param.h>
-#ifdef HAVE_SYS_SYSCTL_H
#include <sys/sysctl.h>
-#endif
-#endif
+#endif // __FreeBSD__
#include <cstring>
#include <sys/time.h>
diff --git a/src/tscore/ink_res_init.cc b/src/tscore/ink_res_init.cc
index 028bdea404..5b48557206 100644
--- a/src/tscore/ink_res_init.cc
+++ b/src/tscore/ink_res_init.cc
@@ -76,9 +76,7 @@
#include <netinet/in.h>
#include <arpa/inet.h>
#include <arpa/nameser.h>
-#ifdef HAVE_ARPA_NAMESER_COMPAT_H
#include <arpa/nameser_compat.h>
-#endif
#include <cstdio>
#include <cctype>
#include <resolv.h>
diff --git a/src/tscore/ink_res_mkquery.cc b/src/tscore/ink_res_mkquery.cc
index fc5b6064c9..8cdb3150b4 100644
--- a/src/tscore/ink_res_mkquery.cc
+++ b/src/tscore/ink_res_mkquery.cc
@@ -71,9 +71,7 @@
#include <sys/param.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
-#ifdef HAVE_ARPA_NAMESER_COMPAT_H
#include <arpa/nameser_compat.h>
-#endif
#include <netdb.h>
#include <resolv.h>
#include <cstdio>