blob: 5b51d528f3ec4911f24c33a21520c79e3a02cca2 [file] [log] [blame]
Suren Baghdasaryanc29c2ba2019-10-22 17:18:42 -07001/*
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
23namespace android {
24namespace init {
25
26static const int MIN_OOM_SCORE_ADJUST = -1000;
27static const int MAX_OOM_SCORE_ADJUST = 1000;
28// service with default score is unkillable
29static const int DEFAULT_OOM_SCORE_ADJUST = MIN_OOM_SCORE_ADJUST;
30
31#if defined(__ANDROID__)
32
33void LmkdRegister(const std::string& name, uid_t uid, pid_t pid, int oom_score_adjust);
34void LmkdUnregister(const std::string& name, pid_t pid);
35
36#else // defined(__ANDROID__)
37
38static inline void LmkdRegister(const std::string&, uid_t, pid_t, int) {}
39static inline void LmkdUnregister(const std::string&, pid_t) {}
40
41#endif // defined(__ANDROID__)
42
43} // namespace init
44} // namespace android