From 87a2402c6ba1c8610b034ed39a896fcc3b61deec Mon Sep 17 00:00:00 2001 From: James Sedgwick Date: Sat, 21 Oct 2017 13:00:55 -0700 Subject: [PATCH] move MemoryMapping, Shell, ThreadId, ThreadName, and VersionCheck to system/ Summary: Everything that's going in system/ besides CpuId and Subprocess, which are included in hphp Reviewed By: mzlee Differential Revision: D6102263 fbshipit-source-id: 564ef584c341a4ac79db14a9d58fe23ce51e78b3 --- CMakeLists.txt | 12 ++++++----- folly/Makefile.am | 20 +++++++++---------- folly/Subprocess.cpp | 2 +- folly/concurrency/CacheLocality.h | 2 +- folly/detail/MemoryIdler.h | 2 +- folly/executors/ThreadedExecutor.cpp | 2 +- .../thread_factory/NamedThreadFactory.h | 2 +- folly/experimental/FunctionScheduler.cpp | 2 +- .../ThreadedRepeatingFunctionRunner.cpp | 2 +- folly/experimental/io/HugePageUtil.cpp | 2 +- folly/experimental/logging/LogMessage.cpp | 2 +- .../observer/detail/ObserverManager.cpp | 2 +- folly/io/RecordIO.h | 2 +- folly/io/async/EventBase.cpp | 2 +- folly/io/async/SSLContext.cpp | 2 +- folly/io/async/ScopedEventBaseThread.cpp | 2 +- folly/io/async/test/EventBaseThreadTest.cpp | 2 +- .../async/test/ScopedEventBaseThreadTest.cpp | 2 +- folly/io/async/test/TimeUtil.cpp | 2 +- folly/{ => system}/MemoryMapping.cpp | 2 +- folly/{ => system}/MemoryMapping.h | 0 folly/{ => system}/Shell.cpp | 2 +- folly/{ => system}/Shell.h | 0 folly/{ => system}/ThreadId.h | 0 folly/{ => system}/ThreadName.cpp | 2 +- folly/{ => system}/ThreadName.h | 0 .../{Version.cpp => system/VersionCheck.cpp} | 2 +- folly/{ => system}/VersionCheck.h | 0 folly/{ => system}/test/MemoryMappingTest.cpp | 2 +- folly/{ => system}/test/ShellTest.cpp | 2 +- folly/{ => system}/test/ThreadIdTest.cpp | 2 +- folly/{ => system}/test/ThreadNameTest.cpp | 2 +- folly/test/Makefile.am | 4 ++-- folly/test/ThreadCachedIntTest.cpp | 2 +- folly/test/ThreadLocalTest.cpp | 2 +- 35 files changed, 46 insertions(+), 44 deletions(-) rename folly/{ => system}/MemoryMapping.cpp (99%) rename folly/{ => system}/MemoryMapping.h (100%) rename folly/{ => system}/Shell.cpp (96%) rename folly/{ => system}/Shell.h (100%) rename folly/{ => system}/ThreadId.h (100%) rename folly/{ => system}/ThreadName.cpp (99%) rename folly/{ => system}/ThreadName.h (100%) rename folly/{Version.cpp => system/VersionCheck.cpp} (94%) rename folly/{ => system}/VersionCheck.h (100%) rename folly/{ => system}/test/MemoryMappingTest.cpp (99%) rename folly/{ => system}/test/ShellTest.cpp (98%) rename folly/{ => system}/test/ThreadIdTest.cpp (97%) rename folly/{ => system}/test/ThreadNameTest.cpp (98%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3255fe47..6d9237e9 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -480,6 +480,13 @@ if (BUILD_TESTS) DIRECTORY synchronization/test/ TEST call_once_test SOURCES CallOnceTest.cpp + DIRECTORY system/test/ + TEST memory_mapping_test SOURCES MemoryMappingTest.cpp + TEST shell_test SOURCES ShellTest.cpp + #TEST subprocess_test SOURCES SubprocessTest.cpp + TEST thread_id_test SOURCES ThreadIdTest.cpp + TEST thread_name_test SOURCES ThreadNameTest.cpp + DIRECTORY test/ TEST ahm_int_stress_test SOURCES AHMIntStressTest.cpp TEST arena_test SOURCES ArenaTest.cpp @@ -552,7 +559,6 @@ if (BUILD_TESTS) TEST map_util_test SOURCES MapUtilTest.cpp TEST memcpy_test SOURCES MemcpyTest.cpp TEST memory_idler_test SOURCES MemoryIdlerTest.cpp - TEST memory_mapping_test SOURCES MemoryMappingTest.cpp TEST memory_test SOURCES MemoryTest.cpp TEST merge SOURCES MergeTest.cpp TEST move_wrapper_test SOURCES MoveWrapperTest.cpp @@ -579,7 +585,6 @@ if (BUILD_TESTS) TEST scope_guard_test SOURCES ScopeGuardTest.cpp # Heavily dependent on drand and srand48 #TEST shared_mutex_test SOURCES SharedMutexTest.cpp - TEST shell_test SOURCES ShellTest.cpp TEST singleton_test SOURCES SingletonTest.cpp TEST singleton_test_global SOURCES SingletonTestGlobal.cpp TEST singleton_thread_local_test SOURCES SingletonThreadLocalTest.cpp @@ -588,13 +593,10 @@ if (BUILD_TESTS) TEST sorted_vector_types_test SOURCES sorted_vector_test.cpp TEST sparse_byte_set_test SOURCES SparseByteSetTest.cpp TEST string_test SOURCES StringTest.cpp - #TEST subprocess_test SOURCES SubprocessTest.cpp TEST synchronized_test SOURCES SynchronizedTest.cpp TEST thread_cached_arena_test SOURCES ThreadCachedArenaTest.cpp TEST thread_cached_int_test SOURCES ThreadCachedIntTest.cpp - TEST thread_id_test SOURCES ThreadIdTest.cpp TEST thread_local_test SOURCES ThreadLocalTest.cpp - TEST thread_name_test SOURCES ThreadNameTest.cpp TEST timeout_queue_test SOURCES TimeoutQueueTest.cpp TEST token_bucket_test SOURCES TokenBucketTest.cpp TEST traits_test SOURCES TraitsTest.cpp diff --git a/folly/Makefile.am b/folly/Makefile.am index ef127982..cbc950b2 100644 --- a/folly/Makefile.am +++ b/folly/Makefile.am @@ -327,7 +327,6 @@ nobase_follyinclude_HEADERS = \ MapUtil.h \ Math.h \ Memory.h \ - MemoryMapping.h \ memory/MallctlHelper.h \ memory/UninitializedMemoryHacks.h \ MicroSpinLock.h \ @@ -390,7 +389,6 @@ nobase_follyinclude_HEADERS = \ SafeAssert.h \ ScopeGuard.h \ SharedMutex.h \ - Shell.h \ Singleton.h \ Singleton-inl.h \ SingletonThreadLocal.h \ @@ -419,6 +417,11 @@ nobase_follyinclude_HEADERS = \ stats/TimeseriesHistogram-defs.h \ stats/TimeseriesHistogram.h \ synchronization/CallOnce.h \ + system/MemoryMapping.h \ + system/Shell.h \ + system/ThreadId.h \ + system/ThreadName.h \ + system/VersionCheck.h \ stop_watch.h \ String.h \ String-inl.h \ @@ -434,9 +437,7 @@ nobase_follyinclude_HEADERS = \ test/TestUtils.h \ ThreadCachedArena.h \ ThreadCachedInt.h \ - ThreadId.h \ ThreadLocal.h \ - ThreadName.h \ TimeoutQueue.h \ TokenBucket.h \ tracing/StaticTracepoint.h \ @@ -452,8 +453,7 @@ nobase_follyinclude_HEADERS = \ Uri.h \ Uri-inl.h \ Utility.h \ - Varint.h \ - VersionCheck.h + Varint.h FormatTables.cpp: build/generate_format_tables.py $(PYTHON) build/generate_format_tables.py @@ -563,7 +563,6 @@ libfolly_la_SOURCES = \ detail/MemoryIdler.cpp \ detail/SocketFastOpen.cpp \ MacAddress.cpp \ - MemoryMapping.cpp \ portability/Dirent.cpp \ portability/Fcntl.cpp \ portability/Libgen.cpp \ @@ -588,7 +587,6 @@ libfolly_la_SOURCES = \ SafeAssert.cpp \ ScopeGuard.cpp \ SharedMutex.cpp \ - Shell.cpp \ MicroLock.cpp \ Optional.cpp \ Singleton.cpp \ @@ -602,13 +600,15 @@ libfolly_la_SOURCES = \ stats/Histogram.cpp \ stats/MultiLevelTimeSeries.cpp \ stats/TimeseriesHistogram.cpp \ + system/MemoryMapping.cpp \ + system/Shell.cpp \ + system/ThreadName.cpp \ + system/VersionCheck.cpp \ Subprocess.cpp \ ThreadCachedArena.cpp \ - ThreadName.cpp \ TimeoutQueue.cpp \ Try.cpp \ Uri.cpp \ - Version.cpp \ experimental/AsymmetricMemoryBarrier.cpp \ experimental/ThreadedRepeatingFunctionRunner.cpp \ experimental/bser/Dump.cpp \ diff --git a/folly/Subprocess.cpp b/folly/Subprocess.cpp index 7ac96687..77706213 100644 --- a/folly/Subprocess.cpp +++ b/folly/Subprocess.cpp @@ -38,13 +38,13 @@ #include #include #include -#include #include #include #include #include #include #include +#include constexpr int kExecFailure = 127; constexpr int kChildFailure = 126; diff --git a/folly/concurrency/CacheLocality.h b/folly/concurrency/CacheLocality.h index 38f5557c..457e107a 100644 --- a/folly/concurrency/CacheLocality.h +++ b/folly/concurrency/CacheLocality.h @@ -33,9 +33,9 @@ #include #include #include -#include #include #include +#include namespace folly { diff --git a/folly/detail/MemoryIdler.h b/folly/detail/MemoryIdler.h index fcbde002..13fe453e 100644 --- a/folly/detail/MemoryIdler.h +++ b/folly/detail/MemoryIdler.h @@ -21,9 +21,9 @@ #include #include -#include #include #include +#include namespace folly { diff --git a/folly/executors/ThreadedExecutor.cpp b/folly/executors/ThreadedExecutor.cpp index e19ecf4f..badfc549 100644 --- a/folly/executors/ThreadedExecutor.cpp +++ b/folly/executors/ThreadedExecutor.cpp @@ -20,8 +20,8 @@ #include -#include #include +#include namespace folly { diff --git a/folly/executors/thread_factory/NamedThreadFactory.h b/folly/executors/thread_factory/NamedThreadFactory.h index 2b34be9e..12cb7a7e 100644 --- a/folly/executors/thread_factory/NamedThreadFactory.h +++ b/folly/executors/thread_factory/NamedThreadFactory.h @@ -22,8 +22,8 @@ #include #include -#include #include +#include namespace folly { diff --git a/folly/experimental/FunctionScheduler.cpp b/folly/experimental/FunctionScheduler.cpp index cee5a4c4..61538106 100644 --- a/folly/experimental/FunctionScheduler.cpp +++ b/folly/experimental/FunctionScheduler.cpp @@ -21,7 +21,7 @@ #include #include #include -#include +#include using std::chrono::milliseconds; using std::chrono::steady_clock; diff --git a/folly/experimental/ThreadedRepeatingFunctionRunner.cpp b/folly/experimental/ThreadedRepeatingFunctionRunner.cpp index 82ab4081..7c478d1a 100644 --- a/folly/experimental/ThreadedRepeatingFunctionRunner.cpp +++ b/folly/experimental/ThreadedRepeatingFunctionRunner.cpp @@ -15,7 +15,7 @@ */ #include "folly/experimental/ThreadedRepeatingFunctionRunner.h" -#include +#include #include #include diff --git a/folly/experimental/io/HugePageUtil.cpp b/folly/experimental/io/HugePageUtil.cpp index 8701856b..25735bfe 100644 --- a/folly/experimental/io/HugePageUtil.cpp +++ b/folly/experimental/io/HugePageUtil.cpp @@ -18,10 +18,10 @@ #include #include -#include #include #include #include +#include DEFINE_bool(cp, false, "Copy file"); diff --git a/folly/experimental/logging/LogMessage.cpp b/folly/experimental/logging/LogMessage.cpp index 3ec39603..7b4bd253 100644 --- a/folly/experimental/logging/LogMessage.cpp +++ b/folly/experimental/logging/LogMessage.cpp @@ -15,7 +15,7 @@ */ #include -#include +#include using std::chrono::system_clock; diff --git a/folly/experimental/observer/detail/ObserverManager.cpp b/folly/experimental/observer/detail/ObserverManager.cpp index 88372ad6..e9312db5 100644 --- a/folly/experimental/observer/detail/ObserverManager.cpp +++ b/folly/experimental/observer/detail/ObserverManager.cpp @@ -20,8 +20,8 @@ #include #include #include -#include #include +#include namespace folly { namespace observer_detail { diff --git a/folly/io/RecordIO.h b/folly/io/RecordIO.h index 856e329f..45381080 100644 --- a/folly/io/RecordIO.h +++ b/folly/io/RecordIO.h @@ -31,9 +31,9 @@ #include #include -#include #include #include +#include namespace folly { diff --git a/folly/io/async/EventBase.cpp b/folly/io/async/EventBase.cpp index 56f92c8d..d138c336 100644 --- a/folly/io/async/EventBase.cpp +++ b/folly/io/async/EventBase.cpp @@ -27,10 +27,10 @@ #include #include -#include #include #include #include +#include namespace folly { diff --git a/folly/io/async/SSLContext.cpp b/folly/io/async/SSLContext.cpp index d0134178..498d8dfb 100644 --- a/folly/io/async/SSLContext.cpp +++ b/folly/io/async/SSLContext.cpp @@ -21,8 +21,8 @@ #include #include #include -#include #include +#include // --------------------------------------------------------------------- // SSLContext implementation diff --git a/folly/io/async/ScopedEventBaseThread.cpp b/folly/io/async/ScopedEventBaseThread.cpp index 1e21aad7..7ffaae62 100644 --- a/folly/io/async/ScopedEventBaseThread.cpp +++ b/folly/io/async/ScopedEventBaseThread.cpp @@ -20,8 +20,8 @@ #include #include -#include #include +#include using namespace std; diff --git a/folly/io/async/test/EventBaseThreadTest.cpp b/folly/io/async/test/EventBaseThreadTest.cpp index 96939e33..e804501e 100644 --- a/folly/io/async/test/EventBaseThreadTest.cpp +++ b/folly/io/async/test/EventBaseThreadTest.cpp @@ -19,9 +19,9 @@ #include #include -#include #include #include +#include using namespace std; using namespace std::chrono; diff --git a/folly/io/async/test/ScopedEventBaseThreadTest.cpp b/folly/io/async/test/ScopedEventBaseThreadTest.cpp index 79dbe6ff..6f1d2266 100644 --- a/folly/io/async/test/ScopedEventBaseThreadTest.cpp +++ b/folly/io/async/test/ScopedEventBaseThreadTest.cpp @@ -21,9 +21,9 @@ #include #include -#include #include #include +#include using namespace std; using namespace std::chrono; diff --git a/folly/io/async/test/TimeUtil.cpp b/folly/io/async/test/TimeUtil.cpp index 9340a9d6..94c70374 100644 --- a/folly/io/async/test/TimeUtil.cpp +++ b/folly/io/async/test/TimeUtil.cpp @@ -33,8 +33,8 @@ #include #include -#include #include +#include #include diff --git a/folly/MemoryMapping.cpp b/folly/system/MemoryMapping.cpp similarity index 99% rename from folly/MemoryMapping.cpp rename to folly/system/MemoryMapping.cpp index 30d6a1fe..59d09f49 100644 --- a/folly/MemoryMapping.cpp +++ b/folly/system/MemoryMapping.cpp @@ -14,7 +14,7 @@ * limitations under the License. */ -#include +#include #include #include diff --git a/folly/MemoryMapping.h b/folly/system/MemoryMapping.h similarity index 100% rename from folly/MemoryMapping.h rename to folly/system/MemoryMapping.h diff --git a/folly/Shell.cpp b/folly/system/Shell.cpp similarity index 96% rename from folly/Shell.cpp rename to folly/system/Shell.cpp index 3ce31b76..fbc075b0 100644 --- a/folly/Shell.cpp +++ b/folly/system/Shell.cpp @@ -14,7 +14,7 @@ * limitations under the License. */ -#include +#include namespace folly { diff --git a/folly/Shell.h b/folly/system/Shell.h similarity index 100% rename from folly/Shell.h rename to folly/system/Shell.h diff --git a/folly/ThreadId.h b/folly/system/ThreadId.h similarity index 100% rename from folly/ThreadId.h rename to folly/system/ThreadId.h diff --git a/folly/ThreadName.cpp b/folly/system/ThreadName.cpp similarity index 99% rename from folly/ThreadName.cpp rename to folly/system/ThreadName.cpp index abc7eaad..49793a91 100644 --- a/folly/ThreadName.cpp +++ b/folly/system/ThreadName.cpp @@ -14,7 +14,7 @@ * limitations under the License. */ -#include +#include #include diff --git a/folly/ThreadName.h b/folly/system/ThreadName.h similarity index 100% rename from folly/ThreadName.h rename to folly/system/ThreadName.h diff --git a/folly/Version.cpp b/folly/system/VersionCheck.cpp similarity index 94% rename from folly/Version.cpp rename to folly/system/VersionCheck.cpp index cdacce51..be333d68 100644 --- a/folly/Version.cpp +++ b/folly/system/VersionCheck.cpp @@ -14,7 +14,7 @@ * limitations under the License. */ -#include +#include namespace folly { namespace detail { diff --git a/folly/VersionCheck.h b/folly/system/VersionCheck.h similarity index 100% rename from folly/VersionCheck.h rename to folly/system/VersionCheck.h diff --git a/folly/test/MemoryMappingTest.cpp b/folly/system/test/MemoryMappingTest.cpp similarity index 99% rename from folly/test/MemoryMappingTest.cpp rename to folly/system/test/MemoryMappingTest.cpp index 958f97c3..eb2d5d53 100644 --- a/folly/test/MemoryMappingTest.cpp +++ b/folly/system/test/MemoryMappingTest.cpp @@ -17,10 +17,10 @@ #include #include -#include #include #include #include +#include static constexpr double kSomeDouble = 3.14; diff --git a/folly/test/ShellTest.cpp b/folly/system/test/ShellTest.cpp similarity index 98% rename from folly/test/ShellTest.cpp rename to folly/system/test/ShellTest.cpp index 697ecd8e..42978693 100644 --- a/folly/test/ShellTest.cpp +++ b/folly/system/test/ShellTest.cpp @@ -16,8 +16,8 @@ #include -#include #include +#include using namespace folly; diff --git a/folly/test/ThreadIdTest.cpp b/folly/system/test/ThreadIdTest.cpp similarity index 97% rename from folly/test/ThreadIdTest.cpp rename to folly/system/test/ThreadIdTest.cpp index 88e6fac4..fcece811 100644 --- a/folly/test/ThreadIdTest.cpp +++ b/folly/system/test/ThreadIdTest.cpp @@ -17,7 +17,7 @@ // Make sure we include ThreadId.h before anything else. // There is no ThreadId.cpp file, so this test is the only thing that verifies // that ThreadId.h compiles by itself when included first. -#include +#include #include diff --git a/folly/test/ThreadNameTest.cpp b/folly/system/test/ThreadNameTest.cpp similarity index 98% rename from folly/test/ThreadNameTest.cpp rename to folly/system/test/ThreadNameTest.cpp index d47416b3..9dce6bd9 100644 --- a/folly/test/ThreadNameTest.cpp +++ b/folly/system/test/ThreadNameTest.cpp @@ -18,8 +18,8 @@ #include #include -#include #include +#include using namespace std; using namespace folly; diff --git a/folly/test/Makefile.am b/folly/test/Makefile.am index a2f58830..31e8b74b 100644 --- a/folly/test/Makefile.am +++ b/folly/test/Makefile.am @@ -102,7 +102,7 @@ TESTS += fbstring_test_using_jemalloc thread_cached_int_test_SOURCES = ThreadCachedIntTest.cpp thread_cached_int_test_LDADD = libfollytestmain.la $(top_builddir)/libfollybenchmark.la -thread_id_test_SOURCES = ThreadIdTest.cpp +thread_id_test_SOURCES = system/test/ThreadIdTest.cpp thread_id_test_LDADD = libfollytestmain.la TESTS += thread_id_test @@ -239,7 +239,7 @@ token_bucket_test_SOURCES = TokenBucketTest.cpp token_bucket_test_LDADD = libfollytestmain.la $(top_builddir)/libfollybenchmark.la TESTS += token_bucket_test -thread_name_test_SOURCES = ThreadNameTest.cpp +thread_name_test_SOURCES = system/ThreadNameTest.cpp thread_name_test_LDADD = libfollytestmain.la TESTS += thread_name_test diff --git a/folly/test/ThreadCachedIntTest.cpp b/folly/test/ThreadCachedIntTest.cpp index e09c780f..6b438f74 100644 --- a/folly/test/ThreadCachedIntTest.cpp +++ b/folly/test/ThreadCachedIntTest.cpp @@ -24,9 +24,9 @@ #include #include -#include #include #include +#include using namespace folly; diff --git a/folly/test/ThreadLocalTest.cpp b/folly/test/ThreadLocalTest.cpp index 90d9f63c..6be3f228 100644 --- a/folly/test/ThreadLocalTest.cpp +++ b/folly/test/ThreadLocalTest.cpp @@ -38,10 +38,10 @@ #include #include -#include #include #include #include +#include using namespace folly; -- 2.34.1