platform/core/system/faultd.git
7 years agoAdd helper sources for unit tests 08/140808/11
Konrad Kuchciak [Wed, 26 Jul 2017 11:07:06 +0000 (13:07 +0200)]
Add helper sources for unit tests

Change-Id: Ie9ebf2ae5bae6e33fde763792e26f416d6834f51
Signed-off-by: Konrad Kuchciak <k.kuchciak@samsung.com>
[Fix string generation]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
7 years agoMake database abstraction layer not depend on ejdb 35/139335/12
Paweł Szewczyk [Tue, 1 Aug 2017 17:28:52 +0000 (19:28 +0200)]
Make database abstraction layer not depend on ejdb

This commit introduces new abstraction layer for databases. Database
logic is separated into independent modules, leaving in core only
generic code.

Change-Id: I6291628b31f96df8d8acae77d659a9da733f2f36
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
[Minor fixes]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
7 years agoAdd new interface for storing json-like objects 34/139334/11
Paweł Szewczyk [Wed, 19 Jul 2017 14:09:41 +0000 (16:09 +0200)]
Add new interface for storing json-like objects

Change-Id: Ia55546087931d537580020fc1ea6cf36e39a08b3
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
[Use generic functions instead of copy-paste code]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
7 years agoAdd feature to enable specified modules at build time. 11/139811/6
Konrad Kuchciak [Thu, 20 Jul 2017 12:06:41 +0000 (14:06 +0200)]
Add feature to enable specified modules at build time.

Change-Id: If40c344ef163e4855fa867cd2ed521516630295f

7 years agoAlign faultd_bson_get_timespec function to fit convention used in EJDB. 24/138924/4
Konrad Kuchciak [Thu, 13 Jul 2017 15:24:33 +0000 (17:24 +0200)]
Align faultd_bson_get_timespec function to fit convention used in EJDB.

Change-Id: I20549539cb05d84c67c742a9de3ae678db88c412

7 years agoFIX: build should fail if any of the tests fail, not only last. 22/138922/4
Konrad Kuchciak [Fri, 14 Jul 2017 07:36:02 +0000 (09:36 +0200)]
FIX: build should fail if any of the tests fail, not only last.

Change-Id: Ia7265b29bce8bc1d99837ba0242c081208e2c7f9

7 years agoSome POC of faultd test framework 86/134286/7
Krzysztof Opasiak [Thu, 15 Jun 2017 22:25:10 +0000 (00:25 +0200)]
Some POC of faultd test framework

Change-Id: Ib9b8f8bca49b0dc546287aec1dedecc9e149c4b2
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
7 years agoImplement basic recovery mechanism 42/136442/5
Paweł Szewczyk [Thu, 29 Jun 2017 12:31:29 +0000 (14:31 +0200)]
Implement basic recovery mechanism

Change-Id: I26faf1621ab8e09b6d756d8131f7e55c21e125d5
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
7 years agoImplement deserialisation of resource_violation_event 88/132988/6
Łukasz Stelmach [Thu, 8 Jun 2017 12:59:50 +0000 (14:59 +0200)]
Implement deserialisation of resource_violation_event

Change-Id: Iac3cee29e78a1099443e29481a603ef624e5159f
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
7 years agoImplement deserialisation of service_failed_event 70/132970/10
Łukasz Stelmach [Fri, 2 Jun 2017 14:45:35 +0000 (16:45 +0200)]
Implement deserialisation of service_failed_event

Allocate service_failed_event and fill it with data loaded from the
database.

Change-Id: Ib3d82e92e6e3c21cc37859aaef443b9b991c06e5
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
[ Remove BSON_BIN_UUID_OLD due to compilation error with new EJDB
version. ]
Signed-off-by: Konrad Kuchciak <k.kuchciak@samsung.com>
7 years agoSerialise OID of the event being the reason for the decision 93/135293/4
Łukasz Stelmach [Wed, 21 Jun 2017 13:35:52 +0000 (15:35 +0200)]
Serialise OID of the event being the reason for the decision

Change-Id: I12969364083f93b5c164871da50f3ba1f9ccc806
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
7 years agoAdd command line help 70/135470/9
Paweł Szewczyk [Thu, 22 Jun 2017 11:08:04 +0000 (13:08 +0200)]
Add command line help

Change-Id: I33caa8cd478e7a413ad412a3cf12851944443bb4
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
7 years agoAdd faultd configuration 30/133530/11
Paweł Szewczyk [Tue, 11 Jul 2017 13:11:28 +0000 (15:11 +0200)]
Add faultd configuration

Includes configuration parsing.

Change-Id: I94ab44a652635ac36a9ada4ddf4e07ba1e712de8
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
7 years agoAdd action executed event 78/137178/2
Krzysztof Opasiak [Tue, 4 Jul 2017 15:05:52 +0000 (17:05 +0200)]
Add action executed event

This event should be generated after each action execution
this allows to store action log into data base using our
generic framework.

Add also dummy handler for this event type to avoid some logs
about unhandled event.

Change-Id: If18b2bc7692ef136f6e952fd59350940e021fba5
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
7 years agoStart faultd on boot 67/135467/3
Łukasz Stelmach [Thu, 22 Jun 2017 10:36:40 +0000 (12:36 +0200)]
Start faultd on boot

Change-Id: Iacc1b0d70aed33ba21ea130573104ba3f8c4b306
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
7 years agoSave faultd database under /var/db/faultd 78/135478/3
Łukasz Stelmach [Thu, 22 Jun 2017 12:25:50 +0000 (14:25 +0200)]
Save faultd database under /var/db/faultd

Change-Id: I77fe25d835ee4cf7677a9cde58ac72ed71604453
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
7 years agoDisable audit-listener module in service file 76/135476/1 accepted/tizen/4.0/unified/20170816.012044 accepted/tizen/unified/20170629.085835 submit/tizen/20170622.134850 submit/tizen_4.0/20170811.094300
Paweł Szewczyk [Thu, 22 Jun 2017 12:12:26 +0000 (14:12 +0200)]
Disable audit-listener module in service file

Change-Id: I3a336341294de2bf511983d318d7bb938e70ceb0
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
7 years agoDisable action modules 56/135456/1 accepted/tizen/unified/20170629.085808 submit/tizen/20170622.101818
Łukasz Stelmach [Thu, 22 Jun 2017 10:10:43 +0000 (12:10 +0200)]
Disable action modules

Deploy faultd to Mobile and Wearable images with actions disabled to
prevent regressions.

Change-Id: I5ddf26143ad3eb804575e4d0c7eeb3949725075e
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
7 years agoAdd no-action command line option 98/135298/2
Paweł Szewczyk [Wed, 21 Jun 2017 16:01:40 +0000 (18:01 +0200)]
Add no-action command line option

Also adds a possibility to disable any module category.

Change-Id: I82a24f6e4594a0946ce4b796cedbb59da0b722ad
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
7 years agoAdd disable-module command line option 96/135296/2
Paweł Szewczyk [Wed, 21 Jun 2017 15:35:53 +0000 (17:35 +0200)]
Add disable-module command line option

Change-Id: I396c93df20017f27b305b0eae23e0cfd0c834caf
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
7 years agoInstall configuration files in Makefile instead of spec 94/135294/2
Łukasz Stelmach [Wed, 21 Jun 2017 14:56:10 +0000 (16:56 +0200)]
Install configuration files in Makefile instead of spec

Change-Id: Ib3c754f692965ab2e8c02eded74f35fb866d709f
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
7 years agoUse private bus provided by systemd 27/131527/7
Paweł Szewczyk [Wed, 7 Jun 2017 13:24:55 +0000 (15:24 +0200)]
Use private bus provided by systemd

Change-Id: I74a141d484002054b7a7a4ec72b0bacaa9e5f6f7
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
7 years agoImplement last boot id retrieval from db 13/130513/7
Paweł Szewczyk [Mon, 22 May 2017 13:51:48 +0000 (15:51 +0200)]
Implement last boot id retrieval from db

Change-Id: I84d8baa64df118855aa74afb54bcf28b4fec3afa
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
7 years agodatabase: Add retrieval function 12/130512/7
Paweł Szewczyk [Mon, 22 May 2017 13:51:52 +0000 (15:51 +0200)]
database: Add retrieval function

Change-Id: I701707829c2308fbdb971d1b533ded81a81a07f8
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
7 years agoAdd 'system booted' event 11/130511/7
Paweł Szewczyk [Mon, 22 May 2017 11:24:14 +0000 (13:24 +0200)]
Add 'system booted' event

Event is generated based on boot id stored in database. This commit is
based on stub implementation of last boot id retrieval from db.

Change-Id: I59c22fbae6eeebda9de83e7905aed478711cc655
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
7 years agoAdd faultd startup listener and 'faultd started' event 10/130510/5
Paweł Szewczyk [Mon, 22 May 2017 15:07:19 +0000 (17:07 +0200)]
Add faultd startup listener and 'faultd started' event

Change-Id: I7038132bdeb5337dfdd787acc812cce5fa26176b
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
8 years agoFix test entry point declaration 22/134422/1
Łukasz Stelmach [Fri, 16 Jun 2017 09:04:57 +0000 (11:04 +0200)]
Fix test entry point declaration

Change-Id: I4930178d3bba1ce70e8afe9ee8333e6078e84c21

8 years agoAdd the option to enable testing code 05/134105/2
Łukasz Stelmach [Wed, 14 Jun 2017 14:30:20 +0000 (16:30 +0200)]
Add the option to enable testing code

Add the option in configure.ac and the macro to define entry points
for testing code.

Change-Id: Icbdc657283b925935861e951123a3b4d4ee55662
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
8 years agoDerive module module names from file names 04/134104/1
Łukasz Stelmach [Wed, 14 Jun 2017 14:28:09 +0000 (16:28 +0200)]
Derive module module names from file names

Change-Id: I24fa4f6fd69a968b529080f7509926bd0af8b85f
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
8 years agocore: service: Add serialisation for service_type and recovery_unit 18/133818/1
Łukasz Stelmach [Mon, 12 Jun 2017 15:14:01 +0000 (17:14 +0200)]
core: service: Add serialisation for service_type and recovery_unit

Change-Id: I174617c69f5a69e3f7bb3f74d8d1a147fdf7565e
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
8 years agodatabase: implement database_load() 71/131171/12
Łukasz Stelmach [Thu, 25 May 2017 15:38:45 +0000 (17:38 +0200)]
database: implement database_load()

Change-Id: Ieb99efe60e1de90ee2103843dcae0ff14ea96104

8 years agoUse bson instead of void * for passing action data 09/132009/7
Krzysztof Opasiak [Wed, 31 May 2017 17:38:38 +0000 (19:38 +0200)]
Use bson instead of void * for passing action data

Change-Id: I43de8f7d1162a5f6824ca404add341b201bbf2e5
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoAdd helpers to fill bson with data required for given action 08/132008/7
Krzysztof Opasiak [Mon, 5 Jun 2017 17:01:12 +0000 (19:01 +0200)]
Add helpers to fill bson with data required for given action

Change-Id: I9ffd9ff03afa054398b571b18e3694d1f3a093a8
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoAdd helpers for bson manipulation 07/132007/7
Krzysztof Opasiak [Wed, 31 May 2017 10:32:10 +0000 (12:32 +0200)]
Add helpers for bson manipulation

Change-Id: Iad2cefd42c3322a7d7d9a4fd66f3f939e88d87c7
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoAdd decision maker to handle all standard services 66/131366/7
Krzysztof Opasiak [Fri, 26 May 2017 15:04:37 +0000 (17:04 +0200)]
Add decision maker to handle all standard services

For now we always cleanup and restart service.
In future we should check the history and reboot platform
after 3 failures of some service.

Change-Id: I76562af73d65ec350f8bd34a8b96545a11e5e1ac
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoMerge "Serialise events to bson format" into tizen
Krzysztof Opasiak [Mon, 5 Jun 2017 16:43:11 +0000 (16:43 +0000)]
Merge "Serialise events to bson format" into tizen

8 years agoMerge "core: Create database adapter module" into tizen
Krzysztof Opasiak [Mon, 5 Jun 2017 16:40:13 +0000 (16:40 +0000)]
Merge "core: Create database adapter module" into tizen

8 years agoAdd VIP service decision maker 36/130536/6
Krzysztof Opasiak [Mon, 22 May 2017 16:49:25 +0000 (18:49 +0200)]
Add VIP service decision maker

Add a decision maker which will reboot the system if VIP
service has entered a failed state

Change-Id: I05bc657bb48b7ba826da922b8d8f6cc1a72a2846
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agodm: rv_dm: Request platform reboot if VIP service has a resource leak 84/130484/8
Krzysztof Opasiak [Fri, 19 May 2017 17:27:36 +0000 (19:27 +0200)]
dm: rv_dm: Request platform reboot if VIP service has a resource leak

Change-Id: Ia6608b7939eadea4a5991f21af5b556277aff0d0
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoAdd some helper for service type checking 83/130483/6
Krzysztof Opasiak [Fri, 19 May 2017 17:25:25 +0000 (19:25 +0200)]
Add some helper for service type checking

Change-Id: If11034bedd999d52f0dd0f96627c96109b0d66d8
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoAdd faultd config files for test services 85/130485/7
Krzysztof Opasiak [Mon, 22 May 2017 08:54:24 +0000 (10:54 +0200)]
Add faultd config files for test services

Change-Id: Id5def3bed1bdb8804ffebdfd5f942246663319c7
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoSerialise events to bson format 64/130264/9
Łukasz Stelmach [Fri, 19 May 2017 15:00:16 +0000 (17:00 +0200)]
Serialise events to bson format

Change-Id: Iebe856156ce6e65e3edcaf79952a633d25a1ea6d
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
8 years agocore: Create database adapter module 63/130263/8
Łukasz Stelmach [Mon, 22 May 2017 10:57:32 +0000 (12:57 +0200)]
core: Create database adapter module

Change-Id: I5a77674ae87defab22a8925b49f4db7f54d97241
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
8 years agoAdd configuration for currently customized services 63/131163/3
Paweł Szewczyk [Thu, 25 May 2017 13:47:45 +0000 (15:47 +0200)]
Add configuration for currently customized services

Change-Id: I1bee7131990570dd7dc446c9f86072448b5788b0
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
8 years agoFix copyright notices 35/130735/3
Łukasz Stelmach [Tue, 23 May 2017 12:16:47 +0000 (14:16 +0200)]
Fix copyright notices

Change-Id: I4b38c66de2d478015b5256294d55ab36cbaf9595
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
8 years agoDefine _GNU_SOURCE globally in CFLAGS 34/130734/3
Łukasz Stelmach [Tue, 23 May 2017 12:03:25 +0000 (14:03 +0200)]
Define _GNU_SOURCE globally in CFLAGS

Change-Id: I0147ac08c961987e9d1ce49b87091955a5e8a35c
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
8 years agoservice: Add service-related configuration parsing 57/129957/13
Paweł Szewczyk [Fri, 19 May 2017 09:04:25 +0000 (11:04 +0200)]
service: Add service-related configuration parsing

Introduce service configuration files stored in /etc/faultd/config.d.

Config files are stored in json format, so this adds dependency on
json-c library.

Change-Id: Ibec741d67a563e8a1fb4037459e3acc00081c62c
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
[Fix memory mngnt and split to smaller functions]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoProvide serialising function for struct timespec 58/130258/2
Łukasz Stelmach [Mon, 15 May 2017 08:44:58 +0000 (10:44 +0200)]
Provide serialising function for struct timespec

Provide serialising function for struct timespec as well as macro for
generating such functions.

Change-Id: Ib27477b2be0ab9e6f38f5d1fede477426acb7e80
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
8 years agoZero allocated event structures 65/130265/2
Łukasz Stelmach [Mon, 22 May 2017 10:04:10 +0000 (12:04 +0200)]
Zero allocated event structures

Change-Id: Ic85cf158cb4187400b5ef0a203c36e147ef88de2
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
8 years agotests: update db test programme 61/130261/2
Łukasz Stelmach [Wed, 17 May 2017 13:25:07 +0000 (15:25 +0200)]
tests: update db test programme

Change-Id: I66d7dda70e037651f5edd299c3f108f684ab1021
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
[Rebase onto current head]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agotests: Install the failing test service 59/130259/2
Łukasz Stelmach [Wed, 17 May 2017 13:16:55 +0000 (15:16 +0200)]
tests: Install the failing test service

Rename also leaker test service to faultd-leaker.

Change-Id: I32bb0502e390d5f555d2695ac539cb444e4c9dae
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
[Rebase onto current head]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoReport only failed services in the systemd listener 60/130260/2
Łukasz Stelmach [Wed, 17 May 2017 13:22:27 +0000 (15:22 +0200)]
Report only failed services in the systemd listener

Change-Id: Iec50c0c94e8896eec07cd280bd0cf68c147f6815
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
[Rebase onto current head]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agomodule: Add parameter to pass configuration to modules 62/130262/2
Łukasz Stelmach [Thu, 18 May 2017 14:14:32 +0000 (16:14 +0200)]
module: Add parameter to pass configuration to modules

Change-Id: I728ff341d16bfce9af0b3b3293c8dd1ec6603137
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
[Rebase onto current head]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoservice: Change service.name to service.dbus_path 56/129956/3
Paweł Szewczyk [Thu, 18 May 2017 12:03:43 +0000 (14:03 +0200)]
service: Change service.name to service.dbus_path

What we called 'name' was actually a dbus path, so 'dbus_path' is a better
name for it.

Change-Id: If85c82e6f9dde703e6c2946e01cdc68e0db5ca7b
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
8 years agocore: service: Use defines instead of hard coded strings 86/129986/1
Krzysztof Opasiak [Thu, 18 May 2017 17:22:25 +0000 (19:22 +0200)]
core: service: Use defines instead of hard coded strings

Change-Id: I5f0726b6d6aa71c17d66dd663819e44e7ddbe807
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolisteners: systemd: fix: unreference bus and error when it's not needed 85/129985/1
Krzysztof Opasiak [Thu, 18 May 2017 17:21:53 +0000 (19:21 +0200)]
listeners: systemd: fix: unreference bus and error when it's not needed

Change-Id: Ia88f074aa935745f06af695e08c1586a21751b1b
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoAdd default implementation of reboot to recovery action 11/129711/3
Krzysztof Opasiak [Wed, 17 May 2017 20:49:22 +0000 (22:49 +0200)]
Add default implementation of reboot to recovery action

For now it just adds some dummy parameter which has to be
substituted with real parameter name.

Change-Id: Id85abecc785234bac3e916d6139b224ca49e6def
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoAdd default implementation of system reboot action 10/129710/3
Krzysztof Opasiak [Wed, 17 May 2017 20:48:45 +0000 (22:48 +0200)]
Add default implementation of system reboot action

Change-Id: Ib6c0f18dc7037bf1b0bc5259bfad023ec00ea330
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoAdd service recovery action 09/129709/2
Krzysztof Opasiak [Wed, 17 May 2017 20:48:19 +0000 (22:48 +0200)]
Add service recovery action

For now it's only copy-paste of service restart.
Has to be updated in a future.

Change-Id: I5f13b4f6b1b2c9e62752bb598b51bb1d39826055
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoMake tests/leaker a valid systemd service 13/129513/4
Krzysztof Opasiak [Tue, 16 May 2017 15:36:43 +0000 (17:36 +0200)]
Make tests/leaker a valid systemd service

Change-Id: I572e206454a92ff9bcd828f2f9977b5458b2c5c3
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoAdd service restart action implementation 12/129512/3
Krzysztof Opasiak [Tue, 16 May 2017 11:08:44 +0000 (13:08 +0200)]
Add service restart action implementation

Change-Id: If82d9d6e4083504493f945a7bc5c309e49cbfac4
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoAdd helpers and defines for action implementation 11/129511/3
Krzysztof Opasiak [Tue, 16 May 2017 11:07:17 +0000 (13:07 +0200)]
Add helpers and defines for action implementation

Change-Id: Ie0fdc5a965ca9973acff67ac6c6db01604d88aa3
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoAdd action execution framework 53/129253/3
Krzysztof Opasiak [Mon, 15 May 2017 18:56:02 +0000 (20:56 +0200)]
Add action execution framework

This framework is implemented as event handler which handles all
decision made events. Currently it just iterates through the list of
registered builtin action looking for a suitable action to execute.
If action has not been found it just simply fails with error log
and drops the event.

Change-Id: Ib7f36b4b5ce523a78f72ad388611ebfdaba6a2ee
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoAdd dedicated module type for action implementations 52/129252/2
Krzysztof Opasiak [Mon, 15 May 2017 18:53:40 +0000 (20:53 +0200)]
Add dedicated module type for action implementations

Action implementations has to be initialized after action
executor but before decision makers. To acheve this let's
add a new module type in between.

Change-Id: I786f88e3bd24c739ee3f8d6b3a32ddb903854346
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agocore: event_processor: Add missing break in list iteration 10/129510/1
Krzysztof Opasiak [Tue, 16 May 2017 17:08:13 +0000 (19:08 +0200)]
core: event_processor: Add missing break in list iteration

When we find handler for particular event we should stop list
iteration. Otherwise we may get a NULL pointer dereference.

Change-Id: I33022ea84d8e9e5b0a71cf53f9ad4adb006afb3e
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoutil: nqueue: Set fd to -1 after closing eventfd 09/129509/1
Krzysztof Opasiak [Tue, 16 May 2017 19:26:46 +0000 (21:26 +0200)]
util: nqueue: Set fd to -1 after closing eventfd

Unexpected closing of eventfd may be very hard to debug as kernel may
reuse just closed fd number. To avoid queuing new element to queue
with closed eventfd let's invalidate fd in nqueue_cleanup().

Change-Id: I3e9328dfd713fc29d2adbed68dd1a1b35770e6a9
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoutil: queue: use list_del_init() instead of list_del() for pop() 08/129508/1
Krzysztof Opasiak [Tue, 16 May 2017 18:21:00 +0000 (20:21 +0200)]
util: queue: use list_del_init() instead of list_del() for pop()

Let's use list_del_init() instead of list_del() for queue_pop()
to avoid putting queue element in inconsistent state.

Change-Id: I68f78d6d22315e9f3e716589e70175b471672ebc
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoutil: log: fflush() stderr after each log line 07/129507/1
Krzysztof Opasiak [Tue, 16 May 2017 17:36:35 +0000 (19:36 +0200)]
util: log: fflush() stderr after each log line

Change-Id: Ifaff8c9718edaa54db2a5c051404f0b6bc1490b1
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolisteners: systemd: Fix typo in log message 06/129506/1
Krzysztof Opasiak [Tue, 16 May 2017 11:08:04 +0000 (13:08 +0200)]
listeners: systemd: Fix typo in log message

Change-Id: Ic5cc188d158bc6ef2d967debef8e7cb5b6874efb
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolisteners: systemd: Fix printf() format for uint64_t 51/129251/1
Krzysztof Opasiak [Mon, 15 May 2017 19:18:30 +0000 (21:18 +0200)]
listeners: systemd: Fix printf() format for uint64_t

Change-Id: I7a9ae8e51ef6a97632bdf43790475c18586b3a7a
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoUse bson as the event serialisation format sandbox/kopasiak/rebased_with_coding_style
Łukasz Stelmach [Tue, 9 May 2017 10:57:04 +0000 (12:57 +0200)]
Use bson as the event serialisation format

As of this commit faultd depends on ejdb package.

8 years agoAdd dummy serialization function for events
Krzysztof Opasiak [Wed, 10 May 2017 18:37:44 +0000 (20:37 +0200)]
Add dummy serialization function for events

8 years agoRecord boot_id in events
Krzysztof Opasiak [Wed, 10 May 2017 18:34:36 +0000 (20:34 +0200)]
Record boot_id in events

8 years agoChange naming convention of internal event function
Krzysztof Opasiak [Wed, 10 May 2017 18:33:38 +0000 (20:33 +0200)]
Change naming convention of internal event function

Change the naming convention by adding "_internal" suffix to functions
called by subclasses.

8 years agoAdd program to compare ejdb and sqlite performance
Łukasz Stelmach [Tue, 9 May 2017 09:50:15 +0000 (11:50 +0200)]
Add program to compare ejdb and sqlite performance

8 years agoAdd listener to collect events propagated by systemd via dbus
Łukasz Stelmach [Tue, 9 May 2017 09:49:46 +0000 (11:49 +0200)]
Add listener to collect events propagated by systemd via dbus

This listener subscribes to DBUS signals generated by systemd
to catch services which entered a failed state.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoAdd entity to represent service failure
Krzysztof Opasiak [Tue, 9 May 2017 09:44:02 +0000 (11:44 +0200)]
Add entity to represent service failure

This type of event should be generated by a listener
when it detects that some service entered a failed state.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoAdd a decision maker to restart a service when it leaks resources
Krzysztof Opasiak [Tue, 9 May 2017 09:42:17 +0000 (11:42 +0200)]
Add a decision maker to restart a service when it leaks resources

This is a very simple decision maker which always restarts
a service if it's leaking resources.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoAdd decision made event
Krzysztof Opasiak [Tue, 9 May 2017 11:33:48 +0000 (13:33 +0200)]
Add decision made event

This event is generated when some decision maker
made a decision that some action should be executed.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoAdd a simple program to test audit listener
Paweł Szewczyk [Tue, 9 May 2017 09:41:09 +0000 (11:41 +0200)]
Add a simple program to test audit listener

This is just a process which leaks file descriptors.
To test audit listener just run faultd and then this
program.

8 years agoAdd audit listener to catch resource violation events
Krzysztof Opasiak [Tue, 9 May 2017 11:32:52 +0000 (13:32 +0200)]
Add audit listener to catch resource violation events

8 years agoAdd entity to represent resource violation event
Krzysztof Opasiak [Tue, 9 May 2017 11:31:47 +0000 (13:31 +0200)]
Add entity to represent resource violation event

Resource violation means that some process is using
more resources than it should.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoAdd IDs of predefined faultd actions
Krzysztof Opasiak [Tue, 9 May 2017 09:25:25 +0000 (11:25 +0200)]
Add IDs of predefined faultd actions

Action which can be executed when event arrived is identified
by a string in reverse domain name convention.

faultd will provide implementation of 4 predefined actions.
All other actions can be provided by a plugin mechanism
(to be implemented later)

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoAdd system service abstraction
Krzysztof Opasiak [Tue, 9 May 2017 11:29:39 +0000 (13:29 +0200)]
Add system service abstraction

Internally this entity talks with systemd via DBUS to
translate PID to systemd service name.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoAdd framework for processing faultd events
Krzysztof Opasiak [Tue, 9 May 2017 11:28:34 +0000 (13:28 +0200)]
Add framework for processing faultd events

For now it's just a simple framework which has a list of
available event handlers each time when event arrives it
iterates through the list to find a volunteer to handle
this event.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoAdd faultd event entity
Krzysztof Opasiak [Tue, 9 May 2017 11:24:13 +0000 (13:24 +0200)]
Add faultd event entity

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoAdd tizen packaging
Łukasz Stelmach [Mon, 8 May 2017 21:04:28 +0000 (23:04 +0200)]
Add tizen packaging

8 years agoMake faultd build
Łukasz Stelmach [Mon, 8 May 2017 21:02:59 +0000 (23:02 +0200)]
Make faultd build

8 years agoAdd main faultd file
Łukasz Stelmach [Mon, 8 May 2017 21:00:53 +0000 (23:00 +0200)]
Add main faultd file

8 years agoAdd modules infrastructure
Krzysztof Opasiak [Mon, 8 May 2017 20:58:22 +0000 (22:58 +0200)]
Add modules infrastructure

Add some infrastructure to make faultd a modular daemon.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoAdd queue with fd notification
Krzysztof Opasiak [Mon, 8 May 2017 20:54:07 +0000 (22:54 +0200)]
Add queue with fd notification

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoAdd simple queue implementation
Krzysztof Opasiak [Mon, 8 May 2017 20:51:24 +0000 (22:51 +0200)]
Add simple queue implementation

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoAdd simple list implementation based on linux kernel
Krzysztof Opasiak [Mon, 8 May 2017 20:50:25 +0000 (22:50 +0200)]
Add simple list implementation based on linux kernel

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoAdd reference counting helper
Krzysztof Opasiak [Mon, 8 May 2017 20:39:28 +0000 (22:39 +0200)]
Add reference counting helper

Add a helper structure based on kref to simplify memory management.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoAdd logging infrastructure
Łukasz Stelmach [Mon, 8 May 2017 20:56:21 +0000 (22:56 +0200)]
Add logging infrastructure

8 years agoAdd common macros which can be useful in faultd
Krzysztof Opasiak [Mon, 8 May 2017 20:46:32 +0000 (22:46 +0200)]
Add common macros which can be useful in faultd

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoAdd codding-style configuration for emacs
Łukasz Stelmach [Mon, 8 May 2017 20:48:18 +0000 (22:48 +0200)]
Add codding-style configuration for emacs

8 years agoAdd .gitignore
Łukasz Stelmach [Mon, 8 May 2017 20:49:16 +0000 (22:49 +0200)]
Add .gitignore

[Add also .orig files as ignored]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoAdd license file
Łukasz Stelmach [Mon, 8 May 2017 20:37:02 +0000 (22:37 +0200)]
Add license file

8 years agoInitial empty repository master
Tizen Infrastructure [Mon, 3 Apr 2017 06:23:29 +0000 (23:23 -0700)]
Initial empty repository