diff options
author | Christopher Wiley <wiley@google.com> | 2016-08-22 18:04:44 -0700 |
---|---|---|
committer | Christopher Wiley <wiley@google.com> | 2016-08-22 18:05:33 -0700 |
commit | b8157c6e5b77e3503757cedcc4e62f49309c106b (patch) | |
tree | de58bbd83b5162b0665dd9510effc168f5f6922b | |
parent | d7783d804c40b8b75b02ef1c86f87b399114d958 (diff) |
Remove hostapd pid manipulation
This is no longer needed now that we can clean up after unclean
shutdowns.
Bug: 31023120
Change-Id: I459d62d3f199c8acd35a139fa4f8ca60042d6bbf
Test: wificond unit and integration tests pass
-rw-r--r-- | libwifi_system/hostapd_manager.cpp | 35 | ||||
-rw-r--r-- | libwifi_system/include/wifi_system/hostapd_manager.h | 7 |
2 files changed, 0 insertions, 42 deletions
diff --git a/libwifi_system/hostapd_manager.cpp b/libwifi_system/hostapd_manager.cpp index 56951613a..b92c56bed 100644 --- a/libwifi_system/hostapd_manager.cpp +++ b/libwifi_system/hostapd_manager.cpp @@ -47,7 +47,6 @@ namespace { const int kDefaultApChannel = 6; const char kHostapdServiceName[] = "hostapd"; const char kHostapdConfigFilePath[] = "/data/misc/wifi/hostapd.conf"; -const char kHostapdPidFile[] = "/data/misc/wifi/hostapd.pid"; string GeneratePsk(const vector<uint8_t>& ssid, @@ -82,8 +81,6 @@ bool HostapdManager::StartHostapd() { LOG(WARNING) << "Wi-Fi entropy file was not created"; } - unlink(kHostapdPidFile); - if (property_set("ctl.start", kHostapdServiceName) != 0) { LOG(ERROR) << "Failed to start SoftAP"; return false; @@ -93,36 +90,6 @@ bool HostapdManager::StartHostapd() { return true; } -bool HostapdManager::IsHostapdRunning() { - pid_t hostapd_pid; - if (!GetHostapdPid(&hostapd_pid)) { - return false; - } - - if (kill(hostapd_pid, 0) != 0) { - LOG(DEBUG) << "hostapd has already died."; - return false; - } - - return true; -} - -bool HostapdManager::GetHostapdPid(pid_t* hostapd_pid) { - string pid_string; - if (!ReadFileToString(kHostapdPidFile, &pid_string)) { - LOG(DEBUG) << "Failed to read hostapd pid file."; - return false; - } - pid_t pid = 0; - if (!ParseInt(pid_string.c_str(), &pid) || pid <= 0) { - LOG(DEBUG) << "hostapd pid file contained bad pid: " << pid_string; - return false; - } - - *hostapd_pid = pid; - return true; -} - bool HostapdManager::StopHostapd() { LOG(DEBUG) << "Stopping the SoftAP service..."; @@ -131,8 +98,6 @@ bool HostapdManager::StopHostapd() { return false; } - unlink(kHostapdPidFile); - LOG(DEBUG) << "SoftAP stopped successfully"; return true; } diff --git a/libwifi_system/include/wifi_system/hostapd_manager.h b/libwifi_system/include/wifi_system/hostapd_manager.h index 9b52711e0..485267078 100644 --- a/libwifi_system/include/wifi_system/hostapd_manager.h +++ b/libwifi_system/include/wifi_system/hostapd_manager.h @@ -40,13 +40,6 @@ class HostapdManager { // Returns true on success. virtual bool StartHostapd(); - // Returns true if hostapd is currently running. - virtual bool IsHostapdRunning(); - - // Returns true if hostapd is running, false otherwise. - // When true is returned, will write hostapd's pid to |hostapd_pid|. - virtual bool GetHostapdPid(pid_t* hostapd_pid); - // Request that a running instance of hostapd be stopped. // Returns true on success. virtual bool StopHostapd(); |