Loading system/gd/Android.bp +5 −0 Original line number Diff line number Diff line Loading @@ -407,9 +407,11 @@ cc_test { ":BluetoothOsTestSources_timerfd", ], static_libs: [ "bluetooth_flags_c_lib_for_test", "libbluetooth_log", "libchrome", "libgmock", "server_configurable_flags", ], shared_libs: [ "libbase", Loading Loading @@ -733,6 +735,7 @@ cc_fuzz { cc_benchmark { name: "bluetooth_benchmark_gd", defaults: [ "aconfig_lib_cc_shared_link.defaults", "gd_defaults", ], host_supported: true, Loading @@ -741,12 +744,14 @@ cc_benchmark { "benchmark.cc", ], static_libs: [ "bluetooth_flags_c_lib", "libbase", "libbluetooth_gd", "libbluetooth_log", "libbt_shim_bridge", "libchrome", "liblog", "server_configurable_flags", ], } Loading system/gd/os/BUILD.gn +4 −1 Original line number Diff line number Diff line Loading @@ -66,7 +66,10 @@ source_set("BluetoothOsSources_linux_generic") { "//bt/system/gd:gd_defaults", "//bt/system/log:log_defaults", ] deps = [ "//bt/system/gd:gd_default_deps" ] deps = [ "//bt/flags:bluetooth_flags_c_lib", "//bt/system/gd:gd_default_deps", ] if (target_os == "chromeos") { deps += [ ":BluetoothOsSources_chromeos" ] Loading system/gd/os/linux_generic/alarm.cc +15 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ #include "os/alarm.h" #include <bluetooth/log.h> #include <com_android_bluetooth_flags.h> #include <sys/timerfd.h> #include <unistd.h> Loading @@ -38,7 +39,11 @@ namespace os { using common::Closure; using common::OnceClosure; Alarm::Alarm(Handler* handler) : handler_(handler), fd_(TIMERFD_CREATE(ALARM_CLOCK, 0)) { Alarm::Alarm(Handler* handler) : handler_(handler) { int timerfd_flag = com::android::bluetooth::flags::non_wake_alarm_for_rpa_rotation() ? TFD_NONBLOCK : 0; fd_ = TIMERFD_CREATE(ALARM_CLOCK, timerfd_flag); log::assert_that(fd_ != -1, "cannot create timerfd: {}", strerror(errno)); token_ = handler_->thread_->GetReactor()->Register( Loading Loading @@ -77,6 +82,15 @@ void Alarm::on_fire() { uint64_t times_invoked; auto bytes_read = read(fd_, ×_invoked, sizeof(uint64_t)); lock.unlock(); if (com::android::bluetooth::flags::non_wake_alarm_for_rpa_rotation() && bytes_read == -1) { log::info("No data to read."); if (errno == EAGAIN || errno == EWOULDBLOCK) { log::info("Alarm is already canceled or rescheduled."); return; } } log::assert_that(bytes_read == static_cast<ssize_t>(sizeof(uint64_t)), "assert failed: bytes_read == static_cast<ssize_t>(sizeof(uint64_t))"); log::assert_that(times_invoked == static_cast<uint64_t>(1), "Invoked number of times:{} fd:{}", Loading Loading
system/gd/Android.bp +5 −0 Original line number Diff line number Diff line Loading @@ -407,9 +407,11 @@ cc_test { ":BluetoothOsTestSources_timerfd", ], static_libs: [ "bluetooth_flags_c_lib_for_test", "libbluetooth_log", "libchrome", "libgmock", "server_configurable_flags", ], shared_libs: [ "libbase", Loading Loading @@ -733,6 +735,7 @@ cc_fuzz { cc_benchmark { name: "bluetooth_benchmark_gd", defaults: [ "aconfig_lib_cc_shared_link.defaults", "gd_defaults", ], host_supported: true, Loading @@ -741,12 +744,14 @@ cc_benchmark { "benchmark.cc", ], static_libs: [ "bluetooth_flags_c_lib", "libbase", "libbluetooth_gd", "libbluetooth_log", "libbt_shim_bridge", "libchrome", "liblog", "server_configurable_flags", ], } Loading
system/gd/os/BUILD.gn +4 −1 Original line number Diff line number Diff line Loading @@ -66,7 +66,10 @@ source_set("BluetoothOsSources_linux_generic") { "//bt/system/gd:gd_defaults", "//bt/system/log:log_defaults", ] deps = [ "//bt/system/gd:gd_default_deps" ] deps = [ "//bt/flags:bluetooth_flags_c_lib", "//bt/system/gd:gd_default_deps", ] if (target_os == "chromeos") { deps += [ ":BluetoothOsSources_chromeos" ] Loading
system/gd/os/linux_generic/alarm.cc +15 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ #include "os/alarm.h" #include <bluetooth/log.h> #include <com_android_bluetooth_flags.h> #include <sys/timerfd.h> #include <unistd.h> Loading @@ -38,7 +39,11 @@ namespace os { using common::Closure; using common::OnceClosure; Alarm::Alarm(Handler* handler) : handler_(handler), fd_(TIMERFD_CREATE(ALARM_CLOCK, 0)) { Alarm::Alarm(Handler* handler) : handler_(handler) { int timerfd_flag = com::android::bluetooth::flags::non_wake_alarm_for_rpa_rotation() ? TFD_NONBLOCK : 0; fd_ = TIMERFD_CREATE(ALARM_CLOCK, timerfd_flag); log::assert_that(fd_ != -1, "cannot create timerfd: {}", strerror(errno)); token_ = handler_->thread_->GetReactor()->Register( Loading Loading @@ -77,6 +82,15 @@ void Alarm::on_fire() { uint64_t times_invoked; auto bytes_read = read(fd_, ×_invoked, sizeof(uint64_t)); lock.unlock(); if (com::android::bluetooth::flags::non_wake_alarm_for_rpa_rotation() && bytes_read == -1) { log::info("No data to read."); if (errno == EAGAIN || errno == EWOULDBLOCK) { log::info("Alarm is already canceled or rescheduled."); return; } } log::assert_that(bytes_read == static_cast<ssize_t>(sizeof(uint64_t)), "assert failed: bytes_read == static_cast<ssize_t>(sizeof(uint64_t))"); log::assert_that(times_invoked == static_cast<uint64_t>(1), "Invoked number of times:{} fd:{}", Loading