pthread_create(&thread_id, NULL, synthetic_client_thread_entry, this);
assert(thread_id);
- pthread_setname_np(thread_id, "client");
+ ceph_pthread_setname(thread_id, "client");
return 0;
}
if (pid && cpuid >= 0)
_set_affinity(cpuid);
- pthread_setname_np(pthread_self(), thread_name);
+ ceph_pthread_setname(pthread_self(), thread_name);
return entry();
}
std::stringstream ss;
char name[16] = {0};
- pthread_getname_np(pthread_self(), name, sizeof(name));
+ ceph_pthread_getname(pthread_self(), name, sizeof(name));
ss << name << " thread " << name;
heartbeat_handle_d *hb = cct->get_heartbeat_map()->add_worker(ss.str(), pthread_self());
std::stringstream ss;
char name[16] = {0};
- pthread_getname_np(pthread_self(), name, sizeof(name));
+ ceph_pthread_getname(pthread_self(), name, sizeof(name));
ss << name << " thread " << name;
heartbeat_handle_d *hb = cct->get_heartbeat_map()->add_worker(ss.str(), pthread_self());
pthread_t print_thread;
pthread_create(&print_thread, NULL, ObjBencher::status_printer, (void *)this);
- pthread_setname_np(print_thread, "write_stat");
+ ceph_pthread_setname(print_thread, "write_stat");
lock.Lock();
data.finished = 0;
data.start_time = ceph_clock_now(cct);
pthread_t print_thread;
pthread_create(&print_thread, NULL, status_printer, (void *)this);
- pthread_setname_np(print_thread, "seq_read_stat");
+ ceph_pthread_setname(print_thread, "seq_read_stat");
utime_t finish_time = data.start_time + time_to_run;
//start initial reads
pthread_t print_thread;
pthread_create(&print_thread, NULL, status_printer, (void *)this);
- pthread_setname_np(print_thread, "rand_read_stat");
+ ceph_pthread_setname(print_thread, "rand_read_stat");
utime_t finish_time = data.start_time + time_to_run;
//start initial reads
*/
#include "include/compat.h"
+#include "pthread.h"
#include "common/BackTrace.h"
#include "common/debug.h"
// presumably dump core-- will handle it.
char buf[1024];
char pthread_name[16] = {0}; //limited by 16B include terminating null byte.
- int r = pthread_getname_np(pthread_self(), pthread_name, sizeof(pthread_name));
+ int r = ceph_pthread_getname(pthread_self(), pthread_name, sizeof(pthread_name));
(void)r;
#if defined(__sun)
char message[SIG2STR_MAX];
#if defined(HAVE_PTHREAD_SETNAME_NP)
#if defined(__APPLE__)
- #define pthread_setname_np(thread, name) ({ \
+ #define ceph_pthread_setname(thread, name) ({ \
int __result = 0; \
if (thread == pthread_self()) \
- __result = pthread_setname_np(name) \
+ __result = pthread_setname_np(name); \
__result; })
+ #else
+ #define ceph_pthread_setname pthread_setname_np
#endif
#elif defined(HAVE_PTHREAD_SET_NAME_NP)
/* Fix a small name diff */
- #define pthread_setname_np pthread_set_name_np
+ #define ceph_pthread_setname pthread_set_name_np
#else
/* compiler warning free success noop */
- #define pthread_setname_np(thread, name) ({ \
+ #define ceph_pthread_setname(thread, name) ({ \
int __i = 0; \
__i; })
#endif
-#if !defined(HAVE_PTHREAD_GETNAME_NP)
+#if defined(HAVE_PTHREAD_GETNAME_NP)
+ #define ceph_pthread_getname pthread_getname_np
+#else
/* compiler warning free success noop */
- #define pthread_getname_np(thread, name, len) ({ \
+ #define ceph_pthread_getname(thread, name, len) ({ \
if (name != NULL) \
*name = '\0'; \
0; })