platform/core/system/dlog.git
9 months agoconfigure: XO is long gone, long live Tizen 36/295536/3
Karol Lewandowski [Mon, 10 Jul 2023 11:50:44 +0000 (13:50 +0200)]
configure: XO is long gone, long live Tizen

This commit drops legacy configure options, including XO.

Change-Id: I35108361cc1f260e1fa3715f1d23f939f0b7a051

9 months agopackaging: Make vconf usage optional and disable it by default 35/295535/3
Karol Lewandowski [Mon, 10 Jul 2023 11:32:03 +0000 (13:32 +0200)]
packaging: Make vconf usage optional and disable it by default

vconf is used for low-memory notification, but vconf also uses dlog so adding it here
causes build loop:

   glib2->libdbuspolicy->libcynara-commons->dlog->buxton2->glib2

This commit keeps the feature but disables it by default.

Change-Id: I108f3bb5bbed1a4816bfb8ea8b125c8149a09ded

9 months agopackaging: Drop uneeded pkgconfig(vconf) for logger binary package 34/295534/1
Karol Lewandowski [Mon, 10 Jul 2023 11:40:16 +0000 (13:40 +0200)]
packaging: Drop uneeded pkgconfig(vconf) for logger binary package

pkgconfig() is for build deps, it's strictly unnecessary for dlog_logger binary package.

Change-Id: Ic014f07b5986ee7b448820d4788ffa257ab6944e

9 months agoFix the stdout redirection block 87/295287/1
Michal Bloch [Mon, 3 Jul 2023 14:51:16 +0000 (16:51 +0200)]
Fix the stdout redirection block

Change-Id: I38d80a33a8af0093eea3c59766c423c9148f1788

10 months agoRelease 8.0.0 65/295165/1
Michal Bloch [Mon, 3 Jul 2023 09:19:45 +0000 (11:19 +0200)]
Release 8.0.0

Add low-memory compression size reduction and stdout disabling.

Change-Id: I38d80a33a8af0093eea3c59766c423c9148f17c7

10 months agoMake logger resize storage when system is low on memory 64/295164/1
Antoni [Fri, 12 May 2023 14:11:45 +0000 (16:11 +0200)]
Make logger resize storage when system is low on memory

Logger registers for the wait on a vconf signal.

Change-Id: I38d80a33a8af0093eea3c59766c423c9148f17c3

10 months agodlog_logger: add log compressed storage resize to logctl options 37/288937/11
Marek Szulc [Fri, 12 May 2023 12:24:29 +0000 (14:24 +0200)]
dlog_logger: add log compressed storage resize to logctl options

Change-Id: I8a43bcb73fec343eb47e894c2fdcea6b15ddd38b

10 months agoAdd stdout redirection defaults to `dlog.conf` 85/294785/1 accepted/tizen/unified/20230706.152117
Michal Bloch [Fri, 23 Jun 2023 15:45:32 +0000 (17:45 +0200)]
Add stdout redirection defaults to `dlog.conf`

For discoverability.

Change-Id: I592a75d36a2915bf786ae54cc94591d606fa01c2

10 months agoDisallow redirecting to stdout based on config keys 94/294294/4
Antoni [Thu, 15 Jun 2023 19:58:06 +0000 (21:58 +0200)]
Disallow redirecting to stdout based on config keys

Change-Id: I592a75d36a2915bf786ae54cc94591d606fa01c1

10 months agoFix a scandirat failure in tests 84/294284/1 accepted/tizen_unified_dev tizen_dev accepted/tizen/unified/dev/20230726.115320
Michal Bloch [Wed, 14 Jun 2023 16:33:06 +0000 (18:33 +0200)]
Fix a scandirat failure in tests

scandirat would return EOVERFLOW.

Change-Id: I9b26e20b3d81595dcbd09dd0584c23a37ff68599

10 months agoFix snprintf(3) format truncation bug reported by gcc 13 34/294234/1
Łukasz Stelmach [Wed, 14 Jun 2023 14:28:26 +0000 (16:28 +0200)]
Fix snprintf(3) format truncation bug reported by gcc 13

src/tests/deduplicate_test.c: In function 'test_advanced_many_millisec':
src/tests/deduplicate_test.c:331:54: error: 'snprintf' output may be truncated before the last format character [-Werror=format-truncation=]
  331 |                         snprintf(msg, sizeof msg, "%d", index);
      |                                                      ^
src/tests/deduplicate_test.c:331:25: note: 'snprintf' output between 2 and 5 bytes into a destination of size 4
  331 |                         snprintf(msg, sizeof msg, "%d", index);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Change-Id: I9b26e20b3d81595dcbf09dd0584c23a37ff68599
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
11 months agoRemove dlog_print_{dotnet,native} information from the header 78/293178/1 accepted/tizen/unified/20230609.163732
Chanwoo Choi [Mon, 22 May 2023 06:19:33 +0000 (15:19 +0900)]
Remove dlog_print_{dotnet,native} information from the header

dlog.h header file is published by Tizen rootstrap in order to keep
the ABI compatibility. It should only contain the published
information. So that remove dlog_print_{dotnet,native} information
from the header

Change-Id: I91588df23017864fbc767a3c1bb2bebd48c71cf1
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
12 months agoRelease 7.5.5 89/291889/2 accepted/tizen/unified/20230427.041611
Michal Bloch [Mon, 24 Apr 2023 13:27:52 +0000 (15:27 +0200)]
Release 7.5.5

Fixes a race condition that could result in unsorted logs.

Change-Id: Ia21ef08956cff695c9402ad1a63ca87ea121e82c
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
12 months ago"""Fix""" an integration test 88/291888/2
Michal Bloch [Mon, 24 Apr 2023 13:16:04 +0000 (15:16 +0200)]
"""Fix""" an integration test

Change-Id: Iecc09484a4a8945b63828a54dc7e5b40cb9db16d
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
12 months agolibdlogutil: printing buffers get aliased 38/291738/3
Michal Bloch [Thu, 20 Apr 2023 20:21:57 +0000 (22:21 +0200)]
libdlogutil: printing buffers get aliased

Change-Id: I7b12fe7ab7cef14479cb09f6335eef54b6b131af
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
12 months agolibdlogutil: pipe requests aliased buffers 37/291737/3
Michal Bloch [Thu, 20 Apr 2023 18:33:55 +0000 (20:33 +0200)]
libdlogutil: pipe requests aliased buffers

Change-Id: I74dd76cf99c40355676a36dd7a5bea7e2c4a67af
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
12 months agoAlow multiplexing from writer-made readers 36/291736/2
Michal Bloch [Tue, 18 Apr 2023 13:43:50 +0000 (15:43 +0200)]
Alow multiplexing from writer-made readers

Change-Id: I0ab35b82c7c4e04909e4a011eee7ce4e99915562
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
12 months agolibdlogutil: pipe request sends buffer info 35/291735/2
Michal Bloch [Thu, 20 Apr 2023 17:23:40 +0000 (19:23 +0200)]
libdlogutil: pipe request sends buffer info

Change-Id: I980216d0f31f5192526507896ef91e96a26e3c25
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
12 months agolibdlogutil: minor refactor 34/291734/2
Michal Bloch [Thu, 20 Apr 2023 14:31:03 +0000 (16:31 +0200)]
libdlogutil: minor refactor

Change-Id: Ib46e7040b9d045f245839aa266562f6dbd1a39c3

12 months agolibdlogutil: extract op set check 33/291733/2
Michal Bloch [Thu, 20 Apr 2023 13:57:10 +0000 (15:57 +0200)]
libdlogutil: extract op set check

Change-Id: I3dfed3f6c298c594af2f41e98c95c347f99dd39c
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
12 months agolibdlogutil: extract buffer checks 32/291732/2
Michal Bloch [Tue, 18 Apr 2023 16:19:56 +0000 (18:19 +0200)]
libdlogutil: extract buffer checks

Delete tests because they can't read the config.

Change-Id: I3803b86ad0efc5e2b7e6c3e407b2ccd9fc6ebadf
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
12 months agodlog_logger: allow multiplexing pipe storage readers 69/291569/3
Michal Bloch [Mon, 17 Apr 2023 14:10:26 +0000 (16:10 +0200)]
dlog_logger: allow multiplexing pipe storage readers

Change-Id: I634643dbc26f7f4a8fec2d0e86e12cd16e75bf6c
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
12 months agoreader_pipe: get rid of dump/monitor flags 68/291568/2
Michal Bloch [Thu, 13 Apr 2023 13:42:14 +0000 (15:42 +0200)]
reader_pipe: get rid of dump/monitor flags

Only pass them to the storage reader

Change-Id: If7186778b234fa9e8a6a258474652e79a0eeb52f

12 months agodlog_logger: clear drained dumping storage readers 52/291352/3
Michal Bloch [Thu, 6 Apr 2023 15:32:23 +0000 (17:32 +0200)]
dlog_logger: clear drained dumping storage readers

Change-Id: I27316b35c3e06862953bae7ebe3541fc60d32b5c
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
12 months agoGeneral pyramidity reduction 51/291351/2
Michal Bloch [Tue, 4 Apr 2023 14:46:01 +0000 (16:46 +0200)]
General pyramidity reduction

40 levels of indentation look down upon you

Change-Id: I8178af8fd23b70337a189677d11a2fc1f767b7fd
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
12 months agodlog_logger: commonize adding server readers 50/291350/2
Michal Bloch [Tue, 4 Apr 2023 12:29:01 +0000 (14:29 +0200)]
dlog_logger: commonize adding server readers

Change-Id: Iac10a724188d407f2298515959096a34b8061ba5
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
12 months agodlog_logger: remove log_buffer ptr from pipe readers 49/291349/2
Michal Bloch [Tue, 4 Apr 2023 10:42:08 +0000 (12:42 +0200)]
dlog_logger: remove log_buffer ptr from pipe readers

Change-Id: I4a40704234e2f964b5961966b147c4711799011e

12 months agodlog_logger: server has just one nominal sorting 48/291348/2
Michal Bloch [Mon, 3 Apr 2023 14:04:16 +0000 (16:04 +0200)]
dlog_logger: server has just one nominal sorting

Change-Id: I926417dbbd46f55bc27887ffbd3a67de5c68b19e
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
12 months agoStorage readers: add `is_finished` for dumping readers 79/291279/1
Michal Bloch [Wed, 5 Apr 2023 12:42:50 +0000 (14:42 +0200)]
Storage readers: add `is_finished` for dumping readers

Both `log_compressed_storage` and regular uncompressed `log_storage`

Change-Id: Ia7265a91eb10350fa5269fe98e94780301687eea
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
12 months agoFix single-log dumping readers 78/291278/1
Michal Bloch [Wed, 5 Apr 2023 14:11:11 +0000 (16:11 +0200)]
Fix single-log dumping readers

Change-Id: I1a0326ff43130646affa211ed117bc6f5041f3af

13 months agodlog_logger: multiplex pipe storage readers (nominally) 77/291277/1
Michal Bloch [Wed, 29 Mar 2023 12:28:12 +0000 (14:28 +0200)]
dlog_logger: multiplex pipe storage readers (nominally)

There's still just one storage reader per pipe reader,
but it's now easy to add more.

Change-Id: I58b677dc0b1989c635207d345540bfad94a2dec2
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
13 months agoAdd log storage peeking 82/290682/2
Michal Bloch [Thu, 30 Mar 2023 11:41:32 +0000 (13:41 +0200)]
Add log storage peeking

Allows to "peek" at an entry without consuming it.

This is needed to be able to choose the best
storage to consume an entry from in the planned
multi-storage reader system.

Change-Id: Id62c6ff2cc4dac5d0fa925d6e01048da50bb2454
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
13 months agodlog_logger: pipe reader buffer param now a bitmask 57/290557/1
Michal Bloch [Fri, 24 Mar 2023 16:25:48 +0000 (17:25 +0100)]
dlog_logger: pipe reader buffer param now a bitmask

Internally only, no logic change. Multiple buffers are still rejected.

Change-Id: I556f91cb1346d80c0b8f04b70deca5875f32d417
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
13 months agodlog_logger: unify reader book-keeping 56/290556/1
Michal Bloch [Fri, 24 Mar 2023 17:46:20 +0000 (18:46 +0100)]
dlog_logger: unify reader book-keeping

Change-Id: I31d02853f4023b123f16e8469741fd62cba8d201
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
13 months agodlog_logger: get rid of Android Logger throttling 53/289853/3
Michal Bloch [Tue, 14 Mar 2023 16:33:56 +0000 (17:33 +0100)]
dlog_logger: get rid of Android Logger throttling

No longer needed now that each reader has its own thread,
since it won't starve other threads.

Change-Id: I90477fcd1510b9447027fc0f1bcfd67b45305514
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
13 months agoRelease 7.5.4 64/290364/1 accepted/tizen/unified/20230329.013219
Michal Bloch [Thu, 23 Mar 2023 15:36:24 +0000 (16:36 +0100)]
Release 7.5.4

Hide csharp API and add daemon multi-threading

Change-Id: I3e5557083ba2551d76a57080539de7e5491590cd

13 months agodlog_logger: simplify reader_logger 45/290145/2
Michal Bloch [Thu, 16 Mar 2023 12:22:01 +0000 (13:22 +0100)]
dlog_logger: simplify reader_logger

No longer uses the server abstraction

Change-Id: I6d60f6bd96c6f6c6460b418489cf39d9bac749b8
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
13 months agoHide dlog_print_{dotnet,native} from the header 25/289925/1
Michal Bloch [Wed, 15 Mar 2023 13:41:12 +0000 (14:41 +0100)]
Hide dlog_print_{dotnet,native} from the header

Change-Id: Ibcd9b7c2c7aaa0a96faaaf6cac4f870dc6d3434f
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
13 months agounit tests: fix a minor leak 01/289701/1
Michal Bloch [Mon, 13 Mar 2023 16:40:17 +0000 (17:40 +0100)]
unit tests: fix a minor leak

Change-Id: I021efcad0ee56fee4a1af8be568635a45ab6df7c
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
13 months agolog-redirect: don't put enormous vars on the stack 00/289700/1
Michal Bloch [Mon, 13 Mar 2023 14:25:32 +0000 (15:25 +0100)]
log-redirect: don't put enormous vars on the stack

Change-Id: I3e6df1c687d7d379f13078dbca7450cda34a97d5

13 months agodlog_logger: multi-thread logger readers 78/285378/7
Michal Bloch [Fri, 10 Feb 2023 17:39:40 +0000 (18:39 +0100)]
dlog_logger: multi-thread logger readers

Each Android Logger reader now has its own thread.
This means the daemon now has up to 5 threads, which
will make it more responsive and less likely to starve.

Future commits will introduce similar treatment for
pipe and memory readers if this change proves itself.

Change-Id: I197bf2905449109bdd7a497a571c89c366608b06
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
13 months agodlog_logger: add a dedicated signal handler thread 10/289210/6
Michal Bloch [Tue, 7 Mar 2023 16:14:56 +0000 (17:14 +0100)]
dlog_logger: add a dedicated signal handler thread

Change-Id: I026304f8023bd236d30f30bb356ccb99adbc4d52
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
13 months agodlog_logger: add a function for resizing log_compressed_storage 15/288915/11
Marek Szulc [Fri, 24 Feb 2023 09:29:03 +0000 (10:29 +0100)]
dlog_logger: add a function for resizing log_compressed_storage

Change-Id: I1a2631ac944ef7d1384245464c9a194e3eab535f

14 months agodlog_logger: build with -pthread 30/285130/8
Michal Bloch [Tue, 6 Dec 2022 13:25:01 +0000 (14:25 +0100)]
dlog_logger: build with -pthread

In preparation for multi-threading changes.
Also affects a dlog_logger-adjacent unit test.

Change-Id: I1aabef4640e96978c4b3f54d041048a42d44f7f3

14 months agodlog_logger: remove useless 'exiting' state 87/289087/1
Michal Bloch [Tue, 28 Feb 2023 17:57:38 +0000 (18:57 +0100)]
dlog_logger: remove useless 'exiting' state

Change-Id: I45da2cbfec8fd0243c2e6bd9636559220709fda7
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
14 months agodlog_logger: flush readers on free 86/289086/1
Michal Bloch [Tue, 28 Feb 2023 18:04:08 +0000 (19:04 +0100)]
dlog_logger: flush readers on free

Change-Id: Ie0c431a107900843474e9b0f0557a23fc0eb3254

14 months agotests: less confusing logic 45/289045/2
Michal Bloch [Mon, 27 Feb 2023 16:04:57 +0000 (17:04 +0100)]
tests: less confusing logic

No logic change, but it no longer looks like the test
is somehow obtaining logs that got cleared earlier.

Change-Id: I0c9293d13dd948ec3f41236212d5d774431e5f9d
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
14 months agodlog_logger: extract some struct logger functions 41/289041/2
Michal Bloch [Fri, 24 Feb 2023 21:18:55 +0000 (22:18 +0100)]
dlog_logger: extract some struct logger functions

No logic change, just moving code around.

Change-Id: Ie1f95a4661c71839f75dedebf93eac4f94177d87
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
14 months agoRelease 7.5.3 96/288696/1 accepted/tizen/unified/20230222.161514
Michal Bloch [Tue, 21 Feb 2023 14:03:29 +0000 (15:03 +0100)]
Release 7.5.3

 * add extra 'dotnet' and 'native' sinks
 * preparatory refactoring for daemon multithreading
 * assorted fixes

Change-Id: Id24ada5453ccc43c793f3527e7d1f328a9b558cf
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
14 months agoAdd the 'dotnet' and 'native' extra libdlog sinks 96/288296/4
Michal Bloch [Mon, 20 Feb 2023 15:29:19 +0000 (16:29 +0100)]
Add the 'dotnet' and 'native' extra libdlog sinks

Including dlog_[v]print_{dotnet,native} interfaces.

Change-Id: Ie1692f8302dd42fa9d7f399b158c3190137406a9
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
14 months agoAdd the concept of extra redirectable sinks 24/288624/2
Michal Bloch [Mon, 20 Feb 2023 15:29:05 +0000 (16:29 +0100)]
Add the concept of extra redirectable sinks

These are a lot like buffers, but are listed separately due
to stakeholder decision. See the description in the header file.

Change-Id: Ib1e24c7f11ed2a76e6c227b01762e2ae73f0ac1e
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
14 months agoDisallow adapter sinks (kmsg, syslog) from printing 23/288623/1
Michal Bloch [Mon, 20 Feb 2023 13:05:07 +0000 (14:05 +0100)]
Disallow adapter sinks (kmsg, syslog) from printing

Change-Id: I211d7d7afa4b0d0698985ae9e56352eac1ee3fe2
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
14 months agoUse buffer traits over specific IDs 95/288295/4
Michal Bloch [Tue, 14 Feb 2023 18:11:45 +0000 (19:11 +0100)]
Use buffer traits over specific IDs

Change-Id: I07c52156ff93650a318089185d1b1f255519bb51

14 months agoBuffer traits: add `platform` 45/288445/1
Michal Bloch [Wed, 15 Feb 2023 15:54:17 +0000 (16:54 +0100)]
Buffer traits: add `platform`

Change-Id: I21fd715d5fc03478bfbd23affd3af8ef67f294dc
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
14 months agoExtract buffer trait functions from logcommon 44/288444/1
Michal Bloch [Wed, 15 Feb 2023 15:45:19 +0000 (16:45 +0100)]
Extract buffer trait functions from logcommon

Change-Id: If920b77c08d79b3d704ff2aba5cbf48a40845485
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
14 months agoFix tool behaviour for disabled platform logging 94/288294/1
Michal Bloch [Tue, 14 Feb 2023 18:07:29 +0000 (19:07 +0100)]
Fix tool behaviour for disabled platform logging

Now consistent with what libdlog does. It could be extracted
to a unified function, but that is not in the scope of this patch.

Change-Id: Ifec204ceaae6aa852c62e437f779c2ba9bda1494

14 months agodlog_logger: move epoll metadata functions to fd_entity.c 46/288146/1
Michal Bloch [Fri, 10 Feb 2023 18:17:01 +0000 (19:17 +0100)]
dlog_logger: move epoll metadata functions to fd_entity.c

This is where they belong. Add doxygen documentation (mostly pro forma).

Change-Id: Ibbf2cab10f3d3bc2cebd6d20d592d809474af738
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
14 months agodlog_logger: commonize reader epoll dispatch 45/288145/1
Michal Bloch [Fri, 10 Feb 2023 15:49:34 +0000 (16:49 +0100)]
dlog_logger: commonize reader epoll dispatch

 * behaviour change: reader_logger will now get removed if
   clock_gettime fails. This doesn't seem like a real concern.

 * amend commentary to reflect our recent advances in knowledge.

Change-Id: Ia4ea04703cd82cf816ef9d6f38f02344cabc4aec
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
14 months agodlog_logger: readers unregister themselves from epoll 05/287705/2
Michal Bloch [Wed, 8 Feb 2023 18:05:39 +0000 (19:05 +0100)]
dlog_logger: readers unregister themselves from epoll

Prevents mistakes (dangling FD and/or broken book-keeping),
and simplifies things (with more future potential as usual).

Removes a test that seems to have tried to do something
vaguely illegal with FD entities, this is no longer relevant.

Change-Id: I6130f0d1b725f1931bfe36f5947b84cc4b5798ec

14 months agodlog_logger: readers now remove themselves from lists 44/288144/1
Michal Bloch [Wed, 8 Feb 2023 12:55:04 +0000 (13:55 +0100)]
dlog_logger: readers now remove themselves from lists

Prevents mistakes (no longer need to call both reader_free and
list_remove when removing a reader) and allows further simplification.

Change-Id: Icf31d96ea665638965d079683d59263df47fc946

14 months agodlog_logger: writer_free uses foreach 43/288143/1
Michal Bloch [Fri, 10 Feb 2023 12:43:26 +0000 (13:43 +0100)]
dlog_logger: writer_free uses foreach

Mostly for consistency with all the other foreach that are
going to be introduced for readers in further patches.

Change-Id: Ied26532bd13ed9644126acab98501a35e1ae4afe
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
14 months agodlog_logger: readers keep their owning server 57/288057/1
Michal Bloch [Wed, 8 Feb 2023 14:00:31 +0000 (15:00 +0100)]
dlog_logger: readers keep their owning server

Will allow readers to unregister themselves from server structures
when they are cleaned up, which allows to prevent mistakes via RAII
and makes it possible to commonize more reader handling functions.

Change-Id: I1e2e5645b3106465a877ebf2b7385e83364dfb61

14 months agodlog_logger: cleanup config line handling 56/288056/1
Michal Bloch [Wed, 8 Feb 2023 12:54:09 +0000 (13:54 +0100)]
dlog_logger: cleanup config line handling

 * remove needless setting to NULL (already NULL and would leak otherwise).
 * remove a needless void cast (just makes the code less type safe)
 * remove a needless conditional-but-not-really removal wrapper (proper API exists for this)

Change-Id: Iebc4f3cd76c5aa7973f16dca9c33575e0c21445a
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
14 months agoptrs_list: make list_foreach self removal safe 21/287921/2
Michal Bloch [Tue, 7 Feb 2023 15:50:33 +0000 (16:50 +0100)]
ptrs_list: make list_foreach self removal safe

The function applied in list_foreach is now allowed to remove
the element on which it is being applied. This will allow us
to simplify various patterns such as "conditional removal that
always returns true" in the daemon.

Change-Id: Ia6e908a3085ad3aecbc6b5eacdcd077fdedaa8e6

14 months agoptrs_list: simplify remove_at implementation 20/287920/1
Michal Bloch [Tue, 7 Feb 2023 16:29:44 +0000 (17:29 +0100)]
ptrs_list: simplify remove_at implementation

Consider a table with memory layout like this:

[A]->[B]->[C]->[D]

Now, consider the removal of B. Intuitively it would result in:

[A]------>[C]->[D]

Which is what will happen now. Previously, what happened was:

[A]->[C]------>[D]

meaning B wasn't actually removed; rather, C was removed and
B took on the value of C. This was not only needlessly complex
but also made it difficult to implement "safe" iteration
that lets one remove the value being iterated on, which is
going to be implemented in a subsequent patch.

Change-Id: Icca3066ecd7c6a33b3eaf9655780c1ffc97ba722
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
14 months agodlog_logger: QoS contained by aggregation 99/287699/2
Michal Bloch [Thu, 2 Feb 2023 15:02:36 +0000 (16:02 +0100)]
dlog_logger: QoS contained by aggregation

The server struct in dlog_logger now contains a pointer
to the QoS module struct (aggregation) instead of being
a member field (composition).

This lets multiple server structs share the same QoS module.

Change-Id: I573318cb74f76374a3cd93ad03d89b7892b7dcb3
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
14 months agodlog_logger: refactor QoS distributions 25/287625/3
Michal Bloch [Wed, 1 Feb 2023 18:02:01 +0000 (19:02 +0100)]
dlog_logger: refactor QoS distributions

 * now there's a getter that returns the appropriate func,
   instead of it being parsed inside config preparation code

 * the func is now a member of the QoS module struct instead
   of being global (this is related to the plan of wrapping
   logger readers in the server struct, since that contains
   an object of type QoS module)

Change-Id: Ic08bc091079e280c891f78b1358d68d63b377669
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
14 months agodlog_logger: extract main loop iteration 68/287568/4
Michal Bloch [Tue, 31 Jan 2023 13:10:44 +0000 (14:10 +0100)]
dlog_logger: extract main loop iteration

Needed to intertwine two server structs in a single loop, which will
be introduced in a further patch. The aim is to encapsulate a reader
in its own server struct to maintain identical behaviour when moved
to a separate thread.

Also makes the code cleaner (small building blocks, etc).

Change-Id: Id60f30df617f30b65a6b121eabfd6ebeed4af6db
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
14 months agodlog_logger: reader_logger keeps dev FD directly 56/286856/3
Michal Bloch [Fri, 13 Jan 2023 18:34:04 +0000 (19:34 +0100)]
dlog_logger: reader_logger keeps dev FD directly

This is in preparation for the future change where each reader
operates from its own thread and manages the FD independently.

Change-Id: Ic2e1637ccfb2ca389a0c154cba1478da6559592f
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
14 months agodlog_logger: cull unused logger readers 55/286855/3
Michal Bloch [Fri, 13 Jan 2023 20:08:28 +0000 (21:08 +0100)]
dlog_logger: cull unused logger readers

This will avoid unnecessary resource usage, in particular
needless threads when the transition happens.

Change-Id: Ia2a057b964f1ab0e9cefc582214495d37984ed4c

14 months agodlogctl: adjust the buffer enable/disable display 75/286775/3
Michal Bloch [Thu, 22 Dec 2022 13:32:00 +0000 (14:32 +0100)]
dlogctl: adjust the buffer enable/disable display

Put each ENABLE/DISABLE in its own line for easy parsing.

Fix tests to use only the lines they were meant to use.
When stdout status was added to the same line, parsing
in tests became able to use either of the two statuses.

Change-Id: I4d05b9dbb9ac3899976f13ff7e3fc1ed756359ee
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
15 months agodlog_logger: remove reader logger sink FD entity 54/286854/1
Michal Bloch [Fri, 13 Jan 2023 18:48:27 +0000 (19:48 +0100)]
dlog_logger: remove reader logger sink FD entity

Reader logger uses internal sub-readers as sinks,
so it does not need a sink FD entity to manage it.

Change-Id: I87248d83b26384e8f37b3999132526b4cd25be4d

15 months agodlog_logger: code documentation 53/286853/1
Michal Bloch [Fri, 13 Jan 2023 18:31:45 +0000 (19:31 +0100)]
dlog_logger: code documentation

Prevent tears in the rain.

Change-Id: Ia6d5160064c2a5e08d99b3026f32da4d3b8fe556

15 months agotests: extract header to a separate file 23/286423/3
Michal Bloch [Thu, 5 Jan 2023 18:50:03 +0000 (19:50 +0100)]
tests: extract header to a separate file

Can be included by specific, focused tests in the future,
allowing to reduce the time it takes to test individual
features (since a lot of time is wasted waiting for other
irrelevant tests to run).

Change-Id: Id5046219726a7cdeb2177ea10ac36d46fa717923

15 months agolibdlog: extract dynamic config inotify check 62/286362/2
Michal Bloch [Wed, 4 Jan 2023 15:33:20 +0000 (16:33 +0100)]
libdlog: extract dynamic config inotify check

Opens up the possibility for another implementation.

Change-Id: I0ed92ef14a8e24d5389ade4e76e26f3d58d71b75
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
15 months agoFix gcno file path 65/286665/7 accepted/tizen/unified/20230207.165802
Marek Szulc [Tue, 10 Jan 2023 16:08:57 +0000 (17:08 +0100)]
Fix gcno file path

Change-Id: Iab6285dbdd7a6b86390161e9a2b69388b36130fd
Signed-off-by: Marek Szulc <m.szulc3@samsung.com>
16 months agoAdd integration test for log limiter 24/285024/8
Marek Szulc [Wed, 30 Nov 2022 15:15:55 +0000 (16:15 +0100)]
Add integration test for log limiter

Change-Id: I951ececa259bed4a7aa5b2806dcdcc5e3aa40e89

16 months agoRelease 7.5.2 60/285760/4 accepted/tizen/unified/20221221.165305
Michal Bloch [Mon, 19 Dec 2022 18:43:27 +0000 (19:43 +0100)]
Release 7.5.2

Fix lazy polling and add a null backend.

Change-Id: I1b856b536857c6d882576e7fab82aafeb17ddfae
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
16 months agodlog_logger: refactoring 76/285376/4
Michal Bloch [Fri, 9 Dec 2022 15:29:01 +0000 (16:29 +0100)]
dlog_logger: refactoring

Now there's a function that just handles system IO,
and another function that just parses data. This is
to make adapting the IO part to multi-threading easier.

Change-Id: Ia185928c092de94e617ec76a937e312d90cf7b3e
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
16 months agodlog_logger: extract a static var to a struct 94/285294/4
Michal Bloch [Thu, 8 Dec 2022 15:43:42 +0000 (16:43 +0100)]
dlog_logger: extract a static var to a struct

Change-Id: Ib9b254d2a679833659c558572cc6516030a6548c
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
16 months agodlog_logger: abstract (sub-)reader operations 29/285129/5
Michal Bloch [Tue, 6 Dec 2022 13:47:52 +0000 (14:47 +0100)]
dlog_logger: abstract (sub-)reader operations

In preparation for future work.

Change-Id: I6e38452f41b030a4677a0d45a069350308160701

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>
16 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>
17 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>