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

Commit fcb47e59 authored by Hansong Zhang's avatar Hansong Zhang
Browse files

Change PID file format

Test: cert/run
Tag: #refactor
Bug: 189501475
Change-Id: I249aa66cb1cb21efa1f60028157339adc23f4b8c
parent d509ef90
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
#include "stack_manager.h"

#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
#include <chrono>
#include <future>
@@ -35,7 +36,8 @@ using ::bluetooth::os::WakelockManager;

namespace bluetooth {

constexpr char bluetooth_pid_file[] = "/var/run/bluetooth";
// Assume we are hci0 for now
constexpr char bluetooth_pid_file[] = "/var/run/bluetooth/bluetooth0.pid";

void StackManager::StartUp(ModuleList* modules, Thread* stack_thread) {
  management_thread_ = new Thread("management_thread", Thread::Priority::NORMAL);
@@ -59,7 +61,7 @@ void StackManager::StartUp(ModuleList* modules, Thread* stack_thread) {

  pid_fd_ = open(bluetooth_pid_file, O_WRONLY | O_CREAT, 0644);
  pid_t my_pid = getpid();
  write(pid_fd_, &my_pid, sizeof(pid_t));
  dprintf(pid_fd_, "%d\n", my_pid);

  LOG_INFO("init complete");
}