diff options
author | thiagoftsm <thiagoftsm@gmail.com> | 2023-07-06 15:46:48 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-06 15:46:48 +0000 |
commit | e0f388c43f3144abb871cce2a7b44e85a36de48f (patch) | |
tree | cf41e5ae11ae7d0ad5ec0b49f5f4ac4531189eb3 /libnetdata/threads/threads.c | |
parent | 3cc220ff5e38ef5cd96a64596c7e0c370d0fa074 (diff) |
Rename generic `error` function (#15296)
Diffstat (limited to 'libnetdata/threads/threads.c')
-rw-r--r-- | libnetdata/threads/threads.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/libnetdata/threads/threads.c b/libnetdata/threads/threads.c index 5b1adb0e88..1ec6864477 100644 --- a/libnetdata/threads/threads.c +++ b/libnetdata/threads/threads.c @@ -150,12 +150,12 @@ void netdata_threads_init_after_fork(size_t stacksize) { if(netdata_threads_attr && stacksize > (size_t)PTHREAD_STACK_MIN) { i = pthread_attr_setstacksize(netdata_threads_attr, stacksize); if(i != 0) - error("pthread_attr_setstacksize() to %zu bytes, failed with code %d.", stacksize, i); + netdata_log_error("pthread_attr_setstacksize() to %zu bytes, failed with code %d.", stacksize, i); else netdata_log_info("Set threads stack size to %zu bytes", stacksize); } else - error("Invalid pthread stacksize %zu", stacksize); + netdata_log_error("Invalid pthread stacksize %zu", stacksize); } // ---------------------------------------------------------------------------- @@ -169,7 +169,7 @@ void service_exits(void); static void thread_cleanup(void *ptr) { if(netdata_thread != ptr) { NETDATA_THREAD *info = (NETDATA_THREAD *)ptr; - error("THREADS: internal error - thread local variable does not match the one passed to this function. Expected thread '%s', passed thread '%s'", netdata_thread->tag, info->tag); + netdata_log_error("THREADS: internal error - thread local variable does not match the one passed to this function. Expected thread '%s', passed thread '%s'", netdata_thread->tag, info->tag); } if(!(netdata_thread->options & NETDATA_THREAD_OPTION_DONT_LOG_CLEANUP)) @@ -205,7 +205,7 @@ static void thread_set_name_np(NETDATA_THREAD *nt) { #endif if (ret != 0) - error("cannot set pthread name of %d to %s. ErrCode: %d", gettid(), threadname, ret); + netdata_log_error("cannot set pthread name of %d to %s. ErrCode: %d", gettid(), threadname, ret); else netdata_log_info("set name of thread %d to %s", gettid(), threadname); @@ -250,10 +250,10 @@ static void *netdata_thread_init(void *ptr) { netdata_log_info("thread created with task id %d", gettid()); if(pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL) != 0) - error("cannot set pthread cancel type to DEFERRED."); + netdata_log_error("cannot set pthread cancel type to DEFERRED."); if(pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL) != 0) - error("cannot set pthread cancel state to ENABLE."); + netdata_log_error("cannot set pthread cancel state to ENABLE."); thread_set_name_np(ptr); @@ -275,13 +275,13 @@ int netdata_thread_create(netdata_thread_t *thread, const char *tag, NETDATA_THR int ret = pthread_create(thread, netdata_threads_attr, netdata_thread_init, info); if(ret != 0) - error("failed to create new thread for %s. pthread_create() failed with code %d", tag, ret); + netdata_log_error("failed to create new thread for %s. pthread_create() failed with code %d", tag, ret); else { if (!(options & NETDATA_THREAD_OPTION_JOINABLE)) { int ret2 = pthread_detach(*thread); if (ret2 != 0) - error("cannot request detach of newly created %s thread. pthread_detach() failed with code %d", tag, ret2); + netdata_log_error("cannot request detach of newly created %s thread. pthread_detach() failed with code %d", tag, ret2); } } @@ -298,9 +298,9 @@ int netdata_thread_cancel(netdata_thread_t thread) { int ret = pthread_cancel(thread); if(ret != 0) #ifdef NETDATA_INTERNAL_CHECKS - error("cannot cancel thread. pthread_cancel() failed with code %d at %d@%s, function %s()", ret, line, file, function); + netdata_log_error("cannot cancel thread. pthread_cancel() failed with code %d at %d@%s, function %s()", ret, line, file, function); #else - error("cannot cancel thread. pthread_cancel() failed with code %d.", ret); + netdata_log_error("cannot cancel thread. pthread_cancel() failed with code %d.", ret); #endif return ret; @@ -312,7 +312,7 @@ int netdata_thread_cancel(netdata_thread_t thread) { int netdata_thread_join(netdata_thread_t thread, void **retval) { int ret = pthread_join(thread, retval); if(ret != 0) - error("cannot join thread. pthread_join() failed with code %d.", ret); + netdata_log_error("cannot join thread. pthread_join() failed with code %d.", ret); return ret; } @@ -320,7 +320,7 @@ int netdata_thread_join(netdata_thread_t thread, void **retval) { int netdata_thread_detach(pthread_t thread) { int ret = pthread_detach(thread); if(ret != 0) - error("cannot detach thread. pthread_detach() failed with code %d.", ret); + netdata_log_error("cannot detach thread. pthread_detach() failed with code %d.", ret); return ret; } |