platform/core/system/dlog.git
16 months agominiz: get rid of unused code 33/285433/3
Michal Bloch [Mon, 12 Dec 2022 17:54:44 +0000 (18:54 +0100)]
miniz: get rid of unused code

Slightly improves compile time and makes maintenance easier.

Change-Id: I5fa293286f81d5ff309f37a6cd1a4c5538383bde
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
16 months agolibdlog: implement a null backend 00/285500/7
Michal Bloch [Tue, 13 Dec 2022 16:28:02 +0000 (17:28 +0100)]
libdlog: implement a null backend

Set via 'backend=null' config entry, drops logs.

Note that backend-independent features (like limiter)
need to be disabled separately; a conf file is provided.

Change-Id: Id0afe298960ae8a57d72b0eba3b4cdb33811e7f0
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
16 months agodlog_logger: lazy poll only for Logger backend 57/285757/6
Michal Bloch [Mon, 19 Dec 2022 17:06:32 +0000 (18:06 +0100)]
dlog_logger: lazy poll only for Logger backend

The delay makes sense for Android Logger because it only reads logs
from an "external" (from the daemon's PoV) storage so they aren't
going anywhere, and it's good not to waste resources trying to read
them at boot time.

Meanwhile for the Pipe backend it is important for the daemon to
actively listen to clients who might be trying to write logs, since
in that case the daemon is the storage (so logs need to be written
immediately, for example for crash report reasons) and also the
implementation requires it (since pipes otherwise get clogged).

Change-Id: I215438459c334698b4f3c195f6fce69ab7454f9c
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
17 months agodlog_logger: remove duplicate code 28/285128/1
Michal Bloch [Tue, 6 Dec 2022 13:46:28 +0000 (14:46 +0100)]
dlog_logger: remove duplicate code

Change-Id: I218b74301576afdd18cb61dcf0be4a05b85c9208

17 months agoRelease 7.5.1 accepted/tizen/unified/20221206.100436
Michal Bloch [Fri, 2 Dec 2022 14:47:44 +0000 (15:47 +0100)]
Release 7.5.1

ID caching + compression framework

Change-Id: Ide7ba9e5b9129fe7d3770d9b56fdb3802cc86030

17 months agolibdlog: thread-local cache for pid/tid 87/284787/4
Michal Bloch [Wed, 23 Nov 2022 15:15:22 +0000 (16:15 +0100)]
libdlog: thread-local cache for pid/tid

Expand the thread-local pid/tid caching from the zero-copy backend
to all of them. This avoids a syscall or two per log, saving a lot
of performance.

Change-Id: I964b4bb79e400833c47adf5e0fc527f2aaa5e9c4
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
17 months agoDistribute compression benchmark onto target 58/284658/2
Michal Bloch [Tue, 22 Nov 2022 16:57:38 +0000 (17:57 +0100)]
Distribute compression benchmark onto target

Change-Id: If1b5f239e237901d89e2d2e914a2edb9b5d31660
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
17 months agoAdd miniz to the daemon framework 82/284482/3
Michal Bloch [Tue, 22 Nov 2022 11:54:43 +0000 (12:54 +0100)]
Add miniz to the daemon framework

Change-Id: If4b899546504659e320719ecb28286453b658e81

17 months agoAdd a compression framework to the daemon 81/284481/2
Michal Bloch [Tue, 22 Nov 2022 11:53:46 +0000 (12:53 +0100)]
Add a compression framework to the daemon

Currently only adds fastlz. Miniz to be added later.

Change-Id: I8703d45a2a5253a5823968fb81b5a9074a747a1c
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
18 months agoCompression buffer size spec: bytes -> kilobytes 46/283946/1
Michal Bloch [Fri, 4 Nov 2022 19:21:17 +0000 (20:21 +0100)]
Compression buffer size spec: bytes -> kilobytes

As in, `dlog_logger_conf_foo=dlogutil -r 123 -b main -m bar` now
creates a buffer for 123 KB whereas previously it was 123 bytes.

Fixes an inconsistency where for files (-f) this already meant
kilobytes, and makes the default sensible (1 KB -> 1 MB).

Change-Id: I1553c29051b674a91613921a5d4eec4f0dd09d4b
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
18 months agoRelease 7.5.0 66/283566/2 accepted/tizen/unified/20221102.172734
Karol Lewandowski [Fri, 28 Oct 2022 12:58:11 +0000 (14:58 +0200)]
Release 7.5.0

Support the rewritten zero-copy backend

Change-Id: I8be6f987dd1d7c7d81b3648bdf94ecc32db22e9f

18 months agoAdd tests for the miniz compression library 67/281067/17
Marek Szulc [Thu, 8 Sep 2022 14:18:55 +0000 (16:18 +0200)]
Add tests for the miniz compression library

Change-Id: Ic6c9a3ee7c9e97ee492eeed9f71aa738c81db21a
Signed-off-by: Marek Szulc <m.szulc3@samsung.com>
18 months agoAdd miniz compression library 56/282956/3
Marek Szulc [Thu, 13 Oct 2022 16:55:21 +0000 (18:55 +0200)]
Add miniz compression library

From https://github.com/richgel999/miniz

Change-Id: I139388170a7440afe588eaaa85246af1ebc088d2

18 months agoAdd benchmark framework for testing compression algos 64/283564/1
Marek Szulc [Mon, 26 Sep 2022 11:31:56 +0000 (13:31 +0200)]
Add benchmark framework for testing compression algos

Most tests originally come from test_fastlz_pos.c

Change-Id: Ie8fec39be15959ae0565701627f12d8093c29f22
Signed-off-by: Marek Szulc <m.szulc3@samsung.com>
18 months agoAdd a timespec handling helper 01/282801/4
Michal Bloch [Tue, 11 Oct 2022 11:32:30 +0000 (13:32 +0200)]
Add a timespec handling helper

Change-Id: I24657e243fc51ef2e284fd192bce1b205294adb0
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
18 months agoEnable tests for zero-copy backend 98/282798/5
Mateusz Majewski [Wed, 7 Sep 2022 12:57:16 +0000 (14:57 +0200)]
Enable tests for zero-copy backend

Change-Id: I963d42019ae4f1106cc9dc24f288b59539ee3103

18 months agoStore ze->len in a variable 26/283326/2
Mateusz Majewski [Mon, 24 Oct 2022 08:50:13 +0000 (10:50 +0200)]
Store ze->len in a variable

This is needed since ze is a pointer to shared memory and can change at
any time. Therefore, when load_single_device tries to do bound checks
for ze->len, they become invalid immediately, since the ze->len variable
contents can change right after the check.

Change-Id: Iaa169af3180000cd8a797e1753d569f7cb3ddbbf

18 months agoEnsure the timestamp always increases in zero-copy libdlog 01/283301/2
Mateusz Majewski [Fri, 21 Oct 2022 13:08:12 +0000 (15:08 +0200)]
Ensure the timestamp always increases in zero-copy libdlog

The kernel guarantees that it won't decrease, but if function is
executed in quick repetition it might happen that we get the same value
twice in a row. This is unacceptable, since the timestamp is the only
thing we rely on in order to sort the messages.

This mirrors a similar change in the kernel module, see 282866. In the
kernel the issue has been more visible since the kernel might split the
messages in a quite arbitrary way. In userspace the issue has been
harder to notice, but with Marek's changes increasing the performance it
has become more urgent.

Change-Id: I993529a2f8e7f8e477733c929232b10fb981eaba

18 months agozlogger: use dynamic mappings for each client 56/281156/14
Marek Szyprowski [Wed, 14 Sep 2022 08:16:43 +0000 (10:16 +0200)]
zlogger: use dynamic mappings for each client

Change-Id: I7cdf81ab79445d9121728dbecd140af8042fbc84
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
18 months agozlogger: use cache for gettid() to reduce logging hot path overhead 72/283172/5
Marek Szyprowski [Wed, 19 Oct 2022 15:48:35 +0000 (17:48 +0200)]
zlogger: use cache for gettid() to reduce logging hot path overhead

Use thread local variable to cache gettid() calls and clear it with
pthread_atfork() hook. This reduces the logging hot path overhead by
avoiding any kernel calls.

On RPi4 this reduced a test message logging time (averaged) from 2.2us
to 0.8us.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I8ed74a4442d76183f2403861ac3c428fd9b5b051

18 months agozlogger: don't call get_time() twice 58/283058/2
Marek Szyprowski [Mon, 17 Oct 2022 10:08:19 +0000 (12:08 +0200)]
zlogger: don't call get_time() twice

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I1e57a2dae628b0fc4aa2d2a954bfc6ad269ba09f

19 months agoFix dlogutil -t in zero-copy backend 96/282796/1
Mateusz Majewski [Tue, 11 Oct 2022 13:16:50 +0000 (15:16 +0200)]
Fix dlogutil -t in zero-copy backend

The removed code block looks sensible. However, this is actually done
somewhere else (compare the Android Logger backend, which works in a
similar way and doesn't really handle the dump value).

Change-Id: I68161e26bda09833f2a1c20870fa8f4f72c9acaa

19 months agoFix redirection check for zero-copy logger 83/282783/1
Mateusz Majewski [Tue, 11 Oct 2022 10:21:22 +0000 (12:21 +0200)]
Fix redirection check for zero-copy logger

Change-Id: Ieaf450b09b0058551148841153838d8a5aa291f8

19 months agoHotfix release 7.0.11
Michal Bloch [Mon, 10 Oct 2022 10:39:42 +0000 (12:39 +0200)]
Hotfix release 7.0.11

Fix zero-copy sorting

Change-Id: Ia2afa31554cba7fdbefe0cb4c710bd70ca381408

19 months agoFix zero copy sorting 67/282667/2
Mateusz Majewski [Fri, 7 Oct 2022 13:20:01 +0000 (15:20 +0200)]
Fix zero copy sorting

Otherwise, the multiplication overflows since sec_sent_mono is 32 bit
and NSEC_PER_SEC is kinda big.

Change-Id: I1b4ce376bad39792929142feb7c3a05308188112

19 months agoAdd timer and string test to test_fastlz_pos/neg.c 66/281066/19
Marek Szulc [Thu, 8 Sep 2022 14:13:50 +0000 (16:13 +0200)]
Add timer and string test to test_fastlz_pos/neg.c

Change-Id: Idd8d64ceb08430ab7fef52a854a0b15ce4fe29b3
Signed-off-by: Marek Szulc <m.szulc3@samsung.com>
19 months agoRelease 7.0.10 69/281769/1 accepted/tizen_7.0_unified_hotfix tizen_7.0_hotfix accepted/tizen/7.0/unified/20221110.062910 accepted/tizen/7.0/unified/hotfix/20221116.105708 accepted/tizen/unified/20220923.052703 tizen_7.0_m2_release
Michal Bloch [Wed, 21 Sep 2022 20:27:48 +0000 (22:27 +0200)]
Release 7.0.10

Adds the clear option to the zero-copy backend
and the default dlogutil format config option.

Change-Id: I31bb1ab6439e1aecea79fd21c5a7212d169d33d3

19 months agoAdd util_default_format configuration option 74/281474/7
Mateusz Majewski [Mon, 19 Sep 2022 09:42:09 +0000 (11:42 +0200)]
Add util_default_format configuration option

Change-Id: I6b3368007ca6546b5e6cf7cc340d27651354317d

19 months agoAdd clear operation to zero copy libdlogutil 66/281766/1
Mateusz Majewski [Wed, 7 Sep 2022 12:32:20 +0000 (14:32 +0200)]
Add clear operation to zero copy libdlogutil

Change-Id: If22bd2e78ec0ffe41f79d886c579e7615cddbba2

19 months agoAdd package to explicitly enable zero-copy dlog backend 70/281670/3 accepted/tizen/unified/20220921.022916
Karol Lewandowski [Tue, 20 Sep 2022 10:33:51 +0000 (12:33 +0200)]
Add package to explicitly enable zero-copy dlog backend

Change-Id: If977fd867e7459523bb384877cee6ff117146471

19 months agoActually store the block number in the thread-local 79/281679/1
Mateusz Majewski [Tue, 20 Sep 2022 12:39:40 +0000 (14:39 +0200)]
Actually store the block number in the thread-local

Change-Id: Ia5788deca19364199f397b51a9914aa63955ee9b

19 months agoRelease 7.0.8 95/281495/1
Karol Lewandowski [Mon, 19 Sep 2022 12:24:49 +0000 (14:24 +0200)]
Release 7.0.8

Change-Id: I2d75370c199830ee492d9baa4b7c98fccd6f1eef

19 months agoDo not allow overriding DLOG_CONFIG_PATH for setuid programs 94/281494/1
Karol Lewandowski [Mon, 19 Sep 2022 11:46:00 +0000 (13:46 +0200)]
Do not allow overriding DLOG_CONFIG_PATH for setuid programs

Unprivileged process could try to redirect logs to unused backend
potentially hiding malicious attemps to break into the program.

Change-Id: I4161467c2ff9014c048a1c9d6220a792d468187e

20 months agozlogger: correct calculation of buffer map/offset 40/281340/2
Marek Szyprowski [Thu, 15 Sep 2022 11:31:36 +0000 (13:31 +0200)]
zlogger: correct calculation of buffer map/offset

Fix calculation of buffer map & offset for the non-2KB buffer case.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I753f34b105439af4b7c5db13b5c08a7918aa4d02

20 months agoRelease 7.0.7 accepted/tizen/unified/20220917.094322 accepted/tizen/unified/20220919.013235
Michal Bloch [Thu, 15 Sep 2022 11:40:39 +0000 (13:40 +0200)]
Release 7.0.7

Integrate zlogutil into (lib)dlogutil

Change-Id: Ia3146a435b56575229958889a3842934fa37129b

20 months agoIntegrate zlogutil into libdlogutil 10/280910/3
Michal Bloch [Fri, 26 Aug 2022 15:54:18 +0000 (17:54 +0200)]
Integrate zlogutil into libdlogutil

Change-Id: I910ba8eda65721afc1a687b4d76b927587cde09b
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
20 months agoRelease 7.0.6 06/280906/1 accepted/tizen/unified/20220908.124823 submit/tizen/20220906.135332
Karol Lewandowski [Tue, 6 Sep 2022 13:39:32 +0000 (15:39 +0200)]
Release 7.0.6

Change-Id: Ia0fba0db16c7bbf743bba15df0b1f5880faf6475

20 months agoMake log-redirect-stdout refuse to redirect logs if they are disabled 43/280743/3
Mateusz Majewski [Fri, 2 Sep 2022 11:44:58 +0000 (13:44 +0200)]
Make log-redirect-stdout refuse to redirect logs if they are disabled

This is sometimes needed for integration tests to work.

Change-Id: I5c829b45442276982d053111142bb87e998d4712

20 months agoBring dlog-logger.conf.alias closer to dlog-logger.conf.test 42/280742/2
Mateusz Majewski [Fri, 2 Sep 2022 10:15:00 +0000 (12:15 +0200)]
Bring dlog-logger.conf.alias closer to dlog-logger.conf.test

Otherwise, the aliasing test will fail if a logger daemon is not running
outside of the tests.

Change-Id: Ic62909639ad0ea5fca3a8e0690f70bf194b3fa38

20 months agoHack in a graceful shutdown of the daemon in the zero-copy backend 13/280713/2
Mateusz Majewski [Fri, 2 Sep 2022 09:12:00 +0000 (11:12 +0200)]
Hack in a graceful shutdown of the daemon in the zero-copy backend

Change-Id: Ia01d41469b14895c0de5435a30bb290610ba9c47

20 months agoEnsure proper access rights for zlogger device 15/280815/1
Karol Lewandowski [Mon, 5 Sep 2022 10:31:40 +0000 (12:31 +0200)]
Ensure proper access rights for zlogger device

Change-Id: Ie3e9e4ee492df5a7a051ad4754f7a80290db17c3

20 months agoAdd zero-copy backend support to log-redirect-stdout 06/280606/1 submit/tizen/20220902.191720
Mateusz Majewski [Thu, 1 Sep 2022 06:34:57 +0000 (08:34 +0200)]
Add zero-copy backend support to log-redirect-stdout

Change-Id: I7e54084e89a1f0dfe0b94fc497d71e50492cb3e9

20 months agoAdd Zlogutil for reading zero-copy backend logs 34/278734/13
Michal Bloch [Tue, 19 Jul 2022 17:20:33 +0000 (19:20 +0200)]
Add Zlogutil for reading zero-copy backend logs

Change-Id: Iffaa7bbfcf8329e1e7888efd88cd13a7ba15f493
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
20 months agoAdd a zero-copy backend 33/278733/14
Michal Bloch [Thu, 23 Jun 2022 14:51:54 +0000 (16:51 +0200)]
Add a zero-copy backend

This is the initial implementation of a zero-copy backend,
also known as 'zlog' in various places.

Many facilities (logutil, stdout redirection etc) are to be
implemented in further commits, only writing is supported
so far.

It aims to minimize the cost of writing logs above all else.
When it comes to perf, it's pushin' it to the max, rollin' deep, baby.

Some traits:
 + limited syscalls (one per N logs)
 + no needless copies (writes directly to destination)
 - no way to monitor logs efficiently (which also has
   consequences for features like QoS)
 - kernel-based and somewhat convoluted

Change-Id: I183ca7ee29aaeb6d24b2c5da96fc353f2c298d3e
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
20 months agoReuse -m for memory compression mode 38/280038/2
Michal Bloch [Mon, 22 Aug 2022 10:56:14 +0000 (12:56 +0200)]
Reuse -m for memory compression mode

Previously known as --compress.
Monitor mode is now done via --monitor.

Change-Id: If88daa7da4e9a222c8c674beb4f79c03c5a3bff0
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
20 months agoReduce max logger request length 94/279394/2
Michal Bloch [Mon, 8 Aug 2022 11:37:34 +0000 (13:37 +0200)]
Reduce max logger request length

Change-Id: I243e1c7ca10e5c2a5f0e383e9b01c3731fe64bf5
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
21 months agoRelease 7.0.5 03/278903/4 accepted/tizen/unified/20220805.131749 submit/tizen/20220804.182348
Michal Bloch [Wed, 27 Jul 2022 17:28:30 +0000 (19:28 +0200)]
Release 7.0.5

Container warning logs pid/tid; minor optimisations

Change-Id: I158010e1209f08c9d96b482cb4c093604b86948d
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
21 months agoLess harsh thread cancellation prevention 90/277090/7
Michal Bloch [Wed, 29 Jun 2022 18:33:49 +0000 (20:33 +0200)]
Less harsh thread cancellation prevention

No longer disables cancels when lockless to save 2 syscalls.

Change-Id: Id5408a0558d7c359ac5b86bb8a9d9d1a228fdead
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
21 months agoFix insufficient test dir rights 44/279144/1
Michal Bloch [Tue, 2 Aug 2022 11:33:47 +0000 (13:33 +0200)]
Fix insufficient test dir rights

Change-Id: Ie2799cce6d9fd0d3a2b269f20978edaff8dcbae0
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
21 months agolib: avoid a needless rw-lock if possible 01/278901/3
Michal Bloch [Tue, 26 Jul 2022 13:51:17 +0000 (15:51 +0200)]
lib: avoid a needless rw-lock if possible

Change-Id: Ic65ed823f3453cf270d7a373e384b9553f44ca0c
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
21 months agolimiter: minor cleanup 00/278900/1
Michal Bloch [Tue, 26 Jul 2022 15:19:45 +0000 (17:19 +0200)]
limiter: minor cleanup

 - less pyramid
 - more commentary
 - fix programs sending 2^31 logs becoming able to log again

Change-Id: I3e51ba70d1f8f525a2324d991957d8f6634f6dfa
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
21 months agolibdlog: container warning contains PID/TID 26/278826/1
Michal Bloch [Tue, 26 Jul 2022 12:38:19 +0000 (14:38 +0200)]
libdlog: container warning contains PID/TID

Change-Id: I646a2dca987fabd73213c903caf161bf03adfadf
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
21 months agoMake headers a bit more C++ friendly 42/278642/2
Michal Bloch [Fri, 22 Jul 2022 21:09:32 +0000 (23:09 +0200)]
Make headers a bit more C++ friendly

logcommon.h:
 * put a listing of buffers in order (surprisingly, RADIO precedes SYSTEM)
 * cast between differently-signed values explicitly

logprint.h:
 * include dlog.h directly instead of going through logcommon.h

Change-Id: Id56a09e6ca6894443880bdf557accc9a4fb3ec27
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
22 months agolibdlog: reduce the "critical" section a bit 43/277043/1
Michal Bloch [Wed, 29 Jun 2022 18:13:56 +0000 (20:13 +0200)]
libdlog: reduce the "critical" section a bit

Change-Id: I3a1142d354605df89a3f7f1c9519230988edbf6c
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
22 months agolibdlog: more careful handling of null function ptrs 42/277042/1
Michal Bloch [Wed, 29 Jun 2022 16:11:36 +0000 (18:11 +0200)]
libdlog: more careful handling of null function ptrs

Change-Id: I1e621a3ee594fcabb55ac3b0c19846086780a1ce
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
23 months agoCreate units (.service and .socket) directory in the repository 17/276017/1 accepted/tizen/unified/20220610.134735 submit/tizen/20220608.120536 submit/tizen/20220608.235431
Hyotaek Shim [Wed, 8 Jun 2022 11:55:43 +0000 (20:55 +0900)]
Create units (.service and .socket) directory in the repository

Change-Id: Ide0e27067e804b77c7dc6edd58aab6df884c0079
Signed-off-by: Hyotaek Shim <hyotaek.shim@samsung.com>
23 months agoAdjust dlog backup size and # of backup files 03/276003/5
Hyotaek Shim [Wed, 8 Jun 2022 08:46:19 +0000 (17:46 +0900)]
Adjust dlog backup size and # of backup files

Change-Id: I00aafc6f48191ad21bf4cf59259503f38289a511
Signed-off-by: Hyotaek Shim <hyotaek.shim@samsung.com>
23 months agoAdd a note on tests to overview.rst 29/274229/4 accepted/tizen/unified/20220525.134532 accepted/tizen/unified/20220526.144134 submit/tizen/20220524.172119 submit/tizen/20220525.001052
Mateusz Majewski [Mon, 25 Apr 2022 05:43:17 +0000 (07:43 +0200)]
Add a note on tests to overview.rst

Change-Id: I0fd44548b48cd85a9ae21b20cd2bc8b30543f47e

2 years agoRelease 7.0.4 96/274796/1
Michal Bloch [Mon, 9 May 2022 12:59:46 +0000 (14:59 +0200)]
Release 7.0.4

Adds compressed in-memory log backup.

Change-Id: Ief49ba90ab6f7b92aa6b4a8fa360aa7984894deb
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
2 years agoImprove dlogutil compression handling / parsing 54/274454/6
Mateusz Majewski [Thu, 28 Apr 2022 11:14:56 +0000 (13:14 +0200)]
Improve dlogutil compression handling / parsing

Change-Id: I3dd8cec078fefed64dc94e7c5d5fb619fcd2b1f3

2 years agoIn-memory compressed log backup 70/271770/9
Michal Bloch [Tue, 26 Apr 2022 14:56:22 +0000 (16:56 +0200)]
In-memory compressed log backup

Change-Id: I87a94908152fab5808a1a6cd4791a171ad225aea

2 years agologutil: terminate error logs properly 55/274455/1
Michal Bloch [Thu, 28 Apr 2022 11:23:33 +0000 (13:23 +0200)]
logutil: terminate error logs properly

Change-Id: Ia496b3426e351f0e6d11517431d1200e6a41bb9b
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
2 years agoAdd a compressed storage struct + tests 32/274232/5
Michal Bloch [Sun, 24 Apr 2022 20:22:48 +0000 (22:22 +0200)]
Add a compressed storage struct + tests

Change-Id: I56cc99f0ac101b810612d1f1e7f95d5da4f6ec6c

2 years agoptrs_list: add find_if (similar to C++ STL) 96/274396/3
Michal Bloch [Tue, 26 Apr 2022 23:38:42 +0000 (01:38 +0200)]
ptrs_list: add find_if (similar to C++ STL)

Change-Id: Ia2851581d9304fca7ee15e96d1ee680ef586dc5b
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
2 years agoReader pipe: remove an unused timestamp 95/274395/3
Michal Bloch [Tue, 26 Apr 2022 22:59:54 +0000 (00:59 +0200)]
Reader pipe: remove an unused timestamp

Change-Id: Ice14689d33279cacb40f2fdee0928ad3db63edf6
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
2 years agoImprove pipe reader related function names 94/274394/3
Michal Bloch [Tue, 26 Apr 2022 22:38:22 +0000 (00:38 +0200)]
Improve pipe reader related function names

Memory reader is going to be very similar, avoids confusion.

Change-Id: I3c0d5721815e2052b2b1b1e8740c1ce7e181b99e
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
2 years agoExtract pipe reader functionality into subs 52/273652/7
Michal Bloch [Wed, 13 Apr 2022 16:30:00 +0000 (18:30 +0200)]
Extract pipe reader functionality into subs

Change-Id: I83d194543b400750c664b47ae6af8ccfac3920e7
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
2 years agoSubreaders: methods now return an error code 05/273705/6
Michal Bloch [Tue, 12 Apr 2022 18:07:20 +0000 (20:07 +0200)]
Subreaders: methods now return an error code

Change-Id: I1a474986796a82f721ddcd6550cce88453c2ee45
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
2 years agoptrs_list: add list_foreach_ret 04/273704/6
Michal Bloch [Tue, 12 Apr 2022 17:15:04 +0000 (19:15 +0200)]
ptrs_list: add list_foreach_ret

A variant of list_foreach which can return an error code.

Change-Id: Ib3cfcb55114b15674ca342c70b5a8a90d2819633
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
2 years agoreader_pipe now uses subreader_file 03/273703/6
Michal Bloch [Tue, 12 Apr 2022 14:21:52 +0000 (16:21 +0200)]
reader_pipe now uses subreader_file

Change-Id: I5578820db453ae899b7005761bee0539a1ecb8ba
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
2 years agoAdd some basic tests for FastLZ. 06/274106/5
Michal Bloch [Tue, 19 Apr 2022 08:03:06 +0000 (10:03 +0200)]
Add some basic tests for FastLZ.

Change-Id: I245de78a9b5b5d3fec80979351cc493700b4dbd3

2 years agoDLog-specific tweaks to FastLZ 05/274105/4
Michal Bloch [Thu, 21 Apr 2022 09:32:44 +0000 (11:32 +0200)]
DLog-specific tweaks to FastLZ

 * add a way to calculate the minimum compression output buffer size
   as required by the interface. This should've probably been baseline.

 * remove the unsafety compiler parameter because I don't want anybody
   to actually tweak it. Removing this safety check is still possible,
   but now somebody has to get his hands dirty and be aware of what
   the exact consequences are, as opposed to just tweaking what is
   essentially an opaque knob.

 * add a comment detailing whence the code was taken.

Change-Id: I1229a9364523b3a5526c9933ccfd09d9292f34a9
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
2 years agoImport FastLZ compression sources 71/273971/7
Michal Bloch [Thu, 21 Apr 2022 09:30:40 +0000 (11:30 +0200)]
Import FastLZ compression sources

A compression algo to be used in the daemon, for in-memory compressed logs.

MIT licensed.
From https://github.com/ariya/FastLZ @ c3bdfad9e0094d0fb15c12cd300e647c13dc85f9

Change-Id: I245de78a9b5b5d3fce80979351cc493700b4dbd3

2 years agolibdlog: mark logs from processes in a container 23/274123/1 accepted/tizen/unified/20220424.221508 submit/tizen/20220422.012056
Michal Bloch [Thu, 21 Apr 2022 15:49:49 +0000 (17:49 +0200)]
libdlog: mark logs from processes in a container

Change-Id: Id10045be42a875ab88f1defb39da41687c8a9a64

2 years agoRelease 7.0.3 25/273425/1 submit/tizen/20220405.121801
Michal Bloch [Tue, 5 Apr 2022 12:14:09 +0000 (14:14 +0200)]
Release 7.0.3

Mostly a safe checkpoint before a larger change.

Change-Id: I529c080514a373c53ff95dacc8fbf95c7517f49b
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
2 years agoFile reader: add sorting info 12/273012/2
Michal Bloch [Wed, 23 Mar 2022 18:23:52 +0000 (19:23 +0100)]
File reader: add sorting info

Pipe based readers have this buffer-dependent.

Change-Id: Idcc25fa572748aff0215fe01ac287860634d5023
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
2 years agoSimplify some unreachable code 11/273011/2
Michal Bloch [Fri, 18 Mar 2022 16:33:32 +0000 (17:33 +0100)]
Simplify some unreachable code

The case where `file.path` is not NULL was already handled.

Further commits are going to shuffle this chunk of code around
so it's good to trim it beforehand.

Change-Id: I8ac3e75a6f72a333bcb15450151a392faf08fc38
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
2 years agoreaders: reduce some copy-paste 10/273010/2
Michal Bloch [Fri, 18 Mar 2022 16:28:01 +0000 (17:28 +0100)]
readers: reduce some copy-paste

Change-Id: Idde6b37cf58f89345fd1808cf8f72b5cfc491e08
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
2 years agoreaders: make free a member func 09/273009/2
Michal Bloch [Fri, 18 Mar 2022 16:25:45 +0000 (17:25 +0100)]
readers: make free a member func

Regrettably, some tests had to be deleted because
adding a level of indirection breaks func wrapping.

Change-Id: I24ddd9af32fea7df5f5037a9d4c22b6fd1ff912e
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
2 years agoreaders: initialize fd entities properly 08/273008/2
Michal Bloch [Fri, 18 Mar 2022 16:22:41 +0000 (17:22 +0100)]
readers: initialize fd entities properly

Set the FD inside to -1 (as opposed to 0).
If something fails during init, that FD gets closed.

Change-Id: Ic50cadabc7ca4ec514e40878d49df027e450e61c
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
2 years agoreader: put the service handler into reader common 07/273007/2
Michal Bloch [Fri, 18 Mar 2022 16:19:21 +0000 (17:19 +0100)]
reader: put the service handler into reader common

Change-Id: I963e5d46e4a2bd8af45b30ee319f114ecaad3933
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
2 years agoreaders: put reader_common first 06/273006/2
Michal Bloch [Tue, 15 Mar 2022 18:30:52 +0000 (19:30 +0100)]
readers: put reader_common first

For easy casting into the derived classes.

Change-Id: Icf2d77b855b83b95f7af865bb4787c326cd07671
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
2 years agoreaders: commonize flushing 05/273005/2
Michal Bloch [Tue, 15 Mar 2022 17:27:08 +0000 (18:27 +0100)]
readers: commonize flushing

Change-Id: Ibfdb7d3489ef8ef3f6388dadd18ca966f54a7089
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
2 years agoMove sub-readers to the common reader 32/272232/1
Michal Bloch [Tue, 8 Mar 2022 17:07:22 +0000 (18:07 +0100)]
Move sub-readers to the common reader

This will allow the pipe reader to also use sub-readers.

Change-Id: Ib03dbab96631ba25ae6654da22e485cb14d2d8e2
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
2 years agodlog_logger: rearrange readers (no logic change) 31/272231/1
Michal Bloch [Tue, 8 Mar 2022 17:05:56 +0000 (18:05 +0100)]
dlog_logger: rearrange readers (no logic change)

Preparation for a refactoring of the reader code.

Move subreaders away from the Android Logger reader
files since they're going to be generic.

Change-Id: I00fe88e86db1871886a3a0993b141db56101e84c
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
2 years agoRefactor NULL check in logmetrics 57/271657/1
Mateusz Majewski [Thu, 24 Feb 2022 06:46:37 +0000 (07:46 +0100)]
Refactor NULL check in logmetrics

While the original check was (I think) correct, it was a bit confusing,
and we got a bug report from static analysis.

Change-Id: I54a904d441a4b67434da027fb9c50fcbbbcc8e59

2 years agoAdd generator for logger.ko device dependencies 30/271130/8 accepted/tizen/unified/20220221.224807 submit/tizen/20220217.170359 submit/tizen/20220220.125013
Karol Lewandowski [Tue, 15 Feb 2022 16:03:50 +0000 (17:03 +0100)]
Add generator for logger.ko device dependencies

This will dynamically generate needed systemd unit dependencies when logger.ko
devices are available (/dev/log_* devices are assumed to be used when these are
available due to backend autodetection).

Change-Id: I1b280d3878e6c4db5261f410722d3de84c583b60

2 years agoTests: add minor overflow check 24/270824/1
Michal Bloch [Wed, 9 Feb 2022 18:03:46 +0000 (19:03 +0100)]
Tests: add minor overflow check

Change-Id: I1dd3280bc6499a855caf436940bd5fb756345080
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
2 years agoMerge "Move to linux-tizen-modules-headers" into tizen
Karol Lewandowski [Fri, 21 Jan 2022 13:24:01 +0000 (13:24 +0000)]
Merge "Move to linux-tizen-modules-headers" into tizen

2 years agoAdd timestamp correctness test 35/269635/2 accepted/tizen/unified/20220121.122943 submit/tizen/20220120.173647
Mateusz Majewski [Wed, 19 Jan 2022 09:31:24 +0000 (10:31 +0100)]
Add timestamp correctness test

We had a bug where Android Logger kernel module accidentally returned
monotonic time instead of realtime time on some kernel versions. This
test checks whether the timestamp of a new log is somewhat close to
actual time in order to detect such bugs more easily.

Change-Id: Icd7ea0d774a15a30c1ef61860648328983f11adf

2 years agoFix buffer usage printing in dlogutil 48/269648/2
Mateusz Majewski [Wed, 19 Jan 2022 13:13:50 +0000 (14:13 +0100)]
Fix buffer usage printing in dlogutil

Without converting to unsigned long long, the calculation would overflow
when the buffer usage would get higher than around 42 MB. This doesn't
really happen, since the buffer capacity currently is not even close to
that value. However, there's no reason not to fix this.

Change-Id: Ib1a440b08ac01a1996f1542719070271d0936f79

2 years agoFix some invalid function names in dlogutil.h documentation 45/269645/2
Mateusz Majewski [Wed, 19 Jan 2022 12:20:19 +0000 (13:20 +0100)]
Fix some invalid function names in dlogutil.h documentation

Change-Id: I50a44e3b27fd913c3d4a15ac9ee14f5e2fbcdb2d

2 years agoMove gcov directory 98/269798/4
Mateusz Majewski [Thu, 20 Jan 2022 06:56:14 +0000 (07:56 +0100)]
Move gcov directory

Change-Id: Ic89cfac8f8f0ab08aafd15072edac558bc53c62c

2 years agoMove to linux-tizen-modules-headers 77/269477/1
Mateusz Majewski [Fri, 14 Jan 2022 18:49:41 +0000 (19:49 +0100)]
Move to linux-tizen-modules-headers

Change-Id: I8a981836b29ddf2c1935a7b8a2b650a71db7ab96

2 years agodlogutil: better error message for disabled kmsg 27/269227/2
Michal Bloch [Mon, 10 Jan 2022 13:08:23 +0000 (14:08 +0100)]
dlogutil: better error message for disabled kmsg

Shows a hint about the 'handle_kmsg' config entry.

Change-Id: I35e748580dbb22b071bb22088dfa49ee0b5c09e1
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
2 years agoReplace a custom loop with a simple strnlen 75/268675/3
Mateusz Majewski [Wed, 29 Dec 2021 08:29:39 +0000 (09:29 +0100)]
Replace a custom loop with a simple strnlen

Change-Id: Ie7fc0a2523a770ecad436be9922325ef01923d7a

2 years agoDocument auto-quit 69/268669/3
Mateusz Majewski [Wed, 29 Dec 2021 07:13:15 +0000 (08:13 +0100)]
Document auto-quit

Change-Id: I4d29565a1c769582a5dc7281acf14069b13d99bf

2 years agoRelease 7.0.1 28/268728/2 accepted/tizen/unified/20211231.161253 submit/tizen/20211230.133842
Karol Lewandowski [Thu, 30 Dec 2021 13:28:45 +0000 (14:28 +0100)]
Release 7.0.1

Additionally, provide a bit more information to the user why dlog_logger
process is terminating on its own.

Change-Id: Ie4e6e80960be2481b8a9dc82dc19ae7d77fc1cb0

2 years agoTerminate the daemon if it's not needed 46/268246/3
Mateusz Majewski [Thu, 16 Dec 2021 12:41:27 +0000 (13:41 +0100)]
Terminate the daemon if it's not needed

Change-Id: Icf8d83ff134ea84c8aa3c7a869bd8394f6c2685e

2 years agoRelease 7.0.0 88/266788/6 accepted/tizen/unified/20211125.144711 accepted/tizen/unified/20211213.132445 submit/tizen/20211119.132203 submit/tizen/20211124.010953 submit/tizen/20211124.100111 submit/tizen/20211126.122044 submit/tizen/20211203.141009
Karol Lewandowski [Thu, 18 Nov 2021 13:36:36 +0000 (14:36 +0100)]
Release 7.0.0

Change-Id: I39e79ac903c29e9aaaaf14340cc304849af08b78