diff --git a/src/os/CMakeLists.txt b/src/os/CMakeLists.txt index efe2a1ed771441a8126e104038ded72bdebbb9eb..4472c683c70f0e4463ae46c63aaff7c7c7ba0fd6 100644 --- a/src/os/CMakeLists.txt +++ b/src/os/CMakeLists.txt @@ -1,7 +1,9 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8) PROJECT(TDengine) -IF (TD_DARWIN) +IF (TD_LINUX) + ADD_SUBDIRECTORY(src/linux) +ELSEIF (TD_DARWIN) ADD_SUBDIRECTORY(src/darwin) ELSEIF (TD_WINDOWS) ADD_SUBDIRECTORY(src/windows) diff --git a/src/os/src/darwin/CMakeLists.txt b/src/os/src/darwin/CMakeLists.txt index f46dfac6a18a7cacd50cba5e38e0930d20dab9ca..259e1a7a0b56a02b7d67825acc85caef5b598089 100644 --- a/src/os/src/darwin/CMakeLists.txt +++ b/src/os/src/darwin/CMakeLists.txt @@ -2,4 +2,4 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8) PROJECT(TDengine) AUX_SOURCE_DIRECTORY(. SRC) -ADD_LIBRARY(osd ${SRC}) +ADD_LIBRARY(osdarwin ${SRC}) diff --git a/src/os/src/detail/CMakeLists.txt b/src/os/src/detail/CMakeLists.txt index a3db8bd8b88b3f10389d3747a2288782b712ab9d..5c49df24c1c7b1e88c0ba206f2d100fe90ed21c6 100644 --- a/src/os/src/detail/CMakeLists.txt +++ b/src/os/src/detail/CMakeLists.txt @@ -10,12 +10,12 @@ SET_SOURCE_FILES_PROPERTIES(osCoredump.c PROPERTIES COMPILE_FLAGS -w) ADD_LIBRARY(os ${SRC}) IF (TD_LINUX) - TARGET_LINK_LIBRARIES(os m rt z) + TARGET_LINK_LIBRARIES(os oslinux) IF (TD_ARM_32 OR TD_LINUX_32) TARGET_LINK_LIBRARIES(os atomic) ENDIF () ELSEIF (TD_DARWIN) - TARGET_LINK_LIBRARIES(os osd) + TARGET_LINK_LIBRARIES(os osdarwin) ELSEIF (TD_WINDOWS) - TARGET_LINK_LIBRARIES(os osw) + TARGET_LINK_LIBRARIES(os oswindows) ENDIF () diff --git a/src/os/src/linux/CMakeLists.txt b/src/os/src/linux/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..08b696ba1aedb80ecc17997811591fea1209f1ae --- /dev/null +++ b/src/os/src/linux/CMakeLists.txt @@ -0,0 +1,7 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.8) +PROJECT(TDengine) + +AUX_SOURCE_DIRECTORY(. SRC) +ADD_LIBRARY(oslinux ${SRC}) + +TARGET_LINK_LIBRARIES(oslinux m rt z) \ No newline at end of file diff --git a/src/os/src/detail/osEnv.c b/src/os/src/linux/linuxEnv.c similarity index 98% rename from src/os/src/detail/osEnv.c rename to src/os/src/linux/linuxEnv.c index e3eadbc94bcf71e7cf09e70901e4de0aed427c54..417513314c7013a3e707999bfbd7f9dbd1a4baa8 100644 --- a/src/os/src/detail/osEnv.c +++ b/src/os/src/linux/linuxEnv.c @@ -40,9 +40,8 @@ void osInit() { strcpy(tsOsName, "Linux"); } -char cmdline[1024]; - char* taosGetCmdlineByPID(int pid) { + static char cmdline[1024]; sprintf(cmdline, "/proc/%d/cmdline", pid); FILE* f = fopen(cmdline, "r"); if (f) { diff --git a/src/os/src/windows/CMakeLists.txt b/src/os/src/windows/CMakeLists.txt index 1ac2700f1da5937869b0b3bba69e7ed52c05197f..e5472e1abd618f27d119efbb926a959bf8c737c6 100644 --- a/src/os/src/windows/CMakeLists.txt +++ b/src/os/src/windows/CMakeLists.txt @@ -2,6 +2,6 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8) PROJECT(TDengine) AUX_SOURCE_DIRECTORY(. SRC) -ADD_LIBRARY(osw ${SRC}) +ADD_LIBRARY(oswindows ${SRC}) -TARGET_LINK_LIBRARIES(osw winmm IPHLPAPI ws2_32 MsvcLibXw) +TARGET_LINK_LIBRARIES(oswindows winmm IPHLPAPI ws2_32 MsvcLibXw) \ No newline at end of file