Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 33b94e0b authored by Elliott Hughes's avatar Elliott Hughes Committed by Gerrit Code Review
Browse files

Merge "Use PLOG rather than LOG strerror(errno)."

parents 2d7ddc98 25ce28a0
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -170,7 +170,7 @@ void Reactor::Unregister(Reactor::Reactable* reactable) {
    if (result == -1 && errno == ENOENT) {
      LOG(INFO) << __func__ << ": reactable is invalid or unregistered";
    } else if (result == -1) {
      LOG(FATAL) << __func__ << ": failed: " << strerror(errno);
      PLOG(FATAL) << __func__ << ": failed";
    }
    // If we are unregistering during the callback event from this reactable, we delete it after the callback is executed.
    // reactable->is_executing_ is protected by reactable->lock_, so it's thread safe.
+1 −1
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@ void Thread::run(Priority priority) {
    int rc;
    RUN_NO_INTR(rc = sched_setscheduler(linux_tid, SCHED_FIFO, &rt_params));
    if (rc != 0) {
      LOG(ERROR) << __func__ << ": unable to set SCHED_FIFO priority: " << strerror(errno);
      PLOG(ERROR) << __func__ << ": unable to set SCHED_FIFO priority";
    }
  }
  reactor_.Run();
+8 −8
Original line number Diff line number Diff line
@@ -203,12 +203,12 @@ void hci_initialize() {
  addr.hci_dev = hci_interface;
  addr.hci_channel = HCI_CHANNEL_USER;
  if (bind(fd, (struct sockaddr*)&addr, sizeof(addr)) < 0) {
    LOG(FATAL) << "socket bind error " << strerror(errno);
    PLOG(FATAL) << "socket bind error";
  }

  int sv[2];
  if (socketpair(AF_UNIX, SOCK_STREAM, 0, sv) < 0) {
    LOG(FATAL) << "socketpair failed: " << strerror(errno);
    PLOG(FATAL) << "socketpair failed";
  }

  reader_thread_ctrl_fd = sv[0];
@@ -274,7 +274,7 @@ void hci_transmit(BT_HDR* packet) {

  if (ret != packet->len + 1) LOG(ERROR) << "Should have send whole packet";

  if (ret == -1) LOG(FATAL) << strerror(errno);
  if (ret == -1) PLOG(FATAL) << "write failed";
}

static int wait_hcidev(void) {
@@ -288,7 +288,7 @@ static int wait_hcidev(void) {

  fd = socket(PF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI);
  if (fd < 0) {
    LOG(ERROR) << "Bluetooth socket error: %s" << strerror(errno);
    PLOG(ERROR) << "Bluetooth socket error";
    return -1;
  }

@@ -298,7 +298,7 @@ static int wait_hcidev(void) {
  addr.hci_channel = HCI_CHANNEL_CONTROL;

  if (bind(fd, (struct sockaddr*)&addr, sizeof(addr)) < 0) {
    LOG(ERROR) << "HCI Channel Control: " << strerror(errno);
    PLOG(ERROR) << "HCI Channel Control";
    close(fd);
    return -1;
  }
@@ -314,7 +314,7 @@ static int wait_hcidev(void) {
  ssize_t wrote;
  OSI_NO_INTR(wrote = write(fd, &ev, 6));
  if (wrote != 6) {
    LOG(ERROR) << "Unable to write mgmt command: " << strerror(errno);
    PLOG(ERROR) << "Unable to write mgmt command";
    ret = -1;
    goto end;
  }
@@ -323,7 +323,7 @@ static int wait_hcidev(void) {
    int n;
    OSI_NO_INTR(n = poll(fds, 1, MGMT_EV_POLL_TIMEOUT));
    if (n == -1) {
      LOG(ERROR) << "Poll error: " << strerror(errno);
      PLOG(ERROR) << "Poll error";
      ret = -1;
      break;
    } else if (n == 0) {
@@ -335,7 +335,7 @@ static int wait_hcidev(void) {
    if (fds[0].revents & POLLIN) {
      OSI_NO_INTR(n = read(fd, &ev, sizeof(struct mgmt_pkt)));
      if (n < 0) {
        LOG(ERROR) << "Error reading control channel: " << strerror(errno);
        PLOG(ERROR) << "Error reading control channel";
        ret = -1;
        break;
      }
+3 −3
Original line number Diff line number Diff line
@@ -89,7 +89,7 @@ bool IPCHandlerLinux::Run() {
            sizeof(address.sun_path) - 1);
    if (bind(server_socket.get(), (struct sockaddr*)&address, sizeof(address)) <
        0) {
      LOG(ERROR) << "Failed to bind IPC socket to address: " << strerror(errno);
      PLOG(ERROR) << "Failed to bind IPC socket to address";
      return false;
    }

@@ -141,7 +141,7 @@ void IPCHandlerLinux::StartListeningOnThread() {

  int status = listen(socket_.get(), SOMAXCONN);
  if (status < 0) {
    LOG(ERROR) << "Failed to listen on domain socket: " << strerror(errno);
    PLOG(ERROR) << "Failed to listen on domain socket";
    origin_task_runner_->PostTask(
        FROM_HERE, base::Bind(&IPCHandlerLinux::ShutDownOnOriginThread, this));
    return;
@@ -158,7 +158,7 @@ void IPCHandlerLinux::StartListeningOnThread() {
  while (keep_running_.load()) {
    int client_socket = accept4(socket_.get(), nullptr, nullptr, SOCK_NONBLOCK);
    if (client_socket < 0) {
      LOG(ERROR) << "Failed to accept client connection: " << strerror(errno);
      PLOG(ERROR) << "Failed to accept client connection";
      continue;
    }