]>
git.saurik.com Git - apple/libc.git/blob - os/boot_mode_private.h
2 * Copyright (c) 2020 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_BOOT_MODE_H__
22 #define __OS_BOOT_MODE_H__
27 #include <os/availability.h>
31 #define OS_BOOT_MODE_FVUNLOCK "fvunlock"
32 #define OS_BOOT_MODE_KCGEN "kcgen"
33 #define OS_BOOT_MODE_DIAGNOSTICS "diagnostics"
34 #define OS_BOOT_MODE_MIGRATION "migration"
37 * @function os_boot_mode_query
39 * @abstract fetches the current boot mode if available
42 * This attempts to query the current boot mode.
44 * In general, please prefer the _LimitLoad[To|From]BootMode launchd plist key
45 * over direct use of this SPI.
48 * - this is not guaranteed to succeed when called from boot tasks (we may not
49 * have figured out our boot mode yet)
50 * - though the boot mode can in principle be an arbitrary string, this can
51 * currently only be used to query for the "fvunlock", "kcgen", "diagnostics",
52 * and "migration" boot modes
55 * true if the query succeeds, with boot_mode_out set to the boot mode string
56 * (or NULL if no particular boot mode). false if the boot mode is not known,
57 * in which case boot_mode_out is not modified.
59 API_AVAILABLE(macosx(10.16)) API_UNAVAILABLE(ios
, tvos
, watchos
, bridgeos
)
60 OS_EXPORT OS_WARN_RESULT
62 os_boot_mode_query(const char **boot_mode_out
);
66 #endif // __OS_BOOT_MODE_H__