platform/core/system/dlog.git
5 years agosvace: set umask to protect tempfile 71/197771/6
sanghyeok.oh [Wed, 16 Jan 2019 08:13:28 +0000 (17:13 +0900)]
svace: set umask to protect tempfile

umask(077) needs to be called before mkstemp(),
to prevent a potential race condition vulnerability.

Change-Id: Id7c167e9627e55d563dc4a881a6ecfbb4843f70e
Signed-off-by: sanghyeok.oh <sanghyeok.oh@samsung.com>
Signed-off-by: Hyotaek Shim <hyotaek.shim@samsung.com>
5 years agoutil: allow filterspec to work with empty-tagged messages 58/197458/2 accepted/tizen/unified/20190117.151819 submit/tizen/20190116.045852
Maciej Slodczyk [Thu, 10 Jan 2019 13:21:45 +0000 (14:21 +0100)]
util: allow filterspec to work with empty-tagged messages

Change-Id: I9b49e3a07145e2f3dc83ab59b99e9ee340dab414
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
5 years agoMerge "testsuite: speed up format tests" into tizen
Michal Bloch [Mon, 7 Jan 2019 15:28:29 +0000 (15:28 +0000)]
Merge "testsuite: speed up format tests" into tizen

5 years agotestsuite: speed up format tests 07/196907/1
Maciej Slodczyk [Mon, 7 Jan 2019 11:46:19 +0000 (12:46 +0100)]
testsuite: speed up format tests

Get rid of unnecessary sorting in dlogutil
when performing format checks.

Change-Id: Iaecd583c3994f73de0b11626a89e87b19379f7ae
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
5 years agolibdlog: detect and notify about empty tagged messages 78/196578/3
Maciej Slodczyk [Wed, 2 Jan 2019 11:18:46 +0000 (12:18 +0100)]
libdlog: detect and notify about empty tagged messages

It is an error for an application to send a message with empty tag. To
make it easy to catch such situation and fix it in the app, empty-tagged
messages are exluded from limiter and marked with DLOG_ERROR_NOTAG tag.

Change-Id: I5ca0e0ef0e20f9d7cabcec11dad379023b7f0630
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
5 years agologctl: simplify and document a confusing function 06/196706/2 submit/tizen/20190107.090102
Michal Bloch [Thu, 3 Jan 2019 15:53:34 +0000 (16:53 +0100)]
logctl: simplify and document a confusing function

  Minor behaviour change: all affected lines are now moved to the end,
  in the order they were specified in the kv struct (used to stay in
  place) and duplicate keys are pruned (used to be left alone).

  Example: kv pairs {"A", "1"} and {"B", "2"}, file:
    C=3
    B=8
    A=4
    B=6
    D=4

  Previously, the resulting file:
    C=3
    B=2
    A=1
    B=2
    D=4

  Now:
    C=3
    D=4
    A=1
    B=2

  This has no effect on configs because the order among different keys
  doesn't matter and a given key used to get the same value across copies,
  but allows to simplify some logic.

Change-Id: Ib2ac9e07dced12614cde000dc3876e2887410537
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoFix log_config initialisation properly 90/196690/1
Michal Bloch [Thu, 3 Jan 2019 12:27:33 +0000 (13:27 +0100)]
Fix log_config initialisation properly

The test wrapper around log_config_read had different behaviour
than the real function and did not properly initialise members.

The previous fix was less elegant and is no longer needed.
This partially reverts commit 682e540702101156881a5c3219f1b27a8fcb4894.

Change-Id: Ib9210dabe0c6033fe22de073ceaada30e012cdc5
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoRelease 5.5.1 94/196594/1 submit/tizen/20190103.011939
Karol Lewandowski [Wed, 2 Jan 2019 14:20:58 +0000 (15:20 +0100)]
Release 5.5.1

This release adds follwing features:

 - dlog printf format is now enforced

 - android driver v2 is now required for android backend

 - reduce default client side buffer to 64k (from 1MB) due to
   global (system wide) limit

 - add testsuite together with coverage reporting

Lastly, long list of fixes.

Change-Id: I03af7cc3dba8c7c9fa8a8758f281cdb5eeef5b59

5 years agofix: test common: use correct cast to validate pipefd receive 93/196593/1
Karol Lewandowski [Wed, 2 Jan 2019 14:51:40 +0000 (15:51 +0100)]
fix: test common: use correct cast to validate pipefd receive

Change-Id: Ibf7b808ddfccdbdc9ea54e44f37961383099954e

5 years agofix: parse_number 64-bit architecture compatibility 66/196466/1 submit/tizen/20181231.025611
Karol Lewandowski [Sun, 30 Dec 2018 02:05:32 +0000 (03:05 +0100)]
fix: parse_number 64-bit architecture compatibility

Simplify strtol() return error code checking to properly handle 64-bit
architectures.  Problem appears only on 64-bit architectures, where
LONG_MAX (long type, 4 bytes) does not fit into regular int type
(4 bytes).

Additionally, this commit removes str2num() function which is copy
paste of parse_number (with same bugs).

Change-Id: I44cbcdd1e5601c8ed988368932e84f29f719c8a9

5 years agofix: ensure log_config is always properly initialized 64/196464/3
Karol Lewandowski [Fri, 28 Dec 2018 15:17:03 +0000 (16:17 +0100)]
fix: ensure log_config is always properly initialized

Proper initialization is required to be able to free the
structure after eg. failing log_config_read() which might
have either read some entries (and updated .begin/.end)
or have not read anything (keeping .begin/.end unchanged).

Change-Id: I3a2a2434488e13349746a85afcb4c81752609dd9

5 years agoRemove executable flag from non-executable files 81/196281/1 submit/tizen/20181227.070601
lokilee73 [Thu, 27 Dec 2018 03:11:54 +0000 (12:11 +0900)]
Remove executable flag from non-executable files

Change-Id: Ibf83f8fcec9a3596a317b3d202fc76eb89ecc259
Signed-off-by: lokilee73 <changjoo.lee@samsung.com>
5 years agotests: top up coverage of some files in shared 11/196111/1
Michal Bloch [Thu, 20 Dec 2018 17:26:54 +0000 (18:26 +0100)]
tests: top up coverage of some files in shared

Change-Id: I33be1871e67a90f20099afe8e632519253043e27
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agotests: extend logcommon unit tests 13/196013/3
Michal Bloch [Fri, 14 Dec 2018 19:33:32 +0000 (20:33 +0100)]
tests: extend logcommon unit tests

Change-Id: I64900e1c453be7131a05fdc886a290df756364bb
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agotests: reinstate 100% libdlog unit test coverage 12/196012/3
Michal Bloch [Thu, 20 Dec 2018 15:24:00 +0000 (16:24 +0100)]
tests: reinstate 100% libdlog unit test coverage

Change-Id: I4d5fb273567a63c04d21a87434cf532c5b62f383
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agotests: compile with -O0 11/196011/3
Michal Bloch [Tue, 18 Dec 2018 14:25:12 +0000 (15:25 +0100)]
tests: compile with -O0

autoconf adds some flags, including -O2, which prevents
gcov from properly measuring test coverage by optimizing
various functions and code paths out.

Change-Id: I288ed6261f6a07ed23e5cd09c7517bb4b39695ba
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agolibdlog: handle limiter allocation failures 10/196010/3
Michal Bloch [Thu, 20 Dec 2018 15:21:56 +0000 (16:21 +0100)]
libdlog: handle limiter allocation failures

Change-Id: Ie097957247c72c3d8cdccfbc4d3b080343582873
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agolibdlog: stricter correctness checks 09/196009/2
Michal Bloch [Tue, 18 Dec 2018 14:54:13 +0000 (15:54 +0100)]
libdlog: stricter correctness checks

Change-Id: Ice3b5b65d907e7c56c2924dcb94a3300b89a94ad
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoEnforce Android Logger device protocol version 2 57/194657/10 submit/tizen/20181221.003724
Michal Bloch [Thu, 13 Dec 2018 16:14:04 +0000 (17:14 +0100)]
Enforce Android Logger device protocol version 2

Will no longer fail on devices compatible with version 2 of the protocol
which change the GET_LOG_LEN ioctl behaviour where the returned value is
not the sum of the values returned by read() calls. Such devices are so
far a straight-up hypothetical, but it's better to exercise our foresight
right now rather than have to deal with the fallout after such change,
since as unlikely as a fix would be given that this behaviour is not in
theory an error and that DLog is the primary way to access this interface,
it doesn't look like Android Logger is getting abandoned anytime soon.

This patch also makes protocol version requirement checks more strict;
specifically, it makes support for version 2 mandatory. Previously such
devices would silently drop logs past the amount that would usually be
reported by a v2 device, so we now spare ourselves painful debugging
and won't have to pollute our code with exceptional handling of obsolete
versions. The drawback is not particularly harsh because virtually all
kernels nowadays have either dropped Android Logger devices altogether,
or use version 2.

Change-Id: Ic66f0abfb1de83fba454bfa151b7e40b90e30ad6
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoutil: document some tricky code 29/195729/2
Michal Bloch [Mon, 17 Dec 2018 15:40:30 +0000 (16:40 +0100)]
util: document some tricky code

Change-Id: I301c7bd877248201edb7ca27590ad348b18db06a
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agotests: add queued_entry unit tests 12/195612/1
Michal Bloch [Fri, 14 Dec 2018 18:29:46 +0000 (19:29 +0100)]
tests: add queued_entry unit tests

Change-Id: Ifd9748ba07f8f6a7e0faa7a2dc0871b9b9cc8617
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoFix minor issues with log entry parsing 11/195611/1
Michal Bloch [Fri, 14 Dec 2018 18:29:14 +0000 (19:29 +0100)]
Fix minor issues with log entry parsing

Change-Id: I2a566647cdde20aa7168d816afd1c78146567f4f
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoFix missing header inclusion 10/195610/1
Michal Bloch [Fri, 14 Dec 2018 18:28:27 +0000 (19:28 +0100)]
Fix missing header inclusion

`get_proper_clock` returns `clockid_t` which requires <time.h>

Change-Id: I40c6416246cde0d2033b80bf8eb7219f3500fb77
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agotestsuite: test tag based dynamic filters 40/195440/3
Maciej Slodczyk [Thu, 13 Dec 2018 11:43:18 +0000 (12:43 +0100)]
testsuite: test tag based dynamic filters

Change-Id: Iebea3f70867d117b765737113bead7837bd285f6
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
5 years agotestsuite: check if dlogctl denies invalid arguments 36/195336/3
Maciej Slodczyk [Wed, 12 Dec 2018 17:46:43 +0000 (18:46 +0100)]
testsuite: check if dlogctl denies invalid arguments

Change-Id: I7b50ead74478b210e04b1324ed7d2bf0da54d949
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
5 years agoApply __attribute__((format(printf..))) Warning to Public dlog_print() 38/195438/2 submit/tizen/20181213.113859
Hyotaek Shim [Thu, 13 Dec 2018 11:33:42 +0000 (20:33 +0900)]
Apply __attribute__((format(printf..))) Warning to Public dlog_print()

In public rootstrap, dlog-internal.h is removed.
So,
"#pragma GCC diagnostic warning "-Wformat"" will be applied instead of
"#pragma GCC diagnostic error "-Wformat""

Change-Id: I56beb06ac1cdb17fee45411e32f058f56b743bba
Signed-off-by: Hyotaek Shim <hyotaek.shim@samsung.com>
5 years agotests: add libdlog base unit tests 41/195341/1
Michal Bloch [Tue, 11 Dec 2018 19:33:19 +0000 (20:33 +0100)]
tests: add libdlog base unit tests

Change-Id: I9d489ed607d9917aaf782339b7db700259955ac9
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agolibdlog: fix reconstruction after destruction 40/195340/1
Michal Bloch [Mon, 10 Dec 2018 10:59:59 +0000 (11:59 +0100)]
libdlog: fix reconstruction after destruction

Change-Id: Ib3409ce958d6c936f9a44e337bbec50d36117d02
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agotestsuite: test filters added by dlogctl 34/195334/2
Maciej Slodczyk [Wed, 12 Dec 2018 16:54:19 +0000 (17:54 +0100)]
testsuite: test filters added by dlogctl

Change-Id: I3309ee558a3549438aa9a45bf17ab2ff03a184de
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
5 years agoutil: fix dlogutil failing with multiple buffers 35/195335/2
Maciej Slodczyk [Wed, 12 Dec 2018 16:57:00 +0000 (17:57 +0100)]
util: fix dlogutil failing with multiple buffers

Change-Id: Ia0375c7118194dddb51725af3cdfea3065de353f
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
5 years agotestsuite: make sure proper values are returned when testing filters 30/195330/2
Maciej Slodczyk [Wed, 12 Dec 2018 13:03:47 +0000 (14:03 +0100)]
testsuite: make sure proper values are returned when testing filters

Change-Id: I08200630ea299c71865f06da09a235ed395d533d
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
5 years agotestsuite: extend dynamic filters tests 29/195329/2
Maciej Slodczyk [Wed, 12 Dec 2018 12:59:38 +0000 (13:59 +0100)]
testsuite: extend dynamic filters tests

Dynamic filters directory SMACK label is now tested,
as well as alternative filters config file.

Change-Id: I3d2879885c87991965fab65339c68f0b05d9ab18
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
5 years agoshared: add log_config_copy & log_config_remove 05/195105/6
Michal Bloch [Tue, 11 Dec 2018 18:03:59 +0000 (19:03 +0100)]
shared: add log_config_copy & log_config_remove

The former copies a config structure and the latter removes
an entry under given key. Includes unit tests for both.

Change-Id: Ideca55a2b9fe9d0b038675e06f5ace72d12af78a
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agotests: add libdlog Android Logger unit tests 78/195078/2
Michal Bloch [Fri, 7 Dec 2018 16:29:02 +0000 (17:29 +0100)]
tests: add libdlog Android Logger unit tests

Change-Id: Ib529daa9fb8fff828c0255bdd871bf81b7263158
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agotests: add libdlog-pipe unit tests 66/194866/4
Michal Bloch [Fri, 7 Dec 2018 12:23:00 +0000 (13:23 +0100)]
tests: add libdlog-pipe unit tests

Change-Id: I7f25900125ba5901a527c6a1268a39e3d68c3710
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agolibdlog pipe: fix correctness checks 65/194865/2
Michal Bloch [Fri, 7 Dec 2018 12:21:22 +0000 (13:21 +0100)]
libdlog pipe: fix correctness checks

 * rejects on negative buffer ID (no longer crashes)
 * rejects relative socket paths
 * accepts maximal payloads

Change-Id: I7344cf4d47eb65c98a65a01ad4ada38ca9c9b5fd
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agolibdlog: fail early on long pipe paths 64/194864/2
Michal Bloch [Fri, 30 Nov 2018 11:42:08 +0000 (12:42 +0100)]
libdlog: fail early on long pipe paths

Change-Id: I779b8427db928c8dc29174b508194cbd38561329
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoFix `log_config_free` corrupting the config 18/195218/3
Michal Bloch [Tue, 11 Dec 2018 18:03:22 +0000 (19:03 +0100)]
Fix `log_config_free` corrupting the config

It used to leave the config in a corrupt state that
referenced freed memory and leaked any added entries.
This did not cause any actual problems because no
config structure was ever reused in production code,
only in tests which do that for convenience.

Change-Id: I90a52c31ca2985ab9c67b32849bca426fb3f1ed7
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoRevert "Apply __attribute__((format(printf..))) to Public dlog_print()" 46/195246/2
Hyotaek Shim [Wed, 12 Dec 2018 02:20:51 +0000 (02:20 +0000)]
Revert "Apply __attribute__((format(printf..))) to Public dlog_print()"

This reverts commit 6b5b9d0c435fa4b79395e22bc8ba39eedee3f0c0.

Change-Id: Id7739408a38f86f78ddaa12e93e42de2cc208a8d

5 years agodlogutil: allow printing current DLog version 77/195177/2
Maciej Slodczyk [Mon, 10 Dec 2018 15:20:38 +0000 (16:20 +0100)]
dlogutil: allow printing current DLog version

Change-Id: I49c1d4cf5c5bd725c9d516414e7fbd0774f2af8d
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
5 years agoMerge "dlogctl: allow empty priority when printing limits" into tizen
Maciej Slodczyk [Tue, 11 Dec 2018 08:32:11 +0000 (08:32 +0000)]
Merge "dlogctl: allow empty priority when printing limits" into tizen

5 years agoMerge "dlogsend: notify and return error code when message send fails" into tizen
Maciej Slodczyk [Tue, 11 Dec 2018 08:32:04 +0000 (08:32 +0000)]
Merge "dlogsend: notify and return error code when message send fails" into tizen

5 years agoFix compilation errors 01/195101/2
Michal Bloch [Mon, 10 Dec 2018 15:32:33 +0000 (16:32 +0100)]
Fix compilation errors

 * `malloc` requires `stdlib.h`
 * case labels only accept constants, not variables (even static const)

Change-Id: Ie508947abd79e6d3b47a08f63cb07dbf8463dd72
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agodlogsend: notify and return error code when message send fails 09/193809/5
Maciej Slodczyk [Mon, 26 Nov 2018 13:18:34 +0000 (14:18 +0100)]
dlogsend: notify and return error code when message send fails

Change-Id: I3545f90ef57a71e93ee59977d185d8c90306170b
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
5 years agodlogctl: allow empty priority when printing limits 61/194061/8
Maciej Slodczyk [Wed, 28 Nov 2018 14:54:44 +0000 (15:54 +0100)]
dlogctl: allow empty priority when printing limits

Change-Id: If2ed606bc3f99ba03cb87974f5ec7e09a2c3121b
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
5 years agoApply __attribute__((format(printf..))) to Public dlog_print() 43/194943/1
Hyotaek Shim [Mon, 10 Dec 2018 03:01:35 +0000 (12:01 +0900)]
Apply __attribute__((format(printf..))) to Public dlog_print()

to check format even for variable arguments (...)

format (printf, string-index, first-to-check)
- string-index : format string index (starting from 1)
- first-to-check : first argument index to be checked
https://gcc.gnu.org/onlinedocs/gcc-4.0.1/gcc/Function-Attributes.html#Function-Attributes

Change-Id: I852fcea60109517e50e26e3ee1a8064fd9bb649f
Signed-off-by: Hyotaek Shim <hyotaek.shim@samsung.com>
5 years agoApply __attribute__((format(printf..))) to internal __dlog_print() 81/194581/2 submit/tizen/20181207.015822
Hyotaek Shim [Thu, 6 Dec 2018 04:42:39 +0000 (13:42 +0900)]
Apply __attribute__((format(printf..))) to internal __dlog_print()

to check format even for variable arguments (...)

format (printf, string-index, first-to-check)
- string-index : format string index (starting from 1)
- first-to-check : first argument index to be checked
https://gcc.gnu.org/onlinedocs/gcc-4.0.1/gcc/Function-Attributes.html#Function-Attributes

Change-Id: I70ee2d0687c87b4f15f46dd962c249136d27709f
Signed-off-by: Hyotaek Shim <hyotaek.shim@samsung.com>
5 years agotests: add libdlog dynamic config unit tests 62/194262/2 accepted/tizen/unified/20181205.063352 submit/tizen/20181204.070128
Michal Bloch [Fri, 30 Nov 2018 10:37:00 +0000 (11:37 +0100)]
tests: add libdlog dynamic config unit tests

Change-Id: I120962c2b83f05d52487a955abd8731119e57b0d
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
(cherry picked from commit 8d4febbb4cbf3e7d322560ae7a438fd11b8d2954)

5 years agolibdlog: treat inotify creation errors as a failure 61/194261/1
Michal Bloch [Fri, 30 Nov 2018 10:36:19 +0000 (11:36 +0100)]
libdlog: treat inotify creation errors as a failure

Change-Id: I7abcfcf606fbd32c9b6806e6bab557ee6155a9e5
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agotests: don't report coverage of tests themselves 71/194071/3
Michal Bloch [Wed, 28 Nov 2018 20:16:34 +0000 (21:16 +0100)]
tests: don't report coverage of tests themselves

Counting test cases themselves in the report just inflates the coverage
since they tend to have a lot of lines that are executed unconditionally.

Change-Id: I74f961fb8432bbfef06fa522e06aad650ad94a6c
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoUse the actual bool type instead of a fake enum 44/193944/2
Michal Bloch [Tue, 27 Nov 2018 18:20:07 +0000 (19:20 +0100)]
Use the actual bool type instead of a fake enum

Improves type correctness and fixes a case of two functions
being identical - `log_config_get_boolean` used to just call
`log_config_get_int` with the same parameters and did not
even touch the return value.

Includes tests for `log_config_get_boolean`.

Change-Id: I185dfac32d40bcab3ddbf95d3b4536c2d275098e
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agotests: complete ptrs_list unit tests 70/194070/2 accepted/tizen/unified/20181130.064916 submit/tizen/20181129.005631
Michal Bloch [Wed, 28 Nov 2018 18:04:04 +0000 (19:04 +0100)]
tests: complete ptrs_list unit tests

Add tests for `list_clear_free_contents`, the last untested func.
Also improve type correctness.

Change-Id: I4ccc62268757b990e1462a9af9f76f7084848177
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agodlog_logger: read /dev/kmsg in a throttled loop 26/193726/3
Michal Bloch [Thu, 22 Nov 2018 19:17:42 +0000 (20:17 +0100)]
dlog_logger: read /dev/kmsg in a throttled loop

KMSG only returns one entry per read() - do it in a throttled loop
for efficiency. This is similar to how Android Logger devices are
handled.

Change-Id: I0f95dc657898a9d68bcfd96f9d2e2daab5814176
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agotestsuite: make sure all buffers are disabled when testing 64/194064/1
Maciej Slodczyk [Wed, 28 Nov 2018 16:25:35 +0000 (17:25 +0100)]
testsuite: make sure all buffers are disabled when testing

Change-Id: Ic48475b7862ffae7d7d1263fce885f31f68a0d16
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
5 years agotests: add libdlog limiter unit tests 37/193937/1
Michal Bloch [Mon, 26 Nov 2018 16:29:33 +0000 (17:29 +0100)]
tests: add libdlog limiter unit tests

Change-Id: I8dacfcf606fbd32c9b6806e6bab557ee6155a9e5
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agolimiter: fix internal priority mapping 08/193908/1
Michal Bloch [Tue, 27 Nov 2018 10:11:23 +0000 (11:11 +0100)]
limiter: fix internal priority mapping

Now makes sure the result is one of the chars "?*VDIWEFS".

Previously it could return lowercase characters, numerical
characters (except '8' which stands for SILENT but including
'1' which stands for DEFAULT which is not a real priority),
or the null character (when passed the integers 0 or 1).

Change-Id: I3766d699e553d71265a979ababe59fccdd16d571
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoFix a missing include 07/193907/1
Michal Bloch [Mon, 26 Nov 2018 16:35:12 +0000 (17:35 +0100)]
Fix a missing include

`stddef.h` is needed for `size_t`, which is
one of the arguments to `__log_limiter_dump_rule`.

Change-Id: Iffbf5666dbfffe26ac1214e0068628ecfb5dd789
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agolibdlog: reduce pipe size 1 MB → 64 kB 90/193790/2 accepted/tizen/unified/20181127.133459 submit/tizen/20181127.023050
Michal Bloch [Mon, 26 Nov 2018 10:36:39 +0000 (11:36 +0100)]
libdlog: reduce pipe size 1 MB â†’ 64 kB

It seems that the amount of memory allocated specifically to pipes
can be limited and on most targets it seems to be set to 16k pages,
that is, 64 MB raw memory. Pipes are currently very aggressively
sized which burns through this limit easily. 64 kB is still quite
a lot and should not cause any problems to prolific loggers while
heavily culling memory wastage.

Change-Id: I5465de849a279e23ca0d6bae34bceddd6136db16
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoFix pipe resize failure being considered an error 95/193795/2
Michal Bloch [Mon, 26 Nov 2018 11:00:57 +0000 (12:00 +0100)]
Fix pipe resize failure being considered an error

Pipes are enlarged so that prolific logging does not clog the pipe,
which is just an optimisation - logging can still continue if it
fails (albeit slower).

Change-Id: I5218512d3b22eea1636460ed463eeb2280faa9e7
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoBuild process: create a test coverage report 26/193826/2
Michal Bloch [Mon, 26 Nov 2018 12:57:45 +0000 (13:57 +0100)]
Build process: create a test coverage report

Uses LCOV to assemble a HTML report in the build directory.

Change-Id: I990d3d59b5fcb500708688c06e7f9a6573e39255
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agotests: add dlogctl buffer toggling tests 23/193723/2
Michal Bloch [Fri, 23 Nov 2018 13:15:24 +0000 (14:15 +0100)]
tests: add dlogctl buffer toggling tests

Change-Id: Ibbdfbc938799230cf3e036d7274bf9ffdc9b0e1e
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agotests: test misc utility stuff from logcommon.h 34/193734/3
Michal Bloch [Fri, 23 Nov 2018 17:18:10 +0000 (18:18 +0100)]
tests: test misc utility stuff from logcommon.h

Change-Id: Ib8ea673ae9eeae990dcfe8e998fc8383df3c8bae

5 years agotests: add daemon file descriptor checks 18/193718/1
Michal Bloch [Fri, 23 Nov 2018 11:41:22 +0000 (12:41 +0100)]
tests: add daemon file descriptor checks

Checks whether the daemon crashes with low FD limit
and whether it leaks any FDs.

Change-Id: I7352a0e71b5e066ad4600854f34d6bc67375df40
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agotests: cleanup programs when no longer needed 17/193717/1
Michal Bloch [Fri, 23 Nov 2018 11:41:35 +0000 (12:41 +0100)]
tests: cleanup programs when no longer needed

Change-Id: I5cbe9a0723d7cecc657198fb716e78256c5bbde9

5 years agodlogctl: fix -s working as -c if without -t or -p 36/193536/1 accepted/tizen/unified/20181123.063254 submit/tizen/20181122.055216
Michal Bloch [Wed, 21 Nov 2018 13:37:54 +0000 (14:37 +0100)]
dlogctl: fix -s working as -c if without -t or -p

Change-Id: Icf3dfee19d51a7312c4f392424774904622dd24e
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agodlogctl: add --clear / -c 68/193268/4 accepted/tizen/unified/20181121.060500 submit/tizen/20181120.234806
Michal Bloch [Fri, 16 Nov 2018 14:53:04 +0000 (15:53 +0100)]
dlogctl: add --clear / -c

Without any parameters, clears all rules. With just one of -t or -p
supplied, the other is assumed to be '*' (same logic as -g).

The argument to the -s option is now mandatory.

Change-Id: I3ec152e49076f58b1f052e4c21c32fcee0deff56
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agodlogctl: add a parameter correctness check 49/193449/2
Michal Bloch [Tue, 20 Nov 2018 10:58:24 +0000 (11:58 +0100)]
dlogctl: add a parameter correctness check

Now `-g -s 123 --disable` is disallowed.

Change-Id: I9b8163e21cbc9c4fe1d20d2d3c58d289cfb0f640
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agodlog_logger: commentary for the recent epoll fixes 46/193246/2
Michal Bloch [Thu, 15 Nov 2018 15:47:25 +0000 (16:47 +0100)]
dlog_logger: commentary for the recent epoll fixes

Some of the recent epoll changes needed an explanation
since it wasn't immediately obvious how they work.

Change-Id: Idecadedcd8bf8a570f65c602d7dbf11e971360f3
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agodlog_logger: fix writing to files 82/193182/1 accepted/tizen/unified/20181119.013237 submit/tizen/20181116.003516
Michal Bloch [Thu, 15 Nov 2018 15:47:25 +0000 (16:47 +0100)]
dlog_logger: fix writing to files

Change-Id: I172cb2dcd8bf8a570f65c602d7dbf11e971360f3
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agolibdlog: filters the `apps` buffer by default 10/193110/2 accepted/tizen/unified/20181115.151619 submit/tizen/20181115.015729
Michal Bloch [Wed, 14 Nov 2018 14:51:58 +0000 (15:51 +0100)]
libdlog: filters the `apps` buffer by default

Change-Id: Ie89cd6f5f660cc831aa55e95db7181720fca9191
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agoMerge "libdlog: enable dynamic filters by default" into tizen
Hyotaek Shim [Thu, 15 Nov 2018 01:48:25 +0000 (01:48 +0000)]
Merge "libdlog: enable dynamic filters by default" into tizen

6 years agoMerge "dlog_logger: reuse clock readings" into tizen
Hyotaek Shim [Thu, 15 Nov 2018 01:42:08 +0000 (01:42 +0000)]
Merge "dlog_logger: reuse clock readings" into tizen

6 years agolibdlog: fix a dynamic config crash 07/193107/1
Michal Bloch [Wed, 14 Nov 2018 15:09:59 +0000 (16:09 +0100)]
libdlog: fix a dynamic config crash

Change-Id: I83867775088438636cf483a14616b8ef49106a84
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agolibdlog: enable dynamic filters by default 04/193104/2
Michal Bloch [Wed, 14 Nov 2018 14:34:07 +0000 (15:34 +0100)]
libdlog: enable dynamic filters by default

Change-Id: I8f9a6ec4ab2d99c3bf4c4e36c6790db744747889
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agodlog_logger: reuse clock readings 03/193103/1
Michal Bloch [Wed, 14 Nov 2018 14:29:33 +0000 (15:29 +0100)]
dlog_logger: reuse clock readings

No need for every reader to read the same value on its own.

Change-Id: I91f0e81306061607cb848911bafaf69554b15229
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agodlog_logger: improve reader epoll registration 29/192129/4 accepted/tizen/5.0/unified/20181113.090059 accepted/tizen/unified/20181113.085958 submit/tizen/20181112.002448 submit/tizen_5.0/20181112.002456
Michal Bloch [Mon, 29 Oct 2018 16:54:28 +0000 (17:54 +0100)]
dlog_logger: improve reader epoll registration

 * now keeps readers registered with EPOLLHUP for
   immediate removal when the other end gets closed

 * no longer attempts to unregister already unregistered FDs

Change-Id: If5a28be45158896a174ab90259648602af594b92
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agoRelease 5.0.4 05/192205/2 accepted/tizen/unified/20181105.143907 submit/tizen/20181031.151907
Michal Bloch [Wed, 31 Oct 2018 13:45:42 +0000 (14:45 +0100)]
Release 5.0.4

Contains various fixes:
 * fix dynamic config not rejecting relative paths
 * fix libdlog not closing FDs on exec() under Android Logger backend
 * fix removal of the dynamic config file being unhandled
 * fix treating log limitation as an error

Also:
 * increase the daemon's FD limit from 1K to 16K
 * optimize dlogutil's dumping mode performance

Change-Id: Ic3ac0ab254490268698af46da73723e963edd57a
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agodlog_logger daemon: reaching FD limit leaves a log 99/191999/5
Michal Bloch [Fri, 26 Oct 2018 10:31:25 +0000 (12:31 +0200)]
dlog_logger daemon: reaching FD limit leaves a log

Change-Id: Ie70e7fa6e1fe5a3c394e0fd428cf0aa3375e03aa
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agoMerge "limiter: do not treat limiter restrictions as an error" into tizen
Maciej Slodczyk [Mon, 29 Oct 2018 11:30:37 +0000 (11:30 +0000)]
Merge "limiter: do not treat limiter restrictions as an error" into tizen

6 years agoMerge "Handle deleting dynamic configuration file" into tizen
Maciej Slodczyk [Mon, 29 Oct 2018 10:51:35 +0000 (10:51 +0000)]
Merge "Handle deleting dynamic configuration file" into tizen

6 years agolimiter: do not treat limiter restrictions as an error 65/191865/6
Maciej Slodczyk [Wed, 24 Oct 2018 15:54:04 +0000 (17:54 +0200)]
limiter: do not treat limiter restrictions as an error

Currently when a log is blocked by limiter rules,
dlog_print() returns an error code. Let it be blocked,
but return a success code - number of written bytes
(which is 0).

Change-Id: Ie37e3d0e17f0fa3cd9fef012412270bdce8565e2
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
6 years agoIncrease the limit of open files from 1K to 16K in dlog_logger 76/191976/2
Hyotaek Shim [Fri, 26 Oct 2018 08:07:19 +0000 (17:07 +0900)]
Increase the limit of open files from 1K to 16K in dlog_logger

Change-Id: Ib334e7762099fef2008adec29da9120115764b19
Signed-off-by: Hyotaek Shim <hyotaek.shim@samsung.com>
6 years agoHandle deleting dynamic configuration file 81/191781/2
Maciej Slodczyk [Tue, 23 Oct 2018 14:33:55 +0000 (16:33 +0200)]
Handle deleting dynamic configuration file

It's no longer an error when a dynamic configuration
file is deleted - restore default values both for plog and
filters in that case.

Change-Id: I3ec06aeba50f2e74bfee90736beeb5634d79e06d
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
6 years agoMerge "dynamic config: fail on relative paths" into tizen
Maciej Slodczyk [Mon, 22 Oct 2018 14:37:06 +0000 (14:37 +0000)]
Merge "dynamic config: fail on relative paths" into tizen

6 years agolibdlog: close Android Logger connections on exec 06/191706/1
Michal Bloch [Mon, 22 Oct 2018 12:16:18 +0000 (14:16 +0200)]
libdlog: close Android Logger connections on exec

Change-Id: Ib6576073f3c0c7f224a9d0c9605f879a9f347cd0
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agodynamic config: fail on relative paths 02/191702/1
Michal Bloch [Mon, 22 Oct 2018 10:25:11 +0000 (12:25 +0200)]
dynamic config: fail on relative paths

Change-Id: I50ca411b3268fdc25d1cb58a19f1dc8aa9752bbb
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agoutil: optimize dumping instance timezone handling 02/191502/2
Michal Bloch [Wed, 17 Oct 2018 12:08:39 +0000 (14:08 +0200)]
util: optimize dumping instance timezone handling

  We can assume that such instances will not see a timezone
  change happen during their lifetime, and even if they do,
  it is probably best if they ignore it (a dump would ideally
  behave as if it was atomic). This means we can optimize the
  behaviour where printing the timestamp requires us to check
  whether the timezone changed, which involves calling stat()
  on /etc/localtime, which is not cheap on its own and made
  even worse when multiple symlinks are involves.

  glibc has a feature where setting the TZ environmental var
  will cache the timezone, achieving precisely what we want.

Change-Id: I2f5e26a4be81b8f846036282fc1a0bfe02b70b48
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agoRelease 5.0.3 57/191657/1 submit/tizen/20181019.192244
Michal Bloch [Fri, 19 Oct 2018 19:11:10 +0000 (21:11 +0200)]
Release 5.0.3

Contains fixes and documentation for the recently added
dynamic configuration features:

 * the dlog-doc package now contains a usage guide describing
   the new feature with examples and common mistakes

 * fixed disabling dynamic configuration turning the limiter off as well

 * fixed disabling all buffers being permanent

 * fixed logs being able to slip through a disabled buffer

 * fixed dynamic config behaviour with forked processes

And some miscellaneous fixes:

 * fixed some resource leak and corruption issues

 * fixed some spurious static analysis warnings

 * fixed the config being needlessly read twice by libdlog

 * fixed the daemon not noticing timezone changes for the purpose
   of writing log files (on both backends)

Change-Id: I7acdc373c7acb5ae0b06bc0fe12ad507fd327d30
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agolibdlog: Do not remove the dynamic filter watch in library destructor 55/191655/3
Karol Lewandowski [Fri, 19 Oct 2018 19:07:44 +0000 (21:07 +0200)]
libdlog: Do not remove the dynamic filter watch in library destructor

Calling inotify_rm_watch() on inotify fd will remove watches for
all processes that share that inotify fd. This means that every
process that uses dlog and forks will have the dynamic config
feature broken.

This commit fixes that by removing the erroneous rm_watch.

Change-Id: If023d75937b5b435e2188aca7f70b57ce964c767

6 years agodocumentation: describe some common mistakes 56/191656/1
Michal Bloch [Fri, 19 Oct 2018 18:56:15 +0000 (20:56 +0200)]
documentation: describe some common mistakes

Change-Id: Ib18b454042a50152bc0815fe42780d2fb8a05004
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agoFurther documentation improvements 07/191407/3
Michal Bloch [Tue, 16 Oct 2018 12:49:05 +0000 (14:49 +0200)]
Further documentation improvements

 * fix some mistakes in the previous documentation commit
 * in particular, make the txt file actually end up in the doc rpm
 * extend config entry documentation
 * remove unused entries

Change-Id: I6f423ee42f5fc26059ee738909208719e4dd6753
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agodlog_logger: update timezone at runtime 01/191301/1
Michal Bloch [Mon, 15 Oct 2018 13:40:26 +0000 (15:40 +0200)]
dlog_logger: update timezone at runtime

glibc looks for the existence of the TZ variable and caches the timezone,
preventing extra stat() calls. This saves some performance but also sets
the timezone in stone.

The daemon can afford the performance hit as it is spread gradually over
time.

Change-Id: I15e789a391e7a443c284b4e08d20dd7163eccce5
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agolibdlog: fix broken limiter with static config 22/191222/1
Michal Bloch [Fri, 12 Oct 2018 14:23:39 +0000 (16:23 +0200)]
libdlog: fix broken limiter with static config

Change-Id: I0ecd8c3327ac12133aa2beb402bc1c52d598926b
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agolibdlog: fix buffer disabling issues 20/191220/1
Michal Bloch [Fri, 12 Oct 2018 14:15:46 +0000 (16:15 +0200)]
libdlog: fix buffer disabling issues

 - fix reenabling a buffer requiring a log to be
   sent to another already enabled buffer

 - fix one log being able to slip through into a
   disabled buffer if was enabled the previous time

Change-Id: I47af64b8a74da31c24472190f2ab22806d16db26
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agolibdlog: don't read the config twice 98/190498/2
Michal Bloch [Tue, 2 Oct 2018 11:29:38 +0000 (13:29 +0200)]
libdlog: don't read the config twice

Change-Id: I6c921f264cec7da77da0918ee94f03493f017424
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agoFix various static analysis warnings. 33/190833/2
Michal Bloch [Fri, 5 Oct 2018 17:17:12 +0000 (19:17 +0200)]
Fix various static analysis warnings.

Change-Id: I2e677130ee43e11abd870bd9647f15bdebde7667
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agodlogctl: documentation 44/190944/1
Michal Bloch [Tue, 9 Oct 2018 14:22:29 +0000 (16:22 +0200)]
dlogctl: documentation

 * the priority parameter is now `--priority`;
   note that `--prio`, as a contraction, is still accepted.

 * the dynamic config entry is now mentioned in `--help`,
   as is `limiter_apply_to_all_buffers`.

 * add a guide/manual on dlogctl to the documentation folder.
   Contains examples and commentary.

Change-Id: I80ce5f687f68d61efd729dffcfe70941c66ba3ab
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agoAdd MIT License file 99/190599/1 accepted/tizen/5.0/unified/20181102.020628 accepted/tizen/unified/20181010.061632 submit/tizen/20181005.011712 submit/tizen_5.0/20181101.000004
pr.jung [Thu, 4 Oct 2018 05:02:17 +0000 (14:02 +0900)]
Add MIT License file

Change-Id: I7baea949dc8ffd3a83aca16bddb017fbb91e7f41
Signed-off-by: pr.jung <pr.jung@samsung.com>
6 years agoMerge "dlogctl: add runtime platform logging control" into tizen submit/tizen/20181002.093115
Maciej Slodczyk [Tue, 2 Oct 2018 09:22:57 +0000 (09:22 +0000)]
Merge "dlogctl: add runtime platform logging control" into tizen

6 years agoMerge "Extend the platform logging config values" into tizen
Maciej Slodczyk [Tue, 2 Oct 2018 09:22:55 +0000 (09:22 +0000)]
Merge "Extend the platform logging config values" into tizen