platform/core/system/dlog.git
4 years agoRelease 6.0.4 89/223189/1 accepted/tizen/unified/20200129.022642 submit/tizen/20200124.122926
Michal Bloch [Fri, 24 Jan 2020 11:50:11 +0000 (12:50 +0100)]
Release 6.0.4

This release adds the critical logging functionality.

Change-Id: I90b479d53aed2d8dea84ea1c4bcc3a4e554fd57f
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
4 years agotests: solve some coverage regressions 36/222736/3
Michal Bloch [Thu, 16 Jan 2020 10:03:27 +0000 (11:03 +0100)]
tests: solve some coverage regressions

Change-Id: I8dd82a6ba2da72db797db62f1d71d9fdd8c67572
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
4 years agotests: fix scandirat wrapping 88/223188/3
Michal Bloch [Fri, 24 Jan 2020 11:20:31 +0000 (12:20 +0100)]
tests: fix scandirat wrapping

Change-Id: I381d623749ddc90deb2ddad7d828dbbc20c160df
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
4 years agoMerge "Create the critical log file at package install" into tizen
Karol Lewandowski [Fri, 24 Jan 2020 11:26:55 +0000 (11:26 +0000)]
Merge "Create the critical log file at package install" into tizen

4 years agoMerge changes into tizen
Karol Lewandowski [Fri, 24 Jan 2020 11:26:55 +0000 (11:26 +0000)]
Merge changes  into tizen

4 years agoMerge changes from topic "kritzkrieg" into tizen
Karol Lewandowski [Fri, 24 Jan 2020 11:26:55 +0000 (11:26 +0000)]
Merge changes from topic "kritzkrieg" into tizen

* changes:
  Create the critical log writer program
  logsend: add -k option for critical logs

4 years agoCreate the critical log file at package install 63/223163/1
Michal Bloch [Thu, 23 Jan 2020 11:26:30 +0000 (12:26 +0100)]
Create the critical log file at package install

Change-Id: I089dec6c016c924237f550e5e7a01dbea54d9733
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
4 years agoCreate the critical log writer program 41/222841/6
Michal Bloch [Mon, 20 Jan 2020 14:11:46 +0000 (15:11 +0100)]
Create the critical log writer program

Change-Id: I079979b8ca1a369ad24327b7219e2556d819f71d
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
4 years agologsend: add -k option for critical logs 42/222842/5
Michal Bloch [Mon, 20 Jan 2020 14:51:50 +0000 (15:51 +0100)]
logsend: add -k option for critical logs

Change-Id: I4b6a69d73eb14fa17c676aeadad490df83b981a5
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
4 years agolibdlog: add __dlog_critical_print to the API 38/222738/11
Michal Bloch [Fri, 17 Jan 2020 12:08:52 +0000 (13:08 +0100)]
libdlog: add __dlog_critical_print to the API

Still requires the special privileged logging program,
so doesn't yet do anything.

Change-Id: Id1195957592f0fa475cf8f9482b5edd8b2bc04fe
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
4 years agoMake the libdlogutil sorting test actually test something 46/223146/2
Mateusz Majewski [Mon, 20 Jan 2020 13:30:01 +0000 (14:30 +0100)]
Make the libdlogutil sorting test actually test something

-.-

Change-Id: I15b38f7fb41ad950ae75b78cee5666e9820f6d1b

4 years agoImprove some test signatures 40/222840/2
Mateusz Majewski [Mon, 20 Jan 2020 12:41:01 +0000 (13:41 +0100)]
Improve some test signatures

Change-Id: I2ac0b8f6f8848d76ca3e4d5217a26ef6efced9b5

4 years agoMove priority / char mapping to logcommon 39/222739/3
Michal Bloch [Fri, 17 Jan 2020 13:13:45 +0000 (14:13 +0100)]
Move priority / char mapping to logcommon

Change-Id: I65206d11e943f4d4aea02c38ebeccf7a7927eb25
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
4 years agoRelease 6.0.3 40/222740/1 accepted/tizen/unified/20200121.121505 submit/tizen/20200117.161457 submit/tizen/20200120.091007
Karol Lewandowski [Fri, 17 Jan 2020 15:53:44 +0000 (16:53 +0100)]
Release 6.0.3

This release brings addion of libdlogutil - library and API.

Change-Id: I4b7742ffe58b1090f6ee042a58001850d0df8008

4 years agoImplement the first version of the libdlogutil library 97/214497/75
Mateusz Majewski [Fri, 25 Oct 2019 06:24:44 +0000 (08:24 +0200)]
Implement the first version of the libdlogutil library

Change-Id: I2bf179f93df97e157a625c3538d6c9ddefa1e68b

4 years agoMerge "Filterspec get/setters: conform to Tizen API style" into tizen
Michal Bloch [Fri, 17 Jan 2020 10:35:17 +0000 (10:35 +0000)]
Merge "Filterspec get/setters: conform to Tizen API style" into tizen

4 years agoFilterspec get/setters: conform to Tizen API style 05/222305/6
Mateusz Majewski [Mon, 13 Jan 2020 10:10:23 +0000 (11:10 +0100)]
Filterspec get/setters: conform to Tizen API style

Change-Id: I265d5e7b2891b70a6d964f0409b13c18e0154c46

4 years agoEntry getters return error code 99/222299/7
Michal Bloch [Mon, 13 Jan 2020 09:28:04 +0000 (10:28 +0100)]
Entry getters return error code

And return the actual thing through a parameter.
This is the Tizen API style.

Change-Id: Ibf4056a3d3a70c4c27de0b9bf5534c4bb575628c

4 years agoRemove DLOGUTIL_SORT_MAX 98/222298/5
Michal Bloch [Mon, 13 Jan 2020 09:17:48 +0000 (10:17 +0100)]
Remove DLOGUTIL_SORT_MAX

Only used in a test and is unwanted in an API

Change-Id: Ic186c6de6150bc004c5033469a3efe2f44c52901

4 years agoChange some `size_t` to `unsigned int` 96/222296/7
Mateusz Majewski [Mon, 13 Jan 2020 08:54:36 +0000 (09:54 +0100)]
Change some `size_t` to `unsigned int`

Tizen interfaces are fairly consistent in only using `size_t` when the
variable represents the size of some object in bytes. Therefore we're
changing our variables away from `size_t` as they represent the number
of objects.

Change-Id: I7e9b0a66d51ad1ca0114387d8dbc40914f605138

4 years agoFix to handle F_SETLKW64 in the test code 23/222523/1 accepted/tizen/unified/20200116.104151 submit/tizen/20200116.015057
Semun Lee [Thu, 16 Jan 2020 01:02:21 +0000 (10:02 +0900)]
Fix to handle F_SETLKW64 in the test code

glibc is changed to call fcntl64 in a certain configuration.

refer to: https://sourceware.org/git/?p=glibc.git;a=commit;h=06ab719d30b01da401150068054d3b8ea93dd12f

Change-Id: Id89344430e0c85a4cf6e0bd7537c143add247d18
Signed-off-by: Semun Lee <semun.lee@samsung.com>
4 years agoWorkaround a flaw in the build toolchain 59/221359/5 accepted/tizen/unified/20200115.123335 submit/tizen/20200114.152758 submit/tizen/20200115.044909 submit/tizen/20200115.100804
Michal Bloch [Tue, 14 Jan 2020 14:18:53 +0000 (15:18 +0100)]
Workaround a flaw in the build toolchain

For armv7l builds, the emulator handles the `scandirat` syscall
differently than what glibc expects. This results in EOVERFLOW.

Handle this case by skipping the test (it can't really be salvaged
from our side).

Change-Id: I8100dd342ebfc086642e134619270403ae361462
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
4 years agoProvide wrappers for large-file system calls 17/222417/3
Michal Bloch [Tue, 14 Jan 2020 12:41:19 +0000 (13:41 +0100)]
Provide wrappers for large-file system calls

Some toolchains produce binaries linked to large-file versions
of most system calls (e.g. open() → open64()). Handle those
in addition to the regular versions.

Change-Id: I7277f93fa064a168c95ca09a7cda01dafe1eafae
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
4 years agoDon't fail the whole build through broken lcov 60/221360/5
Michal Bloch [Tue, 31 Dec 2019 14:56:12 +0000 (15:56 +0100)]
Don't fail the whole build through broken lcov

Change-Id: I88b873714a81b89852ae5b90295ce8828f014c07
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
4 years agoLimit ability to control operations to log user and log group members 22/222322/1
Karol Lewandowski [Mon, 13 Jan 2020 11:11:37 +0000 (12:11 +0100)]
Limit ability to control operations to log user and log group members

This brings consistency with Android logger backend.

Change-Id: I46f6816d6613b955b9ce84f82a54f50c0c43f7c9

4 years agoRename dlogutil_entry_ts to dlogutil_entry_get_ts 91/222091/3 accepted/tizen/unified/20200114.130728 submit/tizen/20200113.072921
Mateusz Majewski [Thu, 9 Jan 2020 11:49:31 +0000 (12:49 +0100)]
Rename dlogutil_entry_ts to dlogutil_entry_get_ts

This is to fit Tizen's guidelines better.

Change-Id: I3ec3548bd61346b94c76fd07b522b1f0129a7992

4 years agoRename dlogutil_entry_(tag|msg) to dlogutil_entry_get_(tag|msg) 90/222090/3
Mateusz Majewski [Thu, 9 Jan 2020 11:30:20 +0000 (12:30 +0100)]
Rename dlogutil_entry_(tag|msg) to dlogutil_entry_get_(tag|msg)

This is to fit Tizen's guidelines better.

Change-Id: Ia0e2025b17a5e86bd5f618cd1af5846dad8df340

4 years agoRename dlogutil_write_cb to dlogutil_entry_cb 01/222201/2
Mateusz Majewski [Fri, 10 Jan 2020 08:30:46 +0000 (09:30 +0100)]
Rename dlogutil_write_cb to dlogutil_entry_cb

Change-Id: Ib8aa0e66a766b5918f5fcc1a0bbe747f88ef1a07

4 years agoRelease 6.0.2 23/222223/1 accepted/tizen/unified/20200113.130540 submit/tizen/20200110.141218
Michal Bloch [Fri, 10 Jan 2020 13:51:59 +0000 (14:51 +0100)]
Release 6.0.2

 * fix Android Logger passive logging
 * fix various errors found through aggressive compiler warnings
 * miscellaneous minor bugfixes

Change-Id: Ibde07ec14e0db6022b95a196bcfe2f2d60c85eaa
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
4 years agoRevert "Increase log source scanning frequency from 1s to 10ms" 22/222222/2
Michal Bloch [Thu, 9 Jan 2020 15:26:33 +0000 (16:26 +0100)]
Revert "Increase log source scanning frequency from 1s to 10ms"

This reverts commit b98095cc7007b14b22f2e91e0e18066efbf63ec3.

No longer needed due to f419d06319fcd3da39aa6812f05aaa8cdf330e50
and the other changes since b98095cc. With Android Logger devices
being added to epoll, they are always handled immediately as long
as they have more data available (which is equivalent to increasing
the frequency to 0ms under the old rules).

Change-Id: Ic1150dd8e967c01e9d7f9aea3a8b13c64a5eea9b
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
4 years agodlog_logger: handle reader source fd entity 03/222103/3
Michal Bloch [Thu, 9 Jan 2020 14:43:31 +0000 (15:43 +0100)]
dlog_logger: handle reader source fd entity

Change-Id: I803f5f535248d9f2ee15c99d6cd58b3486b5dfce
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
4 years agodlog_logger: subscribe source fd entity to epoll 98/222098/2
Michal Bloch [Thu, 9 Jan 2020 09:12:08 +0000 (10:12 +0100)]
dlog_logger: subscribe source fd entity to epoll

The event is not yet handled (still relies on the periodic check).

Change-Id: I9ceefa64b20416a4a5bf749fc3099b58b011011b
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
4 years agoFix an epoll descriptor list leak 74/222074/3
Michal Bloch [Thu, 9 Jan 2020 09:16:45 +0000 (10:16 +0100)]
Fix an epoll descriptor list leak

Change-Id: I914ad793674c72aeabd4c5c101d0fbc692d6cfe1
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
4 years agodlog_logger: wrap reader read_fd in an FD entity 40/222040/3
Michal Bloch [Wed, 8 Jan 2020 15:47:02 +0000 (16:47 +0100)]
dlog_logger: wrap reader read_fd in an FD entity

No logic change so far; will be made to work with epoll
in a subsequent patch.

Change-Id: I9a3d199206b392976a63ae7b66bb14d4e8616a90
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
4 years agodlog_logger: rename reader fd entity to _sink 39/222039/3
Michal Bloch [Wed, 8 Jan 2020 15:08:42 +0000 (16:08 +0100)]
dlog_logger: rename reader fd entity to _sink

This is in preparation for adding a second fd entity to that structure,
which will represent the log source and will need to be distinguished from
the current one that represents the log sink.

Change-Id: Ia56c352c564fd0bae4a40e4c923e4ab6013a2579
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
4 years agoIncrease log source scanning frequency from 1s to 10ms 74/221974/4 accepted/tizen/unified/20200110.123605 submit/tizen/20200109.021000
Karol Lewandowski [Wed, 8 Jan 2020 15:13:34 +0000 (16:13 +0100)]
Increase log source scanning frequency from 1s to 10ms

This is workaround.  This commit ensures logs source is checked every 10ms.

In current design logs from source devices (/dev/log_) are checked
only periodically on fixed intervals (unlike other sources, which
are driven by epoll()).  The "special" android source handling seems
to be microoptimisation, done due to not entirely correct architecture
decisions.

Proper solution require adding android source devices to epoll.

Change-Id: I91e01f988566c1766385d0c94c6d9dc82bd8e08b
Signed-off-by: Hyotaek Shim <hyotaek.shim@samsung.com>
4 years agoFix GCC9 compilation 38/221938/1 submit/tizen/20200108.114316
Michal Bloch [Wed, 8 Jan 2020 09:53:25 +0000 (10:53 +0100)]
Fix GCC9 compilation

Change-Id: I6b6a4ae4f3fe0dba2c9d8e82db3f64618eeba203
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
4 years agoVarious string buffer size checks 53/221353/4 submit/tizen/20200107.134313 submit/tizen/20200108.020101
Michal Bloch [Thu, 2 Jan 2020 16:23:21 +0000 (17:23 +0100)]
Various string buffer size checks

Change-Id: I39a757599ddd78fd121bf5446cba7fa5ee5ee710
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
4 years agowritev(2) requires <sys/uio.h> 52/221252/2
Michal Bloch [Mon, 30 Dec 2019 11:29:59 +0000 (12:29 +0100)]
writev(2) requires <sys/uio.h>

Change-Id: Ifacc47eb488359d3d4741fcab16650920e8e9677
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
4 years agoRefactor the permission checking for libdlogutil 36/220536/2
Mateusz Majewski [Tue, 17 Dec 2019 12:40:43 +0000 (13:40 +0100)]
Refactor the permission checking for libdlogutil

Change-Id: I679f23b4366bdc70f515fb2633fb0c0d54fe0f8e

4 years agoCheck necessary privilege for correct behaviour 18/217918/4
Michal Bloch [Fri, 15 Nov 2019 13:35:36 +0000 (14:35 +0100)]
Check necessary privilege for correct behaviour

Change-Id: I10a5796292e4e166df86b4f49b7f47c01a914d21
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
4 years agoCreate a typedef for dlogutil_entry 21/219721/1
Mateusz Majewski [Mon, 9 Dec 2019 07:50:30 +0000 (08:50 +0100)]
Create a typedef for dlogutil_entry

Change-Id: I73ff0af0d07490e6fdadd3ed1c95c42046662700

4 years agoCreate a typedef for dlogutil_sorting_order 20/219720/1
Mateusz Majewski [Mon, 9 Dec 2019 07:44:25 +0000 (08:44 +0100)]
Create a typedef for dlogutil_sorting_order

Change-Id: Ic600f59f30a686e43bb459773aa07f4892fca586

4 years agoCreate a typedef for dlogutil_filter_options 19/219719/1
Mateusz Majewski [Mon, 9 Dec 2019 07:40:02 +0000 (08:40 +0100)]
Create a typedef for dlogutil_filter_options

Change-Id: Ic7320ed0fa10a5f6863a7095dea665029e6cca55

4 years agoRename dlogutil_write_callback 18/219718/1
Mateusz Majewski [Mon, 9 Dec 2019 07:37:31 +0000 (08:37 +0100)]
Rename dlogutil_write_callback

Change-Id: Idfefbd7ab4e634dbb0f0a2470e1448db1a80c212

4 years agoImprove the sorting test loop slightly 93/219593/2
Mateusz Majewski [Fri, 6 Dec 2019 07:33:33 +0000 (08:33 +0100)]
Improve the sorting test loop slightly

This makes it slightly faster, slightly less fragile, and also slightly
nicer.

Change-Id: I99e54de7b25935d17d5a9a994c35b44da4fcde59

4 years agoMake gcov package 97/218397/2
Yunmi Ha [Fri, 22 Nov 2019 02:52:33 +0000 (11:52 +0900)]
Make gcov package

- Make gcov package when --define 'gcov ON' is given

Change-Id: If2d18676637dad6f94ba9b1d4ca1bf3b8510e0b7
Signed-off-by: Yunmi Ha <yunmi.ha@samsung.com>
4 years agoRevert "libdlog doesn't modify errno from outside PoV" 49/218849/2
Hyotaek Shim [Fri, 29 Nov 2019 01:48:58 +0000 (01:48 +0000)]
Revert "libdlog doesn't modify errno from outside PoV"

This reverts commit 6afdbf69c184f8b1b466af16d65272ad9e7f757a.

Change-Id: Ie046f84788b84f748211df374d8d601db1280810

4 years agoSpecify buffers in some calls of dlog_tests 46/218746/2
Mateusz Majewski [Mon, 25 Nov 2019 10:02:52 +0000 (11:02 +0100)]
Specify buffers in some calls of dlog_tests

Those tests would start failing on some targets after the libdlogutil
patches. This would be due to them trying to clear/get size of the apps
buffer, which does not exist. This was accepted before the libdlogutil
patches, because dlogutil would consider all of the enabled buffers at
the same time. However, said patches change it to clear/get size of each
buffer separately and return on the first failure. We can work around
this issue by making it so that dlogutil will not try to manipulate the
apps buffer in the failing spots.

Change-Id: I5b3135256b99b0bc8f53a14fc68f99a9effbf6c3

4 years ago[logcleanup] Fix svace/coverity issue 06/218606/4 accepted/tizen/unified/20191128.162015 submit/tizen/20191126.094154
Yunmi Ha [Tue, 26 Nov 2019 02:39:13 +0000 (11:39 +0900)]
[logcleanup] Fix svace/coverity issue

- check return value

Change-Id: Ie861d6972c3bfa2c8346f8a25e72e0039e344e6e
Signed-off-by: Yunmi Ha <yunmi.ha@samsung.com>
4 years agoAdd dlog_cleanup service 76/218076/9
Yunmi Ha [Tue, 19 Nov 2019 07:30:37 +0000 (16:30 +0900)]
Add dlog_cleanup service

- dlog_cleanup service will delete old dlog files.
- dlog_cleanup service will be started by activationd.

Change-Id: I3f197f98edcaa03b6f418dbefdb6f4ced714cb91
Signed-off-by: Yunmi Ha <yunmi.ha@samsung.com>
4 years agoFix asserts 33/218333/1
Mateusz Majewski [Mon, 18 Nov 2019 08:37:37 +0000 (09:37 +0100)]
Fix asserts

Some of the pointer arguments of some functions were not asserted. This
commit fixes that. To add to this, userdata is no longer asserted, since
it is not used anywhere, only passed on to the callback. This way the
user can pass NULL if he doesn't need to use it.

Change-Id: I1c6c616fef5ccb95fc6d2465a01f0df68af2b2a6

4 years agoUnsupported buffer set retval: EINVAL → ENOTSUP 07/217907/2
Michal Bloch [Fri, 15 Nov 2019 11:18:34 +0000 (12:18 +0100)]
Unsupported buffer set retval: EINVAL → ENOTSUP

Change-Id: I370bfc46d6326a8ae14cae89da87623adb8c7a03
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
4 years agolibdlog doesn't modify errno from outside PoV 08/218108/1
Michal Bloch [Tue, 19 Nov 2019 10:22:22 +0000 (11:22 +0100)]
libdlog doesn't modify errno from outside PoV

Change-Id: If5b0fabec233d805041fa534933828cc72bf87cf
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
4 years agoDocument the behaviour of CAP_SYSLOG 24/217224/4 accepted/tizen/unified/20191118.122958 submit/tizen/20191115.041146
Michal Bloch [Thu, 7 Nov 2019 20:14:43 +0000 (21:14 +0100)]
Document the behaviour of CAP_SYSLOG

Change-Id: I3fe9d45220883b17141203539928059f57847bc1
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
4 years agoOptimize terminal detection 73/217573/2
Mateusz Majewski [Fri, 8 Nov 2019 09:32:10 +0000 (10:32 +0100)]
Optimize terminal detection

dlogutil needs to check if it's printing to the terminal or not in order
to see if it needs to apply colors or not in the automatic color mode.
Previously, we checked this repeatedly on every log we printed. However,
whether we are printing to the terminal or not shouldn't change at all.
Therefore, we should only check this once, during setup, and then never
call isatty() again. This commit achieves that.

Change-Id: I2084a4efbfeab057f33028a4b298a929aa3d5851

4 years agoFix missing logs when a dlogutil pipe gets clogged 15/217215/3
Michal Bloch [Thu, 7 Nov 2019 12:24:09 +0000 (13:24 +0100)]
Fix missing logs when a dlogutil pipe gets clogged

Change-Id: I44e5c53401abc03605fdc9a0c15e5611742d31a1
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
4 years agoUpdate the version to 6.0 in autoconf as well 11/217211/1
Michal Bloch [Thu, 7 Nov 2019 11:15:51 +0000 (12:15 +0100)]
Update the version to 6.0 in autoconf as well

Change-Id: Ic1bbc298d6922f182e6f2b9ad22f23f166ae43a0
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
4 years agoRename SORT_* to DLOGUTIL_SORT_* 97/217197/3
Mateusz Majewski [Wed, 6 Nov 2019 16:17:57 +0000 (17:17 +0100)]
Rename SORT_* to DLOGUTIL_SORT_*

Change-Id: I5ddf6b95b4abf24dfaecd464b94015c7bdeb51f5

4 years agoFix a SVACE complaint 87/216687/5
Mateusz Majewski [Wed, 30 Oct 2019 16:01:00 +0000 (17:01 +0100)]
Fix a SVACE complaint

The complaint is that the function should be checked for NULL before
dereferencing. This is wrong, since we build the struct and so we can
be sure that it is indeed correctly built. However, it's simpler to just
do the check so that SVACE doesn't complain.

Change-Id: I4664170c25b2a7feeb4b25fafb6ebb9741016f5e

4 years agoRename log_add_filter_string to dlogutil_filter_options_filterspec 84/216684/4
Mateusz Majewski [Wed, 30 Oct 2019 14:48:41 +0000 (15:48 +0100)]
Rename log_add_filter_string to dlogutil_filter_options_filterspec

Change-Id: I15b5b5aa930e36fb040d198d63d994cf2c57afa5

4 years agoRename log_add_filter_pid to dlogutil_filter_options_pid 83/216683/4
Mateusz Majewski [Wed, 30 Oct 2019 14:44:11 +0000 (15:44 +0100)]
Rename log_add_filter_pid to dlogutil_filter_options_pid

Change-Id: I5ed69dddb731f57d1f545110b306351f8ae379e0

4 years agoRename log_add_filter_tid to dlogutil_filter_options_tid 82/216682/4
Mateusz Majewski [Wed, 30 Oct 2019 14:41:00 +0000 (15:41 +0100)]
Rename log_add_filter_tid to dlogutil_filter_options_tid

Change-Id: Idaee63aacd2fc8cf62048a9792b5ce38d052958c

4 years agoRename log_buffer_get_message to dlogutil_entry_msg 80/216680/4
Mateusz Majewski [Wed, 30 Oct 2019 14:34:06 +0000 (15:34 +0100)]
Rename log_buffer_get_message to dlogutil_entry_msg

Change-Id: I95984f9affaf6ab8ebb6616a458933c0a0322f48

4 years agoRename log_buffer_get_tag to dlogutil_entry_tag 79/216679/4
Mateusz Majewski [Wed, 30 Oct 2019 14:30:11 +0000 (15:30 +0100)]
Rename log_buffer_get_tag to dlogutil_entry_tag

Change-Id: I2b98af866377c176415e2113df3fc36dae21d893

4 years agoRename log_filter to dlogutil_filter_options 81/216681/4
Mateusz Majewski [Fri, 25 Oct 2019 07:30:34 +0000 (09:30 +0200)]
Rename log_filter to dlogutil_filter_options

This also changes the namespace, as log_filter used to be a typedef, but
dlogutil_filter_options is just a normal struct.

Change-Id: I7a0aed07fd8ec0318e07269307c65d09d66e65fe

4 years agoSlightly improve log_filter_add_* 59/216459/3
Mateusz Majewski [Fri, 25 Oct 2019 06:24:16 +0000 (08:24 +0200)]
Slightly improve log_filter_add_*

Change-Id: I296b6a6317bc5829fb88ca69aa6844bbafc5b6c0

4 years agoRefactor extract_timestamp and rename to dlogutil_entry_ts 58/216458/3
Mateusz Majewski [Thu, 24 Oct 2019 10:11:36 +0000 (12:11 +0200)]
Refactor extract_timestamp and rename to dlogutil_entry_ts

Change-Id: I0c6ee97ad3a39fe66a8cf64e4957a80d52b4b17e

4 years agoAdd __dlog_sec_print() to keep backward compatibility with existing MCD in-house... 03/217003/5 accepted/tizen/unified/20191107.051421 submit/tizen/20191106.015848
Hyotaek Shim [Tue, 5 Nov 2019 09:47:21 +0000 (18:47 +0900)]
Add __dlog_sec_print() to keep backward compatibility with existing MCD in-house Apps

.#define SECURE_LOG_(id, prio, tag, fmt, arg...) \
({ do { \
      __dlog_sec_print(id, prio, tag, "%s: %s(%d) > [SECURE_LOG] " fmt, __MODULE__, __func__, __LINE__, ##arg); \
} while (0); })

root@localhost:/usr/apps/com.samsung.w-manager-service/bin# ./w-manager-service
appcore: Failed to get application ID - pid(3962)
./w-manager-service: symbol lookup error: ./w-manager-service: undefined symbol: __dlog_sec_print

root@HyotaekShim:/platform/AppStoreWhitelist/20191106# grep -r __dlog_sec_print
000001044261_com.samsung.w-dialer2_100015.txt:__dlog_sec_print
000004264895_com.samsung.tizen.bixby-voice_210200007.txt:__dlog_sec_print
000001913406_com.samsung.w-spotify_300002.txt:__dlog_sec_print
000001902170_com.samsung.w-spotify_300001.txt:__dlog_sec_print
000002736570_com.samsung.w-manager-service_500300013.txt:__dlog_sec_print
000002420102_com.samsung.samsung-pay-app_100400303.txt:__dlog_sec_print
000001915993_com.samsung.w-spotify_300002.txt:__dlog_sec_print
000002750274_com.samsung.w-logs2_100300011.txt:__dlog_sec_print
000002738273_com.samsung.w-contacts2_100200074.txt:__dlog_sec_print
...

Change-Id: Ieda4e759213ab50810540574d98f72bb0491c6c9
Signed-off-by: Hyotaek Shim <hyotaek.shim@samsung.com>
4 years agoBump version to 6.0.1 29/217029/1 submit/tizen/20191105.163340
Michal Bloch [Tue, 5 Nov 2019 12:21:06 +0000 (13:21 +0100)]
Bump version to 6.0.1

Tizen 5.5 just had a release and forked off.

Change-Id: I452d9ccb456b7a5a28ee00ef1e56987f79b8ccbe
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
4 years agoImprove log_buffer_get_* exceptional conditions 98/216398/1
Mateusz Majewski [Thu, 24 Oct 2019 09:05:10 +0000 (11:05 +0200)]
Improve log_buffer_get_* exceptional conditions

We now handle the case in which the struct lacks the ending '\0'.
This would mean that one could read past the end of the struct while
using the result.

Change-Id: Ie70ffd57181dd351ab94db27550b8f967235648f

4 years agoAdd some missing consts 97/216397/1
Mateusz Majewski [Thu, 24 Oct 2019 08:51:22 +0000 (10:51 +0200)]
Add some missing consts

Change-Id: I22c50dea669bb940dc25871dc47d5ed8afaede6f

4 years agoRename DUMP_{CONTINUOUS,INFINITE} 24/216124/2
Mateusz Majewski [Mon, 21 Oct 2019 06:18:51 +0000 (08:18 +0200)]
Rename DUMP_{CONTINUOUS,INFINITE}

Change-Id: Ibc5746ba2bd82b115f8a41cc6378e301cd47c80b

4 years agoAdd a basic design overview document 96/215496/4
Michal Bloch [Wed, 9 Oct 2019 15:16:25 +0000 (17:16 +0200)]
Add a basic design overview document

Change-Id: Ic70b6025143ca00cd7c7441e254a242defe2feef
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
4 years agoAdd dlogutil_ prefix to logger_entry 26/215626/2
Mateusz Majewski [Fri, 11 Oct 2019 16:26:26 +0000 (18:26 +0200)]
Add dlogutil_ prefix to logger_entry

Change-Id: Ic5caa8139956f1dfff3dc5296a0a67e763a567ae

4 years agoAdd dlogutil_ prefix to write_callback 25/215625/1
Mateusz Majewski [Fri, 11 Oct 2019 16:12:16 +0000 (18:12 +0200)]
Add dlogutil_ prefix to write_callback

Change-Id: I2d1778741a66f1aee13d74e61208c489788009bb

4 years agoAdd dlogutil_ prefix to sorting_order 24/215624/1
Mateusz Majewski [Fri, 11 Oct 2019 16:04:28 +0000 (18:04 +0200)]
Add dlogutil_ prefix to sorting_order

Change-Id: I069c761ff6c6c390d994ac843efbf7d6cc24a6d9

4 years agoMove all pipe backend filtering server-side 09/215109/5
Mateusz Majewski [Tue, 1 Oct 2019 06:43:31 +0000 (08:43 +0200)]
Move all pipe backend filtering server-side

Previously, we used to carry around two filter settings objects in
dlogutil: a filter list, which contained a simple text list of all
filterspecs, and a filter object, which contained info about all other
filters set. The logger backend merged those two together and used
them to filter everything locally, while the pipe backend sent the
filter list to the server and filtered locally on filter object. This
patch does away with the filter list, so that everything is in the
filter object, and enables client to send the filter object. In
particular, this means that the server is able to filter by TID and PID
now.

Change-Id: Ic962da04a5657527f2f80fe20e35caa75d7e2782

4 years agoFix FilterInfo to use pid_t for tid 41/215341/1
Mateusz Majewski [Mon, 7 Oct 2019 06:34:17 +0000 (08:34 +0200)]
Fix FilterInfo to use pid_t for tid

Change-Id: If22062d76d02f62baad5fff5e756adbba56d0caf

4 years agoRefactor filter list a bit 70/214870/1
Mateusz Majewski [Thu, 26 Sep 2019 12:49:25 +0000 (14:49 +0200)]
Refactor filter list a bit

Change-Id: Ic69af18d2b91608708227c3c8c86d1f8dda842d1

4 years agoFix issues found by static analysis. 21/214521/5 accepted/tizen_5.5_unified_mobile_hotfix tizen_5.5_mobile_hotfix accepted/tizen/5.5/unified/20191031.021742 accepted/tizen/5.5/unified/mobile/hotfix/20201027.085839 accepted/tizen/unified/20190927.013321 submit/tizen/20190926.122500 submit/tizen_5.5/20191031.000004 submit/tizen_5.5_mobile_hotfix/20201026.185104 tizen_5.5.m2_release
Michal Bloch [Mon, 23 Sep 2019 15:49:26 +0000 (17:49 +0200)]
Fix issues found by static analysis.

Change-Id: I4d1e87a5e3b8091f5503d105a41764358e5b6840
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
4 years agoReplace strerror with %m 25/214725/4
Michal Bloch [Wed, 25 Sep 2019 14:36:57 +0000 (16:36 +0200)]
Replace strerror with %m

Change-Id: I071303c25389b958fd4d9ad5c3e74af97c92fe09
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
4 years agoFix coverity issue 47/214547/4
Yunmi Ha [Wed, 25 Sep 2019 14:38:46 +0000 (16:38 +0200)]
Fix coverity issue

- resolve "Uninitialized pointer read"

Change-Id: If160a36be2cd77ed7dadc8056b234098470a52a4
Signed-off-by: Yunmi Ha <yunmi.ha@samsung.com>
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
4 years agoChange size and dumping count types into size_t 95/214595/4
Mateusz Majewski [Tue, 24 Sep 2019 06:13:18 +0000 (08:13 +0200)]
Change size and dumping count types into size_t

This also requires changing a magic value triggering the infinite dump
mode from -1 into SIZE_MAX.

Change-Id: Ib033921ca72001de2570bf740383a8471e9cae35

4 years agoDon't output errors in dlogutil outside of logutil.c 65/214365/2
Mateusz Majewski [Fri, 20 Sep 2019 12:07:50 +0000 (14:07 +0200)]
Don't output errors in dlogutil outside of logutil.c

This is useful, beacuse those functions will probably end up being used
in libdlogutil, and writing to stderr in a library seems like a bad
idea.

Change-Id: Ic07ed3548bf901ea4878d4a54a3824a0760a9b88

4 years agoAdd meaningful error codes 64/214364/2
Mateusz Majewski [Fri, 20 Sep 2019 12:28:59 +0000 (14:28 +0200)]
Add meaningful error codes

Change-Id: Ic633e51ba49e8e9261ce4e9f33efec8a66f6079a

4 years agoFill the seconds field of invalid timestamps 68/214268/4
Mateusz Majewski [Thu, 19 Sep 2019 10:53:08 +0000 (12:53 +0200)]
Fill the seconds field of invalid timestamps

We used to fill only nsec with -1. However, this means that the sec
field is kept uninitialized. This means that reading it would be
undefined behavior, which is bad. This doesn't seem to happen in
dlogutil as is, but it would be possible when choosing a timestamp to sort
on is be implemented.

Also, a slight change to sort vector is done so that it works well in
such situation.

Change-Id: I501adad093c0782433d014395e8cc752f7d48574

4 years agoPropagate callback return value 58/214158/2
Mateusz Majewski [Wed, 18 Sep 2019 08:44:55 +0000 (10:44 +0200)]
Propagate callback return value

This will be especially useful in libdlogutil, where it will enable the
user of the library to return a nonzero value from the callback in order
to stop log processing.

Change-Id: I0565be6f8af2c7804a129250075778ec3f2b2e7c

4 years agoFix an include 95/213995/1
Mateusz Majewski [Tue, 17 Sep 2019 06:21:52 +0000 (08:21 +0200)]
Fix an include

Change-Id: I5368742a9054956d5b8506b92b47551a43b0cbb6

4 years agoFix an off-by-one inconsistency in the "out of order" message 99/213799/1
Mateusz Majewski [Wed, 11 Sep 2019 11:59:59 +0000 (13:59 +0200)]
Fix an off-by-one inconsistency in the "out of order" message

The len field of the logger_entry should contain the byte size of the
msg field. However, in this case, the final null byte is not counted.
This is not really a bug since we should handle this case, but
nevertheless an inconsistency with the rest of the dlogutil.

Change-Id: Icf2277abc8dd7f8cd1885fc53dd49c9bdede623d

4 years agoRemove unnecessary newlines at the end of the files 79/213679/1 accepted/tizen/unified/20190916.111626 submit/tizen/20190910.115310
Mateusz Majewski [Tue, 10 Sep 2019 05:56:36 +0000 (07:56 +0200)]
Remove unnecessary newlines at the end of the files

Change-Id: I5ad464bb853b3209f9a87ac899c3be677c1a8942

4 years agoCreate and fill logretrieve.{c,h} 47/213647/1
Mateusz Majewski [Thu, 22 Aug 2019 09:41:48 +0000 (11:41 +0200)]
Create and fill logretrieve.{c,h}

Change-Id: I4f0402cb2d8ff38e1b371b63600dd79e1aa467b3

4 years agoMove pipe/logger backend choice logic to create_initial_fdis 46/213646/1
Mateusz Majewski [Mon, 9 Sep 2019 09:39:39 +0000 (11:39 +0200)]
Move pipe/logger backend choice logic to create_initial_fdis

Change-Id: I3221f256d96e014200875a87467ed4b3eab5cd79

4 years agoMove flush_logs into sort_vector.c 45/213645/1
Mateusz Majewski [Thu, 22 Aug 2019 09:15:45 +0000 (11:15 +0200)]
Move flush_logs into sort_vector.c

It's now called sort_vector_flush.

Change-Id: I9a90166e81bb129df7529c92626fa80c7ae84f10

4 years agoMove buffer choice validation into create_initial_fdis 34/213534/7
Mateusz Majewski [Fri, 6 Sep 2019 08:59:02 +0000 (10:59 +0200)]
Move buffer choice validation into create_initial_fdis

Change-Id: I3328790d7ef438aaa7dd99a22b12c3243145c292

4 years agoMove sort_vector initialization into do_print 33/213533/7
Mateusz Majewski [Fri, 6 Sep 2019 07:23:16 +0000 (09:23 +0200)]
Move sort_vector initialization into do_print

This way, main doesn't have to care about the sort_vector at all.

Change-Id: Iaf9f80957f1df40f1113f0cdd7428aef782d3baf

4 years agoAdd some missing const qualifiers 09/213609/1
Mateusz Majewski [Mon, 9 Sep 2019 06:18:10 +0000 (08:18 +0200)]
Add some missing const qualifiers

Change-Id: I521e570921a07b93c7fbdd6cef0abcb1f2409fba

4 years agoSet some sort_vector fields indirectly 32/213532/5
Mateusz Majewski [Fri, 23 Aug 2019 09:34:42 +0000 (11:34 +0200)]
Set some sort_vector fields indirectly

This way, we don't need to pass the sort_vector to the parse_options
function.

Change-Id: Iffe9436e847846b4dc4d1c39123ada87526a0db5

4 years agoMove some arguments into a common struct 51/213551/2
Mateusz Majewski [Fri, 6 Sep 2019 11:50:51 +0000 (13:50 +0200)]
Move some arguments into a common struct

Change-Id: Iacb5461d42688128c52842e20c8d32317b3cd60a

4 years agoFix log_filter_free 53/213553/1
Mateusz Majewski [Fri, 6 Sep 2019 13:12:16 +0000 (15:12 +0200)]
Fix log_filter_free

Change-Id: I3a23f7a2303d4659aacd2fbd9e88a5a4bf046893