platform/core/system/dlog.git
6 years agologger: improve poor variable naming 83/148083/1
Michal Bloch [Wed, 6 Sep 2017 14:47:06 +0000 (16:47 +0200)]
logger: improve poor variable naming

"Buffer" used to be used for two different things.

Change-Id: Ie62eadbc81d2334934d6531c0a5b51e2423d8052
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agologger: remove g_file_buffer 54/148054/1
Michal Bloch [Wed, 6 Sep 2017 10:50:56 +0000 (12:50 +0200)]
logger: remove g_file_buffer

There is no evidence this buffering was ever needed.
We can also use fwrite instead should the need arise.

Change-Id: I62184bdf1a7a4529b48a8ee40a1e9c17a202332e
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agoMerge "Revert "Add Android logger backend configuration file."" into tizen
Karol Lewandowski [Tue, 5 Sep 2017 21:52:43 +0000 (21:52 +0000)]
Merge "Revert "Add Android logger backend configuration file."" into tizen

6 years agoMerge changes I387ff0bf,I7c687a7b,I0688f428,I58dc8880,I8278bca1 into tizen
Karol Lewandowski [Tue, 5 Sep 2017 16:31:52 +0000 (16:31 +0000)]
Merge changes I387ff0bf,I7c687a7b,I0688f428,I58dc8880,I8278bca1 into tizen

* changes:
  logger: introduce buffering defaults
  logger: decouple epoll and buffering timeouts
  logger: make byte-based buffering per-reader
  logger: add reader helper functions
  logger: refactor circular buffer helpers

6 years agologger: introduce buffering defaults 87/144687/7
Michal Bloch [Thu, 17 Aug 2017 11:46:54 +0000 (13:46 +0200)]
logger: introduce buffering defaults

Change-Id: I387ff0bf745325a946260e12628effb8906fbf0f
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agologger: decouple epoll and buffering timeouts 44/144144/9
Michal Bloch [Thu, 17 Aug 2017 14:56:06 +0000 (16:56 +0200)]
logger: decouple epoll and buffering timeouts

Change-Id: I7c687a7bf7246f5301ad245471b4545c787ca8f5
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agologger: make byte-based buffering per-reader 47/144747/5
Michal Bloch [Thu, 17 Aug 2017 14:56:06 +0000 (16:56 +0200)]
logger: make byte-based buffering per-reader

Change-Id: I0688f428adeb5a40c225237585feef4ee7683573
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agologger: add reader helper functions 46/144746/5
Michal Bloch [Thu, 17 Aug 2017 15:07:33 +0000 (17:07 +0200)]
logger: add reader helper functions

Change-Id: I58dc8880cb8d2aae575a80bddd83cdf94ac41c26
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agologger: refactor circular buffer helpers 45/144745/5
Michal Bloch [Thu, 17 Aug 2017 15:06:46 +0000 (17:06 +0200)]
logger: refactor circular buffer helpers

 * make data types unsigned when conceptually appropriate
 * extract circular distance calculation (for use in further changes)

Change-Id: I8278bca1cc06c4bc9fb3efb9b37a50bf86205593

6 years agologutil: pipe: Raise sorting buffer sizes 30/146630/1
Karol Lewandowski [Tue, 29 Aug 2017 15:31:29 +0000 (17:31 +0200)]
logutil: pipe: Raise sorting buffer sizes

To sort messages in order sort buffer size must be >= size of sorted
log messages.

This commit raises the defaults and limits to ensure that sort buffer
is big enough.

Change-Id: I596133cb8aa5a442b074d340464293b4a1400f6b

6 years agoRevert "Add Android logger backend configuration file." 61/146261/2
Karol Lewandowski [Fri, 25 Aug 2017 10:59:46 +0000 (12:59 +0200)]
Revert "Add Android logger backend configuration file."

This reverts commit 1d2ee4c83384c11bba81044b8722d8f3a41b6d4b.

Originally it meant to support RPi3-specific kernel logger
configuration change, but it was not accepted in the kernel
itself.

Change-Id: I3da8cc3ec43fc8bfafb81c514fda340a44e6553b

6 years agoMerge "logutil: move a generic function to logcommon" into tizen
Karol Lewandowski [Fri, 25 Aug 2017 12:31:45 +0000 (12:31 +0000)]
Merge "logutil: move a generic function to logcommon" into tizen

6 years agologutil: move a generic function to logcommon 58/145158/2
Michal Bloch [Fri, 18 Aug 2017 15:42:17 +0000 (17:42 +0200)]
logutil: move a generic function to logcommon

Change-Id: I85de720e8784a4a8650e7b597e5877dfdebacc09
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agologger: remove nonexistent `-k` option 93/145193/1
Michal Bloch [Mon, 21 Aug 2017 13:44:19 +0000 (15:44 +0200)]
logger: remove nonexistent `-k` option

Change-Id: I9d34270419b3de01d4575fe4b48fab5b3a74c757
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agoModify 3.0 to 4.0 upgrade script 94/144894/3 accepted/tizen/4.0/unified/20170829.015902 accepted/tizen/unified/20170822.023820 submit/tizen/20170821.062931 submit/tizen_4.0/20170828.100004 submit/tizen_4.0/20170828.110004
Yunmi Ha [Fri, 18 Aug 2017 08:11:17 +0000 (17:11 +0900)]
Modify 3.0 to 4.0 upgrade script

Change-Id: I13d8b9002b453630df16c89a4b2da71f1bf0de44
Signed-off-by: Yunmi Ha <yunmi.ha@samsung.com>
6 years agoMerge "Fix: logutil: pipe: Do not depend on snprintf() return value for calculations... accepted/tizen/unified/20170821.144341 submit/tizen/20170818.090347
Karol Lewandowski [Fri, 18 Aug 2017 09:01:15 +0000 (09:01 +0000)]
Merge "Fix: logutil: pipe: Do not depend on snprintf() return value for calculations" into tizen

6 years agoMerge "logutil: pipe: Do not send rotation parameters" into tizen
Karol Lewandowski [Thu, 17 Aug 2017 12:51:04 +0000 (12:51 +0000)]
Merge "logutil: pipe: Do not send rotation parameters" into tizen

6 years agoMerge "logutil: pipe: Do not send buffer name directly" into tizen
Karol Lewandowski [Thu, 17 Aug 2017 12:50:36 +0000 (12:50 +0000)]
Merge "logutil: pipe: Do not send buffer name directly" into tizen

6 years agoFix: logutil: pipe: Do not depend on snprintf() return value for calculations 99/144599/4
Karol Lewandowski [Thu, 17 Aug 2017 08:13:31 +0000 (10:13 +0200)]
Fix: logutil: pipe: Do not depend on snprintf() return value for calculations

snprintf() can return numers of characters that "would have been
written if buffer would be large enough", not actual characters
written.

This commits reworks logger request command construction to
avoid snprintf().

Problem pointed out by κΉ€μ›μ˜ <won0.kim@samsung.com> (thank you!)

Change-Id: I664cc0ce779eaff3c004e47fd5102b0576295630

6 years agoMerge "logger: handle logs of odd length correctly" into tizen submit/tizen/20170816.150837
Karol Lewandowski [Wed, 16 Aug 2017 14:41:57 +0000 (14:41 +0000)]
Merge "logger: handle logs of odd length correctly" into tizen

6 years agologutil: pipe: Do not send rotation parameters 20/144420/2
Karol Lewandowski [Wed, 16 Aug 2017 13:54:38 +0000 (15:54 +0200)]
logutil: pipe: Do not send rotation parameters

These parameters are interpreted locally by dlogutil and must not
be transferred to the server.

Change-Id: Iafed8915c16afb05d721a139f8e7baaf86a70128

6 years agologger: handle logs of odd length correctly 09/144409/3
Michal Bloch [Wed, 16 Aug 2017 12:08:19 +0000 (14:08 +0200)]
logger: handle logs of odd length correctly

If there was only one byte left before the buffer wraps around,
the length field, which consists of 2 bytes, would end up torn apart,
yielding garbage on naive read attempts.

While libdlog did ensure to write only even-length logs, this could
not be relied upon when not using it: this includes kmsg and, potentially,
malicious users.

Change-Id: I7ec3777d650ec2642812b27e87de5e16e0dd72fc
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agologutil: pipe: Do not send buffer name directly 81/144381/1
Karol Lewandowski [Wed, 16 Aug 2017 10:55:38 +0000 (12:55 +0200)]
logutil: pipe: Do not send buffer name directly

For pipe backend, in order to get logs from particular buffer
we need to connect to appropriate socket.  Sending buffer name
over wire is unnecessary and potentially dangerous.

Change-Id: Ibe18292b627bfbec277dd0dbf378ce054e0c9f54

6 years agologutil: pipe: Rework logutil request 61/142861/12
Karol Lewandowski [Wed, 16 Aug 2017 10:42:13 +0000 (12:42 +0200)]
logutil: pipe: Rework logutil request

This commit introduces iovec+writev() usage to construct logutil
request instead of malloc.  This allows us to simplify error handling
a bit.

Additionally, fix dlog_control_msg payload length calculation -
it needs to have at most MAX_LOGGER_REQUEST_LEN (including
terminating null byte).

Change-Id: Ib9ab85355a6760a26a9250b20f4ea0dc1b1b2532

6 years agologutil: pipe: Simplify clear command 80/144380/1
Karol Lewandowski [Wed, 16 Aug 2017 10:36:24 +0000 (12:36 +0200)]
logutil: pipe: Simplify clear command

Change-Id: I0c14ec2e05d62e8d197f37dd655a5892b32bb0ba

6 years agologutil: Move sorting vector initialization out of main 65/142865/9
Karol Lewandowski [Tue, 8 Aug 2017 15:58:45 +0000 (17:58 +0200)]
logutil: Move sorting vector initialization out of main

Change-Id: Id1cb99838dc24ccdb04a3e7dc00508b4f883d7fe

6 years agoRefactor libdlog initialisation 18/142618/7
Michal Bloch [Fri, 4 Aug 2017 14:45:36 +0000 (16:45 +0200)]
Refactor libdlog initialisation

Change-Id: Ifda65c610c5496fa270a826eac3dc2cc8217dd57
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agologger: Print warning when dlogutil config line did not come with -f (required) 03/143603/6
Karol Lewandowski [Thu, 10 Aug 2017 12:09:14 +0000 (14:09 +0200)]
logger: Print warning when dlogutil config line did not come with -f (required)

Change-Id: I8d317c258950fc5e3ec3adcf0372ef49fe90d4ee

6 years agologconfig: fix config entry duplication 44/143844/5
Michal Bloch [Fri, 11 Aug 2017 12:42:13 +0000 (14:42 +0200)]
logconfig: fix config entry duplication

snprintf returns the number of written chars WITHOUT the null terminator,
even though it accepts the size WITH it.

This meant that even though the overwrite was successful,
the modification check always failed, leading the config
to think there was no existing entry and add another one.

Change-Id: Ic7e10e24258e0d54dc08f2c280f1f298569a282d
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agologutil: Be explicit about invalid option handling 30/143130/11
Karol Lewandowski [Tue, 8 Aug 2017 15:53:58 +0000 (17:53 +0200)]
logutil: Be explicit about invalid option handling

Change-Id: If7b5c4710622c9912adbd7fb7e3edb4445077124
Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
6 years agologger: Simplify getopt() handling in server 23/143823/1
Karol Lewandowski [Thu, 10 Aug 2017 13:05:36 +0000 (15:05 +0200)]
logger: Simplify getopt() handling in server

Change-Id: I5c6e6f47a0b8ed9df599cdeb52e1ea6651f40716
Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
6 years agoIntroduce rotation parameter defaults for both server and util 10/143410/7
Karol Lewandowski [Thu, 10 Aug 2017 13:03:00 +0000 (15:03 +0200)]
Introduce rotation parameter defaults for both server and util

 * file size (-r): 1 MB
 * file count (-n): 3

Change-Id: I8be4ad5dcab0a04b1ba92b6f7072e8b4c2ba0783
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
6 years agocommon: Add stringify macro 99/143599/6
Karol Lewandowski [Thu, 10 Aug 2017 11:50:05 +0000 (13:50 +0200)]
common: Add stringify macro

Change-Id: I3164fcaaba493eca62f5c095be0a845933150fac

6 years agoUnify logfile handling (including rotation) across util & server 16/143816/2
Karol Lewandowski [Thu, 10 Aug 2017 13:01:07 +0000 (15:01 +0200)]
Unify logfile handling (including rotation) across util & server

Change-Id: I63cd978a022789267a8081166ebdad508ead8273
Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
6 years agoFix: Do not write binary header to otherwise plaintext "syslog" file 02/143402/2
Karol Lewandowski [Wed, 9 Aug 2017 14:25:26 +0000 (16:25 +0200)]
Fix: Do not write binary header to otherwise plaintext "syslog" file

Change-Id: If8e202af7d79a6fa2ba33e0510a1ebcbab2ae1e8

6 years agologutil: Drop unneeded filename check 63/142863/7
Karol Lewandowski [Mon, 7 Aug 2017 10:09:47 +0000 (12:09 +0200)]
logutil: Drop unneeded filename check

Any error will be properly handled by open() call in next statement anyway.

Change-Id: Ic92433adbaad9065bf6db2759b32f055c23179c5

6 years agologutil: Avoid redundant config free 68/142868/9
Karol Lewandowski [Mon, 7 Aug 2017 16:44:59 +0000 (18:44 +0200)]
logutil: Avoid redundant config free

Config is always freed due to usage of gcc's function descructors:

 __attribute__ ((cleanup(log_config_free))) struct log_config conf;

Change-Id: Idfd3f9a402ca2698aed715f5ea25d99e36c438e0

6 years agologutil: Drop invalid buffer names early 59/142859/5
Karol Lewandowski [Mon, 7 Aug 2017 09:25:00 +0000 (11:25 +0200)]
logutil: Drop invalid buffer names early

Change-Id: Id54fa50a99fb8623ad841d947da43704bb2e3b76

6 years agologutil: Drop unneeded getopt() sanity checking 58/142858/7
Karol Lewandowski [Wed, 9 Aug 2017 12:08:27 +0000 (14:08 +0200)]
logutil: Drop unneeded getopt() sanity checking

getopt() internally checks if argument was specified.
This commit removes duplicate checking.

Change-Id: I53ce56756bfffa96fc82761679d29c1d9639a553

6 years agocommon: Introduce atoi_check_numeric() 86/143386/2
Karol Lewandowski [Wed, 9 Aug 2017 12:05:46 +0000 (14:05 +0200)]
common: Introduce atoi_check_numeric()

Change-Id: I47cdb91f9b8e803b592f2e5ed0298e4ba21b020b

6 years agologutil: Drop redundant select() 16/142616/1
Karol Lewandowski [Fri, 4 Aug 2017 14:52:20 +0000 (16:52 +0200)]
logutil: Drop redundant select()

select() was needed when dlogutil read files from stdin, however
this was disabled long time ago in 744f33dd2 ("Pipe-backend: change
dlogutil handling of raw files").

Change-Id: Ic6133240d2ea6079f3a475a170637abf31f3078d

6 years agoFix libdlog limiter 22/142122/3
Michal Bloch [Wed, 2 Aug 2017 11:32:50 +0000 (13:32 +0200)]
Fix libdlog limiter

Change-Id: Id6b986092de98c6e4241c9b99a36539f41929456
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agoAllow disabling sorting through `-u 0` 22/139822/8
Michal Bloch [Fri, 28 Jul 2017 11:57:07 +0000 (13:57 +0200)]
Allow disabling sorting through `-u 0`

Change-Id: I56520ea70e03aebc736cf971ef50bfec6d1a4c5b
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agoRefactor the sorting vector structure 54/141454/3
Michal Bloch [Mon, 31 Jul 2017 09:30:05 +0000 (11:30 +0200)]
Refactor the sorting vector structure

 * move global parameters into the structure
 * use standard names: begin, end, size

Change-Id: I009ea2336b95fd053a82017130bf334806dbf2a5
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agoMerge "Add Android logger backend configuration file." into tizen
Karol Lewandowski [Fri, 4 Aug 2017 09:17:17 +0000 (09:17 +0000)]
Merge "Add Android logger backend configuration file." into tizen

6 years agoMerge "svace: fix logical error" into tizen
Karol Lewandowski [Thu, 3 Aug 2017 11:54:30 +0000 (11:54 +0000)]
Merge "svace: fix logical error" into tizen

6 years agoFix sorting timeout reverting to default value 63/140063/6
Michal Bloch [Fri, 28 Jul 2017 11:53:01 +0000 (13:53 +0200)]
Fix sorting timeout reverting to default value

After the first force-flush, the timeout would always revert
to the default value (1000ms) regardless of what the config said.

Change-Id: Ia39414a0192c259760d8fa87a7dc7ce0f3f91f87
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agoRefactor sort parameter handling 05/141205/4
Michal Bloch [Fri, 28 Jul 2017 11:45:27 +0000 (13:45 +0200)]
Refactor sort parameter handling

 * use `log_config_get_int` instead of manual parsing
 * move in front of the `getopt` loop for override priority

Change-Id: I426be11b053f815a601930974dbb74988d27cb35
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agosvace: fix logical error 62/141962/1
sanghyeok.oh [Wed, 2 Aug 2017 06:20:27 +0000 (15:20 +0900)]
svace: fix logical error

Change-Id: I91094f33007d939440e9b886828167cc47809735
Signed-off-by: sanghyeok.oh <sanghyeok.oh@samsung.com>
6 years agoAdd Android logger backend configuration file. 43/135343/3
scott park [Thu, 22 Jun 2017 03:51:37 +0000 (12:51 +0900)]
Add Android logger backend configuration file.

Change-Id: Ic01023d1bd1550a4f1ab7d74c9d9f5dc63014271
Signed-off-by: Scott Park <scott.park@dignsys.com>
6 years agodlogutil --dumpfile: print error reason on failure 59/140259/6
Michal Bloch [Mon, 24 Jul 2017 08:16:20 +0000 (10:16 +0200)]
dlogutil --dumpfile: print error reason on failure

Change-Id: I999971b0bcbe23b160d158230de143f092a1e7dd
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agodlog binary file header format: standarize 11/141011/4
Michal Bloch [Thu, 27 Jul 2017 10:44:50 +0000 (12:44 +0200)]
dlog binary file header format: standarize

Made sure both dlogutil and dlog_logger use the same format of this file.

Change-Id: Idd27f733454ba48a38c62927704ee64cf78c64a9
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agoExit dlogutil on any --dumpfile failure 41/139841/10
Michal Bloch [Mon, 24 Jul 2017 08:12:07 +0000 (10:12 +0200)]
Exit dlogutil on any --dumpfile failure

Change-Id: I046871b0bcbe23b160d158230de143f092a1e7dd
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agodlogutil: free resources on exit 72/140572/9
Michal Bloch [Mon, 24 Jul 2017 13:30:40 +0000 (15:30 +0200)]
dlogutil: free resources on exit

Change-Id: I9756272b5614e352dc611ae362022c2bab5f3aee
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agoUtil flushing fix 67/139167/2
Michal Bloch [Wed, 12 Jul 2017 13:55:12 +0000 (15:55 +0200)]
Util flushing fix

When the sorting buffer is empty, only flush as many logs as needed
to make room for incoming ones. Previously the entire buffer would be
flushed, which was both a performance problem (the program would hang
and not read data while flushing) and a reduction of sort quality (as
recent logs were flushed as well).

Change-Id: I1b10c7286ab28e70438b82d60d69fad6c4f38df3
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agoMerge "Refactor vector operations into functions" into tizen
Rafal Pietruch [Thu, 27 Jul 2017 14:44:18 +0000 (14:44 +0000)]
Merge "Refactor vector operations into functions" into tizen

6 years agoMerge "dlogutil: refactor some globals into locals" into tizen
Rafal Pietruch [Thu, 27 Jul 2017 14:43:36 +0000 (14:43 +0000)]
Merge "dlogutil: refactor some globals into locals" into tizen

6 years agoRefactor vector operations into functions 34/140834/1
Michal Bloch [Wed, 26 Jul 2017 11:15:44 +0000 (13:15 +0200)]
Refactor vector operations into functions

Change-Id: I604bfdda6a8eeaf60dd5e0f58dfd01f86a77790b
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agodlogutil: refactor some globals into locals 11/140611/2
Michal Bloch [Tue, 25 Jul 2017 12:19:45 +0000 (14:19 +0200)]
dlogutil: refactor some globals into locals

Change-Id: Ida805b499e63c65d01c34fc338d73b60e2a4936a
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agoMerge "Fixes to binary log files" into tizen
Karol Lewandowski [Thu, 20 Jul 2017 12:46:31 +0000 (12:46 +0000)]
Merge "Fixes to binary log files" into tizen

6 years agoFixes to binary log files 36/139136/2
Michal Bloch [Fri, 14 Jul 2017 12:21:51 +0000 (14:21 +0200)]
Fixes to binary log files

 * fixed missing header in some circumstances
 * dlogutil no longer hangs whe reading those
 * made sure both the daemon and dlogutil use the same magic check constant

Change-Id: If4ae5e5fb255d6cab681a5e7785106925f19045c
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
7 years agoUse internal version of sd-daemon and drop libsystemd dependency 62/138962/2
Karol Lewandowski [Fri, 14 Jul 2017 10:42:10 +0000 (12:42 +0200)]
Use internal version of sd-daemon and drop libsystemd dependency

Needed due to external request for systemd to be able to log directly to dlog.
This change avoids creation of cyclic dependency that would be created in
that case.

Change-Id: I9c779f263e92f4f84b825d20e263296400fcbf05

7 years agoImport sd-daemon from systemd 61/138961/2
Karol Lewandowski [Fri, 14 Jul 2017 10:36:34 +0000 (12:36 +0200)]
Import sd-daemon from systemd

This commit import sd-daemon.[ch] directly from systemd,
commit 09812eb764b440651f3ff4cb5d37bd343f800560.

Change-Id: I9e4ea41da2218ba9ba8b02dceac41ed3ad3dda20

7 years agoMerge "send/recv pipe fd refactored" into tizen
Rafal Pietruch [Tue, 4 Jul 2017 10:32:30 +0000 (10:32 +0000)]
Merge "send/recv pipe fd refactored" into tizen

7 years agoMerge "logconfig: Simplify log_config_set API" into tizen
Rafal Pietruch [Tue, 4 Jul 2017 10:32:09 +0000 (10:32 +0000)]
Merge "logconfig: Simplify log_config_set API" into tizen

7 years agosend/recv pipe fd refactored 89/135489/3
Rafal Pietruch [Thu, 22 Jun 2017 11:58:04 +0000 (13:58 +0200)]
send/recv pipe fd refactored

 * send_pipe function moved to logcommon
 * close pipe fd outside send_pipe function
 * fd set/clear flags moved to logcommon
 * send/recv pipe common code extracted

Change-Id: Iba1e5e403c9759dc80631dcb7e82556cb540cb28

7 years agoPut testing programs in a package. 61/129961/9
Michal Bloch [Thu, 11 May 2017 08:57:50 +0000 (10:57 +0200)]
Put testing programs in a package.

 * testing binaries are now compiled
 * test_pipe.sh renamed to dlog_test_pipe
 * testing environment is now isolated

Change-Id: I4e63ffa741feb61882505af5fe87e8f902072c9d
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
7 years agologconfig: Simplify log_config_set API 73/129973/5
Karol Lewandowski [Fri, 9 Jun 2017 11:48:49 +0000 (13:48 +0200)]
logconfig: Simplify log_config_set API

Previously, logconfig provided push() function which only did
append new entry and set() which only did overwrite existing
entry.

This commit leaves only set() in public API, which does both
add & replace.  Original functions are hidden and available
for internal purpose only (modify, add).

Change-Id: Id5c735d3b2b9ca4f7a2dafd2879823fd42d3f56e

7 years agologutil: [bugfix] uninitialized reading offset 78/131978/4
Rafal Pietruch [Wed, 31 May 2017 08:36:50 +0000 (10:36 +0200)]
logutil: [bugfix] uninitialized reading offset

when creating struct fd_info for PIPE backend
the index field was not initialized causing
unpredictable behavior
thus the new function for the struct creation
was extracted to properly initialize the struct
anytime it is needed

Also:
* issue with possible allocation of 0 bytes was fixed
* strcmp used in case of strncmp where it makes no difference

Change-Id: Id791d3366b363da9a74a5eed6d2942219a3577c1

7 years agoMerge "Fix debug mode logic inversion" into tizen
Karol Lewandowski [Tue, 30 May 2017 08:18:58 +0000 (08:18 +0000)]
Merge "Fix debug mode logic inversion" into tizen

7 years agologger: fix -Werror=maybe-uninitialized 52/131152/2
Slava Barinov [Thu, 25 May 2017 12:54:37 +0000 (15:54 +0300)]
logger: fix -Werror=maybe-uninitialized

src/shared/logconfig.c:94:59: error: 'val' may be used uninitialized in this function [-Werror=maybe-uninitialized]

Change-Id: I581aee106c4d82dc8f5aa452be602e8b78fd87a2
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
7 years agoMerge "logger: introduce backend global config" into tizen
Karol Lewandowski [Fri, 26 May 2017 15:16:27 +0000 (15:16 +0000)]
Merge "logger: introduce backend global config" into tizen

7 years agoAdd dlogsend, a tool for sending dlog logs. 88/129988/14
Michal Bloch [Thu, 18 May 2017 15:27:46 +0000 (17:27 +0200)]
Add dlogsend, a tool for sending dlog logs.

Change-Id: I0de32470e04190e91d3eb8ac6dff7b0e7e3b8c50
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
7 years agoFix debug mode logic inversion 31/131331/2
Michal Bloch [Fri, 26 May 2017 10:21:11 +0000 (12:21 +0200)]
Fix debug mode logic inversion

If the debugmode file exists, access() returns 0 -> disabled debugmode.
Should be the other way around (disable debugmode if debugmode file does *not* exist).

Got accidentally broken in c1a7326e3ebf0f93e78c5d317ea7debe2fea207d

Change-Id: If9daeba158735759e2a8518ee25bfc722c147060
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
7 years agologger: introduce backend global config 64/131164/2
Rafal Pietruch [Thu, 25 May 2017 13:35:57 +0000 (15:35 +0200)]
logger: introduce backend global config

config is read once creation logger structures
when creating readers the config will not be read again
a backend and android logger devices are stored in global data
to access when are needed to create specific readers actions

Change-Id: I91a5bc2ef3dd4c86ea44b8314e3b1747739acc1b

7 years agoMerge changes Idd9c0d26,Iccb7ac50 into tizen
Karol Lewandowski [Thu, 25 May 2017 12:22:46 +0000 (12:22 +0000)]
Merge changes Idd9c0d26,Iccb7ac50 into tizen

* changes:
  logger: add readers waiting on pipe event
  logger: move writer/sock fd to fd_entity struct

7 years agoConform to Tizen coding rule. 17/129917/3
Michal Bloch [Thu, 18 May 2017 11:55:01 +0000 (13:55 +0200)]
Conform to Tizen coding rule.

Change-Id: I4ddd7c32b43f00f2095e0c6a40a9135781a93228
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
7 years agologger: add readers waiting on pipe event 23/130523/6
Rafal Pietruch [Tue, 23 May 2017 13:47:22 +0000 (15:47 +0200)]
logger: add readers waiting on pipe event

when printing logs using dlogutil there was lag
because of default 600ms timeout on epoll_wait
when no new logs were handled dlogutil waited
600ms every time a pipe it was connected with a server
become full

current solution resolves this problem by
adding readers waiting on pipe to the main epoll loop

Change-Id: Idd9c0d26e05b3341c6eef7085c661ffd7683358e

7 years agologger: move writer/sock fd to fd_entity struct 42/130742/4
Rafal Pietruch [Tue, 23 May 2017 13:45:20 +0000 (15:45 +0200)]
logger: move writer/sock fd to fd_entity struct

writers and sockets fds are registered in epoll loop
their fds are placed in the common fd_entity struct.
adding/removing fds to logger's epoll are redesigned
to reflect this pattern

free logger extra readers possible memory leak bugfix
and style minor changes

Change-Id: Iccb7ac50658494451290fa98ad170247a141099e

7 years agologger: use reader callback in case of reader type 72/129972/4
Rafal Pietruch [Wed, 17 May 2017 11:10:30 +0000 (13:10 +0200)]
logger: use reader callback in case of reader type

Change-Id: Ia894f31cacd0e2d8c831396c8a6c5309e44bb711

7 years agologger: use separate FD for file reader, bugfix 71/129971/2
Rafal Pietruch [Wed, 17 May 2017 10:45:25 +0000 (12:45 +0200)]
logger: use separate FD for file reader, bugfix

the buf_id field is not used for keeping file descriptor
new reader field read_fd is added to store this data
the buf_id specifies which buffer is used for reading
if buf_id is BUF_ID_INVALID the read_fd keeps file descriptor then

the read_fd is closed when reader_free is called
- resource leak bugfix

Change-Id: Ic321c48e6ef0d9f8946c72451d5b61bcbdabb1ff

7 years agologger: separate add reader to buffer function 41/129841/2
Rafal Pietruch [Mon, 15 May 2017 10:11:34 +0000 (12:11 +0200)]
logger: separate add reader to buffer function

Change-Id: I2d9a90bfdddea3ada81c543f31ba9b6d486b583b

7 years agologger: unify service reader functions 49/129649/7
Rafal Pietruch [Tue, 16 May 2017 15:21:11 +0000 (17:21 +0200)]
logger: unify service reader functions

Change-Id: Iab6f056e641261ef353b7fe804ce635d1ff4ef64

7 years agologger: use callbacks in case of entity type enum 91/129491/8
Rafal Pietruch [Tue, 16 May 2017 13:58:16 +0000 (15:58 +0200)]
logger: use callbacks in case of entity type enum

Change-Id: Ibbc0447ebcb57e3d4a05c0ba09a8fe41ea2bd747

7 years agologger: unify writer creation 90/129490/3
Rafal Pietruch [Tue, 16 May 2017 11:39:54 +0000 (13:39 +0200)]
logger: unify writer creation

Change-Id: Icc97d331efddc52c4df8f1be09cbd8d3ca7e8883

7 years agoMerge "packaging: Remove unused manifest file" into tizen
Rafal Pietruch [Wed, 17 May 2017 10:47:18 +0000 (10:47 +0000)]
Merge "packaging: Remove unused manifest file" into tizen

7 years agopackaging: Remove unused manifest file 99/129499/1
Karol Lewandowski [Tue, 16 May 2017 14:23:53 +0000 (16:23 +0200)]
packaging: Remove unused manifest file

Commit 29550842a ("[4.0] kmsg-backend removed") removed extended kmsg
support, but missed manifest file for kmsg backend package.

This commit removes this now-unused manifest file.

Change-Id: I16b8db8aea4132bfebbda6891f89f5f0c8976039

7 years agoMerge "Remove needless ad-hoc epoll" into tizen
Karol Lewandowski [Tue, 16 May 2017 13:57:07 +0000 (13:57 +0000)]
Merge "Remove needless ad-hoc epoll" into tizen

7 years agoFix dlogutil -d under Android Logger backend 59/127759/3
Michal Bloch [Fri, 28 Apr 2017 13:12:35 +0000 (15:12 +0200)]
Fix dlogutil -d under Android Logger backend

Util would keep reading as long as any data was in the buffer,
so if data came faster than it was processed then it would be
working indefinitely.

Now, it learns how many logs are present right at the start
by sending a get length request and only reads that many.

Change-Id: Idcfc7b10776ff93c85f16b335dad36d12bf5cd8e
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
7 years agoFix uninitialized variables. 79/127479/8
Michal Bloch [Wed, 26 Apr 2017 18:47:18 +0000 (20:47 +0200)]
Fix uninitialized variables.

Change-Id: I59455794f050aff9b92334243cee797ac745831d
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
7 years agoMerge "logger: redundant function argument removed" into tizen
Karol Lewandowski [Tue, 16 May 2017 11:08:52 +0000 (11:08 +0000)]
Merge "logger: redundant function argument removed" into tizen

7 years agoRemove needless ad-hoc epoll 50/128850/2
Michal Bloch [Thu, 11 May 2017 13:45:15 +0000 (15:45 +0200)]
Remove needless ad-hoc epoll

Previously, handling a reader caused an ad-hoc epoll fd to be created
just for the duration of the handling function. This is very wasteful
and the daemon would become sluggish.

The epoll was originally put in place because the pipes used to be
blocking. When pipes became nonblocking it was left alone on the
grounds that it's more efficient not to attempt doing writes that
the pipe is not ready to accept. While true, this is completely
subverted by recreating the epoll fd on every function call.

Change-Id: I9a886ca6613bb6786e01a2a7b5508c075d5b231d
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
7 years agoFix dlogutil -d on Pipe backend. 62/127762/2
Michal Bloch [Fri, 28 Apr 2017 19:23:48 +0000 (21:23 +0200)]
Fix dlogutil -d on Pipe backend.

Dumping readers now only receive logs that were present in the buffer
when the reader was created.

Change-Id: I3c3102c33633604d87d70c7c8b2b0ec1bf3c703c
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
7 years agologger: redundant function argument removed 84/129184/1
Rafal Pietruch [Mon, 15 May 2017 09:21:31 +0000 (11:21 +0200)]
logger: redundant function argument removed

buffer_append function gets log_buffer pointer
every log_buffer has its readers list pointer
so there is no need to include it in arguments

Change-Id: Id44f1091441a6fe3bee405297a094c362e883d6a

7 years agoMerge "Sort config entries alpha-numerically." into tizen accepted/tizen/4.0/unified/20170816.013150 accepted/tizen/unified/20170428.033057 submit/tizen-tizen-tizen/20170427.133758 submit/tizen/20170427.134121 submit/tizen_4.0/20170811.094300 tizen_4.0.m1_release
Karol Lewandowski [Thu, 27 Apr 2017 13:29:57 +0000 (13:29 +0000)]
Merge "Sort config entries alpha-numerically." into tizen

7 years agoSort config entries alpha-numerically. 60/126660/6
Michal Bloch [Fri, 21 Apr 2017 18:27:28 +0000 (20:27 +0200)]
Sort config entries alpha-numerically.

Change-Id: I4b64324243d15bd9b04787df383856de81e55686
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
7 years agoFix EAGAIN properly. 87/126687/2
Michal Bloch [Mon, 24 Apr 2017 16:58:40 +0000 (18:58 +0200)]
Fix EAGAIN properly.

The previous patch already produces the correct behaviour;
this just ensures correctness in case calling code changes.

Change-Id: Ibc514ac31dcb02462d5b6755d1765652a342dfa5
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
7 years agologger: handle EAGAIN properly for nonblocking fds 72/126672/2
Karol Lewandowski [Mon, 24 Apr 2017 14:18:08 +0000 (16:18 +0200)]
logger: handle EAGAIN properly for nonblocking fds

Reading non-blocking /dev/log_* returns -EINVAL when there is no
data available.  This commit fixes the service_reader_file() to
handle this situation gracefully.

Change-Id: I488361adeb11ea59719d645051e5a3f3173b6525

7 years agoSplit change_flags into set and clear. 78/125978/5
Michal Bloch [Wed, 12 Apr 2017 19:44:57 +0000 (21:44 +0200)]
Split change_flags into set and clear.

Change-Id: I02878434720f92f83a5c3682b305654e60ca7be1
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
7 years agoadded syslog message parser 30/120830/22
Rafal Pietruch [Fri, 24 Mar 2017 08:34:44 +0000 (09:34 +0100)]
added syslog message parser

Change-Id: I7a6d986f8504e1d979779a061e8b0da29e4dfaff