diff options
| author | David Lamparter <equinox@diac24.net> | 2021-04-11 03:59:25 +0200 | 
|---|---|---|
| committer | David Lamparter <equinox@opensourcerouting.org> | 2021-06-18 21:05:21 +0200 | 
| commit | 78598fd0195510d0d1338bf8c28e606d67e63359 (patch) | |
| tree | 16748cd339dfa0636eb1c6afb3a6803aef927120 /lib/zlog.h | |
| parent | 8b94cb4388d62ad341ff352266dd5d91780e4eec (diff) | |
lib: cache PID & TID in zlog code
glibc removed its pid cache a while back, and grabbing this from TLS is
faster than repeatedly calling the kernel...
Also use `intmax_t` which is more appropriate for both PID & TID.
Signed-off-by: David Lamparter <equinox@diac24.net>
Diffstat (limited to 'lib/zlog.h')
| -rw-r--r-- | lib/zlog.h | 5 | 
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/zlog.h b/lib/zlog.h index 1b03e3fd12..7fd7b0e5c7 100644 --- a/lib/zlog.h +++ b/lib/zlog.h @@ -178,6 +178,11 @@ extern size_t zlog_msg_ts(struct zlog_msg *msg, struct fbuf *out,  extern size_t zlog_msg_ts_3164(struct zlog_msg *msg, struct fbuf *out,  			       uint32_t flags); +/* currently just returns the current PID/TID since we never write another + * thread's messages + */ +extern void zlog_msg_pid(struct zlog_msg *msg, intmax_t *pid, intmax_t *tid); +  /* This list & struct implements the actual logging targets.  It is accessed   * lock-free from all threads, and thus MUST only be changed atomically, i.e.   * RCU.  | 
