return ret;
}
+int64_t BlkDev::get_int_property(blkdev_prop_t prop) const
+{
+ return 0;
+}
+
bool BlkDev::support_discard() const
{
return false;
return false;
}
+int BlkDev::get_numa_node(int *node) const
+{
+ return -1;
+}
+
int BlkDev::model(char *model, size_t max) const
{
return -EOPNOTSUPP;
return ret;
}
+int64_t BlkDev::get_int_property(blkdev_prop_t prop) const
+{
+ return 0;
+}
+
bool BlkDev::support_discard() const
{
#ifdef FREEBSD_WITH_TRIM
#endif
}
+int BlkDev::get_numa_node(int *node) const
+{
+ int numa = get_int_property(BLKDEV_PROP_NUMA_NODE);
+ if (numa < 0)
+ return -1;
+ *node = numa;
+ return 0;
+}
+
int BlkDev::model(char *model, size_t max) const
{
struct diocgattr_arg arg;
return (errno = save_errno, -1);
#endif
}
+
+#if defined(__FreeBSD__)
+int sched_setaffinity(pid_t pid, size_t cpusetsize,
+ cpu_set_t *mask)
+{
+ return 0;
+}
+#endif
+
// list
-
+#if defined(__linux__)
int parse_cpu_set_list(const char *s,
size_t *cpu_set_size,
cpu_set_t *cpu_set)
::close(fd);
return r;
}
+
+#elif defined(__FreeBSD__)
+
+int parse_cpu_set_list(const char *s,
+ size_t *cpu_set_size,
+ cpu_set_t *cpu_set)
+{
+ return -ENOTSUP;
+}
+
+std::string cpu_set_to_str_list(size_t cpu_set_size,
+ const cpu_set_t *cpu_set)
+{
+ return {};
+}
+
+std::set<int> cpu_set_to_set(size_t cpu_set_size,
+ const cpu_set_t *cpu_set)
+{
+ return {};
+}
+
+int get_numa_node_cpu_set(int node,
+ size_t *cpu_set_size,
+ cpu_set_t *cpu_set)
+{
+ return -ENOTSUP;
+}
+
+#endif
#pragma once
+#include <include/compat.h>
#include <sched.h>
#include <ostream>
#include <set>
/* And include the extra required include file */
#include <pthread_np.h>
+#include <sys/param.h>
+#include <sys/cpuset.h>
+#define cpu_set_t cpuset_t
+int sched_setaffinity(pid_t pid, size_t cpusetsize,
+ cpu_set_t *mask);
+
#endif /* __FreeBSD__ */
#if defined(__APPLE__) || defined(__FreeBSD__)
add_ceph_unittest(unittest_lockdep)
target_link_libraries(unittest_lockdep ceph-common global)
+# FreeBSD only has shims to support NUMA, no functional code.
+if(LINUX)
# unittest_numa
add_executable(unittest_numa
test_numa.cc
)
add_ceph_unittest(unittest_numa)
target_link_libraries(unittest_numa ceph-common)
+endif()
# unittest_bloom_filter
add_executable(unittest_bloom_filter