This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
laforge gerrit-no-reply at lists.osmocom.orglaforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/22952 ) Change subject: logging: gsmtap: Store TID instead of PID in pkt hdr ...................................................................... logging: gsmtap: Store TID instead of PID in pkt hdr This allows differentiating threads withing an application, while still keeping same numbering for single-threaded application (since first thread ID is always the same as the process group ID). Related: OS#5027 Change-Id: I33da02524fc064e133b2b762af7060139c4cfd81 --- M src/logging_gsmtap.c 1 file changed, 5 insertions(+), 5 deletions(-) Approvals: Jenkins Builder: Verified fixeria: Looks good to me, approved diff --git a/src/logging_gsmtap.c b/src/logging_gsmtap.c index 0524602..e190f88 100644 --- a/src/logging_gsmtap.c +++ b/src/logging_gsmtap.c @@ -51,10 +51,11 @@ #include <osmocom/core/logging.h> #include <osmocom/core/timer.h> #include <osmocom/core/byteswap.h> +#include <osmocom/core/thread.h> #define GSMTAP_LOG_MAX_SIZE 4096 -static uint32_t logging_gsmtap_pid; +static __thread uint32_t logging_gsmtap_tid; static void _gsmtap_raw_output(struct log_target *target, int subsys, unsigned int level, const char *file, @@ -85,7 +86,9 @@ /* Logging header */ golh = (struct gsmtap_osmocore_log_hdr *) msgb_put(msg, sizeof(*golh)); OSMO_STRLCPY_ARRAY(golh->proc_name, target->tgt_gsmtap.ident); - golh->pid = logging_gsmtap_pid; + if (logging_gsmtap_tid == 0) + osmo_store32be((uint32_t)osmo_gettid(), &logging_gsmtap_tid); + golh->pid = logging_gsmtap_tid; if (subsys_name) OSMO_STRLCPY_ARRAY(golh->subsys, subsys_name + 1); else @@ -156,9 +159,6 @@ target->type = LOG_TGT_TYPE_GSMTAP; target->raw_output = _gsmtap_raw_output; - if (!logging_gsmtap_pid) - osmo_store32be((uint32_t)getpid(), &logging_gsmtap_pid); - return target; } -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/22952 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I33da02524fc064e133b2b762af7060139c4cfd81 Gerrit-Change-Number: 22952 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin at sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de> Gerrit-Reviewer: laforge <laforge at osmocom.org> Gerrit-MessageType: merged -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210218/b1adfa0a/attachment.htm>