aboutsummaryrefslogtreecommitdiff
path: root/brillo/daemons
AgeCommit message (Collapse)Author
2020-02-26libbrillo: Refactor AsynchronousSignalHandler.Hidehiko Abe
- use sigorset to avoid timing issue. - Inlined ResetSignal() to make {Register,Unregister}Handler symmetric. - Use C++14. - Get rid of DISALLOW_COPY_AND_ASSIGN which is now not recommended. - Use base::ScopedFD for simpler maintenance. - Reorder members to follow the style guide and represent dependency clearer. BUG=None TEST=Ran unittest locally. Change-Id: If82608e3ca1e0c2d8069de6b23fb7adcf5360163 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform2/+/2066357 Tested-by: Hidehiko Abe <hidehiko@chromium.org> Reviewed-by: Shik Chen <shik@chromium.org> Reviewed-by: Eric Caruso <ejcaruso@chromium.org> Commit-Queue: Hidehiko Abe <hidehiko@chromium.org> Cr-Mirrored-From: https://chromium.googlesource.com/chromiumos/platform2 Cr-Mirrored-Commit: 6fc7959ff3cbd242d0f0c18d212597af0c5884bc
2019-12-12libbrillo: Change MessageLoop to use {Once,Repeating}ClosureAnand K Mistry
base::TaskRunner uses OnceClosure, therefore similar interfaces should also be updated. BUG=chromium:993857 TEST=cros_run_unit_tests --board=chell --packages libbrillo Change-Id: I7942a616d1b655c465b01e8bd23e5c675133b08d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform2/+/1827107 Reviewed-by: Eric Caruso <ejcaruso@chromium.org> Commit-Queue: Anand Mistry <amistry@chromium.org> Tested-by: Anand Mistry <amistry@chromium.org> Cr-Mirrored-From: https://chromium.googlesource.com/chromiumos/platform2 Cr-Mirrored-Commit: 7eacd33d906574f3a62b5446ce05c2d920afc360
2019-03-14libbrillo: Fix D-Bus namespace usage in headersMaksim Ivanov
Explicitly qualify the symbols used from the libchrome's "dbus" namespace, by adding double-colon before them. This fixes compilation errors when these headers are included after libbrillo's GLib D-Bus helpers, which define the "brillo::dbus" namespace. BUG=chromium:941748 TEST=manual Change-Id: I91ded54c7f47301566e164135cab0b24cc253f5c Reviewed-on: https://chromium-review.googlesource.com/1522146 Commit-Ready: Maksim Ivanov <emaxx@chromium.org> Tested-by: Maksim Ivanov <emaxx@chromium.org> Reviewed-by: Dan Erat <derat@chromium.org> Cr-Mirrored-From: https://chromium.googlesource.com/chromiumos/platform2 Cr-Mirrored-Commit: 167688c6ea09e3773b4fa4a2cca76fd87ed33ec3
2018-10-12libbrillo: daemon: retain signal handlers while terminatingBrian Norris
A Daemon may receive multiple SIG{TERM,INT} signals for a variety of reasons, and if we unregister our handler after the first one, that means the second one will take the default action -- to exit uncleanly. Not only does this register a lot of crash reports (a "service failure") on our crash servers, it's probably not the best daemon behavior. We really intend to exit the message loop relatively quickly, if given a chance. Instead, we're forced to skip any teardown tasks we might of done -- e.g., disconnecting from Wifi networks, tearing down cellular connections, etc. So instead, let's just stub out the signal handlers such that only their first execution will do anything, and subsequent entries will be no-ops. [1] In the case of a minijailed shill, upstart signals the entire process group when it's preparing to stop (e.g., on shutdown), and minijail0 may also forward it to the shill process. BUG=chromium:865442 TEST=`stop shill` and reboot tests show shill exiting cleanly Change-Id: I355eb2a5d1bd258946da1b2c64555c90426d173e Signed-off-by: Brian Norris <briannorris@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1275006 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Ben Chan <benchan@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org> Cr-Mirrored-From: https://chromium.googlesource.com/chromiumos/platform2 Cr-Mirrored-Commit: 1ea61f52bfd02b97d7e75288ab913d9b4733d160
2018-03-13libbrillo: provide Daemon method to do init on message loopEric Caruso
In OnInit the message loop may not be instantiated yet, so if some initialization has to happen asynchronously it might have any task runner to post tasks to. Allow subclasses of Daemon to provide a method implementation with initialization that must take place when the message loop has started and is the current message loop. BUG=b:74250103 TEST=with modemfwd Change-Id: I4c9a35934681a24730b01b60e9bca5e853e104ef Reviewed-on: https://chromium-review.googlesource.com/959524 Commit-Ready: Eric Caruso <ejcaruso@chromium.org> Tested-by: Eric Caruso <ejcaruso@chromium.org> Reviewed-by: Dan Erat <derat@chromium.org> Cr-Mirrored-From: https://chromium.googlesource.com/chromiumos/platform2 Cr-Mirrored-Commit: b4defe2ad0cf0a596af818315c65de4106786d03
2017-04-25libbrillo: Add daemon logging util functions.Justin TerAvest
These functions are duplicated today between power_manager and biod in ChromeOS platform2. I'd like to use these for metrics_daemon as well, and copying and pasting these again seemed wrong. BUG=None TEST=Built metrics_daemon using these functions. Change-Id: I3cd46dc7f1f5543ac3bd4cf24420d468bb13ff98 Reviewed-on: https://chromium-review.googlesource.com/486090 Commit-Ready: Justin TerAvest <teravest@chromium.org> Tested-by: Justin TerAvest <teravest@chromium.org> Reviewed-by: Dan Erat <derat@chromium.org> Cr-Mirrored-From: https://chromium.googlesource.com/chromiumos/platform2 Cr-Mirrored-Commit: 37d41d72b97a4adcc5f302fb677d07afe57538e9
2016-02-09libbrillo: Drop the required base::MessageLoopForIO when creating a ↵Alex Deymo
BaseMessageLoop. This patch adds a new default constructor to brillo::BaseMessageLoop dropping the requirement to create and pass a base::MessageLoopForIO. Instead, the default constructor will create and keep its own copy. Bug: 26987669 TEST=`m` on edison-eng Change-Id: Ibd8a1d98cbbc1cc1d39f5e90412902edd6840a45 Cr-Mirrored-From: https://chromium.googlesource.com/chromiumos/platform2 Cr-Mirrored-Commit: 33be7082043d51595cf3a4ae90d4343a51b34176
2016-01-21libbrillo: Add DBusConnection helper class to use instead of DBusDaemon.Alex Deymo
This CL moves the logic in DBusDaemon to a helper class that can be included in another class inheriting from Daemon without needed to use multiple inheritance nor forcing a DBus connection to succeed. DBusDaemon was modified to re-use this class without changing its behaviour to be compatible with existing code. Bug: 26690086 TEST=mm; Update update_engine to use this class and tested it on edison. Change-Id: If05a5582158552b6aeebf86dbde2aaa161f5a29f Cr-Mirrored-From: https://chromium.googlesource.com/chromiumos/platform2 Cr-Mirrored-Commit: 47667f349c10dcd7a40f488c58364f6d77211efa
2016-01-04libbrillo: Fix compiler warningsChristopher Wiley
Bug: b:26379664 Test: Compiles Change-Id: I67658ba9ceb8b769c97f0c345f7711bc96d27a84 Cr-Mirrored-From: https://chromium.googlesource.com/chromiumos/platform2 Cr-Mirrored-Commit: 2b1d624aaaaa21b871299bda059e9c441df79b92
2015-10-13libbrillo: rename from libchromeosAlex Vakulenko
Move chromeos symbols into brillo namespace, move the include files into "brillo" directory instead of "chromeos", and rename libchromeos[-.*] libraries into libbrillo-... Bug: b:24872993 TEST=built aosp and brillo and unit tests pass on dragonoboard Change-Id: Ieb979d1ebd3152921d36cd15acbd6247f02aae69 Cr-Mirrored-From: https://chromium.googlesource.com/chromiumos/platform2 Cr-Mirrored-Commit: 5ea23e0123f89a40db8a45b3473aae53f067b022