Replace my_gettid with libosmocore osmo_gettid API
The API was moved to libosmocore, let's use it instead of defining our own here with all the complexity in build system involved. Depends: libosmocore.git Change-Id Id7534beeb22fcd50813dab76dd68818e2ff87ec2 Related: OS#5027 Change-Id: I19e32fbc47bd88a668e0c912e89b001b0f8831dd
This commit is contained in:
parent
cec9eda227
commit
5738940535
|
@ -32,6 +32,8 @@
|
||||||
#include "Timeval.h"
|
#include "Timeval.h"
|
||||||
#include "Logger.h"
|
#include "Logger.h"
|
||||||
|
|
||||||
|
#include <osmocom/core/thread.h>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
#ifndef HAVE_ATOMIC_OPS
|
#ifndef HAVE_ATOMIC_OPS
|
||||||
|
@ -108,7 +110,7 @@ void Signal::wait(Mutex& wMutex, unsigned timeout) const
|
||||||
void set_selfthread_name(const char *name)
|
void set_selfthread_name(const char *name)
|
||||||
{
|
{
|
||||||
pthread_t selfid = pthread_self();
|
pthread_t selfid = pthread_self();
|
||||||
pid_t tid = my_gettid();
|
pid_t tid = osmo_gettid();
|
||||||
if (pthread_setname_np(selfid, name) == 0) {
|
if (pthread_setname_np(selfid, name) == 0) {
|
||||||
LOG(INFO) << "Thread "<< selfid << " (task " << tid << ") set name: " << name;
|
LOG(INFO) << "Thread "<< selfid << " (task " << tid << ") set name: " << name;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -21,18 +21,6 @@
|
||||||
* See the COPYING file in the main directory for details.
|
* See the COPYING file in the main directory for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
/* If HAVE_GETTID, then "_GNU_SOURCE" may need to be defined to use gettid() */
|
|
||||||
#if HAVE_GETTID
|
|
||||||
#define _GNU_SOURCE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <sys/syscall.h>
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include <osmocom/core/logging.h>
|
#include <osmocom/core/logging.h>
|
||||||
#include <osmocom/core/utils.h>
|
#include <osmocom/core/utils.h>
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
@ -93,15 +81,3 @@ const struct log_info log_info = {
|
||||||
.cat = default_categories,
|
.cat = default_categories,
|
||||||
.num_cat = ARRAY_SIZE(default_categories),
|
.num_cat = ARRAY_SIZE(default_categories),
|
||||||
};
|
};
|
||||||
|
|
||||||
pid_t my_gettid(void)
|
|
||||||
{
|
|
||||||
#if HAVE_GETTID
|
|
||||||
return gettid();
|
|
||||||
#elif defined(LINUX) && defined(__NR_gettid)
|
|
||||||
return (pid_t) syscall(__NR_gettid);
|
|
||||||
#else
|
|
||||||
#pragma message ("use pid as tid")
|
|
||||||
return getpid();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <sys/types.h>
|
|
||||||
|
|
||||||
#include <osmocom/core/logging.h>
|
#include <osmocom/core/logging.h>
|
||||||
|
#include <osmocom/core/thread.h>
|
||||||
|
|
||||||
extern const struct log_info log_info;
|
extern const struct log_info log_info;
|
||||||
|
|
||||||
|
@ -19,12 +19,10 @@ enum {
|
||||||
DCTR,
|
DCTR,
|
||||||
};
|
};
|
||||||
|
|
||||||
pid_t my_gettid(void);
|
|
||||||
|
|
||||||
#define CLOGC(category, level, fmt, args...) do { \
|
#define CLOGC(category, level, fmt, args...) do { \
|
||||||
LOGP(category, level, "[tid=%ld] " fmt, (long int) my_gettid(), ##args); \
|
LOGP(category, level, "[tid=%ld] " fmt, (long int) osmo_gettid(), ##args); \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
#define CLOGCHAN(chan, category, level, fmt, args...) do { \
|
#define CLOGCHAN(chan, category, level, fmt, args...) do { \
|
||||||
LOGP(category, level, "[tid=%ld][chan=%zu] " fmt, (long int) my_gettid(), chan, ##args); \
|
LOGP(category, level, "[tid=%ld][chan=%zu] " fmt, (long int) osmo_gettid(), chan, ##args); \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
* update libosmocore dependency to > 1.3.x for osmo_sched_vty_init(), osmo_sched_vty_apply_localthread()
|
* update libosmocore dependency to > 1.3.x for osmo_sched_vty_init(), osmo_sched_vty_apply_localthread()
|
||||||
* update osmo-gsm-manuals dependency to > 0.3.0 for vty_cpu_sched.adoc include.
|
* update osmo-gsm-manuals dependency to > 0.3.0 for vty_cpu_sched.adoc include.
|
||||||
* update libosmocore dependency to > 1.4.x for osmo_fd_{read,write}_{enable,disable}()
|
* update libosmocore dependency to > 1.4.x for osmo_fd_{read,write}_{enable,disable}()
|
||||||
|
* update libosmocore dependency to > 1.4.2 for osmo_gettid()
|
||||||
|
|
|
@ -82,15 +82,6 @@ AC_TYPE_SIZE_T
|
||||||
AC_HEADER_TIME
|
AC_HEADER_TIME
|
||||||
AC_C_BIGENDIAN
|
AC_C_BIGENDIAN
|
||||||
|
|
||||||
# Check if gettid is available (despite not being documented in glibc doc, it requires __USE_GNU on some systems)
|
|
||||||
# C compiler is used since __USE_GNU seems to be always defined for g++.
|
|
||||||
save_CPPFLAGS=$CPPFLAGS
|
|
||||||
AC_LANG_PUSH(C)
|
|
||||||
CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
|
|
||||||
AC_CHECK_FUNCS([gettid])
|
|
||||||
AC_LANG_POP(C)
|
|
||||||
CPPFLAGS=$save_CPPFLAGS
|
|
||||||
|
|
||||||
PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.3.0)
|
PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.3.0)
|
||||||
PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 1.3.0)
|
PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 1.3.0)
|
||||||
PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl >= 1.3.0)
|
PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl >= 1.3.0)
|
||||||
|
|
Loading…
Reference in New Issue