You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by bn...@apache.org on 2024/01/30 16:23:45 UTC
(trafficserver-libswoc) branch dev-1-2-10 created (now 8de989d)
This is an automated email from the ASF dual-hosted git repository.
bneradt pushed a change to branch dev-1-2-10
in repository https://gitbox.apache.org/repos/asf/trafficserver-libswoc.git
at 8de989d comment out unused spec in bwf_std.h
This branch includes the following new commits:
new f4965bd file: Add support for MAC OS having different names for file status times.
new 8de989d comment out unused spec in bwf_std.h
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(trafficserver-libswoc) 02/02: comment out unused spec in bwf_std.h
Posted by bn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
bneradt pushed a commit to branch dev-1-2-10
in repository https://gitbox.apache.org/repos/asf/trafficserver-libswoc.git
commit 8de989df57a1524b4ffcd43a66ee24bf7bf468fc
Author: bneradt <bn...@verizonmedia.com>
AuthorDate: Mon Sep 14 18:35:20 2020 -0500
comment out unused spec in bwf_std.h
---
code/include/swoc/bwf_std.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/code/include/swoc/bwf_std.h b/code/include/swoc/bwf_std.h
index 536b9d8..372de72 100644
--- a/code/include/swoc/bwf_std.h
+++ b/code/include/swoc/bwf_std.h
@@ -26,7 +26,7 @@ bwformat(swoc::BufferWriter &w, swoc::bwf::Spec const &spec, atomic<T> const &v)
swoc::BufferWriter &bwformat(swoc::BufferWriter &w, swoc::bwf::Spec const &spec, error_code const &ec);
template < size_t N >
-swoc::BufferWriter &bwformat(swoc::BufferWriter &w, swoc::bwf::Spec const& spec, bitset<N> const& bits) {
+swoc::BufferWriter &bwformat(swoc::BufferWriter &w, swoc::bwf::Spec const& /* spec */, bitset<N> const& bits) {
for ( unsigned idx = 0 ; idx < N ; ++idx) {
w.write(bits[idx] ? '1' : '0');
}
(trafficserver-libswoc) 01/02: file: Add support for MAC OS having different names for file status times.
Posted by bn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
bneradt pushed a commit to branch dev-1-2-10
in repository https://gitbox.apache.org/repos/asf/trafficserver-libswoc.git
commit f4965bdc7e79a5d7494a9c336843e77af134c44c
Author: Alan M. Carroll <am...@apache.org>
AuthorDate: Mon Sep 14 17:23:18 2020 -0500
file: Add support for MAC OS having different names for file status times.
---
code/src/swoc_file.cc | 42 +++++++++++++++++++++++++++++++-----------
1 file changed, 31 insertions(+), 11 deletions(-)
diff --git a/code/src/swoc_file.cc b/code/src/swoc_file.cc
index 7337d2d..7051a1c 100644
--- a/code/src/swoc_file.cc
+++ b/code/src/swoc_file.cc
@@ -10,13 +10,6 @@
#include "swoc/swoc_file.h"
#include "swoc/bwf_base.h"
-// Some portability defines for Apple's stat structure. See stat(2) man page.
-#if __APPLE__
-#define st_atim st_atimespec
-#define st_ctim st_ctimespec
-#define st_mtim st_mtimespec
-#endif
-
using namespace swoc::literals;
namespace swoc { inline namespace SWOC_VERSION_NS {
@@ -92,18 +85,45 @@ inline std::chrono::system_clock::time_point chrono_cast(timespec const& ts) {
using namespace std::chrono;
return system_clock::time_point{duration_cast<system_clock::duration>(seconds{ts.tv_sec} + nanoseconds{ts.tv_nsec})};
}
-} // namesapce
+
+// Apple has different names for these members, need to have accessors that account for that.
+// Under -O2 these are completely elided.
+template < typename S > auto a_time(S const& s) -> decltype(S::st_atim) {
+ return s.st_atim;
+}
+
+template < typename S > auto a_time(S const& s) -> decltype(S::st_atimespec) {
+ return s.st_atimespec;
+}
+
+template < typename S > auto m_time(S const& s) -> decltype(S::st_mtim) {
+ return s.st_mtim;
+}
+
+template < typename S > auto m_time(S const& s) -> decltype(S::st_mtimespec) {
+ return s.st_mtimespec;
+}
+
+template < typename S > auto c_time(S const& s) -> decltype(S::st_ctim) {
+ return s.st_ctim;
+}
+
+template < typename S > auto c_time(S const& s) -> decltype(S::st_ctimespec) {
+ return s.st_ctimespec;
+}
+
+} // namespace
std::chrono::system_clock::time_point modify_time(file_status const& fs) {
- return chrono_cast(fs._stat.st_mtim);
+ return chrono_cast(m_time(fs._stat));
}
std::chrono::system_clock::time_point access_time(file_status const& fs) {
- return chrono_cast(fs._stat.st_atim);
+ return chrono_cast(a_time(fs._stat));
}
std::chrono::system_clock::time_point status_time(file_status const& fs) {
- return chrono_cast(fs._stat.st_ctim);
+ return chrono_cast(c_time(fs._stat));
}
bool