Tom Cherry | de6bd50 | 2018-02-13 16:50:08 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2018 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 | #ifndef _INIT_HOST_INIT_STUBS_H |
| 18 | #define _INIT_HOST_INIT_STUBS_H |
| 19 | |
| 20 | #include <stddef.h> |
| 21 | #include <sys/socket.h> |
| 22 | #include <sys/types.h> |
| 23 | |
| 24 | #include <string> |
| 25 | |
| 26 | // sys/system_properties.h |
| 27 | #define PROP_VALUE_MAX 92 |
| 28 | |
| 29 | // unistd.h |
| 30 | int setgroups(size_t __size, const gid_t* __list); |
| 31 | |
| 32 | // android-base/properties.h |
| 33 | namespace android { |
| 34 | namespace base { |
| 35 | |
| 36 | std::string GetProperty(const std::string& key, const std::string& default_value); |
| 37 | bool GetBoolProperty(const std::string& key, bool default_value); |
Tom Cherry | 1257812 | 2018-04-11 15:50:00 -0700 | [diff] [blame] | 38 | template <typename T> |
| 39 | T GetIntProperty(const std::string&, T default_value, T = std::numeric_limits<T>::min(), |
| 40 | T = std::numeric_limits<T>::max()) { |
| 41 | return default_value; |
| 42 | } |
Tom Cherry | de6bd50 | 2018-02-13 16:50:08 -0800 | [diff] [blame] | 43 | |
| 44 | } // namespace base |
| 45 | } // namespace android |
| 46 | |
| 47 | namespace android { |
| 48 | namespace init { |
| 49 | |
| 50 | // init.h |
| 51 | extern std::string default_console; |
| 52 | |
| 53 | // property_service.h |
| 54 | extern uint32_t (*property_set)(const std::string& name, const std::string& value); |
| 55 | uint32_t HandlePropertySet(const std::string& name, const std::string& value, |
Tom Cherry | 69d47aa | 2018-03-01 11:00:57 -0800 | [diff] [blame] | 56 | const std::string& source_context, const ucred& cr, std::string* error); |
Tom Cherry | de6bd50 | 2018-02-13 16:50:08 -0800 | [diff] [blame] | 57 | |
| 58 | // selinux.h |
Logan Chien | c50144e | 2018-05-03 14:33:52 +0800 | [diff] [blame] | 59 | bool SelinuxHasVendorInit(); |
Tom Cherry | de6bd50 | 2018-02-13 16:50:08 -0800 | [diff] [blame] | 60 | void SelabelInitialize(); |
| 61 | bool SelabelLookupFileContext(const std::string& key, int type, std::string* result); |
| 62 | |
| 63 | } // namespace init |
| 64 | } // namespace android |
| 65 | |
| 66 | #endif |