]>
git.saurik.com Git - apple/libc.git/blob - os/variant_private.h
2 * Copyright (c) 2017 Apple Inc. All rights reserved.
4 * @APPLE_APACHE_LICENSE_HEADER_START@
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 * @APPLE_APACHE_LICENSE_HEADER_END@
21 #ifndef __OS_VARIANT_H__
22 #define __OS_VARIANT_H__
27 #include <os/availability.h>
32 * Provides a mechanism to determine the currently running OS variant.
34 * Any of these APIs may be overridden to its non-internal behavior on a
35 * device by creating on override file. On macOS, this file is placed
37 * /var/db/os_variant_override
38 * On embedded platforms, this file is placed at:
39 * /usr/share/misc/os_variant_override
41 * Individual internal behaviors can be selectively disabled (ie.
42 * individual os_variant_has_internal_*() predicates can be overriden to
43 * false) by writing the file with a comma- or newline-delimited list of
44 * names to disable. To disable all internal behaviors, empty the file.
46 * Each of these functions takes a constant string argument for the requesting
47 * subsystem. This should be a reverse-DNS string describing the subsystem
48 * performing the check. This may be used in the future for auditing and
49 * selective overriding of checks.
56 * @function os_variant_has_internal_content
58 * @abstract returns whether this system variant has internal content installed
62 * Returns true if this build has this property. False otherwise or upon error.
64 API_AVAILABLE(macosx(10.13), ios(11.0), tvos(11.0), watchos(4.0))
65 OS_EXPORT OS_WARN_RESULT
67 os_variant_has_internal_content(const char *subsystem
);
70 * @function os_variant_has_internal_diagnostics
72 * @abstract returns whether this system variant has internal diagnostics
73 * enabled ("diagnostics")
77 * Internal diagnostics include behaviors that emit extra diagnostic or
78 * debugging information when an error occurs.
80 * On macOS, this check will look for presence of AppleInternal content or the
81 * AppleInternalDiagnostics profile to be installed.
83 * On embedded platforms, this check will look for an internal install variant
84 * in a manner similar to the MobileGestalt check for InternalBuild.
87 * Returns true if this build has this property. False otherwise or upon error.
89 API_AVAILABLE(macosx(10.13), ios(11.0), tvos(11.0), watchos(4.0))
90 OS_EXPORT OS_WARN_RESULT
92 os_variant_has_internal_diagnostics(const char *subsystem
);
95 * @function os_variant_has_internal_ui
97 * @abstract returns whether this system variant has internal UI visible ("ui")
101 * Internal UI includes debug menus and internal settings.
103 * On macOS, this will check for the presence of AppleInternal content. On
104 * embedded platforms, this check will look for an internal install variant in
105 * a manor similar to the MobileGestalt check for InternalBuild.
108 * Returns true if this build has this property. False otherwise or upon error.
110 API_AVAILABLE(macosx(10.13), ios(11.0), tvos(11.0), watchos(4.0))
111 OS_EXPORT OS_WARN_RESULT
113 os_variant_has_internal_ui(const char *subsystem
);
116 * @function os_variant_allows_internal_security_policies
118 * @abstract returns whether this system variant allows internal security policies
123 * On macOS, this will check the CSR status for whether AppleInternal policies
126 * On embedded platforms, this will check for a build/device combination that
127 * allows for removal of codesigning and debugging restrictions. This usually
128 * returns whether the hardware is development fused and may return true on
129 * such hardware even if a customer build is installed.
131 * n.b. The result of this API should /not/ be used to automatically enable
132 * relaxed security policies, only to signal that other mechanisms to enable
133 * them are allowed, e.g. a "defaults write".
136 * Returns true if this build has this property. False otherwise or upon error.
138 API_AVAILABLE(macosx(10.13), ios(11.0), tvos(11.0), watchos(4.0))
139 OS_EXPORT OS_WARN_RESULT
141 os_variant_allows_internal_security_policies(const char *subsystem
);
145 #endif // __os_variant_H__