Move to kernel style SPDX license identifiers The SPDX identifier is a legally binding shorthand, which can be used instead of the full boiler plate text. See https://spdx.org/ids-how for details. Signed-off-by: Michael Jeanson <mjeanson@efficios.com> Change-Id: I62e7038e191a061286abcef5550b58f5ee67149d Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
sessiond: fix: possible unaligned access in packed structure A number of (potentially) unaligned pointers are used in client command handlers to pass command parameters to other internal functions. Fixing those forces a number of const-correctness changes where contexts are passed as arguments. Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Fix: include the filter expression in agent events' primary key Similar fix to a931962, but for filter expressions this time. UST events's key already includes the filter bytecode, so adding the string itself should not be needed. Signed-off-by: Alexandre Montplaisir <alexmonthy@efficios.com> Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Add the filter expression to the enable_event agent protocol message The filter expression is part of an event rule, so should be sent along with the event name and log level. This bumps the protocol version to 2.0, and will require UST agents to be updated. Signed-off-by: Alexandre Montplaisir <alexmonthy@efficios.com> Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Fix: disable agent events by name The event_agent_disable() function only disables the first agent event matching a given name. However, if multiple agent events exist with different loglevels, but share the same name, we want all of them to be disabled at once. Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com> Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
sessiond: use `loglevel_value` and `loglevel_type` names By using the `loglevel_value` and `loglevel_type` names instead of `loglevel` for one or the other, some unsettling inconsistencies are exposed. This patch only changes the names to show the weird stuff, e.g.: key.loglevel_type = loglevel_value; A future patch will fix this. The only `loglevel` names left untouched are those in public headers as well as those in the tools<->UST ABI. Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com> Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Fix: clean-up agent app hash table from the main sessiond thread The agent application hash table, which is allocated by the session daemon's main thread, is free'd from the agent application registration thread. This leads to a number of interesting scenarios under which the agent app registration thread may encounter an error, thus tearing itself down and freeing the agent_apps_ht_by_sock hash table. Of course, nothing then prevents the client processing thread from accessing this invalidated hash table to list, enable or disable agent events which leads to crashes or assertions hitting in ht_match_reg_uid(). However, it is not necessary for the agent app registration thread to encounter an error for this to prove problematic. As shown in bug #893, the session daemon's teardown will assert on a NULL key in ht_match_reg_uid() whenever it is performed while a JUL, Log4J or Python event is still enabled in a session. This happens because the session daemon's clean-up triggers the destruction of all sessions. The destruction of those sessions would access the free'd agent_apps_ht_by_sock to disable the registered agent events. Fixes #893 Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Add the support for multiple agent For this, a new field has been added to the register message, the domain type. Agent object and agent application object have now a domain type so we can enable/disable the right event for the right agent for a client command or during an application registration. The "jevent" name has been renamed to "aevent" so further remove the concept of Java event. Signed-off-by: David Goulet <dgoulet@efficios.com>