Module: kamailio
Branch: master
Commit: bfe95c90e91a0bc33a769967a5841a4ab43a6553
URL: https://github.com/kamailio/kamailio/commit/bfe95c90e91a0bc33a769967a5841a4…
Author: Sebastian Kemper <sebastian_ml(a)gmx.net>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2021-11-03T13:03:34+01:00
core: add support for time64 libcs
libcs are implementing changes to fix the year 2038 issue on 32 bit
platforms (see [1]). musl libc already went ahead and implemented it,
starting with musl-1.2.0 (see [2]).
This commit adds the groundwork for always using the "lld" format when
dealing with time_t and casting the values to be formatted to (long
long). The aim is to be future proof and portable.
Example warning when not using TIME_T_FMT while compiling for a 32 bit
target using a time64 libc:
In file included from auth_identity.c:50:
auth_identity.c: In function 'check_date':
../../core/dprint.h:316:73: warning: format '%ld' expects argument of type 'long int', but argument 11 has type 'time_t' {aka 'long long int'} [-Wformat=]
316 | fprintf(stderr, "%2d(%d) %s: %.*s%s%s%s" fmt, \
| ^~~~~~~~~~~~~~~~~~~~~~~~
../../core/dprint.h:340:25: note: in expansion of macro 'LOG_FX'
340 | LOG_FX(facility, level, lname, prefix, _FUNC_NAME_, fmt, ## args)
| ^~~~~~
../../core/dprint.h:346:25: note: in expansion of macro 'LOG_FL'
346 | LOG_FL(facility, level, NULL, prefix, fmt, ## args)
| ^~~~~~
../../core/dprint.h:349:25: note: in expansion of macro 'LOG_FP'
349 | LOG_FP(DEFAULT_FACILITY, (level), LOC_INFO, fmt, ## args)
| ^~~~~~
auth_identity.c:594:17: note: in expansion of macro 'LOG'
594 | LOG(L_INFO, "AUTH_IDENTITY VERIFIER: Outdated date header value (%ld sec)\n", tnow - tmsg + glb_iauthval);
| ^~~
[1] https://sourceware.org/glibc/wiki/Y2038ProofnessDesign
[2] https://musl.libc.org/time64.html
Signed-off-by: Sebastian Kemper <sebastian_ml(a)gmx.net>
---
Modified: src/core/dprint.h
---
Diff: https://github.com/kamailio/kamailio/commit/bfe95c90e91a0bc33a769967a5841a4…
Patch: https://github.com/kamailio/kamailio/commit/bfe95c90e91a0bc33a769967a5841a4…
---
diff --git a/src/core/dprint.h b/src/core/dprint.h
index 65fcc6fc3c..fbdd349acb 100644
--- a/src/core/dprint.h
+++ b/src/core/dprint.h
@@ -35,6 +35,8 @@
#include "compiler_opt.h"
#include "cfg_core.h"
+#define TIME_T_FMT "lld"
+#define TIME_T_CAST(x) ((long long)(x))
/** dicover the function name */
/* C >= 99 has __func__, older gcc versions have __FUNCTION__ */
<!-- Kamailio Pull Request Template -->
<!--
IMPORTANT:
- for detailed contributing guidelines, read:
https://github.com/kamailio/kamailio/blob/master/.github/CONTRIBUTING.md
- pull requests must be done to master branch, unless they are backports
of fixes from master branch to a stable branch
- backports to stable branches must be done with 'git cherry-pick -x ...'
- code is contributed under BSD for core and main components (tm, sl, auth, tls)
- code is contributed GPLv2 or a compatible license for the other components
- GPL code is contributed with OpenSSL licensing exception
-->
#### Pre-Submission Checklist
<!-- Go over all points below, and after creating the PR, tick all the checkboxes that apply -->
<!-- All points should be verified, otherwise, read the CONTRIBUTING guidelines from above-->
<!-- If you're unsure about any of these, don't hesitate to ask on sr-dev mailing list -->
- [X] Commit message has the format required by CONTRIBUTING guide
- [ ] Commits are split per component (core, individual modules, libs, utils, ...)
- [X] Each component has a single commit (if not, squash them into one commit)
- [X] No commits to README files for modules (changes must be done to docbook files
in `doc/` subfolder, the README file is autogenerated)
#### Type Of Change
- [ ] Small bug fix (non-breaking change which fixes an issue)
- [X] New feature (non-breaking change which adds new functionality)
- [ ] Breaking change (fix or feature that would change existing functionality)
#### Checklist:
<!-- Go over all points below, and after creating the PR, tick the checkboxes that apply -->
- [ ] PR should be backported to stable branches
- [X] Tested changes locally
- [ ] Related to issue #XXXX (replace XXXX with an open issue number)
#### Description
<!-- Describe your changes in detail -->
Hello. I want to ask if increasing this #define(s) are feasible to commit upstream? We've come to the case where need at least +16 more for acc module and at least +8 more for core branches. Not sure if other people would need this.
1. If yes, let me know if i should split it in 2 commits, one for core and one for acc module
2. If no, please close this PR
Thank you,
Stefan
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/2891
-- Commit Summary --
* <a href="https://github.com/kamailio/kamailio/pull/2891/commits/378cfd7d02243544807a…">core, acc: increase define values</a>
-- File Changes --
M src/core/config.h (2)
M src/modules/acc/acc_api.h (2)
M src/modules/acc/acc_cdr.h (2)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/2891.patchhttps://github.com/kamailio/kamailio/pull/2891.diff
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/2891
#### Pre-Submission Checklist
- [x] Commit message has the format required by CONTRIBUTING guide
- [x] Commits are split per component (core, individual modules, libs, utils, ...)
- [x] Each component has a single commit (if not, squash them into one commit)
- [x] No commits to README files for modules (changes must be done to docbook files
in `doc/` subfolder, the README file is autogenerated)
#### Type Of Change
- [x] Small bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds new functionality)
- [ ] Breaking change (fix or feature that would change existing functionality)
#### Checklist:
- [x] PR should be backported to stable branches
- [x] Tested changes locally
- [x] Related to issue #2892
#### Description
When Kamailio goes to shutdown then routing hash table cleaned properly.
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/2896
-- Commit Summary --
* <a href="https://github.com/kamailio/kamailio/pull/2896/commits/ce6453920f4a28d79e0d…">core: fixed route hash table cleanup</a>
-- File Changes --
M src/core/route.c (7)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/2896.patchhttps://github.com/kamailio/kamailio/pull/2896.diff
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/2896