Suren Baghdasaryan | c29c2ba | 2019-10-22 17:18:42 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2019 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #pragma once |
| 18 | |
| 19 | #include <sys/types.h> |
| 20 | |
| 21 | #include <string> |
| 22 | |
| 23 | namespace android { |
| 24 | namespace init { |
| 25 | |
| 26 | static const int MIN_OOM_SCORE_ADJUST = -1000; |
| 27 | static const int MAX_OOM_SCORE_ADJUST = 1000; |
| 28 | // service with default score is unkillable |
| 29 | static const int DEFAULT_OOM_SCORE_ADJUST = MIN_OOM_SCORE_ADJUST; |
| 30 | |
| 31 | #if defined(__ANDROID__) |
| 32 | |
| 33 | void LmkdRegister(const std::string& name, uid_t uid, pid_t pid, int oom_score_adjust); |
| 34 | void LmkdUnregister(const std::string& name, pid_t pid); |
| 35 | |
| 36 | #else // defined(__ANDROID__) |
| 37 | |
| 38 | static inline void LmkdRegister(const std::string&, uid_t, pid_t, int) {} |
| 39 | static inline void LmkdUnregister(const std::string&, pid_t) {} |
| 40 | |
| 41 | #endif // defined(__ANDROID__) |
| 42 | |
| 43 | } // namespace init |
| 44 | } // namespace android |