From: Radoslaw Zarzynski Date: Wed, 26 Jan 2022 19:10:43 +0000 (+0000) Subject: common: fix compilation warnings in numa.cc X-Git-Tag: v17.2.8~180^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c8bb5ee3c4f3f9acef2cace878163b52e065708a;p=ceph.git common: fix compilation warnings in numa.cc ``` [141/1591] Building CXX object src/common/CMakeFiles/common-common-objs.dir/numa.cc.o In file included from ../src/include/types.h:63, from ../src/include/stringify.h:7, from ../src/common/numa.cc:10: ../src/common/numa.cc: In function ‘std::string get_task_comm(pid_t)’: ../src/common/numa.cc:176:12: warning: comparison of integer expressions of different signedness: ‘ssize_t’ {aka ‘long int’} and ‘long unsigned int’ [-Wsign-compare] 176 | assert(n <= sizeof(name)); | ~~^~~~~~~~~~~~~~~ ../src/common/numa.cc: At global scope: ../src/common/numa.cc:159:20: warning: ‘std::string get_task_comm(pid_t)’ defined but not used [-Wunused-function] 159 | static std::string get_task_comm(pid_t tid) | ^~~~~~~~~~~~~ ``` Signed-off-by: Radoslaw Zarzynski (cherry picked from commit 718607457994046f03cf0459517355c82391ed87) --- diff --git a/src/common/numa.cc b/src/common/numa.cc index 7af8247f2a53..f62f0d010b78 100644 --- a/src/common/numa.cc +++ b/src/common/numa.cc @@ -156,6 +156,7 @@ static int easy_readdir(const std::string& dir, std::set *out) return 0; } +#ifdef HAVE_DPDK static std::string get_task_comm(pid_t tid) { static const char* comm_fmt = "/proc/self/task/%d/comm"; @@ -173,7 +174,7 @@ static std::string get_task_comm(pid_t tid) if (n < 0) { return ""; } - assert(n <= sizeof(name)); + assert(static_cast(n) <= sizeof(name)); if (name[n - 1] == '\n') { name[n - 1] = '\0'; } else { @@ -181,6 +182,7 @@ static std::string get_task_comm(pid_t tid) } return name; } +#endif int set_cpu_affinity_all_threads(size_t cpu_set_size, cpu_set_t *cpu_set) {