Bug 1867190 - Add prefs for PHC probablities r=glandium
[gecko.git] / toolkit / profile / ProfileUnlockerAndroid.cpp
blob58836c7b8e63e308b893e81f8b312c412c14d4f5
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #include "ProfileUnlockerAndroid.h"
6 #include "nsPrintfCString.h"
7 #include <unistd.h>
9 namespace mozilla {
11 ProfileUnlockerAndroid::ProfileUnlockerAndroid(const pid_t aPid) : mPid(aPid) {}
13 ProfileUnlockerAndroid::~ProfileUnlockerAndroid() {}
15 NS_IMPL_ISUPPORTS(ProfileUnlockerAndroid, nsIProfileUnlocker)
17 NS_IMETHODIMP
18 ProfileUnlockerAndroid::Unlock(uint32_t aSeverity) {
19 if (aSeverity != FORCE_QUIT) {
20 return NS_ERROR_NOT_IMPLEMENTED;
23 NS_WARNING(nsPrintfCString("Process %d has the profile "
24 "lock, will try to kill it.",
25 mPid)
26 .get());
27 if (mPid == getpid()) {
28 NS_ERROR("Lock held by current process !?");
29 return NS_ERROR_FAILURE;
31 if (kill(mPid, SIGKILL) != 0) {
32 NS_WARNING("Could not kill process.");
34 return NS_OK;
37 } // namespace mozilla