mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
Merge remote-tracking branch 'origin/master' into llvm12
Conflicts:
* src/clang.zig
* src/llvm.zig
- this file got moved to src/llvm/bindings.zig in master branch so I
had to put the new LLVM arch/os enum tags into it.
* lib/std/target.zig, src/stage1/target.cpp
- haiku had an inconsistency with its default target ABI, gnu vs
eabi. In this commit we make it gnu in both places to match the
latest changes by @hoanga.
* src/translate_c.zig
This commit is contained in:
commit
0b58b61799
2
.gitignore
vendored
2
.gitignore
vendored
@ -10,6 +10,8 @@
|
||||
# -andrewrk
|
||||
|
||||
zig-cache/
|
||||
/release/
|
||||
/debug/
|
||||
/build/
|
||||
/build-*/
|
||||
/docgen_tmp/
|
||||
|
||||
@ -25,8 +25,8 @@ project(zig C CXX)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
|
||||
|
||||
set(ZIG_VERSION_MAJOR 0)
|
||||
set(ZIG_VERSION_MINOR 7)
|
||||
set(ZIG_VERSION_PATCH 1)
|
||||
set(ZIG_VERSION_MINOR 8)
|
||||
set(ZIG_VERSION_PATCH 0)
|
||||
set(ZIG_VERSION "" CACHE STRING "Override Zig version string. Default is to find out with git.")
|
||||
|
||||
if("${ZIG_VERSION}" STREQUAL "")
|
||||
@ -34,18 +34,31 @@ if("${ZIG_VERSION}" STREQUAL "")
|
||||
find_program(GIT_EXE NAMES git)
|
||||
if(GIT_EXE)
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXE} -C ${CMAKE_SOURCE_DIR} name-rev HEAD --tags --name-only --no-undefined --always
|
||||
COMMAND ${GIT_EXE} -C ${CMAKE_SOURCE_DIR} describe --match *.*.* --tags
|
||||
RESULT_VARIABLE EXIT_STATUS
|
||||
OUTPUT_VARIABLE ZIG_GIT_REV
|
||||
OUTPUT_VARIABLE GIT_DESCRIBE
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
ERROR_QUIET)
|
||||
if(EXIT_STATUS EQUAL "0")
|
||||
if(ZIG_GIT_REV MATCHES "\\^0$")
|
||||
if(NOT("${ZIG_GIT_REV}" STREQUAL "${ZIG_VERSION}^0"))
|
||||
message("WARNING: Tag does not match configured Zig version")
|
||||
if(GIT_DESCRIBE MATCHES "^v?([0-9]+\\.[0-9]+\\.[0-9]+)$")
|
||||
# Tagged release version.
|
||||
set(GIT_TAG ${CMAKE_MATCH_1})
|
||||
if(NOT GIT_TAG VERSION_EQUAL ZIG_VERSION)
|
||||
message(SEND_ERROR "Zig version (${ZIG_VERSION}) does not match Git tag (${GIT_TAG}).")
|
||||
endif()
|
||||
elseif(GIT_DESCRIBE MATCHES "^v?([0-9]+\\.[0-9]+\\.[0-9]+)-([0-9]+)-g(.+)$")
|
||||
# Untagged pre-release. The Zig version is updated to include the number of commits
|
||||
# since the last tagged version and the commit hash. The version is formatted in
|
||||
# accordance with the https://semver.org specification.
|
||||
set(GIT_TAG ${CMAKE_MATCH_1})
|
||||
set(GIT_COMMITS_AFTER_TAG ${CMAKE_MATCH_2})
|
||||
set(GIT_COMMIT ${CMAKE_MATCH_3})
|
||||
if(NOT ZIG_VERSION VERSION_GREATER GIT_TAG)
|
||||
message(SEND_ERROR "Zig version (${ZIG_VERSION}) must be greater than tagged ancestor (${GIT_TAG}).")
|
||||
endif()
|
||||
set(ZIG_VERSION "${ZIG_VERSION}-dev.${GIT_COMMITS_AFTER_TAG}+${GIT_COMMIT}")
|
||||
else()
|
||||
set(ZIG_VERSION "${ZIG_VERSION}+${ZIG_GIT_REV}")
|
||||
message(WARNING "Failed to parse version from output of `git describe`.")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
@ -75,6 +88,8 @@ set(ZIG_TARGET_TRIPLE "native" CACHE STRING "arch-os-abi to output binaries for"
|
||||
set(ZIG_TARGET_MCPU "baseline" CACHE STRING "-mcpu parameter to output binaries for")
|
||||
set(ZIG_EXECUTABLE "" CACHE STRING "(when cross compiling) path to already-built zig binary")
|
||||
set(ZIG_PREFER_LLVM_CONFIG off CACHE BOOL "(when cross compiling) use llvm-config to find target llvm dependencies if needed")
|
||||
set(ZIG_SINGLE_THREADED off CACHE BOOL "limit the zig compiler to use only 1 thread")
|
||||
set(ZIG_OMIT_STAGE2 off CACHE BOOL "omit the stage2 backend from stage1")
|
||||
|
||||
find_package(llvm)
|
||||
find_package(clang)
|
||||
@ -319,7 +334,6 @@ set(ZIG_STAGE2_SOURCES
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/atomic/int.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/atomic/queue.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/atomic/stack.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/auto_reset_event.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/base64.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/buf_map.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/builtin.zig"
|
||||
@ -356,13 +370,14 @@ set(ZIG_STAGE2_SOURCES
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/heap.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/heap/arena_allocator.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/io.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/io/auto_indenting_stream.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/io/buffered_atomic_file.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/io/buffered_writer.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/io/change_detection_stream.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/io/counting_reader.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/io/counting_writer.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/io/find_byte_out_stream.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/io/find_byte_writer.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/io/fixed_buffer_stream.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/io/limited_reader.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/io/reader.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/io/seekable_stream.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/io/writer.zig"
|
||||
@ -392,7 +407,7 @@ set(ZIG_STAGE2_SOURCES
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/meta.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/meta/trailer_flags.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/meta/trait.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/mutex.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/multi_array_list.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/os.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/os/bits.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/os/bits/linux.zig"
|
||||
@ -408,11 +423,10 @@ set(ZIG_STAGE2_SOURCES
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/os/windows/bits.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/os/windows/ntstatus.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/os/windows/win32error.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/Progress.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/pdb.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/process.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/progress.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/rand.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/reset_event.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/sort.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/addXf3.zig"
|
||||
@ -476,7 +490,6 @@ set(ZIG_STAGE2_SOURCES
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/udivmodti4.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/udivti3.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/umodti3.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/spinlock.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/start.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/std.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/target.zig"
|
||||
@ -495,7 +508,11 @@ set(ZIG_STAGE2_SOURCES
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/target/systemz.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/target/wasm.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/target/x86.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/thread.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/Thread.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/Thread/AutoResetEvent.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/Thread/Mutex.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/Thread/ResetEvent.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/Thread/StaticResetEvent.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/time.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/unicode.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/zig.zig"
|
||||
@ -513,7 +530,9 @@ set(ZIG_STAGE2_SOURCES
|
||||
"${CMAKE_SOURCE_DIR}/src/Module.zig"
|
||||
"${CMAKE_SOURCE_DIR}/src/Package.zig"
|
||||
"${CMAKE_SOURCE_DIR}/src/RangeSet.zig"
|
||||
"${CMAKE_SOURCE_DIR}/src/ThreadPool.zig"
|
||||
"${CMAKE_SOURCE_DIR}/src/TypedValue.zig"
|
||||
"${CMAKE_SOURCE_DIR}/src/WaitGroup.zig"
|
||||
"${CMAKE_SOURCE_DIR}/src/astgen.zig"
|
||||
"${CMAKE_SOURCE_DIR}/src/clang.zig"
|
||||
"${CMAKE_SOURCE_DIR}/src/clang_options.zig"
|
||||
@ -523,6 +542,7 @@ set(ZIG_STAGE2_SOURCES
|
||||
"${CMAKE_SOURCE_DIR}/src/codegen/arm.zig"
|
||||
"${CMAKE_SOURCE_DIR}/src/codegen/c.zig"
|
||||
"${CMAKE_SOURCE_DIR}/src/codegen/llvm.zig"
|
||||
"${CMAKE_SOURCE_DIR}/src/codegen/llvm/bindings.zig"
|
||||
"${CMAKE_SOURCE_DIR}/src/codegen/riscv64.zig"
|
||||
"${CMAKE_SOURCE_DIR}/src/codegen/spu-mk2.zig"
|
||||
"${CMAKE_SOURCE_DIR}/src/codegen/wasm.zig"
|
||||
@ -532,6 +552,7 @@ set(ZIG_STAGE2_SOURCES
|
||||
"${CMAKE_SOURCE_DIR}/src/ir.zig"
|
||||
"${CMAKE_SOURCE_DIR}/src/libc_installation.zig"
|
||||
"${CMAKE_SOURCE_DIR}/src/libcxx.zig"
|
||||
"${CMAKE_SOURCE_DIR}/src/libtsan.zig"
|
||||
"${CMAKE_SOURCE_DIR}/src/libunwind.zig"
|
||||
"${CMAKE_SOURCE_DIR}/src/link.zig"
|
||||
"${CMAKE_SOURCE_DIR}/src/link/C.zig"
|
||||
@ -540,10 +561,9 @@ set(ZIG_STAGE2_SOURCES
|
||||
"${CMAKE_SOURCE_DIR}/src/link/MachO.zig"
|
||||
"${CMAKE_SOURCE_DIR}/src/link/MachO/Trie.zig"
|
||||
"${CMAKE_SOURCE_DIR}/src/link/Wasm.zig"
|
||||
"${CMAKE_SOURCE_DIR}/src/link/cbe.h"
|
||||
"${CMAKE_SOURCE_DIR}/src/link/C/zig.h"
|
||||
"${CMAKE_SOURCE_DIR}/src/link/msdos-stub.bin"
|
||||
"${CMAKE_SOURCE_DIR}/src/liveness.zig"
|
||||
"${CMAKE_SOURCE_DIR}/src/llvm.zig"
|
||||
"${CMAKE_SOURCE_DIR}/src/main.zig"
|
||||
"${CMAKE_SOURCE_DIR}/src/mingw.zig"
|
||||
"${CMAKE_SOURCE_DIR}/src/musl.zig"
|
||||
@ -553,6 +573,7 @@ set(ZIG_STAGE2_SOURCES
|
||||
"${CMAKE_SOURCE_DIR}/src/target.zig"
|
||||
"${CMAKE_SOURCE_DIR}/src/tracy.zig"
|
||||
"${CMAKE_SOURCE_DIR}/src/translate_c.zig"
|
||||
"${CMAKE_SOURCE_DIR}/src/translate_c/ast.zig"
|
||||
"${CMAKE_SOURCE_DIR}/src/type.zig"
|
||||
"${CMAKE_SOURCE_DIR}/src/value.zig"
|
||||
"${CMAKE_SOURCE_DIR}/src/windows_sdk.zig"
|
||||
@ -568,6 +589,12 @@ if(MSVC)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(ZIG_OMIT_STAGE2)
|
||||
set(ZIG_OMIT_STAGE2_BOOL "true")
|
||||
else()
|
||||
set(ZIG_OMIT_STAGE2_BOOL "false")
|
||||
endif()
|
||||
|
||||
configure_file (
|
||||
"${CMAKE_SOURCE_DIR}/src/stage1/config.h.in"
|
||||
"${ZIG_CONFIG_H_OUT}"
|
||||
@ -713,6 +740,11 @@ if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
|
||||
else()
|
||||
set(ZIG1_RELEASE_ARG -OReleaseFast --strip)
|
||||
endif()
|
||||
if(ZIG_SINGLE_THREADED)
|
||||
set(ZIG1_SINGLE_THREADED_ARG "--single-threaded")
|
||||
else()
|
||||
set(ZIG1_SINGLE_THREADED_ARG "")
|
||||
endif()
|
||||
|
||||
set(BUILD_ZIG1_ARGS
|
||||
"src/stage1.zig"
|
||||
@ -722,6 +754,7 @@ set(BUILD_ZIG1_ARGS
|
||||
--override-lib-dir "${CMAKE_SOURCE_DIR}/lib"
|
||||
"-femit-bin=${ZIG1_OBJECT}"
|
||||
"${ZIG1_RELEASE_ARG}"
|
||||
"${ZIG1_SINGLE_THREADED_ARG}"
|
||||
-lc
|
||||
--pkg-begin build_options "${ZIG_CONFIG_ZIG_OUT}"
|
||||
--pkg-end
|
||||
|
||||
@ -5,7 +5,7 @@ A general-purpose programming language and toolchain for maintaining
|
||||
|
||||
## Resources
|
||||
|
||||
* [Introduction](https://ziglang.org/#Introduction)
|
||||
* [Introduction](https://ziglang.org/learn/#introduction)
|
||||
* [Download & Documentation](https://ziglang.org/download)
|
||||
* [Chapter 0 - Getting Started | ZigLearn.org](https://ziglearn.org/)
|
||||
* [Community](https://github.com/ziglang/zig/wiki/Community)
|
||||
|
||||
285
build.zig
285
build.zig
@ -11,7 +11,7 @@ const fs = std.fs;
|
||||
const InstallDirectoryOptions = std.build.InstallDirectoryOptions;
|
||||
const assert = std.debug.assert;
|
||||
|
||||
const zig_version = std.builtin.Version{ .major = 0, .minor = 7, .patch = 1 };
|
||||
const zig_version = std.builtin.Version{ .major = 0, .minor = 8, .patch = 0 };
|
||||
|
||||
pub fn build(b: *Builder) !void {
|
||||
b.setPreferredReleaseMode(.ReleaseFast);
|
||||
@ -77,10 +77,12 @@ pub fn build(b: *Builder) !void {
|
||||
|
||||
const tracy = b.option([]const u8, "tracy", "Enable Tracy integration. Supply path to Tracy source");
|
||||
const link_libc = b.option(bool, "force-link-libc", "Force self-hosted compiler to link libc") orelse enable_llvm;
|
||||
const strip = b.option(bool, "strip", "Omit debug information") orelse false;
|
||||
|
||||
const main_file = if (is_stage1) "src/stage1.zig" else "src/main.zig";
|
||||
|
||||
var exe = b.addExecutable("zig", main_file);
|
||||
exe.strip = strip;
|
||||
exe.install();
|
||||
exe.setBuildMode(mode);
|
||||
exe.setTarget(target);
|
||||
@ -91,6 +93,7 @@ pub fn build(b: *Builder) !void {
|
||||
exe.addBuildOption(bool, "have_llvm", enable_llvm);
|
||||
if (enable_llvm) {
|
||||
const cmake_cfg = if (static_llvm) null else findAndParseConfigH(b, config_h_path_option);
|
||||
|
||||
if (is_stage1) {
|
||||
exe.addIncludeDir("src");
|
||||
exe.addIncludeDir("deps/SoftFloat-3e/source/include");
|
||||
@ -109,28 +112,8 @@ pub fn build(b: *Builder) !void {
|
||||
softfloat.addCSourceFiles(&softfloat_sources, &[_][]const u8{ "-std=c99", "-O3" });
|
||||
exe.linkLibrary(softfloat);
|
||||
|
||||
const exe_cflags = [_][]const u8{
|
||||
"-std=c++14",
|
||||
"-D__STDC_CONSTANT_MACROS",
|
||||
"-D__STDC_FORMAT_MACROS",
|
||||
"-D__STDC_LIMIT_MACROS",
|
||||
"-D_GNU_SOURCE",
|
||||
"-fvisibility-inlines-hidden",
|
||||
"-fno-exceptions",
|
||||
"-fno-rtti",
|
||||
"-Werror=type-limits",
|
||||
"-Wno-missing-braces",
|
||||
"-Wno-comment",
|
||||
};
|
||||
exe.addCSourceFiles(&stage1_sources, &exe_cflags);
|
||||
exe.addCSourceFiles(&optimized_c_sources, &[_][]const u8{ "-std=c99", "-O3" });
|
||||
if (cmake_cfg == null) {
|
||||
// We need this because otherwise zig_clang_cc1_main.cpp ends up pulling
|
||||
// in a dependency on llvm::cfg::Update<llvm::BasicBlock*>::dump() which is
|
||||
// unavailable when LLVM is compiled in Release mode.
|
||||
const zig_cpp_cflags = exe_cflags ++ [_][]const u8{"-DNDEBUG=1"};
|
||||
exe.addCSourceFiles(&zig_cpp_sources, &zig_cpp_cflags);
|
||||
}
|
||||
}
|
||||
if (cmake_cfg) |cfg| {
|
||||
// Inside this code path, we have to coordinate with system packaged LLVM, Clang, and LLD.
|
||||
@ -139,79 +122,13 @@ pub fn build(b: *Builder) !void {
|
||||
if (cfg.cmake_prefix_path.len > 0) {
|
||||
b.addSearchPrefix(cfg.cmake_prefix_path);
|
||||
}
|
||||
exe.addObjectFile(fs.path.join(b.allocator, &[_][]const u8{
|
||||
cfg.cmake_binary_dir,
|
||||
"zigcpp",
|
||||
b.fmt("{s}{s}{s}", .{ exe.target.libPrefix(), "zigcpp", exe.target.staticLibSuffix() }),
|
||||
}) catch unreachable);
|
||||
assert(cfg.lld_include_dir.len != 0);
|
||||
exe.addIncludeDir(cfg.lld_include_dir);
|
||||
addCMakeLibraryList(exe, cfg.clang_libraries);
|
||||
addCMakeLibraryList(exe, cfg.lld_libraries);
|
||||
addCMakeLibraryList(exe, cfg.llvm_libraries);
|
||||
|
||||
const need_cpp_includes = tracy != null;
|
||||
|
||||
// System -lc++ must be used because in this code path we are attempting to link
|
||||
// against system-provided LLVM, Clang, LLD.
|
||||
if (exe.target.getOsTag() == .linux) {
|
||||
// First we try to static link against gcc libstdc++. If that doesn't work,
|
||||
// we fall back to -lc++ and cross our fingers.
|
||||
addCxxKnownPath(b, cfg, exe, "libstdc++.a", "", need_cpp_includes) catch |err| switch (err) {
|
||||
error.RequiredLibraryNotFound => {
|
||||
exe.linkSystemLibrary("c++");
|
||||
},
|
||||
else => |e| return e,
|
||||
};
|
||||
|
||||
exe.linkSystemLibrary("pthread");
|
||||
} else if (exe.target.isFreeBSD()) {
|
||||
try addCxxKnownPath(b, cfg, exe, "libc++.a", null, need_cpp_includes);
|
||||
exe.linkSystemLibrary("pthread");
|
||||
} else if (exe.target.getOsTag() == .openbsd) {
|
||||
try addCxxKnownPath(b, cfg, exe, "libc++.a", null, need_cpp_includes);
|
||||
try addCxxKnownPath(b, cfg, exe, "libc++abi.a", null, need_cpp_includes);
|
||||
} else if (exe.target.isDarwin()) {
|
||||
if (addCxxKnownPath(b, cfg, exe, "libgcc_eh.a", "", need_cpp_includes)) {
|
||||
// Compiler is GCC.
|
||||
try addCxxKnownPath(b, cfg, exe, "libstdc++.a", null, need_cpp_includes);
|
||||
exe.linkSystemLibrary("pthread");
|
||||
// TODO LLD cannot perform this link.
|
||||
// Set ZIG_SYSTEM_LINKER_HACK env var to use system linker ld instead.
|
||||
// See https://github.com/ziglang/zig/issues/1535
|
||||
} else |err| switch (err) {
|
||||
error.RequiredLibraryNotFound => {
|
||||
// System compiler, not gcc.
|
||||
exe.linkSystemLibrary("c++");
|
||||
},
|
||||
else => |e| return e,
|
||||
}
|
||||
}
|
||||
|
||||
if (cfg.dia_guids_lib.len != 0) {
|
||||
exe.addObjectFile(cfg.dia_guids_lib);
|
||||
}
|
||||
try addCmakeCfgOptionsToExe(b, cfg, tracy, exe);
|
||||
try addCmakeCfgOptionsToExe(b, cfg, tracy, test_stage2);
|
||||
} else {
|
||||
// Here we are -Denable-llvm but no cmake integration.
|
||||
for (clang_libs) |lib_name| {
|
||||
exe.linkSystemLibrary(lib_name);
|
||||
}
|
||||
|
||||
for (lld_libs) |lib_name| {
|
||||
exe.linkSystemLibrary(lib_name);
|
||||
}
|
||||
|
||||
for (llvm_libs) |lib_name| {
|
||||
exe.linkSystemLibrary(lib_name);
|
||||
}
|
||||
|
||||
// This means we rely on clang-or-zig-built LLVM, Clang, LLD libraries.
|
||||
exe.linkSystemLibrary("c++");
|
||||
|
||||
if (target.getOs().tag == .windows) {
|
||||
exe.linkSystemLibrary("version");
|
||||
exe.linkSystemLibrary("uuid");
|
||||
}
|
||||
try addStaticLlvmOptionsToExe(exe);
|
||||
try addStaticLlvmOptionsToExe(test_stage2);
|
||||
}
|
||||
}
|
||||
if (link_libc) {
|
||||
@ -219,44 +136,55 @@ pub fn build(b: *Builder) !void {
|
||||
test_stage2.linkLibC();
|
||||
}
|
||||
|
||||
const log_scopes = b.option([]const []const u8, "log", "Which log scopes to enable") orelse &[0][]const u8{};
|
||||
const zir_dumps = b.option([]const []const u8, "dump-zir", "Which functions to dump ZIR for before codegen") orelse &[0][]const u8{};
|
||||
const enable_logging = b.option(bool, "log", "Whether to enable logging") orelse false;
|
||||
|
||||
const opt_version_string = b.option([]const u8, "version-string", "Override Zig version string. Default is to find out with git.");
|
||||
const version = if (opt_version_string) |version| version else v: {
|
||||
const version_string = b.fmt("{}.{}.{}", .{ zig_version.major, zig_version.minor, zig_version.patch });
|
||||
const version_string = b.fmt("{d}.{d}.{d}", .{ zig_version.major, zig_version.minor, zig_version.patch });
|
||||
|
||||
var code: u8 = undefined;
|
||||
const git_sha_untrimmed = b.execAllowFail(&[_][]const u8{
|
||||
"git", "-C", b.build_root, "name-rev", "HEAD",
|
||||
"--tags", "--name-only", "--no-undefined", "--always",
|
||||
const git_describe_untrimmed = b.execAllowFail(&[_][]const u8{
|
||||
"git", "-C", b.build_root, "describe", "--match", "*.*.*", "--tags",
|
||||
}, &code, .Ignore) catch {
|
||||
break :v version_string;
|
||||
};
|
||||
const git_sha_trimmed = mem.trim(u8, git_sha_untrimmed, " \n\r");
|
||||
// Detect dirty changes.
|
||||
const diff_untrimmed = b.execAllowFail(&[_][]const u8{
|
||||
"git", "-C", b.build_root, "diff", "HEAD",
|
||||
}, &code, .Ignore) catch |err| {
|
||||
std.debug.print("Error executing git diff: {}", .{err});
|
||||
std.process.exit(1);
|
||||
};
|
||||
const trimmed_diff = mem.trim(u8, diff_untrimmed, " \n\r");
|
||||
const dirty_suffix = if (trimmed_diff.len == 0) "" else s: {
|
||||
const dirty_hash = std.hash.Wyhash.hash(0, trimmed_diff);
|
||||
break :s b.fmt("dirty{x}", .{@truncate(u32, dirty_hash)});
|
||||
};
|
||||
const git_describe = mem.trim(u8, git_describe_untrimmed, " \n\r");
|
||||
|
||||
// This will look like e.g. "0.7.0^0" for a tag commit.
|
||||
if (mem.endsWith(u8, git_sha_trimmed, "^0")) {
|
||||
const git_ver_string = git_sha_trimmed[0 .. git_sha_trimmed.len - 2];
|
||||
if (!mem.eql(u8, git_ver_string, version_string)) {
|
||||
std.debug.print("Expected git tag '{}', found '{}'\n", .{ version_string, git_ver_string });
|
||||
std.process.exit(1);
|
||||
}
|
||||
break :v b.fmt("{}{}", .{ version_string, dirty_suffix });
|
||||
} else {
|
||||
break :v b.fmt("{}+{}{}", .{ version_string, git_sha_trimmed, dirty_suffix });
|
||||
switch (mem.count(u8, git_describe, "-")) {
|
||||
0 => {
|
||||
// Tagged release version (e.g. 0.7.0).
|
||||
if (!mem.eql(u8, git_describe, version_string)) {
|
||||
std.debug.print("Zig version '{s}' does not match Git tag '{s}'\n", .{ version_string, git_describe });
|
||||
std.process.exit(1);
|
||||
}
|
||||
break :v version_string;
|
||||
},
|
||||
2 => {
|
||||
// Untagged development build (e.g. 0.7.0-684-gbbe2cca1a).
|
||||
var it = mem.split(git_describe, "-");
|
||||
const tagged_ancestor = it.next() orelse unreachable;
|
||||
const commit_height = it.next() orelse unreachable;
|
||||
const commit_id = it.next() orelse unreachable;
|
||||
|
||||
const ancestor_ver = try std.builtin.Version.parse(tagged_ancestor);
|
||||
if (zig_version.order(ancestor_ver) != .gt) {
|
||||
std.debug.print("Zig version '{}' must be greater than tagged ancestor '{}'\n", .{ zig_version, ancestor_ver });
|
||||
std.process.exit(1);
|
||||
}
|
||||
|
||||
// Check that the commit hash is prefixed with a 'g' (a Git convention).
|
||||
if (commit_id.len < 1 or commit_id[0] != 'g') {
|
||||
std.debug.print("Unexpected `git describe` output: {s}\n", .{git_describe});
|
||||
break :v version_string;
|
||||
}
|
||||
|
||||
// The version is reformatted in accordance with the https://semver.org specification.
|
||||
break :v b.fmt("{s}-dev.{s}+{s}", .{ version_string, commit_height, commit_id[1..] });
|
||||
},
|
||||
else => {
|
||||
std.debug.print("Unexpected `git describe` output: {s}\n", .{git_describe});
|
||||
break :v version_string;
|
||||
},
|
||||
}
|
||||
};
|
||||
exe.addBuildOption([:0]const u8, "version", try b.allocator.dupeZ(u8, version));
|
||||
@ -264,10 +192,10 @@ pub fn build(b: *Builder) !void {
|
||||
const semver = try std.SemanticVersion.parse(version);
|
||||
exe.addBuildOption(std.SemanticVersion, "semver", semver);
|
||||
|
||||
exe.addBuildOption([]const []const u8, "log_scopes", log_scopes);
|
||||
exe.addBuildOption([]const []const u8, "zir_dumps", zir_dumps);
|
||||
exe.addBuildOption(bool, "enable_logging", enable_logging);
|
||||
exe.addBuildOption(bool, "enable_tracy", tracy != null);
|
||||
exe.addBuildOption(bool, "is_stage1", is_stage1);
|
||||
exe.addBuildOption(bool, "omit_stage2", false);
|
||||
if (tracy) |tracy_path| {
|
||||
const client_cpp = fs.path.join(
|
||||
b.allocator,
|
||||
@ -290,6 +218,7 @@ pub fn build(b: *Builder) !void {
|
||||
|
||||
test_stage2.addBuildOption(bool, "skip_non_native", skip_non_native);
|
||||
test_stage2.addBuildOption(bool, "is_stage1", is_stage1);
|
||||
test_stage2.addBuildOption(bool, "omit_stage2", false);
|
||||
test_stage2.addBuildOption(bool, "have_llvm", enable_llvm);
|
||||
test_stage2.addBuildOption(bool, "enable_qemu", is_qemu_enabled);
|
||||
test_stage2.addBuildOption(bool, "enable_wine", is_wine_enabled);
|
||||
@ -347,6 +276,112 @@ pub fn build(b: *Builder) !void {
|
||||
test_step.dependOn(docs_step);
|
||||
}
|
||||
|
||||
const exe_cflags = [_][]const u8{
|
||||
"-std=c++14",
|
||||
"-D__STDC_CONSTANT_MACROS",
|
||||
"-D__STDC_FORMAT_MACROS",
|
||||
"-D__STDC_LIMIT_MACROS",
|
||||
"-D_GNU_SOURCE",
|
||||
"-fvisibility-inlines-hidden",
|
||||
"-fno-exceptions",
|
||||
"-fno-rtti",
|
||||
"-Werror=type-limits",
|
||||
"-Wno-missing-braces",
|
||||
"-Wno-comment",
|
||||
};
|
||||
|
||||
fn addCmakeCfgOptionsToExe(
|
||||
b: *Builder,
|
||||
cfg: CMakeConfig,
|
||||
tracy: ?[]const u8,
|
||||
exe: *std.build.LibExeObjStep,
|
||||
) !void {
|
||||
exe.addObjectFile(fs.path.join(b.allocator, &[_][]const u8{
|
||||
cfg.cmake_binary_dir,
|
||||
"zigcpp",
|
||||
b.fmt("{s}{s}{s}", .{ exe.target.libPrefix(), "zigcpp", exe.target.staticLibSuffix() }),
|
||||
}) catch unreachable);
|
||||
assert(cfg.lld_include_dir.len != 0);
|
||||
exe.addIncludeDir(cfg.lld_include_dir);
|
||||
addCMakeLibraryList(exe, cfg.clang_libraries);
|
||||
addCMakeLibraryList(exe, cfg.lld_libraries);
|
||||
addCMakeLibraryList(exe, cfg.llvm_libraries);
|
||||
|
||||
const need_cpp_includes = tracy != null;
|
||||
|
||||
// System -lc++ must be used because in this code path we are attempting to link
|
||||
// against system-provided LLVM, Clang, LLD.
|
||||
if (exe.target.getOsTag() == .linux) {
|
||||
// First we try to static link against gcc libstdc++. If that doesn't work,
|
||||
// we fall back to -lc++ and cross our fingers.
|
||||
addCxxKnownPath(b, cfg, exe, "libstdc++.a", "", need_cpp_includes) catch |err| switch (err) {
|
||||
error.RequiredLibraryNotFound => {
|
||||
exe.linkSystemLibrary("c++");
|
||||
},
|
||||
else => |e| return e,
|
||||
};
|
||||
|
||||
exe.linkSystemLibrary("pthread");
|
||||
} else if (exe.target.isFreeBSD()) {
|
||||
try addCxxKnownPath(b, cfg, exe, "libc++.a", null, need_cpp_includes);
|
||||
exe.linkSystemLibrary("pthread");
|
||||
} else if (exe.target.getOsTag() == .openbsd) {
|
||||
try addCxxKnownPath(b, cfg, exe, "libc++.a", null, need_cpp_includes);
|
||||
try addCxxKnownPath(b, cfg, exe, "libc++abi.a", null, need_cpp_includes);
|
||||
} else if (exe.target.isDarwin()) {
|
||||
if (addCxxKnownPath(b, cfg, exe, "libgcc_eh.a", "", need_cpp_includes)) {
|
||||
// Compiler is GCC.
|
||||
try addCxxKnownPath(b, cfg, exe, "libstdc++.a", null, need_cpp_includes);
|
||||
exe.linkSystemLibrary("pthread");
|
||||
// TODO LLD cannot perform this link.
|
||||
// Set ZIG_SYSTEM_LINKER_HACK env var to use system linker ld instead.
|
||||
// See https://github.com/ziglang/zig/issues/1535
|
||||
} else |err| switch (err) {
|
||||
error.RequiredLibraryNotFound => {
|
||||
// System compiler, not gcc.
|
||||
exe.linkSystemLibrary("c++");
|
||||
},
|
||||
else => |e| return e,
|
||||
}
|
||||
}
|
||||
|
||||
if (cfg.dia_guids_lib.len != 0) {
|
||||
exe.addObjectFile(cfg.dia_guids_lib);
|
||||
}
|
||||
}
|
||||
|
||||
fn addStaticLlvmOptionsToExe(
|
||||
exe: *std.build.LibExeObjStep,
|
||||
) !void {
|
||||
// Adds the Zig C++ sources which both stage1 and stage2 need.
|
||||
//
|
||||
// We need this because otherwise zig_clang_cc1_main.cpp ends up pulling
|
||||
// in a dependency on llvm::cfg::Update<llvm::BasicBlock*>::dump() which is
|
||||
// unavailable when LLVM is compiled in Release mode.
|
||||
const zig_cpp_cflags = exe_cflags ++ [_][]const u8{"-DNDEBUG=1"};
|
||||
exe.addCSourceFiles(&zig_cpp_sources, &zig_cpp_cflags);
|
||||
|
||||
for (clang_libs) |lib_name| {
|
||||
exe.linkSystemLibrary(lib_name);
|
||||
}
|
||||
|
||||
for (lld_libs) |lib_name| {
|
||||
exe.linkSystemLibrary(lib_name);
|
||||
}
|
||||
|
||||
for (llvm_libs) |lib_name| {
|
||||
exe.linkSystemLibrary(lib_name);
|
||||
}
|
||||
|
||||
// This means we rely on clang-or-zig-built LLVM, Clang, LLD libraries.
|
||||
exe.linkSystemLibrary("c++");
|
||||
|
||||
if (exe.target.getOs().tag == .windows) {
|
||||
exe.linkSystemLibrary("version");
|
||||
exe.linkSystemLibrary("uuid");
|
||||
}
|
||||
}
|
||||
|
||||
fn addCxxKnownPath(
|
||||
b: *Builder,
|
||||
ctx: CMakeConfig,
|
||||
@ -357,14 +392,14 @@ fn addCxxKnownPath(
|
||||
) !void {
|
||||
const path_padded = try b.exec(&[_][]const u8{
|
||||
ctx.cxx_compiler,
|
||||
b.fmt("-print-file-name={}", .{objname}),
|
||||
b.fmt("-print-file-name={s}", .{objname}),
|
||||
});
|
||||
const path_unpadded = mem.tokenize(path_padded, "\r\n").next().?;
|
||||
if (mem.eql(u8, path_unpadded, objname)) {
|
||||
if (errtxt) |msg| {
|
||||
warn("{}", .{msg});
|
||||
warn("{s}", .{msg});
|
||||
} else {
|
||||
warn("Unable to determine path to {}\n", .{objname});
|
||||
warn("Unable to determine path to {s}\n", .{objname});
|
||||
}
|
||||
return error.RequiredLibraryNotFound;
|
||||
}
|
||||
|
||||
@ -3,76 +3,104 @@
|
||||
set -x
|
||||
set -e
|
||||
|
||||
# This parameters we wait at most 2mins, it should be enough to sort out any
|
||||
# transient error.
|
||||
CMD_MAX_RETRY=12
|
||||
CMD_WAIT_TIME=10s
|
||||
sudo apt-get update -q
|
||||
sudo apt-get install -y cmake s3cmd tidy
|
||||
|
||||
# Execute the given command and, in case of failure, try to execute it again
|
||||
# after sleeping for CMD_WAIT_TIME.
|
||||
# We give up after retrying CMD_MAX_RETRY times.
|
||||
retry() {
|
||||
for i in $(seq 1 "$CMD_MAX_RETRY"); do
|
||||
eval "$@" && return
|
||||
echo "command \"$@\" failed, retrying..."
|
||||
sleep ${CMD_WAIT_TIME}
|
||||
done
|
||||
ZIGDIR="$(pwd)"
|
||||
ARCH="$(uname -m)"
|
||||
TARGET="$ARCH-linux-musl"
|
||||
CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.8.0-dev.859+f1ef0a80f"
|
||||
PREFIX="$HOME/$CACHE_BASENAME"
|
||||
MCPU="baseline"
|
||||
JOBS="-j$(nproc)"
|
||||
|
||||
echo "command \"$@\" failed, giving up..."
|
||||
exit 1
|
||||
}
|
||||
rm -rf $PREFIX
|
||||
cd $HOME
|
||||
|
||||
BUILDDIR="$(pwd)"
|
||||
|
||||
sudo sh -c 'echo "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-11 main" >> /etc/apt/sources.list'
|
||||
retry 'wget -O - http://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -'
|
||||
retry sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
|
||||
|
||||
sudo apt-get remove -y llvm-*
|
||||
sudo rm -rf /usr/local/*
|
||||
|
||||
retry sudo apt-get update -q
|
||||
retry sudo apt-get install -y \
|
||||
libxml2-dev libclang-11-dev llvm-11 llvm-11-dev liblld-11-dev cmake s3cmd \
|
||||
gcc-7 g++-7 ninja-build tidy \
|
||||
wget -nv "https://ziglang.org/deps/$CACHE_BASENAME.tar.xz"
|
||||
tar xf "$CACHE_BASENAME.tar.xz"
|
||||
|
||||
QEMUBASE="qemu-linux-x86_64-5.2.0"
|
||||
wget -nv https://ziglang.org/deps/$QEMUBASE.tar.xz
|
||||
tar xf $QEMUBASE.tar.xz
|
||||
PATH=$PWD/$QEMUBASE/bin:$PATH
|
||||
wget -nv "https://ziglang.org/deps/$QEMUBASE.tar.xz"
|
||||
tar xf "$QEMUBASE.tar.xz"
|
||||
export PATH="$(pwd)/$QEMUBASE/bin:$PATH"
|
||||
|
||||
WASMTIME="wasmtime-v0.20.0-x86_64-linux"
|
||||
wget -nv https://github.com/bytecodealliance/wasmtime/releases/download/v0.20.0/$WASMTIME.tar.xz
|
||||
tar xf $WASMTIME.tar.xz
|
||||
PATH=$PWD/$WASMTIME:$PATH
|
||||
wget -nv "https://github.com/bytecodealliance/wasmtime/releases/download/v0.20.0/$WASMTIME.tar.xz"
|
||||
tar xf "$WASMTIME.tar.xz"
|
||||
export PATH="$(pwd)/$WASMTIME:$PATH"
|
||||
|
||||
ZIG="$PREFIX/bin/zig"
|
||||
export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
|
||||
export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
|
||||
|
||||
cd $ZIGDIR
|
||||
|
||||
# Make the `zig version` number consistent.
|
||||
# This will affect the cmake command below.
|
||||
git config core.abbrev 9
|
||||
git fetch --unshallow || true
|
||||
git fetch --tags
|
||||
|
||||
export CC=gcc-7
|
||||
export CXX=g++-7
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -GNinja
|
||||
ninja install
|
||||
./zig build test -Denable-qemu -Denable-wasmtime
|
||||
cmake .. \
|
||||
-DCMAKE_INSTALL_PREFIX="$(pwd)/release" \
|
||||
-DCMAKE_PREFIX_PATH="$PREFIX" \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DZIG_TARGET_TRIPLE="$TARGET" \
|
||||
-DZIG_TARGET_MCPU="$MCPU" \
|
||||
-DZIG_STATIC=ON
|
||||
|
||||
# look for HTML errors
|
||||
# Now cmake will use zig as the C/C++ compiler. We reset the environment variables
|
||||
# so that installation and testing do not get affected by them.
|
||||
unset CC
|
||||
unset CXX
|
||||
|
||||
make $JOBS install
|
||||
|
||||
# Here we rebuild zig but this time using the Zig binary we just now produced to
|
||||
# build zig1.o rather than relying on the one built with stage0. See
|
||||
# https://github.com/ziglang/zig/issues/6830 for more details.
|
||||
cmake .. -DZIG_EXECUTABLE="$(pwd)/release/bin/zig"
|
||||
make $JOBS install
|
||||
|
||||
release/bin/zig build test -Denable-qemu -Denable-wasmtime
|
||||
|
||||
# Look for HTML errors.
|
||||
tidy -qe ../zig-cache/langref.html
|
||||
|
||||
VERSION="$(./zig version)"
|
||||
|
||||
if [ "${BUILD_REASON}" != "PullRequest" ]; then
|
||||
ARTIFACTSDIR="$BUILDDIR/artifacts"
|
||||
mkdir "$ARTIFACTSDIR"
|
||||
docker run -i --mount type=bind,source="$ARTIFACTSDIR",target=/z ziglang/static-base:llvm11-x86_64-1 -j2 $BUILD_SOURCEVERSION
|
||||
TARBALL="$(ls $ARTIFACTSDIR)"
|
||||
mv "$DOWNLOADSECUREFILE_SECUREFILEPATH" "$HOME/.s3cfg"
|
||||
s3cmd put -P --add-header="cache-control: public, max-age=31536000, immutable" "$ARTIFACTSDIR/$TARBALL" s3://ziglang.org/builds/
|
||||
# Produce the experimental std lib documentation.
|
||||
mkdir -p release/docs/std
|
||||
release/bin/zig test ../lib/std/std.zig \
|
||||
--override-lib-dir ../lib \
|
||||
-femit-docs=release/docs/std \
|
||||
-fno-emit-bin
|
||||
|
||||
SHASUM=$(sha256sum $ARTIFACTSDIR/$TARBALL | cut '-d ' -f1)
|
||||
BYTESIZE=$(wc -c < $ARTIFACTSDIR/$TARBALL)
|
||||
mv ../LICENSE release/
|
||||
mv ../zig-cache/langref.html release/docs/
|
||||
|
||||
# Remove the unnecessary bin dir in $prefix/bin/zig
|
||||
mv release/bin/zig release/
|
||||
rmdir release/bin
|
||||
|
||||
# Remove the unnecessary zig dir in $prefix/lib/zig/std/std.zig
|
||||
mv release/lib/zig release/lib2
|
||||
rmdir release/lib
|
||||
mv release/lib2 release/lib
|
||||
|
||||
VERSION=$(release/zig version)
|
||||
DIRNAME="zig-linux-$ARCH-$VERSION"
|
||||
TARBALL="$DIRNAME.tar.xz"
|
||||
mv release "$DIRNAME"
|
||||
tar cfJ "$TARBALL" "$DIRNAME"
|
||||
|
||||
mv "$DOWNLOADSECUREFILE_SECUREFILEPATH" "$HOME/.s3cfg"
|
||||
s3cmd put -P --add-header="cache-control: public, max-age=31536000, immutable" "$TARBALL" s3://ziglang.org/builds/
|
||||
|
||||
SHASUM=$(sha256sum $TARBALL | cut '-d ' -f1)
|
||||
BYTESIZE=$(wc -c < $TARBALL)
|
||||
|
||||
JSONFILE="linux-$GITBRANCH.json"
|
||||
touch $JSONFILE
|
||||
@ -81,7 +109,7 @@ if [ "${BUILD_REASON}" != "PullRequest" ]; then
|
||||
echo "\"size\": \"$BYTESIZE\"}" >>$JSONFILE
|
||||
|
||||
s3cmd put -P --add-header="Cache-Control: max-age=0, must-revalidate" "$JSONFILE" "s3://ziglang.org/builds/$JSONFILE"
|
||||
s3cmd put -P "$JSONFILE" "s3://ziglang.org/builds/x86_64-linux-$VERSION.json"
|
||||
s3cmd put -P "$JSONFILE" "s3://ziglang.org/builds/$ARCH-linux-$VERSION.json"
|
||||
|
||||
# `set -x` causes these variables to be mangled.
|
||||
# See https://developercommunity.visualstudio.com/content/problem/375679/pipeline-variable-incorrectly-inserts-single-quote.html
|
||||
|
||||
@ -28,6 +28,8 @@ cd $ZIGDIR
|
||||
# Make the `zig version` number consistent.
|
||||
# This will affect the cmake command below.
|
||||
git config core.abbrev 9
|
||||
git fetch --unshallow || true
|
||||
git fetch --tags
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
@ -31,7 +31,7 @@ jobs:
|
||||
timeoutInMinutes: 360
|
||||
steps:
|
||||
- powershell: |
|
||||
(New-Object Net.WebClient).DownloadFile("https://github.com/msys2/msys2-installer/releases/download/2020-11-09/msys2-base-x86_64-20201109.sfx.exe", "sfx.exe")
|
||||
(New-Object Net.WebClient).DownloadFile("https://github.com/msys2/msys2-installer/releases/download/2021-01-05/msys2-base-x86_64-20210105.sfx.exe", "sfx.exe")
|
||||
.\sfx.exe -y -o\
|
||||
del sfx.exe
|
||||
displayName: Download/Extract/Install MSYS2
|
||||
|
||||
@ -18,14 +18,17 @@ call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliar
|
||||
REM Make the `zig version` number consistent.
|
||||
REM This will affect the cmake command below.
|
||||
git.exe config core.abbrev 9
|
||||
git.exe fetch --unshallow
|
||||
git.exe fetch --tags
|
||||
|
||||
mkdir %ZIGBUILDDIR%
|
||||
cd %ZIGBUILDDIR%
|
||||
cmake.exe .. -Thost=x64 -G"Visual Studio 16 2019" -A x64 "-DCMAKE_INSTALL_PREFIX=%ZIGINSTALLDIR%" "-DCMAKE_PREFIX_PATH=%ZIGPREFIXPATH%" -DCMAKE_BUILD_TYPE=Release || exit /b
|
||||
cmake.exe .. -Thost=x64 -G"Visual Studio 16 2019" -A x64 "-DCMAKE_INSTALL_PREFIX=%ZIGINSTALLDIR%" "-DCMAKE_PREFIX_PATH=%ZIGPREFIXPATH%" -DCMAKE_BUILD_TYPE=Release -DZIG_OMIT_STAGE2=ON || exit /b
|
||||
msbuild /maxcpucount /p:Configuration=Release INSTALL.vcxproj || exit /b
|
||||
|
||||
"%ZIGINSTALLDIR%\bin\zig.exe" build test-behavior -Dskip-non-native || exit /b
|
||||
"%ZIGINSTALLDIR%\bin\zig.exe" build test-stage2 -Dskip-non-native || exit /b
|
||||
REM Disabled to prevent OOM
|
||||
REM "%ZIGINSTALLDIR%\bin\zig.exe" build test-stage2 -Dskip-non-native || exit /b
|
||||
"%ZIGINSTALLDIR%\bin\zig.exe" build test-fmt -Dskip-non-native || exit /b
|
||||
"%ZIGINSTALLDIR%\bin\zig.exe" build test-std -Dskip-non-native || exit /b
|
||||
"%ZIGINSTALLDIR%\bin\zig.exe" build test-compiler-rt -Dskip-non-native || exit /b
|
||||
|
||||
@ -14,13 +14,15 @@ pip3 install s3cmd
|
||||
# Make the `zig version` number consistent.
|
||||
# This will affect the cmake command below.
|
||||
git config core.abbrev 9
|
||||
git fetch --unshallow || true
|
||||
git fetch --tags
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release "-DCMAKE_INSTALL_PREFIX=$DISTDIR" -DZIG_STATIC=ON -DCMAKE_PREFIX_PATH=/deps/local -GNinja
|
||||
|
||||
samu install
|
||||
./zig build test -Dskip-release -Dskip-non-native
|
||||
./zig build test -Dskip-release -Dskip-non-native -Dskip-compile-errors
|
||||
|
||||
if [ -z "$DRONE_PULL_REQUEST" ]; then
|
||||
mv ../LICENSE "$DISTDIR/"
|
||||
|
||||
@ -4,7 +4,7 @@ set -x
|
||||
set -e
|
||||
|
||||
sudo pkg update -fq
|
||||
sudo pkg install -y cmake py27-s3cmd wget curl jq
|
||||
sudo pkg install -y cmake py37-s3cmd wget curl jq
|
||||
|
||||
ZIGDIR="$(pwd)"
|
||||
CACHE_BASENAME="llvm+clang+lld-11.0.0-x86_64-freebsd-release"
|
||||
@ -20,6 +20,8 @@ cd $ZIGDIR
|
||||
# Make the `zig version` number consistent.
|
||||
# This will affect the cmake command below.
|
||||
git config core.abbrev 9
|
||||
git fetch --unshallow || true
|
||||
git fetch --tags
|
||||
|
||||
# SourceHut reports that it is a terminal that supports escape codes, but it
|
||||
# is a filthy liar. Here we tell Zig to not try to send any terminal escape
|
||||
|
||||
731
ci/srht/index.html
Normal file
731
ci/srht/index.html
Normal file
@ -0,0 +1,731 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Releases ⚡ The Zig Programming Language</title>
|
||||
<link rel="icon" href="/favicon.png">
|
||||
<style>
|
||||
body{
|
||||
font-family: system-ui, -apple-system, Roboto, "Segoe UI", sans-serif;
|
||||
line-height: 1.45;
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
}
|
||||
p {
|
||||
margin: 0.8em 0;
|
||||
}
|
||||
|
||||
h1, h2, h3, h4 {
|
||||
margin: 0.5em 0 0.5em;
|
||||
line-height: 1.2;
|
||||
font-weight: bold;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
h1 a, h2 a, h3 a, h4 a {
|
||||
text-decoration: none;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
a.hdr {
|
||||
visibility: hidden;
|
||||
}
|
||||
h1:hover > a.hdr, h2:hover > a.hdr, h3:hover > a.hdr, h4:hover > a.hdr, h5:hover > a.hdr {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
h1 { font-size: 2.0em; }
|
||||
|
||||
h2 { font-size: 1.5em; }
|
||||
|
||||
h3 { font-size: 1.25em; }
|
||||
|
||||
h4 { font-size: 1.0em; }
|
||||
|
||||
a {
|
||||
color: #2A6286;
|
||||
}
|
||||
|
||||
a:not(:hover) {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
th, td {
|
||||
padding: 0.6em;
|
||||
text-align: left;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
td {
|
||||
font-size: 0.96em;
|
||||
}
|
||||
|
||||
th {
|
||||
border-bottom: 2px solid #f2f3f3;
|
||||
}
|
||||
|
||||
tr:nth-child(even) {
|
||||
background: #f2f3f3;
|
||||
}
|
||||
|
||||
.container {
|
||||
margin: 0 auto;
|
||||
position: relative;
|
||||
max-width: 1000px;
|
||||
}
|
||||
|
||||
#navbar {
|
||||
background-color: #737475;
|
||||
padding: 5px 0;
|
||||
border-top: 4px solid #f7a41d;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
#navbar .navbar-item, #navbar .navbar-item:visited {
|
||||
color: white;
|
||||
padding-right: 5px;
|
||||
padding-left: 5px;
|
||||
}
|
||||
|
||||
.code {
|
||||
font-family: monospace;
|
||||
font-size: 0.8em;
|
||||
}
|
||||
|
||||
#header-image {
|
||||
background-image: url(https://ziglang.org/img/zig-logo-dark.svg);
|
||||
background-repeat: no-repeat;
|
||||
width: 340px;
|
||||
height: 90px;
|
||||
display: block;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
body{
|
||||
background-color:#111;
|
||||
color: #bbb;
|
||||
}
|
||||
a {
|
||||
color: #88f;
|
||||
}
|
||||
table, th, td {
|
||||
border-color: grey;
|
||||
}
|
||||
tr:nth-child(even) {
|
||||
background: #1e1e1e;
|
||||
}
|
||||
h1 a, h2 a, h3 a, h4 a, h5 a {
|
||||
color: #aaa;
|
||||
}
|
||||
#header-image {
|
||||
background-image: url(https://ziglang.org/img/zig-logo-light.svg);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<a href="/"><span id="header-image"></span></a>
|
||||
</div>
|
||||
<nav id="navbar">
|
||||
<div class="container">
|
||||
<a href="/download/" class="navbar-item">Download & Documentation</a>
|
||||
<a href="https://github.com/ziglang/zig" class="navbar-item">Source Code</a>
|
||||
<a href="/news/" class="navbar-item">News</a>
|
||||
<a href="https://github.com/ziglang/zig/wiki/Community" class="navbar-item">Join a Community</a>
|
||||
<a href="/zsf/" class="navbar-item">
|
||||
<svg style="color: #ea4aaa; vertical-align: middle;fill: currentColor; margin-right: 5px" viewBox="0 0 12 16" version="1.1" width="12" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M9 2c-.97 0-1.69.42-2.2 1-.51.58-.78.92-.8 1-.02-.08-.28-.42-.8-1-.52-.58-1.17-1-2.2-1-1.632.086-2.954 1.333-3 3 0 .52.09 1.52.67 2.67C1.25 8.82 3.01 10.61 6 13c2.98-2.39 4.77-4.17 5.34-5.33C11.91 6.51 12 5.5 12 5c-.047-1.69-1.342-2.913-3-3z"></path></svg>Sponsor the Zig Software Foundation</a>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="container">
|
||||
<h1>Releases</h1>
|
||||
<p>You can also
|
||||
<a href="https://github.com/ziglang/zig/wiki/Install-Zig-from-a-Package-Manager">install Zig from a package manager</a>.
|
||||
</p>
|
||||
<p>
|
||||
There is a <a href="index.json">JSON version of this page</a>.
|
||||
</p>
|
||||
|
||||
<h2 id="release-master">master</h2>
|
||||
<ul>
|
||||
<li>{{MASTER_DATE}}</li>
|
||||
<li><a href="/documentation/master/">Language Reference</a></li>
|
||||
<li><a href="/documentation/master/std/">Standard Library Documentation</a> (experimental)</li>
|
||||
</ul>
|
||||
<table>
|
||||
<colgroup>
|
||||
<col width="40%">
|
||||
<col width="10%">
|
||||
<col width="10%">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Filename</th>
|
||||
<th>Kind</th>
|
||||
<th>Size</th>
|
||||
<th>Sha256</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/builds/{{SRC_TARBALL}}">{{SRC_TARBALL}}</a></td>
|
||||
<td>Source</td>
|
||||
<td>{{SRC_BYTESIZE}}</td>
|
||||
<td class="code">{{SRC_SHASUM}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/builds/{{X86_64_LINUX_TARBALL}}">{{X86_64_LINUX_TARBALL}}</a></td>
|
||||
<td>Binary</td>
|
||||
<td>{{X86_64_LINUX_BYTESIZE}}</td>
|
||||
<td class="code">{{X86_64_LINUX_SHASUM}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/builds/{{AARCH64_LINUX_TARBALL}}">{{AARCH64_LINUX_TARBALL}}</a></td>
|
||||
<td>Binary</td>
|
||||
<td>{{AARCH64_LINUX_BYTESIZE}}</td>
|
||||
<td class="code">{{AARCH64_LINUX_SHASUM}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/builds/{{X86_64_WINDOWS_TARBALL}}">{{X86_64_WINDOWS_TARBALL}}</a></td>
|
||||
<td>Binary</td>
|
||||
<td>{{X86_64_WINDOWS_BYTESIZE}}</td>
|
||||
<td class="code">{{X86_64_WINDOWS_SHASUM}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/builds/{{X86_64_MACOS_TARBALL}}">{{X86_64_MACOS_TARBALL}}</a></td>
|
||||
<td>Binary</td>
|
||||
<td>{{X86_64_MACOS_BYTESIZE}}</td>
|
||||
<td class="code">{{X86_64_MACOS_SHASUM}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/builds/{{X86_64_FREEBSD_TARBALL}}">{{X86_64_FREEBSD_TARBALL}}</a></td>
|
||||
<td>Binary</td>
|
||||
<td>{{X86_64_FREEBSD_BYTESIZE}}</td>
|
||||
<td class="code">{{X86_64_FREEBSD_SHASUM}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h2 id="release-0.7.1">0.7.1</h2>
|
||||
<ul>
|
||||
<li>2020-12-13</li>
|
||||
<li><a href="0.7.1/release-notes.html">Release Notes</a></li>
|
||||
<li><a href="/documentation/0.7.1/">Language Reference</a></li>
|
||||
<li><a href="/documentation/0.7.1/std">Standard Library Documentation</a> (experimental)</li>
|
||||
</ul>
|
||||
<table>
|
||||
<colgroup>
|
||||
<col width="40%">
|
||||
<col width="10%">
|
||||
<col width="10%">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Filename</th>
|
||||
<th>Kind</th>
|
||||
<th>Size</th>
|
||||
<th>Sha256</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/download/0.7.1/zig-0.7.1.tar.xz">zig-0.7.1.tar.xz</a></td>
|
||||
<td>Source</td>
|
||||
<td>11MiB</td>
|
||||
<td class="code">2db3b944ab368d955b48743d9f7c963b8f96de1a441ba5a35e197237cc6dae44</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/download/0.7.1/zig-bootstrap-0.7.1.tar.xz">zig-bootstrap-0.7.1.tar.xz</a></td>
|
||||
<td>Source</td>
|
||||
<td>39MiB</td>
|
||||
<td class="code">040f27c1fae4b0cac0a2782aecdb691f6a2f8e89db6a6ed35024c31c304fd9b2</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/download/0.7.1/zig-freebsd-x86_64-0.7.1.tar.xz">zig-freebsd-x86_64-0.7.1.tar.xz</a></td>
|
||||
<td>Binary</td>
|
||||
<td>38MiB</td>
|
||||
<td class="code">e73c1dca35791a3183fdd5ecde0443ebbe180942efceafe651886034fb8def09</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/download/0.7.1/zig-linux-aarch64-0.7.1.tar.xz">zig-linux-aarch64-0.7.1.tar.xz</a></td>
|
||||
<td>Binary</td>
|
||||
<td>33MiB</td>
|
||||
<td class="code">48ec90eba407e4587ddef7eecef25fec7e13587eb98e3b83c5f2f5fff2a5cbe7</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/download/0.7.1/zig-linux-armv7a-0.7.1.tar.xz">zig-linux-armv7a-0.7.1.tar.xz</a></td>
|
||||
<td>Binary</td>
|
||||
<td>35MiB</td>
|
||||
<td class="code">5a0662e07b4c4968665e1f97558f8591f6facec45d2e0ff5715e661743107ceb</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/download/0.7.1/zig-linux-i386-0.7.1.tar.xz">zig-linux-i386-0.7.1.tar.xz</a></td>
|
||||
<td>Binary</td>
|
||||
<td>38MiB</td>
|
||||
<td class="code">4882e052e5f83690bd0334bb4fc1702b5403cb3a3d2aa63fd7d6043d8afecba3</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/download/0.7.1/zig-linux-riscv64-0.7.1.tar.xz">zig-linux-riscv64-0.7.1.tar.xz</a></td>
|
||||
<td>Binary</td>
|
||||
<td>36MiB</td>
|
||||
<td class="code">187294bfd35983348c3fe042901b42e67e7e36ab7f77a5f969d21c0051f4d21f</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/download/0.7.1/zig-linux-x86_64-0.7.1.tar.xz">zig-linux-x86_64-0.7.1.tar.xz</a></td>
|
||||
<td>Binary</td>
|
||||
<td>37MiB</td>
|
||||
<td class="code">18c7b9b200600f8bcde1cd8d7f1f578cbc3676241ce36d771937ce19a8159b8d</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/download/0.7.1/zig-macos-x86_64-0.7.1.tar.xz">zig-macos-x86_64-0.7.1.tar.xz</a></td>
|
||||
<td>Binary</td>
|
||||
<td>35MiB</td>
|
||||
<td class="code">845cb17562978af0cf67e3993f4e33330525eaf01ead9386df9105111e3bc519</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/download/0.7.1/zig-windows-i386-0.7.1.zip">zig-windows-i386-0.7.1.zip</a></td>
|
||||
<td>Binary</td>
|
||||
<td>52MiB</td>
|
||||
<td class="code">a1b9a7421e13153e07fd2e2c93ff29aad64d83105b8fcdafa633dbe689caf1c0</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/download/0.7.1/zig-windows-x86_64-0.7.1.zip">zig-windows-x86_64-0.7.1.zip</a></td>
|
||||
<td>Binary</td>
|
||||
<td>53MiB</td>
|
||||
<td class="code">4818a8a65b4672bc52c0ae7f14d014e0eb8caf10f12c0745176820384cea296a</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h2 id="release-0.7.0">0.7.0</h2>
|
||||
<ul>
|
||||
<li>2020-11-08</li>
|
||||
<li><a href="0.7.0/release-notes.html">Release Notes</a></li>
|
||||
<li><a href="/documentation/0.7.0/">Language Reference</a></li>
|
||||
<li><a href="/documentation/0.7.0/std">Standard Library Documentation</a> (experimental)</li>
|
||||
</ul>
|
||||
<table>
|
||||
<colgroup>
|
||||
<col width="40%">
|
||||
<col width="10%">
|
||||
<col width="10%">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Filename</th>
|
||||
<th>Kind</th>
|
||||
<th>Size</th>
|
||||
<th>Sha256</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/download/0.7.0/zig-0.7.0.tar.xz">zig-0.7.0.tar.xz</a></td>
|
||||
<td>Source</td>
|
||||
<td>11MiB</td>
|
||||
<td class="code">0efd2cf6c3b05723db80e9cf193bc55150bba84ca41f855a90f53fc756445f83</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/download/0.7.0/zig-bootstrap-0.7.0.tar.xz">zig-bootstrap-0.7.0.tar.xz</a></td>
|
||||
<td>Source</td>
|
||||
<td>39MiB</td>
|
||||
<td class="code">f073beaf5c53c8c57c0d374cbfcb332ef92ad703173edba0d9e0f2ed28401b72</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/download/0.7.0/zig-freebsd-x86_64-0.7.0.tar.xz">zig-freebsd-x86_64-0.7.0.tar.xz</a></td>
|
||||
<td>Binary</td>
|
||||
<td>34MiB</td>
|
||||
<td class="code">a0c926272ee4ae720034b4a6a1dc98399d76156dd84182554740f0ca8a41fc99</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/download/0.7.0/zig-linux-aarch64-0.7.0.tar.xz">zig-linux-aarch64-0.7.0.tar.xz</a></td>
|
||||
<td>Binary</td>
|
||||
<td>32MiB</td>
|
||||
<td class="code">f89933bac87d44be82325754ff88423020c81c7032a6fc41cfeb81e982eeab9b</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/download/0.7.0/zig-linux-armv7a-0.7.0.tar.xz">zig-linux-armv7a-0.7.0.tar.xz</a></td>
|
||||
<td>Binary</td>
|
||||
<td>34MiB</td>
|
||||
<td class="code">011c267e25a96ee160505a560c441daa045359a9d50e13ab1bada9d75c95db2d</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/download/0.7.0/zig-linux-i386-0.7.0.tar.xz">zig-linux-i386-0.7.0.tar.xz</a></td>
|
||||
<td>Binary</td>
|
||||
<td>37MiB</td>
|
||||
<td class="code">4bb2072cd363bcb1cbeb4872ff5cbc1f683b02d0cc1f90c46e3ea7422ce53222</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/download/0.7.0/zig-linux-riscv64-0.7.0.tar.xz">zig-linux-riscv64-0.7.0.tar.xz</a></td>
|
||||
<td>Binary</td>
|
||||
<td>36MiB</td>
|
||||
<td class="code">40dff81faa6f232ac40abbf88b9371f3cc932b6e09c423b94387c9ea580cb7be</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/download/0.7.0/zig-linux-x86_64-0.7.0.tar.xz">zig-linux-x86_64-0.7.0.tar.xz</a></td>
|
||||
<td>Binary</td>
|
||||
<td>36MiB</td>
|
||||
<td class="code">e619b1c6094c095b932767f527aee2507f847ea981513ff8a08aab0fd730e0ac</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/download/0.7.0/zig-macos-aarch64-0.7.0.tar.xz">zig-macos-aarch64-0.7.0.tar.xz</a></td>
|
||||
<td>Binary</td>
|
||||
<td>33MiB</td>
|
||||
<td class="code">338238035734db74ea4f30e500a4893bf741d38305c10952d5e39fa05bdb057d</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/download/0.7.0/zig-macos-x86_64-0.7.0.tar.xz">zig-macos-x86_64-0.7.0.tar.xz</a></td>
|
||||
<td>Binary</td>
|
||||
<td>35MiB</td>
|
||||
<td class="code">94063f9a311cbbf7a2e0a12295e09437182cf950f18cb0eb30ea9893f3677f24</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/download/0.7.0/zig-windows-i386-0.7.0.zip">zig-windows-i386-0.7.0.zip</a></td>
|
||||
<td>Binary</td>
|
||||
<td>51MiB</td>
|
||||
<td class="code">b1e520aacbfbd645ff3521b3eb4d44166d9a0288b8725e4b001f8b50a425eb2e</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/download/0.7.0/zig-windows-x86_64-0.7.0.zip">zig-windows-x86_64-0.7.0.zip</a></td>
|
||||
<td>Binary</td>
|
||||
<td>52MiB</td>
|
||||
<td class="code">965f56c0a36f9cda2125e3a348bc654f7f155e2804c3667d231775ec228f8553</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h2 id="release-0.6.0">0.6.0</h2>
|
||||
<ul>
|
||||
<li>2020-04-13</li>
|
||||
<li><a href="0.6.0/release-notes.html">Release Notes</a></li>
|
||||
<li><a href="/documentation/0.6.0">Language Reference</a></li>
|
||||
<li><a href="/documentation/0.6.0/std">Standard Library Documentation</a> (experimental)</li>
|
||||
</ul>
|
||||
<table>
|
||||
<colgroup>
|
||||
<col width="40%">
|
||||
<col width="10%">
|
||||
<col width="10%">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Filename</th>
|
||||
<th>Kind</th>
|
||||
<th>Size</th>
|
||||
<th>Sha256</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/download/0.6.0/zig-0.6.0.tar.xz">zig-0.6.0.tar.xz</a></td>
|
||||
<td>Source</td>
|
||||
<td>9.9MiB</td>
|
||||
<td class="code">5d167dc19354282dd35dd17b38e99e1763713b9be8a4ba9e9e69284e059e7204</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/download/0.6.0/zig-bootstrap-0.6.0.tar.xz">zig-bootstrap-0.6.0.tar.xz</a></td>
|
||||
<td>Source</td>
|
||||
<td>36.7MiB</td>
|
||||
<td class="code">5e0e4dc878b3dd0c1852a442b174f0732e8c07869a8fcd226b71a93b89b381ab</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/download/0.6.0/zig-freebsd-x86_64-0.6.0.tar.xz">zig-freebsd-x86_64-0.6.0.tar.xz</a></td>
|
||||
<td>Binary</td>
|
||||
<td>36MiB</td>
|
||||
<td class="code">190ff79c1eb56805a315d7c7a51082e32f62926250c0702b36760c225e1634a3</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/download/0.6.0/zig-linux-aarch64-0.6.0.tar.xz">zig-linux-aarch64-0.6.0.tar.xz</a></td>
|
||||
<td>Binary</td>
|
||||
<td>36MiB</td>
|
||||
<td class="code">e7520efd42cfa02be48c2e430d08fe1f3cbb999d21d9f0d3ffd0febb976b2f41</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/download/0.6.0/zig-linux-armv6kz-0.6.0.tar.xz">zig-linux-armv6kz-0.6.0.tar.xz</a></td>
|
||||
<td>Binary</td>
|
||||
<td>38MiB</td>
|
||||
<td class="code">36b6493b3fed43eb1f0000e765798ad31a6bb7d7fd3f553ac1c3761dbc919b82</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/download/0.6.0/zig-linux-armv7a-0.6.0.tar.xz">zig-linux-armv7a-0.6.0.tar.xz</a></td>
|
||||
<td>Binary</td>
|
||||
<td>38MiB</td>
|
||||
<td class="code">946969abe357def95ca9cbbfcebfcf2d90cf967bcd3f48ee87662e32d91d8f35</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/download/0.6.0/zig-linux-i386-0.6.0.tar.xz">zig-linux-i386-0.6.0.tar.xz</a></td>
|
||||
<td>Binary</td>
|
||||
<td>43MiB</td>
|
||||
<td class="code">a97a2f9ae21575743cdd763c1917d49400d83fc562ef64582b18bade43eb24ce</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/download/0.6.0/zig-linux-riscv64-0.6.0.tar.xz">zig-linux-riscv64-0.6.0.tar.xz</a></td>
|
||||
<td>Binary</td>
|
||||
<td>41MiB</td>
|
||||
<td class="code">68ddee43f7503c8ae5f26a921f3602c34719a02ed2241f528c0b8b888cc14b38</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/download/0.6.0/zig-linux-x86_64-0.6.0.tar.xz">zig-linux-x86_64-0.6.0.tar.xz</a></td>
|
||||
<td>Binary</td>
|
||||
<td>43MiB</td>
|
||||
<td class="code">08fd3c757963630645441c2772362e9c2294020c44f14fce1b89f45de0dc1253</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/download/0.6.0/zig-macos-x86_64-0.6.0.tar.xz">zig-macos-x86_64-0.6.0.tar.xz</a></td>
|
||||
<td>Binary</td>
|
||||
<td>41MiB</td>
|
||||
<td class="code">17270360e87ddc49f737e760047b2fac49f1570a824a306119b1194ac4093895</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/download/0.6.0/zig-windows-i386-0.6.0.zip">zig-windows-i386-0.6.0.zip</a></td>
|
||||
<td>Binary</td>
|
||||
<td>58MiB</td>
|
||||
<td class="code">3b0a02618743e92175990dc6d1a787bb95ff62c4cda016f1c14c7786f575f8ca</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/download/0.6.0/zig-windows-x86_64-0.6.0.zip">zig-windows-x86_64-0.6.0.zip</a></td>
|
||||
<td>Binary</td>
|
||||
<td>47MiB</td>
|
||||
<td class="code">c3b897832523e1026e10b2d8d55d7f895185c0a27a63681f3a23219c3f1c38f4</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h2 id="release-0.5.0">0.5.0</h2>
|
||||
<ul>
|
||||
<li>2019-09-30</li>
|
||||
<li><a href="0.5.0/release-notes.html">Release Notes</a></li>
|
||||
<li><a href="/documentation/0.5.0">Documentation</a></li>
|
||||
</ul>
|
||||
<table>
|
||||
<colgroup>
|
||||
<col width="40%">
|
||||
<col width="10%">
|
||||
<col width="10%">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Filename</th>
|
||||
<th>Kind</th>
|
||||
<th>Size</th>
|
||||
<th>Sha256</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/download/0.5.0/zig-0.5.0.tar.xz">zig-0.5.0.tar.xz</a></td>
|
||||
<td>Source</td>
|
||||
<td>10.4MiB</td>
|
||||
<td class="code">55ae16960f152bcb9cf98b4f8570902d0e559a141abf927f0d3555b7cc838a31</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/download/0.5.0/zig-linux-x86_64-0.5.0.tar.xz">zig-linux-x86_64-0.5.0.tar.xz</a></td>
|
||||
<td>Binary</td>
|
||||
<td>39.0MiB</td>
|
||||
<td class="code">43e8f8a8b8556edd373ddf9c1ef3ca6cf852d4d09fe07d5736d12fefedd2b4f7</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/download/0.5.0/zig-windows-x86_64-0.5.0.zip">zig-windows-x86_64-0.5.0.zip</a></td>
|
||||
<td>Binary</td>
|
||||
<td>42.8MiB</td>
|
||||
<td class="code">58141323db8d84a5af62746be5f9140bc161ee760ef33dc91a887bf9ac021976</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/download/0.5.0/zig-macos-x86_64-0.5.0.tar.xz">zig-macos-x86_64-0.5.0.tar.xz</a></td>
|
||||
<td>Binary</td>
|
||||
<td>36.1MiB</td>
|
||||
<td class="code">28702cc05745c7c0bd450487d5f4091bf0a1ad279b35eb9a640ce3e3a15b300d</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/download/0.5.0/zig-freebsd-x86_64-0.5.0.tar.xz">zig-freebsd-x86_64-0.5.0.tar.xz</a></td>
|
||||
<td>Binary</td>
|
||||
<td>32.1MiB</td>
|
||||
<td class="code">9e1f4d36c3d584c0aa01f20eb4cd0a0eef3eee5af23e483b8414de55feab6ab6</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h2 id="release-0.4.0">0.4.0</h2>
|
||||
<ul>
|
||||
<li>2019-04-08</li>
|
||||
<li><a href="0.4.0/release-notes.html">Release Notes</a></li>
|
||||
<li><a href="/documentation/0.4.0">Documentation</a></li>
|
||||
</ul>
|
||||
<table>
|
||||
<colgroup>
|
||||
<col width="40%">
|
||||
<col width="10%">
|
||||
<col width="10%">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Filename</th>
|
||||
<th>Kind</th>
|
||||
<th>Size</th>
|
||||
<th>Sha256</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/download/0.4.0/zig-0.4.0.tar.xz">zig-0.4.0.tar.xz</a></td>
|
||||
<td>Source</td>
|
||||
<td>5.1MiB</td>
|
||||
<td class="code">fec1f3f6b359a3d942e0a7f9157b3b30cde83927627a0e1ea95c54de3c526cfc</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/download/0.4.0/zig-linux-x86_64-0.4.0.tar.xz">zig-linux-x86_64-0.4.0.tar.xz</a></td>
|
||||
<td>Binary</td>
|
||||
<td>31.4MiB</td>
|
||||
<td class="code">fb1954e2fb556a01f8079a08130e88f70084e08978ff853bb2b1986d8c39d84e</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/download/0.4.0/zig-windows-x86_64-0.4.0.zip">zig-windows-x86_64-0.4.0.zip</a></td>
|
||||
<td>Binary</td>
|
||||
<td>34.1MiB</td>
|
||||
<td class="code">fbc3dd205e064c263063f69f600bedb18e3d0aa2efa747a63ef6cafb6d73f127</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/download/0.4.0/zig-macos-x86_64-0.4.0.tar.xz">zig-macos-x86_64-0.4.0.tar.xz</a></td>
|
||||
<td>Binary</td>
|
||||
<td>29.4MiB</td>
|
||||
<td class="code">67c932982484d017c5111e54af9f33f15e8e05c6bc5346a55e04052159c964a8</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/download/0.4.0/zig-freebsd-x86_64-0.4.0.tar.xz">zig-freebsd-x86_64-0.4.0.tar.xz</a></td>
|
||||
<td>Binary</td>
|
||||
<td>26.0MiB</td>
|
||||
<td class="code">3d557c91ac36d8262eb1733bb5f261c95944f9b635e43386e3d00a3272818c30</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h2 id="release-0.3.0">0.3.0</h2>
|
||||
<ul>
|
||||
<li>2018-09-28</li>
|
||||
<li><a href="0.3.0/release-notes.html">Release Notes</a></li>
|
||||
<li><a href="/documentation/0.3.0">Documentation</a></li>
|
||||
</ul>
|
||||
<table>
|
||||
<colgroup>
|
||||
<col width="40%">
|
||||
<col width="10%">
|
||||
<col width="10%">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Filename</th>
|
||||
<th>Kind</th>
|
||||
<th>Size</th>
|
||||
<th>Sha256</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/download/0.3.0/zig-0.3.0.tar.xz">zig-0.3.0.tar.xz</a></td>
|
||||
<td>Source</td>
|
||||
<td>2.2MiB</td>
|
||||
<td class="code">d70af604f3a8622f3393d93abb3e056bf60351e32d121e6fa4fe03d8d41e1f5a</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/download/0.3.0/zig-linux-x86_64-0.3.0.tar.xz">zig-linux-x86_64-0.3.0.tar.xz</a></td>
|
||||
<td>Binary</td>
|
||||
<td>24.0MiB</td>
|
||||
<td class="code">b378d0aae30cb54f28494e7bc4efbc9bfb6326f47bfb302e8b5287af777b2f3c</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/download/0.3.0/zig-windows-x86_64-0.3.0.zip">zig-windows-x86_64-0.3.0.zip</a></td>
|
||||
<td>Binary</td>
|
||||
<td>21.5MiB</td>
|
||||
<td class="code">bb568c03950958f8bb3472139c3ab5ed74547c8c694ab50f404c202faf51baf4</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/download/0.3.0/zig-macos-x86_64-0.3.0.tar.xz">zig-macos-x86_64-0.3.0.tar.xz</a></td>
|
||||
<td>Binary</td>
|
||||
<td>22.6MiB</td>
|
||||
<td class="code">19dec1f1943ab7be26823376d466f7e456143deb34e17502778a949034dc2e7e</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h2 id="release-0.2.0">0.2.0</h2>
|
||||
<ul>
|
||||
<li>2018-03-15</li>
|
||||
<li><a href="0.2.0/release-notes.html">Release Notes</a></li>
|
||||
<li><a href="/documentation/0.2.0">Documentation</a></li>
|
||||
</ul>
|
||||
<table>
|
||||
<colgroup>
|
||||
<col width="40%">
|
||||
<col width="10%">
|
||||
<col width="10%">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Filename</th>
|
||||
<th>Kind</th>
|
||||
<th>Size</th>
|
||||
<th>Sha256</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/download/0.2.0/zig-0.2.0.tar.xz">zig-0.2.0.tar.xz</a></td>
|
||||
<td>Source</td>
|
||||
<td>1.9MiB</td>
|
||||
<td class="code">29c9beb172737f4d5019b88ceae829ae8bc6512fb4386cfbf895ae2b42aa6965</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/download/0.2.0/zig-linux-x86_64-0.2.0.tar.xz">zig-linux-x86_64-0.2.0.tar.xz</a></td>
|
||||
<td>Binary</td>
|
||||
<td>23.5MiB</td>
|
||||
<td class="code">209c6fb745d42474c0a73d6f291c7ae3a38b6a1b6b641eea285a7f840cc1a890</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/download/0.2.0/zig-win64-0.2.0.zip">zig-win64-0.2.0.zip</a></td>
|
||||
<td>Binary</td>
|
||||
<td>20.6MiB</td>
|
||||
<td class="code">4f8a2979941a1f081ec8e545cca0b72608c0db1c5a3fd377a94db40649dcd3d4</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h2 id="release-0.1.1">0.1.1</h2>
|
||||
<ul>
|
||||
<li>2017-10-17</li>
|
||||
<li><a href="0.1.1/release-notes.html">Release Notes</a></li>
|
||||
<li><a href="/documentation/0.1.1">Documentation</a></li>
|
||||
</ul>
|
||||
<table>
|
||||
<colgroup>
|
||||
<col width="40%">
|
||||
<col width="10%">
|
||||
<col width="10%">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Filename</th>
|
||||
<th>Kind</th>
|
||||
<th>Size</th>
|
||||
<th>Sha256</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/download/0.1.1/zig-0.1.1.tar.xz">zig-0.1.1.tar.xz</a></td>
|
||||
<td>Source</td>
|
||||
<td>1.62MiB</td>
|
||||
<td class="code">ffca0cfb263485287e19cc997b08701fcd5f24b700345bcdc3dd8074f5a104e0</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://ziglang.org/download/0.1.1/zig-win64-0.1.1.zip">zig-win64-0.1.1.zip</a></td>
|
||||
<td>Binary</td>
|
||||
<td>19.3MiB</td>
|
||||
<td class="code">6fc88bef531af7e567fe30bf60da1487b86833cbee84c7a2f3e317030aa5b660</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
351
ci/srht/index.json
Normal file
351
ci/srht/index.json
Normal file
@ -0,0 +1,351 @@
|
||||
{
|
||||
"master": {
|
||||
"version": "{{MASTER_VERSION}}",
|
||||
"date": "{{MASTER_DATE}}",
|
||||
"docs": "https://ziglang.org/documentation/master/",
|
||||
"stdDocs": "https://ziglang.org/documentation/master/std/",
|
||||
"src": {
|
||||
"tarball": "https://ziglang.org/builds/{{SRC_TARBALL}}",
|
||||
"shasum": "{{SRC_SHASUM}}",
|
||||
"size": "{{SRC_BYTESIZE}}"
|
||||
},
|
||||
"x86_64-freebsd": {
|
||||
"tarball": "https://ziglang.org/builds/{{X86_64_FREEBSD_TARBALL}}",
|
||||
"shasum": "{{X86_64_FREEBSD_SHASUM}}",
|
||||
"size": "{{X86_64_FREEBSD_BYTESIZE}}"
|
||||
},
|
||||
"x86_64-macos": {
|
||||
"tarball": "https://ziglang.org/builds/{{X86_64_MACOS_TARBALL}}",
|
||||
"shasum": "{{X86_64_MACOS_SHASUM}}",
|
||||
"size": "{{X86_64_MACOS_BYTESIZE}}"
|
||||
},
|
||||
"x86_64-windows": {
|
||||
"tarball": "https://ziglang.org/builds/{{X86_64_WINDOWS_TARBALL}}",
|
||||
"shasum": "{{X86_64_WINDOWS_SHASUM}}",
|
||||
"size": "{{X86_64_WINDOWS_BYTESIZE}}"
|
||||
},
|
||||
"x86_64-linux": {
|
||||
"tarball": "https://ziglang.org/builds/{{X86_64_LINUX_TARBALL}}",
|
||||
"shasum": "{{X86_64_LINUX_SHASUM}}",
|
||||
"size": "{{X86_64_LINUX_BYTESIZE}}"
|
||||
},
|
||||
"aarch64-linux": {
|
||||
"tarball": "https://ziglang.org/builds/{{AARCH64_LINUX_TARBALL}}",
|
||||
"shasum": "{{AARCH64_LINUX_SHASUM}}",
|
||||
"size": "{{AARCH64_LINUX_BYTESIZE}}"
|
||||
}
|
||||
},
|
||||
"0.7.1": {
|
||||
"date": "2020-12-13",
|
||||
"docs": "https://ziglang.org/documentation/0.7.1/",
|
||||
"stdDocs": "https://ziglang.org/documentation/0.7.1/std/",
|
||||
"notes": "https://ziglang.org/download/0.7.1/release-notes.html",
|
||||
"src": {
|
||||
"tarball": "https://ziglang.org/download/0.7.1/zig-0.7.1.tar.xz",
|
||||
"shasum": "2db3b944ab368d955b48743d9f7c963b8f96de1a441ba5a35e197237cc6dae44",
|
||||
"size": "10711824"
|
||||
},
|
||||
"bootstrap": {
|
||||
"tarball": "https://ziglang.org/download/0.7.1/zig-bootstrap-0.7.1.tar.xz",
|
||||
"shasum": "040f27c1fae4b0cac0a2782aecdb691f6a2f8e89db6a6ed35024c31c304fd9b2",
|
||||
"size": "40232612"
|
||||
},
|
||||
"x86_64-freebsd": {
|
||||
"tarball": "https://ziglang.org/download/0.7.1/zig-freebsd-x86_64-0.7.1.tar.xz",
|
||||
"shasum": "e73c1dca35791a3183fdd5ecde0443ebbe180942efceafe651886034fb8def09",
|
||||
"size": "39066808"
|
||||
},
|
||||
"aarch64-linux": {
|
||||
"tarball": "https://ziglang.org/download/0.7.1/zig-linux-aarch64-0.7.1.tar.xz",
|
||||
"shasum": "48ec90eba407e4587ddef7eecef25fec7e13587eb98e3b83c5f2f5fff2a5cbe7",
|
||||
"size": "33780552"
|
||||
},
|
||||
"armv7a-linux": {
|
||||
"tarball": "https://ziglang.org/download/0.7.1/zig-linux-armv7a-0.7.1.tar.xz",
|
||||
"shasum": "5a0662e07b4c4968665e1f97558f8591f6facec45d2e0ff5715e661743107ceb",
|
||||
"size": "35813504"
|
||||
},
|
||||
"i386-linux": {
|
||||
"tarball": "https://ziglang.org/download/0.7.1/zig-linux-i386-0.7.1.tar.xz",
|
||||
"shasum": "4882e052e5f83690bd0334bb4fc1702b5403cb3a3d2aa63fd7d6043d8afecba3",
|
||||
"size": "39230912"
|
||||
},
|
||||
"riscv64-linux": {
|
||||
"tarball": "https://ziglang.org/download/0.7.1/zig-linux-riscv64-0.7.1.tar.xz",
|
||||
"shasum": "187294bfd35983348c3fe042901b42e67e7e36ab7f77a5f969d21c0051f4d21f",
|
||||
"size": "37454812"
|
||||
},
|
||||
"x86_64-linux": {
|
||||
"tarball": "https://ziglang.org/download/0.7.1/zig-linux-x86_64-0.7.1.tar.xz",
|
||||
"shasum": "18c7b9b200600f8bcde1cd8d7f1f578cbc3676241ce36d771937ce19a8159b8d",
|
||||
"size": "37848176"
|
||||
},
|
||||
"x86_64-macos": {
|
||||
"tarball": "https://ziglang.org/download/0.7.1/zig-macos-x86_64-0.7.1.tar.xz",
|
||||
"shasum": "845cb17562978af0cf67e3993f4e33330525eaf01ead9386df9105111e3bc519",
|
||||
"size": "36211076"
|
||||
},
|
||||
"i386-windows": {
|
||||
"tarball": "https://ziglang.org/download/0.7.1/zig-windows-i386-0.7.1.zip",
|
||||
"shasum": "a1b9a7421e13153e07fd2e2c93ff29aad64d83105b8fcdafa633dbe689caf1c0",
|
||||
"size": "54374983"
|
||||
},
|
||||
"x86_64-windows": {
|
||||
"tarball": "https://ziglang.org/download/0.7.1/zig-windows-x86_64-0.7.1.zip",
|
||||
"shasum": "4818a8a65b4672bc52c0ae7f14d014e0eb8caf10f12c0745176820384cea296a",
|
||||
"size": "54909997"
|
||||
}
|
||||
},
|
||||
"0.7.0": {
|
||||
"date": "2020-11-08",
|
||||
"docs": "https://ziglang.org/documentation/0.7.0/",
|
||||
"stdDocs": "https://ziglang.org/documentation/0.7.0/std/",
|
||||
"notes": "https://ziglang.org/download/0.7.0/release-notes.html",
|
||||
"src": {
|
||||
"tarball": "https://ziglang.org/download/0.7.0/zig-0.7.0.tar.xz",
|
||||
"shasum": "0efd2cf6c3b05723db80e9cf193bc55150bba84ca41f855a90f53fc756445f83",
|
||||
"size": "10683920"
|
||||
},
|
||||
"bootstrap": {
|
||||
"tarball": "https://ziglang.org/download/0.7.0/zig-bootstrap-0.7.0.tar.xz",
|
||||
"shasum": "f073beaf5c53c8c57c0d374cbfcb332ef92ad703173edba0d9e0f2ed28401b72",
|
||||
"size": "40200436"
|
||||
},
|
||||
"x86_64-freebsd": {
|
||||
"tarball": "https://ziglang.org/download/0.7.0/zig-freebsd-x86_64-0.7.0.tar.xz",
|
||||
"shasum": "a0c926272ee4ae720034b4a6a1dc98399d76156dd84182554740f0ca8a41fc99",
|
||||
"size": "34798992"
|
||||
},
|
||||
"aarch64-linux": {
|
||||
"tarball": "https://ziglang.org/download/0.7.0/zig-linux-aarch64-0.7.0.tar.xz",
|
||||
"shasum": "f89933bac87d44be82325754ff88423020c81c7032a6fc41cfeb81e982eeab9b",
|
||||
"size": "33096140"
|
||||
},
|
||||
"armv7a-linux": {
|
||||
"tarball": "https://ziglang.org/download/0.7.0/zig-linux-armv7a-0.7.0.tar.xz",
|
||||
"shasum": "011c267e25a96ee160505a560c441daa045359a9d50e13ab1bada9d75c95db2d",
|
||||
"size": "35157584"
|
||||
},
|
||||
"i386-linux": {
|
||||
"tarball": "https://ziglang.org/download/0.7.0/zig-linux-i386-0.7.0.tar.xz",
|
||||
"shasum": "4bb2072cd363bcb1cbeb4872ff5cbc1f683b02d0cc1f90c46e3ea7422ce53222",
|
||||
"size": "38530596"
|
||||
},
|
||||
"riscv64-linux": {
|
||||
"tarball": "https://ziglang.org/download/0.7.0/zig-linux-riscv64-0.7.0.tar.xz",
|
||||
"shasum": "40dff81faa6f232ac40abbf88b9371f3cc932b6e09c423b94387c9ea580cb7be",
|
||||
"size": "36759992"
|
||||
},
|
||||
"x86_64-linux": {
|
||||
"tarball": "https://ziglang.org/download/0.7.0/zig-linux-x86_64-0.7.0.tar.xz",
|
||||
"shasum": "e619b1c6094c095b932767f527aee2507f847ea981513ff8a08aab0fd730e0ac",
|
||||
"size": "37154432"
|
||||
},
|
||||
"aarch64-macos": {
|
||||
"tarball": "https://ziglang.org/download/0.7.0/zig-macos-aarch64-0.7.0.tar.xz",
|
||||
"shasum": "338238035734db74ea4f30e500a4893bf741d38305c10952d5e39fa05bdb057d",
|
||||
"size": "33739424"
|
||||
},
|
||||
"x86_64-macos": {
|
||||
"tarball": "https://ziglang.org/download/0.7.0/zig-macos-x86_64-0.7.0.tar.xz",
|
||||
"shasum": "94063f9a311cbbf7a2e0a12295e09437182cf950f18cb0eb30ea9893f3677f24",
|
||||
"size": "35258328"
|
||||
},
|
||||
"i386-windows": {
|
||||
"tarball": "https://ziglang.org/download/0.7.0/zig-windows-i386-0.7.0.zip",
|
||||
"shasum": "b1e520aacbfbd645ff3521b3eb4d44166d9a0288b8725e4b001f8b50a425eb2e",
|
||||
"size": "53390517"
|
||||
},
|
||||
"x86_64-windows": {
|
||||
"tarball": "https://ziglang.org/download/0.7.0/zig-windows-x86_64-0.7.0.zip",
|
||||
"shasum": "965f56c0a36f9cda2125e3a348bc654f7f155e2804c3667d231775ec228f8553",
|
||||
"size": "53943784"
|
||||
}
|
||||
},
|
||||
"0.6.0": {
|
||||
"date": "2020-04-13",
|
||||
"docs": "https://ziglang.org/documentation/0.6.0/",
|
||||
"stdDocs": "https://ziglang.org/documentation/0.6.0/std/",
|
||||
"notes": "https://ziglang.org/download/0.6.0/release-notes.html",
|
||||
"src": {
|
||||
"tarball": "https://ziglang.org/download/0.6.0/zig-0.6.0.tar.xz",
|
||||
"shasum": "5d167dc19354282dd35dd17b38e99e1763713b9be8a4ba9e9e69284e059e7204",
|
||||
"size": "10349552"
|
||||
},
|
||||
"bootstrap": {
|
||||
"tarball": "https://ziglang.org/download/0.6.0/zig-bootstrap-0.6.0.tar.xz",
|
||||
"shasum": "5e0e4dc878b3dd0c1852a442b174f0732e8c07869a8fcd226b71a93b89b381ab",
|
||||
"size": "38469948"
|
||||
},
|
||||
"x86_64-freebsd": {
|
||||
"tarball": "https://ziglang.org/download/0.6.0/zig-freebsd-x86_64-0.6.0.tar.xz",
|
||||
"shasum": "190ff79c1eb56805a315d7c7a51082e32f62926250c0702b36760c225e1634a3",
|
||||
"size": "36974604"
|
||||
},
|
||||
"aarch64-linux": {
|
||||
"tarball": "https://ziglang.org/download/0.6.0/zig-linux-aarch64-0.6.0.tar.xz",
|
||||
"shasum": "e7520efd42cfa02be48c2e430d08fe1f3cbb999d21d9f0d3ffd0febb976b2f41",
|
||||
"size": "37090044"
|
||||
},
|
||||
"armv6kz-linux": {
|
||||
"tarball": "https://ziglang.org/download/0.6.0/zig-linux-armv6kz-0.6.0.tar.xz",
|
||||
"shasum": "36b6493b3fed43eb1f0000e765798ad31a6bb7d7fd3f553ac1c3761dbc919b82",
|
||||
"size": "39133452"
|
||||
},
|
||||
"armv7a-linux": {
|
||||
"tarball": "https://ziglang.org/download/0.6.0/zig-linux-armv7a-0.6.0.tar.xz",
|
||||
"shasum": "946969abe357def95ca9cbbfcebfcf2d90cf967bcd3f48ee87662e32d91d8f35",
|
||||
"size": "39143748"
|
||||
},
|
||||
"i386-linux": {
|
||||
"tarball": "https://ziglang.org/download/0.6.0/zig-linux-i386-0.6.0.tar.xz",
|
||||
"shasum": "a97a2f9ae21575743cdd763c1917d49400d83fc562ef64582b18bade43eb24ce",
|
||||
"size": "44877640"
|
||||
},
|
||||
"riscv64-linux": {
|
||||
"tarball": "https://ziglang.org/download/0.6.0/zig-linux-riscv64-0.6.0.tar.xz",
|
||||
"shasum": "68ddee43f7503c8ae5f26a921f3602c34719a02ed2241f528c0b8b888cc14b38",
|
||||
"size": "41993144"
|
||||
},
|
||||
"x86_64-linux": {
|
||||
"tarball": "https://ziglang.org/download/0.6.0/zig-linux-x86_64-0.6.0.tar.xz",
|
||||
"shasum": "08fd3c757963630645441c2772362e9c2294020c44f14fce1b89f45de0dc1253",
|
||||
"size": "44766320"
|
||||
},
|
||||
"x86_64-macos": {
|
||||
"tarball": "https://ziglang.org/download/0.6.0/zig-macos-x86_64-0.6.0.tar.xz",
|
||||
"shasum": "17270360e87ddc49f737e760047b2fac49f1570a824a306119b1194ac4093895",
|
||||
"size": "42573184"
|
||||
},
|
||||
"i386-windows": {
|
||||
"tarball": "https://ziglang.org/download/0.6.0/zig-windows-i386-0.6.0.zip",
|
||||
"shasum": "3b0a02618743e92175990dc6d1a787bb95ff62c4cda016f1c14c7786f575f8ca",
|
||||
"size": "60446431"
|
||||
},
|
||||
"x86_64-windows": {
|
||||
"tarball": "https://ziglang.org/download/0.6.0/zig-windows-x86_64-0.6.0.zip",
|
||||
"shasum": "c3b897832523e1026e10b2d8d55d7f895185c0a27a63681f3a23219c3f1c38f4",
|
||||
"size": "49065511"
|
||||
}
|
||||
},
|
||||
"0.5.0": {
|
||||
"date": "2019-09-30",
|
||||
"docs": "https://ziglang.org/documentation/0.5.0/",
|
||||
"notes": "https://ziglang.org/download/0.5.0/release-notes.html",
|
||||
"src": {
|
||||
"tarball": "https://ziglang.org/download/0.5.0/zig-0.5.0.tar.xz",
|
||||
"shasum": "55ae16960f152bcb9cf98b4f8570902d0e559a141abf927f0d3555b7cc838a31",
|
||||
"size": "10956132"
|
||||
},
|
||||
"x86_64-freebsd": {
|
||||
"tarball": "https://ziglang.org/download/0.5.0/zig-freebsd-x86_64-0.5.0.tar.xz",
|
||||
"shasum": "9e1f4d36c3d584c0aa01f20eb4cd0a0eef3eee5af23e483b8414de55feab6ab6",
|
||||
"size": "33650744"
|
||||
},
|
||||
"x86_64-macos": {
|
||||
"tarball": "https://ziglang.org/download/0.5.0/zig-macos-x86_64-0.5.0.tar.xz",
|
||||
"shasum": "28702cc05745c7c0bd450487d5f4091bf0a1ad279b35eb9a640ce3e3a15b300d",
|
||||
"size": "37898664"
|
||||
},
|
||||
"x86_64-windows": {
|
||||
"tarball": "https://ziglang.org/download/0.5.0/zig-windows-x86_64-0.5.0.zip",
|
||||
"shasum": "58141323db8d84a5af62746be5f9140bc161ee760ef33dc91a887bf9ac021976",
|
||||
"size": "44871804"
|
||||
},
|
||||
"x86_64-linux": {
|
||||
"tarball": "https://ziglang.org/download/0.5.0/zig-linux-x86_64-0.5.0.tar.xz",
|
||||
"shasum": "43e8f8a8b8556edd373ddf9c1ef3ca6cf852d4d09fe07d5736d12fefedd2b4f7",
|
||||
"size": "40895068"
|
||||
}
|
||||
},
|
||||
"0.4.0": {
|
||||
"date": "2019-04-08",
|
||||
"docs": "https://ziglang.org/documentation/0.4.0/",
|
||||
"notes": "https://ziglang.org/download/0.4.0/release-notes.html",
|
||||
"src": {
|
||||
"tarball": "https://ziglang.org/download/0.4.0/zig-0.4.0.tar.xz",
|
||||
"shasum": "fec1f3f6b359a3d942e0a7f9157b3b30cde83927627a0e1ea95c54de3c526cfc",
|
||||
"size": "5348776"
|
||||
},
|
||||
"x86_64-freebsd": {
|
||||
"tarball": "https://ziglang.org/download/0.4.0/zig-freebsd-x86_64-0.4.0.tar.xz",
|
||||
"shasum": "3d557c91ac36d8262eb1733bb5f261c95944f9b635e43386e3d00a3272818c30",
|
||||
"size": "27269672"
|
||||
},
|
||||
"x86_64-macos": {
|
||||
"tarball": "https://ziglang.org/download/0.4.0/zig-macos-x86_64-0.4.0.tar.xz",
|
||||
"shasum": "67c932982484d017c5111e54af9f33f15e8e05c6bc5346a55e04052159c964a8",
|
||||
"size": "30841504"
|
||||
},
|
||||
"x86_64-windows": {
|
||||
"tarball": "https://ziglang.org/download/0.4.0/zig-windows-x86_64-0.4.0.zip",
|
||||
"shasum": "fbc3dd205e064c263063f69f600bedb18e3d0aa2efa747a63ef6cafb6d73f127",
|
||||
"size": "35800101"
|
||||
},
|
||||
"x86_64-linux": {
|
||||
"tarball": "https://ziglang.org/download/0.4.0/zig-linux-x86_64-0.4.0.tar.xz",
|
||||
"shasum": "fb1954e2fb556a01f8079a08130e88f70084e08978ff853bb2b1986d8c39d84e",
|
||||
"size": "32876100"
|
||||
}
|
||||
},
|
||||
"0.3.0": {
|
||||
"date": "2018-09-28",
|
||||
"docs": "https://ziglang.org/documentation/0.3.0/",
|
||||
"notes": "https://ziglang.org/download/0.3.0/release-notes.html",
|
||||
"src": {
|
||||
"tarball": "https://ziglang.org/download/0.3.0/zig-0.3.0.tar.xz",
|
||||
"shasum": "d70af604f3a8622f3393d93abb3e056bf60351e32d121e6fa4fe03d8d41e1f5a",
|
||||
"size": "2335592"
|
||||
},
|
||||
"x86_64-macos": {
|
||||
"tarball": "https://ziglang.org/download/0.3.0/zig-macos-x86_64-0.3.0.tar.xz",
|
||||
"shasum": "19dec1f1943ab7be26823376d466f7e456143deb34e17502778a949034dc2e7e",
|
||||
"size": "23712696"
|
||||
},
|
||||
"x86_64-windows": {
|
||||
"tarball": "https://ziglang.org/download/0.3.0/zig-windows-x86_64-0.3.0.zip",
|
||||
"shasum": "bb568c03950958f8bb3472139c3ab5ed74547c8c694ab50f404c202faf51baf4",
|
||||
"size": "22524425"
|
||||
},
|
||||
"x86_64-linux": {
|
||||
"tarball": "https://ziglang.org/download/0.3.0/zig-linux-x86_64-0.3.0.tar.xz",
|
||||
"shasum": "b378d0aae30cb54f28494e7bc4efbc9bfb6326f47bfb302e8b5287af777b2f3c",
|
||||
"size": "25209304"
|
||||
}
|
||||
},
|
||||
"0.2.0": {
|
||||
"date": "2018-03-15",
|
||||
"docs": "https://ziglang.org/documentation/0.2.0/",
|
||||
"notes": "https://ziglang.org/download/0.2.0/release-notes.html",
|
||||
"src": {
|
||||
"tarball": "https://ziglang.org/download/0.2.0/zig-0.2.0.tar.xz",
|
||||
"shasum": "29c9beb172737f4d5019b88ceae829ae8bc6512fb4386cfbf895ae2b42aa6965",
|
||||
"size": "1940832"
|
||||
},
|
||||
"x86_64-windows": {
|
||||
"tarball": "https://ziglang.org/download/0.2.0/zig-win64-0.2.0.zip",
|
||||
"shasum": "4f8a2979941a1f081ec8e545cca0b72608c0db1c5a3fd377a94db40649dcd3d4",
|
||||
"size": "21076274"
|
||||
},
|
||||
"x86_64-linux": {
|
||||
"tarball": "https://ziglang.org/download/0.2.0/zig-linux-x86_64-0.2.0.tar.xz",
|
||||
"shasum": "209c6fb745d42474c0a73d6f291c7ae3a38b6a1b6b641eea285a7f840cc1a890",
|
||||
"size": "22551928"
|
||||
}
|
||||
},
|
||||
"0.1.1": {
|
||||
"date": "2017-10-17",
|
||||
"docs": "https://ziglang.org/documentation/0.1.1/",
|
||||
"notes": "https://ziglang.org/download/0.1.1/release-notes.html",
|
||||
"src": {
|
||||
"tarball": "https://ziglang.org/download/0.1.1/zig-0.1.1.tar.xz",
|
||||
"shasum": "ffca0cfb263485287e19cc997b08701fcd5f24b700345bcdc3dd8074f5a104e0",
|
||||
"size": "1659716"
|
||||
},
|
||||
"x86_64-windows": {
|
||||
"tarball": "https://ziglang.org/download/0.1.1/zig-win64-0.1.1.zip",
|
||||
"shasum": "6fc88bef531af7e567fe30bf60da1487b86833cbee84c7a2f3e317030aa5b660",
|
||||
"size": "19757776"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -24,6 +24,7 @@ packages:
|
||||
- xz
|
||||
secrets:
|
||||
- 51bfddf5-86a6-4e01-8576-358c72a4a0a4
|
||||
- 8d5f230b-78d9-4e7c-b583-8cbb1b15807c
|
||||
sources:
|
||||
- https://github.com/ziglang/zig
|
||||
tasks:
|
||||
|
||||
103
ci/srht/update-download-page.zig
Normal file
103
ci/srht/update-download-page.zig
Normal file
@ -0,0 +1,103 @@
|
||||
const std = @import("std");
|
||||
const path = std.fs.path;
|
||||
const mem = std.mem;
|
||||
|
||||
pub fn main() !void {
|
||||
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
|
||||
defer arena.deinit();
|
||||
|
||||
const allocator = &arena.allocator;
|
||||
|
||||
const out_dir = "out";
|
||||
try std.fs.cwd().makePath(out_dir);
|
||||
{
|
||||
const out_file = out_dir ++ path.sep_str ++ "index.html";
|
||||
const in_file = "index.html";
|
||||
try render(allocator, in_file, out_file, .html);
|
||||
}
|
||||
{
|
||||
const out_file = out_dir ++ path.sep_str ++ "index.json";
|
||||
const in_file = "index.json";
|
||||
try render(allocator, in_file, out_file, .plain);
|
||||
}
|
||||
}
|
||||
|
||||
fn render(
|
||||
allocator: *mem.Allocator,
|
||||
in_file: []const u8,
|
||||
out_file: []const u8,
|
||||
fmt: enum {
|
||||
html,
|
||||
plain,
|
||||
},
|
||||
) !void {
|
||||
const in_contents = try std.fs.cwd().readFileAlloc(allocator, in_file, 1 * 1024 * 1024);
|
||||
|
||||
var vars = try std.process.getEnvMap(allocator);
|
||||
|
||||
var buffer = std.ArrayList(u8).init(allocator);
|
||||
defer buffer.deinit();
|
||||
|
||||
const State = enum {
|
||||
Start,
|
||||
OpenBrace,
|
||||
VarName,
|
||||
EndBrace,
|
||||
};
|
||||
const writer = buffer.writer();
|
||||
var state = State.Start;
|
||||
var var_name_start: usize = undefined;
|
||||
var line: usize = 1;
|
||||
for (in_contents) |byte, index| {
|
||||
switch (state) {
|
||||
State.Start => switch (byte) {
|
||||
'{' => {
|
||||
state = State.OpenBrace;
|
||||
},
|
||||
else => try writer.writeByte(byte),
|
||||
},
|
||||
State.OpenBrace => switch (byte) {
|
||||
'{' => {
|
||||
state = State.VarName;
|
||||
var_name_start = index + 1;
|
||||
},
|
||||
else => {
|
||||
try writer.writeByte('{');
|
||||
try writer.writeByte(byte);
|
||||
state = State.Start;
|
||||
},
|
||||
},
|
||||
State.VarName => switch (byte) {
|
||||
'}' => {
|
||||
const var_name = in_contents[var_name_start..index];
|
||||
if (vars.get(var_name)) |value| {
|
||||
const trimmed = mem.trim(u8, value, " \r\n");
|
||||
if (fmt == .html and mem.endsWith(u8, var_name, "BYTESIZE")) {
|
||||
try writer.print("{Bi:.1}", .{try std.fmt.parseInt(u64, trimmed, 10)});
|
||||
} else {
|
||||
try writer.writeAll(trimmed);
|
||||
}
|
||||
} else {
|
||||
std.debug.warn("line {d}: missing variable: {s}\n", .{ line, var_name });
|
||||
try writer.writeAll("(missing)");
|
||||
}
|
||||
state = State.EndBrace;
|
||||
},
|
||||
else => {},
|
||||
},
|
||||
State.EndBrace => switch (byte) {
|
||||
'}' => {
|
||||
state = State.Start;
|
||||
},
|
||||
else => {
|
||||
std.debug.warn("line {d}: invalid byte: '0x{x}'", .{ line, byte });
|
||||
std.process.exit(1);
|
||||
},
|
||||
},
|
||||
}
|
||||
if (byte == '\n') {
|
||||
line += 1;
|
||||
}
|
||||
}
|
||||
try std.fs.cwd().writeFile(out_file, buffer.items);
|
||||
}
|
||||
@ -28,14 +28,23 @@ curl --fail -I "$X86_64_FREEBSD_JSON_URL" >/dev/null || exit 0
|
||||
pip3 install s3cmd --user
|
||||
S3CMD="$HOME/.local/bin/s3cmd"
|
||||
|
||||
# This is the user when pushing to the website repo.
|
||||
git config --global user.email "ziggy@ziglang.org"
|
||||
git config --global user.name "Ziggy"
|
||||
|
||||
# Refresh this with `ssh-keyscan github.com` from a trusted Internet connection.
|
||||
# We hard code the public key here to detect man-in-the-middle attacks.
|
||||
echo "github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==" >> ~/.ssh/known_hosts
|
||||
|
||||
# We don't want the .git folder inside the tarball.
|
||||
rm -rf .git
|
||||
|
||||
cd "$HOME"
|
||||
wget "https://ziglang.org/builds/$NATIVE_TARBALL"
|
||||
tar xf "$NATIVE_TARBALL"
|
||||
ZIGDIR=$(basename $NATIVE_TARBALL .tar.xz)
|
||||
ZIGDIR="$(pwd)/$(basename $NATIVE_TARBALL .tar.xz)"
|
||||
ZIG="$ZIGDIR/zig"
|
||||
LANGREF="$ZIGDIR/langref.html"
|
||||
LANGREF="$ZIGDIR/docs/langref.html"
|
||||
SRCTARBALLDIR="zig-$VERSION"
|
||||
export SRC_TARBALL="$SRCTARBALLDIR.tar.xz"
|
||||
mv "$SRCDIR" "$SRCTARBALLDIR"
|
||||
@ -68,13 +77,29 @@ export X86_64_FREEBSD_TARBALL="$(echo "$X86_64_FREEBSD_JSON" | jq .tarball -r)"
|
||||
export X86_64_FREEBSD_BYTESIZE="$(echo "$X86_64_FREEBSD_JSON" | jq .size -r)"
|
||||
export X86_64_FREEBSD_SHASUM="$(echo "$X86_64_FREEBSD_JSON" | jq .shasum -r)"
|
||||
|
||||
git clone https://github.com/ziglang/www.ziglang.org --depth 1
|
||||
cd www.ziglang.org
|
||||
export MASTER_DATE="$(date +%Y-%m-%d)"
|
||||
export MASTER_VERSION="$VERSION"
|
||||
"../$ZIG" run update-download-page.zig
|
||||
|
||||
$S3CMD put -P --no-mime-magic --add-header="cache-control: public, max-age=31536000, immutable" "../$SRC_TARBALL" s3://ziglang.org/builds/
|
||||
$S3CMD put -P --no-mime-magic "../$LANGREF" s3://ziglang.org/documentation/master/index.html --add-header="Cache-Control: max-age=0, must-revalidate"
|
||||
$S3CMD put -P --no-mime-magic www/download/index.html s3://ziglang.org/download/index.html --add-header="Cache-Control: max-age=0, must-revalidate"
|
||||
$S3CMD put -P --no-mime-magic www/download/index.json s3://ziglang.org/download/index.json --add-header="Cache-Control: max-age=0, must-revalidate"
|
||||
cd "$SRCTARBALLDIR/ci/srht"
|
||||
"$ZIG" run update-download-page.zig
|
||||
CIDIR="$(pwd)"
|
||||
|
||||
# Create index.json and index.html and update the website repo.
|
||||
cd "$HOME"
|
||||
git clone git@github.com:ziglang/www.ziglang.org.git
|
||||
cd www.ziglang.org
|
||||
WWWDIR="$(pwd)"
|
||||
|
||||
$S3CMD put -P --no-mime-magic --add-header="cache-control: public, max-age=31536000, immutable" "$HOME/$SRC_TARBALL" s3://ziglang.org/builds/
|
||||
|
||||
cd "$WWWDIR"
|
||||
cp "$CIDIR/out/index.json" data/releases.json
|
||||
mkdir -p content/documentation/master/std
|
||||
cp "$LANGREF" content/documentation/master/index.html
|
||||
cp "$ZIGDIR/docs/std/index.html" content/documentation/master/std/index.html
|
||||
cp "$ZIGDIR/docs/std/data.js" content/documentation/master/std/data.js
|
||||
cp "$ZIGDIR/docs/std/main.js" content/documentation/master/std/main.js
|
||||
git add data/releases.json
|
||||
git add content/
|
||||
git commit -m "CI: update releases and docs"
|
||||
git push origin master
|
||||
|
||||
379
doc/docgen.zig
379
doc/docgen.zig
@ -40,9 +40,9 @@ pub fn main() !void {
|
||||
var out_file = try fs.cwd().createFile(out_file_name, .{});
|
||||
defer out_file.close();
|
||||
|
||||
const input_file_bytes = try in_file.inStream().readAllAlloc(allocator, max_doc_file_size);
|
||||
const input_file_bytes = try in_file.reader().readAllAlloc(allocator, max_doc_file_size);
|
||||
|
||||
var buffered_out_stream = io.bufferedOutStream(out_file.outStream());
|
||||
var buffered_writer = io.bufferedWriter(out_file.writer());
|
||||
|
||||
var tokenizer = Tokenizer.init(in_file_name, input_file_bytes);
|
||||
var toc = try genToc(allocator, &tokenizer);
|
||||
@ -50,8 +50,8 @@ pub fn main() !void {
|
||||
try fs.cwd().makePath(tmp_dir_name);
|
||||
defer fs.cwd().deleteTree(tmp_dir_name) catch {};
|
||||
|
||||
try genHtml(allocator, &tokenizer, &toc, buffered_out_stream.outStream(), zig_exe);
|
||||
try buffered_out_stream.flush();
|
||||
try genHtml(allocator, &tokenizer, &toc, buffered_writer.writer(), zig_exe);
|
||||
try buffered_writer.flush();
|
||||
}
|
||||
|
||||
const Token = struct {
|
||||
@ -215,9 +215,9 @@ const Tokenizer = struct {
|
||||
fn parseError(tokenizer: *Tokenizer, token: Token, comptime fmt: []const u8, args: anytype) anyerror {
|
||||
const loc = tokenizer.getTokenLocation(token);
|
||||
const args_prefix = .{ tokenizer.source_file_name, loc.line + 1, loc.column + 1 };
|
||||
print("{}:{}:{}: error: " ++ fmt ++ "\n", args_prefix ++ args);
|
||||
print("{s}:{d}:{d}: error: " ++ fmt ++ "\n", args_prefix ++ args);
|
||||
if (loc.line_start <= loc.line_end) {
|
||||
print("{}\n", .{tokenizer.buffer[loc.line_start..loc.line_end]});
|
||||
print("{s}\n", .{tokenizer.buffer[loc.line_start..loc.line_end]});
|
||||
{
|
||||
var i: usize = 0;
|
||||
while (i < loc.column) : (i += 1) {
|
||||
@ -238,7 +238,7 @@ fn parseError(tokenizer: *Tokenizer, token: Token, comptime fmt: []const u8, arg
|
||||
|
||||
fn assertToken(tokenizer: *Tokenizer, token: Token, id: Token.Id) !void {
|
||||
if (token.id != id) {
|
||||
return parseError(tokenizer, token, "expected {}, found {}", .{ @tagName(id), @tagName(token.id) });
|
||||
return parseError(tokenizer, token, "expected {s}, found {s}", .{ @tagName(id), @tagName(token.id) });
|
||||
}
|
||||
}
|
||||
|
||||
@ -325,7 +325,7 @@ fn genToc(allocator: *mem.Allocator, tokenizer: *Tokenizer) !Toc {
|
||||
var toc_buf = std.ArrayList(u8).init(allocator);
|
||||
defer toc_buf.deinit();
|
||||
|
||||
var toc = toc_buf.outStream();
|
||||
var toc = toc_buf.writer();
|
||||
|
||||
var nodes = std.ArrayList(Node).init(allocator);
|
||||
defer nodes.deinit();
|
||||
@ -374,7 +374,7 @@ fn genToc(allocator: *mem.Allocator, tokenizer: *Tokenizer) !Toc {
|
||||
return parseError(
|
||||
tokenizer,
|
||||
bracket_tok,
|
||||
"unrecognized header_open param: {}",
|
||||
"unrecognized header_open param: {s}",
|
||||
.{param},
|
||||
);
|
||||
}
|
||||
@ -394,7 +394,7 @@ fn genToc(allocator: *mem.Allocator, tokenizer: *Tokenizer) !Toc {
|
||||
},
|
||||
});
|
||||
if (try urls.fetchPut(urlized, tag_token)) |entry| {
|
||||
parseError(tokenizer, tag_token, "duplicate header url: #{}", .{urlized}) catch {};
|
||||
parseError(tokenizer, tag_token, "duplicate header url: #{s}", .{urlized}) catch {};
|
||||
parseError(tokenizer, entry.value, "other tag here", .{}) catch {};
|
||||
return error.ParseError;
|
||||
}
|
||||
@ -411,7 +411,7 @@ fn genToc(allocator: *mem.Allocator, tokenizer: *Tokenizer) !Toc {
|
||||
}
|
||||
last_columns = columns;
|
||||
try toc.writeByteNTimes(' ', 4 + header_stack_size * 4);
|
||||
try toc.print("<li><a id=\"toc-{}\" href=\"#{}\">{}</a>", .{ urlized, urlized, content });
|
||||
try toc.print("<li><a id=\"toc-{s}\" href=\"#{s}\">{s}</a>", .{ urlized, urlized, content });
|
||||
} else if (mem.eql(u8, tag_name, "header_close")) {
|
||||
if (header_stack_size == 0) {
|
||||
return parseError(tokenizer, tag_token, "unbalanced close header", .{});
|
||||
@ -515,7 +515,7 @@ fn genToc(allocator: *mem.Allocator, tokenizer: *Tokenizer) !Toc {
|
||||
code_kind_id = Code.Id{ .Obj = null };
|
||||
is_inline = true;
|
||||
} else {
|
||||
return parseError(tokenizer, code_kind_tok, "unrecognized code kind: {}", .{code_kind_str});
|
||||
return parseError(tokenizer, code_kind_tok, "unrecognized code kind: {s}", .{code_kind_str});
|
||||
}
|
||||
|
||||
var mode: builtin.Mode = .Debug;
|
||||
@ -559,7 +559,7 @@ fn genToc(allocator: *mem.Allocator, tokenizer: *Tokenizer) !Toc {
|
||||
return parseError(
|
||||
tokenizer,
|
||||
end_code_tag,
|
||||
"invalid token inside code_begin: {}",
|
||||
"invalid token inside code_begin: {s}",
|
||||
.{end_tag_name},
|
||||
);
|
||||
}
|
||||
@ -590,14 +590,14 @@ fn genToc(allocator: *mem.Allocator, tokenizer: *Tokenizer) !Toc {
|
||||
return parseError(
|
||||
tokenizer,
|
||||
end_syntax_tag,
|
||||
"invalid token inside syntax: {}",
|
||||
"invalid token inside syntax: {s}",
|
||||
.{end_tag_name},
|
||||
);
|
||||
}
|
||||
_ = try eatToken(tokenizer, Token.Id.BracketClose);
|
||||
try nodes.append(Node{ .Syntax = content_tok });
|
||||
} else {
|
||||
return parseError(tokenizer, tag_token, "unrecognized tag name: {}", .{tag_name});
|
||||
return parseError(tokenizer, tag_token, "unrecognized tag name: {s}", .{tag_name});
|
||||
}
|
||||
},
|
||||
else => return parseError(tokenizer, token, "invalid token", .{}),
|
||||
@ -615,7 +615,7 @@ fn urlize(allocator: *mem.Allocator, input: []const u8) ![]u8 {
|
||||
var buf = std.ArrayList(u8).init(allocator);
|
||||
defer buf.deinit();
|
||||
|
||||
const out = buf.outStream();
|
||||
const out = buf.writer();
|
||||
for (input) |c| {
|
||||
switch (c) {
|
||||
'a'...'z', 'A'...'Z', '_', '-', '0'...'9' => {
|
||||
@ -634,7 +634,7 @@ fn escapeHtml(allocator: *mem.Allocator, input: []const u8) ![]u8 {
|
||||
var buf = std.ArrayList(u8).init(allocator);
|
||||
defer buf.deinit();
|
||||
|
||||
const out = buf.outStream();
|
||||
const out = buf.writer();
|
||||
try writeEscaped(out, input);
|
||||
return buf.toOwnedSlice();
|
||||
}
|
||||
@ -680,7 +680,7 @@ fn termColor(allocator: *mem.Allocator, input: []const u8) ![]u8 {
|
||||
var buf = std.ArrayList(u8).init(allocator);
|
||||
defer buf.deinit();
|
||||
|
||||
var out = buf.outStream();
|
||||
var out = buf.writer();
|
||||
var number_start_index: usize = undefined;
|
||||
var first_number: usize = undefined;
|
||||
var second_number: usize = undefined;
|
||||
@ -744,7 +744,7 @@ fn termColor(allocator: *mem.Allocator, input: []const u8) ![]u8 {
|
||||
try out.writeAll("</span>");
|
||||
}
|
||||
if (first_number != 0 or second_number != 0) {
|
||||
try out.print("<span class=\"t{}_{}\">", .{ first_number, second_number });
|
||||
try out.print("<span class=\"t{d}_{d}\">", .{ first_number, second_number });
|
||||
open_span_count += 1;
|
||||
}
|
||||
},
|
||||
@ -781,106 +781,119 @@ fn tokenizeAndPrintRaw(docgen_tokenizer: *Tokenizer, out: anytype, source_token:
|
||||
next_tok_is_fn = false;
|
||||
|
||||
const token = tokenizer.next();
|
||||
try writeEscaped(out, src[index..token.loc.start]);
|
||||
switch (token.id) {
|
||||
.Eof => break,
|
||||
if (mem.indexOf(u8, src[index..token.loc.start], "//")) |comment_start_off| {
|
||||
// render one comment
|
||||
const comment_start = index + comment_start_off;
|
||||
const comment_end_off = mem.indexOf(u8, src[comment_start .. token.loc.start], "\n");
|
||||
const comment_end = if (comment_end_off) |o| comment_start + o else token.loc.start;
|
||||
|
||||
.Keyword_align,
|
||||
.Keyword_and,
|
||||
.Keyword_asm,
|
||||
.Keyword_async,
|
||||
.Keyword_await,
|
||||
.Keyword_break,
|
||||
.Keyword_catch,
|
||||
.Keyword_comptime,
|
||||
.Keyword_const,
|
||||
.Keyword_continue,
|
||||
.Keyword_defer,
|
||||
.Keyword_else,
|
||||
.Keyword_enum,
|
||||
.Keyword_errdefer,
|
||||
.Keyword_error,
|
||||
.Keyword_export,
|
||||
.Keyword_extern,
|
||||
.Keyword_for,
|
||||
.Keyword_if,
|
||||
.Keyword_inline,
|
||||
.Keyword_noalias,
|
||||
.Keyword_noinline,
|
||||
.Keyword_nosuspend,
|
||||
.Keyword_opaque,
|
||||
.Keyword_or,
|
||||
.Keyword_orelse,
|
||||
.Keyword_packed,
|
||||
.Keyword_anyframe,
|
||||
.Keyword_pub,
|
||||
.Keyword_resume,
|
||||
.Keyword_return,
|
||||
.Keyword_linksection,
|
||||
.Keyword_callconv,
|
||||
.Keyword_struct,
|
||||
.Keyword_suspend,
|
||||
.Keyword_switch,
|
||||
.Keyword_test,
|
||||
.Keyword_threadlocal,
|
||||
.Keyword_try,
|
||||
.Keyword_union,
|
||||
.Keyword_unreachable,
|
||||
.Keyword_usingnamespace,
|
||||
.Keyword_var,
|
||||
.Keyword_volatile,
|
||||
.Keyword_allowzero,
|
||||
.Keyword_while,
|
||||
.Keyword_anytype,
|
||||
try writeEscaped(out, src[index..comment_start]);
|
||||
try out.writeAll("<span class=\"tok-comment\">");
|
||||
try writeEscaped(out, src[comment_start .. comment_end]);
|
||||
try out.writeAll("</span>");
|
||||
index = comment_end;
|
||||
tokenizer.index = index;
|
||||
continue;
|
||||
}
|
||||
|
||||
try writeEscaped(out, src[index..token.loc.start]);
|
||||
switch (token.tag) {
|
||||
.eof => break,
|
||||
|
||||
.keyword_align,
|
||||
.keyword_and,
|
||||
.keyword_asm,
|
||||
.keyword_async,
|
||||
.keyword_await,
|
||||
.keyword_break,
|
||||
.keyword_catch,
|
||||
.keyword_comptime,
|
||||
.keyword_const,
|
||||
.keyword_continue,
|
||||
.keyword_defer,
|
||||
.keyword_else,
|
||||
.keyword_enum,
|
||||
.keyword_errdefer,
|
||||
.keyword_error,
|
||||
.keyword_export,
|
||||
.keyword_extern,
|
||||
.keyword_for,
|
||||
.keyword_if,
|
||||
.keyword_inline,
|
||||
.keyword_noalias,
|
||||
.keyword_noinline,
|
||||
.keyword_nosuspend,
|
||||
.keyword_opaque,
|
||||
.keyword_or,
|
||||
.keyword_orelse,
|
||||
.keyword_packed,
|
||||
.keyword_anyframe,
|
||||
.keyword_pub,
|
||||
.keyword_resume,
|
||||
.keyword_return,
|
||||
.keyword_linksection,
|
||||
.keyword_callconv,
|
||||
.keyword_struct,
|
||||
.keyword_suspend,
|
||||
.keyword_switch,
|
||||
.keyword_test,
|
||||
.keyword_threadlocal,
|
||||
.keyword_try,
|
||||
.keyword_union,
|
||||
.keyword_unreachable,
|
||||
.keyword_usingnamespace,
|
||||
.keyword_var,
|
||||
.keyword_volatile,
|
||||
.keyword_allowzero,
|
||||
.keyword_while,
|
||||
.keyword_anytype,
|
||||
=> {
|
||||
try out.writeAll("<span class=\"tok-kw\">");
|
||||
try writeEscaped(out, src[token.loc.start..token.loc.end]);
|
||||
try out.writeAll("</span>");
|
||||
},
|
||||
|
||||
.Keyword_fn => {
|
||||
.keyword_fn => {
|
||||
try out.writeAll("<span class=\"tok-kw\">");
|
||||
try writeEscaped(out, src[token.loc.start..token.loc.end]);
|
||||
try out.writeAll("</span>");
|
||||
next_tok_is_fn = true;
|
||||
},
|
||||
|
||||
.Keyword_undefined,
|
||||
.Keyword_null,
|
||||
.Keyword_true,
|
||||
.Keyword_false,
|
||||
.keyword_undefined,
|
||||
.keyword_null,
|
||||
.keyword_true,
|
||||
.keyword_false,
|
||||
=> {
|
||||
try out.writeAll("<span class=\"tok-null\">");
|
||||
try writeEscaped(out, src[token.loc.start..token.loc.end]);
|
||||
try out.writeAll("</span>");
|
||||
},
|
||||
|
||||
.StringLiteral,
|
||||
.MultilineStringLiteralLine,
|
||||
.CharLiteral,
|
||||
.string_literal,
|
||||
.multiline_string_literal_line,
|
||||
.char_literal,
|
||||
=> {
|
||||
try out.writeAll("<span class=\"tok-str\">");
|
||||
try writeEscaped(out, src[token.loc.start..token.loc.end]);
|
||||
try out.writeAll("</span>");
|
||||
},
|
||||
|
||||
.Builtin => {
|
||||
.builtin => {
|
||||
try out.writeAll("<span class=\"tok-builtin\">");
|
||||
try writeEscaped(out, src[token.loc.start..token.loc.end]);
|
||||
try out.writeAll("</span>");
|
||||
},
|
||||
|
||||
.LineComment,
|
||||
.DocComment,
|
||||
.ContainerDocComment,
|
||||
.ShebangLine,
|
||||
.doc_comment,
|
||||
.container_doc_comment,
|
||||
=> {
|
||||
try out.writeAll("<span class=\"tok-comment\">");
|
||||
try writeEscaped(out, src[token.loc.start..token.loc.end]);
|
||||
try out.writeAll("</span>");
|
||||
},
|
||||
|
||||
.Identifier => {
|
||||
.identifier => {
|
||||
if (prev_tok_was_fn) {
|
||||
try out.writeAll("<span class=\"tok-fn\">");
|
||||
try writeEscaped(out, src[token.loc.start..token.loc.end]);
|
||||
@ -908,71 +921,71 @@ fn tokenizeAndPrintRaw(docgen_tokenizer: *Tokenizer, out: anytype, source_token:
|
||||
}
|
||||
},
|
||||
|
||||
.IntegerLiteral,
|
||||
.FloatLiteral,
|
||||
.integer_literal,
|
||||
.float_literal,
|
||||
=> {
|
||||
try out.writeAll("<span class=\"tok-number\">");
|
||||
try writeEscaped(out, src[token.loc.start..token.loc.end]);
|
||||
try out.writeAll("</span>");
|
||||
},
|
||||
|
||||
.Bang,
|
||||
.Pipe,
|
||||
.PipePipe,
|
||||
.PipeEqual,
|
||||
.Equal,
|
||||
.EqualEqual,
|
||||
.EqualAngleBracketRight,
|
||||
.BangEqual,
|
||||
.LParen,
|
||||
.RParen,
|
||||
.Semicolon,
|
||||
.Percent,
|
||||
.PercentEqual,
|
||||
.LBrace,
|
||||
.RBrace,
|
||||
.LBracket,
|
||||
.RBracket,
|
||||
.Period,
|
||||
.PeriodAsterisk,
|
||||
.Ellipsis2,
|
||||
.Ellipsis3,
|
||||
.Caret,
|
||||
.CaretEqual,
|
||||
.Plus,
|
||||
.PlusPlus,
|
||||
.PlusEqual,
|
||||
.PlusPercent,
|
||||
.PlusPercentEqual,
|
||||
.Minus,
|
||||
.MinusEqual,
|
||||
.MinusPercent,
|
||||
.MinusPercentEqual,
|
||||
.Asterisk,
|
||||
.AsteriskEqual,
|
||||
.AsteriskAsterisk,
|
||||
.AsteriskPercent,
|
||||
.AsteriskPercentEqual,
|
||||
.Arrow,
|
||||
.Colon,
|
||||
.Slash,
|
||||
.SlashEqual,
|
||||
.Comma,
|
||||
.Ampersand,
|
||||
.AmpersandEqual,
|
||||
.QuestionMark,
|
||||
.AngleBracketLeft,
|
||||
.AngleBracketLeftEqual,
|
||||
.AngleBracketAngleBracketLeft,
|
||||
.AngleBracketAngleBracketLeftEqual,
|
||||
.AngleBracketRight,
|
||||
.AngleBracketRightEqual,
|
||||
.AngleBracketAngleBracketRight,
|
||||
.AngleBracketAngleBracketRightEqual,
|
||||
.Tilde,
|
||||
.bang,
|
||||
.pipe,
|
||||
.pipe_pipe,
|
||||
.pipe_equal,
|
||||
.equal,
|
||||
.equal_equal,
|
||||
.equal_angle_bracket_right,
|
||||
.bang_equal,
|
||||
.l_paren,
|
||||
.r_paren,
|
||||
.semicolon,
|
||||
.percent,
|
||||
.percent_equal,
|
||||
.l_brace,
|
||||
.r_brace,
|
||||
.l_bracket,
|
||||
.r_bracket,
|
||||
.period,
|
||||
.period_asterisk,
|
||||
.ellipsis2,
|
||||
.ellipsis3,
|
||||
.caret,
|
||||
.caret_equal,
|
||||
.plus,
|
||||
.plus_plus,
|
||||
.plus_equal,
|
||||
.plus_percent,
|
||||
.plus_percent_equal,
|
||||
.minus,
|
||||
.minus_equal,
|
||||
.minus_percent,
|
||||
.minus_percent_equal,
|
||||
.asterisk,
|
||||
.asterisk_equal,
|
||||
.asterisk_asterisk,
|
||||
.asterisk_percent,
|
||||
.asterisk_percent_equal,
|
||||
.arrow,
|
||||
.colon,
|
||||
.slash,
|
||||
.slash_equal,
|
||||
.comma,
|
||||
.ampersand,
|
||||
.ampersand_equal,
|
||||
.question_mark,
|
||||
.angle_bracket_left,
|
||||
.angle_bracket_left_equal,
|
||||
.angle_bracket_angle_bracket_left,
|
||||
.angle_bracket_angle_bracket_left_equal,
|
||||
.angle_bracket_right,
|
||||
.angle_bracket_right_equal,
|
||||
.angle_bracket_angle_bracket_right,
|
||||
.angle_bracket_angle_bracket_right_equal,
|
||||
.tilde,
|
||||
=> try writeEscaped(out, src[token.loc.start..token.loc.end]),
|
||||
|
||||
.Invalid, .Invalid_ampersands, .Invalid_periodasterisks => return parseError(
|
||||
.invalid, .invalid_ampersands, .invalid_periodasterisks => return parseError(
|
||||
docgen_tokenizer,
|
||||
source_token,
|
||||
"syntax error",
|
||||
@ -1004,9 +1017,9 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: any
|
||||
},
|
||||
.Link => |info| {
|
||||
if (!toc.urls.contains(info.url)) {
|
||||
return parseError(tokenizer, info.token, "url not found: {}", .{info.url});
|
||||
return parseError(tokenizer, info.token, "url not found: {s}", .{info.url});
|
||||
}
|
||||
try out.print("<a href=\"#{}\">{}</a>", .{ info.url, info.name });
|
||||
try out.print("<a href=\"#{s}\">{s}</a>", .{ info.url, info.name });
|
||||
},
|
||||
.Nav => {
|
||||
try out.writeAll(toc.toc);
|
||||
@ -1018,7 +1031,7 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: any
|
||||
},
|
||||
.HeaderOpen => |info| {
|
||||
try out.print(
|
||||
"<h{} id=\"{}\"><a href=\"#toc-{}\">{}</a> <a class=\"hdr\" href=\"#{}\">§</a></h{}>\n",
|
||||
"<h{d} id=\"{s}\"><a href=\"#toc-{s}\">{s}</a> <a class=\"hdr\" href=\"#{s}\">§</a></h{d}>\n",
|
||||
.{ info.n, info.url, info.url, info.name, info.url, info.n },
|
||||
);
|
||||
},
|
||||
@ -1027,9 +1040,9 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: any
|
||||
for (items) |item| {
|
||||
const url = try urlize(allocator, item.name);
|
||||
if (!toc.urls.contains(url)) {
|
||||
return parseError(tokenizer, item.token, "url not found: {}", .{url});
|
||||
return parseError(tokenizer, item.token, "url not found: {s}", .{url});
|
||||
}
|
||||
try out.print("<li><a href=\"#{}\">{}</a></li>\n", .{ url, item.name });
|
||||
try out.print("<li><a href=\"#{s}\">{s}</a></li>\n", .{ url, item.name });
|
||||
}
|
||||
try out.writeAll("</ul>\n");
|
||||
},
|
||||
@ -1043,12 +1056,12 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: any
|
||||
const raw_source = tokenizer.buffer[code.source_token.start..code.source_token.end];
|
||||
const trimmed_raw_source = mem.trim(u8, raw_source, " \n");
|
||||
if (!code.is_inline) {
|
||||
try out.print("<p class=\"file\">{}.zig</p>", .{code.name});
|
||||
try out.print("<p class=\"file\">{s}.zig</p>", .{code.name});
|
||||
}
|
||||
try out.writeAll("<pre>");
|
||||
try tokenizeAndPrint(tokenizer, out, code.source_token);
|
||||
try out.writeAll("</pre>");
|
||||
const name_plus_ext = try std.fmt.allocPrint(allocator, "{}.zig", .{code.name});
|
||||
const name_plus_ext = try std.fmt.allocPrint(allocator, "{s}.zig", .{code.name});
|
||||
const tmp_source_file_name = try fs.path.join(
|
||||
allocator,
|
||||
&[_][]const u8{ tmp_dir_name, name_plus_ext },
|
||||
@ -1057,7 +1070,7 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: any
|
||||
|
||||
switch (code.id) {
|
||||
Code.Id.Exe => |expected_outcome| code_block: {
|
||||
const name_plus_bin_ext = try std.fmt.allocPrint(allocator, "{}{}", .{ code.name, exe_ext });
|
||||
const name_plus_bin_ext = try std.fmt.allocPrint(allocator, "{s}{s}", .{ code.name, exe_ext });
|
||||
var build_args = std.ArrayList([]const u8).init(allocator);
|
||||
defer build_args.deinit();
|
||||
try build_args.appendSlice(&[_][]const u8{
|
||||
@ -1066,7 +1079,7 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: any
|
||||
"--color", "on",
|
||||
"--enable-cache", tmp_source_file_name,
|
||||
});
|
||||
try out.print("<pre><code class=\"shell\">$ zig build-exe {}.zig", .{code.name});
|
||||
try out.print("<pre><code class=\"shell\">$ zig build-exe {s}.zig", .{code.name});
|
||||
switch (code.mode) {
|
||||
.Debug => {},
|
||||
else => {
|
||||
@ -1075,7 +1088,7 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: any
|
||||
},
|
||||
}
|
||||
for (code.link_objects) |link_object| {
|
||||
const name_with_ext = try std.fmt.allocPrint(allocator, "{}{}", .{ link_object, obj_ext });
|
||||
const name_with_ext = try std.fmt.allocPrint(allocator, "{s}{s}", .{ link_object, obj_ext });
|
||||
const full_path_object = try fs.path.join(
|
||||
allocator,
|
||||
&[_][]const u8{ tmp_dir_name, name_with_ext },
|
||||
@ -1093,7 +1106,7 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: any
|
||||
if (code.target_str) |triple| {
|
||||
try build_args.appendSlice(&[_][]const u8{ "-target", triple });
|
||||
if (!code.is_inline) {
|
||||
try out.print(" -target {}", .{triple});
|
||||
try out.print(" -target {s}", .{triple});
|
||||
}
|
||||
}
|
||||
if (expected_outcome == .BuildFail) {
|
||||
@ -1106,20 +1119,20 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: any
|
||||
switch (result.term) {
|
||||
.Exited => |exit_code| {
|
||||
if (exit_code == 0) {
|
||||
print("{}\nThe following command incorrectly succeeded:\n", .{result.stderr});
|
||||
print("{s}\nThe following command incorrectly succeeded:\n", .{result.stderr});
|
||||
dumpArgs(build_args.items);
|
||||
return parseError(tokenizer, code.source_token, "example incorrectly compiled", .{});
|
||||
}
|
||||
},
|
||||
else => {
|
||||
print("{}\nThe following command crashed:\n", .{result.stderr});
|
||||
print("{s}\nThe following command crashed:\n", .{result.stderr});
|
||||
dumpArgs(build_args.items);
|
||||
return parseError(tokenizer, code.source_token, "example compile crashed", .{});
|
||||
},
|
||||
}
|
||||
const escaped_stderr = try escapeHtml(allocator, result.stderr);
|
||||
const colored_stderr = try termColor(allocator, escaped_stderr);
|
||||
try out.print("\n{}</code></pre>\n", .{colored_stderr});
|
||||
try out.print("\n{s}</code></pre>\n", .{colored_stderr});
|
||||
break :code_block;
|
||||
}
|
||||
const exec_result = exec(allocator, &env_map, build_args.items) catch
|
||||
@ -1138,7 +1151,7 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: any
|
||||
}
|
||||
|
||||
const path_to_exe_dir = mem.trim(u8, exec_result.stdout, " \r\n");
|
||||
const path_to_exe_basename = try std.fmt.allocPrint(allocator, "{}{}", .{
|
||||
const path_to_exe_basename = try std.fmt.allocPrint(allocator, "{s}{s}", .{
|
||||
code.name,
|
||||
target.exeFileExt(),
|
||||
});
|
||||
@ -1160,7 +1173,7 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: any
|
||||
switch (result.term) {
|
||||
.Exited => |exit_code| {
|
||||
if (exit_code == 0) {
|
||||
print("{}\nThe following command incorrectly succeeded:\n", .{result.stderr});
|
||||
print("{s}\nThe following command incorrectly succeeded:\n", .{result.stderr});
|
||||
dumpArgs(run_args);
|
||||
return parseError(tokenizer, code.source_token, "example incorrectly compiled", .{});
|
||||
}
|
||||
@ -1179,7 +1192,7 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: any
|
||||
const colored_stderr = try termColor(allocator, escaped_stderr);
|
||||
const colored_stdout = try termColor(allocator, escaped_stdout);
|
||||
|
||||
try out.print("\n$ ./{}\n{}{}", .{ code.name, colored_stdout, colored_stderr });
|
||||
try out.print("\n$ ./{s}\n{s}{s}", .{ code.name, colored_stdout, colored_stderr });
|
||||
if (exited_with_signal) {
|
||||
try out.print("(process terminated by signal)", .{});
|
||||
}
|
||||
@ -1190,7 +1203,7 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: any
|
||||
defer test_args.deinit();
|
||||
|
||||
try test_args.appendSlice(&[_][]const u8{ zig_exe, "test", tmp_source_file_name });
|
||||
try out.print("<pre><code class=\"shell\">$ zig test {}.zig", .{code.name});
|
||||
try out.print("<pre><code class=\"shell\">$ zig test {s}.zig", .{code.name});
|
||||
switch (code.mode) {
|
||||
.Debug => {},
|
||||
else => {
|
||||
@ -1204,12 +1217,12 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: any
|
||||
}
|
||||
if (code.target_str) |triple| {
|
||||
try test_args.appendSlice(&[_][]const u8{ "-target", triple });
|
||||
try out.print(" -target {}", .{triple});
|
||||
try out.print(" -target {s}", .{triple});
|
||||
}
|
||||
const result = exec(allocator, &env_map, test_args.items) catch return parseError(tokenizer, code.source_token, "test failed", .{});
|
||||
const escaped_stderr = try escapeHtml(allocator, result.stderr);
|
||||
const escaped_stdout = try escapeHtml(allocator, result.stdout);
|
||||
try out.print("\n{}{}</code></pre>\n", .{ escaped_stderr, escaped_stdout });
|
||||
try out.print("\n{s}{s}</code></pre>\n", .{ escaped_stderr, escaped_stdout });
|
||||
},
|
||||
Code.Id.TestError => |error_match| {
|
||||
var test_args = std.ArrayList([]const u8).init(allocator);
|
||||
@ -1222,7 +1235,7 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: any
|
||||
"on",
|
||||
tmp_source_file_name,
|
||||
});
|
||||
try out.print("<pre><code class=\"shell\">$ zig test {}.zig", .{code.name});
|
||||
try out.print("<pre><code class=\"shell\">$ zig test {s}.zig", .{code.name});
|
||||
switch (code.mode) {
|
||||
.Debug => {},
|
||||
else => {
|
||||
@ -1239,24 +1252,24 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: any
|
||||
switch (result.term) {
|
||||
.Exited => |exit_code| {
|
||||
if (exit_code == 0) {
|
||||
print("{}\nThe following command incorrectly succeeded:\n", .{result.stderr});
|
||||
print("{s}\nThe following command incorrectly succeeded:\n", .{result.stderr});
|
||||
dumpArgs(test_args.items);
|
||||
return parseError(tokenizer, code.source_token, "example incorrectly compiled", .{});
|
||||
}
|
||||
},
|
||||
else => {
|
||||
print("{}\nThe following command crashed:\n", .{result.stderr});
|
||||
print("{s}\nThe following command crashed:\n", .{result.stderr});
|
||||
dumpArgs(test_args.items);
|
||||
return parseError(tokenizer, code.source_token, "example compile crashed", .{});
|
||||
},
|
||||
}
|
||||
if (mem.indexOf(u8, result.stderr, error_match) == null) {
|
||||
print("{}\nExpected to find '{}' in stderr\n", .{ result.stderr, error_match });
|
||||
print("{s}\nExpected to find '{s}' in stderr\n", .{ result.stderr, error_match });
|
||||
return parseError(tokenizer, code.source_token, "example did not have expected compile error", .{});
|
||||
}
|
||||
const escaped_stderr = try escapeHtml(allocator, result.stderr);
|
||||
const colored_stderr = try termColor(allocator, escaped_stderr);
|
||||
try out.print("\n{}</code></pre>\n", .{colored_stderr});
|
||||
try out.print("\n{s}</code></pre>\n", .{colored_stderr});
|
||||
},
|
||||
|
||||
Code.Id.TestSafety => |error_match| {
|
||||
@ -1294,31 +1307,31 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: any
|
||||
switch (result.term) {
|
||||
.Exited => |exit_code| {
|
||||
if (exit_code == 0) {
|
||||
print("{}\nThe following command incorrectly succeeded:\n", .{result.stderr});
|
||||
print("{s}\nThe following command incorrectly succeeded:\n", .{result.stderr});
|
||||
dumpArgs(test_args.items);
|
||||
return parseError(tokenizer, code.source_token, "example test incorrectly succeeded", .{});
|
||||
}
|
||||
},
|
||||
else => {
|
||||
print("{}\nThe following command crashed:\n", .{result.stderr});
|
||||
print("{s}\nThe following command crashed:\n", .{result.stderr});
|
||||
dumpArgs(test_args.items);
|
||||
return parseError(tokenizer, code.source_token, "example compile crashed", .{});
|
||||
},
|
||||
}
|
||||
if (mem.indexOf(u8, result.stderr, error_match) == null) {
|
||||
print("{}\nExpected to find '{}' in stderr\n", .{ result.stderr, error_match });
|
||||
print("{s}\nExpected to find '{s}' in stderr\n", .{ result.stderr, error_match });
|
||||
return parseError(tokenizer, code.source_token, "example did not have expected runtime safety error message", .{});
|
||||
}
|
||||
const escaped_stderr = try escapeHtml(allocator, result.stderr);
|
||||
const colored_stderr = try termColor(allocator, escaped_stderr);
|
||||
try out.print("<pre><code class=\"shell\">$ zig test {}.zig{}\n{}</code></pre>\n", .{
|
||||
try out.print("<pre><code class=\"shell\">$ zig test {s}.zig{s}\n{s}</code></pre>\n", .{
|
||||
code.name,
|
||||
mode_arg,
|
||||
colored_stderr,
|
||||
});
|
||||
},
|
||||
Code.Id.Obj => |maybe_error_match| {
|
||||
const name_plus_obj_ext = try std.fmt.allocPrint(allocator, "{}{}", .{ code.name, obj_ext });
|
||||
const name_plus_obj_ext = try std.fmt.allocPrint(allocator, "{s}{s}", .{ code.name, obj_ext });
|
||||
const tmp_obj_file_name = try fs.path.join(
|
||||
allocator,
|
||||
&[_][]const u8{ tmp_dir_name, name_plus_obj_ext },
|
||||
@ -1326,7 +1339,7 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: any
|
||||
var build_args = std.ArrayList([]const u8).init(allocator);
|
||||
defer build_args.deinit();
|
||||
|
||||
const name_plus_h_ext = try std.fmt.allocPrint(allocator, "{}.h", .{code.name});
|
||||
const name_plus_h_ext = try std.fmt.allocPrint(allocator, "{s}.h", .{code.name});
|
||||
const output_h_file_name = try fs.path.join(
|
||||
allocator,
|
||||
&[_][]const u8{ tmp_dir_name, name_plus_h_ext },
|
||||
@ -1345,7 +1358,7 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: any
|
||||
}),
|
||||
});
|
||||
if (!code.is_inline) {
|
||||
try out.print("<pre><code class=\"shell\">$ zig build-obj {}.zig", .{code.name});
|
||||
try out.print("<pre><code class=\"shell\">$ zig build-obj {s}.zig", .{code.name});
|
||||
}
|
||||
|
||||
switch (code.mode) {
|
||||
@ -1360,7 +1373,7 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: any
|
||||
|
||||
if (code.target_str) |triple| {
|
||||
try build_args.appendSlice(&[_][]const u8{ "-target", triple });
|
||||
try out.print(" -target {}", .{triple});
|
||||
try out.print(" -target {s}", .{triple});
|
||||
}
|
||||
|
||||
if (maybe_error_match) |error_match| {
|
||||
@ -1373,24 +1386,24 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: any
|
||||
switch (result.term) {
|
||||
.Exited => |exit_code| {
|
||||
if (exit_code == 0) {
|
||||
print("{}\nThe following command incorrectly succeeded:\n", .{result.stderr});
|
||||
print("{s}\nThe following command incorrectly succeeded:\n", .{result.stderr});
|
||||
dumpArgs(build_args.items);
|
||||
return parseError(tokenizer, code.source_token, "example build incorrectly succeeded", .{});
|
||||
}
|
||||
},
|
||||
else => {
|
||||
print("{}\nThe following command crashed:\n", .{result.stderr});
|
||||
print("{s}\nThe following command crashed:\n", .{result.stderr});
|
||||
dumpArgs(build_args.items);
|
||||
return parseError(tokenizer, code.source_token, "example compile crashed", .{});
|
||||
},
|
||||
}
|
||||
if (mem.indexOf(u8, result.stderr, error_match) == null) {
|
||||
print("{}\nExpected to find '{}' in stderr\n", .{ result.stderr, error_match });
|
||||
print("{s}\nExpected to find '{s}' in stderr\n", .{ result.stderr, error_match });
|
||||
return parseError(tokenizer, code.source_token, "example did not have expected compile error message", .{});
|
||||
}
|
||||
const escaped_stderr = try escapeHtml(allocator, result.stderr);
|
||||
const colored_stderr = try termColor(allocator, escaped_stderr);
|
||||
try out.print("\n{}", .{colored_stderr});
|
||||
try out.print("\n{s}", .{colored_stderr});
|
||||
} else {
|
||||
_ = exec(allocator, &env_map, build_args.items) catch return parseError(tokenizer, code.source_token, "example failed to compile", .{});
|
||||
}
|
||||
@ -1416,7 +1429,7 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: any
|
||||
tmp_dir_name, fs.path.sep_str, bin_basename,
|
||||
}),
|
||||
});
|
||||
try out.print("<pre><code class=\"shell\">$ zig build-lib {}.zig", .{code.name});
|
||||
try out.print("<pre><code class=\"shell\">$ zig build-lib {s}.zig", .{code.name});
|
||||
switch (code.mode) {
|
||||
.Debug => {},
|
||||
else => {
|
||||
@ -1426,12 +1439,12 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: any
|
||||
}
|
||||
if (code.target_str) |triple| {
|
||||
try test_args.appendSlice(&[_][]const u8{ "-target", triple });
|
||||
try out.print(" -target {}", .{triple});
|
||||
try out.print(" -target {s}", .{triple});
|
||||
}
|
||||
const result = exec(allocator, &env_map, test_args.items) catch return parseError(tokenizer, code.source_token, "test failed", .{});
|
||||
const escaped_stderr = try escapeHtml(allocator, result.stderr);
|
||||
const escaped_stdout = try escapeHtml(allocator, result.stdout);
|
||||
try out.print("\n{}{}</code></pre>\n", .{ escaped_stderr, escaped_stdout });
|
||||
try out.print("\n{s}{s}</code></pre>\n", .{ escaped_stderr, escaped_stdout });
|
||||
},
|
||||
}
|
||||
print("OK\n", .{});
|
||||
@ -1450,13 +1463,13 @@ fn exec(allocator: *mem.Allocator, env_map: *std.BufMap, args: []const []const u
|
||||
switch (result.term) {
|
||||
.Exited => |exit_code| {
|
||||
if (exit_code != 0) {
|
||||
print("{}\nThe following command exited with code {}:\n", .{ result.stderr, exit_code });
|
||||
print("{s}\nThe following command exited with code {}:\n", .{ result.stderr, exit_code });
|
||||
dumpArgs(args);
|
||||
return error.ChildExitError;
|
||||
}
|
||||
},
|
||||
else => {
|
||||
print("{}\nThe following command crashed:\n", .{result.stderr});
|
||||
print("{s}\nThe following command crashed:\n", .{result.stderr});
|
||||
dumpArgs(args);
|
||||
return error.ChildCrashed;
|
||||
},
|
||||
@ -1471,7 +1484,7 @@ fn getBuiltinCode(allocator: *mem.Allocator, env_map: *std.BufMap, zig_exe: []co
|
||||
|
||||
fn dumpArgs(args: []const []const u8) void {
|
||||
for (args) |arg|
|
||||
print("{} ", .{arg})
|
||||
print("{s} ", .{arg})
|
||||
else
|
||||
print("\n", .{});
|
||||
}
|
||||
|
||||
@ -236,7 +236,7 @@ const std = @import("std");
|
||||
|
||||
pub fn main() !void {
|
||||
const stdout = std.io.getStdOut().writer();
|
||||
try stdout.print("Hello, {}!\n", .{"world"});
|
||||
try stdout.print("Hello, {s}!\n", .{"world"});
|
||||
}
|
||||
{#code_end#}
|
||||
<p>
|
||||
@ -308,9 +308,9 @@ pub fn main() !void {
|
||||
multiple arguments passed to a function, they are separated by commas <code>,</code>.
|
||||
</p>
|
||||
<p>
|
||||
The two arguments passed to the <code>stdout.print()</code> function, <code>"Hello, {}!\n"</code>
|
||||
The two arguments passed to the <code>stdout.print()</code> function, <code>"Hello, {s}!\n"</code>
|
||||
and <code>.{"world"}</code>, are evaluated at {#link|compile-time|comptime#}. The code sample is
|
||||
purposely written to show how to perform {#link|string|String Literals and Character Literals#}
|
||||
purposely written to show how to perform {#link|string|String Literals and Unicode Code Point Literals#}
|
||||
substitution in the <code>print</code> function. The curly-braces inside of the first argument
|
||||
are substituted with the compile-time known value inside of the second argument
|
||||
(known as an {#link|anonymous struct literal|Anonymous Struct Literals#}). The <code>\n</code>
|
||||
@ -435,7 +435,7 @@ pub fn main() void {
|
||||
var optional_value: ?[]const u8 = null;
|
||||
assert(optional_value == null);
|
||||
|
||||
print("\noptional 1\ntype: {}\nvalue: {}\n", .{
|
||||
print("\noptional 1\ntype: {s}\nvalue: {s}\n", .{
|
||||
@typeName(@TypeOf(optional_value)),
|
||||
optional_value,
|
||||
});
|
||||
@ -443,7 +443,7 @@ pub fn main() void {
|
||||
optional_value = "hi";
|
||||
assert(optional_value != null);
|
||||
|
||||
print("\noptional 2\ntype: {}\nvalue: {}\n", .{
|
||||
print("\noptional 2\ntype: {s}\nvalue: {s}\n", .{
|
||||
@typeName(@TypeOf(optional_value)),
|
||||
optional_value,
|
||||
});
|
||||
@ -451,14 +451,14 @@ pub fn main() void {
|
||||
// error union
|
||||
var number_or_error: anyerror!i32 = error.ArgNotFound;
|
||||
|
||||
print("\nerror union 1\ntype: {}\nvalue: {}\n", .{
|
||||
print("\nerror union 1\ntype: {s}\nvalue: {}\n", .{
|
||||
@typeName(@TypeOf(number_or_error)),
|
||||
number_or_error,
|
||||
});
|
||||
|
||||
number_or_error = 1234;
|
||||
|
||||
print("\nerror union 2\ntype: {}\nvalue: {}\n", .{
|
||||
print("\nerror union 2\ntype: {s}\nvalue: {}\n", .{
|
||||
@typeName(@TypeOf(number_or_error)),
|
||||
number_or_error,
|
||||
});
|
||||
@ -682,18 +682,31 @@ pub fn main() void {
|
||||
</div>
|
||||
{#see_also|Optionals|undefined#}
|
||||
{#header_close#}
|
||||
{#header_open|String Literals and Character Literals#}
|
||||
{#header_open|String Literals and Unicode Code Point Literals#}
|
||||
<p>
|
||||
String literals are single-item constant {#link|Pointers#} to null-terminated UTF-8 encoded byte arrays.
|
||||
String literals are single-item constant {#link|Pointers#} to null-terminated byte arrays.
|
||||
The type of string literals encodes both the length, and the fact that they are null-terminated,
|
||||
and thus they can be {#link|coerced|Type Coercion#} to both {#link|Slices#} and
|
||||
{#link|Null-Terminated Pointers|Sentinel-Terminated Pointers#}.
|
||||
Dereferencing string literals converts them to {#link|Arrays#}.
|
||||
</p>
|
||||
<p>
|
||||
Character literals have type {#syntax#}comptime_int{#endsyntax#}, the same as
|
||||
The encoding of a string in Zig is de-facto assumed to be UTF-8.
|
||||
Because Zig source code is {#link|UTF-8 encoded|Source Encoding#}, any non-ASCII bytes appearing within a string literal
|
||||
in source code carry their UTF-8 meaning into the content of the string in the Zig program;
|
||||
the bytes are not modified by the compiler.
|
||||
However, it is possible to embbed non-UTF-8 bytes into a string literal using <code>\xNN</code> notation.
|
||||
</p>
|
||||
<p>
|
||||
Unicode code point literals have type {#syntax#}comptime_int{#endsyntax#}, the same as
|
||||
{#link|Integer Literals#}. All {#link|Escape Sequences#} are valid in both string literals
|
||||
and character literals.
|
||||
and Unicode code point literals.
|
||||
</p>
|
||||
<p>
|
||||
In many other programming languages, a Unicode code point literal is called a "character literal".
|
||||
However, there is <a href="https://unicode.org/glossary">no precise technical definition of a "character"</a>
|
||||
in recent versions of the Unicode specification (as of Unicode 13.0).
|
||||
In Zig, a Unicode code point literal corresponds to the Unicode definition of a code point.
|
||||
</p>
|
||||
{#code_begin|test#}
|
||||
const expect = @import("std").testing.expect;
|
||||
@ -709,6 +722,7 @@ test "string literals" {
|
||||
expect('\u{1f4a9}' == 128169);
|
||||
expect('💯' == 128175);
|
||||
expect(mem.eql(u8, "hello", "h\x65llo"));
|
||||
expect("\xff"[0] == 0xff); // non-UTF-8 strings are possible with \xNN notation.
|
||||
}
|
||||
{#code_end#}
|
||||
{#see_also|Arrays|Zig Test|Source Encoding#}
|
||||
@ -749,11 +763,11 @@ test "string literals" {
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>\xNN</code></td>
|
||||
<td>hexadecimal 8-bit character code (2 digits)</td>
|
||||
<td>hexadecimal 8-bit byte value (2 digits)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>\u{NNNNNN}</code></td>
|
||||
<td>hexadecimal Unicode character code UTF-8 encoded (1 or more digits)</td>
|
||||
<td>hexadecimal Unicode code point UTF-8 encoded (1 or more digits)</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
@ -1300,10 +1314,10 @@ a /= b{#endsyntax#}</pre></td>
|
||||
<li>Can cause {#link|overflow|Default Operations#} for integers.</li>
|
||||
<li>Can cause {#link|Division by Zero#} for integers.</li>
|
||||
<li>Can cause {#link|Division by Zero#} for floats in {#link|FloatMode.Optimized Mode|Floating Point Operations#}.</li>
|
||||
<li>For non-compile-time-known signed integers, must use
|
||||
<li>Signed integer operands must be comptime-known and positive. In other cases, use
|
||||
{#link|@divTrunc#},
|
||||
{#link|@divFloor#}, or
|
||||
{#link|@divExact#} instead of {#syntax#}/{#endsyntax#}.
|
||||
{#link|@divExact#} instead.
|
||||
</li>
|
||||
<li>Invokes {#link|Peer Type Resolution#} for the operands.</li>
|
||||
</ul>
|
||||
@ -1325,9 +1339,9 @@ a %= b{#endsyntax#}</pre></td>
|
||||
<ul>
|
||||
<li>Can cause {#link|Division by Zero#} for integers.</li>
|
||||
<li>Can cause {#link|Division by Zero#} for floats in {#link|FloatMode.Optimized Mode|Floating Point Operations#}.</li>
|
||||
<li>For non-compile-time-known signed integers, must use
|
||||
<li>Signed or floating-point operands must be comptime-known and positive. In other cases, use
|
||||
{#link|@rem#} or
|
||||
{#link|@mod#} instead of {#syntax#}%{#endsyntax#}.
|
||||
{#link|@mod#} instead.
|
||||
</li>
|
||||
<li>Invokes {#link|Peer Type Resolution#} for the operands.</li>
|
||||
</ul>
|
||||
@ -2328,10 +2342,10 @@ const mem = std.mem;
|
||||
const fmt = std.fmt;
|
||||
|
||||
test "using slices for strings" {
|
||||
// Zig has no concept of strings. String literals are const pointers to
|
||||
// arrays of u8, and by convention parameters that are "strings" are
|
||||
// expected to be UTF-8 encoded slices of u8.
|
||||
// Here we coerce [5]u8 to []const u8
|
||||
// Zig has no concept of strings. String literals are const pointers
|
||||
// to null-terminated arrays of u8, and by convention parameters
|
||||
// that are "strings" are expected to be UTF-8 encoded slices of u8.
|
||||
// Here we coerce *const [5:0]u8 and *const [6:0]u8 to []const u8
|
||||
const hello: []const u8 = "hello";
|
||||
const world: []const u8 = "世界";
|
||||
|
||||
@ -2339,7 +2353,7 @@ test "using slices for strings" {
|
||||
// You can use slice syntax on an array to convert an array into a slice.
|
||||
const all_together_slice = all_together[0..];
|
||||
// String concatenation example.
|
||||
const hello_world = try fmt.bufPrint(all_together_slice, "{} {}", .{ hello, world });
|
||||
const hello_world = try fmt.bufPrint(all_together_slice, "{s} {s}", .{ hello, world });
|
||||
|
||||
// Generally, you can use UTF-8 and not worry about whether something is a
|
||||
// string. If you don't need to deal with individual characters, no need
|
||||
@ -2772,9 +2786,9 @@ const std = @import("std");
|
||||
|
||||
pub fn main() void {
|
||||
const Foo = struct {};
|
||||
std.debug.print("variable: {}\n", .{@typeName(Foo)});
|
||||
std.debug.print("anonymous: {}\n", .{@typeName(struct {})});
|
||||
std.debug.print("function: {}\n", .{@typeName(List(i32))});
|
||||
std.debug.print("variable: {s}\n", .{@typeName(Foo)});
|
||||
std.debug.print("anonymous: {s}\n", .{@typeName(struct {})});
|
||||
std.debug.print("function: {s}\n", .{@typeName(List(i32))});
|
||||
}
|
||||
|
||||
fn List(comptime T: type) type {
|
||||
@ -2909,15 +2923,15 @@ test "enum variant switch" {
|
||||
expect(mem.eql(u8, what_is_it, "this is a number"));
|
||||
}
|
||||
|
||||
// @TagType can be used to access the integer tag type of an enum.
|
||||
// @typeInfo can be used to access the integer tag type of an enum.
|
||||
const Small = enum {
|
||||
one,
|
||||
two,
|
||||
three,
|
||||
four,
|
||||
};
|
||||
test "@TagType" {
|
||||
expect(@TagType(Small) == u2);
|
||||
test "std.meta.Tag" {
|
||||
expect(@typeInfo(Small).Enum.tag_type == u2);
|
||||
}
|
||||
|
||||
// @typeInfo tells us the field count and the fields names:
|
||||
@ -3092,8 +3106,7 @@ test "simple union" {
|
||||
{#header_open|Tagged union#}
|
||||
<p>Unions can be declared with an enum tag type.
|
||||
This turns the union into a <em>tagged</em> union, which makes it eligible
|
||||
to use with {#link|switch#} expressions. One can use {#link|@TagType#} to
|
||||
obtain the enum type from the union type.
|
||||
to use with {#link|switch#} expressions.
|
||||
Tagged unions coerce to their tag type: {#link|Type Coercion: unions and enums#}.
|
||||
</p>
|
||||
{#code_begin|test#}
|
||||
@ -3119,8 +3132,8 @@ test "switch on tagged union" {
|
||||
}
|
||||
}
|
||||
|
||||
test "@TagType" {
|
||||
expect(@TagType(ComplexType) == ComplexTypeTag);
|
||||
test "get tag type" {
|
||||
expect(std.meta.Tag(ComplexType) == ComplexTypeTag);
|
||||
}
|
||||
|
||||
test "coerce to enum" {
|
||||
@ -4241,9 +4254,9 @@ fn _start() callconv(.Naked) noreturn {
|
||||
abort();
|
||||
}
|
||||
|
||||
// The inline specifier forces a function to be inlined at all call sites.
|
||||
// The inline calling convention forces a function to be inlined at all call sites.
|
||||
// If the function cannot be inlined, it is a compile-time error.
|
||||
inline fn shiftLeftOne(a: u32) u32 {
|
||||
fn shiftLeftOne(a: u32) callconv(.Inline) u32 {
|
||||
return a << 1;
|
||||
}
|
||||
|
||||
@ -6110,7 +6123,7 @@ const a_number: i32 = 1234;
|
||||
const a_string = "foobar";
|
||||
|
||||
pub fn main() void {
|
||||
print("here is a string: '{}' here is a number: {}\n", .{a_string, a_number});
|
||||
print("here is a string: '{s}' here is a number: {}\n", .{a_string, a_number});
|
||||
}
|
||||
{#code_end#}
|
||||
|
||||
@ -6120,7 +6133,7 @@ pub fn main() void {
|
||||
|
||||
{#code_begin|syntax#}
|
||||
/// Calls print and then flushes the buffer.
|
||||
pub fn printf(self: *OutStream, comptime format: []const u8, args: anytype) anyerror!void {
|
||||
pub fn printf(self: *Writer, comptime format: []const u8, args: anytype) anyerror!void {
|
||||
const State = enum {
|
||||
start,
|
||||
open_brace,
|
||||
@ -6192,7 +6205,7 @@ pub fn printf(self: *OutStream, comptime format: []const u8, args: anytype) anye
|
||||
and emits a function that actually looks like this:
|
||||
</p>
|
||||
{#code_begin|syntax#}
|
||||
pub fn printf(self: *OutStream, arg0: i32, arg1: []const u8) !void {
|
||||
pub fn printf(self: *Writer, arg0: i32, arg1: []const u8) !void {
|
||||
try self.write("here is a string: '");
|
||||
try self.printValue(arg0);
|
||||
try self.write("' here is a number: ");
|
||||
@ -6206,7 +6219,7 @@ pub fn printf(self: *OutStream, arg0: i32, arg1: []const u8) !void {
|
||||
on the type:
|
||||
</p>
|
||||
{#code_begin|syntax#}
|
||||
pub fn printValue(self: *OutStream, value: anytype) !void {
|
||||
pub fn printValue(self: *Writer, value: anytype) !void {
|
||||
switch (@typeInfo(@TypeOf(value))) {
|
||||
.Int => {
|
||||
return self.printInt(T, value);
|
||||
@ -6230,7 +6243,7 @@ const a_number: i32 = 1234;
|
||||
const a_string = "foobar";
|
||||
|
||||
test "printf too many arguments" {
|
||||
print("here is a string: '{}' here is a number: {}\n", .{
|
||||
print("here is a string: '{s}' here is a number: {}\n", .{
|
||||
a_string,
|
||||
a_number,
|
||||
a_number,
|
||||
@ -6249,7 +6262,7 @@ const print = @import("std").debug.print;
|
||||
|
||||
const a_number: i32 = 1234;
|
||||
const a_string = "foobar";
|
||||
const fmt = "here is a string: '{}' here is a number: {}\n";
|
||||
const fmt = "here is a string: '{s}' here is a number: {}\n";
|
||||
|
||||
pub fn main() void {
|
||||
print(fmt, .{a_string, a_number});
|
||||
@ -6720,8 +6733,8 @@ fn amain() !void {
|
||||
const download_text = try await download_frame;
|
||||
defer allocator.free(download_text);
|
||||
|
||||
std.debug.print("download_text: {}\n", .{download_text});
|
||||
std.debug.print("file_text: {}\n", .{file_text});
|
||||
std.debug.print("download_text: {s}\n", .{download_text});
|
||||
std.debug.print("file_text: {s}\n", .{file_text});
|
||||
}
|
||||
|
||||
var global_download_frame: anyframe = undefined;
|
||||
@ -6790,8 +6803,8 @@ fn amain() !void {
|
||||
const download_text = try await download_frame;
|
||||
defer allocator.free(download_text);
|
||||
|
||||
std.debug.print("download_text: {}\n", .{download_text});
|
||||
std.debug.print("file_text: {}\n", .{file_text});
|
||||
std.debug.print("download_text: {s}\n", .{download_text});
|
||||
std.debug.print("file_text: {s}\n", .{file_text});
|
||||
}
|
||||
|
||||
fn fetchUrl(allocator: *Allocator, url: []const u8) ![]u8 {
|
||||
@ -7415,7 +7428,7 @@ test "main" {
|
||||
This function returns a compile time constant pointer to null-terminated,
|
||||
fixed-size array with length equal to the byte count of the file given by
|
||||
{#syntax#}path{#endsyntax#}. The contents of the array are the contents of the file.
|
||||
This is equivalent to a {#link|string literal|String Literals and Character Literals#}
|
||||
This is equivalent to a {#link|string literal|String Literals and Unicode Code Point Literals#}
|
||||
with the file contents.
|
||||
</p>
|
||||
<p>
|
||||
@ -7534,19 +7547,21 @@ export fn @"A function name that is a complete sentence."() void {}
|
||||
|
||||
{#header_open|@field#}
|
||||
<pre>{#syntax#}@field(lhs: anytype, comptime field_name: []const u8) (field){#endsyntax#}</pre>
|
||||
<p>Performs field access by a compile-time string.
|
||||
<p>Performs field access by a compile-time string. Works on both fields and declarations.
|
||||
</p>
|
||||
{#code_begin|test#}
|
||||
const std = @import("std");
|
||||
|
||||
const Point = struct {
|
||||
x: u32,
|
||||
y: u32
|
||||
y: u32,
|
||||
|
||||
pub var z: u32 = 1;
|
||||
};
|
||||
|
||||
test "field access by string" {
|
||||
const expect = std.testing.expect;
|
||||
var p = Point {.x = 0, .y = 0};
|
||||
var p = Point{ .x = 0, .y = 0 };
|
||||
|
||||
@field(p, "x") = 4;
|
||||
@field(p, "y") = @field(p, "x") + 1;
|
||||
@ -7554,6 +7569,15 @@ test "field access by string" {
|
||||
expect(@field(p, "x") == 4);
|
||||
expect(@field(p, "y") == 5);
|
||||
}
|
||||
|
||||
test "decl access by string" {
|
||||
const expect = std.testing.expect;
|
||||
|
||||
expect(@field(Point, "z") == 1);
|
||||
|
||||
@field(Point, "z") = 2;
|
||||
expect(@field(Point, "z") == 2);
|
||||
}
|
||||
{#code_end#}
|
||||
|
||||
{#header_close#}
|
||||
@ -7740,7 +7764,7 @@ test "@hasDecl" {
|
||||
{#header_close#}
|
||||
|
||||
{#header_open|@intToEnum#}
|
||||
<pre>{#syntax#}@intToEnum(comptime DestType: type, int_value: @TagType(DestType)) DestType{#endsyntax#}</pre>
|
||||
<pre>{#syntax#}@intToEnum(comptime DestType: type, int_value: std.meta.Tag(DestType)) DestType{#endsyntax#}</pre>
|
||||
<p>
|
||||
Converts an integer into an {#link|enum#} value.
|
||||
</p>
|
||||
@ -8435,16 +8459,6 @@ fn doTheTest() void {
|
||||
</p>
|
||||
{#header_close#}
|
||||
|
||||
{#header_open|@TagType#}
|
||||
<pre>{#syntax#}@TagType(T: type) type{#endsyntax#}</pre>
|
||||
<p>
|
||||
For an enum, returns the integer type that is used to store the enumeration value.
|
||||
</p>
|
||||
<p>
|
||||
For a union, returns the enum type that is used to store the tag value.
|
||||
</p>
|
||||
{#header_close#}
|
||||
|
||||
{#header_open|@This#}
|
||||
<pre>{#syntax#}@This() type{#endsyntax#}</pre>
|
||||
<p>
|
||||
@ -8848,7 +8862,7 @@ pub fn main() !void {
|
||||
var byte: u8 = 255;
|
||||
|
||||
byte = if (math.add(u8, byte, 1)) |result| result else |err| {
|
||||
print("unable to add one: {}\n", .{@errorName(err)});
|
||||
print("unable to add one: {s}\n", .{@errorName(err)});
|
||||
return err;
|
||||
};
|
||||
|
||||
@ -9078,7 +9092,7 @@ pub fn main() void {
|
||||
if (result) |number| {
|
||||
print("got number: {}\n", .{number});
|
||||
} else |err| {
|
||||
print("got error: {}\n", .{@errorName(err)});
|
||||
print("got error: {s}\n", .{@errorName(err)});
|
||||
}
|
||||
}
|
||||
|
||||
@ -9135,7 +9149,7 @@ const Foo = enum {
|
||||
pub fn main() void {
|
||||
var a: u2 = 3;
|
||||
var b = @intToEnum(Foo, a);
|
||||
std.debug.print("value: {}\n", .{@tagName(b)});
|
||||
std.debug.print("value: {s}\n", .{@tagName(b)});
|
||||
}
|
||||
{#code_end#}
|
||||
{#header_close#}
|
||||
@ -10025,7 +10039,7 @@ pub fn main() !void {
|
||||
defer std.process.argsFree(gpa, args);
|
||||
|
||||
for (args) |arg, i| {
|
||||
std.debug.print("{}: {}\n", .{ i, arg });
|
||||
std.debug.print("{}: {s}\n", .{ i, arg });
|
||||
}
|
||||
}
|
||||
{#code_end#}
|
||||
|
||||
@ -365,6 +365,12 @@ struct iovec { void *iov_base; size_t iov_len; };
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(__NEED_struct_winsize) && !defined(__DEFINED_struct_winsize)
|
||||
struct winsize { unsigned short ws_row, ws_col, ws_xpixel, ws_ypixel; };
|
||||
#define __DEFINED_struct_winsize
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(__NEED_socklen_t) && !defined(__DEFINED_socklen_t)
|
||||
typedef unsigned socklen_t;
|
||||
#define __DEFINED_socklen_t
|
||||
|
||||
@ -37,4 +37,14 @@
|
||||
#define HWCAP2_SVEPMULL (1 << 3)
|
||||
#define HWCAP2_SVEBITPERM (1 << 4)
|
||||
#define HWCAP2_SVESHA3 (1 << 5)
|
||||
#define HWCAP2_SVESM4 (1 << 6)
|
||||
#define HWCAP2_SVESM4 (1 << 6)
|
||||
#define HWCAP2_FLAGM2 (1 << 7)
|
||||
#define HWCAP2_FRINT (1 << 8)
|
||||
#define HWCAP2_SVEI8MM (1 << 9)
|
||||
#define HWCAP2_SVEF32MM (1 << 10)
|
||||
#define HWCAP2_SVEF64MM (1 << 11)
|
||||
#define HWCAP2_SVEBF16 (1 << 12)
|
||||
#define HWCAP2_I8MM (1 << 13)
|
||||
#define HWCAP2_BF16 (1 << 14)
|
||||
#define HWCAP2_DGH (1 << 15)
|
||||
#define HWCAP2_RNG (1 << 16)
|
||||
@ -11,7 +11,7 @@ typedef unsigned long greg_t;
|
||||
typedef unsigned long gregset_t[34];
|
||||
|
||||
typedef struct {
|
||||
long double vregs[32];
|
||||
__uint128_t vregs[32];
|
||||
unsigned int fpsr;
|
||||
unsigned int fpcr;
|
||||
} fpregset_t;
|
||||
@ -34,7 +34,7 @@ struct fpsimd_context {
|
||||
struct _aarch64_ctx head;
|
||||
unsigned int fpsr;
|
||||
unsigned int fpcr;
|
||||
long double vregs[32];
|
||||
__uint128_t vregs[32];
|
||||
};
|
||||
struct esr_context {
|
||||
struct _aarch64_ctx head;
|
||||
|
||||
@ -289,6 +289,10 @@
|
||||
#define __NR_fspick 433
|
||||
#define __NR_pidfd_open 434
|
||||
#define __NR_clone3 435
|
||||
#define __NR_close_range 436
|
||||
#define __NR_openat2 437
|
||||
#define __NR_pidfd_getfd 438
|
||||
#define __NR_faccessat2 439
|
||||
|
||||
#define SYS_io_setup 0
|
||||
#define SYS_io_destroy 1
|
||||
@ -580,4 +584,8 @@
|
||||
#define SYS_fsmount 432
|
||||
#define SYS_fspick 433
|
||||
#define SYS_pidfd_open 434
|
||||
#define SYS_clone3 435
|
||||
#define SYS_clone3 435
|
||||
#define SYS_close_range 436
|
||||
#define SYS_openat2 437
|
||||
#define SYS_pidfd_getfd 438
|
||||
#define SYS_faccessat2 439
|
||||
@ -6,7 +6,7 @@ struct user_regs_struct {
|
||||
};
|
||||
|
||||
struct user_fpsimd_struct {
|
||||
long double vregs[32];
|
||||
__uint128_t vregs[32];
|
||||
unsigned int fpsr;
|
||||
unsigned int fpcr;
|
||||
};
|
||||
|
||||
482
lib/libc/include/aarch64-macos-gnu/Availability.h
Normal file
482
lib/libc/include/aarch64-macos-gnu/Availability.h
Normal file
@ -0,0 +1,482 @@
|
||||
/*
|
||||
* Copyright (c) 2007-2016 by Apple Inc.. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef __AVAILABILITY__
|
||||
#define __AVAILABILITY__
|
||||
/*
|
||||
These macros are for use in OS header files. They enable function prototypes
|
||||
and Objective-C methods to be tagged with the OS version in which they
|
||||
were first available; and, if applicable, the OS version in which they
|
||||
became deprecated.
|
||||
|
||||
The desktop Mac OS X and iOS each have different version numbers.
|
||||
The __OSX_AVAILABLE_STARTING() macro allows you to specify both the desktop
|
||||
and iOS version numbers. For instance:
|
||||
__OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0)
|
||||
means the function/method was first available on Mac OS X 10.2 on the desktop
|
||||
and first available in iOS 2.0 on the iPhone.
|
||||
|
||||
If a function is available on one platform, but not the other a _NA (not
|
||||
applicable) parameter is used. For instance:
|
||||
__OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_NA)
|
||||
means that the function/method was first available on Mac OS X 10.3, and it
|
||||
currently not implemented on the iPhone.
|
||||
|
||||
At some point, a function/method may be deprecated. That means Apple
|
||||
recommends applications stop using the function, either because there is a
|
||||
better replacement or the functionality is being phased out. Deprecated
|
||||
functions/methods can be tagged with a __OSX_AVAILABLE_BUT_DEPRECATED()
|
||||
macro which specifies the OS version where the function became available
|
||||
as well as the OS version in which it became deprecated. For instance:
|
||||
__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0,__MAC_10_5,__IPHONE_NA,__IPHONE_NA)
|
||||
means that the function/method was introduced in Mac OS X 10.0, then
|
||||
became deprecated beginning in Mac OS X 10.5. On iOS the function
|
||||
has never been available.
|
||||
|
||||
For these macros to function properly, a program must specify the OS version range
|
||||
it is targeting. The min OS version is specified as an option to the compiler:
|
||||
-mmacosx-version-min=10.x when building for Mac OS X, and -miphoneos-version-min=y.z
|
||||
when building for the iPhone. The upper bound for the OS version is rarely needed,
|
||||
but it can be set on the command line via: -D__MAC_OS_X_VERSION_MAX_ALLOWED=10x0 for
|
||||
Mac OS X and __IPHONE_OS_VERSION_MAX_ALLOWED = y0z00 for iOS.
|
||||
|
||||
Examples:
|
||||
|
||||
A function available in Mac OS X 10.5 and later, but not on the phone:
|
||||
|
||||
extern void mymacfunc() __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
|
||||
|
||||
|
||||
An Objective-C method in Mac OS X 10.5 and later, but not on the phone:
|
||||
|
||||
@interface MyClass : NSObject
|
||||
-(void) mymacmethod __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
|
||||
@end
|
||||
|
||||
|
||||
An enum available on the phone, but not available on Mac OS X:
|
||||
|
||||
#if __IPHONE_OS_VERSION_MIN_REQUIRED
|
||||
enum { myEnum = 1 };
|
||||
#endif
|
||||
Note: this works when targeting the Mac OS X platform because
|
||||
__IPHONE_OS_VERSION_MIN_REQUIRED is undefined which evaluates to zero.
|
||||
|
||||
|
||||
An enum with values added in different iPhoneOS versions:
|
||||
|
||||
enum {
|
||||
myX = 1, // Usable on iPhoneOS 2.1 and later
|
||||
myY = 2, // Usable on iPhoneOS 3.0 and later
|
||||
myZ = 3, // Usable on iPhoneOS 3.0 and later
|
||||
...
|
||||
Note: you do not want to use #if with enumeration values
|
||||
when a client needs to see all values at compile time
|
||||
and use runtime logic to only use the viable values.
|
||||
|
||||
|
||||
It is also possible to use the *_VERSION_MIN_REQUIRED in source code to make one
|
||||
source base that can be compiled to target a range of OS versions. It is best
|
||||
to not use the _MAC_* and __IPHONE_* macros for comparisons, but rather their values.
|
||||
That is because you might get compiled on an old OS that does not define a later
|
||||
OS version macro, and in the C preprocessor undefined values evaluate to zero
|
||||
in expresssions, which could cause the #if expression to evaluate in an unexpected
|
||||
way.
|
||||
|
||||
#ifdef __MAC_OS_X_VERSION_MIN_REQUIRED
|
||||
// code only compiled when targeting Mac OS X and not iPhone
|
||||
// note use of 1050 instead of __MAC_10_5
|
||||
#if __MAC_OS_X_VERSION_MIN_REQUIRED < 1050
|
||||
// code in here might run on pre-Leopard OS
|
||||
#else
|
||||
// code here can assume Leopard or later
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
* __API_TO_BE_DEPRECATED is used as a version number in API that will be deprecated
|
||||
* in an upcoming release. This soft deprecation is an intermediate step before formal
|
||||
* deprecation to notify developers about the API before compiler warnings are generated.
|
||||
* You can find all places in your code that use soft deprecated API by redefining the
|
||||
* value of this macro to your current minimum deployment target, for example:
|
||||
* (macOS)
|
||||
* clang -D__API_TO_BE_DEPRECATED=10.12 <other compiler flags>
|
||||
* (iOS)
|
||||
* clang -D__API_TO_BE_DEPRECATED=11.0 <other compiler flags>
|
||||
*/
|
||||
|
||||
#ifndef __API_TO_BE_DEPRECATED
|
||||
#define __API_TO_BE_DEPRECATED 100000
|
||||
#endif
|
||||
|
||||
#include <AvailabilityVersions.h>
|
||||
#include <AvailabilityInternal.h>
|
||||
|
||||
#ifdef __IPHONE_OS_VERSION_MIN_REQUIRED
|
||||
#define __OSX_AVAILABLE_STARTING(_osx, _ios) __AVAILABILITY_INTERNAL##_ios
|
||||
#define __OSX_AVAILABLE_BUT_DEPRECATED(_osxIntro, _osxDep, _iosIntro, _iosDep) \
|
||||
__AVAILABILITY_INTERNAL##_iosIntro##_DEP##_iosDep
|
||||
#define __OSX_AVAILABLE_BUT_DEPRECATED_MSG(_osxIntro, _osxDep, _iosIntro, _iosDep, _msg) \
|
||||
__AVAILABILITY_INTERNAL##_iosIntro##_DEP##_iosDep##_MSG(_msg)
|
||||
|
||||
#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
|
||||
|
||||
#if defined(__has_builtin)
|
||||
#if __has_builtin(__is_target_arch)
|
||||
#if __has_builtin(__is_target_vendor)
|
||||
#if __has_builtin(__is_target_os)
|
||||
#if __has_builtin(__is_target_environment)
|
||||
#if __has_builtin(__is_target_variant_os)
|
||||
#if __has_builtin(__is_target_variant_environment)
|
||||
#if (__is_target_arch(x86_64) && __is_target_vendor(apple) && ((__is_target_os(ios) && __is_target_environment(macabi)) || (__is_target_variant_os(ios) && __is_target_variant_environment(macabi))))
|
||||
#define __OSX_AVAILABLE_STARTING(_osx, _ios) __AVAILABILITY_INTERNAL##_osx __AVAILABILITY_INTERNAL##_ios
|
||||
#define __OSX_AVAILABLE_BUT_DEPRECATED(_osxIntro, _osxDep, _iosIntro, _iosDep) \
|
||||
__AVAILABILITY_INTERNAL##_osxIntro##_DEP##_osxDep __AVAILABILITY_INTERNAL##_iosIntro##_DEP##_iosDep
|
||||
#define __OSX_AVAILABLE_BUT_DEPRECATED_MSG(_osxIntro, _osxDep, _iosIntro, _iosDep, _msg) \
|
||||
__AVAILABILITY_INTERNAL##_osxIntro##_DEP##_osxDep##_MSG(_msg) __AVAILABILITY_INTERNAL##_iosIntro##_DEP##_iosDep##_MSG(_msg)
|
||||
#endif /* # if __is_target_arch... */
|
||||
#endif /* #if __has_builtin(__is_target_variant_environment) */
|
||||
#endif /* #if __has_builtin(__is_target_variant_os) */
|
||||
#endif /* #if __has_builtin(__is_target_environment) */
|
||||
#endif /* #if __has_builtin(__is_target_os) */
|
||||
#endif /* #if __has_builtin(__is_target_vendor) */
|
||||
#endif /* #if __has_builtin(__is_target_arch) */
|
||||
#endif /* #if defined(__has_builtin) */
|
||||
|
||||
#ifndef __OSX_AVAILABLE_STARTING
|
||||
#if defined(__has_attribute) && defined(__has_feature)
|
||||
#if __has_attribute(availability)
|
||||
#define __OSX_AVAILABLE_STARTING(_osx, _ios) __AVAILABILITY_INTERNAL##_osx
|
||||
#define __OSX_AVAILABLE_BUT_DEPRECATED(_osxIntro, _osxDep, _iosIntro, _iosDep) \
|
||||
__AVAILABILITY_INTERNAL##_osxIntro##_DEP##_osxDep
|
||||
#define __OSX_AVAILABLE_BUT_DEPRECATED_MSG(_osxIntro, _osxDep, _iosIntro, _iosDep, _msg) \
|
||||
__AVAILABILITY_INTERNAL##_osxIntro##_DEP##_osxDep##_MSG(_msg)
|
||||
#else
|
||||
#define __OSX_AVAILABLE_STARTING(_osx, _ios)
|
||||
#define __OSX_AVAILABLE_BUT_DEPRECATED(_osxIntro, _osxDep, _iosIntro, _iosDep)
|
||||
#define __OSX_AVAILABLE_BUT_DEPRECATED_MSG(_osxIntro, _osxDep, _iosIntro, _iosDep, _msg)
|
||||
#endif
|
||||
#else
|
||||
#define __OSX_AVAILABLE_STARTING(_osx, _ios)
|
||||
#define __OSX_AVAILABLE_BUT_DEPRECATED(_osxIntro, _osxDep, _iosIntro, _iosDep)
|
||||
#define __OSX_AVAILABLE_BUT_DEPRECATED_MSG(_osxIntro, _osxDep, _iosIntro, _iosDep, _msg)
|
||||
#endif
|
||||
#endif /* __OSX_AVAILABLE_STARTING */
|
||||
|
||||
#else
|
||||
#define __OSX_AVAILABLE_STARTING(_osx, _ios)
|
||||
#define __OSX_AVAILABLE_BUT_DEPRECATED(_osxIntro, _osxDep, _iosIntro, _iosDep)
|
||||
#define __OSX_AVAILABLE_BUT_DEPRECATED_MSG(_osxIntro, _osxDep, _iosIntro, _iosDep, _msg)
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(__has_feature)
|
||||
#if __has_feature(attribute_availability_with_message)
|
||||
#define __OS_AVAILABILITY(_target, _availability) __attribute__((availability(_target,_availability)))
|
||||
#define __OS_AVAILABILITY_MSG(_target, _availability, _msg) __attribute__((availability(_target,_availability,message=_msg)))
|
||||
#elif __has_feature(attribute_availability)
|
||||
#define __OS_AVAILABILITY(_target, _availability) __attribute__((availability(_target,_availability)))
|
||||
#define __OS_AVAILABILITY_MSG(_target, _availability, _msg) __attribute__((availability(_target,_availability)))
|
||||
#else
|
||||
#define __OS_AVAILABILITY(_target, _availability)
|
||||
#define __OS_AVAILABILITY_MSG(_target, _availability, _msg)
|
||||
#endif
|
||||
#else
|
||||
#define __OS_AVAILABILITY(_target, _availability)
|
||||
#define __OS_AVAILABILITY_MSG(_target, _availability, _msg)
|
||||
#endif
|
||||
|
||||
|
||||
/* for use to document app extension usage */
|
||||
#if defined(__has_feature)
|
||||
#if __has_feature(attribute_availability_app_extension)
|
||||
#define __OSX_EXTENSION_UNAVAILABLE(_msg) __OS_AVAILABILITY_MSG(macosx_app_extension,unavailable,_msg)
|
||||
#define __IOS_EXTENSION_UNAVAILABLE(_msg) __OS_AVAILABILITY_MSG(ios_app_extension,unavailable,_msg)
|
||||
#else
|
||||
#define __OSX_EXTENSION_UNAVAILABLE(_msg)
|
||||
#define __IOS_EXTENSION_UNAVAILABLE(_msg)
|
||||
#endif
|
||||
#else
|
||||
#define __OSX_EXTENSION_UNAVAILABLE(_msg)
|
||||
#define __IOS_EXTENSION_UNAVAILABLE(_msg)
|
||||
#endif
|
||||
|
||||
#define __OS_EXTENSION_UNAVAILABLE(_msg) __OSX_EXTENSION_UNAVAILABLE(_msg) __IOS_EXTENSION_UNAVAILABLE(_msg)
|
||||
|
||||
|
||||
|
||||
/* for use marking APIs available info for Mac OSX */
|
||||
#if defined(__has_attribute)
|
||||
#if __has_attribute(availability)
|
||||
#define __OSX_UNAVAILABLE __OS_AVAILABILITY(macosx,unavailable)
|
||||
#define __OSX_AVAILABLE(_vers) __OS_AVAILABILITY(macosx,introduced=_vers)
|
||||
#define __OSX_DEPRECATED(_start, _dep, _msg) __OSX_AVAILABLE(_start) __OS_AVAILABILITY_MSG(macosx,deprecated=_dep,_msg)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef __OSX_UNAVAILABLE
|
||||
#define __OSX_UNAVAILABLE
|
||||
#endif
|
||||
|
||||
#ifndef __OSX_AVAILABLE
|
||||
#define __OSX_AVAILABLE(_vers)
|
||||
#endif
|
||||
|
||||
#ifndef __OSX_DEPRECATED
|
||||
#define __OSX_DEPRECATED(_start, _dep, _msg)
|
||||
#endif
|
||||
|
||||
|
||||
/* for use marking APIs available info for iOS */
|
||||
#if defined(__has_attribute)
|
||||
#if __has_attribute(availability)
|
||||
#define __IOS_UNAVAILABLE __OS_AVAILABILITY(ios,unavailable)
|
||||
#define __IOS_PROHIBITED __OS_AVAILABILITY(ios,unavailable)
|
||||
#define __IOS_AVAILABLE(_vers) __OS_AVAILABILITY(ios,introduced=_vers)
|
||||
#define __IOS_DEPRECATED(_start, _dep, _msg) __IOS_AVAILABLE(_start) __OS_AVAILABILITY_MSG(ios,deprecated=_dep,_msg)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef __IOS_UNAVAILABLE
|
||||
#define __IOS_UNAVAILABLE
|
||||
#endif
|
||||
|
||||
#ifndef __IOS_PROHIBITED
|
||||
#define __IOS_PROHIBITED
|
||||
#endif
|
||||
|
||||
#ifndef __IOS_AVAILABLE
|
||||
#define __IOS_AVAILABLE(_vers)
|
||||
#endif
|
||||
|
||||
#ifndef __IOS_DEPRECATED
|
||||
#define __IOS_DEPRECATED(_start, _dep, _msg)
|
||||
#endif
|
||||
|
||||
|
||||
/* for use marking APIs available info for tvOS */
|
||||
#if defined(__has_feature)
|
||||
#if __has_feature(attribute_availability_tvos)
|
||||
#define __TVOS_UNAVAILABLE __OS_AVAILABILITY(tvos,unavailable)
|
||||
#define __TVOS_PROHIBITED __OS_AVAILABILITY(tvos,unavailable)
|
||||
#define __TVOS_AVAILABLE(_vers) __OS_AVAILABILITY(tvos,introduced=_vers)
|
||||
#define __TVOS_DEPRECATED(_start, _dep, _msg) __TVOS_AVAILABLE(_start) __OS_AVAILABILITY_MSG(tvos,deprecated=_dep,_msg)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef __TVOS_UNAVAILABLE
|
||||
#define __TVOS_UNAVAILABLE
|
||||
#endif
|
||||
|
||||
#ifndef __TVOS_PROHIBITED
|
||||
#define __TVOS_PROHIBITED
|
||||
#endif
|
||||
|
||||
#ifndef __TVOS_AVAILABLE
|
||||
#define __TVOS_AVAILABLE(_vers)
|
||||
#endif
|
||||
|
||||
#ifndef __TVOS_DEPRECATED
|
||||
#define __TVOS_DEPRECATED(_start, _dep, _msg)
|
||||
#endif
|
||||
|
||||
|
||||
/* for use marking APIs available info for Watch OS */
|
||||
#if defined(__has_feature)
|
||||
#if __has_feature(attribute_availability_watchos)
|
||||
#define __WATCHOS_UNAVAILABLE __OS_AVAILABILITY(watchos,unavailable)
|
||||
#define __WATCHOS_PROHIBITED __OS_AVAILABILITY(watchos,unavailable)
|
||||
#define __WATCHOS_AVAILABLE(_vers) __OS_AVAILABILITY(watchos,introduced=_vers)
|
||||
#define __WATCHOS_DEPRECATED(_start, _dep, _msg) __WATCHOS_AVAILABLE(_start) __OS_AVAILABILITY_MSG(watchos,deprecated=_dep,_msg)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef __WATCHOS_UNAVAILABLE
|
||||
#define __WATCHOS_UNAVAILABLE
|
||||
#endif
|
||||
|
||||
#ifndef __WATCHOS_PROHIBITED
|
||||
#define __WATCHOS_PROHIBITED
|
||||
#endif
|
||||
|
||||
#ifndef __WATCHOS_AVAILABLE
|
||||
#define __WATCHOS_AVAILABLE(_vers)
|
||||
#endif
|
||||
|
||||
#ifndef __WATCHOS_DEPRECATED
|
||||
#define __WATCHOS_DEPRECATED(_start, _dep, _msg)
|
||||
#endif
|
||||
|
||||
|
||||
/* for use marking APIs unavailable for swift */
|
||||
#if defined(__has_feature)
|
||||
#if __has_feature(attribute_availability_swift)
|
||||
#define __SWIFT_UNAVAILABLE __OS_AVAILABILITY(swift,unavailable)
|
||||
#define __SWIFT_UNAVAILABLE_MSG(_msg) __OS_AVAILABILITY_MSG(swift,unavailable,_msg)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef __SWIFT_UNAVAILABLE
|
||||
#define __SWIFT_UNAVAILABLE
|
||||
#endif
|
||||
|
||||
#ifndef __SWIFT_UNAVAILABLE_MSG
|
||||
#define __SWIFT_UNAVAILABLE_MSG(_msg)
|
||||
#endif
|
||||
|
||||
/*
|
||||
Macros for defining which versions/platform a given symbol can be used.
|
||||
|
||||
@see http://clang.llvm.org/docs/AttributeReference.html#availability
|
||||
|
||||
* Note that these macros are only compatible with clang compilers that
|
||||
* support the following target selection options:
|
||||
*
|
||||
* -mmacosx-version-min
|
||||
* -miphoneos-version-min
|
||||
* -mwatchos-version-min
|
||||
* -mtvos-version-min
|
||||
*/
|
||||
|
||||
#if defined(__has_feature) && defined(__has_attribute)
|
||||
#if __has_attribute(availability)
|
||||
|
||||
/*
|
||||
* API Introductions
|
||||
*
|
||||
* Use to specify the release that a particular API became available.
|
||||
*
|
||||
* Platform names:
|
||||
* macos, ios, tvos, watchos
|
||||
*
|
||||
* Examples:
|
||||
* __API_AVAILABLE(macos(10.10))
|
||||
* __API_AVAILABLE(macos(10.9), ios(10.0))
|
||||
* __API_AVAILABLE(macos(10.4), ios(8.0), watchos(2.0), tvos(10.0))
|
||||
* __API_AVAILABLE(driverkit(19.0))
|
||||
*/
|
||||
#define __API_AVAILABLE(...) __API_AVAILABLE_GET_MACRO(__VA_ARGS__,__API_AVAILABLE7, __API_AVAILABLE6, __API_AVAILABLE5, __API_AVAILABLE4, __API_AVAILABLE3, __API_AVAILABLE2, __API_AVAILABLE1, 0)(__VA_ARGS__)
|
||||
|
||||
#define __API_AVAILABLE_BEGIN(...) _Pragma("clang attribute push") __API_AVAILABLE_BEGIN_GET_MACRO(__VA_ARGS__,__API_AVAILABLE_BEGIN7, __API_AVAILABLE_BEGIN6, __API_AVAILABLE_BEGIN5, __API_AVAILABLE_BEGIN4, __API_AVAILABLE_BEGIN3, __API_AVAILABLE_BEGIN2, __API_AVAILABLE_BEGIN1, 0)(__VA_ARGS__)
|
||||
#define __API_AVAILABLE_END _Pragma("clang attribute pop")
|
||||
|
||||
/*
|
||||
* API Deprecations
|
||||
*
|
||||
* Use to specify the release that a particular API became unavailable.
|
||||
*
|
||||
* Platform names:
|
||||
* macos, ios, tvos, watchos
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* __API_DEPRECATED("No longer supported", macos(10.4, 10.8))
|
||||
* __API_DEPRECATED("No longer supported", macos(10.4, 10.8), ios(2.0, 3.0), watchos(2.0, 3.0), tvos(9.0, 10.0))
|
||||
*
|
||||
* __API_DEPRECATED_WITH_REPLACEMENT("-setName:", tvos(10.0, 10.4), ios(9.0, 10.0))
|
||||
* __API_DEPRECATED_WITH_REPLACEMENT("SomeClassName", macos(10.4, 10.6), watchos(2.0, 3.0))
|
||||
*/
|
||||
#define __API_DEPRECATED(...) __API_DEPRECATED_MSG_GET_MACRO(__VA_ARGS__,__API_DEPRECATED_MSG8,__API_DEPRECATED_MSG7,__API_DEPRECATED_MSG6,__API_DEPRECATED_MSG5,__API_DEPRECATED_MSG4,__API_DEPRECATED_MSG3,__API_DEPRECATED_MSG2,__API_DEPRECATED_MSG1, 0)(__VA_ARGS__)
|
||||
#define __API_DEPRECATED_WITH_REPLACEMENT(...) __API_DEPRECATED_REP_GET_MACRO(__VA_ARGS__,__API_DEPRECATED_REP8,__API_DEPRECATED_REP7,__API_DEPRECATED_REP6,__API_DEPRECATED_REP5,__API_DEPRECATED_REP4,__API_DEPRECATED_REP3,__API_DEPRECATED_REP2,__API_DEPRECATED_REP1, 0)(__VA_ARGS__)
|
||||
|
||||
#define __API_DEPRECATED_BEGIN(...) _Pragma("clang attribute push") __API_DEPRECATED_BEGIN_MSG_GET_MACRO(__VA_ARGS__,__API_DEPRECATED_BEGIN_MSG8,__API_DEPRECATED_BEGIN_MSG7, __API_DEPRECATED_BEGIN_MSG6, __API_DEPRECATED_BEGIN_MSG5, __API_DEPRECATED_BEGIN_MSG4, __API_DEPRECATED_BEGIN_MSG3, __API_DEPRECATED_BEGIN_MSG2, __API_DEPRECATED_BEGIN_MSG1, 0)(__VA_ARGS__)
|
||||
#define __API_DEPRECATED_END _Pragma("clang attribute pop")
|
||||
|
||||
#define __API_DEPRECATED_WITH_REPLACEMENT_BEGIN(...) _Pragma("clang attribute push") __API_DEPRECATED_BEGIN_REP_GET_MACRO(__VA_ARGS__,__API_DEPRECATED_BEGIN_REP8,__API_DEPRECATED_BEGIN_REP7, __API_DEPRECATED_BEGIN_REP6, __API_DEPRECATED_BEGIN_REP5, __API_DEPRECATED_BEGIN_REP4, __API_DEPRECATED_BEGIN_REP3, __API_DEPRECATED_BEGIN_REP2, __API_DEPRECATED_BEGIN_REP1, 0)(__VA_ARGS__)
|
||||
#define __API_DEPRECATED_WITH_REPLACEMENT_END _Pragma("clang attribute pop")
|
||||
|
||||
/*
|
||||
* API Unavailability
|
||||
* Use to specify that an API is unavailable for a particular platform.
|
||||
*
|
||||
* Example:
|
||||
* __API_UNAVAILABLE(macos)
|
||||
* __API_UNAVAILABLE(watchos, tvos)
|
||||
*/
|
||||
#define __API_UNAVAILABLE(...) __API_UNAVAILABLE_GET_MACRO(__VA_ARGS__,__API_UNAVAILABLE7,__API_UNAVAILABLE6,__API_UNAVAILABLE5,__API_UNAVAILABLE4,__API_UNAVAILABLE3,__API_UNAVAILABLE2,__API_UNAVAILABLE1, 0)(__VA_ARGS__)
|
||||
|
||||
#define __API_UNAVAILABLE_BEGIN(...) _Pragma("clang attribute push") __API_UNAVAILABLE_BEGIN_GET_MACRO(__VA_ARGS__,__API_UNAVAILABLE_BEGIN7,__API_UNAVAILABLE_BEGIN6, __API_UNAVAILABLE_BEGIN5, __API_UNAVAILABLE_BEGIN4, __API_UNAVAILABLE_BEGIN3, __API_UNAVAILABLE_BEGIN2, __API_UNAVAILABLE_BEGIN1, 0)(__VA_ARGS__)
|
||||
#define __API_UNAVAILABLE_END _Pragma("clang attribute pop")
|
||||
#else
|
||||
|
||||
/*
|
||||
* Evaluate to nothing for compilers that don't support availability.
|
||||
*/
|
||||
|
||||
#define __API_AVAILABLE(...)
|
||||
#define __API_AVAILABLE_BEGIN(...)
|
||||
#define __API_AVAILABLE_END
|
||||
#define __API_DEPRECATED(...)
|
||||
#define __API_DEPRECATED_WITH_REPLACEMENT(...)
|
||||
#define __API_DEPRECATED_BEGIN(...)
|
||||
#define __API_DEPRECATED_END
|
||||
#define __API_DEPRECATED_WITH_REPLACEMENT_BEGIN(...)
|
||||
#define __API_DEPRECATED_WITH_REPLACEMENT_END
|
||||
#define __API_UNAVAILABLE(...)
|
||||
#define __API_UNAVAILABLE_BEGIN(...)
|
||||
#define __API_UNAVAILABLE_END
|
||||
#endif /* __has_attribute(availability) */
|
||||
#else
|
||||
|
||||
/*
|
||||
* Evaluate to nothing for compilers that don't support clang language extensions.
|
||||
*/
|
||||
|
||||
#define __API_AVAILABLE(...)
|
||||
#define __API_AVAILABLE_BEGIN(...)
|
||||
#define __API_AVAILABLE_END
|
||||
#define __API_DEPRECATED(...)
|
||||
#define __API_DEPRECATED_WITH_REPLACEMENT(...)
|
||||
#define __API_DEPRECATED_BEGIN(...)
|
||||
#define __API_DEPRECATED_END
|
||||
#define __API_DEPRECATED_WITH_REPLACEMENT_BEGIN(...)
|
||||
#define __API_DEPRECATED_WITH_REPLACEMENT_END
|
||||
#define __API_UNAVAILABLE(...)
|
||||
#define __API_UNAVAILABLE_BEGIN(...)
|
||||
#define __API_UNAVAILABLE_END
|
||||
#endif /* #if defined(__has_feature) && defined(__has_attribute) */
|
||||
|
||||
#if __has_include(<AvailabilityProhibitedInternal.h>)
|
||||
#include <AvailabilityProhibitedInternal.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* If SPI decorations have not been defined elsewhere, disable them.
|
||||
*/
|
||||
|
||||
#ifndef __SPI_AVAILABLE
|
||||
#define __SPI_AVAILABLE(...)
|
||||
#endif
|
||||
|
||||
#ifndef __SPI_DEPRECATED
|
||||
#define __SPI_DEPRECATED(...)
|
||||
#endif
|
||||
|
||||
#ifndef __SPI_DEPRECATED_WITH_REPLACEMENT
|
||||
#define __SPI_DEPRECATED_WITH_REPLACEMENT(...)
|
||||
#endif
|
||||
|
||||
#endif /* __AVAILABILITY__ */
|
||||
4675
lib/libc/include/aarch64-macos-gnu/AvailabilityInternal.h
Normal file
4675
lib/libc/include/aarch64-macos-gnu/AvailabilityInternal.h
Normal file
File diff suppressed because it is too large
Load Diff
4013
lib/libc/include/aarch64-macos-gnu/AvailabilityMacros.h
Normal file
4013
lib/libc/include/aarch64-macos-gnu/AvailabilityMacros.h
Normal file
File diff suppressed because it is too large
Load Diff
207
lib/libc/include/aarch64-macos-gnu/AvailabilityVersions.h
Normal file
207
lib/libc/include/aarch64-macos-gnu/AvailabilityVersions.h
Normal file
@ -0,0 +1,207 @@
|
||||
/*
|
||||
* Copyright (c) 2019 by Apple Inc.. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef __AVAILABILITY_VERSIONS__
|
||||
#define __AVAILABILITY_VERSIONS__
|
||||
|
||||
#define __MAC_10_0 1000
|
||||
#define __MAC_10_1 1010
|
||||
#define __MAC_10_2 1020
|
||||
#define __MAC_10_3 1030
|
||||
#define __MAC_10_4 1040
|
||||
#define __MAC_10_5 1050
|
||||
#define __MAC_10_6 1060
|
||||
#define __MAC_10_7 1070
|
||||
#define __MAC_10_8 1080
|
||||
#define __MAC_10_9 1090
|
||||
#define __MAC_10_10 101000
|
||||
#define __MAC_10_10_2 101002
|
||||
#define __MAC_10_10_3 101003
|
||||
#define __MAC_10_11 101100
|
||||
#define __MAC_10_11_2 101102
|
||||
#define __MAC_10_11_3 101103
|
||||
#define __MAC_10_11_4 101104
|
||||
#define __MAC_10_12 101200
|
||||
#define __MAC_10_12_1 101201
|
||||
#define __MAC_10_12_2 101202
|
||||
#define __MAC_10_12_4 101204
|
||||
#define __MAC_10_13 101300
|
||||
#define __MAC_10_13_1 101301
|
||||
#define __MAC_10_13_2 101302
|
||||
#define __MAC_10_13_4 101304
|
||||
#define __MAC_10_14 101400
|
||||
#define __MAC_10_14_1 101401
|
||||
#define __MAC_10_14_4 101404
|
||||
#define __MAC_10_14_6 101406
|
||||
#define __MAC_10_15 101500
|
||||
#define __MAC_10_15_1 101501
|
||||
#define __MAC_10_15_4 101504
|
||||
#define __MAC_10_16 101600
|
||||
#define __MAC_11_0 110000
|
||||
/* __MAC_NA is not defined to a value but is used as a token by macros to indicate that the API is unavailable */
|
||||
|
||||
#define __IPHONE_2_0 20000
|
||||
#define __IPHONE_2_1 20100
|
||||
#define __IPHONE_2_2 20200
|
||||
#define __IPHONE_3_0 30000
|
||||
#define __IPHONE_3_1 30100
|
||||
#define __IPHONE_3_2 30200
|
||||
#define __IPHONE_4_0 40000
|
||||
#define __IPHONE_4_1 40100
|
||||
#define __IPHONE_4_2 40200
|
||||
#define __IPHONE_4_3 40300
|
||||
#define __IPHONE_5_0 50000
|
||||
#define __IPHONE_5_1 50100
|
||||
#define __IPHONE_6_0 60000
|
||||
#define __IPHONE_6_1 60100
|
||||
#define __IPHONE_7_0 70000
|
||||
#define __IPHONE_7_1 70100
|
||||
#define __IPHONE_8_0 80000
|
||||
#define __IPHONE_8_1 80100
|
||||
#define __IPHONE_8_2 80200
|
||||
#define __IPHONE_8_3 80300
|
||||
#define __IPHONE_8_4 80400
|
||||
#define __IPHONE_9_0 90000
|
||||
#define __IPHONE_9_1 90100
|
||||
#define __IPHONE_9_2 90200
|
||||
#define __IPHONE_9_3 90300
|
||||
#define __IPHONE_10_0 100000
|
||||
#define __IPHONE_10_1 100100
|
||||
#define __IPHONE_10_2 100200
|
||||
#define __IPHONE_10_3 100300
|
||||
#define __IPHONE_11_0 110000
|
||||
#define __IPHONE_11_1 110100
|
||||
#define __IPHONE_11_2 110200
|
||||
#define __IPHONE_11_3 110300
|
||||
#define __IPHONE_11_4 110400
|
||||
#define __IPHONE_12_0 120000
|
||||
#define __IPHONE_12_1 120100
|
||||
#define __IPHONE_12_2 120200
|
||||
#define __IPHONE_12_3 120300
|
||||
#define __IPHONE_12_4 120400
|
||||
#define __IPHONE_13_0 130000
|
||||
#define __IPHONE_13_1 130100
|
||||
#define __IPHONE_13_2 130200
|
||||
#define __IPHONE_13_3 130300
|
||||
#define __IPHONE_13_4 130400
|
||||
#define __IPHONE_13_5 130500
|
||||
#define __IPHONE_13_6 130600
|
||||
#define __IPHONE_13_7 130700
|
||||
#define __IPHONE_14_0 140000
|
||||
#define __IPHONE_14_1 140100
|
||||
#define __IPHONE_14_2 140200
|
||||
/* __IPHONE_NA is not defined to a value but is used as a token by macros to indicate that the API is unavailable */
|
||||
|
||||
#define __TVOS_9_0 90000
|
||||
#define __TVOS_9_1 90100
|
||||
#define __TVOS_9_2 90200
|
||||
#define __TVOS_10_0 100000
|
||||
#define __TVOS_10_0_1 100001
|
||||
#define __TVOS_10_1 100100
|
||||
#define __TVOS_10_2 100200
|
||||
#define __TVOS_11_0 110000
|
||||
#define __TVOS_11_1 110100
|
||||
#define __TVOS_11_2 110200
|
||||
#define __TVOS_11_3 110300
|
||||
#define __TVOS_11_4 110400
|
||||
#define __TVOS_12_0 120000
|
||||
#define __TVOS_12_1 120100
|
||||
#define __TVOS_12_2 120200
|
||||
#define __TVOS_12_3 120300
|
||||
#define __TVOS_12_4 120400
|
||||
#define __TVOS_13_0 130000
|
||||
#define __TVOS_13_2 130200
|
||||
#define __TVOS_13_3 130300
|
||||
#define __TVOS_13_4 130400
|
||||
#define __TVOS_14_0 140000
|
||||
#define __TVOS_14_1 140100
|
||||
#define __TVOS_14_2 140200
|
||||
|
||||
#define __WATCHOS_1_0 10000
|
||||
#define __WATCHOS_2_0 20000
|
||||
#define __WATCHOS_2_1 20100
|
||||
#define __WATCHOS_2_2 20200
|
||||
#define __WATCHOS_3_0 30000
|
||||
#define __WATCHOS_3_1 30100
|
||||
#define __WATCHOS_3_1_1 30101
|
||||
#define __WATCHOS_3_2 30200
|
||||
#define __WATCHOS_4_0 40000
|
||||
#define __WATCHOS_4_1 40100
|
||||
#define __WATCHOS_4_2 40200
|
||||
#define __WATCHOS_4_3 40300
|
||||
#define __WATCHOS_5_0 50000
|
||||
#define __WATCHOS_5_1 50100
|
||||
#define __WATCHOS_5_2 50200
|
||||
#define __WATCHOS_5_3 50300
|
||||
#define __WATCHOS_6_0 60000
|
||||
#define __WATCHOS_6_1 60100
|
||||
#define __WATCHOS_6_2 60200
|
||||
#define __WATCHOS_7_0 70000
|
||||
#define __WATCHOS_7_1 70100
|
||||
|
||||
/*
|
||||
* Set up standard Mac OS X versions
|
||||
*/
|
||||
|
||||
#if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || defined(_DARWIN_C_SOURCE)
|
||||
|
||||
#define MAC_OS_X_VERSION_10_0 1000
|
||||
#define MAC_OS_X_VERSION_10_1 1010
|
||||
#define MAC_OS_X_VERSION_10_2 1020
|
||||
#define MAC_OS_X_VERSION_10_3 1030
|
||||
#define MAC_OS_X_VERSION_10_4 1040
|
||||
#define MAC_OS_X_VERSION_10_5 1050
|
||||
#define MAC_OS_X_VERSION_10_6 1060
|
||||
#define MAC_OS_X_VERSION_10_7 1070
|
||||
#define MAC_OS_X_VERSION_10_8 1080
|
||||
#define MAC_OS_X_VERSION_10_9 1090
|
||||
#define MAC_OS_X_VERSION_10_10 101000
|
||||
#define MAC_OS_X_VERSION_10_10_2 101002
|
||||
#define MAC_OS_X_VERSION_10_10_3 101003
|
||||
#define MAC_OS_X_VERSION_10_11 101100
|
||||
#define MAC_OS_X_VERSION_10_11_2 101102
|
||||
#define MAC_OS_X_VERSION_10_11_3 101103
|
||||
#define MAC_OS_X_VERSION_10_11_4 101104
|
||||
#define MAC_OS_X_VERSION_10_12 101200
|
||||
#define MAC_OS_X_VERSION_10_12_1 101201
|
||||
#define MAC_OS_X_VERSION_10_12_2 101202
|
||||
#define MAC_OS_X_VERSION_10_12_4 101204
|
||||
#define MAC_OS_X_VERSION_10_13 101300
|
||||
#define MAC_OS_X_VERSION_10_13_1 101301
|
||||
#define MAC_OS_X_VERSION_10_13_2 101302
|
||||
#define MAC_OS_X_VERSION_10_13_4 101304
|
||||
#define MAC_OS_X_VERSION_10_14 101400
|
||||
#define MAC_OS_X_VERSION_10_14_1 101401
|
||||
#define MAC_OS_X_VERSION_10_14_4 101404
|
||||
#define MAC_OS_X_VERSION_10_14_6 101406
|
||||
#define MAC_OS_X_VERSION_10_15 101500
|
||||
#define MAC_OS_X_VERSION_10_15_1 101501
|
||||
#define MAC_OS_X_VERSION_10_16 101600
|
||||
#define MAC_OS_VERSION_11_0 110000
|
||||
|
||||
#endif /* #if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || defined(_DARWIN_C_SOURCE) */
|
||||
|
||||
#define __DRIVERKIT_19_0 190000
|
||||
#define __DRIVERKIT_20_0 200000
|
||||
|
||||
#endif /* __AVAILABILITY_VERSIONS__ */
|
||||
508
lib/libc/include/aarch64-macos-gnu/TargetConditionals.h
Normal file
508
lib/libc/include/aarch64-macos-gnu/TargetConditionals.h
Normal file
@ -0,0 +1,508 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2014 by Apple Inc.. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
/*
|
||||
File: TargetConditionals.h
|
||||
|
||||
Contains: Autoconfiguration of TARGET_ conditionals for Mac OS X and iPhone
|
||||
|
||||
Note: TargetConditionals.h in 3.4 Universal Interfaces works
|
||||
with all compilers. This header only recognizes compilers
|
||||
known to run on Mac OS X.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef __TARGETCONDITIONALS__
|
||||
#define __TARGETCONDITIONALS__
|
||||
|
||||
/*
|
||||
*
|
||||
* TARGET_CPU_*
|
||||
* These conditionals specify which microprocessor instruction set is being
|
||||
* generated. At most one of these is true, the rest are false.
|
||||
*
|
||||
* TARGET_CPU_PPC - Compiler is generating PowerPC instructions for 32-bit mode
|
||||
* TARGET_CPU_PPC64 - Compiler is generating PowerPC instructions for 64-bit mode
|
||||
* TARGET_CPU_68K - Compiler is generating 680x0 instructions
|
||||
* TARGET_CPU_X86 - Compiler is generating x86 instructions for 32-bit mode
|
||||
* TARGET_CPU_X86_64 - Compiler is generating x86 instructions for 64-bit mode
|
||||
* TARGET_CPU_ARM - Compiler is generating ARM instructions for 32-bit mode
|
||||
* TARGET_CPU_ARM64 - Compiler is generating ARM instructions for 64-bit mode
|
||||
* TARGET_CPU_MIPS - Compiler is generating MIPS instructions
|
||||
* TARGET_CPU_SPARC - Compiler is generating Sparc instructions
|
||||
* TARGET_CPU_ALPHA - Compiler is generating Dec Alpha instructions
|
||||
*
|
||||
*
|
||||
* TARGET_OS_*
|
||||
* These conditionals specify in which Operating System the generated code will
|
||||
* run. Indention is used to show which conditionals are evolutionary subclasses.
|
||||
*
|
||||
* The MAC/WIN32/UNIX conditionals are mutually exclusive.
|
||||
* The IOS/TV/WATCH conditionals are mutually exclusive.
|
||||
*
|
||||
*
|
||||
* TARGET_OS_WIN32 - Generated code will run under 32-bit Windows
|
||||
* TARGET_OS_UNIX - Generated code will run under some Unix (not OSX)
|
||||
* TARGET_OS_MAC - Generated code will run under Mac OS X variant
|
||||
* TARGET_OS_OSX - Generated code will run under OS X devices
|
||||
* TARGET_OS_IPHONE - Generated code for firmware, devices, or simulator
|
||||
* TARGET_OS_IOS - Generated code will run under iOS
|
||||
* TARGET_OS_TV - Generated code will run under Apple TV OS
|
||||
* TARGET_OS_WATCH - Generated code will run under Apple Watch OS
|
||||
* TARGET_OS_BRIDGE - Generated code will run under Bridge devices
|
||||
* TARGET_OS_MACCATALYST - Generated code will run under macOS
|
||||
* TARGET_OS_SIMULATOR - Generated code will run under a simulator
|
||||
*
|
||||
* TARGET_OS_EMBEDDED - DEPRECATED: Use TARGET_OS_IPHONE and/or TARGET_OS_SIMULATOR instead
|
||||
* TARGET_IPHONE_SIMULATOR - DEPRECATED: Same as TARGET_OS_SIMULATOR
|
||||
* TARGET_OS_NANO - DEPRECATED: Same as TARGET_OS_WATCH
|
||||
*
|
||||
* +---------------------------------------------------------------------+
|
||||
* | TARGET_OS_MAC |
|
||||
* | +---+ +-----------------------------------------------+ +---------+ |
|
||||
* | | | | TARGET_OS_IPHONE | | | |
|
||||
* | | | | +---------------+ +----+ +-------+ +--------+ | | | |
|
||||
* | | | | | IOS | | | | | | | | | | |
|
||||
* | |OSX| | |+-------------+| | TV | | WATCH | | BRIDGE | | |DRIVERKIT| |
|
||||
* | | | | || MACCATALYST || | | | | | | | | | |
|
||||
* | | | | |+-------------+| | | | | | | | | | |
|
||||
* | | | | +---------------+ +----+ +-------+ +--------+ | | | |
|
||||
* | +---+ +-----------------------------------------------+ +---------+ |
|
||||
* +---------------------------------------------------------------------+
|
||||
*
|
||||
* TARGET_RT_*
|
||||
* These conditionals specify in which runtime the generated code will
|
||||
* run. This is needed when the OS and CPU support more than one runtime
|
||||
* (e.g. Mac OS X supports CFM and mach-o).
|
||||
*
|
||||
* TARGET_RT_LITTLE_ENDIAN - Generated code uses little endian format for integers
|
||||
* TARGET_RT_BIG_ENDIAN - Generated code uses big endian format for integers
|
||||
* TARGET_RT_64_BIT - Generated code uses 64-bit pointers
|
||||
* TARGET_RT_MAC_CFM - TARGET_OS_MAC is true and CFM68K or PowerPC CFM (TVectors) are used
|
||||
* TARGET_RT_MAC_MACHO - TARGET_OS_MAC is true and Mach-O/dlyd runtime is used
|
||||
*/
|
||||
|
||||
/*
|
||||
* TARGET_OS conditionals can be enabled via clang preprocessor extensions:
|
||||
*
|
||||
* __is_target_arch
|
||||
* __is_target_vendor
|
||||
* __is_target_os
|
||||
* __is_target_environment
|
||||
*
|
||||
* “-target=x86_64-apple-ios12-macabi”
|
||||
* TARGET_OS_MAC=1
|
||||
* TARGET_OS_IPHONE=1
|
||||
* TARGET_OS_IOS=1
|
||||
* TARGET_OS_MACCATALYST=1
|
||||
*
|
||||
* “-target=x86_64-apple-ios12-simulator”
|
||||
* TARGET_OS_MAC=1
|
||||
* TARGET_OS_IPHONE=1
|
||||
* TARGET_OS_IOS=1
|
||||
* TARGET_OS_SIMULATOR=1
|
||||
*
|
||||
* DYNAMIC_TARGETS_ENABLED indicates that the core TARGET_OS macros were enabled via clang preprocessor extensions.
|
||||
* If this value is not set, the macro enablements will fall back to the static behavior.
|
||||
* It is disabled by default.
|
||||
*/
|
||||
|
||||
#if defined(__has_builtin)
|
||||
#if __has_builtin(__is_target_arch)
|
||||
#if __has_builtin(__is_target_vendor)
|
||||
#if __has_builtin(__is_target_os)
|
||||
#if __has_builtin(__is_target_environment)
|
||||
|
||||
/* “-target=x86_64-apple-ios12-macabi” */
|
||||
/* “-target=arm64-apple-ios12-macabi” */
|
||||
/* “-target=arm64e-apple-ios12-macabi” */
|
||||
#if (__is_target_arch(x86_64) || __is_target_arch(arm64) || __is_target_arch(arm64e)) && __is_target_vendor(apple) && __is_target_os(ios) && __is_target_environment(macabi)
|
||||
#define TARGET_OS_OSX 0
|
||||
#define TARGET_OS_IPHONE 1
|
||||
#define TARGET_OS_IOS 1
|
||||
#define TARGET_OS_WATCH 0
|
||||
|
||||
#define TARGET_OS_TV 0
|
||||
#define TARGET_OS_SIMULATOR 0
|
||||
#define TARGET_OS_EMBEDDED 0
|
||||
#define TARGET_OS_RTKIT 0
|
||||
#define TARGET_OS_MACCATALYST 1
|
||||
#define TARGET_OS_MACCATALYST 1
|
||||
#ifndef TARGET_OS_UIKITFORMAC
|
||||
#define TARGET_OS_UIKITFORMAC 1
|
||||
#endif
|
||||
#define TARGET_OS_DRIVERKIT 0
|
||||
#define DYNAMIC_TARGETS_ENABLED 1
|
||||
#endif
|
||||
|
||||
/* “-target=x86_64-apple-ios12-simulator” */
|
||||
#if __is_target_arch(x86_64) && __is_target_vendor(apple) && __is_target_os(ios) && __is_target_environment(simulator)
|
||||
#define TARGET_OS_OSX 0
|
||||
#define TARGET_OS_IPHONE 1
|
||||
#define TARGET_OS_IOS 1
|
||||
#define TARGET_OS_WATCH 0
|
||||
|
||||
#define TARGET_OS_TV 0
|
||||
#define TARGET_OS_SIMULATOR 1
|
||||
#define TARGET_OS_EMBEDDED 0
|
||||
#define TARGET_OS_RTKIT 0
|
||||
#define TARGET_OS_MACCATALYST 0
|
||||
#define TARGET_OS_MACCATALYST 0
|
||||
#ifndef TARGET_OS_UIKITFORMAC
|
||||
#define TARGET_OS_UIKITFORMAC 0
|
||||
#endif
|
||||
#define TARGET_OS_DRIVERKIT 0
|
||||
#define DYNAMIC_TARGETS_ENABLED 1
|
||||
#endif
|
||||
|
||||
/* -target=x86_64-apple-driverkit19.0 */
|
||||
/* -target=arm64-apple-driverkit19.0 */
|
||||
/* -target=arm64e-apple-driverkit19.0 */
|
||||
#if (__is_target_arch(x86_64) || __is_target_arch(arm64) || __is_target_arch(arm64e)) && __is_target_vendor(apple) && __is_target_os(driverkit)
|
||||
#define TARGET_OS_OSX 0
|
||||
#define TARGET_OS_IPHONE 0
|
||||
#define TARGET_OS_IOS 0
|
||||
#define TARGET_OS_WATCH 0
|
||||
|
||||
#define TARGET_OS_TV 0
|
||||
#define TARGET_OS_SIMULATOR 0
|
||||
#define TARGET_OS_EMBEDDED 0
|
||||
#define TARGET_OS_RTKIT 0
|
||||
#define TARGET_OS_MACCATALYST 0
|
||||
#define TARGET_OS_MACCATALYST 0
|
||||
#ifndef TARGET_OS_UIKITFORMAC
|
||||
#define TARGET_OS_UIKITFORMAC 0
|
||||
#endif
|
||||
#define TARGET_OS_DRIVERKIT 1
|
||||
#define DYNAMIC_TARGETS_ENABLED 1
|
||||
#endif
|
||||
|
||||
#endif /* #if __has_builtin(__is_target_environment) */
|
||||
#endif /* #if __has_builtin(__is_target_os) */
|
||||
#endif /* #if __has_builtin(__is_target_vendor) */
|
||||
#endif /* #if __has_builtin(__is_target_arch) */
|
||||
#endif /* #if defined(__has_builtin) */
|
||||
|
||||
|
||||
#ifndef DYNAMIC_TARGETS_ENABLED
|
||||
#define DYNAMIC_TARGETS_ENABLED 0
|
||||
#endif /* DYNAMIC_TARGETS_ENABLED */
|
||||
|
||||
/*
|
||||
* gcc based compiler used on Mac OS X
|
||||
*/
|
||||
#if defined(__GNUC__) && ( defined(__APPLE_CPP__) || defined(__APPLE_CC__) || defined(__MACOS_CLASSIC__) )
|
||||
#define TARGET_OS_MAC 1
|
||||
#define TARGET_OS_WIN32 0
|
||||
#define TARGET_OS_UNIX 0
|
||||
|
||||
#if !DYNAMIC_TARGETS_ENABLED
|
||||
#define TARGET_OS_OSX 1
|
||||
#define TARGET_OS_IPHONE 0
|
||||
#define TARGET_OS_IOS 0
|
||||
#define TARGET_OS_WATCH 0
|
||||
|
||||
#define TARGET_OS_TV 0
|
||||
#define TARGET_OS_MACCATALYST 0
|
||||
#define TARGET_OS_MACCATALYST 0
|
||||
#ifndef TARGET_OS_UIKITFORMAC
|
||||
#define TARGET_OS_UIKITFORMAC 0
|
||||
#endif
|
||||
#define TARGET_OS_SIMULATOR 0
|
||||
#define TARGET_OS_EMBEDDED 0
|
||||
#define TARGET_OS_RTKIT 0
|
||||
#define TARGET_OS_DRIVERKIT 0
|
||||
#endif
|
||||
|
||||
#define TARGET_IPHONE_SIMULATOR TARGET_OS_SIMULATOR /* deprecated */
|
||||
#define TARGET_OS_NANO TARGET_OS_WATCH /* deprecated */
|
||||
|
||||
#define TARGET_ABI_USES_IOS_VALUES (!TARGET_CPU_X86_64 || (TARGET_OS_IPHONE && !TARGET_OS_MACCATALYST))
|
||||
#if defined(__ppc__)
|
||||
#define TARGET_CPU_PPC 1
|
||||
#define TARGET_CPU_PPC64 0
|
||||
#define TARGET_CPU_68K 0
|
||||
#define TARGET_CPU_X86 0
|
||||
#define TARGET_CPU_X86_64 0
|
||||
#define TARGET_CPU_ARM 0
|
||||
#define TARGET_CPU_ARM64 0
|
||||
#define TARGET_CPU_MIPS 0
|
||||
#define TARGET_CPU_SPARC 0
|
||||
#define TARGET_CPU_ALPHA 0
|
||||
#define TARGET_RT_LITTLE_ENDIAN 0
|
||||
#define TARGET_RT_BIG_ENDIAN 1
|
||||
#define TARGET_RT_64_BIT 0
|
||||
#ifdef __MACOS_CLASSIC__
|
||||
#define TARGET_RT_MAC_CFM 1
|
||||
#define TARGET_RT_MAC_MACHO 0
|
||||
#else
|
||||
#define TARGET_RT_MAC_CFM 0
|
||||
#define TARGET_RT_MAC_MACHO 1
|
||||
#endif
|
||||
#elif defined(__ppc64__)
|
||||
#define TARGET_CPU_PPC 0
|
||||
#define TARGET_CPU_PPC64 1
|
||||
#define TARGET_CPU_68K 0
|
||||
#define TARGET_CPU_X86 0
|
||||
#define TARGET_CPU_X86_64 0
|
||||
#define TARGET_CPU_ARM 0
|
||||
#define TARGET_CPU_ARM64 0
|
||||
#define TARGET_CPU_MIPS 0
|
||||
#define TARGET_CPU_SPARC 0
|
||||
#define TARGET_CPU_ALPHA 0
|
||||
#define TARGET_RT_LITTLE_ENDIAN 0
|
||||
#define TARGET_RT_BIG_ENDIAN 1
|
||||
#define TARGET_RT_64_BIT 1
|
||||
#define TARGET_RT_MAC_CFM 0
|
||||
#define TARGET_RT_MAC_MACHO 1
|
||||
#elif defined(__i386__)
|
||||
#define TARGET_CPU_PPC 0
|
||||
#define TARGET_CPU_PPC64 0
|
||||
#define TARGET_CPU_68K 0
|
||||
#define TARGET_CPU_X86 1
|
||||
#define TARGET_CPU_X86_64 0
|
||||
#define TARGET_CPU_ARM 0
|
||||
#define TARGET_CPU_ARM64 0
|
||||
#define TARGET_CPU_MIPS 0
|
||||
#define TARGET_CPU_SPARC 0
|
||||
#define TARGET_CPU_ALPHA 0
|
||||
#define TARGET_RT_MAC_CFM 0
|
||||
#define TARGET_RT_MAC_MACHO 1
|
||||
#define TARGET_RT_LITTLE_ENDIAN 1
|
||||
#define TARGET_RT_BIG_ENDIAN 0
|
||||
#define TARGET_RT_64_BIT 0
|
||||
#elif defined(__x86_64__)
|
||||
#define TARGET_CPU_PPC 0
|
||||
#define TARGET_CPU_PPC64 0
|
||||
#define TARGET_CPU_68K 0
|
||||
#define TARGET_CPU_X86 0
|
||||
#define TARGET_CPU_X86_64 1
|
||||
#define TARGET_CPU_ARM 0
|
||||
#define TARGET_CPU_ARM64 0
|
||||
#define TARGET_CPU_MIPS 0
|
||||
#define TARGET_CPU_SPARC 0
|
||||
#define TARGET_CPU_ALPHA 0
|
||||
#define TARGET_RT_MAC_CFM 0
|
||||
#define TARGET_RT_MAC_MACHO 1
|
||||
#define TARGET_RT_LITTLE_ENDIAN 1
|
||||
#define TARGET_RT_BIG_ENDIAN 0
|
||||
#define TARGET_RT_64_BIT 1
|
||||
#elif defined(__arm__)
|
||||
#define TARGET_CPU_PPC 0
|
||||
#define TARGET_CPU_PPC64 0
|
||||
#define TARGET_CPU_68K 0
|
||||
#define TARGET_CPU_X86 0
|
||||
#define TARGET_CPU_X86_64 0
|
||||
#define TARGET_CPU_ARM 1
|
||||
#define TARGET_CPU_ARM64 0
|
||||
#define TARGET_CPU_MIPS 0
|
||||
#define TARGET_CPU_SPARC 0
|
||||
#define TARGET_CPU_ALPHA 0
|
||||
#define TARGET_RT_MAC_CFM 0
|
||||
#define TARGET_RT_MAC_MACHO 1
|
||||
#define TARGET_RT_LITTLE_ENDIAN 1
|
||||
#define TARGET_RT_BIG_ENDIAN 0
|
||||
#define TARGET_RT_64_BIT 0
|
||||
#elif defined(__arm64__)
|
||||
#define TARGET_CPU_PPC 0
|
||||
#define TARGET_CPU_PPC64 0
|
||||
#define TARGET_CPU_68K 0
|
||||
#define TARGET_CPU_X86 0
|
||||
#define TARGET_CPU_X86_64 0
|
||||
#define TARGET_CPU_ARM 0
|
||||
#define TARGET_CPU_ARM64 1
|
||||
#define TARGET_CPU_MIPS 0
|
||||
#define TARGET_CPU_SPARC 0
|
||||
#define TARGET_CPU_ALPHA 0
|
||||
#define TARGET_RT_MAC_CFM 0
|
||||
#define TARGET_RT_MAC_MACHO 1
|
||||
#define TARGET_RT_LITTLE_ENDIAN 1
|
||||
#define TARGET_RT_BIG_ENDIAN 0
|
||||
#if __LP64__
|
||||
#define TARGET_RT_64_BIT 1
|
||||
#else
|
||||
#define TARGET_RT_64_BIT 0
|
||||
#endif
|
||||
#else
|
||||
#error unrecognized GNU C compiler
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* CodeWarrior compiler from Metrowerks/Motorola
|
||||
*/
|
||||
#elif defined(__MWERKS__)
|
||||
#define TARGET_OS_MAC 1
|
||||
#define TARGET_OS_WIN32 0
|
||||
#define TARGET_OS_UNIX 0
|
||||
#define TARGET_OS_EMBEDDED 0
|
||||
#if defined(__POWERPC__)
|
||||
#define TARGET_CPU_PPC 1
|
||||
#define TARGET_CPU_PPC64 0
|
||||
#define TARGET_CPU_68K 0
|
||||
#define TARGET_CPU_X86 0
|
||||
#define TARGET_CPU_MIPS 0
|
||||
#define TARGET_CPU_SPARC 0
|
||||
#define TARGET_CPU_ALPHA 0
|
||||
#define TARGET_RT_LITTLE_ENDIAN 0
|
||||
#define TARGET_RT_BIG_ENDIAN 1
|
||||
#elif defined(__INTEL__)
|
||||
#define TARGET_CPU_PPC 0
|
||||
#define TARGET_CPU_PPC64 0
|
||||
#define TARGET_CPU_68K 0
|
||||
#define TARGET_CPU_X86 1
|
||||
#define TARGET_CPU_MIPS 0
|
||||
#define TARGET_CPU_SPARC 0
|
||||
#define TARGET_CPU_ALPHA 0
|
||||
#define TARGET_RT_LITTLE_ENDIAN 1
|
||||
#define TARGET_RT_BIG_ENDIAN 0
|
||||
#else
|
||||
#error unknown Metrowerks CPU type
|
||||
#endif
|
||||
#define TARGET_RT_64_BIT 0
|
||||
#ifdef __MACH__
|
||||
#define TARGET_RT_MAC_CFM 0
|
||||
#define TARGET_RT_MAC_MACHO 1
|
||||
#else
|
||||
#define TARGET_RT_MAC_CFM 1
|
||||
#define TARGET_RT_MAC_MACHO 0
|
||||
#endif
|
||||
|
||||
/*
|
||||
* unknown compiler
|
||||
*/
|
||||
#else
|
||||
#if defined(TARGET_CPU_PPC) && TARGET_CPU_PPC
|
||||
#define TARGET_CPU_PPC64 0
|
||||
#define TARGET_CPU_68K 0
|
||||
#define TARGET_CPU_X86 0
|
||||
#define TARGET_CPU_X86_64 0
|
||||
#define TARGET_CPU_ARM 0
|
||||
#define TARGET_CPU_ARM64 0
|
||||
#define TARGET_CPU_MIPS 0
|
||||
#define TARGET_CPU_SPARC 0
|
||||
#define TARGET_CPU_ALPHA 0
|
||||
#elif defined(TARGET_CPU_PPC64) && TARGET_CPU_PPC64
|
||||
#define TARGET_CPU_PPC 0
|
||||
#define TARGET_CPU_68K 0
|
||||
#define TARGET_CPU_X86 0
|
||||
#define TARGET_CPU_X86_64 0
|
||||
#define TARGET_CPU_ARM 0
|
||||
#define TARGET_CPU_ARM64 0
|
||||
#define TARGET_CPU_MIPS 0
|
||||
#define TARGET_CPU_SPARC 0
|
||||
#define TARGET_CPU_ALPHA 0
|
||||
#elif defined(TARGET_CPU_X86) && TARGET_CPU_X86
|
||||
#define TARGET_CPU_PPC 0
|
||||
#define TARGET_CPU_PPC64 0
|
||||
#define TARGET_CPU_X86_64 0
|
||||
#define TARGET_CPU_68K 0
|
||||
#define TARGET_CPU_ARM 0
|
||||
#define TARGET_CPU_ARM64 0
|
||||
#define TARGET_CPU_MIPS 0
|
||||
#define TARGET_CPU_SPARC 0
|
||||
#define TARGET_CPU_ALPHA 0
|
||||
#elif defined(TARGET_CPU_X86_64) && TARGET_CPU_X86_64
|
||||
#define TARGET_CPU_PPC 0
|
||||
#define TARGET_CPU_PPC64 0
|
||||
#define TARGET_CPU_X86 0
|
||||
#define TARGET_CPU_68K 0
|
||||
#define TARGET_CPU_ARM 0
|
||||
#define TARGET_CPU_ARM64 0
|
||||
#define TARGET_CPU_MIPS 0
|
||||
#define TARGET_CPU_SPARC 0
|
||||
#define TARGET_CPU_ALPHA 0
|
||||
#elif defined(TARGET_CPU_ARM) && TARGET_CPU_ARM
|
||||
#define TARGET_CPU_PPC 0
|
||||
#define TARGET_CPU_PPC64 0
|
||||
#define TARGET_CPU_X86 0
|
||||
#define TARGET_CPU_X86_64 0
|
||||
#define TARGET_CPU_68K 0
|
||||
#define TARGET_CPU_ARM64 0
|
||||
#define TARGET_CPU_MIPS 0
|
||||
#define TARGET_CPU_SPARC 0
|
||||
#define TARGET_CPU_ALPHA 0
|
||||
#elif defined(TARGET_CPU_ARM64) && TARGET_CPU_ARM64
|
||||
#define TARGET_CPU_PPC 0
|
||||
#define TARGET_CPU_PPC64 0
|
||||
#define TARGET_CPU_X86 0
|
||||
#define TARGET_CPU_X86_64 0
|
||||
#define TARGET_CPU_68K 0
|
||||
#define TARGET_CPU_ARM 0
|
||||
#define TARGET_CPU_MIPS 0
|
||||
#define TARGET_CPU_SPARC 0
|
||||
#define TARGET_CPU_ALPHA 0
|
||||
#else
|
||||
/*
|
||||
NOTE: If your compiler errors out here then support for your compiler
|
||||
has not yet been added to TargetConditionals.h.
|
||||
|
||||
TargetConditionals.h is designed to be plug-and-play. It auto detects
|
||||
which compiler is being run and configures the TARGET_ conditionals
|
||||
appropriately.
|
||||
|
||||
The short term work around is to set the TARGET_CPU_ and TARGET_OS_
|
||||
on the command line to the compiler (e.g. -DTARGET_CPU_MIPS=1 -DTARGET_OS_UNIX=1)
|
||||
|
||||
The long term solution is to add a new case to this file which
|
||||
auto detects your compiler and sets up the TARGET_ conditionals.
|
||||
Then submit the changes to Apple Computer.
|
||||
*/
|
||||
#error TargetConditionals.h: unknown compiler (see comment above)
|
||||
#define TARGET_CPU_PPC 0
|
||||
#define TARGET_CPU_68K 0
|
||||
#define TARGET_CPU_X86 0
|
||||
#define TARGET_CPU_ARM 0
|
||||
#define TARGET_CPU_ARM64 0
|
||||
#define TARGET_CPU_MIPS 0
|
||||
#define TARGET_CPU_SPARC 0
|
||||
#define TARGET_CPU_ALPHA 0
|
||||
#endif
|
||||
#define TARGET_OS_MAC 1
|
||||
#define TARGET_OS_WIN32 0
|
||||
#define TARGET_OS_UNIX 0
|
||||
#define TARGET_OS_EMBEDDED 0
|
||||
#if TARGET_CPU_PPC || TARGET_CPU_PPC64
|
||||
#define TARGET_RT_BIG_ENDIAN 1
|
||||
#define TARGET_RT_LITTLE_ENDIAN 0
|
||||
#else
|
||||
#define TARGET_RT_BIG_ENDIAN 0
|
||||
#define TARGET_RT_LITTLE_ENDIAN 1
|
||||
#endif
|
||||
#if TARGET_CPU_PPC64 || TARGET_CPU_X86_64
|
||||
#define TARGET_RT_64_BIT 1
|
||||
#else
|
||||
#define TARGET_RT_64_BIT 0
|
||||
#endif
|
||||
#ifdef __MACH__
|
||||
#define TARGET_RT_MAC_MACHO 1
|
||||
#define TARGET_RT_MAC_CFM 0
|
||||
#else
|
||||
#define TARGET_RT_MAC_MACHO 0
|
||||
#define TARGET_RT_MAC_CFM 1
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* __TARGETCONDITIONALS__ */
|
||||
35
lib/libc/include/aarch64-macos-gnu/_ctermid.h
Normal file
35
lib/libc/include/aarch64-macos-gnu/_ctermid.h
Normal file
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2002-2006, 2008-2010, 2012, 2020 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef _CTERMID_H_
|
||||
#define _CTERMID_H_
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
char *ctermid(char *);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif
|
||||
9
lib/libc/include/aarch64-macos-gnu/arm/_limits.h
Normal file
9
lib/libc/include/aarch64-macos-gnu/arm/_limits.h
Normal file
@ -0,0 +1,9 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2007 Apple Inc. All rights reserved.
|
||||
*/
|
||||
#ifndef _ARM__LIMITS_H_
|
||||
#define _ARM__LIMITS_H_
|
||||
|
||||
#define __DARWIN_CLK_TCK 100 /* ticks per second */
|
||||
|
||||
#endif /* _ARM__LIMITS_H_ */
|
||||
91
lib/libc/include/aarch64-macos-gnu/arm/_mcontext.h
Normal file
91
lib/libc/include/aarch64-macos-gnu/arm/_mcontext.h
Normal file
@ -0,0 +1,91 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2012 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef __ARM_MCONTEXT_H_
|
||||
#define __ARM_MCONTEXT_H_
|
||||
|
||||
#include <sys/cdefs.h> /* __DARWIN_UNIX03 */
|
||||
#include <sys/appleapiopts.h>
|
||||
#include <mach/machine/_structs.h>
|
||||
|
||||
#ifndef _STRUCT_MCONTEXT32
|
||||
#if __DARWIN_UNIX03
|
||||
#define _STRUCT_MCONTEXT32 struct __darwin_mcontext32
|
||||
_STRUCT_MCONTEXT32
|
||||
{
|
||||
_STRUCT_ARM_EXCEPTION_STATE __es;
|
||||
_STRUCT_ARM_THREAD_STATE __ss;
|
||||
_STRUCT_ARM_VFP_STATE __fs;
|
||||
};
|
||||
|
||||
#else /* !__DARWIN_UNIX03 */
|
||||
#define _STRUCT_MCONTEXT32 struct mcontext32
|
||||
_STRUCT_MCONTEXT32
|
||||
{
|
||||
_STRUCT_ARM_EXCEPTION_STATE es;
|
||||
_STRUCT_ARM_THREAD_STATE ss;
|
||||
_STRUCT_ARM_VFP_STATE fs;
|
||||
};
|
||||
|
||||
#endif /* __DARWIN_UNIX03 */
|
||||
#endif /* _STRUCT_MCONTEXT32 */
|
||||
|
||||
|
||||
#ifndef _STRUCT_MCONTEXT64
|
||||
#if __DARWIN_UNIX03
|
||||
#define _STRUCT_MCONTEXT64 struct __darwin_mcontext64
|
||||
_STRUCT_MCONTEXT64
|
||||
{
|
||||
_STRUCT_ARM_EXCEPTION_STATE64 __es;
|
||||
_STRUCT_ARM_THREAD_STATE64 __ss;
|
||||
_STRUCT_ARM_NEON_STATE64 __ns;
|
||||
};
|
||||
|
||||
#else /* !__DARWIN_UNIX03 */
|
||||
#define _STRUCT_MCONTEXT64 struct mcontext64
|
||||
_STRUCT_MCONTEXT64
|
||||
{
|
||||
_STRUCT_ARM_EXCEPTION_STATE64 es;
|
||||
_STRUCT_ARM_THREAD_STATE64 ss;
|
||||
_STRUCT_ARM_NEON_STATE64 ns;
|
||||
};
|
||||
#endif /* __DARWIN_UNIX03 */
|
||||
#endif /* _STRUCT_MCONTEXT32 */
|
||||
|
||||
#ifndef _MCONTEXT_T
|
||||
#define _MCONTEXT_T
|
||||
#if defined(__arm64__)
|
||||
typedef _STRUCT_MCONTEXT64 *mcontext_t;
|
||||
#define _STRUCT_MCONTEXT _STRUCT_MCONTEXT64
|
||||
#else
|
||||
typedef _STRUCT_MCONTEXT32 *mcontext_t;
|
||||
#define _STRUCT_MCONTEXT _STRUCT_MCONTEXT32
|
||||
#endif
|
||||
#endif /* _MCONTEXT_T */
|
||||
|
||||
#endif /* __ARM_MCONTEXT_H_ */
|
||||
22
lib/libc/include/aarch64-macos-gnu/arm/_param.h
Normal file
22
lib/libc/include/aarch64-macos-gnu/arm/_param.h
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2007 Apple Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _ARM__PARAM_H_
|
||||
#define _ARM__PARAM_H_
|
||||
|
||||
#include <arm/_types.h>
|
||||
|
||||
/*
|
||||
* Round p (pointer or byte index) up to a correctly-aligned value for all
|
||||
* data types (int, long, ...). The result is unsigned int and must be
|
||||
* cast to any desired pointer type.
|
||||
*/
|
||||
#define __DARWIN_ALIGNBYTES (sizeof(__darwin_size_t) - 1)
|
||||
#define __DARWIN_ALIGN(p) ((__darwin_size_t)((__darwin_size_t)(p) + __DARWIN_ALIGNBYTES) &~ __DARWIN_ALIGNBYTES)
|
||||
|
||||
#define __DARWIN_ALIGNBYTES32 (sizeof(__uint32_t) - 1)
|
||||
#define __DARWIN_ALIGN32(p) ((__darwin_size_t)((__darwin_size_t)(p) + __DARWIN_ALIGNBYTES32) &~ __DARWIN_ALIGNBYTES32)
|
||||
|
||||
|
||||
#endif /* _ARM__PARAM_H_ */
|
||||
98
lib/libc/include/aarch64-macos-gnu/arm/_types.h
Normal file
98
lib/libc/include/aarch64-macos-gnu/arm/_types.h
Normal file
@ -0,0 +1,98 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2007 Apple Inc. All rights reserved.
|
||||
*/
|
||||
#ifndef _BSD_ARM__TYPES_H_
|
||||
#define _BSD_ARM__TYPES_H_
|
||||
|
||||
/*
|
||||
* This header file contains integer types. It's intended to also contain
|
||||
* flotaing point and other arithmetic types, as needed, later.
|
||||
*/
|
||||
|
||||
#ifdef __GNUC__
|
||||
typedef __signed char __int8_t;
|
||||
#else /* !__GNUC__ */
|
||||
typedef char __int8_t;
|
||||
#endif /* !__GNUC__ */
|
||||
typedef unsigned char __uint8_t;
|
||||
typedef short __int16_t;
|
||||
typedef unsigned short __uint16_t;
|
||||
typedef int __int32_t;
|
||||
typedef unsigned int __uint32_t;
|
||||
typedef long long __int64_t;
|
||||
typedef unsigned long long __uint64_t;
|
||||
|
||||
typedef long __darwin_intptr_t;
|
||||
typedef unsigned int __darwin_natural_t;
|
||||
|
||||
/*
|
||||
* The rune type below is declared to be an ``int'' instead of the more natural
|
||||
* ``unsigned long'' or ``long''. Two things are happening here. It is not
|
||||
* unsigned so that EOF (-1) can be naturally assigned to it and used. Also,
|
||||
* it looks like 10646 will be a 31 bit standard. This means that if your
|
||||
* ints cannot hold 32 bits, you will be in trouble. The reason an int was
|
||||
* chosen over a long is that the is*() and to*() routines take ints (says
|
||||
* ANSI C), but they use __darwin_ct_rune_t instead of int. By changing it
|
||||
* here, you lose a bit of ANSI conformance, but your programs will still
|
||||
* work.
|
||||
*
|
||||
* NOTE: rune_t is not covered by ANSI nor other standards, and should not
|
||||
* be instantiated outside of lib/libc/locale. Use wchar_t. wchar_t and
|
||||
* rune_t must be the same type. Also wint_t must be no narrower than
|
||||
* wchar_t, and should also be able to hold all members of the largest
|
||||
* character set plus one extra value (WEOF). wint_t must be at least 16 bits.
|
||||
*/
|
||||
|
||||
typedef int __darwin_ct_rune_t; /* ct_rune_t */
|
||||
|
||||
/*
|
||||
* mbstate_t is an opaque object to keep conversion state, during multibyte
|
||||
* stream conversions. The content must not be referenced by user programs.
|
||||
*/
|
||||
typedef union {
|
||||
char __mbstate8[128];
|
||||
long long _mbstateL; /* for alignment */
|
||||
} __mbstate_t;
|
||||
|
||||
typedef __mbstate_t __darwin_mbstate_t; /* mbstate_t */
|
||||
|
||||
#if defined(__PTRDIFF_TYPE__)
|
||||
typedef __PTRDIFF_TYPE__ __darwin_ptrdiff_t; /* ptr1 - ptr2 */
|
||||
#elif defined(__LP64__)
|
||||
typedef long __darwin_ptrdiff_t; /* ptr1 - ptr2 */
|
||||
#else
|
||||
typedef int __darwin_ptrdiff_t; /* ptr1 - ptr2 */
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
#if defined(__SIZE_TYPE__)
|
||||
typedef __SIZE_TYPE__ __darwin_size_t; /* sizeof() */
|
||||
#else
|
||||
typedef unsigned long __darwin_size_t; /* sizeof() */
|
||||
#endif
|
||||
|
||||
#if (__GNUC__ > 2)
|
||||
typedef __builtin_va_list __darwin_va_list; /* va_list */
|
||||
#else
|
||||
typedef void * __darwin_va_list; /* va_list */
|
||||
#endif
|
||||
|
||||
#if defined(__WCHAR_TYPE__)
|
||||
typedef __WCHAR_TYPE__ __darwin_wchar_t; /* wchar_t */
|
||||
#else
|
||||
typedef __darwin_ct_rune_t __darwin_wchar_t; /* wchar_t */
|
||||
#endif
|
||||
|
||||
typedef __darwin_wchar_t __darwin_rune_t; /* rune_t */
|
||||
|
||||
#if defined(__WINT_TYPE__)
|
||||
typedef __WINT_TYPE__ __darwin_wint_t; /* wint_t */
|
||||
#else
|
||||
typedef __darwin_ct_rune_t __darwin_wint_t; /* wint_t */
|
||||
#endif
|
||||
|
||||
typedef unsigned long __darwin_clock_t; /* clock() */
|
||||
typedef __uint32_t __darwin_socklen_t; /* socklen_t (duh) */
|
||||
typedef long __darwin_ssize_t; /* byte count or error */
|
||||
typedef long __darwin_time_t; /* time() */
|
||||
|
||||
#endif /* _BSD_ARM__TYPES_H_ */
|
||||
67
lib/libc/include/aarch64-macos-gnu/arm/arch.h
Normal file
67
lib/libc/include/aarch64-macos-gnu/arm/arch.h
Normal file
@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright (c) 2007 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
#ifndef _ARM_ARCH_H
|
||||
#define _ARM_ARCH_H
|
||||
|
||||
/* Collect the __ARM_ARCH_*__ compiler flags into something easier to use. */
|
||||
#if defined (__ARM_ARCH_7A__) || defined (__ARM_ARCH_7S__) || defined (__ARM_ARCH_7F__) || defined (__ARM_ARCH_7K__)
|
||||
#define _ARM_ARCH_7
|
||||
#endif
|
||||
|
||||
#if defined (_ARM_ARCH_7) || defined (__ARM_ARCH_6K__) || defined (__ARM_ARCH_6ZK__)
|
||||
#define _ARM_ARCH_6K
|
||||
#endif
|
||||
|
||||
#if defined (_ARM_ARCH_7) || defined (__ARM_ARCH_6Z__) || defined (__ARM_ARCH_6ZK__)
|
||||
#define _ARM_ARCH_6Z
|
||||
#endif
|
||||
|
||||
#if defined (__ARM_ARCH_6__) || defined (__ARM_ARCH_6J__) || \
|
||||
defined (_ARM_ARCH_6Z) || defined (_ARM_ARCH_6K)
|
||||
#define _ARM_ARCH_6
|
||||
#endif
|
||||
|
||||
#if defined (_ARM_ARCH_6) || defined (__ARM_ARCH_5E__) || \
|
||||
defined (__ARM_ARCH_5TE__) || defined (__ARM_ARCH_5TEJ__)
|
||||
#define _ARM_ARCH_5E
|
||||
#endif
|
||||
|
||||
#if defined (_ARM_ARCH_5E) || defined (__ARM_ARCH_5__) || \
|
||||
defined (__ARM_ARCH_5T__)
|
||||
#define _ARM_ARCH_5
|
||||
#endif
|
||||
|
||||
#if defined (_ARM_ARCH_5) || defined (__ARM_ARCH_4T__)
|
||||
#define _ARM_ARCH_4T
|
||||
#endif
|
||||
|
||||
#if defined (_ARM_ARCH_4T) || defined (__ARM_ARCH_4__)
|
||||
#define _ARM_ARCH_4
|
||||
#endif
|
||||
|
||||
#endif
|
||||
78
lib/libc/include/aarch64-macos-gnu/arm/endian.h
Normal file
78
lib/libc/include/aarch64-macos-gnu/arm/endian.h
Normal file
@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2007 Apple Inc. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Copyright 1995 NeXT Computer, Inc. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1987, 1991, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)endian.h 8.1 (Berkeley) 6/11/93
|
||||
*/
|
||||
|
||||
#ifndef _ARM__ENDIAN_H_
|
||||
#define _ARM__ENDIAN_H_
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
/*
|
||||
* Define _NOQUAD if the compiler does NOT support 64-bit integers.
|
||||
*/
|
||||
/* #define _NOQUAD */
|
||||
|
||||
/*
|
||||
* Define the order of 32-bit words in 64-bit words.
|
||||
*/
|
||||
#define _QUAD_HIGHWORD 1
|
||||
#define _QUAD_LOWWORD 0
|
||||
|
||||
/*
|
||||
* Definitions for byte order, according to byte significance from low
|
||||
* address to high.
|
||||
*/
|
||||
#define __DARWIN_LITTLE_ENDIAN 1234 /* LSB first: i386, vax */
|
||||
#define __DARWIN_BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */
|
||||
#define __DARWIN_PDP_ENDIAN 3412 /* LSB first in word, MSW first in long */
|
||||
|
||||
#define __DARWIN_BYTE_ORDER __DARWIN_LITTLE_ENDIAN
|
||||
|
||||
#if defined(KERNEL) || (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
|
||||
|
||||
#define LITTLE_ENDIAN __DARWIN_LITTLE_ENDIAN
|
||||
#define BIG_ENDIAN __DARWIN_BIG_ENDIAN
|
||||
#define PDP_ENDIAN __DARWIN_PDP_ENDIAN
|
||||
|
||||
#define BYTE_ORDER __DARWIN_BYTE_ORDER
|
||||
|
||||
#include <sys/_endian.h>
|
||||
|
||||
#endif /* defined(KERNEL) || (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) */
|
||||
#endif /* !_ARM__ENDIAN_H_ */
|
||||
110
lib/libc/include/aarch64-macos-gnu/arm/limits.h
Normal file
110
lib/libc/include/aarch64-macos-gnu/arm/limits.h
Normal file
@ -0,0 +1,110 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2007 Apple Inc. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1988, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)limits.h 8.3 (Berkeley) 1/4/94
|
||||
*/
|
||||
|
||||
#ifndef _ARM_LIMITS_H_
|
||||
#define _ARM_LIMITS_H_
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <arm/_limits.h>
|
||||
|
||||
#define CHAR_BIT 8 /* number of bits in a char */
|
||||
#define MB_LEN_MAX 6 /* Allow 31 bit UTF2 */
|
||||
|
||||
#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
|
||||
#define CLK_TCK __DARWIN_CLK_TCK /* ticks per second */
|
||||
#endif /* !_ANSI_SOURCE && (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
|
||||
|
||||
/*
|
||||
* According to ANSI (section 2.2.4.2), the values below must be usable by
|
||||
* #if preprocessing directives. Additionally, the expression must have the
|
||||
* same type as would an expression that is an object of the corresponding
|
||||
* type converted according to the integral promotions. The subtraction for
|
||||
* INT_MIN and LONG_MIN is so the value is not unsigned; 2147483648 is an
|
||||
* unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2).
|
||||
* These numbers work for pcc as well. The UINT_MAX and ULONG_MAX values
|
||||
* are written as hex so that GCC will be quiet about large integer constants.
|
||||
*/
|
||||
#define SCHAR_MAX 127 /* min value for a signed char */
|
||||
#define SCHAR_MIN (-128) /* max value for a signed char */
|
||||
|
||||
#define UCHAR_MAX 255 /* max value for an unsigned char */
|
||||
#define CHAR_MAX 127 /* max value for a char */
|
||||
#define CHAR_MIN (-128) /* min value for a char */
|
||||
|
||||
#define USHRT_MAX 65535 /* max value for an unsigned short */
|
||||
#define SHRT_MAX 32767 /* max value for a short */
|
||||
#define SHRT_MIN (-32768) /* min value for a short */
|
||||
|
||||
#define UINT_MAX 0xffffffff /* max value for an unsigned int */
|
||||
#define INT_MAX 2147483647 /* max value for an int */
|
||||
#define INT_MIN (-2147483647-1) /* min value for an int */
|
||||
|
||||
#ifdef __LP64__
|
||||
#define ULONG_MAX 0xffffffffffffffffUL /* max unsigned long */
|
||||
#define LONG_MAX 0x7fffffffffffffffL /* max signed long */
|
||||
#define LONG_MIN (-0x7fffffffffffffffL-1) /* min signed long */
|
||||
#else /* !__LP64__ */
|
||||
#define ULONG_MAX 0xffffffffUL /* max unsigned long */
|
||||
#define LONG_MAX 2147483647L /* max signed long */
|
||||
#define LONG_MIN (-2147483647L-1) /* min signed long */
|
||||
#endif /* __LP64__ */
|
||||
|
||||
#define ULLONG_MAX 0xffffffffffffffffULL /* max unsigned long long */
|
||||
#define LLONG_MAX 0x7fffffffffffffffLL /* max signed long long */
|
||||
#define LLONG_MIN (-0x7fffffffffffffffLL-1) /* min signed long long */
|
||||
|
||||
#if !defined(_ANSI_SOURCE)
|
||||
#ifdef __LP64__
|
||||
#define LONG_BIT 64
|
||||
#else /* !__LP64__ */
|
||||
#define LONG_BIT 32
|
||||
#endif /* __LP64__ */
|
||||
#define SSIZE_MAX LONG_MAX /* max value for a ssize_t */
|
||||
#define WORD_BIT 32
|
||||
|
||||
#if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || defined(_DARWIN_C_SOURCE)
|
||||
#define SIZE_T_MAX ULONG_MAX /* max value for a size_t */
|
||||
|
||||
#define UQUAD_MAX ULLONG_MAX
|
||||
#define QUAD_MAX LLONG_MAX
|
||||
#define QUAD_MIN LLONG_MIN
|
||||
|
||||
#endif /* (!_POSIX_C_SOURCE && !_XOPEN_SOURCE) || _DARWIN_C_SOURCE */
|
||||
#endif /* !_ANSI_SOURCE */
|
||||
|
||||
#endif /* _ARM_LIMITS_H_ */
|
||||
147
lib/libc/include/aarch64-macos-gnu/arm/param.h
Normal file
147
lib/libc/include/aarch64-macos-gnu/arm/param.h
Normal file
@ -0,0 +1,147 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2010 Apple Inc. All rights reserved.
|
||||
*/
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
* (c) UNIX System Laboratories, Inc.
|
||||
* All or some portions of this file are derived from material licensed
|
||||
* to the University of California by American Telephone and Telegraph
|
||||
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
|
||||
* the permission of UNIX System Laboratories, Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)param.h 8.1 (Berkeley) 4/4/95
|
||||
*/
|
||||
|
||||
/*
|
||||
* Machine dependent constants for ARM
|
||||
*/
|
||||
|
||||
#ifndef _ARM_PARAM_H_
|
||||
#define _ARM_PARAM_H_
|
||||
|
||||
#include <arm/_param.h>
|
||||
|
||||
/*
|
||||
* Round p (pointer or byte index) up to a correctly-aligned value for all
|
||||
* data types (int, long, ...). The result is unsigned int and must be
|
||||
* cast to any desired pointer type.
|
||||
*/
|
||||
#define ALIGNBYTES __DARWIN_ALIGNBYTES
|
||||
#define ALIGN(p) __DARWIN_ALIGN(p)
|
||||
|
||||
#define NBPG 4096 /* bytes/page */
|
||||
#define PGOFSET (NBPG-1) /* byte offset into page */
|
||||
#define PGSHIFT 12 /* LOG2(NBPG) */
|
||||
|
||||
#define DEV_BSIZE 512
|
||||
#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
|
||||
#define BLKDEV_IOSIZE 2048
|
||||
#define MAXPHYS (64 * 1024) /* max raw I/O transfer size */
|
||||
|
||||
#define CLSIZE 1
|
||||
#define CLSIZELOG2 0
|
||||
|
||||
/*
|
||||
* Constants related to network buffer management.
|
||||
* MCLBYTES must be no larger than CLBYTES (the software page size), and,
|
||||
* on machines that exchange pages of input or output buffers with mbuf
|
||||
* clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
|
||||
* of the hardware page size.
|
||||
*/
|
||||
#define MSIZESHIFT 8 /* 256 */
|
||||
#define MSIZE (1 << MSIZESHIFT) /* size of an mbuf */
|
||||
#define MCLSHIFT 11 /* 2048 */
|
||||
#define MCLBYTES (1 << MCLSHIFT) /* size of an mbuf cluster */
|
||||
#define MBIGCLSHIFT 12 /* 4096 */
|
||||
#define MBIGCLBYTES (1 << MBIGCLSHIFT) /* size of a big cluster */
|
||||
#define M16KCLSHIFT 14 /* 16384 */
|
||||
#define M16KCLBYTES (1 << M16KCLSHIFT) /* size of a jumbo cluster */
|
||||
|
||||
#define MCLOFSET (MCLBYTES - 1)
|
||||
#ifndef NMBCLUSTERS
|
||||
#define NMBCLUSTERS CONFIG_NMBCLUSTERS /* cl map size */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Some macros for units conversion
|
||||
*/
|
||||
/* Core clicks (NeXT_page_size bytes) to segments and vice versa */
|
||||
#define ctos(x) (x)
|
||||
#define stoc(x) (x)
|
||||
|
||||
/* Core clicks (4096 bytes) to disk blocks */
|
||||
#define ctod(x) ((x)<<(PGSHIFT-DEV_BSHIFT))
|
||||
#define dtoc(x) ((x)>>(PGSHIFT-DEV_BSHIFT))
|
||||
#define dtob(x) ((x)<<DEV_BSHIFT)
|
||||
|
||||
/* clicks to bytes */
|
||||
#define ctob(x) ((x)<<PGSHIFT)
|
||||
|
||||
/* bytes to clicks */
|
||||
#define btoc(x) (((unsigned)(x)+(NBPG-1))>>PGSHIFT)
|
||||
|
||||
#ifdef __APPLE__
|
||||
#define btodb(bytes, devBlockSize) \
|
||||
((unsigned)(bytes) / devBlockSize)
|
||||
#define dbtob(db, devBlockSize) \
|
||||
((unsigned)(db) * devBlockSize)
|
||||
#else
|
||||
#define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \
|
||||
((unsigned)(bytes) >> DEV_BSHIFT)
|
||||
#define dbtob(db) /* calculates (db * DEV_BSIZE) */ \
|
||||
((unsigned)(db) << DEV_BSHIFT)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Map a ``block device block'' to a file system block.
|
||||
* This should be device dependent, and will be if we
|
||||
* add an entry to cdevsw/bdevsw for that purpose.
|
||||
* For now though just use DEV_BSIZE.
|
||||
*/
|
||||
#define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE))
|
||||
|
||||
/*
|
||||
* Macros to decode (and encode) processor status word.
|
||||
*/
|
||||
#define STATUS_WORD(rpl, ipl) (((ipl) << 8) | (rpl))
|
||||
#define USERMODE(x) (((x) & 3) == 3)
|
||||
#define BASEPRI(x) (((x) & (255 << 8)) == 0)
|
||||
|
||||
|
||||
#if defined(KERNEL) || defined(STANDALONE)
|
||||
#define DELAY(n) delay(n)
|
||||
|
||||
#else /* defined(KERNEL) || defined(STANDALONE) */
|
||||
#define DELAY(n) { int N = (n); while (--N > 0); }
|
||||
#endif /* defined(KERNEL) || defined(STANDALONE) */
|
||||
|
||||
#endif /* _ARM_PARAM_H_ */
|
||||
18
lib/libc/include/aarch64-macos-gnu/arm/signal.h
Normal file
18
lib/libc/include/aarch64-macos-gnu/arm/signal.h
Normal file
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2009 Apple, Inc. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1992 NeXT Computer, Inc.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _ARM_SIGNAL_
|
||||
#define _ARM_SIGNAL_ 1
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#ifndef _ANSI_SOURCE
|
||||
typedef int sig_atomic_t;
|
||||
#endif /* ! _ANSI_SOURCE */
|
||||
|
||||
#endif /* _ARM_SIGNAL_ */
|
||||
107
lib/libc/include/aarch64-macos-gnu/arm/types.h
Normal file
107
lib/libc/include/aarch64-macos-gnu/arm/types.h
Normal file
@ -0,0 +1,107 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2008 Apple Inc. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Copyright 1995 NeXT Computer, Inc. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1990, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)types.h 8.3 (Berkeley) 1/5/94
|
||||
*/
|
||||
|
||||
#ifndef _MACHTYPES_H_
|
||||
#define _MACHTYPES_H_
|
||||
|
||||
#ifndef __ASSEMBLER__
|
||||
#include <arm/_types.h>
|
||||
#include <sys/cdefs.h>
|
||||
/*
|
||||
* Basic integral types. Omit the typedef if
|
||||
* not possible for a machine/compiler combination.
|
||||
*/
|
||||
#include <sys/_types/_int8_t.h>
|
||||
#include <sys/_types/_int16_t.h>
|
||||
#include <sys/_types/_int32_t.h>
|
||||
#include <sys/_types/_int64_t.h>
|
||||
|
||||
#include <sys/_types/_u_int8_t.h>
|
||||
#include <sys/_types/_u_int16_t.h>
|
||||
#include <sys/_types/_u_int32_t.h>
|
||||
#include <sys/_types/_u_int64_t.h>
|
||||
|
||||
#if __LP64__
|
||||
typedef int64_t register_t;
|
||||
#else
|
||||
typedef int32_t register_t;
|
||||
#endif
|
||||
|
||||
#include <sys/_types/_intptr_t.h>
|
||||
#include <sys/_types/_uintptr_t.h>
|
||||
|
||||
#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
|
||||
/* These types are used for reserving the largest possible size. */
|
||||
#ifdef __arm64__
|
||||
typedef u_int64_t user_addr_t;
|
||||
typedef u_int64_t user_size_t;
|
||||
typedef int64_t user_ssize_t;
|
||||
typedef int64_t user_long_t;
|
||||
typedef u_int64_t user_ulong_t;
|
||||
typedef int64_t user_time_t;
|
||||
typedef int64_t user_off_t;
|
||||
#else
|
||||
typedef u_int32_t user_addr_t;
|
||||
typedef u_int32_t user_size_t;
|
||||
typedef int32_t user_ssize_t;
|
||||
typedef int32_t user_long_t;
|
||||
typedef u_int32_t user_ulong_t;
|
||||
typedef int32_t user_time_t;
|
||||
typedef int64_t user_off_t;
|
||||
#endif
|
||||
|
||||
#define USER_ADDR_NULL ((user_addr_t) 0)
|
||||
#define CAST_USER_ADDR_T(a_ptr) ((user_addr_t)((uintptr_t)(a_ptr)))
|
||||
|
||||
|
||||
#endif /* !_ANSI_SOURCE && (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
|
||||
|
||||
/* This defines the size of syscall arguments after copying into the kernel: */
|
||||
#if defined(__arm__)
|
||||
typedef u_int32_t syscall_arg_t;
|
||||
#elif defined(__arm64__)
|
||||
typedef u_int64_t syscall_arg_t;
|
||||
#else
|
||||
#error Unknown architecture.
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLER__ */
|
||||
#endif /* _MACHTYPES_H_ */
|
||||
391
lib/libc/include/aarch64-macos-gnu/bsm/audit.h
Normal file
391
lib/libc/include/aarch64-macos-gnu/bsm/audit.h
Normal file
@ -0,0 +1,391 @@
|
||||
/*-
|
||||
* Copyright (c) 2005-2009 Apple Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of Apple Inc. ("Apple") nor the names of
|
||||
* its contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $P4: //depot/projects/trustedbsd/openbsm/sys/bsm/audit.h#10 $
|
||||
*/
|
||||
|
||||
#ifndef _BSM_AUDIT_H
|
||||
#define _BSM_AUDIT_H
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#define AUDIT_RECORD_MAGIC 0x828a0f1b
|
||||
#define MAX_AUDIT_RECORDS 20
|
||||
#define MAXAUDITDATA (0x8000 - 1)
|
||||
#define MAX_AUDIT_RECORD_SIZE MAXAUDITDATA
|
||||
#define MIN_AUDIT_FILE_SIZE (512 * 1024)
|
||||
|
||||
/*
|
||||
* Minimum noumber of free blocks on the filesystem containing the audit
|
||||
* log necessary to avoid a hard log rotation. DO NOT SET THIS VALUE TO 0
|
||||
* as the kernel does an unsigned compare, plus we want to leave a few blocks
|
||||
* free so userspace can terminate the log, etc.
|
||||
*/
|
||||
#define AUDIT_HARD_LIMIT_FREE_BLOCKS 4
|
||||
|
||||
/*
|
||||
* Triggers for the audit daemon.
|
||||
*/
|
||||
#define AUDIT_TRIGGER_MIN 1
|
||||
#define AUDIT_TRIGGER_LOW_SPACE 1 /* Below low watermark. */
|
||||
#define AUDIT_TRIGGER_ROTATE_KERNEL 2 /* Kernel requests rotate. */
|
||||
#define AUDIT_TRIGGER_READ_FILE 3 /* Re-read config file. */
|
||||
#define AUDIT_TRIGGER_CLOSE_AND_DIE 4 /* Terminate audit. */
|
||||
#define AUDIT_TRIGGER_NO_SPACE 5 /* Below min free space. */
|
||||
#define AUDIT_TRIGGER_ROTATE_USER 6 /* User requests rotate. */
|
||||
#define AUDIT_TRIGGER_INITIALIZE 7 /* User initialize of auditd. */
|
||||
#define AUDIT_TRIGGER_EXPIRE_TRAILS 8 /* User expiration of trails. */
|
||||
#define AUDIT_TRIGGER_MAX 8
|
||||
|
||||
/*
|
||||
* The special device filename (FreeBSD).
|
||||
*/
|
||||
#define AUDITDEV_FILENAME "audit"
|
||||
#define AUDIT_TRIGGER_FILE ("/dev/" AUDITDEV_FILENAME)
|
||||
|
||||
/*
|
||||
* Pre-defined audit IDs
|
||||
*/
|
||||
#define AU_DEFAUDITID (uid_t)(-1)
|
||||
#define AU_DEFAUDITSID 0
|
||||
#define AU_ASSIGN_ASID -1
|
||||
|
||||
/*
|
||||
* IPC types.
|
||||
*/
|
||||
#define AT_IPC_MSG ((unsigned char)1) /* Message IPC id. */
|
||||
#define AT_IPC_SEM ((unsigned char)2) /* Semaphore IPC id. */
|
||||
#define AT_IPC_SHM ((unsigned char)3) /* Shared mem IPC id. */
|
||||
|
||||
/*
|
||||
* Audit conditions.
|
||||
*/
|
||||
#define AUC_UNSET 0
|
||||
#define AUC_AUDITING 1
|
||||
#define AUC_NOAUDIT 2
|
||||
#define AUC_DISABLED -1
|
||||
|
||||
/*
|
||||
* auditon(2) commands.
|
||||
*/
|
||||
#define A_OLDGETPOLICY 2
|
||||
#define A_OLDSETPOLICY 3
|
||||
#define A_GETKMASK 4
|
||||
#define A_SETKMASK 5
|
||||
#define A_OLDGETQCTRL 6
|
||||
#define A_OLDSETQCTRL 7
|
||||
#define A_GETCWD 8
|
||||
#define A_GETCAR 9
|
||||
#define A_GETSTAT 12
|
||||
#define A_SETSTAT 13
|
||||
#define A_SETUMASK 14
|
||||
#define A_SETSMASK 15
|
||||
#define A_OLDGETCOND 20
|
||||
#define A_OLDSETCOND 21
|
||||
#define A_GETCLASS 22
|
||||
#define A_SETCLASS 23
|
||||
#define A_GETPINFO 24
|
||||
#define A_SETPMASK 25
|
||||
#define A_SETFSIZE 26
|
||||
#define A_GETFSIZE 27
|
||||
#define A_GETPINFO_ADDR 28
|
||||
#define A_GETKAUDIT 29
|
||||
#define A_SETKAUDIT 30
|
||||
#define A_SENDTRIGGER 31
|
||||
#define A_GETSINFO_ADDR 32
|
||||
#define A_GETPOLICY 33
|
||||
#define A_SETPOLICY 34
|
||||
#define A_GETQCTRL 35
|
||||
#define A_SETQCTRL 36
|
||||
#define A_GETCOND 37
|
||||
#define A_SETCOND 38
|
||||
#define A_GETSFLAGS 39
|
||||
#define A_SETSFLAGS 40
|
||||
#define A_GETCTLMODE 41
|
||||
#define A_SETCTLMODE 42
|
||||
#define A_GETEXPAFTER 43
|
||||
#define A_SETEXPAFTER 44
|
||||
|
||||
/*
|
||||
* Audit policy controls.
|
||||
*/
|
||||
#define AUDIT_CNT 0x0001
|
||||
#define AUDIT_AHLT 0x0002
|
||||
#define AUDIT_ARGV 0x0004
|
||||
#define AUDIT_ARGE 0x0008
|
||||
#define AUDIT_SEQ 0x0010
|
||||
#define AUDIT_WINDATA 0x0020
|
||||
#define AUDIT_USER 0x0040
|
||||
#define AUDIT_GROUP 0x0080
|
||||
#define AUDIT_TRAIL 0x0100
|
||||
#define AUDIT_PATH 0x0200
|
||||
#define AUDIT_SCNT 0x0400
|
||||
#define AUDIT_PUBLIC 0x0800
|
||||
#define AUDIT_ZONENAME 0x1000
|
||||
#define AUDIT_PERZONE 0x2000
|
||||
|
||||
/*
|
||||
* Default audit queue control parameters.
|
||||
*/
|
||||
#define AQ_HIWATER 100
|
||||
#define AQ_MAXHIGH 10000
|
||||
#define AQ_LOWATER 10
|
||||
#define AQ_BUFSZ MAXAUDITDATA
|
||||
#define AQ_MAXBUFSZ 1048576
|
||||
|
||||
/*
|
||||
* Default minimum percentage free space on file system.
|
||||
*/
|
||||
#define AU_FS_MINFREE 20
|
||||
|
||||
/*
|
||||
* Type definitions used indicating the length of variable length addresses
|
||||
* in tokens containing addresses, such as header fields.
|
||||
*/
|
||||
#define AU_IPv4 4
|
||||
#define AU_IPv6 16
|
||||
|
||||
/*
|
||||
* Reserved audit class mask indicating which classes are unable to have
|
||||
* events added or removed by unentitled processes.
|
||||
*/
|
||||
#define AU_CLASS_MASK_RESERVED 0x10000000
|
||||
|
||||
/*
|
||||
* Audit control modes
|
||||
*/
|
||||
#define AUDIT_CTLMODE_NORMAL ((unsigned char)1)
|
||||
#define AUDIT_CTLMODE_EXTERNAL ((unsigned char)2)
|
||||
|
||||
/*
|
||||
* Audit file expire_after op modes
|
||||
*/
|
||||
#define AUDIT_EXPIRE_OP_AND ((unsigned char)0)
|
||||
#define AUDIT_EXPIRE_OP_OR ((unsigned char)1)
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
typedef uid_t au_id_t;
|
||||
typedef pid_t au_asid_t;
|
||||
typedef u_int16_t au_event_t;
|
||||
typedef u_int16_t au_emod_t;
|
||||
typedef u_int32_t au_class_t;
|
||||
typedef u_int64_t au_asflgs_t __attribute__ ((aligned(8)));
|
||||
typedef unsigned char au_ctlmode_t;
|
||||
|
||||
struct au_tid {
|
||||
dev_t port;
|
||||
u_int32_t machine;
|
||||
};
|
||||
typedef struct au_tid au_tid_t;
|
||||
|
||||
struct au_tid_addr {
|
||||
dev_t at_port;
|
||||
u_int32_t at_type;
|
||||
u_int32_t at_addr[4];
|
||||
};
|
||||
typedef struct au_tid_addr au_tid_addr_t;
|
||||
|
||||
struct au_mask {
|
||||
unsigned int am_success; /* Success bits. */
|
||||
unsigned int am_failure; /* Failure bits. */
|
||||
};
|
||||
typedef struct au_mask au_mask_t;
|
||||
|
||||
struct auditinfo {
|
||||
au_id_t ai_auid; /* Audit user ID. */
|
||||
au_mask_t ai_mask; /* Audit masks. */
|
||||
au_tid_t ai_termid; /* Terminal ID. */
|
||||
au_asid_t ai_asid; /* Audit session ID. */
|
||||
};
|
||||
typedef struct auditinfo auditinfo_t;
|
||||
|
||||
struct auditinfo_addr {
|
||||
au_id_t ai_auid; /* Audit user ID. */
|
||||
au_mask_t ai_mask; /* Audit masks. */
|
||||
au_tid_addr_t ai_termid; /* Terminal ID. */
|
||||
au_asid_t ai_asid; /* Audit session ID. */
|
||||
au_asflgs_t ai_flags; /* Audit session flags. */
|
||||
};
|
||||
typedef struct auditinfo_addr auditinfo_addr_t;
|
||||
|
||||
struct auditpinfo {
|
||||
pid_t ap_pid; /* ID of target process. */
|
||||
au_id_t ap_auid; /* Audit user ID. */
|
||||
au_mask_t ap_mask; /* Audit masks. */
|
||||
au_tid_t ap_termid; /* Terminal ID. */
|
||||
au_asid_t ap_asid; /* Audit session ID. */
|
||||
};
|
||||
typedef struct auditpinfo auditpinfo_t;
|
||||
|
||||
struct auditpinfo_addr {
|
||||
pid_t ap_pid; /* ID of target process. */
|
||||
au_id_t ap_auid; /* Audit user ID. */
|
||||
au_mask_t ap_mask; /* Audit masks. */
|
||||
au_tid_addr_t ap_termid; /* Terminal ID. */
|
||||
au_asid_t ap_asid; /* Audit session ID. */
|
||||
au_asflgs_t ap_flags; /* Audit session flags. */
|
||||
};
|
||||
typedef struct auditpinfo_addr auditpinfo_addr_t;
|
||||
|
||||
struct au_session {
|
||||
auditinfo_addr_t *as_aia_p; /* Ptr to full audit info. */
|
||||
au_mask_t as_mask; /* Process Audit Masks. */
|
||||
};
|
||||
typedef struct au_session au_session_t;
|
||||
|
||||
struct au_expire_after {
|
||||
time_t age; /* Age after which trail files should be expired */
|
||||
size_t size; /* Aggregate trail size when files should be expired */
|
||||
unsigned char op_type; /* Operator used with the above values to determine when files should be expired */
|
||||
};
|
||||
typedef struct au_expire_after au_expire_after_t;
|
||||
|
||||
/*
|
||||
* Contents of token_t are opaque outside of libbsm.
|
||||
*/
|
||||
typedef struct au_token token_t;
|
||||
|
||||
/*
|
||||
* Kernel audit queue control parameters:
|
||||
* Default: Maximum:
|
||||
* aq_hiwater: AQ_HIWATER (100) AQ_MAXHIGH (10000)
|
||||
* aq_lowater: AQ_LOWATER (10) <aq_hiwater
|
||||
* aq_bufsz: AQ_BUFSZ (32767) AQ_MAXBUFSZ (1048576)
|
||||
* aq_delay: 20 20000 (not used)
|
||||
*/
|
||||
struct au_qctrl {
|
||||
int aq_hiwater; /* Max # of audit recs in queue when */
|
||||
/* threads with new ARs get blocked. */
|
||||
|
||||
int aq_lowater; /* # of audit recs in queue when */
|
||||
/* blocked threads get unblocked. */
|
||||
|
||||
int aq_bufsz; /* Max size of audit record for audit(2). */
|
||||
int aq_delay; /* Queue delay (not used). */
|
||||
int aq_minfree; /* Minimum filesystem percent free space. */
|
||||
};
|
||||
typedef struct au_qctrl au_qctrl_t;
|
||||
|
||||
/*
|
||||
* Structure for the audit statistics.
|
||||
*/
|
||||
struct audit_stat {
|
||||
unsigned int as_version;
|
||||
unsigned int as_numevent;
|
||||
int as_generated;
|
||||
int as_nonattrib;
|
||||
int as_kernel;
|
||||
int as_audit;
|
||||
int as_auditctl;
|
||||
int as_enqueue;
|
||||
int as_written;
|
||||
int as_wblocked;
|
||||
int as_rblocked;
|
||||
int as_dropped;
|
||||
int as_totalsize;
|
||||
unsigned int as_memused;
|
||||
};
|
||||
typedef struct audit_stat au_stat_t;
|
||||
|
||||
/*
|
||||
* Structure for the audit file statistics.
|
||||
*/
|
||||
struct audit_fstat {
|
||||
u_int64_t af_filesz;
|
||||
u_int64_t af_currsz;
|
||||
};
|
||||
typedef struct audit_fstat au_fstat_t;
|
||||
|
||||
/*
|
||||
* Audit to event class mapping.
|
||||
*/
|
||||
struct au_evclass_map {
|
||||
au_event_t ec_number;
|
||||
au_class_t ec_class;
|
||||
};
|
||||
typedef struct au_evclass_map au_evclass_map_t;
|
||||
|
||||
|
||||
#if !defined(_KERNEL) && !defined(KERNEL)
|
||||
#include <Availability.h>
|
||||
#define __AUDIT_API_DEPRECATED __API_DEPRECATED("audit is deprecated", macos(10.4, 11.0))
|
||||
#else
|
||||
#define __AUDIT_API_DEPRECATED
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Audit system calls.
|
||||
*/
|
||||
#if !defined(_KERNEL) && !defined(KERNEL)
|
||||
int audit(const void *, int)
|
||||
__AUDIT_API_DEPRECATED;
|
||||
int auditon(int, void *, int)
|
||||
__AUDIT_API_DEPRECATED;
|
||||
int auditctl(const char *)
|
||||
__AUDIT_API_DEPRECATED;
|
||||
int getauid(au_id_t *);
|
||||
int setauid(const au_id_t *);
|
||||
int getaudit_addr(struct auditinfo_addr *, int);
|
||||
int setaudit_addr(const struct auditinfo_addr *, int);
|
||||
|
||||
#if defined(__APPLE__)
|
||||
#include <Availability.h>
|
||||
|
||||
/*
|
||||
* getaudit()/setaudit() are deprecated and have been replaced with
|
||||
* wrappers to the getaudit_addr()/setaudit_addr() syscalls above.
|
||||
*/
|
||||
|
||||
int getaudit(struct auditinfo *)
|
||||
__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8,
|
||||
__IPHONE_2_0, __IPHONE_6_0);
|
||||
int setaudit(const struct auditinfo *)
|
||||
__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8,
|
||||
__IPHONE_2_0, __IPHONE_6_0);
|
||||
#else
|
||||
|
||||
int getaudit(struct auditinfo *)
|
||||
__AUDIT_API_DEPRECATED;
|
||||
int setaudit(const struct auditinfo *)
|
||||
__AUDIT_API_DEPRECATED;
|
||||
#endif /* !__APPLE__ */
|
||||
|
||||
#ifdef __APPLE_API_PRIVATE
|
||||
#include <mach/port.h>
|
||||
mach_port_name_t audit_session_self(void);
|
||||
au_asid_t audit_session_join(mach_port_name_t port);
|
||||
int audit_session_port(au_asid_t asid, mach_port_name_t *portname);
|
||||
#endif /* __APPLE_API_PRIVATE */
|
||||
|
||||
#endif /* defined(_KERNEL) || defined(KERNEL) */
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_BSM_AUDIT_H */
|
||||
428
lib/libc/include/aarch64-macos-gnu/dispatch/block.h
Normal file
428
lib/libc/include/aarch64-macos-gnu/dispatch/block.h
Normal file
@ -0,0 +1,428 @@
|
||||
/*
|
||||
* Copyright (c) 2014 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_APACHE_LICENSE_HEADER_START@
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_APACHE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef __DISPATCH_BLOCK__
|
||||
#define __DISPATCH_BLOCK__
|
||||
|
||||
#ifndef __DISPATCH_INDIRECT__
|
||||
#error "Please #include <dispatch/dispatch.h> instead of this file directly."
|
||||
#include <dispatch/base.h> // for HeaderDoc
|
||||
#endif
|
||||
|
||||
#ifdef __BLOCKS__
|
||||
|
||||
/*!
|
||||
* @group Dispatch block objects
|
||||
*/
|
||||
|
||||
DISPATCH_ASSUME_NONNULL_BEGIN
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/*!
|
||||
* @typedef dispatch_block_flags_t
|
||||
* Flags to pass to the dispatch_block_create* functions.
|
||||
*
|
||||
* @const DISPATCH_BLOCK_BARRIER
|
||||
* Flag indicating that a dispatch block object should act as a barrier block
|
||||
* when submitted to a DISPATCH_QUEUE_CONCURRENT queue.
|
||||
* See dispatch_barrier_async() for details.
|
||||
* This flag has no effect when the dispatch block object is invoked directly.
|
||||
*
|
||||
* @const DISPATCH_BLOCK_DETACHED
|
||||
* Flag indicating that a dispatch block object should execute disassociated
|
||||
* from current execution context attributes such as os_activity_t
|
||||
* and properties of the current IPC request (if any). With regard to QoS class,
|
||||
* the behavior is the same as for DISPATCH_BLOCK_NO_QOS. If invoked directly,
|
||||
* the block object will remove the other attributes from the calling thread for
|
||||
* the duration of the block body (before applying attributes assigned to the
|
||||
* block object, if any). If submitted to a queue, the block object will be
|
||||
* executed with the attributes of the queue (or any attributes specifically
|
||||
* assigned to the block object).
|
||||
*
|
||||
* @const DISPATCH_BLOCK_ASSIGN_CURRENT
|
||||
* Flag indicating that a dispatch block object should be assigned the execution
|
||||
* context attributes that are current at the time the block object is created.
|
||||
* This applies to attributes such as QOS class, os_activity_t and properties of
|
||||
* the current IPC request (if any). If invoked directly, the block object will
|
||||
* apply these attributes to the calling thread for the duration of the block
|
||||
* body. If the block object is submitted to a queue, this flag replaces the
|
||||
* default behavior of associating the submitted block instance with the
|
||||
* execution context attributes that are current at the time of submission.
|
||||
* If a specific QOS class is assigned with DISPATCH_BLOCK_NO_QOS_CLASS or
|
||||
* dispatch_block_create_with_qos_class(), that QOS class takes precedence over
|
||||
* the QOS class assignment indicated by this flag.
|
||||
*
|
||||
* @const DISPATCH_BLOCK_NO_QOS_CLASS
|
||||
* Flag indicating that a dispatch block object should be not be assigned a QOS
|
||||
* class. If invoked directly, the block object will be executed with the QOS
|
||||
* class of the calling thread. If the block object is submitted to a queue,
|
||||
* this replaces the default behavior of associating the submitted block
|
||||
* instance with the QOS class current at the time of submission.
|
||||
* This flag is ignored if a specific QOS class is assigned with
|
||||
* dispatch_block_create_with_qos_class().
|
||||
*
|
||||
* @const DISPATCH_BLOCK_INHERIT_QOS_CLASS
|
||||
* Flag indicating that execution of a dispatch block object submitted to a
|
||||
* queue should prefer the QOS class assigned to the queue over the QOS class
|
||||
* assigned to the block (resp. associated with the block at the time of
|
||||
* submission). The latter will only be used if the queue in question does not
|
||||
* have an assigned QOS class, as long as doing so does not result in a QOS
|
||||
* class lower than the QOS class inherited from the queue's target queue.
|
||||
* This flag is the default when a dispatch block object is submitted to a queue
|
||||
* for asynchronous execution and has no effect when the dispatch block object
|
||||
* is invoked directly. It is ignored if DISPATCH_BLOCK_ENFORCE_QOS_CLASS is
|
||||
* also passed.
|
||||
*
|
||||
* @const DISPATCH_BLOCK_ENFORCE_QOS_CLASS
|
||||
* Flag indicating that execution of a dispatch block object submitted to a
|
||||
* queue should prefer the QOS class assigned to the block (resp. associated
|
||||
* with the block at the time of submission) over the QOS class assigned to the
|
||||
* queue, as long as doing so will not result in a lower QOS class.
|
||||
* This flag is the default when a dispatch block object is submitted to a queue
|
||||
* for synchronous execution or when the dispatch block object is invoked
|
||||
* directly.
|
||||
*/
|
||||
DISPATCH_OPTIONS(dispatch_block_flags, unsigned long,
|
||||
DISPATCH_BLOCK_BARRIER
|
||||
DISPATCH_ENUM_API_AVAILABLE(macos(10.10), ios(8.0)) = 0x1,
|
||||
DISPATCH_BLOCK_DETACHED
|
||||
DISPATCH_ENUM_API_AVAILABLE(macos(10.10), ios(8.0)) = 0x2,
|
||||
DISPATCH_BLOCK_ASSIGN_CURRENT
|
||||
DISPATCH_ENUM_API_AVAILABLE(macos(10.10), ios(8.0)) = 0x4,
|
||||
DISPATCH_BLOCK_NO_QOS_CLASS
|
||||
DISPATCH_ENUM_API_AVAILABLE(macos(10.10), ios(8.0)) = 0x8,
|
||||
DISPATCH_BLOCK_INHERIT_QOS_CLASS
|
||||
DISPATCH_ENUM_API_AVAILABLE(macos(10.10), ios(8.0)) = 0x10,
|
||||
DISPATCH_BLOCK_ENFORCE_QOS_CLASS
|
||||
DISPATCH_ENUM_API_AVAILABLE(macos(10.10), ios(8.0)) = 0x20,
|
||||
);
|
||||
|
||||
/*!
|
||||
* @function dispatch_block_create
|
||||
*
|
||||
* @abstract
|
||||
* Create a new dispatch block object on the heap from an existing block and
|
||||
* the given flags.
|
||||
*
|
||||
* @discussion
|
||||
* The provided block is Block_copy'ed to the heap and retained by the newly
|
||||
* created dispatch block object.
|
||||
*
|
||||
* The returned dispatch block object is intended to be submitted to a dispatch
|
||||
* queue with dispatch_async() and related functions, but may also be invoked
|
||||
* directly. Both operations can be performed an arbitrary number of times but
|
||||
* only the first completed execution of a dispatch block object can be waited
|
||||
* on with dispatch_block_wait() or observed with dispatch_block_notify().
|
||||
*
|
||||
* If the returned dispatch block object is submitted to a dispatch queue, the
|
||||
* submitted block instance will be associated with the QOS class current at the
|
||||
* time of submission, unless one of the following flags assigned a specific QOS
|
||||
* class (or no QOS class) at the time of block creation:
|
||||
* - DISPATCH_BLOCK_ASSIGN_CURRENT
|
||||
* - DISPATCH_BLOCK_NO_QOS_CLASS
|
||||
* - DISPATCH_BLOCK_DETACHED
|
||||
* The QOS class the block object will be executed with also depends on the QOS
|
||||
* class assigned to the queue and which of the following flags was specified or
|
||||
* defaulted to:
|
||||
* - DISPATCH_BLOCK_INHERIT_QOS_CLASS (default for asynchronous execution)
|
||||
* - DISPATCH_BLOCK_ENFORCE_QOS_CLASS (default for synchronous execution)
|
||||
* See description of dispatch_block_flags_t for details.
|
||||
*
|
||||
* If the returned dispatch block object is submitted directly to a serial queue
|
||||
* and is configured to execute with a specific QOS class, the system will make
|
||||
* a best effort to apply the necessary QOS overrides to ensure that blocks
|
||||
* submitted earlier to the serial queue are executed at that same QOS class or
|
||||
* higher.
|
||||
*
|
||||
* @param flags
|
||||
* Configuration flags for the block object.
|
||||
* Passing a value that is not a bitwise OR of flags from dispatch_block_flags_t
|
||||
* results in NULL being returned.
|
||||
*
|
||||
* @param block
|
||||
* The block to create the dispatch block object from.
|
||||
*
|
||||
* @result
|
||||
* The newly created dispatch block object, or NULL.
|
||||
* When not building with Objective-C ARC, must be released with a -[release]
|
||||
* message or the Block_release() function.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.10), ios(8.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL2 DISPATCH_RETURNS_RETAINED_BLOCK
|
||||
DISPATCH_WARN_RESULT DISPATCH_NOTHROW
|
||||
dispatch_block_t
|
||||
dispatch_block_create(dispatch_block_flags_t flags, dispatch_block_t block);
|
||||
|
||||
/*!
|
||||
* @function dispatch_block_create_with_qos_class
|
||||
*
|
||||
* @abstract
|
||||
* Create a new dispatch block object on the heap from an existing block and
|
||||
* the given flags, and assign it the specified QOS class and relative priority.
|
||||
*
|
||||
* @discussion
|
||||
* The provided block is Block_copy'ed to the heap and retained by the newly
|
||||
* created dispatch block object.
|
||||
*
|
||||
* The returned dispatch block object is intended to be submitted to a dispatch
|
||||
* queue with dispatch_async() and related functions, but may also be invoked
|
||||
* directly. Both operations can be performed an arbitrary number of times but
|
||||
* only the first completed execution of a dispatch block object can be waited
|
||||
* on with dispatch_block_wait() or observed with dispatch_block_notify().
|
||||
*
|
||||
* If invoked directly, the returned dispatch block object will be executed with
|
||||
* the assigned QOS class as long as that does not result in a lower QOS class
|
||||
* than what is current on the calling thread.
|
||||
*
|
||||
* If the returned dispatch block object is submitted to a dispatch queue, the
|
||||
* QOS class it will be executed with depends on the QOS class assigned to the
|
||||
* block, the QOS class assigned to the queue and which of the following flags
|
||||
* was specified or defaulted to:
|
||||
* - DISPATCH_BLOCK_INHERIT_QOS_CLASS: default for asynchronous execution
|
||||
* - DISPATCH_BLOCK_ENFORCE_QOS_CLASS: default for synchronous execution
|
||||
* See description of dispatch_block_flags_t for details.
|
||||
*
|
||||
* If the returned dispatch block object is submitted directly to a serial queue
|
||||
* and is configured to execute with a specific QOS class, the system will make
|
||||
* a best effort to apply the necessary QOS overrides to ensure that blocks
|
||||
* submitted earlier to the serial queue are executed at that same QOS class or
|
||||
* higher.
|
||||
*
|
||||
* @param flags
|
||||
* Configuration flags for the new block object.
|
||||
* Passing a value that is not a bitwise OR of flags from dispatch_block_flags_t
|
||||
* results in NULL being returned.
|
||||
*
|
||||
* @param qos_class
|
||||
* A QOS class value:
|
||||
* - QOS_CLASS_USER_INTERACTIVE
|
||||
* - QOS_CLASS_USER_INITIATED
|
||||
* - QOS_CLASS_DEFAULT
|
||||
* - QOS_CLASS_UTILITY
|
||||
* - QOS_CLASS_BACKGROUND
|
||||
* - QOS_CLASS_UNSPECIFIED
|
||||
* Passing QOS_CLASS_UNSPECIFIED is equivalent to specifying the
|
||||
* DISPATCH_BLOCK_NO_QOS_CLASS flag. Passing any other value results in NULL
|
||||
* being returned.
|
||||
*
|
||||
* @param relative_priority
|
||||
* A relative priority within the QOS class. This value is a negative
|
||||
* offset from the maximum supported scheduler priority for the given class.
|
||||
* Passing a value greater than zero or less than QOS_MIN_RELATIVE_PRIORITY
|
||||
* results in NULL being returned.
|
||||
*
|
||||
* @param block
|
||||
* The block to create the dispatch block object from.
|
||||
*
|
||||
* @result
|
||||
* The newly created dispatch block object, or NULL.
|
||||
* When not building with Objective-C ARC, must be released with a -[release]
|
||||
* message or the Block_release() function.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.10), ios(8.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL4 DISPATCH_RETURNS_RETAINED_BLOCK
|
||||
DISPATCH_WARN_RESULT DISPATCH_NOTHROW
|
||||
dispatch_block_t
|
||||
dispatch_block_create_with_qos_class(dispatch_block_flags_t flags,
|
||||
dispatch_qos_class_t qos_class, int relative_priority,
|
||||
dispatch_block_t block);
|
||||
|
||||
/*!
|
||||
* @function dispatch_block_perform
|
||||
*
|
||||
* @abstract
|
||||
* Create, synchronously execute and release a dispatch block object from the
|
||||
* specified block and flags.
|
||||
*
|
||||
* @discussion
|
||||
* Behaves identically to the sequence
|
||||
* <code>
|
||||
* dispatch_block_t b = dispatch_block_create(flags, block);
|
||||
* b();
|
||||
* Block_release(b);
|
||||
* </code>
|
||||
* but may be implemented more efficiently internally by not requiring a copy
|
||||
* to the heap of the specified block or the allocation of a new block object.
|
||||
*
|
||||
* @param flags
|
||||
* Configuration flags for the temporary block object.
|
||||
* The result of passing a value that is not a bitwise OR of flags from
|
||||
* dispatch_block_flags_t is undefined.
|
||||
*
|
||||
* @param block
|
||||
* The block to create the temporary block object from.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.10), ios(8.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL2 DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_block_perform(dispatch_block_flags_t flags,
|
||||
DISPATCH_NOESCAPE dispatch_block_t block);
|
||||
|
||||
/*!
|
||||
* @function dispatch_block_wait
|
||||
*
|
||||
* @abstract
|
||||
* Wait synchronously until execution of the specified dispatch block object has
|
||||
* completed or until the specified timeout has elapsed.
|
||||
*
|
||||
* @discussion
|
||||
* This function will return immediately if execution of the block object has
|
||||
* already completed.
|
||||
*
|
||||
* It is not possible to wait for multiple executions of the same block object
|
||||
* with this interface; use dispatch_group_wait() for that purpose. A single
|
||||
* dispatch block object may either be waited on once and executed once,
|
||||
* or it may be executed any number of times. The behavior of any other
|
||||
* combination is undefined. Submission to a dispatch queue counts as an
|
||||
* execution, even if cancellation (dispatch_block_cancel) means the block's
|
||||
* code never runs.
|
||||
*
|
||||
* The result of calling this function from multiple threads simultaneously
|
||||
* with the same dispatch block object is undefined, but note that doing so
|
||||
* would violate the rules described in the previous paragraph.
|
||||
*
|
||||
* If this function returns indicating that the specified timeout has elapsed,
|
||||
* then that invocation does not count as the one allowed wait.
|
||||
*
|
||||
* If at the time this function is called, the specified dispatch block object
|
||||
* has been submitted directly to a serial queue, the system will make a best
|
||||
* effort to apply the necessary QOS overrides to ensure that the block and any
|
||||
* blocks submitted earlier to that serial queue are executed at the QOS class
|
||||
* (or higher) of the thread calling dispatch_block_wait().
|
||||
*
|
||||
* @param block
|
||||
* The dispatch block object to wait on.
|
||||
* The result of passing NULL or a block object not returned by one of the
|
||||
* dispatch_block_create* functions is undefined.
|
||||
*
|
||||
* @param timeout
|
||||
* When to timeout (see dispatch_time). As a convenience, there are the
|
||||
* DISPATCH_TIME_NOW and DISPATCH_TIME_FOREVER constants.
|
||||
*
|
||||
* @result
|
||||
* Returns zero on success (the dispatch block object completed within the
|
||||
* specified timeout) or non-zero on error (i.e. timed out).
|
||||
*/
|
||||
API_AVAILABLE(macos(10.10), ios(8.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW
|
||||
intptr_t
|
||||
dispatch_block_wait(dispatch_block_t block, dispatch_time_t timeout);
|
||||
|
||||
/*!
|
||||
* @function dispatch_block_notify
|
||||
*
|
||||
* @abstract
|
||||
* Schedule a notification block to be submitted to a queue when the execution
|
||||
* of a specified dispatch block object has completed.
|
||||
*
|
||||
* @discussion
|
||||
* This function will submit the notification block immediately if execution of
|
||||
* the observed block object has already completed.
|
||||
*
|
||||
* It is not possible to be notified of multiple executions of the same block
|
||||
* object with this interface, use dispatch_group_notify() for that purpose.
|
||||
*
|
||||
* A single dispatch block object may either be observed one or more times
|
||||
* and executed once, or it may be executed any number of times. The behavior
|
||||
* of any other combination is undefined. Submission to a dispatch queue
|
||||
* counts as an execution, even if cancellation (dispatch_block_cancel) means
|
||||
* the block's code never runs.
|
||||
*
|
||||
* If multiple notification blocks are scheduled for a single block object,
|
||||
* there is no defined order in which the notification blocks will be submitted
|
||||
* to their associated queues.
|
||||
*
|
||||
* @param block
|
||||
* The dispatch block object to observe.
|
||||
* The result of passing NULL or a block object not returned by one of the
|
||||
* dispatch_block_create* functions is undefined.
|
||||
*
|
||||
* @param queue
|
||||
* The queue to which the supplied notification block will be submitted when
|
||||
* the observed block completes.
|
||||
*
|
||||
* @param notification_block
|
||||
* The notification block to submit when the observed block object completes.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.10), ios(8.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_block_notify(dispatch_block_t block, dispatch_queue_t queue,
|
||||
dispatch_block_t notification_block);
|
||||
|
||||
/*!
|
||||
* @function dispatch_block_cancel
|
||||
*
|
||||
* @abstract
|
||||
* Asynchronously cancel the specified dispatch block object.
|
||||
*
|
||||
* @discussion
|
||||
* Cancellation causes any future execution of the dispatch block object to
|
||||
* return immediately, but does not affect any execution of the block object
|
||||
* that is already in progress.
|
||||
*
|
||||
* Release of any resources associated with the block object will be delayed
|
||||
* until execution of the block object is next attempted (or any execution
|
||||
* already in progress completes).
|
||||
*
|
||||
* NOTE: care needs to be taken to ensure that a block object that may be
|
||||
* canceled does not capture any resources that require execution of the
|
||||
* block body in order to be released (e.g. memory allocated with
|
||||
* malloc(3) that the block body calls free(3) on). Such resources will
|
||||
* be leaked if the block body is never executed due to cancellation.
|
||||
*
|
||||
* @param block
|
||||
* The dispatch block object to cancel.
|
||||
* The result of passing NULL or a block object not returned by one of the
|
||||
* dispatch_block_create* functions is undefined.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.10), ios(8.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_block_cancel(dispatch_block_t block);
|
||||
|
||||
/*!
|
||||
* @function dispatch_block_testcancel
|
||||
*
|
||||
* @abstract
|
||||
* Tests whether the given dispatch block object has been canceled.
|
||||
*
|
||||
* @param block
|
||||
* The dispatch block object to test.
|
||||
* The result of passing NULL or a block object not returned by one of the
|
||||
* dispatch_block_create* functions is undefined.
|
||||
*
|
||||
* @result
|
||||
* Non-zero if canceled and zero if not canceled.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.10), ios(8.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_WARN_RESULT DISPATCH_PURE
|
||||
DISPATCH_NOTHROW
|
||||
intptr_t
|
||||
dispatch_block_testcancel(dispatch_block_t block);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
DISPATCH_ASSUME_NONNULL_END
|
||||
|
||||
#endif // __BLOCKS__
|
||||
|
||||
#endif // __DISPATCH_BLOCK__
|
||||
80
lib/libc/include/aarch64-macos-gnu/dispatch/dispatch.h
Normal file
80
lib/libc/include/aarch64-macos-gnu/dispatch/dispatch.h
Normal file
@ -0,0 +1,80 @@
|
||||
/*
|
||||
* Copyright (c) 2008-2013 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_APACHE_LICENSE_HEADER_START@
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_APACHE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef __DISPATCH_PUBLIC__
|
||||
#define __DISPATCH_PUBLIC__
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <Availability.h>
|
||||
#include <os/availability.h>
|
||||
#include <TargetConditionals.h>
|
||||
#include <os/base.h>
|
||||
#elif defined(_WIN32)
|
||||
#include <os/generic_win_base.h>
|
||||
#elif defined(__unix__)
|
||||
#include <os/generic_unix_base.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <fcntl.h>
|
||||
#if defined(_WIN32)
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
#if (defined(__linux__) || defined(__FreeBSD__)) && defined(__has_feature)
|
||||
#if __has_feature(modules)
|
||||
#if !defined(__arm__)
|
||||
#include <stdio.h> // for off_t (to match Glibc.modulemap)
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define DISPATCH_API_VERSION 20181008
|
||||
|
||||
#ifndef __DISPATCH_INDIRECT__
|
||||
#define __DISPATCH_INDIRECT__
|
||||
#endif
|
||||
|
||||
#include <os/object.h>
|
||||
#include <os/workgroup.h>
|
||||
#include <dispatch/base.h>
|
||||
#include <dispatch/time.h>
|
||||
#include <dispatch/object.h>
|
||||
#include <dispatch/queue.h>
|
||||
#include <dispatch/block.h>
|
||||
#include <dispatch/source.h>
|
||||
#include <dispatch/group.h>
|
||||
#include <dispatch/semaphore.h>
|
||||
#include <dispatch/once.h>
|
||||
#include <dispatch/data.h>
|
||||
#include <dispatch/io.h>
|
||||
#include <dispatch/workloop.h>
|
||||
|
||||
#undef __DISPATCH_INDIRECT__
|
||||
|
||||
#endif
|
||||
279
lib/libc/include/aarch64-macos-gnu/dispatch/group.h
Normal file
279
lib/libc/include/aarch64-macos-gnu/dispatch/group.h
Normal file
@ -0,0 +1,279 @@
|
||||
/*
|
||||
* Copyright (c) 2008-2013 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_APACHE_LICENSE_HEADER_START@
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_APACHE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef __DISPATCH_GROUP__
|
||||
#define __DISPATCH_GROUP__
|
||||
|
||||
#ifndef __DISPATCH_INDIRECT__
|
||||
#error "Please #include <dispatch/dispatch.h> instead of this file directly."
|
||||
#include <dispatch/base.h> // for HeaderDoc
|
||||
#endif
|
||||
|
||||
DISPATCH_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/*!
|
||||
* @typedef dispatch_group_t
|
||||
* @abstract
|
||||
* A group of blocks submitted to queues for asynchronous invocation.
|
||||
*/
|
||||
DISPATCH_DECL(dispatch_group);
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/*!
|
||||
* @function dispatch_group_create
|
||||
*
|
||||
* @abstract
|
||||
* Creates new group with which blocks may be associated.
|
||||
*
|
||||
* @discussion
|
||||
* This function creates a new group with which blocks may be associated.
|
||||
* The dispatch group may be used to wait for the completion of the blocks it
|
||||
* references. The group object memory is freed with dispatch_release().
|
||||
*
|
||||
* @result
|
||||
* The newly created group, or NULL on failure.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT
|
||||
DISPATCH_NOTHROW
|
||||
dispatch_group_t
|
||||
dispatch_group_create(void);
|
||||
|
||||
/*!
|
||||
* @function dispatch_group_async
|
||||
*
|
||||
* @abstract
|
||||
* Submits a block to a dispatch queue and associates the block with the given
|
||||
* dispatch group.
|
||||
*
|
||||
* @discussion
|
||||
* Submits a block to a dispatch queue and associates the block with the given
|
||||
* dispatch group. The dispatch group may be used to wait for the completion
|
||||
* of the blocks it references.
|
||||
*
|
||||
* @param group
|
||||
* A dispatch group to associate with the submitted block.
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*
|
||||
* @param queue
|
||||
* The dispatch queue to which the block will be submitted for asynchronous
|
||||
* invocation.
|
||||
*
|
||||
* @param block
|
||||
* The block to perform asynchronously.
|
||||
*/
|
||||
#ifdef __BLOCKS__
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_group_async(dispatch_group_t group,
|
||||
dispatch_queue_t queue,
|
||||
dispatch_block_t block);
|
||||
#endif /* __BLOCKS__ */
|
||||
|
||||
/*!
|
||||
* @function dispatch_group_async_f
|
||||
*
|
||||
* @abstract
|
||||
* Submits a function to a dispatch queue and associates the block with the
|
||||
* given dispatch group.
|
||||
*
|
||||
* @discussion
|
||||
* See dispatch_group_async() for details.
|
||||
*
|
||||
* @param group
|
||||
* A dispatch group to associate with the submitted function.
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*
|
||||
* @param queue
|
||||
* The dispatch queue to which the function will be submitted for asynchronous
|
||||
* invocation.
|
||||
*
|
||||
* @param context
|
||||
* The application-defined context parameter to pass to the function.
|
||||
*
|
||||
* @param work
|
||||
* The application-defined function to invoke on the target queue. The first
|
||||
* parameter passed to this function is the context provided to
|
||||
* dispatch_group_async_f().
|
||||
*/
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NONNULL2 DISPATCH_NONNULL4
|
||||
DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_group_async_f(dispatch_group_t group,
|
||||
dispatch_queue_t queue,
|
||||
void *_Nullable context,
|
||||
dispatch_function_t work);
|
||||
|
||||
/*!
|
||||
* @function dispatch_group_wait
|
||||
*
|
||||
* @abstract
|
||||
* Wait synchronously until all the blocks associated with a group have
|
||||
* completed or until the specified timeout has elapsed.
|
||||
*
|
||||
* @discussion
|
||||
* This function waits for the completion of the blocks associated with the
|
||||
* given dispatch group, and returns after all blocks have completed or when
|
||||
* the specified timeout has elapsed.
|
||||
*
|
||||
* This function will return immediately if there are no blocks associated
|
||||
* with the dispatch group (i.e. the group is empty).
|
||||
*
|
||||
* The result of calling this function from multiple threads simultaneously
|
||||
* with the same dispatch group is undefined.
|
||||
*
|
||||
* After the successful return of this function, the dispatch group is empty.
|
||||
* It may either be released with dispatch_release() or re-used for additional
|
||||
* blocks. See dispatch_group_async() for more information.
|
||||
*
|
||||
* @param group
|
||||
* The dispatch group to wait on.
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*
|
||||
* @param timeout
|
||||
* When to timeout (see dispatch_time). As a convenience, there are the
|
||||
* DISPATCH_TIME_NOW and DISPATCH_TIME_FOREVER constants.
|
||||
*
|
||||
* @result
|
||||
* Returns zero on success (all blocks associated with the group completed
|
||||
* within the specified timeout) or non-zero on error (i.e. timed out).
|
||||
*/
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
|
||||
intptr_t
|
||||
dispatch_group_wait(dispatch_group_t group, dispatch_time_t timeout);
|
||||
|
||||
/*!
|
||||
* @function dispatch_group_notify
|
||||
*
|
||||
* @abstract
|
||||
* Schedule a block to be submitted to a queue when all the blocks associated
|
||||
* with a group have completed.
|
||||
*
|
||||
* @discussion
|
||||
* This function schedules a notification block to be submitted to the specified
|
||||
* queue once all blocks associated with the dispatch group have completed.
|
||||
*
|
||||
* If no blocks are associated with the dispatch group (i.e. the group is empty)
|
||||
* then the notification block will be submitted immediately.
|
||||
*
|
||||
* The group will be empty at the time the notification block is submitted to
|
||||
* the target queue. The group may either be released with dispatch_release()
|
||||
* or reused for additional operations.
|
||||
* See dispatch_group_async() for more information.
|
||||
*
|
||||
* @param group
|
||||
* The dispatch group to observe.
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*
|
||||
* @param queue
|
||||
* The queue to which the supplied block will be submitted when the group
|
||||
* completes.
|
||||
*
|
||||
* @param block
|
||||
* The block to submit when the group completes.
|
||||
*/
|
||||
#ifdef __BLOCKS__
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_group_notify(dispatch_group_t group,
|
||||
dispatch_queue_t queue,
|
||||
dispatch_block_t block);
|
||||
#endif /* __BLOCKS__ */
|
||||
|
||||
/*!
|
||||
* @function dispatch_group_notify_f
|
||||
*
|
||||
* @abstract
|
||||
* Schedule a function to be submitted to a queue when all the blocks
|
||||
* associated with a group have completed.
|
||||
*
|
||||
* @discussion
|
||||
* See dispatch_group_notify() for details.
|
||||
*
|
||||
* @param group
|
||||
* The dispatch group to observe.
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*
|
||||
* @param context
|
||||
* The application-defined context parameter to pass to the function.
|
||||
*
|
||||
* @param work
|
||||
* The application-defined function to invoke on the target queue. The first
|
||||
* parameter passed to this function is the context provided to
|
||||
* dispatch_group_notify_f().
|
||||
*/
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NONNULL2 DISPATCH_NONNULL4
|
||||
DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_group_notify_f(dispatch_group_t group,
|
||||
dispatch_queue_t queue,
|
||||
void *_Nullable context,
|
||||
dispatch_function_t work);
|
||||
|
||||
/*!
|
||||
* @function dispatch_group_enter
|
||||
*
|
||||
* @abstract
|
||||
* Manually indicate a block has entered the group
|
||||
*
|
||||
* @discussion
|
||||
* Calling this function indicates another block has joined the group through
|
||||
* a means other than dispatch_group_async(). Calls to this function must be
|
||||
* balanced with dispatch_group_leave().
|
||||
*
|
||||
* @param group
|
||||
* The dispatch group to update.
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_group_enter(dispatch_group_t group);
|
||||
|
||||
/*!
|
||||
* @function dispatch_group_leave
|
||||
*
|
||||
* @abstract
|
||||
* Manually indicate a block in the group has completed
|
||||
*
|
||||
* @discussion
|
||||
* Calling this function indicates block has completed and left the dispatch
|
||||
* group by a means other than dispatch_group_async().
|
||||
*
|
||||
* @param group
|
||||
* The dispatch group to update.
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_group_leave(dispatch_group_t group);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
DISPATCH_ASSUME_NONNULL_END
|
||||
|
||||
#endif
|
||||
606
lib/libc/include/aarch64-macos-gnu/dispatch/object.h
Normal file
606
lib/libc/include/aarch64-macos-gnu/dispatch/object.h
Normal file
@ -0,0 +1,606 @@
|
||||
/*
|
||||
* Copyright (c) 2008-2012 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_APACHE_LICENSE_HEADER_START@
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_APACHE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef __DISPATCH_OBJECT__
|
||||
#define __DISPATCH_OBJECT__
|
||||
|
||||
#ifndef __DISPATCH_INDIRECT__
|
||||
#error "Please #include <dispatch/dispatch.h> instead of this file directly."
|
||||
#include <dispatch/base.h> // for HeaderDoc
|
||||
#endif
|
||||
|
||||
#if __has_include(<sys/qos.h>)
|
||||
#include <sys/qos.h>
|
||||
#endif
|
||||
|
||||
DISPATCH_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/*!
|
||||
* @typedef dispatch_object_t
|
||||
*
|
||||
* @abstract
|
||||
* Abstract base type for all dispatch objects.
|
||||
* The details of the type definition are language-specific.
|
||||
*
|
||||
* @discussion
|
||||
* Dispatch objects are reference counted via calls to dispatch_retain() and
|
||||
* dispatch_release().
|
||||
*/
|
||||
|
||||
#if OS_OBJECT_USE_OBJC
|
||||
/*
|
||||
* By default, dispatch objects are declared as Objective-C types when building
|
||||
* with an Objective-C compiler. This allows them to participate in ARC, in RR
|
||||
* management by the Blocks runtime and in leaks checking by the static
|
||||
* analyzer, and enables them to be added to Cocoa collections.
|
||||
* See <os/object.h> for details.
|
||||
*/
|
||||
OS_OBJECT_DECL_CLASS(dispatch_object);
|
||||
|
||||
#if OS_OBJECT_SWIFT3
|
||||
#define DISPATCH_DECL(name) OS_OBJECT_DECL_SUBCLASS_SWIFT(name, dispatch_object)
|
||||
#define DISPATCH_DECL_SUBCLASS(name, base) OS_OBJECT_DECL_SUBCLASS_SWIFT(name, base)
|
||||
#else // OS_OBJECT_SWIFT3
|
||||
#define DISPATCH_DECL(name) OS_OBJECT_DECL_SUBCLASS(name, dispatch_object)
|
||||
#define DISPATCH_DECL_SUBCLASS(name, base) OS_OBJECT_DECL_SUBCLASS(name, base)
|
||||
|
||||
DISPATCH_INLINE DISPATCH_ALWAYS_INLINE DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
|
||||
void
|
||||
_dispatch_object_validate(dispatch_object_t object)
|
||||
{
|
||||
void *isa = *(void *volatile*)(OS_OBJECT_BRIDGE void*)object;
|
||||
(void)isa;
|
||||
}
|
||||
#endif // OS_OBJECT_SWIFT3
|
||||
|
||||
#define DISPATCH_GLOBAL_OBJECT(type, object) ((OS_OBJECT_BRIDGE type)&(object))
|
||||
#define DISPATCH_RETURNS_RETAINED OS_OBJECT_RETURNS_RETAINED
|
||||
#elif defined(__cplusplus) && !defined(__DISPATCH_BUILDING_DISPATCH__)
|
||||
/*
|
||||
* Dispatch objects are NOT C++ objects. Nevertheless, we can at least keep C++
|
||||
* aware of type compatibility.
|
||||
*/
|
||||
typedef struct dispatch_object_s {
|
||||
private:
|
||||
dispatch_object_s();
|
||||
~dispatch_object_s();
|
||||
dispatch_object_s(const dispatch_object_s &);
|
||||
void operator=(const dispatch_object_s &);
|
||||
} *dispatch_object_t;
|
||||
#define DISPATCH_DECL(name) \
|
||||
typedef struct name##_s : public dispatch_object_s {} *name##_t
|
||||
#define DISPATCH_DECL_SUBCLASS(name, base) \
|
||||
typedef struct name##_s : public base##_s {} *name##_t
|
||||
#define DISPATCH_GLOBAL_OBJECT(type, object) (static_cast<type>(&(object)))
|
||||
#define DISPATCH_RETURNS_RETAINED
|
||||
#else /* Plain C */
|
||||
typedef union {
|
||||
struct _os_object_s *_os_obj;
|
||||
struct dispatch_object_s *_do;
|
||||
struct dispatch_queue_s *_dq;
|
||||
struct dispatch_queue_attr_s *_dqa;
|
||||
struct dispatch_group_s *_dg;
|
||||
struct dispatch_source_s *_ds;
|
||||
struct dispatch_channel_s *_dch;
|
||||
struct dispatch_mach_s *_dm;
|
||||
struct dispatch_mach_msg_s *_dmsg;
|
||||
struct dispatch_semaphore_s *_dsema;
|
||||
struct dispatch_data_s *_ddata;
|
||||
struct dispatch_io_s *_dchannel;
|
||||
} dispatch_object_t DISPATCH_TRANSPARENT_UNION;
|
||||
#define DISPATCH_DECL(name) typedef struct name##_s *name##_t
|
||||
#define DISPATCH_DECL_SUBCLASS(name, base) typedef base##_t name##_t
|
||||
#define DISPATCH_GLOBAL_OBJECT(type, object) ((type)&(object))
|
||||
#define DISPATCH_RETURNS_RETAINED
|
||||
#endif
|
||||
|
||||
#if OS_OBJECT_SWIFT3 && OS_OBJECT_USE_OBJC
|
||||
#define DISPATCH_SOURCE_TYPE_DECL(name) \
|
||||
DISPATCH_EXPORT struct dispatch_source_type_s \
|
||||
_dispatch_source_type_##name; \
|
||||
OS_OBJECT_DECL_PROTOCOL(dispatch_source_##name, <OS_dispatch_source>); \
|
||||
OS_OBJECT_CLASS_IMPLEMENTS_PROTOCOL( \
|
||||
dispatch_source, dispatch_source_##name)
|
||||
#define DISPATCH_SOURCE_DECL(name) \
|
||||
DISPATCH_DECL(name); \
|
||||
OS_OBJECT_DECL_PROTOCOL(name, <NSObject>); \
|
||||
OS_OBJECT_CLASS_IMPLEMENTS_PROTOCOL(name, name)
|
||||
#ifndef DISPATCH_DATA_DECL
|
||||
#define DISPATCH_DATA_DECL(name) OS_OBJECT_DECL_SWIFT(name)
|
||||
#endif // DISPATCH_DATA_DECL
|
||||
#else
|
||||
#define DISPATCH_SOURCE_DECL(name) \
|
||||
DISPATCH_DECL(name);
|
||||
#define DISPATCH_DATA_DECL(name) DISPATCH_DECL(name)
|
||||
#define DISPATCH_SOURCE_TYPE_DECL(name) \
|
||||
DISPATCH_EXPORT const struct dispatch_source_type_s \
|
||||
_dispatch_source_type_##name
|
||||
#endif
|
||||
|
||||
#ifdef __BLOCKS__
|
||||
/*!
|
||||
* @typedef dispatch_block_t
|
||||
*
|
||||
* @abstract
|
||||
* The type of blocks submitted to dispatch queues, which take no arguments
|
||||
* and have no return value.
|
||||
*
|
||||
* @discussion
|
||||
* When not building with Objective-C ARC, a block object allocated on or
|
||||
* copied to the heap must be released with a -[release] message or the
|
||||
* Block_release() function.
|
||||
*
|
||||
* The declaration of a block literal allocates storage on the stack.
|
||||
* Therefore, this is an invalid construct:
|
||||
* <code>
|
||||
* dispatch_block_t block;
|
||||
* if (x) {
|
||||
* block = ^{ printf("true\n"); };
|
||||
* } else {
|
||||
* block = ^{ printf("false\n"); };
|
||||
* }
|
||||
* block(); // unsafe!!!
|
||||
* </code>
|
||||
*
|
||||
* What is happening behind the scenes:
|
||||
* <code>
|
||||
* if (x) {
|
||||
* struct Block __tmp_1 = ...; // setup details
|
||||
* block = &__tmp_1;
|
||||
* } else {
|
||||
* struct Block __tmp_2 = ...; // setup details
|
||||
* block = &__tmp_2;
|
||||
* }
|
||||
* </code>
|
||||
*
|
||||
* As the example demonstrates, the address of a stack variable is escaping the
|
||||
* scope in which it is allocated. That is a classic C bug.
|
||||
*
|
||||
* Instead, the block literal must be copied to the heap with the Block_copy()
|
||||
* function or by sending it a -[copy] message.
|
||||
*/
|
||||
typedef void (^dispatch_block_t)(void);
|
||||
#endif // __BLOCKS__
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/*!
|
||||
* @typedef dispatch_qos_class_t
|
||||
* Alias for qos_class_t type.
|
||||
*/
|
||||
#if __has_include(<sys/qos.h>)
|
||||
typedef qos_class_t dispatch_qos_class_t;
|
||||
#else
|
||||
typedef unsigned int dispatch_qos_class_t;
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* @function dispatch_retain
|
||||
*
|
||||
* @abstract
|
||||
* Increment the reference count of a dispatch object.
|
||||
*
|
||||
* @discussion
|
||||
* Calls to dispatch_retain() must be balanced with calls to
|
||||
* dispatch_release().
|
||||
*
|
||||
* @param object
|
||||
* The object to retain.
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
|
||||
DISPATCH_SWIFT_UNAVAILABLE("Can't be used with ARC")
|
||||
void
|
||||
dispatch_retain(dispatch_object_t object);
|
||||
#if OS_OBJECT_USE_OBJC_RETAIN_RELEASE
|
||||
#undef dispatch_retain
|
||||
#define dispatch_retain(object) \
|
||||
__extension__({ dispatch_object_t _o = (object); \
|
||||
_dispatch_object_validate(_o); (void)[_o retain]; })
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* @function dispatch_release
|
||||
*
|
||||
* @abstract
|
||||
* Decrement the reference count of a dispatch object.
|
||||
*
|
||||
* @discussion
|
||||
* A dispatch object is asynchronously deallocated once all references are
|
||||
* released (i.e. the reference count becomes zero). The system does not
|
||||
* guarantee that a given client is the last or only reference to a given
|
||||
* object.
|
||||
*
|
||||
* @param object
|
||||
* The object to release.
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
|
||||
DISPATCH_SWIFT_UNAVAILABLE("Can't be used with ARC")
|
||||
void
|
||||
dispatch_release(dispatch_object_t object);
|
||||
#if OS_OBJECT_USE_OBJC_RETAIN_RELEASE
|
||||
#undef dispatch_release
|
||||
#define dispatch_release(object) \
|
||||
__extension__({ dispatch_object_t _o = (object); \
|
||||
_dispatch_object_validate(_o); [_o release]; })
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* @function dispatch_get_context
|
||||
*
|
||||
* @abstract
|
||||
* Returns the application defined context of the object.
|
||||
*
|
||||
* @param object
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*
|
||||
* @result
|
||||
* The context of the object; may be NULL.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_PURE DISPATCH_WARN_RESULT
|
||||
DISPATCH_NOTHROW
|
||||
void *_Nullable
|
||||
dispatch_get_context(dispatch_object_t object);
|
||||
|
||||
/*!
|
||||
* @function dispatch_set_context
|
||||
*
|
||||
* @abstract
|
||||
* Associates an application defined context with the object.
|
||||
*
|
||||
* @param object
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*
|
||||
* @param context
|
||||
* The new client defined context for the object. This may be NULL.
|
||||
*
|
||||
*/
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_set_context(dispatch_object_t object, void *_Nullable context);
|
||||
|
||||
/*!
|
||||
* @function dispatch_set_finalizer_f
|
||||
*
|
||||
* @abstract
|
||||
* Set the finalizer function for a dispatch object.
|
||||
*
|
||||
* @param object
|
||||
* The dispatch object to modify.
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*
|
||||
* @param finalizer
|
||||
* The finalizer function pointer.
|
||||
*
|
||||
* @discussion
|
||||
* A dispatch object's finalizer will be invoked on the object's target queue
|
||||
* after all references to the object have been released. This finalizer may be
|
||||
* used by the application to release any resources associated with the object,
|
||||
* such as freeing the object's context.
|
||||
* The context parameter passed to the finalizer function is the current
|
||||
* context of the dispatch object at the time the finalizer call is made.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_set_finalizer_f(dispatch_object_t object,
|
||||
dispatch_function_t _Nullable finalizer);
|
||||
|
||||
/*!
|
||||
* @function dispatch_activate
|
||||
*
|
||||
* @abstract
|
||||
* Activates the specified dispatch object.
|
||||
*
|
||||
* @discussion
|
||||
* Dispatch objects such as queues and sources may be created in an inactive
|
||||
* state. Objects in this state have to be activated before any blocks
|
||||
* associated with them will be invoked.
|
||||
*
|
||||
* The target queue of inactive objects can be changed using
|
||||
* dispatch_set_target_queue(). Change of target queue is no longer permitted
|
||||
* once an initially inactive object has been activated.
|
||||
*
|
||||
* Calling dispatch_activate() on an active object has no effect.
|
||||
* Releasing the last reference count on an inactive object is undefined.
|
||||
*
|
||||
* @param object
|
||||
* The object to be activated.
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.12), ios(10.0), tvos(10.0), watchos(3.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_activate(dispatch_object_t object);
|
||||
|
||||
/*!
|
||||
* @function dispatch_suspend
|
||||
*
|
||||
* @abstract
|
||||
* Suspends the invocation of blocks on a dispatch object.
|
||||
*
|
||||
* @discussion
|
||||
* A suspended object will not invoke any blocks associated with it. The
|
||||
* suspension of an object will occur after any running block associated with
|
||||
* the object completes.
|
||||
*
|
||||
* Calls to dispatch_suspend() must be balanced with calls
|
||||
* to dispatch_resume().
|
||||
*
|
||||
* @param object
|
||||
* The object to be suspended.
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_suspend(dispatch_object_t object);
|
||||
|
||||
/*!
|
||||
* @function dispatch_resume
|
||||
*
|
||||
* @abstract
|
||||
* Resumes the invocation of blocks on a dispatch object.
|
||||
*
|
||||
* @discussion
|
||||
* Dispatch objects can be suspended with dispatch_suspend(), which increments
|
||||
* an internal suspension count. dispatch_resume() is the inverse operation,
|
||||
* and consumes suspension counts. When the last suspension count is consumed,
|
||||
* blocks associated with the object will be invoked again.
|
||||
*
|
||||
* For backward compatibility reasons, dispatch_resume() on an inactive and not
|
||||
* otherwise suspended dispatch source object has the same effect as calling
|
||||
* dispatch_activate(). For new code, using dispatch_activate() is preferred.
|
||||
*
|
||||
* If the specified object has zero suspension count and is not an inactive
|
||||
* source, this function will result in an assertion and the process being
|
||||
* terminated.
|
||||
*
|
||||
* @param object
|
||||
* The object to be resumed.
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_resume(dispatch_object_t object);
|
||||
|
||||
/*!
|
||||
* @function dispatch_set_qos_class_floor
|
||||
*
|
||||
* @abstract
|
||||
* Sets the QOS class floor on a dispatch queue, source or workloop.
|
||||
*
|
||||
* @discussion
|
||||
* The QOS class of workitems submitted to this object asynchronously will be
|
||||
* elevated to at least the specified QOS class floor. The QOS of the workitem
|
||||
* will be used if higher than the floor even when the workitem has been created
|
||||
* without "ENFORCE" semantics.
|
||||
*
|
||||
* Setting the QOS class floor is equivalent to the QOS effects of configuring
|
||||
* a queue whose target queue has a QoS class set to the same value.
|
||||
*
|
||||
* @param object
|
||||
* A dispatch queue, workloop, or source to configure.
|
||||
* The object must be inactive.
|
||||
*
|
||||
* Passing another object type or an object that has been activated is undefined
|
||||
* and will cause the process to be terminated.
|
||||
*
|
||||
* @param qos_class
|
||||
* A QOS class value:
|
||||
* - QOS_CLASS_USER_INTERACTIVE
|
||||
* - QOS_CLASS_USER_INITIATED
|
||||
* - QOS_CLASS_DEFAULT
|
||||
* - QOS_CLASS_UTILITY
|
||||
* - QOS_CLASS_BACKGROUND
|
||||
* Passing any other value is undefined.
|
||||
*
|
||||
* @param relative_priority
|
||||
* A relative priority within the QOS class. This value is a negative
|
||||
* offset from the maximum supported scheduler priority for the given class.
|
||||
* Passing a value greater than zero or less than QOS_MIN_RELATIVE_PRIORITY
|
||||
* is undefined.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0))
|
||||
DISPATCH_EXPORT DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_set_qos_class_floor(dispatch_object_t object,
|
||||
dispatch_qos_class_t qos_class, int relative_priority);
|
||||
|
||||
#ifdef __BLOCKS__
|
||||
/*!
|
||||
* @function dispatch_wait
|
||||
*
|
||||
* @abstract
|
||||
* Wait synchronously for an object or until the specified timeout has elapsed.
|
||||
*
|
||||
* @discussion
|
||||
* Type-generic macro that maps to dispatch_block_wait, dispatch_group_wait or
|
||||
* dispatch_semaphore_wait, depending on the type of the first argument.
|
||||
* See documentation for these functions for more details.
|
||||
* This function is unavailable for any other object type.
|
||||
*
|
||||
* @param object
|
||||
* The object to wait on.
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*
|
||||
* @param timeout
|
||||
* When to timeout (see dispatch_time). As a convenience, there are the
|
||||
* DISPATCH_TIME_NOW and DISPATCH_TIME_FOREVER constants.
|
||||
*
|
||||
* @result
|
||||
* Returns zero on success or non-zero on error (i.e. timed out).
|
||||
*/
|
||||
DISPATCH_UNAVAILABLE
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW
|
||||
intptr_t
|
||||
dispatch_wait(void *object, dispatch_time_t timeout);
|
||||
#if __has_extension(c_generic_selections)
|
||||
#define dispatch_wait(object, timeout) \
|
||||
_Generic((object), \
|
||||
dispatch_block_t:dispatch_block_wait, \
|
||||
dispatch_group_t:dispatch_group_wait, \
|
||||
dispatch_semaphore_t:dispatch_semaphore_wait \
|
||||
)((object),(timeout))
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* @function dispatch_notify
|
||||
*
|
||||
* @abstract
|
||||
* Schedule a notification block to be submitted to a queue when the execution
|
||||
* of a specified object has completed.
|
||||
*
|
||||
* @discussion
|
||||
* Type-generic macro that maps to dispatch_block_notify or
|
||||
* dispatch_group_notify, depending on the type of the first argument.
|
||||
* See documentation for these functions for more details.
|
||||
* This function is unavailable for any other object type.
|
||||
*
|
||||
* @param object
|
||||
* The object to observe.
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*
|
||||
* @param queue
|
||||
* The queue to which the supplied notification block will be submitted when
|
||||
* the observed object completes.
|
||||
*
|
||||
* @param notification_block
|
||||
* The block to submit when the observed object completes.
|
||||
*/
|
||||
DISPATCH_UNAVAILABLE
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_notify(void *object, dispatch_object_t queue,
|
||||
dispatch_block_t notification_block);
|
||||
#if __has_extension(c_generic_selections)
|
||||
#define dispatch_notify(object, queue, notification_block) \
|
||||
_Generic((object), \
|
||||
dispatch_block_t:dispatch_block_notify, \
|
||||
dispatch_group_t:dispatch_group_notify \
|
||||
)((object),(queue), (notification_block))
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* @function dispatch_cancel
|
||||
*
|
||||
* @abstract
|
||||
* Cancel the specified object.
|
||||
*
|
||||
* @discussion
|
||||
* Type-generic macro that maps to dispatch_block_cancel or
|
||||
* dispatch_source_cancel, depending on the type of the first argument.
|
||||
* See documentation for these functions for more details.
|
||||
* This function is unavailable for any other object type.
|
||||
*
|
||||
* @param object
|
||||
* The object to cancel.
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*/
|
||||
DISPATCH_UNAVAILABLE
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_cancel(void *object);
|
||||
#if __has_extension(c_generic_selections)
|
||||
#define dispatch_cancel(object) \
|
||||
_Generic((object), \
|
||||
dispatch_block_t:dispatch_block_cancel, \
|
||||
dispatch_source_t:dispatch_source_cancel \
|
||||
)((object))
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* @function dispatch_testcancel
|
||||
*
|
||||
* @abstract
|
||||
* Test whether the specified object has been canceled
|
||||
*
|
||||
* @discussion
|
||||
* Type-generic macro that maps to dispatch_block_testcancel or
|
||||
* dispatch_source_testcancel, depending on the type of the first argument.
|
||||
* See documentation for these functions for more details.
|
||||
* This function is unavailable for any other object type.
|
||||
*
|
||||
* @param object
|
||||
* The object to test.
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*
|
||||
* @result
|
||||
* Non-zero if canceled and zero if not canceled.
|
||||
*/
|
||||
DISPATCH_UNAVAILABLE
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_WARN_RESULT DISPATCH_PURE
|
||||
DISPATCH_NOTHROW
|
||||
intptr_t
|
||||
dispatch_testcancel(void *object);
|
||||
#if __has_extension(c_generic_selections)
|
||||
#define dispatch_testcancel(object) \
|
||||
_Generic((object), \
|
||||
dispatch_block_t:dispatch_block_testcancel, \
|
||||
dispatch_source_t:dispatch_source_testcancel \
|
||||
)((object))
|
||||
#endif
|
||||
#endif // __BLOCKS__
|
||||
|
||||
/*!
|
||||
* @function dispatch_debug
|
||||
*
|
||||
* @abstract
|
||||
* Programmatically log debug information about a dispatch object.
|
||||
*
|
||||
* @discussion
|
||||
* Programmatically log debug information about a dispatch object. By default,
|
||||
* the log output is sent to syslog at notice level. In the debug version of
|
||||
* the library, the log output is sent to a file in /var/tmp.
|
||||
* The log output destination can be configured via the LIBDISPATCH_LOG
|
||||
* environment variable, valid values are: YES, NO, syslog, stderr, file.
|
||||
*
|
||||
* This function is deprecated and will be removed in a future release.
|
||||
* Objective-C callers may use -debugDescription instead.
|
||||
*
|
||||
* @param object
|
||||
* The object to introspect.
|
||||
*
|
||||
* @param message
|
||||
* The message to log above and beyond the introspection.
|
||||
*/
|
||||
API_DEPRECATED("unsupported interface", macos(10.6,10.9), ios(4.0,6.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL2 DISPATCH_NOTHROW DISPATCH_COLD
|
||||
__attribute__((__format__(printf,2,3)))
|
||||
void
|
||||
dispatch_debug(dispatch_object_t object, const char *message, ...);
|
||||
|
||||
API_DEPRECATED("unsupported interface", macos(10.6,10.9), ios(4.0,6.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL2 DISPATCH_NOTHROW DISPATCH_COLD
|
||||
__attribute__((__format__(printf,2,0)))
|
||||
void
|
||||
dispatch_debugv(dispatch_object_t object, const char *message, va_list ap);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
DISPATCH_ASSUME_NONNULL_END
|
||||
|
||||
#endif
|
||||
1674
lib/libc/include/aarch64-macos-gnu/dispatch/queue.h
Normal file
1674
lib/libc/include/aarch64-macos-gnu/dispatch/queue.h
Normal file
File diff suppressed because it is too large
Load Diff
117
lib/libc/include/aarch64-macos-gnu/dispatch/semaphore.h
Normal file
117
lib/libc/include/aarch64-macos-gnu/dispatch/semaphore.h
Normal file
@ -0,0 +1,117 @@
|
||||
/*
|
||||
* Copyright (c) 2008-2013 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_APACHE_LICENSE_HEADER_START@
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_APACHE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef __DISPATCH_SEMAPHORE__
|
||||
#define __DISPATCH_SEMAPHORE__
|
||||
|
||||
#ifndef __DISPATCH_INDIRECT__
|
||||
#error "Please #include <dispatch/dispatch.h> instead of this file directly."
|
||||
#include <dispatch/base.h> // for HeaderDoc
|
||||
#endif
|
||||
|
||||
DISPATCH_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/*!
|
||||
* @typedef dispatch_semaphore_t
|
||||
*
|
||||
* @abstract
|
||||
* A counting semaphore.
|
||||
*/
|
||||
DISPATCH_DECL(dispatch_semaphore);
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/*!
|
||||
* @function dispatch_semaphore_create
|
||||
*
|
||||
* @abstract
|
||||
* Creates new counting semaphore with an initial value.
|
||||
*
|
||||
* @discussion
|
||||
* Passing zero for the value is useful for when two threads need to reconcile
|
||||
* the completion of a particular event. Passing a value greater than zero is
|
||||
* useful for managing a finite pool of resources, where the pool size is equal
|
||||
* to the value.
|
||||
*
|
||||
* @param value
|
||||
* The starting value for the semaphore. Passing a value less than zero will
|
||||
* cause NULL to be returned.
|
||||
*
|
||||
* @result
|
||||
* The newly created semaphore, or NULL on failure.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT
|
||||
DISPATCH_NOTHROW
|
||||
dispatch_semaphore_t
|
||||
dispatch_semaphore_create(intptr_t value);
|
||||
|
||||
/*!
|
||||
* @function dispatch_semaphore_wait
|
||||
*
|
||||
* @abstract
|
||||
* Wait (decrement) for a semaphore.
|
||||
*
|
||||
* @discussion
|
||||
* Decrement the counting semaphore. If the resulting value is less than zero,
|
||||
* this function waits for a signal to occur before returning.
|
||||
*
|
||||
* @param dsema
|
||||
* The semaphore. The result of passing NULL in this parameter is undefined.
|
||||
*
|
||||
* @param timeout
|
||||
* When to timeout (see dispatch_time). As a convenience, there are the
|
||||
* DISPATCH_TIME_NOW and DISPATCH_TIME_FOREVER constants.
|
||||
*
|
||||
* @result
|
||||
* Returns zero on success, or non-zero if the timeout occurred.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
|
||||
intptr_t
|
||||
dispatch_semaphore_wait(dispatch_semaphore_t dsema, dispatch_time_t timeout);
|
||||
|
||||
/*!
|
||||
* @function dispatch_semaphore_signal
|
||||
*
|
||||
* @abstract
|
||||
* Signal (increment) a semaphore.
|
||||
*
|
||||
* @discussion
|
||||
* Increment the counting semaphore. If the previous value was less than zero,
|
||||
* this function wakes a waiting thread before returning.
|
||||
*
|
||||
* @param dsema The counting semaphore.
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*
|
||||
* @result
|
||||
* This function returns non-zero if a thread is woken. Otherwise, zero is
|
||||
* returned.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
|
||||
intptr_t
|
||||
dispatch_semaphore_signal(dispatch_semaphore_t dsema);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
DISPATCH_ASSUME_NONNULL_END
|
||||
|
||||
#endif /* __DISPATCH_SEMAPHORE__ */
|
||||
780
lib/libc/include/aarch64-macos-gnu/dispatch/source.h
Normal file
780
lib/libc/include/aarch64-macos-gnu/dispatch/source.h
Normal file
@ -0,0 +1,780 @@
|
||||
/*
|
||||
* Copyright (c) 2008-2013 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_APACHE_LICENSE_HEADER_START@
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_APACHE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef __DISPATCH_SOURCE__
|
||||
#define __DISPATCH_SOURCE__
|
||||
|
||||
#ifndef __DISPATCH_INDIRECT__
|
||||
#error "Please #include <dispatch/dispatch.h> instead of this file directly."
|
||||
#include <dispatch/base.h> // for HeaderDoc
|
||||
#endif
|
||||
|
||||
#if TARGET_OS_MAC
|
||||
#include <mach/port.h>
|
||||
#include <mach/message.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_WIN32)
|
||||
#include <sys/signal.h>
|
||||
#endif
|
||||
|
||||
DISPATCH_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/*!
|
||||
* @header
|
||||
* The dispatch framework provides a suite of interfaces for monitoring low-
|
||||
* level system objects (file descriptors, Mach ports, signals, VFS nodes, etc.)
|
||||
* for activity and automatically submitting event handler blocks to dispatch
|
||||
* queues when such activity occurs.
|
||||
*
|
||||
* This suite of interfaces is known as the Dispatch Source API.
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @typedef dispatch_source_t
|
||||
*
|
||||
* @abstract
|
||||
* Dispatch sources are used to automatically submit event handler blocks to
|
||||
* dispatch queues in response to external events.
|
||||
*/
|
||||
DISPATCH_SOURCE_DECL(dispatch_source);
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/*!
|
||||
* @typedef dispatch_source_type_t
|
||||
*
|
||||
* @abstract
|
||||
* Constants of this type represent the class of low-level system object that
|
||||
* is being monitored by the dispatch source. Constants of this type are
|
||||
* passed as a parameter to dispatch_source_create() and determine how the
|
||||
* handle argument is interpreted (i.e. as a file descriptor, mach port,
|
||||
* signal number, process identifier, etc.), and how the mask argument is
|
||||
* interpreted.
|
||||
*/
|
||||
typedef const struct dispatch_source_type_s *dispatch_source_type_t;
|
||||
|
||||
/*!
|
||||
* @const DISPATCH_SOURCE_TYPE_DATA_ADD
|
||||
* @discussion A dispatch source that coalesces data obtained via calls to
|
||||
* dispatch_source_merge_data(). An ADD is used to coalesce the data.
|
||||
* The handle is unused (pass zero for now).
|
||||
* The mask is unused (pass zero for now).
|
||||
*/
|
||||
#define DISPATCH_SOURCE_TYPE_DATA_ADD (&_dispatch_source_type_data_add)
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_SOURCE_TYPE_DECL(data_add);
|
||||
|
||||
/*!
|
||||
* @const DISPATCH_SOURCE_TYPE_DATA_OR
|
||||
* @discussion A dispatch source that coalesces data obtained via calls to
|
||||
* dispatch_source_merge_data(). A bitwise OR is used to coalesce the data.
|
||||
* The handle is unused (pass zero for now).
|
||||
* The mask is unused (pass zero for now).
|
||||
*/
|
||||
#define DISPATCH_SOURCE_TYPE_DATA_OR (&_dispatch_source_type_data_or)
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_SOURCE_TYPE_DECL(data_or);
|
||||
|
||||
/*!
|
||||
* @const DISPATCH_SOURCE_TYPE_DATA_REPLACE
|
||||
* @discussion A dispatch source that tracks data obtained via calls to
|
||||
* dispatch_source_merge_data(). Newly obtained data values replace existing
|
||||
* data values not yet delivered to the source handler
|
||||
*
|
||||
* A data value of zero will cause the source handler to not be invoked.
|
||||
*
|
||||
* The handle is unused (pass zero for now).
|
||||
* The mask is unused (pass zero for now).
|
||||
*/
|
||||
#define DISPATCH_SOURCE_TYPE_DATA_REPLACE (&_dispatch_source_type_data_replace)
|
||||
API_AVAILABLE(macos(10.13), ios(11.0), tvos(11.0), watchos(4.0))
|
||||
DISPATCH_SOURCE_TYPE_DECL(data_replace);
|
||||
|
||||
/*!
|
||||
* @const DISPATCH_SOURCE_TYPE_MACH_SEND
|
||||
* @discussion A dispatch source that monitors a Mach port for dead name
|
||||
* notifications (send right no longer has any corresponding receive right).
|
||||
* The handle is a Mach port with a send or send-once right (mach_port_t).
|
||||
* The mask is a mask of desired events from dispatch_source_mach_send_flags_t.
|
||||
*/
|
||||
#define DISPATCH_SOURCE_TYPE_MACH_SEND (&_dispatch_source_type_mach_send)
|
||||
API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_LINUX_UNAVAILABLE()
|
||||
DISPATCH_SOURCE_TYPE_DECL(mach_send);
|
||||
|
||||
/*!
|
||||
* @const DISPATCH_SOURCE_TYPE_MACH_RECV
|
||||
* @discussion A dispatch source that monitors a Mach port for pending messages.
|
||||
* The handle is a Mach port with a receive right (mach_port_t).
|
||||
* The mask is a mask of desired events from dispatch_source_mach_recv_flags_t,
|
||||
* but no flags are currently defined (pass zero for now).
|
||||
*/
|
||||
#define DISPATCH_SOURCE_TYPE_MACH_RECV (&_dispatch_source_type_mach_recv)
|
||||
API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_LINUX_UNAVAILABLE()
|
||||
DISPATCH_SOURCE_TYPE_DECL(mach_recv);
|
||||
|
||||
/*!
|
||||
* @const DISPATCH_SOURCE_TYPE_MEMORYPRESSURE
|
||||
* @discussion A dispatch source that monitors the system for changes in
|
||||
* memory pressure condition.
|
||||
* The handle is unused (pass zero for now).
|
||||
* The mask is a mask of desired events from
|
||||
* dispatch_source_memorypressure_flags_t.
|
||||
*/
|
||||
#define DISPATCH_SOURCE_TYPE_MEMORYPRESSURE \
|
||||
(&_dispatch_source_type_memorypressure)
|
||||
API_AVAILABLE(macos(10.9), ios(8.0)) DISPATCH_LINUX_UNAVAILABLE()
|
||||
DISPATCH_SOURCE_TYPE_DECL(memorypressure);
|
||||
|
||||
/*!
|
||||
* @const DISPATCH_SOURCE_TYPE_PROC
|
||||
* @discussion A dispatch source that monitors an external process for events
|
||||
* defined by dispatch_source_proc_flags_t.
|
||||
* The handle is a process identifier (pid_t).
|
||||
* The mask is a mask of desired events from dispatch_source_proc_flags_t.
|
||||
*/
|
||||
#define DISPATCH_SOURCE_TYPE_PROC (&_dispatch_source_type_proc)
|
||||
API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_LINUX_UNAVAILABLE()
|
||||
DISPATCH_SOURCE_TYPE_DECL(proc);
|
||||
|
||||
/*!
|
||||
* @const DISPATCH_SOURCE_TYPE_READ
|
||||
* @discussion A dispatch source that monitors a file descriptor for pending
|
||||
* bytes available to be read.
|
||||
* The handle is a file descriptor (int).
|
||||
* The mask is unused (pass zero for now).
|
||||
*/
|
||||
#define DISPATCH_SOURCE_TYPE_READ (&_dispatch_source_type_read)
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_SOURCE_TYPE_DECL(read);
|
||||
|
||||
/*!
|
||||
* @const DISPATCH_SOURCE_TYPE_SIGNAL
|
||||
* @discussion A dispatch source that monitors the current process for signals.
|
||||
* The handle is a signal number (int).
|
||||
* The mask is unused (pass zero for now).
|
||||
*/
|
||||
#define DISPATCH_SOURCE_TYPE_SIGNAL (&_dispatch_source_type_signal)
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_SOURCE_TYPE_DECL(signal);
|
||||
|
||||
/*!
|
||||
* @const DISPATCH_SOURCE_TYPE_TIMER
|
||||
* @discussion A dispatch source that submits the event handler block based
|
||||
* on a timer.
|
||||
* The handle is unused (pass zero for now).
|
||||
* The mask specifies which flags from dispatch_source_timer_flags_t to apply.
|
||||
*/
|
||||
#define DISPATCH_SOURCE_TYPE_TIMER (&_dispatch_source_type_timer)
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_SOURCE_TYPE_DECL(timer);
|
||||
|
||||
/*!
|
||||
* @const DISPATCH_SOURCE_TYPE_VNODE
|
||||
* @discussion A dispatch source that monitors a file descriptor for events
|
||||
* defined by dispatch_source_vnode_flags_t.
|
||||
* The handle is a file descriptor (int).
|
||||
* The mask is a mask of desired events from dispatch_source_vnode_flags_t.
|
||||
*/
|
||||
#define DISPATCH_SOURCE_TYPE_VNODE (&_dispatch_source_type_vnode)
|
||||
API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_LINUX_UNAVAILABLE()
|
||||
DISPATCH_SOURCE_TYPE_DECL(vnode);
|
||||
|
||||
/*!
|
||||
* @const DISPATCH_SOURCE_TYPE_WRITE
|
||||
* @discussion A dispatch source that monitors a file descriptor for available
|
||||
* buffer space to write bytes.
|
||||
* The handle is a file descriptor (int).
|
||||
* The mask is unused (pass zero for now).
|
||||
*/
|
||||
#define DISPATCH_SOURCE_TYPE_WRITE (&_dispatch_source_type_write)
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_SOURCE_TYPE_DECL(write);
|
||||
|
||||
/*!
|
||||
* @typedef dispatch_source_mach_send_flags_t
|
||||
* Type of dispatch_source_mach_send flags
|
||||
*
|
||||
* @constant DISPATCH_MACH_SEND_DEAD
|
||||
* The receive right corresponding to the given send right was destroyed.
|
||||
*/
|
||||
#define DISPATCH_MACH_SEND_DEAD 0x1
|
||||
|
||||
typedef unsigned long dispatch_source_mach_send_flags_t;
|
||||
|
||||
/*!
|
||||
* @typedef dispatch_source_mach_recv_flags_t
|
||||
* Type of dispatch_source_mach_recv flags
|
||||
*/
|
||||
typedef unsigned long dispatch_source_mach_recv_flags_t;
|
||||
|
||||
/*!
|
||||
* @typedef dispatch_source_memorypressure_flags_t
|
||||
* Type of dispatch_source_memorypressure flags
|
||||
*
|
||||
* @constant DISPATCH_MEMORYPRESSURE_NORMAL
|
||||
* The system memory pressure condition has returned to normal.
|
||||
*
|
||||
* @constant DISPATCH_MEMORYPRESSURE_WARN
|
||||
* The system memory pressure condition has changed to warning.
|
||||
*
|
||||
* @constant DISPATCH_MEMORYPRESSURE_CRITICAL
|
||||
* The system memory pressure condition has changed to critical.
|
||||
*
|
||||
* @discussion
|
||||
* Elevated memory pressure is a system-wide condition that applications
|
||||
* registered for this source should react to by changing their future memory
|
||||
* use behavior, e.g. by reducing cache sizes of newly initiated operations
|
||||
* until memory pressure returns back to normal.
|
||||
* NOTE: applications should NOT traverse and discard existing caches for past
|
||||
* operations when the system memory pressure enters an elevated state, as that
|
||||
* is likely to trigger VM operations that will further aggravate system memory
|
||||
* pressure.
|
||||
*/
|
||||
|
||||
#define DISPATCH_MEMORYPRESSURE_NORMAL 0x01
|
||||
#define DISPATCH_MEMORYPRESSURE_WARN 0x02
|
||||
#define DISPATCH_MEMORYPRESSURE_CRITICAL 0x04
|
||||
|
||||
typedef unsigned long dispatch_source_memorypressure_flags_t;
|
||||
|
||||
/*!
|
||||
* @typedef dispatch_source_proc_flags_t
|
||||
* Type of dispatch_source_proc flags
|
||||
*
|
||||
* @constant DISPATCH_PROC_EXIT
|
||||
* The process has exited (perhaps cleanly, perhaps not).
|
||||
*
|
||||
* @constant DISPATCH_PROC_FORK
|
||||
* The process has created one or more child processes.
|
||||
*
|
||||
* @constant DISPATCH_PROC_EXEC
|
||||
* The process has become another executable image via
|
||||
* exec*() or posix_spawn*().
|
||||
*
|
||||
* @constant DISPATCH_PROC_SIGNAL
|
||||
* A Unix signal was delivered to the process.
|
||||
*/
|
||||
#define DISPATCH_PROC_EXIT 0x80000000
|
||||
#define DISPATCH_PROC_FORK 0x40000000
|
||||
#define DISPATCH_PROC_EXEC 0x20000000
|
||||
#define DISPATCH_PROC_SIGNAL 0x08000000
|
||||
|
||||
typedef unsigned long dispatch_source_proc_flags_t;
|
||||
|
||||
/*!
|
||||
* @typedef dispatch_source_vnode_flags_t
|
||||
* Type of dispatch_source_vnode flags
|
||||
*
|
||||
* @constant DISPATCH_VNODE_DELETE
|
||||
* The filesystem object was deleted from the namespace.
|
||||
*
|
||||
* @constant DISPATCH_VNODE_WRITE
|
||||
* The filesystem object data changed.
|
||||
*
|
||||
* @constant DISPATCH_VNODE_EXTEND
|
||||
* The filesystem object changed in size.
|
||||
*
|
||||
* @constant DISPATCH_VNODE_ATTRIB
|
||||
* The filesystem object metadata changed.
|
||||
*
|
||||
* @constant DISPATCH_VNODE_LINK
|
||||
* The filesystem object link count changed.
|
||||
*
|
||||
* @constant DISPATCH_VNODE_RENAME
|
||||
* The filesystem object was renamed in the namespace.
|
||||
*
|
||||
* @constant DISPATCH_VNODE_REVOKE
|
||||
* The filesystem object was revoked.
|
||||
*
|
||||
* @constant DISPATCH_VNODE_FUNLOCK
|
||||
* The filesystem object was unlocked.
|
||||
*/
|
||||
|
||||
#define DISPATCH_VNODE_DELETE 0x1
|
||||
#define DISPATCH_VNODE_WRITE 0x2
|
||||
#define DISPATCH_VNODE_EXTEND 0x4
|
||||
#define DISPATCH_VNODE_ATTRIB 0x8
|
||||
#define DISPATCH_VNODE_LINK 0x10
|
||||
#define DISPATCH_VNODE_RENAME 0x20
|
||||
#define DISPATCH_VNODE_REVOKE 0x40
|
||||
#define DISPATCH_VNODE_FUNLOCK 0x100
|
||||
|
||||
typedef unsigned long dispatch_source_vnode_flags_t;
|
||||
|
||||
/*!
|
||||
* @typedef dispatch_source_timer_flags_t
|
||||
* Type of dispatch_source_timer flags
|
||||
*
|
||||
* @constant DISPATCH_TIMER_STRICT
|
||||
* Specifies that the system should make a best effort to strictly observe the
|
||||
* leeway value specified for the timer via dispatch_source_set_timer(), even
|
||||
* if that value is smaller than the default leeway value that would be applied
|
||||
* to the timer otherwise. A minimal amount of leeway will be applied to the
|
||||
* timer even if this flag is specified.
|
||||
*
|
||||
* CAUTION: Use of this flag may override power-saving techniques employed by
|
||||
* the system and cause higher power consumption, so it must be used with care
|
||||
* and only when absolutely necessary.
|
||||
*/
|
||||
|
||||
#define DISPATCH_TIMER_STRICT 0x1
|
||||
|
||||
typedef unsigned long dispatch_source_timer_flags_t;
|
||||
|
||||
/*!
|
||||
* @function dispatch_source_create
|
||||
*
|
||||
* @abstract
|
||||
* Creates a new dispatch source to monitor low-level system objects and auto-
|
||||
* matically submit a handler block to a dispatch queue in response to events.
|
||||
*
|
||||
* @discussion
|
||||
* Dispatch sources are not reentrant. Any events received while the dispatch
|
||||
* source is suspended or while the event handler block is currently executing
|
||||
* will be coalesced and delivered after the dispatch source is resumed or the
|
||||
* event handler block has returned.
|
||||
*
|
||||
* Dispatch sources are created in an inactive state. After creating the
|
||||
* source and setting any desired attributes (i.e. the handler, context, etc.),
|
||||
* a call must be made to dispatch_activate() in order to begin event delivery.
|
||||
*
|
||||
* Calling dispatch_set_target_queue() on a source once it has been activated
|
||||
* is not allowed (see dispatch_activate() and dispatch_set_target_queue()).
|
||||
*
|
||||
* For backward compatibility reasons, dispatch_resume() on an inactive,
|
||||
* and not otherwise suspended source has the same effect as calling
|
||||
* dispatch_activate(). For new code, using dispatch_activate() is preferred.
|
||||
*
|
||||
* @param type
|
||||
* Declares the type of the dispatch source. Must be one of the defined
|
||||
* dispatch_source_type_t constants.
|
||||
*
|
||||
* @param handle
|
||||
* The underlying system handle to monitor. The interpretation of this argument
|
||||
* is determined by the constant provided in the type parameter.
|
||||
*
|
||||
* @param mask
|
||||
* A mask of flags specifying which events are desired. The interpretation of
|
||||
* this argument is determined by the constant provided in the type parameter.
|
||||
*
|
||||
* @param queue
|
||||
* The dispatch queue to which the event handler block will be submitted.
|
||||
* If queue is DISPATCH_TARGET_QUEUE_DEFAULT, the source will submit the event
|
||||
* handler block to the default priority global queue.
|
||||
*
|
||||
* @result
|
||||
* The newly created dispatch source. Or NULL if invalid arguments are passed.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT
|
||||
DISPATCH_NOTHROW
|
||||
dispatch_source_t
|
||||
dispatch_source_create(dispatch_source_type_t type,
|
||||
uintptr_t handle,
|
||||
uintptr_t mask,
|
||||
dispatch_queue_t _Nullable queue);
|
||||
|
||||
/*!
|
||||
* @function dispatch_source_set_event_handler
|
||||
*
|
||||
* @abstract
|
||||
* Sets the event handler block for the given dispatch source.
|
||||
*
|
||||
* @param source
|
||||
* The dispatch source to modify.
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*
|
||||
* @param handler
|
||||
* The event handler block to submit to the source's target queue.
|
||||
*/
|
||||
#ifdef __BLOCKS__
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_source_set_event_handler(dispatch_source_t source,
|
||||
dispatch_block_t _Nullable handler);
|
||||
#endif /* __BLOCKS__ */
|
||||
|
||||
/*!
|
||||
* @function dispatch_source_set_event_handler_f
|
||||
*
|
||||
* @abstract
|
||||
* Sets the event handler function for the given dispatch source.
|
||||
*
|
||||
* @param source
|
||||
* The dispatch source to modify.
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*
|
||||
* @param handler
|
||||
* The event handler function to submit to the source's target queue.
|
||||
* The context parameter passed to the event handler function is the context of
|
||||
* the dispatch source current at the time the event handler was set.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_source_set_event_handler_f(dispatch_source_t source,
|
||||
dispatch_function_t _Nullable handler);
|
||||
|
||||
/*!
|
||||
* @function dispatch_source_set_cancel_handler
|
||||
*
|
||||
* @abstract
|
||||
* Sets the cancellation handler block for the given dispatch source.
|
||||
*
|
||||
* @discussion
|
||||
* The cancellation handler (if specified) will be submitted to the source's
|
||||
* target queue in response to a call to dispatch_source_cancel() once the
|
||||
* system has released all references to the source's underlying handle and
|
||||
* the source's event handler block has returned.
|
||||
*
|
||||
* IMPORTANT:
|
||||
* Source cancellation and a cancellation handler are required for file
|
||||
* descriptor and mach port based sources in order to safely close the
|
||||
* descriptor or destroy the port.
|
||||
* Closing the descriptor or port before the cancellation handler is invoked may
|
||||
* result in a race condition. If a new descriptor is allocated with the same
|
||||
* value as the recently closed descriptor while the source's event handler is
|
||||
* still running, the event handler may read/write data to the wrong descriptor.
|
||||
*
|
||||
* @param source
|
||||
* The dispatch source to modify.
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*
|
||||
* @param handler
|
||||
* The cancellation handler block to submit to the source's target queue.
|
||||
*/
|
||||
#ifdef __BLOCKS__
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_source_set_cancel_handler(dispatch_source_t source,
|
||||
dispatch_block_t _Nullable handler);
|
||||
#endif /* __BLOCKS__ */
|
||||
|
||||
/*!
|
||||
* @function dispatch_source_set_cancel_handler_f
|
||||
*
|
||||
* @abstract
|
||||
* Sets the cancellation handler function for the given dispatch source.
|
||||
*
|
||||
* @discussion
|
||||
* See dispatch_source_set_cancel_handler() for more details.
|
||||
*
|
||||
* @param source
|
||||
* The dispatch source to modify.
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*
|
||||
* @param handler
|
||||
* The cancellation handler function to submit to the source's target queue.
|
||||
* The context parameter passed to the event handler function is the current
|
||||
* context of the dispatch source at the time the handler call is made.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_source_set_cancel_handler_f(dispatch_source_t source,
|
||||
dispatch_function_t _Nullable handler);
|
||||
|
||||
/*!
|
||||
* @function dispatch_source_cancel
|
||||
*
|
||||
* @abstract
|
||||
* Asynchronously cancel the dispatch source, preventing any further invocation
|
||||
* of its event handler block.
|
||||
*
|
||||
* @discussion
|
||||
* Cancellation prevents any further invocation of the event handler block for
|
||||
* the specified dispatch source, but does not interrupt an event handler
|
||||
* block that is already in progress.
|
||||
*
|
||||
* The cancellation handler is submitted to the source's target queue once the
|
||||
* the source's event handler has finished, indicating it is now safe to close
|
||||
* the source's handle (i.e. file descriptor or mach port).
|
||||
*
|
||||
* See dispatch_source_set_cancel_handler() for more information.
|
||||
*
|
||||
* @param source
|
||||
* The dispatch source to be canceled.
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_source_cancel(dispatch_source_t source);
|
||||
|
||||
/*!
|
||||
* @function dispatch_source_testcancel
|
||||
*
|
||||
* @abstract
|
||||
* Tests whether the given dispatch source has been canceled.
|
||||
*
|
||||
* @param source
|
||||
* The dispatch source to be tested.
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*
|
||||
* @result
|
||||
* Non-zero if canceled and zero if not canceled.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_WARN_RESULT DISPATCH_PURE
|
||||
DISPATCH_NOTHROW
|
||||
intptr_t
|
||||
dispatch_source_testcancel(dispatch_source_t source);
|
||||
|
||||
/*!
|
||||
* @function dispatch_source_get_handle
|
||||
*
|
||||
* @abstract
|
||||
* Returns the underlying system handle associated with this dispatch source.
|
||||
*
|
||||
* @param source
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*
|
||||
* @result
|
||||
* The return value should be interpreted according to the type of the dispatch
|
||||
* source, and may be one of the following handles:
|
||||
*
|
||||
* DISPATCH_SOURCE_TYPE_DATA_ADD: n/a
|
||||
* DISPATCH_SOURCE_TYPE_DATA_OR: n/a
|
||||
* DISPATCH_SOURCE_TYPE_DATA_REPLACE: n/a
|
||||
* DISPATCH_SOURCE_TYPE_MACH_SEND: mach port (mach_port_t)
|
||||
* DISPATCH_SOURCE_TYPE_MACH_RECV: mach port (mach_port_t)
|
||||
* DISPATCH_SOURCE_TYPE_MEMORYPRESSURE n/a
|
||||
* DISPATCH_SOURCE_TYPE_PROC: process identifier (pid_t)
|
||||
* DISPATCH_SOURCE_TYPE_READ: file descriptor (int)
|
||||
* DISPATCH_SOURCE_TYPE_SIGNAL: signal number (int)
|
||||
* DISPATCH_SOURCE_TYPE_TIMER: n/a
|
||||
* DISPATCH_SOURCE_TYPE_VNODE: file descriptor (int)
|
||||
* DISPATCH_SOURCE_TYPE_WRITE: file descriptor (int)
|
||||
*/
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_WARN_RESULT DISPATCH_PURE
|
||||
DISPATCH_NOTHROW
|
||||
uintptr_t
|
||||
dispatch_source_get_handle(dispatch_source_t source);
|
||||
|
||||
/*!
|
||||
* @function dispatch_source_get_mask
|
||||
*
|
||||
* @abstract
|
||||
* Returns the mask of events monitored by the dispatch source.
|
||||
*
|
||||
* @param source
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*
|
||||
* @result
|
||||
* The return value should be interpreted according to the type of the dispatch
|
||||
* source, and may be one of the following flag sets:
|
||||
*
|
||||
* DISPATCH_SOURCE_TYPE_DATA_ADD: n/a
|
||||
* DISPATCH_SOURCE_TYPE_DATA_OR: n/a
|
||||
* DISPATCH_SOURCE_TYPE_DATA_REPLACE: n/a
|
||||
* DISPATCH_SOURCE_TYPE_MACH_SEND: dispatch_source_mach_send_flags_t
|
||||
* DISPATCH_SOURCE_TYPE_MACH_RECV: dispatch_source_mach_recv_flags_t
|
||||
* DISPATCH_SOURCE_TYPE_MEMORYPRESSURE dispatch_source_memorypressure_flags_t
|
||||
* DISPATCH_SOURCE_TYPE_PROC: dispatch_source_proc_flags_t
|
||||
* DISPATCH_SOURCE_TYPE_READ: n/a
|
||||
* DISPATCH_SOURCE_TYPE_SIGNAL: n/a
|
||||
* DISPATCH_SOURCE_TYPE_TIMER: dispatch_source_timer_flags_t
|
||||
* DISPATCH_SOURCE_TYPE_VNODE: dispatch_source_vnode_flags_t
|
||||
* DISPATCH_SOURCE_TYPE_WRITE: n/a
|
||||
*/
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_WARN_RESULT DISPATCH_PURE
|
||||
DISPATCH_NOTHROW
|
||||
uintptr_t
|
||||
dispatch_source_get_mask(dispatch_source_t source);
|
||||
|
||||
/*!
|
||||
* @function dispatch_source_get_data
|
||||
*
|
||||
* @abstract
|
||||
* Returns pending data for the dispatch source.
|
||||
*
|
||||
* @discussion
|
||||
* This function is intended to be called from within the event handler block.
|
||||
* The result of calling this function outside of the event handler callback is
|
||||
* undefined.
|
||||
*
|
||||
* @param source
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*
|
||||
* @result
|
||||
* The return value should be interpreted according to the type of the dispatch
|
||||
* source, and may be one of the following:
|
||||
*
|
||||
* DISPATCH_SOURCE_TYPE_DATA_ADD: application defined data
|
||||
* DISPATCH_SOURCE_TYPE_DATA_OR: application defined data
|
||||
* DISPATCH_SOURCE_TYPE_DATA_REPLACE: application defined data
|
||||
* DISPATCH_SOURCE_TYPE_MACH_SEND: dispatch_source_mach_send_flags_t
|
||||
* DISPATCH_SOURCE_TYPE_MACH_RECV: dispatch_source_mach_recv_flags_t
|
||||
* DISPATCH_SOURCE_TYPE_MEMORYPRESSURE dispatch_source_memorypressure_flags_t
|
||||
* DISPATCH_SOURCE_TYPE_PROC: dispatch_source_proc_flags_t
|
||||
* DISPATCH_SOURCE_TYPE_READ: estimated bytes available to read
|
||||
* DISPATCH_SOURCE_TYPE_SIGNAL: number of signals delivered since
|
||||
* the last handler invocation
|
||||
* DISPATCH_SOURCE_TYPE_TIMER: number of times the timer has fired
|
||||
* since the last handler invocation
|
||||
* DISPATCH_SOURCE_TYPE_VNODE: dispatch_source_vnode_flags_t
|
||||
* DISPATCH_SOURCE_TYPE_WRITE: estimated buffer space available
|
||||
*/
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_WARN_RESULT DISPATCH_PURE
|
||||
DISPATCH_NOTHROW
|
||||
uintptr_t
|
||||
dispatch_source_get_data(dispatch_source_t source);
|
||||
|
||||
/*!
|
||||
* @function dispatch_source_merge_data
|
||||
*
|
||||
* @abstract
|
||||
* Merges data into a dispatch source of type DISPATCH_SOURCE_TYPE_DATA_ADD,
|
||||
* DISPATCH_SOURCE_TYPE_DATA_OR or DISPATCH_SOURCE_TYPE_DATA_REPLACE,
|
||||
* and submits its event handler block to its target queue.
|
||||
*
|
||||
* @param source
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*
|
||||
* @param value
|
||||
* The value to coalesce with the pending data using a logical OR or an ADD
|
||||
* as specified by the dispatch source type. A value of zero has no effect
|
||||
* and will not result in the submission of the event handler block.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_source_merge_data(dispatch_source_t source, uintptr_t value);
|
||||
|
||||
/*!
|
||||
* @function dispatch_source_set_timer
|
||||
*
|
||||
* @abstract
|
||||
* Sets a start time, interval, and leeway value for a timer source.
|
||||
*
|
||||
* @discussion
|
||||
* Once this function returns, any pending source data accumulated for the
|
||||
* previous timer values has been cleared; the next fire of the timer will
|
||||
* occur at 'start', and every 'interval' nanoseconds thereafter until the
|
||||
* timer source is canceled.
|
||||
*
|
||||
* Any fire of the timer may be delayed by the system in order to improve power
|
||||
* consumption and system performance. The upper limit to the allowable delay
|
||||
* may be configured with the 'leeway' argument, the lower limit is under the
|
||||
* control of the system.
|
||||
*
|
||||
* For the initial timer fire at 'start', the upper limit to the allowable
|
||||
* delay is set to 'leeway' nanoseconds. For the subsequent timer fires at
|
||||
* 'start' + N * 'interval', the upper limit is MIN('leeway','interval'/2).
|
||||
*
|
||||
* The lower limit to the allowable delay may vary with process state such as
|
||||
* visibility of application UI. If the specified timer source was created with
|
||||
* a mask of DISPATCH_TIMER_STRICT, the system will make a best effort to
|
||||
* strictly observe the provided 'leeway' value even if it is smaller than the
|
||||
* current lower limit. Note that a minimal amount of delay is to be expected
|
||||
* even if this flag is specified.
|
||||
*
|
||||
* The 'start' argument also determines which clock will be used for the timer:
|
||||
* If 'start' is DISPATCH_TIME_NOW or was created with dispatch_time(3), the
|
||||
* timer is based on up time (which is obtained from mach_absolute_time() on
|
||||
* Apple platforms). If 'start' was created with dispatch_walltime(3), the
|
||||
* timer is based on gettimeofday(3).
|
||||
*
|
||||
* Calling this function has no effect if the timer source has already been
|
||||
* canceled.
|
||||
*
|
||||
* @param start
|
||||
* The start time of the timer. See dispatch_time() and dispatch_walltime()
|
||||
* for more information.
|
||||
*
|
||||
* @param interval
|
||||
* The nanosecond interval for the timer. Use DISPATCH_TIME_FOREVER for a
|
||||
* one-shot timer.
|
||||
*
|
||||
* @param leeway
|
||||
* The nanosecond leeway for the timer.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_source_set_timer(dispatch_source_t source,
|
||||
dispatch_time_t start,
|
||||
uint64_t interval,
|
||||
uint64_t leeway);
|
||||
|
||||
/*!
|
||||
* @function dispatch_source_set_registration_handler
|
||||
*
|
||||
* @abstract
|
||||
* Sets the registration handler block for the given dispatch source.
|
||||
*
|
||||
* @discussion
|
||||
* The registration handler (if specified) will be submitted to the source's
|
||||
* target queue once the corresponding kevent() has been registered with the
|
||||
* system, following the initial dispatch_resume() of the source.
|
||||
*
|
||||
* If a source is already registered when the registration handler is set, the
|
||||
* registration handler will be invoked immediately.
|
||||
*
|
||||
* @param source
|
||||
* The dispatch source to modify.
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*
|
||||
* @param handler
|
||||
* The registration handler block to submit to the source's target queue.
|
||||
*/
|
||||
#ifdef __BLOCKS__
|
||||
API_AVAILABLE(macos(10.7), ios(4.3))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_source_set_registration_handler(dispatch_source_t source,
|
||||
dispatch_block_t _Nullable handler);
|
||||
#endif /* __BLOCKS__ */
|
||||
|
||||
/*!
|
||||
* @function dispatch_source_set_registration_handler_f
|
||||
*
|
||||
* @abstract
|
||||
* Sets the registration handler function for the given dispatch source.
|
||||
*
|
||||
* @discussion
|
||||
* See dispatch_source_set_registration_handler() for more details.
|
||||
*
|
||||
* @param source
|
||||
* The dispatch source to modify.
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*
|
||||
* @param handler
|
||||
* The registration handler function to submit to the source's target queue.
|
||||
* The context parameter passed to the registration handler function is the
|
||||
* current context of the dispatch source at the time the handler call is made.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.7), ios(4.3))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_source_set_registration_handler_f(dispatch_source_t source,
|
||||
dispatch_function_t _Nullable handler);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
DISPATCH_ASSUME_NONNULL_END
|
||||
|
||||
#endif
|
||||
163
lib/libc/include/aarch64-macos-gnu/dispatch/workloop.h
Normal file
163
lib/libc/include/aarch64-macos-gnu/dispatch/workloop.h
Normal file
@ -0,0 +1,163 @@
|
||||
/*
|
||||
* Copyright (c) 2017-2019 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_APACHE_LICENSE_HEADER_START@
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_APACHE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef __DISPATCH_WORKLOOP__
|
||||
#define __DISPATCH_WORKLOOP__
|
||||
|
||||
#ifndef __DISPATCH_INDIRECT__
|
||||
#error "Please #include <dispatch/dispatch.h> instead of this file directly."
|
||||
#include <dispatch/base.h> // for HeaderDoc
|
||||
#endif
|
||||
|
||||
DISPATCH_ASSUME_NONNULL_BEGIN
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/*!
|
||||
* @typedef dispatch_workloop_t
|
||||
*
|
||||
* @abstract
|
||||
* Dispatch workloops invoke workitems submitted to them in priority order.
|
||||
*
|
||||
* @discussion
|
||||
* A dispatch workloop is a flavor of dispatch_queue_t that is a priority
|
||||
* ordered queue (using the QOS class of the submitted workitems as the
|
||||
* ordering).
|
||||
*
|
||||
* Between each workitem invocation, the workloop will evaluate whether higher
|
||||
* priority workitems have since been submitted, either directly to the
|
||||
* workloop or to any queues that target the workloop, and execute these first.
|
||||
*
|
||||
* Serial queues targeting a workloop maintain FIFO execution of their
|
||||
* workitems. However, the workloop may reorder workitems submitted to
|
||||
* independent serial queues targeting it with respect to each other,
|
||||
* based on their priorities, while preserving FIFO execution with respect to
|
||||
* each serial queue.
|
||||
*
|
||||
* A dispatch workloop is a "subclass" of dispatch_queue_t which can be passed
|
||||
* to all APIs accepting a dispatch queue, except for functions from the
|
||||
* dispatch_sync() family. dispatch_async_and_wait() must be used for workloop
|
||||
* objects. Functions from the dispatch_sync() family on queues targeting
|
||||
* a workloop are still permitted but discouraged for performance reasons.
|
||||
*/
|
||||
DISPATCH_DECL_SUBCLASS(dispatch_workloop, dispatch_queue);
|
||||
|
||||
/*!
|
||||
* @function dispatch_workloop_create
|
||||
*
|
||||
* @abstract
|
||||
* Creates a new dispatch workloop to which workitems may be submitted.
|
||||
*
|
||||
* @param label
|
||||
* A string label to attach to the workloop.
|
||||
*
|
||||
* @result
|
||||
* The newly created dispatch workloop.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0))
|
||||
DISPATCH_EXPORT DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT
|
||||
DISPATCH_NOTHROW
|
||||
dispatch_workloop_t
|
||||
dispatch_workloop_create(const char *_Nullable label);
|
||||
|
||||
/*!
|
||||
* @function dispatch_workloop_create_inactive
|
||||
*
|
||||
* @abstract
|
||||
* Creates a new inactive dispatch workloop that can be setup and then
|
||||
* activated.
|
||||
*
|
||||
* @discussion
|
||||
* Creating an inactive workloop allows for it to receive further configuration
|
||||
* before it is activated, and workitems can be submitted to it.
|
||||
*
|
||||
* Submitting workitems to an inactive workloop is undefined and will cause the
|
||||
* process to be terminated.
|
||||
*
|
||||
* @param label
|
||||
* A string label to attach to the workloop.
|
||||
*
|
||||
* @result
|
||||
* The newly created dispatch workloop.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0))
|
||||
DISPATCH_EXPORT DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT
|
||||
DISPATCH_NOTHROW
|
||||
dispatch_workloop_t
|
||||
dispatch_workloop_create_inactive(const char *_Nullable label);
|
||||
|
||||
/*!
|
||||
* @function dispatch_workloop_set_autorelease_frequency
|
||||
*
|
||||
* @abstract
|
||||
* Sets the autorelease frequency of the workloop.
|
||||
*
|
||||
* @discussion
|
||||
* See dispatch_queue_attr_make_with_autorelease_frequency().
|
||||
* The default policy for a workloop is
|
||||
* DISPATCH_AUTORELEASE_FREQUENCY_WORK_ITEM.
|
||||
*
|
||||
* @param workloop
|
||||
* The dispatch workloop to modify.
|
||||
*
|
||||
* This workloop must be inactive, passing an activated object is undefined
|
||||
* and will cause the process to be terminated.
|
||||
*
|
||||
* @param frequency
|
||||
* The requested autorelease frequency.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_workloop_set_autorelease_frequency(dispatch_workloop_t workloop,
|
||||
dispatch_autorelease_frequency_t frequency);
|
||||
|
||||
/*!
|
||||
* @function dispatch_workloop_set_os_workgroup
|
||||
*
|
||||
* @abstract
|
||||
* Associates an os_workgroup_t with the specified dispatch workloop.
|
||||
*
|
||||
* The worker thread will be a member of the specified os_workgroup_t while executing
|
||||
* work items submitted to the workloop.
|
||||
*
|
||||
* @param workloop
|
||||
* The dispatch workloop to modify.
|
||||
*
|
||||
* This workloop must be inactive, passing an activated object is undefined
|
||||
* and will cause the process to be terminated.
|
||||
*
|
||||
* @param workgroup
|
||||
* The workgroup to associate with this workloop.
|
||||
*
|
||||
* The workgroup specified is retained and the previously associated workgroup
|
||||
* (if any) is released.
|
||||
*/
|
||||
API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0), watchos(7.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_workloop_set_os_workgroup(dispatch_workloop_t workloop,
|
||||
os_workgroup_t workgroup);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
DISPATCH_ASSUME_NONNULL_END
|
||||
|
||||
#endif
|
||||
47
lib/libc/include/aarch64-macos-gnu/libkern/OSAtomic.h
Normal file
47
lib/libc/include/aarch64-macos-gnu/libkern/OSAtomic.h
Normal file
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2016 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef _OSATOMIC_H_
|
||||
#define _OSATOMIC_H_
|
||||
|
||||
/*! @header
|
||||
* These are deprecated legacy interfaces for atomic and synchronization
|
||||
* operations.
|
||||
*
|
||||
* Define OSATOMIC_USE_INLINED=1 to get inline implementations of the
|
||||
* OSAtomic interfaces in terms of the <stdatomic.h> primitives.
|
||||
*
|
||||
* Define OSSPINLOCK_USE_INLINED=1 to get inline implementations of the
|
||||
* OSSpinLock interfaces in terms of the <os/lock.h> primitives.
|
||||
*
|
||||
* These are intended as a transition convenience, direct use of those
|
||||
* primitives should be preferred.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#include "OSAtomicDeprecated.h"
|
||||
#include "OSSpinLockDeprecated.h"
|
||||
#include "OSAtomicQueue.h"
|
||||
|
||||
#endif /* _OSATOMIC_H_ */
|
||||
1266
lib/libc/include/aarch64-macos-gnu/libkern/OSAtomicDeprecated.h
Normal file
1266
lib/libc/include/aarch64-macos-gnu/libkern/OSAtomicDeprecated.h
Normal file
File diff suppressed because it is too large
Load Diff
115
lib/libc/include/aarch64-macos-gnu/libkern/OSAtomicQueue.h
Normal file
115
lib/libc/include/aarch64-macos-gnu/libkern/OSAtomicQueue.h
Normal file
@ -0,0 +1,115 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2016 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef _OSATOMICQUEUE_H_
|
||||
#define _OSATOMICQUEUE_H_
|
||||
|
||||
#include <stddef.h>
|
||||
#include <sys/cdefs.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "OSAtomicDeprecated.h"
|
||||
|
||||
#include <Availability.h>
|
||||
|
||||
/*! @header Lockless atomic enqueue and dequeue
|
||||
* These routines manipulate singly-linked LIFO lists.
|
||||
*/
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/*! @abstract The data structure for a queue head.
|
||||
@discussion
|
||||
You should always initialize a queue head structure with the
|
||||
initialization vector {@link OS_ATOMIC_QUEUE_INIT} before use.
|
||||
*/
|
||||
#if defined(__LP64__)
|
||||
|
||||
typedef volatile struct {
|
||||
void *opaque1;
|
||||
long opaque2;
|
||||
} __attribute__ ((aligned (16))) OSQueueHead;
|
||||
|
||||
#else
|
||||
|
||||
typedef volatile struct {
|
||||
void *opaque1;
|
||||
long opaque2;
|
||||
} OSQueueHead;
|
||||
|
||||
#endif
|
||||
|
||||
/*! @abstract The initialization vector for a queue head. */
|
||||
#define OS_ATOMIC_QUEUE_INIT { NULL, 0 }
|
||||
|
||||
/*! @abstract Enqueue an element onto a list.
|
||||
@discussion
|
||||
Memory barriers are incorporated as needed to permit thread-safe access
|
||||
to the queue element.
|
||||
@param __list
|
||||
The list on which you want to enqueue the element.
|
||||
@param __new
|
||||
The element to add.
|
||||
@param __offset
|
||||
The "offset" parameter is the offset (in bytes) of the link field
|
||||
from the beginning of the data structure being queued (<code>__new</code>).
|
||||
The link field should be a pointer type.
|
||||
The <code>__offset</code> value needs to be same for all enqueuing and
|
||||
dequeuing operations on the same list, even if different structure types
|
||||
are enqueued on that list. The use of <code>offsetset()</code>, defined in
|
||||
<code>stddef.h</code> is the common way to specify the <code>__offset</code>
|
||||
value.
|
||||
*/
|
||||
__OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_4_0)
|
||||
void OSAtomicEnqueue( OSQueueHead *__list, void *__new, size_t __offset);
|
||||
|
||||
|
||||
/*! @abstract Dequeue an element from a list.
|
||||
@discussion
|
||||
Memory barriers are incorporated as needed to permit thread-safe access
|
||||
to the queue element.
|
||||
@param __list
|
||||
The list from which you want to dequeue an element.
|
||||
@param __offset
|
||||
The "offset" parameter is the offset (in bytes) of the link field
|
||||
from the beginning of the data structure being dequeued (<code>__new</code>).
|
||||
The link field should be a pointer type.
|
||||
The <code>__offset</code> value needs to be same for all enqueuing and
|
||||
dequeuing operations on the same list, even if different structure types
|
||||
are enqueued on that list. The use of <code>offsetset()</code>, defined in
|
||||
<code>stddef.h</code> is the common way to specify the <code>__offset</code>
|
||||
value.
|
||||
IMPORTANT: the memory backing the link field of a queue element must not be
|
||||
unmapped after OSAtomicDequeue() returns until all concurrent calls to
|
||||
OSAtomicDequeue() for the same list on other threads have also returned,
|
||||
as they may still be accessing that memory location.
|
||||
@result
|
||||
Returns the most recently enqueued element, or <code>NULL</code> if the
|
||||
list is empty.
|
||||
*/
|
||||
__OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_4_0)
|
||||
void* OSAtomicDequeue( OSQueueHead *__list, size_t __offset);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _OSATOMICQUEUE_H_ */
|
||||
317
lib/libc/include/aarch64-macos-gnu/libkern/OSByteOrder.h
Normal file
317
lib/libc/include/aarch64-macos-gnu/libkern/OSByteOrder.h
Normal file
@ -0,0 +1,317 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef _OS_OSBYTEORDER_H
|
||||
#define _OS_OSBYTEORDER_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <libkern/_OSByteOrder.h>
|
||||
|
||||
/* Macros for swapping constant values in the preprocessing stage. */
|
||||
#define OSSwapConstInt16(x) __DARWIN_OSSwapConstInt16(x)
|
||||
#define OSSwapConstInt32(x) __DARWIN_OSSwapConstInt32(x)
|
||||
#define OSSwapConstInt64(x) __DARWIN_OSSwapConstInt64(x)
|
||||
|
||||
#if !defined(__DARWIN_OS_INLINE)
|
||||
# if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
||||
# define __DARWIN_OS_INLINE static inline
|
||||
# elif defined(__MWERKS__) || defined(__cplusplus)
|
||||
# define __DARWIN_OS_INLINE static inline
|
||||
# else
|
||||
# define __DARWIN_OS_INLINE static __inline__
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__)
|
||||
|
||||
#if (defined(__i386__) || defined(__x86_64__))
|
||||
#include <libkern/i386/OSByteOrder.h>
|
||||
#elif defined (__arm__) || defined(__arm64__)
|
||||
#include <libkern/arm/OSByteOrder.h>
|
||||
#else
|
||||
#include <libkern/machine/OSByteOrder.h>
|
||||
#endif
|
||||
|
||||
#else /* ! __GNUC__ */
|
||||
|
||||
#include <libkern/machine/OSByteOrder.h>
|
||||
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
#define OSSwapInt16(x) __DARWIN_OSSwapInt16(x)
|
||||
#define OSSwapInt32(x) __DARWIN_OSSwapInt32(x)
|
||||
#define OSSwapInt64(x) __DARWIN_OSSwapInt64(x)
|
||||
|
||||
enum {
|
||||
OSUnknownByteOrder,
|
||||
OSLittleEndian,
|
||||
OSBigEndian
|
||||
};
|
||||
|
||||
__DARWIN_OS_INLINE
|
||||
int32_t
|
||||
OSHostByteOrder(void)
|
||||
{
|
||||
#if defined(__LITTLE_ENDIAN__)
|
||||
return OSLittleEndian;
|
||||
#elif defined(__BIG_ENDIAN__)
|
||||
return OSBigEndian;
|
||||
#else
|
||||
return OSUnknownByteOrder;
|
||||
#endif
|
||||
}
|
||||
|
||||
#define OSReadBigInt(x, y) OSReadBigInt32(x, y)
|
||||
#define OSWriteBigInt(x, y, z) OSWriteBigInt32(x, y, z)
|
||||
#define OSSwapBigToHostInt(x) OSSwapBigToHostInt32(x)
|
||||
#define OSSwapHostToBigInt(x) OSSwapHostToBigInt32(x)
|
||||
#define OSReadLittleInt(x, y) OSReadLittleInt32(x, y)
|
||||
#define OSWriteLittleInt(x, y, z) OSWriteLittleInt32(x, y, z)
|
||||
#define OSSwapHostToLittleInt(x) OSSwapHostToLittleInt32(x)
|
||||
#define OSSwapLittleToHostInt(x) OSSwapLittleToHostInt32(x)
|
||||
|
||||
/* Functions for loading native endian values. */
|
||||
|
||||
__DARWIN_OS_INLINE
|
||||
uint16_t
|
||||
_OSReadInt16(
|
||||
const volatile void * base,
|
||||
uintptr_t byteOffset
|
||||
)
|
||||
{
|
||||
return *(volatile uint16_t *)((uintptr_t)base + byteOffset);
|
||||
}
|
||||
|
||||
__DARWIN_OS_INLINE
|
||||
uint32_t
|
||||
_OSReadInt32(
|
||||
const volatile void * base,
|
||||
uintptr_t byteOffset
|
||||
)
|
||||
{
|
||||
return *(volatile uint32_t *)((uintptr_t)base + byteOffset);
|
||||
}
|
||||
|
||||
__DARWIN_OS_INLINE
|
||||
uint64_t
|
||||
_OSReadInt64(
|
||||
const volatile void * base,
|
||||
uintptr_t byteOffset
|
||||
)
|
||||
{
|
||||
return *(volatile uint64_t *)((uintptr_t)base + byteOffset);
|
||||
}
|
||||
|
||||
/* Functions for storing native endian values. */
|
||||
|
||||
__DARWIN_OS_INLINE
|
||||
void
|
||||
_OSWriteInt16(
|
||||
volatile void * base,
|
||||
uintptr_t byteOffset,
|
||||
uint16_t data
|
||||
)
|
||||
{
|
||||
*(volatile uint16_t *)((uintptr_t)base + byteOffset) = data;
|
||||
}
|
||||
|
||||
__DARWIN_OS_INLINE
|
||||
void
|
||||
_OSWriteInt32(
|
||||
volatile void * base,
|
||||
uintptr_t byteOffset,
|
||||
uint32_t data
|
||||
)
|
||||
{
|
||||
*(volatile uint32_t *)((uintptr_t)base + byteOffset) = data;
|
||||
}
|
||||
|
||||
__DARWIN_OS_INLINE
|
||||
void
|
||||
_OSWriteInt64(
|
||||
volatile void * base,
|
||||
uintptr_t byteOffset,
|
||||
uint64_t data
|
||||
)
|
||||
{
|
||||
*(volatile uint64_t *)((uintptr_t)base + byteOffset) = data;
|
||||
}
|
||||
|
||||
#if defined(__BIG_ENDIAN__)
|
||||
|
||||
/* Functions for loading big endian to host endianess. */
|
||||
|
||||
#define OSReadBigInt16(base, byteOffset) _OSReadInt16(base, byteOffset)
|
||||
#define OSReadBigInt32(base, byteOffset) _OSReadInt32(base, byteOffset)
|
||||
#define OSReadBigInt64(base, byteOffset) _OSReadInt64(base, byteOffset)
|
||||
|
||||
/* Functions for storing host endianess to big endian. */
|
||||
|
||||
#define OSWriteBigInt16(base, byteOffset, data) _OSWriteInt16(base, byteOffset, data)
|
||||
#define OSWriteBigInt32(base, byteOffset, data) _OSWriteInt32(base, byteOffset, data)
|
||||
#define OSWriteBigInt64(base, byteOffset, data) _OSWriteInt64(base, byteOffset, data)
|
||||
|
||||
/* Functions for loading little endian to host endianess. */
|
||||
|
||||
#define OSReadLittleInt16(base, byteOffset) OSReadSwapInt16(base, byteOffset)
|
||||
#define OSReadLittleInt32(base, byteOffset) OSReadSwapInt32(base, byteOffset)
|
||||
#define OSReadLittleInt64(base, byteOffset) OSReadSwapInt64(base, byteOffset)
|
||||
|
||||
/* Functions for storing host endianess to little endian. */
|
||||
|
||||
#define OSWriteLittleInt16(base, byteOffset, data) OSWriteSwapInt16(base, byteOffset, data)
|
||||
#define OSWriteLittleInt32(base, byteOffset, data) OSWriteSwapInt32(base, byteOffset, data)
|
||||
#define OSWriteLittleInt64(base, byteOffset, data) OSWriteSwapInt64(base, byteOffset, data)
|
||||
|
||||
/* Host endianess to big endian byte swapping macros for constants. */
|
||||
|
||||
#define OSSwapHostToBigConstInt16(x) ((uint16_t)(x))
|
||||
#define OSSwapHostToBigConstInt32(x) ((uint32_t)(x))
|
||||
#define OSSwapHostToBigConstInt64(x) ((uint64_t)(x))
|
||||
|
||||
/* Generic host endianess to big endian byte swapping functions. */
|
||||
|
||||
#define OSSwapHostToBigInt16(x) ((uint16_t)(x))
|
||||
#define OSSwapHostToBigInt32(x) ((uint32_t)(x))
|
||||
#define OSSwapHostToBigInt64(x) ((uint64_t)(x))
|
||||
|
||||
/* Host endianess to little endian byte swapping macros for constants. */
|
||||
|
||||
#define OSSwapHostToLittleConstInt16(x) OSSwapConstInt16(x)
|
||||
#define OSSwapHostToLittleConstInt32(x) OSSwapConstInt32(x)
|
||||
#define OSSwapHostToLittleConstInt64(x) OSSwapConstInt64(x)
|
||||
|
||||
/* Generic host endianess to little endian byte swapping functions. */
|
||||
|
||||
#define OSSwapHostToLittleInt16(x) OSSwapInt16(x)
|
||||
#define OSSwapHostToLittleInt32(x) OSSwapInt32(x)
|
||||
#define OSSwapHostToLittleInt64(x) OSSwapInt64(x)
|
||||
|
||||
/* Big endian to host endianess byte swapping macros for constants. */
|
||||
|
||||
#define OSSwapBigToHostConstInt16(x) ((uint16_t)(x))
|
||||
#define OSSwapBigToHostConstInt32(x) ((uint32_t)(x))
|
||||
#define OSSwapBigToHostConstInt64(x) ((uint64_t)(x))
|
||||
|
||||
/* Generic big endian to host endianess byte swapping functions. */
|
||||
|
||||
#define OSSwapBigToHostInt16(x) ((uint16_t)(x))
|
||||
#define OSSwapBigToHostInt32(x) ((uint32_t)(x))
|
||||
#define OSSwapBigToHostInt64(x) ((uint64_t)(x))
|
||||
|
||||
/* Little endian to host endianess byte swapping macros for constants. */
|
||||
|
||||
#define OSSwapLittleToHostConstInt16(x) OSSwapConstInt16(x)
|
||||
#define OSSwapLittleToHostConstInt32(x) OSSwapConstInt32(x)
|
||||
#define OSSwapLittleToHostConstInt64(x) OSSwapConstInt64(x)
|
||||
|
||||
/* Generic little endian to host endianess byte swapping functions. */
|
||||
|
||||
#define OSSwapLittleToHostInt16(x) OSSwapInt16(x)
|
||||
#define OSSwapLittleToHostInt32(x) OSSwapInt32(x)
|
||||
#define OSSwapLittleToHostInt64(x) OSSwapInt64(x)
|
||||
|
||||
#elif defined(__LITTLE_ENDIAN__)
|
||||
|
||||
/* Functions for loading big endian to host endianess. */
|
||||
|
||||
#define OSReadBigInt16(base, byteOffset) OSReadSwapInt16(base, byteOffset)
|
||||
#define OSReadBigInt32(base, byteOffset) OSReadSwapInt32(base, byteOffset)
|
||||
#define OSReadBigInt64(base, byteOffset) OSReadSwapInt64(base, byteOffset)
|
||||
|
||||
/* Functions for storing host endianess to big endian. */
|
||||
|
||||
#define OSWriteBigInt16(base, byteOffset, data) OSWriteSwapInt16(base, byteOffset, data)
|
||||
#define OSWriteBigInt32(base, byteOffset, data) OSWriteSwapInt32(base, byteOffset, data)
|
||||
#define OSWriteBigInt64(base, byteOffset, data) OSWriteSwapInt64(base, byteOffset, data)
|
||||
|
||||
/* Functions for loading little endian to host endianess. */
|
||||
|
||||
#define OSReadLittleInt16(base, byteOffset) _OSReadInt16(base, byteOffset)
|
||||
#define OSReadLittleInt32(base, byteOffset) _OSReadInt32(base, byteOffset)
|
||||
#define OSReadLittleInt64(base, byteOffset) _OSReadInt64(base, byteOffset)
|
||||
|
||||
/* Functions for storing host endianess to little endian. */
|
||||
|
||||
#define OSWriteLittleInt16(base, byteOffset, data) _OSWriteInt16(base, byteOffset, data)
|
||||
#define OSWriteLittleInt32(base, byteOffset, data) _OSWriteInt32(base, byteOffset, data)
|
||||
#define OSWriteLittleInt64(base, byteOffset, data) _OSWriteInt64(base, byteOffset, data)
|
||||
|
||||
/* Host endianess to big endian byte swapping macros for constants. */
|
||||
|
||||
#define OSSwapHostToBigConstInt16(x) OSSwapConstInt16(x)
|
||||
#define OSSwapHostToBigConstInt32(x) OSSwapConstInt32(x)
|
||||
#define OSSwapHostToBigConstInt64(x) OSSwapConstInt64(x)
|
||||
|
||||
/* Generic host endianess to big endian byte swapping functions. */
|
||||
|
||||
#define OSSwapHostToBigInt16(x) OSSwapInt16(x)
|
||||
#define OSSwapHostToBigInt32(x) OSSwapInt32(x)
|
||||
#define OSSwapHostToBigInt64(x) OSSwapInt64(x)
|
||||
|
||||
/* Host endianess to little endian byte swapping macros for constants. */
|
||||
|
||||
#define OSSwapHostToLittleConstInt16(x) ((uint16_t)(x))
|
||||
#define OSSwapHostToLittleConstInt32(x) ((uint32_t)(x))
|
||||
#define OSSwapHostToLittleConstInt64(x) ((uint64_t)(x))
|
||||
|
||||
/* Generic host endianess to little endian byte swapping functions. */
|
||||
|
||||
#define OSSwapHostToLittleInt16(x) ((uint16_t)(x))
|
||||
#define OSSwapHostToLittleInt32(x) ((uint32_t)(x))
|
||||
#define OSSwapHostToLittleInt64(x) ((uint64_t)(x))
|
||||
|
||||
/* Big endian to host endianess byte swapping macros for constants. */
|
||||
|
||||
#define OSSwapBigToHostConstInt16(x) OSSwapConstInt16(x)
|
||||
#define OSSwapBigToHostConstInt32(x) OSSwapConstInt32(x)
|
||||
#define OSSwapBigToHostConstInt64(x) OSSwapConstInt64(x)
|
||||
|
||||
/* Generic big endian to host endianess byte swapping functions. */
|
||||
|
||||
#define OSSwapBigToHostInt16(x) OSSwapInt16(x)
|
||||
#define OSSwapBigToHostInt32(x) OSSwapInt32(x)
|
||||
#define OSSwapBigToHostInt64(x) OSSwapInt64(x)
|
||||
|
||||
/* Little endian to host endianess byte swapping macros for constants. */
|
||||
|
||||
#define OSSwapLittleToHostConstInt16(x) ((uint16_t)(x))
|
||||
#define OSSwapLittleToHostConstInt32(x) ((uint32_t)(x))
|
||||
#define OSSwapLittleToHostConstInt64(x) ((uint64_t)(x))
|
||||
|
||||
/* Generic little endian to host endianess byte swapping functions. */
|
||||
|
||||
#define OSSwapLittleToHostInt16(x) ((uint16_t)(x))
|
||||
#define OSSwapLittleToHostInt32(x) ((uint32_t)(x))
|
||||
#define OSSwapLittleToHostInt64(x) ((uint64_t)(x))
|
||||
|
||||
#else
|
||||
#error Unknown endianess.
|
||||
#endif
|
||||
|
||||
#endif /* ! _OS_OSBYTEORDER_H */
|
||||
@ -0,0 +1,212 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2016 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef _OSSPINLOCK_DEPRECATED_H_
|
||||
#define _OSSPINLOCK_DEPRECATED_H_
|
||||
|
||||
/*! @header
|
||||
* These are deprecated legacy interfaces for userspace spinlocks.
|
||||
*
|
||||
* These interfaces should no longer be used, particularily in situations where
|
||||
* threads of differing priorities may contend on the same spinlock.
|
||||
*
|
||||
* The interfaces in <os/lock.h> should be used instead in cases where a very
|
||||
* low-level lock primitive is required. In general however, using higher level
|
||||
* synchronization primitives such as those provided by the pthread or dispatch
|
||||
* subsystems should be preferred.
|
||||
*
|
||||
* Define OSSPINLOCK_USE_INLINED=1 to get inline implementations of these
|
||||
* interfaces in terms of the <os/lock.h> primitives. This is intended as a
|
||||
* transition convenience, direct use of those primitives is preferred.
|
||||
*/
|
||||
|
||||
#ifndef OSSPINLOCK_DEPRECATED
|
||||
#define OSSPINLOCK_DEPRECATED 1
|
||||
#define OSSPINLOCK_DEPRECATED_MSG(_r) "Use " #_r "() from <os/lock.h> instead"
|
||||
#define OSSPINLOCK_DEPRECATED_REPLACE_WITH(_r) \
|
||||
__OS_AVAILABILITY_MSG(macosx, deprecated=10.12, OSSPINLOCK_DEPRECATED_MSG(_r)) \
|
||||
__OS_AVAILABILITY_MSG(ios, deprecated=10.0, OSSPINLOCK_DEPRECATED_MSG(_r)) \
|
||||
__OS_AVAILABILITY_MSG(tvos, deprecated=10.0, OSSPINLOCK_DEPRECATED_MSG(_r)) \
|
||||
__OS_AVAILABILITY_MSG(watchos, deprecated=3.0, OSSPINLOCK_DEPRECATED_MSG(_r))
|
||||
#else
|
||||
#undef OSSPINLOCK_DEPRECATED
|
||||
#define OSSPINLOCK_DEPRECATED 0
|
||||
#define OSSPINLOCK_DEPRECATED_REPLACE_WITH(_r)
|
||||
#endif
|
||||
|
||||
#if !(defined(OSSPINLOCK_USE_INLINED) && OSSPINLOCK_USE_INLINED)
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <Availability.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/*! @abstract The default value for an <code>OSSpinLock</code>.
|
||||
@discussion
|
||||
The convention is that unlocked is zero, locked is nonzero.
|
||||
*/
|
||||
#define OS_SPINLOCK_INIT 0
|
||||
|
||||
|
||||
/*! @abstract Data type for a spinlock.
|
||||
@discussion
|
||||
You should always initialize a spinlock to {@link OS_SPINLOCK_INIT} before
|
||||
using it.
|
||||
*/
|
||||
typedef int32_t OSSpinLock OSSPINLOCK_DEPRECATED_REPLACE_WITH(os_unfair_lock);
|
||||
|
||||
|
||||
/*! @abstract Locks a spinlock if it would not block
|
||||
@result
|
||||
Returns <code>false</code> if the lock was already held by another thread,
|
||||
<code>true</code> if it took the lock successfully.
|
||||
*/
|
||||
OSSPINLOCK_DEPRECATED_REPLACE_WITH(os_unfair_lock_trylock)
|
||||
__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0)
|
||||
bool OSSpinLockTry( volatile OSSpinLock *__lock );
|
||||
|
||||
|
||||
/*! @abstract Locks a spinlock
|
||||
@discussion
|
||||
Although the lock operation spins, it employs various strategies to back
|
||||
off if the lock is held.
|
||||
*/
|
||||
OSSPINLOCK_DEPRECATED_REPLACE_WITH(os_unfair_lock_lock)
|
||||
__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0)
|
||||
void OSSpinLockLock( volatile OSSpinLock *__lock );
|
||||
|
||||
|
||||
/*! @abstract Unlocks a spinlock */
|
||||
OSSPINLOCK_DEPRECATED_REPLACE_WITH(os_unfair_lock_unlock)
|
||||
__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0)
|
||||
void OSSpinLockUnlock( volatile OSSpinLock *__lock );
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#else /* OSSPINLOCK_USE_INLINED */
|
||||
|
||||
/*
|
||||
* Inline implementations of the legacy OSSpinLock interfaces in terms of the
|
||||
* of the <os/lock.h> primitives. Direct use of those primitives is preferred.
|
||||
*
|
||||
* NOTE: the locked value of os_unfair_lock is implementation defined and
|
||||
* subject to change, code that relies on the specific locked value used by the
|
||||
* legacy OSSpinLock interface WILL break when using these inline
|
||||
* implementations in terms of os_unfair_lock.
|
||||
*/
|
||||
|
||||
#if !OSSPINLOCK_USE_INLINED_TRANSPARENT
|
||||
|
||||
#include <os/lock.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#if __has_attribute(always_inline)
|
||||
#define OSSPINLOCK_INLINE static __inline
|
||||
#else
|
||||
#define OSSPINLOCK_INLINE static __inline __attribute__((__always_inline__))
|
||||
#endif
|
||||
|
||||
#define OS_SPINLOCK_INIT 0
|
||||
typedef int32_t OSSpinLock;
|
||||
|
||||
#if __has_extension(c_static_assert)
|
||||
_Static_assert(sizeof(OSSpinLock) == sizeof(os_unfair_lock),
|
||||
"Incompatible os_unfair_lock type");
|
||||
#endif
|
||||
|
||||
OSSPINLOCK_INLINE
|
||||
void
|
||||
OSSpinLockLock(volatile OSSpinLock *__lock)
|
||||
{
|
||||
os_unfair_lock_t lock = (os_unfair_lock_t)__lock;
|
||||
return os_unfair_lock_lock(lock);
|
||||
}
|
||||
|
||||
OSSPINLOCK_INLINE
|
||||
bool
|
||||
OSSpinLockTry(volatile OSSpinLock *__lock)
|
||||
{
|
||||
os_unfair_lock_t lock = (os_unfair_lock_t)__lock;
|
||||
return os_unfair_lock_trylock(lock);
|
||||
}
|
||||
|
||||
OSSPINLOCK_INLINE
|
||||
void
|
||||
OSSpinLockUnlock(volatile OSSpinLock *__lock)
|
||||
{
|
||||
os_unfair_lock_t lock = (os_unfair_lock_t)__lock;
|
||||
return os_unfair_lock_unlock(lock);
|
||||
}
|
||||
|
||||
#undef OSSPINLOCK_INLINE
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#else /* OSSPINLOCK_USE_INLINED_TRANSPARENT */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <Availability.h>
|
||||
|
||||
#define OS_NOSPIN_LOCK_AVAILABILITY \
|
||||
__OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) \
|
||||
__TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0)
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#define OS_SPINLOCK_INIT 0
|
||||
typedef int32_t OSSpinLock OSSPINLOCK_DEPRECATED_REPLACE_WITH(os_unfair_lock);
|
||||
typedef volatile OSSpinLock *_os_nospin_lock_t
|
||||
OSSPINLOCK_DEPRECATED_REPLACE_WITH(os_unfair_lock_t);
|
||||
|
||||
OSSPINLOCK_DEPRECATED_REPLACE_WITH(os_unfair_lock_lock)
|
||||
OS_NOSPIN_LOCK_AVAILABILITY
|
||||
void _os_nospin_lock_lock(_os_nospin_lock_t lock);
|
||||
#undef OSSpinLockLock
|
||||
#define OSSpinLockLock(lock) _os_nospin_lock_lock(lock)
|
||||
|
||||
OSSPINLOCK_DEPRECATED_REPLACE_WITH(os_unfair_lock_trylock)
|
||||
OS_NOSPIN_LOCK_AVAILABILITY
|
||||
bool _os_nospin_lock_trylock(_os_nospin_lock_t lock);
|
||||
#undef OSSpinLockTry
|
||||
#define OSSpinLockTry(lock) _os_nospin_lock_trylock(lock)
|
||||
|
||||
OSSPINLOCK_DEPRECATED_REPLACE_WITH(os_unfair_lock_unlock)
|
||||
OS_NOSPIN_LOCK_AVAILABILITY
|
||||
void _os_nospin_lock_unlock(_os_nospin_lock_t lock);
|
||||
#undef OSSpinLockUnlock
|
||||
#define OSSpinLockUnlock(lock) _os_nospin_lock_unlock(lock)
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* OSSPINLOCK_USE_INLINED_TRANSPARENT */
|
||||
|
||||
#endif /* OSSPINLOCK_USE_INLINED */
|
||||
|
||||
#endif /* _OSSPINLOCK_DEPRECATED_H_ */
|
||||
133
lib/libc/include/aarch64-macos-gnu/libkern/_OSByteOrder.h
Normal file
133
lib/libc/include/aarch64-macos-gnu/libkern/_OSByteOrder.h
Normal file
@ -0,0 +1,133 @@
|
||||
/*
|
||||
* Copyright (c) 2006 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef _OS__OSBYTEORDER_H
|
||||
#define _OS__OSBYTEORDER_H
|
||||
|
||||
/*
|
||||
* This header is normally included from <libkern/OSByteOrder.h>. However,
|
||||
* <sys/_endian.h> also includes this in the case of little-endian
|
||||
* architectures, so that we can map OSByteOrder routines to the hton* and ntoh*
|
||||
* macros. This results in the asymmetry below; we only include
|
||||
* <libkern/arch/_OSByteOrder.h> for little-endian architectures.
|
||||
*/
|
||||
|
||||
#include <sys/_types.h>
|
||||
|
||||
/* Macros for swapping constant values in the preprocessing stage. */
|
||||
#define __DARWIN_OSSwapConstInt16(x) \
|
||||
((__uint16_t)((((__uint16_t)(x) & 0xff00U) >> 8) | \
|
||||
(((__uint16_t)(x) & 0x00ffU) << 8)))
|
||||
|
||||
#define __DARWIN_OSSwapConstInt32(x) \
|
||||
((__uint32_t)((((__uint32_t)(x) & 0xff000000U) >> 24) | \
|
||||
(((__uint32_t)(x) & 0x00ff0000U) >> 8) | \
|
||||
(((__uint32_t)(x) & 0x0000ff00U) << 8) | \
|
||||
(((__uint32_t)(x) & 0x000000ffU) << 24)))
|
||||
|
||||
#define __DARWIN_OSSwapConstInt64(x) \
|
||||
((__uint64_t)((((__uint64_t)(x) & 0xff00000000000000ULL) >> 56) | \
|
||||
(((__uint64_t)(x) & 0x00ff000000000000ULL) >> 40) | \
|
||||
(((__uint64_t)(x) & 0x0000ff0000000000ULL) >> 24) | \
|
||||
(((__uint64_t)(x) & 0x000000ff00000000ULL) >> 8) | \
|
||||
(((__uint64_t)(x) & 0x00000000ff000000ULL) << 8) | \
|
||||
(((__uint64_t)(x) & 0x0000000000ff0000ULL) << 24) | \
|
||||
(((__uint64_t)(x) & 0x000000000000ff00ULL) << 40) | \
|
||||
(((__uint64_t)(x) & 0x00000000000000ffULL) << 56)))
|
||||
|
||||
#if defined(__GNUC__)
|
||||
|
||||
#if !defined(__DARWIN_OS_INLINE)
|
||||
# if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
||||
# define __DARWIN_OS_INLINE static inline
|
||||
# elif defined(__MWERKS__) || defined(__cplusplus)
|
||||
# define __DARWIN_OS_INLINE static inline
|
||||
# else
|
||||
# define __DARWIN_OS_INLINE static __inline__
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#include <libkern/i386/_OSByteOrder.h>
|
||||
#endif
|
||||
|
||||
#if defined (__arm__) || defined(__arm64__)
|
||||
#include <libkern/arm/OSByteOrder.h>
|
||||
#endif
|
||||
|
||||
|
||||
#define __DARWIN_OSSwapInt16(x) \
|
||||
((__uint16_t)(__builtin_constant_p(x) ? __DARWIN_OSSwapConstInt16(x) : _OSSwapInt16(x)))
|
||||
|
||||
#define __DARWIN_OSSwapInt32(x) \
|
||||
(__builtin_constant_p(x) ? __DARWIN_OSSwapConstInt32(x) : _OSSwapInt32(x))
|
||||
|
||||
#define __DARWIN_OSSwapInt64(x) \
|
||||
(__builtin_constant_p(x) ? __DARWIN_OSSwapConstInt64(x) : _OSSwapInt64(x))
|
||||
|
||||
#else /* ! __GNUC__ */
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
|
||||
__DARWIN_OS_INLINE
|
||||
uint16_t
|
||||
_OSSwapInt16(
|
||||
uint16_t data
|
||||
)
|
||||
{
|
||||
return __DARWIN_OSSwapConstInt16(data);
|
||||
}
|
||||
|
||||
__DARWIN_OS_INLINE
|
||||
uint32_t
|
||||
_OSSwapInt32(
|
||||
uint32_t data
|
||||
)
|
||||
{
|
||||
return __DARWIN_OSSwapConstInt32(data);
|
||||
}
|
||||
|
||||
__DARWIN_OS_INLINE
|
||||
uint64_t
|
||||
_OSSwapInt64(
|
||||
uint64_t data
|
||||
)
|
||||
{
|
||||
return __DARWIN_OSSwapConstInt64(data);
|
||||
}
|
||||
#endif
|
||||
|
||||
#define __DARWIN_OSSwapInt16(x) _OSSwapInt16(x)
|
||||
|
||||
#define __DARWIN_OSSwapInt32(x) _OSSwapInt32(x)
|
||||
|
||||
#define __DARWIN_OSSwapInt64(x) _OSSwapInt64(x)
|
||||
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
#endif /* ! _OS__OSBYTEORDER_H */
|
||||
216
lib/libc/include/aarch64-macos-gnu/libkern/arm/OSByteOrder.h
Normal file
216
lib/libc/include/aarch64-macos-gnu/libkern/arm/OSByteOrder.h
Normal file
@ -0,0 +1,216 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2007 Apple Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _OS_OSBYTEORDERARM_H
|
||||
#define _OS_OSBYTEORDERARM_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <arm/arch.h> /* for _ARM_ARCH_6 */
|
||||
|
||||
/* Generic byte swapping functions. */
|
||||
|
||||
__DARWIN_OS_INLINE
|
||||
uint16_t
|
||||
_OSSwapInt16(
|
||||
uint16_t _data
|
||||
)
|
||||
{
|
||||
/* Reduces to 'rev16' with clang */
|
||||
return (uint16_t)(_data << 8 | _data >> 8);
|
||||
}
|
||||
|
||||
__DARWIN_OS_INLINE
|
||||
uint32_t
|
||||
_OSSwapInt32(
|
||||
uint32_t _data
|
||||
)
|
||||
{
|
||||
#if defined(__llvm__)
|
||||
_data = __builtin_bswap32(_data);
|
||||
#else
|
||||
/* This actually generates the best code */
|
||||
_data = (((_data ^ (_data >> 16 | (_data << 16))) & 0xFF00FFFF) >> 8) ^ (_data >> 8 | _data << 24);
|
||||
#endif
|
||||
|
||||
return _data;
|
||||
}
|
||||
|
||||
__DARWIN_OS_INLINE
|
||||
uint64_t
|
||||
_OSSwapInt64(
|
||||
uint64_t _data
|
||||
)
|
||||
{
|
||||
#if defined(__llvm__)
|
||||
return __builtin_bswap64(_data);
|
||||
#else
|
||||
union {
|
||||
uint64_t _ull;
|
||||
uint32_t _ul[2];
|
||||
} _u;
|
||||
|
||||
/* This actually generates the best code */
|
||||
_u._ul[0] = (uint32_t)(_data >> 32);
|
||||
_u._ul[1] = (uint32_t)(_data & 0xffffffff);
|
||||
_u._ul[0] = _OSSwapInt32(_u._ul[0]);
|
||||
_u._ul[1] = _OSSwapInt32(_u._ul[1]);
|
||||
return _u._ull;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Functions for byte reversed loads. */
|
||||
|
||||
struct _OSUnalignedU16 {
|
||||
volatile uint16_t __val;
|
||||
} __attribute__((__packed__));
|
||||
|
||||
struct _OSUnalignedU32 {
|
||||
volatile uint32_t __val;
|
||||
} __attribute__((__packed__));
|
||||
|
||||
struct _OSUnalignedU64 {
|
||||
volatile uint64_t __val;
|
||||
} __attribute__((__packed__));
|
||||
|
||||
#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)
|
||||
__DARWIN_OS_INLINE
|
||||
uint16_t
|
||||
_OSReadSwapInt16(
|
||||
const volatile void * _base,
|
||||
uintptr_t _offset
|
||||
)
|
||||
{
|
||||
return _OSSwapInt16(((struct _OSUnalignedU16 *)((uintptr_t)_base + _offset))->__val);
|
||||
}
|
||||
#else
|
||||
__DARWIN_OS_INLINE
|
||||
uint16_t
|
||||
OSReadSwapInt16(
|
||||
const volatile void * _base,
|
||||
uintptr_t _offset
|
||||
)
|
||||
{
|
||||
return _OSSwapInt16(((struct _OSUnalignedU16 *)((uintptr_t)_base + _offset))->__val);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)
|
||||
__DARWIN_OS_INLINE
|
||||
uint32_t
|
||||
_OSReadSwapInt32(
|
||||
const volatile void * _base,
|
||||
uintptr_t _offset
|
||||
)
|
||||
{
|
||||
return _OSSwapInt32(((struct _OSUnalignedU32 *)((uintptr_t)_base + _offset))->__val);
|
||||
}
|
||||
#else
|
||||
__DARWIN_OS_INLINE
|
||||
uint32_t
|
||||
OSReadSwapInt32(
|
||||
const volatile void * _base,
|
||||
uintptr_t _offset
|
||||
)
|
||||
{
|
||||
return _OSSwapInt32(((struct _OSUnalignedU32 *)((uintptr_t)_base + _offset))->__val);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)
|
||||
__DARWIN_OS_INLINE
|
||||
uint64_t
|
||||
_OSReadSwapInt64(
|
||||
const volatile void * _base,
|
||||
uintptr_t _offset
|
||||
)
|
||||
{
|
||||
return _OSSwapInt64(((struct _OSUnalignedU64 *)((uintptr_t)_base + _offset))->__val);
|
||||
}
|
||||
#else
|
||||
__DARWIN_OS_INLINE
|
||||
uint64_t
|
||||
OSReadSwapInt64(
|
||||
const volatile void * _base,
|
||||
uintptr_t _offset
|
||||
)
|
||||
{
|
||||
return _OSSwapInt64(((struct _OSUnalignedU64 *)((uintptr_t)_base + _offset))->__val);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Functions for byte reversed stores. */
|
||||
|
||||
#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)
|
||||
__DARWIN_OS_INLINE
|
||||
void
|
||||
_OSWriteSwapInt16(
|
||||
volatile void * _base,
|
||||
uintptr_t _offset,
|
||||
uint16_t _data
|
||||
)
|
||||
{
|
||||
((struct _OSUnalignedU16 *)((uintptr_t)_base + _offset))->__val = _OSSwapInt16(_data);
|
||||
}
|
||||
#else
|
||||
__DARWIN_OS_INLINE
|
||||
void
|
||||
OSWriteSwapInt16(
|
||||
volatile void * _base,
|
||||
uintptr_t _offset,
|
||||
uint16_t _data
|
||||
)
|
||||
{
|
||||
((struct _OSUnalignedU16 *)((uintptr_t)_base + _offset))->__val = _OSSwapInt16(_data);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)
|
||||
__DARWIN_OS_INLINE
|
||||
void
|
||||
_OSWriteSwapInt32(
|
||||
volatile void * _base,
|
||||
uintptr_t _offset,
|
||||
uint32_t _data
|
||||
)
|
||||
{
|
||||
((struct _OSUnalignedU32 *)((uintptr_t)_base + _offset))->__val = _OSSwapInt32(_data);
|
||||
}
|
||||
#else
|
||||
__DARWIN_OS_INLINE
|
||||
void
|
||||
OSWriteSwapInt32(
|
||||
volatile void * _base,
|
||||
uintptr_t _offset,
|
||||
uint32_t _data
|
||||
)
|
||||
{
|
||||
((struct _OSUnalignedU32 *)((uintptr_t)_base + _offset))->__val = _OSSwapInt32(_data);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)
|
||||
__DARWIN_OS_INLINE
|
||||
void
|
||||
_OSWriteSwapInt64(
|
||||
volatile void * _base,
|
||||
uintptr_t _offset,
|
||||
uint64_t _data
|
||||
)
|
||||
{
|
||||
((struct _OSUnalignedU64 *)((uintptr_t)_base + _offset))->__val = _OSSwapInt64(_data);
|
||||
}
|
||||
#else
|
||||
__DARWIN_OS_INLINE
|
||||
void
|
||||
OSWriteSwapInt64(
|
||||
volatile void * _base,
|
||||
uintptr_t _offset,
|
||||
uint64_t _data
|
||||
)
|
||||
{
|
||||
((struct _OSUnalignedU64 *)((uintptr_t)_base + _offset))->__val = _OSSwapInt64(_data);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ! _OS_OSBYTEORDERARM_H */
|
||||
272
lib/libc/include/aarch64-macos-gnu/mach-o/dyld.h
Normal file
272
lib/libc/include/aarch64-macos-gnu/mach-o/dyld.h
Normal file
@ -0,0 +1,272 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2008 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
#ifndef _MACH_O_DYLD_H_
|
||||
#define _MACH_O_DYLD_H_
|
||||
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <mach-o/loader.h>
|
||||
#include <Availability.h>
|
||||
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef __DRIVERKIT_19_0
|
||||
#define DYLD_DRIVERKIT_UNAVAILABLE __API_UNAVAILABLE(driverkit)
|
||||
#else
|
||||
#define DYLD_DRIVERKIT_UNAVAILABLE
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The following functions allow you to iterate through all loaded images.
|
||||
* This is not a thread safe operation. Another thread can add or remove
|
||||
* an image during the iteration.
|
||||
*
|
||||
* Many uses of these routines can be replace by a call to dladdr() which
|
||||
* will return the mach_header and name of an image, given an address in
|
||||
* the image. dladdr() is thread safe.
|
||||
*/
|
||||
extern uint32_t _dyld_image_count(void) __OSX_AVAILABLE_STARTING(__MAC_10_1, __IPHONE_2_0);
|
||||
extern const struct mach_header* _dyld_get_image_header(uint32_t image_index) __OSX_AVAILABLE_STARTING(__MAC_10_1, __IPHONE_2_0);
|
||||
extern intptr_t _dyld_get_image_vmaddr_slide(uint32_t image_index) __OSX_AVAILABLE_STARTING(__MAC_10_1, __IPHONE_2_0);
|
||||
extern const char* _dyld_get_image_name(uint32_t image_index) __OSX_AVAILABLE_STARTING(__MAC_10_1, __IPHONE_2_0);
|
||||
|
||||
|
||||
/*
|
||||
* The following functions allow you to install callbacks which will be called
|
||||
* by dyld whenever an image is loaded or unloaded. During a call to _dyld_register_func_for_add_image()
|
||||
* the callback func is called for every existing image. Later, it is called as each new image
|
||||
* is loaded and bound (but initializers not yet run). The callback registered with
|
||||
* _dyld_register_func_for_remove_image() is called after any terminators in an image are run
|
||||
* and before the image is un-memory-mapped.
|
||||
*/
|
||||
extern void _dyld_register_func_for_add_image(void (*func)(const struct mach_header* mh, intptr_t vmaddr_slide)) __OSX_AVAILABLE_STARTING(__MAC_10_1, __IPHONE_2_0);
|
||||
extern void _dyld_register_func_for_remove_image(void (*func)(const struct mach_header* mh, intptr_t vmaddr_slide)) __OSX_AVAILABLE_STARTING(__MAC_10_1, __IPHONE_2_0);
|
||||
|
||||
|
||||
/*
|
||||
* NSVersionOfRunTimeLibrary() returns the current_version number of the currently dylib
|
||||
* specifed by the libraryName. The libraryName parameter would be "bar" for /path/libbar.3.dylib and
|
||||
* "Foo" for /path/Foo.framework/Versions/A/Foo. It returns -1 if no such library is loaded.
|
||||
*/
|
||||
extern int32_t NSVersionOfRunTimeLibrary(const char* libraryName) __OSX_AVAILABLE_STARTING(__MAC_10_1, __IPHONE_2_0);
|
||||
|
||||
|
||||
/*
|
||||
* NSVersionOfLinkTimeLibrary() returns the current_version number that the main executable was linked
|
||||
* against at build time. The libraryName parameter would be "bar" for /path/libbar.3.dylib and
|
||||
* "Foo" for /path/Foo.framework/Versions/A/Foo. It returns -1 if the main executable did not link
|
||||
* against the specified library.
|
||||
*/
|
||||
extern int32_t NSVersionOfLinkTimeLibrary(const char* libraryName) __OSX_AVAILABLE_STARTING(__MAC_10_1, __IPHONE_2_0);
|
||||
|
||||
|
||||
/*
|
||||
* _NSGetExecutablePath() copies the path of the main executable into the buffer. The bufsize parameter
|
||||
* should initially be the size of the buffer. The function returns 0 if the path was successfully copied,
|
||||
* and *bufsize is left unchanged. It returns -1 if the buffer is not large enough, and *bufsize is set
|
||||
* to the size required.
|
||||
*
|
||||
* Note that _NSGetExecutablePath will return "a path" to the executable not a "real path" to the executable.
|
||||
* That is the path may be a symbolic link and not the real file. With deep directories the total bufsize
|
||||
* needed could be more than MAXPATHLEN.
|
||||
*/
|
||||
extern int _NSGetExecutablePath(char* buf, uint32_t* bufsize) __OSX_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_2_0);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Registers a function to be called when the current thread terminates.
|
||||
* Called by c++ compiler to implement destructors on thread_local object variables.
|
||||
*/
|
||||
extern void _tlv_atexit(void (*termFunc)(void* objAddr), void* objAddr) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0);
|
||||
|
||||
|
||||
/*
|
||||
* Never called. On-disk thread local variables contain a pointer to this. Once
|
||||
* the thread local is prepared, the pointer changes to a real handler such as tlv_get_addr.
|
||||
*/
|
||||
extern void _tlv_bootstrap(void) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0) DYLD_DRIVERKIT_UNAVAILABLE ;
|
||||
|
||||
|
||||
/*
|
||||
* Dylibs that are incorporated into the dyld cache are removed from disk. That means code
|
||||
* cannot stat() the file to see if it "exists". This function is like a stat() call that checks if a
|
||||
* path is to a dylib that was removed from disk and is incorporated into the active dyld cache.
|
||||
*/
|
||||
extern bool _dyld_shared_cache_contains_path(const char* path) __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) DYLD_DRIVERKIT_UNAVAILABLE;
|
||||
|
||||
|
||||
/*
|
||||
* The following dyld API's are deprecated as of Mac OS X 10.5. They are either
|
||||
* no longer necessary or are superceeded by dlopen and friends in <dlfcn.h>.
|
||||
* dlopen/dlsym/dlclose have been available since Mac OS X 10.3 and work with
|
||||
* dylibs and bundles.
|
||||
*
|
||||
* NSAddImage -> dlopen
|
||||
* NSLookupSymbolInImage -> dlsym
|
||||
* NSCreateObjectFileImageFromFile -> dlopen
|
||||
* NSDestroyObjectFileImage -> dlclose
|
||||
* NSLinkModule -> not needed when dlopen used
|
||||
* NSUnLinkModule -> not needed when dlclose used
|
||||
* NSLookupSymbolInModule -> dlsym
|
||||
* _dyld_image_containing_address -> dladdr
|
||||
* NSLinkEditError -> dlerror
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef ENUM_DYLD_BOOL
|
||||
#define ENUM_DYLD_BOOL
|
||||
#undef FALSE
|
||||
#undef TRUE
|
||||
enum DYLD_BOOL { FALSE, TRUE };
|
||||
#endif /* ENUM_DYLD_BOOL */
|
||||
|
||||
|
||||
/* Object file image API */
|
||||
typedef enum {
|
||||
NSObjectFileImageFailure, /* for this a message is printed on stderr */
|
||||
NSObjectFileImageSuccess,
|
||||
NSObjectFileImageInappropriateFile,
|
||||
NSObjectFileImageArch,
|
||||
NSObjectFileImageFormat, /* for this a message is printed on stderr */
|
||||
NSObjectFileImageAccess
|
||||
} NSObjectFileImageReturnCode;
|
||||
|
||||
typedef struct __NSObjectFileImage* NSObjectFileImage;
|
||||
|
||||
|
||||
|
||||
/* NSObjectFileImage can only be used with MH_BUNDLE files */
|
||||
extern NSObjectFileImageReturnCode NSCreateObjectFileImageFromFile(const char* pathName, NSObjectFileImage *objectFileImage) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "dlopen()");
|
||||
extern NSObjectFileImageReturnCode NSCreateObjectFileImageFromMemory(const void *address, size_t size, NSObjectFileImage *objectFileImage) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "");
|
||||
extern bool NSDestroyObjectFileImage(NSObjectFileImage objectFileImage) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "dlclose()");
|
||||
|
||||
extern uint32_t NSSymbolDefinitionCountInObjectFileImage(NSObjectFileImage objectFileImage) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "");
|
||||
extern const char* NSSymbolDefinitionNameInObjectFileImage(NSObjectFileImage objectFileImage, uint32_t ordinal) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "");
|
||||
extern uint32_t NSSymbolReferenceCountInObjectFileImage(NSObjectFileImage objectFileImage) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "");
|
||||
extern const char* NSSymbolReferenceNameInObjectFileImage(NSObjectFileImage objectFileImage, uint32_t ordinal, bool *tentative_definition) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "");
|
||||
extern bool NSIsSymbolDefinedInObjectFileImage(NSObjectFileImage objectFileImage, const char* symbolName) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.4, "dlsym()");
|
||||
extern void* NSGetSectionDataInObjectFileImage(NSObjectFileImage objectFileImage, const char* segmentName, const char* sectionName, size_t *size) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "getsectiondata()");
|
||||
|
||||
typedef struct __NSModule* NSModule;
|
||||
extern const char* NSNameOfModule(NSModule m) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "");
|
||||
extern const char* NSLibraryNameForModule(NSModule m) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "");
|
||||
|
||||
extern NSModule NSLinkModule(NSObjectFileImage objectFileImage, const char* moduleName, uint32_t options) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "dlopen()");
|
||||
#define NSLINKMODULE_OPTION_NONE 0x0
|
||||
#define NSLINKMODULE_OPTION_BINDNOW 0x1
|
||||
#define NSLINKMODULE_OPTION_PRIVATE 0x2
|
||||
#define NSLINKMODULE_OPTION_RETURN_ON_ERROR 0x4
|
||||
#define NSLINKMODULE_OPTION_DONT_CALL_MOD_INIT_ROUTINES 0x8
|
||||
#define NSLINKMODULE_OPTION_TRAILING_PHYS_NAME 0x10
|
||||
|
||||
extern bool NSUnLinkModule(NSModule module, uint32_t options) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "");
|
||||
#define NSUNLINKMODULE_OPTION_NONE 0x0
|
||||
#define NSUNLINKMODULE_OPTION_KEEP_MEMORY_MAPPED 0x1
|
||||
#define NSUNLINKMODULE_OPTION_RESET_LAZY_REFERENCES 0x2
|
||||
|
||||
/* symbol API */
|
||||
typedef struct __NSSymbol* NSSymbol;
|
||||
extern bool NSIsSymbolNameDefined(const char* symbolName) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.4, "dlsym()");
|
||||
extern bool NSIsSymbolNameDefinedWithHint(const char* symbolName, const char* libraryNameHint) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.4, "dlsym()");
|
||||
extern bool NSIsSymbolNameDefinedInImage(const struct mach_header* image, const char* symbolName) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.4, "dlsym()");
|
||||
extern NSSymbol NSLookupAndBindSymbol(const char* symbolName) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.4, "dlsym()");
|
||||
extern NSSymbol NSLookupAndBindSymbolWithHint(const char* symbolName, const char* libraryNameHint) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.4, "dlsym()");
|
||||
extern NSSymbol NSLookupSymbolInModule(NSModule module, const char* symbolName) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "dlsym()");
|
||||
extern NSSymbol NSLookupSymbolInImage(const struct mach_header* image, const char* symbolName, uint32_t options) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "dlsym()");
|
||||
#define NSLOOKUPSYMBOLINIMAGE_OPTION_BIND 0x0
|
||||
#define NSLOOKUPSYMBOLINIMAGE_OPTION_BIND_NOW 0x1
|
||||
#define NSLOOKUPSYMBOLINIMAGE_OPTION_BIND_FULLY 0x2
|
||||
#define NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR 0x4
|
||||
extern const char* NSNameOfSymbol(NSSymbol symbol) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "");
|
||||
extern void * NSAddressOfSymbol(NSSymbol symbol) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "dlsym()");
|
||||
extern NSModule NSModuleForSymbol(NSSymbol symbol) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "dladdr()");
|
||||
|
||||
/* error handling API */
|
||||
typedef enum {
|
||||
NSLinkEditFileAccessError,
|
||||
NSLinkEditFileFormatError,
|
||||
NSLinkEditMachResourceError,
|
||||
NSLinkEditUnixResourceError,
|
||||
NSLinkEditOtherError,
|
||||
NSLinkEditWarningError,
|
||||
NSLinkEditMultiplyDefinedError,
|
||||
NSLinkEditUndefinedError
|
||||
} NSLinkEditErrors;
|
||||
|
||||
/*
|
||||
* For the NSLinkEditErrors value NSLinkEditOtherError these are the values
|
||||
* passed to the link edit error handler as the errorNumber (what would be an
|
||||
* errno value for NSLinkEditUnixResourceError or a kern_return_t value for
|
||||
* NSLinkEditMachResourceError).
|
||||
*/
|
||||
typedef enum {
|
||||
NSOtherErrorRelocation,
|
||||
NSOtherErrorLazyBind,
|
||||
NSOtherErrorIndrLoop,
|
||||
NSOtherErrorLazyInit,
|
||||
NSOtherErrorInvalidArgs
|
||||
} NSOtherErrorNumbers;
|
||||
|
||||
extern void NSLinkEditError(NSLinkEditErrors *c, int *errorNumber, const char** fileName, const char** errorString) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "dlerror()");
|
||||
|
||||
typedef struct {
|
||||
void (*undefined)(const char* symbolName);
|
||||
NSModule (*multiple)(NSSymbol s, NSModule oldModule, NSModule newModule);
|
||||
void (*linkEdit)(NSLinkEditErrors errorClass, int errorNumber,
|
||||
const char* fileName, const char* errorString);
|
||||
} NSLinkEditErrorHandlers;
|
||||
|
||||
extern void NSInstallLinkEditErrorHandlers(const NSLinkEditErrorHandlers *handlers) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "");
|
||||
|
||||
extern bool NSAddLibrary(const char* pathName) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.4, "dlopen()");
|
||||
extern bool NSAddLibraryWithSearching(const char* pathName) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.4, "dlopen()");
|
||||
extern const struct mach_header* NSAddImage(const char* image_name, uint32_t options) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "dlopen()");
|
||||
#define NSADDIMAGE_OPTION_NONE 0x0
|
||||
#define NSADDIMAGE_OPTION_RETURN_ON_ERROR 0x1
|
||||
#define NSADDIMAGE_OPTION_WITH_SEARCHING 0x2
|
||||
#define NSADDIMAGE_OPTION_RETURN_ONLY_IF_LOADED 0x4
|
||||
#define NSADDIMAGE_OPTION_MATCH_FILENAME_BY_INSTALLNAME 0x8
|
||||
|
||||
extern bool _dyld_present(void) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "always true");
|
||||
extern bool _dyld_launched_prebound(void) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "moot");
|
||||
extern bool _dyld_all_twolevel_modules_prebound(void) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.3, 10.5, "moot");
|
||||
extern bool _dyld_bind_fully_image_containing_address(const void* address) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "dlopen(RTLD_NOW)");
|
||||
extern bool _dyld_image_containing_address(const void* address) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.3, 10.5, "dladdr()");
|
||||
extern void _dyld_lookup_and_bind(const char* symbol_name, void **address, NSModule* module) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.4, "dlsym()");
|
||||
extern void _dyld_lookup_and_bind_with_hint(const char* symbol_name, const char* library_name_hint, void** address, NSModule* module) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.4, "dlsym()");
|
||||
extern void _dyld_lookup_and_bind_fully(const char* symbol_name, void** address, NSModule* module) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "dlsym()");
|
||||
|
||||
extern const struct mach_header* _dyld_get_image_header_containing_address(const void* address) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.3, 10.5, "dladdr()");
|
||||
|
||||
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _MACH_O_DYLD_H_ */
|
||||
1601
lib/libc/include/aarch64-macos-gnu/mach-o/loader.h
Normal file
1601
lib/libc/include/aarch64-macos-gnu/mach-o/loader.h
Normal file
File diff suppressed because it is too large
Load Diff
645
lib/libc/include/aarch64-macos-gnu/mach/arm/_structs.h
Normal file
645
lib/libc/include/aarch64-macos-gnu/mach/arm/_structs.h
Normal file
@ -0,0 +1,645 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2007 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/*
|
||||
* @OSF_COPYRIGHT@
|
||||
*/
|
||||
#ifndef _MACH_ARM__STRUCTS_H_
|
||||
#define _MACH_ARM__STRUCTS_H_
|
||||
|
||||
#include <sys/cdefs.h> /* __DARWIN_UNIX03 */
|
||||
#include <machine/types.h> /* __uint32_t */
|
||||
|
||||
#if __DARWIN_UNIX03
|
||||
#define _STRUCT_ARM_EXCEPTION_STATE struct __darwin_arm_exception_state
|
||||
_STRUCT_ARM_EXCEPTION_STATE
|
||||
{
|
||||
__uint32_t __exception; /* number of arm exception taken */
|
||||
__uint32_t __fsr; /* Fault status */
|
||||
__uint32_t __far; /* Virtual Fault Address */
|
||||
};
|
||||
#else /* !__DARWIN_UNIX03 */
|
||||
#define _STRUCT_ARM_EXCEPTION_STATE struct arm_exception_state
|
||||
_STRUCT_ARM_EXCEPTION_STATE
|
||||
{
|
||||
__uint32_t exception; /* number of arm exception taken */
|
||||
__uint32_t fsr; /* Fault status */
|
||||
__uint32_t far; /* Virtual Fault Address */
|
||||
};
|
||||
#endif /* __DARWIN_UNIX03 */
|
||||
|
||||
#if __DARWIN_UNIX03
|
||||
#define _STRUCT_ARM_EXCEPTION_STATE64 struct __darwin_arm_exception_state64
|
||||
_STRUCT_ARM_EXCEPTION_STATE64
|
||||
{
|
||||
__uint64_t __far; /* Virtual Fault Address */
|
||||
__uint32_t __esr; /* Exception syndrome */
|
||||
__uint32_t __exception; /* number of arm exception taken */
|
||||
};
|
||||
#else /* !__DARWIN_UNIX03 */
|
||||
#define _STRUCT_ARM_EXCEPTION_STATE64 struct arm_exception_state64
|
||||
_STRUCT_ARM_EXCEPTION_STATE64
|
||||
{
|
||||
__uint64_t far; /* Virtual Fault Address */
|
||||
__uint32_t esr; /* Exception syndrome */
|
||||
__uint32_t exception; /* number of arm exception taken */
|
||||
};
|
||||
#endif /* __DARWIN_UNIX03 */
|
||||
|
||||
#if __DARWIN_UNIX03
|
||||
#define _STRUCT_ARM_THREAD_STATE struct __darwin_arm_thread_state
|
||||
_STRUCT_ARM_THREAD_STATE
|
||||
{
|
||||
__uint32_t __r[13]; /* General purpose register r0-r12 */
|
||||
__uint32_t __sp; /* Stack pointer r13 */
|
||||
__uint32_t __lr; /* Link register r14 */
|
||||
__uint32_t __pc; /* Program counter r15 */
|
||||
__uint32_t __cpsr; /* Current program status register */
|
||||
};
|
||||
#else /* !__DARWIN_UNIX03 */
|
||||
#define _STRUCT_ARM_THREAD_STATE struct arm_thread_state
|
||||
_STRUCT_ARM_THREAD_STATE
|
||||
{
|
||||
__uint32_t r[13]; /* General purpose register r0-r12 */
|
||||
__uint32_t sp; /* Stack pointer r13 */
|
||||
__uint32_t lr; /* Link register r14 */
|
||||
__uint32_t pc; /* Program counter r15 */
|
||||
__uint32_t cpsr; /* Current program status register */
|
||||
};
|
||||
#endif /* __DARWIN_UNIX03 */
|
||||
|
||||
|
||||
/*
|
||||
* By default, the pointer fields in the arm_thread_state64_t structure are
|
||||
* opaque on the arm64e architecture and require the use of accessor macros.
|
||||
* This mode can also be enabled on the arm64 architecture by building with
|
||||
* -D__DARWIN_OPAQUE_ARM_THREAD_STATE64=1.
|
||||
*/
|
||||
#if defined(__arm64__) && defined(__LP64__)
|
||||
|
||||
#if __has_feature(ptrauth_calls)
|
||||
#define __DARWIN_OPAQUE_ARM_THREAD_STATE64 1
|
||||
#define __DARWIN_PTRAUTH_ARM_THREAD_STATE64 1
|
||||
#endif /* __has_feature(ptrauth_calls) */
|
||||
|
||||
#ifndef __DARWIN_OPAQUE_ARM_THREAD_STATE64
|
||||
#define __DARWIN_OPAQUE_ARM_THREAD_STATE64 0
|
||||
#endif
|
||||
|
||||
#else /* defined(__arm64__) && defined(__LP64__) */
|
||||
|
||||
#undef __DARWIN_OPAQUE_ARM_THREAD_STATE64
|
||||
#define __DARWIN_OPAQUE_ARM_THREAD_STATE64 0
|
||||
|
||||
#endif /* defined(__arm64__) && defined(__LP64__) */
|
||||
|
||||
#if __DARWIN_UNIX03
|
||||
#define _STRUCT_ARM_THREAD_STATE64 struct __darwin_arm_thread_state64
|
||||
#if __DARWIN_OPAQUE_ARM_THREAD_STATE64
|
||||
_STRUCT_ARM_THREAD_STATE64
|
||||
{
|
||||
__uint64_t __x[29]; /* General purpose registers x0-x28 */
|
||||
void* __opaque_fp; /* Frame pointer x29 */
|
||||
void* __opaque_lr; /* Link register x30 */
|
||||
void* __opaque_sp; /* Stack pointer x31 */
|
||||
void* __opaque_pc; /* Program counter */
|
||||
__uint32_t __cpsr; /* Current program status register */
|
||||
__uint32_t __opaque_flags; /* Flags describing structure format */
|
||||
};
|
||||
#else /* __DARWIN_OPAQUE_ARM_THREAD_STATE64 */
|
||||
_STRUCT_ARM_THREAD_STATE64
|
||||
{
|
||||
__uint64_t __x[29]; /* General purpose registers x0-x28 */
|
||||
__uint64_t __fp; /* Frame pointer x29 */
|
||||
__uint64_t __lr; /* Link register x30 */
|
||||
__uint64_t __sp; /* Stack pointer x31 */
|
||||
__uint64_t __pc; /* Program counter */
|
||||
__uint32_t __cpsr; /* Current program status register */
|
||||
__uint32_t __pad; /* Same size for 32-bit or 64-bit clients */
|
||||
};
|
||||
#endif /* __DARWIN_OPAQUE_ARM_THREAD_STATE64 */
|
||||
#else /* !__DARWIN_UNIX03 */
|
||||
#define _STRUCT_ARM_THREAD_STATE64 struct arm_thread_state64
|
||||
#if __DARWIN_OPAQUE_ARM_THREAD_STATE64
|
||||
_STRUCT_ARM_THREAD_STATE64
|
||||
{
|
||||
__uint64_t x[29]; /* General purpose registers x0-x28 */
|
||||
void* __opaque_fp; /* Frame pointer x29 */
|
||||
void* __opaque_lr; /* Link register x30 */
|
||||
void* __opaque_sp; /* Stack pointer x31 */
|
||||
void* __opaque_pc; /* Program counter */
|
||||
__uint32_t cpsr; /* Current program status register */
|
||||
__uint32_t __opaque_flags; /* Flags describing structure format */
|
||||
};
|
||||
#else /* __DARWIN_OPAQUE_ARM_THREAD_STATE64 */
|
||||
_STRUCT_ARM_THREAD_STATE64
|
||||
{
|
||||
__uint64_t x[29]; /* General purpose registers x0-x28 */
|
||||
__uint64_t fp; /* Frame pointer x29 */
|
||||
__uint64_t lr; /* Link register x30 */
|
||||
__uint64_t sp; /* Stack pointer x31 */
|
||||
__uint64_t pc; /* Program counter */
|
||||
__uint32_t cpsr; /* Current program status register */
|
||||
__uint32_t __pad; /* Same size for 32-bit or 64-bit clients */
|
||||
};
|
||||
#endif /* __DARWIN_OPAQUE_ARM_THREAD_STATE64 */
|
||||
#endif /* __DARWIN_UNIX03 */
|
||||
|
||||
#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL && defined(__arm64__)
|
||||
|
||||
/* Accessor macros for arm_thread_state64_t pointer fields */
|
||||
|
||||
#if __has_feature(ptrauth_calls) && defined(__LP64__)
|
||||
#include <ptrauth.h>
|
||||
|
||||
#if !__DARWIN_OPAQUE_ARM_THREAD_STATE64 || !__DARWIN_PTRAUTH_ARM_THREAD_STATE64
|
||||
#error "Invalid configuration"
|
||||
#endif
|
||||
|
||||
#define __DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH 0x1
|
||||
#define __DARWIN_ARM_THREAD_STATE64_FLAGS_IB_SIGNED_LR 0x2
|
||||
|
||||
/* Return pc field of arm_thread_state64_t as a data pointer value */
|
||||
#define __darwin_arm_thread_state64_get_pc(ts) \
|
||||
__extension__ ({ const _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
|
||||
(uintptr_t)(__tsp->__opaque_pc && !(__tsp->__opaque_flags & \
|
||||
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? \
|
||||
ptrauth_auth_data(__tsp->__opaque_pc, \
|
||||
ptrauth_key_process_independent_code, \
|
||||
ptrauth_string_discriminator("pc")) : __tsp->__opaque_pc); })
|
||||
/* Return pc field of arm_thread_state64_t as a function pointer. May return
|
||||
* NULL if a valid function pointer cannot be constructed, the caller should
|
||||
* fall back to the __darwin_arm_thread_state64_get_pc() macro in that case. */
|
||||
#define __darwin_arm_thread_state64_get_pc_fptr(ts) \
|
||||
__extension__ ({ const _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
|
||||
(__tsp->__opaque_pc && !(__tsp->__opaque_flags & \
|
||||
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? \
|
||||
ptrauth_auth_function(__tsp->__opaque_pc, \
|
||||
ptrauth_key_process_independent_code, \
|
||||
ptrauth_string_discriminator("pc")) : NULL); })
|
||||
/* Set pc field of arm_thread_state64_t to a function pointer */
|
||||
#define __darwin_arm_thread_state64_set_pc_fptr(ts, fptr) \
|
||||
__extension__ ({ _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
|
||||
__typeof__(fptr) __f = (fptr); __tsp->__opaque_pc = \
|
||||
(__f ? (!(__tsp->__opaque_flags & \
|
||||
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? \
|
||||
ptrauth_auth_and_resign(__f, ptrauth_key_function_pointer, 0, \
|
||||
ptrauth_key_process_independent_code, \
|
||||
ptrauth_string_discriminator("pc")) : ptrauth_auth_data(__f, \
|
||||
ptrauth_key_function_pointer, 0)) : __f); })
|
||||
/* Return lr field of arm_thread_state64_t as a data pointer value */
|
||||
#define __darwin_arm_thread_state64_get_lr(ts) \
|
||||
__extension__ ({ const _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
|
||||
(uintptr_t)(__tsp->__opaque_lr && !(__tsp->__opaque_flags & ( \
|
||||
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH | \
|
||||
__DARWIN_ARM_THREAD_STATE64_FLAGS_IB_SIGNED_LR)) ? \
|
||||
ptrauth_auth_data(__tsp->__opaque_lr, \
|
||||
ptrauth_key_process_independent_code, \
|
||||
ptrauth_string_discriminator("lr")) : __tsp->__opaque_lr); })
|
||||
/* Return lr field of arm_thread_state64_t as a function pointer. May return
|
||||
* NULL if a valid function pointer cannot be constructed, the caller should
|
||||
* fall back to the __darwin_arm_thread_state64_get_lr() macro in that case. */
|
||||
#define __darwin_arm_thread_state64_get_lr_fptr(ts) \
|
||||
__extension__ ({ const _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
|
||||
(__tsp->__opaque_lr && !(__tsp->__opaque_flags & ( \
|
||||
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH | \
|
||||
__DARWIN_ARM_THREAD_STATE64_FLAGS_IB_SIGNED_LR)) ? \
|
||||
ptrauth_auth_function(__tsp->__opaque_lr, \
|
||||
ptrauth_key_process_independent_code, \
|
||||
ptrauth_string_discriminator("lr")) : NULL); })
|
||||
/* Set lr field of arm_thread_state64_t to a function pointer */
|
||||
#define __darwin_arm_thread_state64_set_lr_fptr(ts, fptr) \
|
||||
__extension__ ({ _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
|
||||
__typeof__(fptr) __f = (fptr); __tsp->__opaque_lr = \
|
||||
(__f ? (!(__tsp->__opaque_flags & \
|
||||
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? (__tsp->__opaque_flags \
|
||||
&= ~__DARWIN_ARM_THREAD_STATE64_FLAGS_IB_SIGNED_LR , \
|
||||
ptrauth_auth_and_resign(__f, ptrauth_key_function_pointer, 0, \
|
||||
ptrauth_key_process_independent_code, \
|
||||
ptrauth_string_discriminator("lr"))) : ptrauth_auth_data(__f, \
|
||||
ptrauth_key_function_pointer, 0)) : __f); })
|
||||
/* Return sp field of arm_thread_state64_t as a data pointer value */
|
||||
#define __darwin_arm_thread_state64_get_sp(ts) \
|
||||
__extension__ ({ const _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
|
||||
(uintptr_t)(__tsp->__opaque_sp && !(__tsp->__opaque_flags & \
|
||||
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? \
|
||||
ptrauth_auth_data(__tsp->__opaque_sp, \
|
||||
ptrauth_key_process_independent_data, \
|
||||
ptrauth_string_discriminator("sp")) : __tsp->__opaque_sp); })
|
||||
/* Set sp field of arm_thread_state64_t to a data pointer value */
|
||||
#define __darwin_arm_thread_state64_set_sp(ts, ptr) \
|
||||
__extension__ ({ _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
|
||||
void *__p = (void*)(uintptr_t)(ptr); __tsp->__opaque_sp = \
|
||||
(__p && !(__tsp->__opaque_flags & \
|
||||
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? \
|
||||
ptrauth_sign_unauthenticated(__p, \
|
||||
ptrauth_key_process_independent_data, \
|
||||
ptrauth_string_discriminator("sp")) : __p); })
|
||||
/* Return fp field of arm_thread_state64_t as a data pointer value */
|
||||
#define __darwin_arm_thread_state64_get_fp(ts) \
|
||||
__extension__ ({ const _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
|
||||
(uintptr_t)(__tsp->__opaque_fp && !(__tsp->__opaque_flags & \
|
||||
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? \
|
||||
ptrauth_auth_data(__tsp->__opaque_fp, \
|
||||
ptrauth_key_process_independent_data, \
|
||||
ptrauth_string_discriminator("fp")) : __tsp->__opaque_fp); })
|
||||
/* Set fp field of arm_thread_state64_t to a data pointer value */
|
||||
#define __darwin_arm_thread_state64_set_fp(ts, ptr) \
|
||||
__extension__ ({ _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
|
||||
void *__p = (void*)(uintptr_t)(ptr); __tsp->__opaque_fp = \
|
||||
(__p && !(__tsp->__opaque_flags & \
|
||||
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? \
|
||||
ptrauth_sign_unauthenticated(__p, \
|
||||
ptrauth_key_process_independent_data, \
|
||||
ptrauth_string_discriminator("fp")) : __p); })
|
||||
|
||||
/* Strip ptr auth bits from pc, lr, sp and fp field of arm_thread_state64_t */
|
||||
#define __darwin_arm_thread_state64_ptrauth_strip(ts) \
|
||||
__extension__ ({ _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
|
||||
__tsp->__opaque_pc = ((__tsp->__opaque_flags & \
|
||||
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? __tsp->__opaque_pc : \
|
||||
ptrauth_strip(__tsp->__opaque_pc, ptrauth_key_process_independent_code)); \
|
||||
__tsp->__opaque_lr = ((__tsp->__opaque_flags & \
|
||||
(__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH | \
|
||||
__DARWIN_ARM_THREAD_STATE64_FLAGS_IB_SIGNED_LR)) ? __tsp->__opaque_lr : \
|
||||
ptrauth_strip(__tsp->__opaque_lr, ptrauth_key_process_independent_code)); \
|
||||
__tsp->__opaque_sp = ((__tsp->__opaque_flags & \
|
||||
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? __tsp->__opaque_sp : \
|
||||
ptrauth_strip(__tsp->__opaque_sp, ptrauth_key_process_independent_data)); \
|
||||
__tsp->__opaque_fp = ((__tsp->__opaque_flags & \
|
||||
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? __tsp->__opaque_fp : \
|
||||
ptrauth_strip(__tsp->__opaque_fp, ptrauth_key_process_independent_data)); \
|
||||
__tsp->__opaque_flags |= \
|
||||
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH; })
|
||||
|
||||
#else /* __has_feature(ptrauth_calls) && defined(__LP64__) */
|
||||
|
||||
#if __DARWIN_OPAQUE_ARM_THREAD_STATE64
|
||||
|
||||
#ifndef __LP64__
|
||||
#error "Invalid configuration"
|
||||
#endif
|
||||
|
||||
/* Return pc field of arm_thread_state64_t as a data pointer value */
|
||||
#define __darwin_arm_thread_state64_get_pc(ts) \
|
||||
((uintptr_t)((ts).__opaque_pc))
|
||||
/* Return pc field of arm_thread_state64_t as a function pointer */
|
||||
#define __darwin_arm_thread_state64_get_pc_fptr(ts) \
|
||||
((ts).__opaque_pc)
|
||||
/* Set pc field of arm_thread_state64_t to a function pointer */
|
||||
#define __darwin_arm_thread_state64_set_pc_fptr(ts, fptr) \
|
||||
((ts).__opaque_pc = (fptr))
|
||||
/* Return lr field of arm_thread_state64_t as a data pointer value */
|
||||
#define __darwin_arm_thread_state64_get_lr(ts) \
|
||||
((uintptr_t)((ts).__opaque_lr))
|
||||
/* Return lr field of arm_thread_state64_t as a function pointer */
|
||||
#define __darwin_arm_thread_state64_get_lr_fptr(ts) \
|
||||
((ts).__opaque_lr)
|
||||
/* Set lr field of arm_thread_state64_t to a function pointer */
|
||||
#define __darwin_arm_thread_state64_set_lr_fptr(ts, fptr) \
|
||||
((ts).__opaque_lr = (fptr))
|
||||
/* Return sp field of arm_thread_state64_t as a data pointer value */
|
||||
#define __darwin_arm_thread_state64_get_sp(ts) \
|
||||
((uintptr_t)((ts).__opaque_sp))
|
||||
/* Set sp field of arm_thread_state64_t to a data pointer value */
|
||||
#define __darwin_arm_thread_state64_set_sp(ts, ptr) \
|
||||
((ts).__opaque_sp = (void*)(uintptr_t)(ptr))
|
||||
/* Return fp field of arm_thread_state64_t as a data pointer value */
|
||||
#define __darwin_arm_thread_state64_get_fp(ts) \
|
||||
((uintptr_t)((ts).__opaque_fp))
|
||||
/* Set fp field of arm_thread_state64_t to a data pointer value */
|
||||
#define __darwin_arm_thread_state64_set_fp(ts, ptr) \
|
||||
((ts).__opaque_fp = (void*)(uintptr_t)(ptr))
|
||||
/* Strip ptr auth bits from pc, lr, sp and fp field of arm_thread_state64_t */
|
||||
#define __darwin_arm_thread_state64_ptrauth_strip(ts) \
|
||||
(void)(ts)
|
||||
|
||||
#else /* __DARWIN_OPAQUE_ARM_THREAD_STATE64 */
|
||||
#if __DARWIN_UNIX03
|
||||
|
||||
/* Return pc field of arm_thread_state64_t as a data pointer value */
|
||||
#define __darwin_arm_thread_state64_get_pc(ts) \
|
||||
((ts).__pc)
|
||||
/* Return pc field of arm_thread_state64_t as a function pointer */
|
||||
#define __darwin_arm_thread_state64_get_pc_fptr(ts) \
|
||||
((void*)(uintptr_t)((ts).__pc))
|
||||
/* Set pc field of arm_thread_state64_t to a function pointer */
|
||||
#define __darwin_arm_thread_state64_set_pc_fptr(ts, fptr) \
|
||||
((ts).__pc = (uintptr_t)(fptr))
|
||||
/* Return lr field of arm_thread_state64_t as a data pointer value */
|
||||
#define __darwin_arm_thread_state64_get_lr(ts) \
|
||||
((ts).__lr)
|
||||
/* Return lr field of arm_thread_state64_t as a function pointer */
|
||||
#define __darwin_arm_thread_state64_get_lr_fptr(ts) \
|
||||
((void*)(uintptr_t)((ts).__lr))
|
||||
/* Set lr field of arm_thread_state64_t to a function pointer */
|
||||
#define __darwin_arm_thread_state64_set_lr_fptr(ts, fptr) \
|
||||
((ts).__lr = (uintptr_t)(fptr))
|
||||
/* Return sp field of arm_thread_state64_t as a data pointer value */
|
||||
#define __darwin_arm_thread_state64_get_sp(ts) \
|
||||
((ts).__sp)
|
||||
/* Set sp field of arm_thread_state64_t to a data pointer value */
|
||||
#define __darwin_arm_thread_state64_set_sp(ts, ptr) \
|
||||
((ts).__sp = (uintptr_t)(ptr))
|
||||
/* Return fp field of arm_thread_state64_t as a data pointer value */
|
||||
#define __darwin_arm_thread_state64_get_fp(ts) \
|
||||
((ts).__fp)
|
||||
/* Set fp field of arm_thread_state64_t to a data pointer value */
|
||||
#define __darwin_arm_thread_state64_set_fp(ts, ptr) \
|
||||
((ts).__fp = (uintptr_t)(ptr))
|
||||
/* Strip ptr auth bits from pc, lr, sp and fp field of arm_thread_state64_t */
|
||||
#define __darwin_arm_thread_state64_ptrauth_strip(ts) \
|
||||
(void)(ts)
|
||||
|
||||
#else /* __DARWIN_UNIX03 */
|
||||
|
||||
/* Return pc field of arm_thread_state64_t as a data pointer value */
|
||||
#define __darwin_arm_thread_state64_get_pc(ts) \
|
||||
((ts).pc)
|
||||
/* Return pc field of arm_thread_state64_t as a function pointer */
|
||||
#define __darwin_arm_thread_state64_get_pc_fptr(ts) \
|
||||
((void*)(uintptr_t)((ts).pc))
|
||||
/* Set pc field of arm_thread_state64_t to a function pointer */
|
||||
#define __darwin_arm_thread_state64_set_pc_fptr(ts, fptr) \
|
||||
((ts).pc = (uintptr_t)(fptr))
|
||||
/* Return lr field of arm_thread_state64_t as a data pointer value */
|
||||
#define __darwin_arm_thread_state64_get_lr(ts) \
|
||||
((ts).lr)
|
||||
/* Return lr field of arm_thread_state64_t as a function pointer */
|
||||
#define __darwin_arm_thread_state64_get_lr_fptr(ts) \
|
||||
((void*)(uintptr_t)((ts).lr))
|
||||
/* Set lr field of arm_thread_state64_t to a function pointer */
|
||||
#define __darwin_arm_thread_state64_set_lr_fptr(ts, fptr) \
|
||||
((ts).lr = (uintptr_t)(fptr))
|
||||
/* Return sp field of arm_thread_state64_t as a data pointer value */
|
||||
#define __darwin_arm_thread_state64_get_sp(ts) \
|
||||
((ts).sp)
|
||||
/* Set sp field of arm_thread_state64_t to a data pointer value */
|
||||
#define __darwin_arm_thread_state64_set_sp(ts, ptr) \
|
||||
((ts).sp = (uintptr_t)(ptr))
|
||||
/* Return fp field of arm_thread_state64_t as a data pointer value */
|
||||
#define __darwin_arm_thread_state64_get_fp(ts) \
|
||||
((ts).fp)
|
||||
/* Set fp field of arm_thread_state64_t to a data pointer value */
|
||||
#define __darwin_arm_thread_state64_set_fp(ts, ptr) \
|
||||
((ts).fp = (uintptr_t)(ptr))
|
||||
/* Strip ptr auth bits from pc, lr, sp and fp field of arm_thread_state64_t */
|
||||
#define __darwin_arm_thread_state64_ptrauth_strip(ts) \
|
||||
(void)(ts)
|
||||
|
||||
#endif /* __DARWIN_UNIX03 */
|
||||
#endif /* __DARWIN_OPAQUE_ARM_THREAD_STATE64 */
|
||||
|
||||
#endif /* __has_feature(ptrauth_calls) && defined(__LP64__) */
|
||||
#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL && defined(__arm64__) */
|
||||
|
||||
#if __DARWIN_UNIX03
|
||||
#define _STRUCT_ARM_VFP_STATE struct __darwin_arm_vfp_state
|
||||
_STRUCT_ARM_VFP_STATE
|
||||
{
|
||||
__uint32_t __r[64];
|
||||
__uint32_t __fpscr;
|
||||
};
|
||||
#else /* !__DARWIN_UNIX03 */
|
||||
#define _STRUCT_ARM_VFP_STATE struct arm_vfp_state
|
||||
_STRUCT_ARM_VFP_STATE
|
||||
{
|
||||
__uint32_t r[64];
|
||||
__uint32_t fpscr;
|
||||
};
|
||||
#endif /* __DARWIN_UNIX03 */
|
||||
|
||||
#if __DARWIN_UNIX03
|
||||
#define _STRUCT_ARM_NEON_STATE64 struct __darwin_arm_neon_state64
|
||||
#define _STRUCT_ARM_NEON_STATE struct __darwin_arm_neon_state
|
||||
|
||||
#if defined(__arm64__)
|
||||
_STRUCT_ARM_NEON_STATE64
|
||||
{
|
||||
__uint128_t __v[32];
|
||||
__uint32_t __fpsr;
|
||||
__uint32_t __fpcr;
|
||||
};
|
||||
|
||||
_STRUCT_ARM_NEON_STATE
|
||||
{
|
||||
__uint128_t __v[16];
|
||||
__uint32_t __fpsr;
|
||||
__uint32_t __fpcr;
|
||||
};
|
||||
#elif defined(__arm__)
|
||||
/*
|
||||
* No 128-bit intrinsic for ARM; leave it opaque for now.
|
||||
*/
|
||||
_STRUCT_ARM_NEON_STATE64
|
||||
{
|
||||
char opaque[(32 * 16) + (2 * sizeof(__uint32_t))];
|
||||
} __attribute__((aligned(16)));
|
||||
|
||||
_STRUCT_ARM_NEON_STATE
|
||||
{
|
||||
char opaque[(16 * 16) + (2 * sizeof(__uint32_t))];
|
||||
} __attribute__((aligned(16)));
|
||||
|
||||
#else
|
||||
#error Unknown architecture.
|
||||
#endif
|
||||
|
||||
#else /* !__DARWIN_UNIX03 */
|
||||
#define _STRUCT_ARM_NEON_STATE64 struct arm_neon_state64
|
||||
#define _STRUCT_ARM_NEON_STATE struct arm_neon_state
|
||||
|
||||
#if defined(__arm64__)
|
||||
_STRUCT_ARM_NEON_STATE64
|
||||
{
|
||||
__uint128_t q[32];
|
||||
uint32_t fpsr;
|
||||
uint32_t fpcr;
|
||||
};
|
||||
|
||||
_STRUCT_ARM_NEON_STATE
|
||||
{
|
||||
__uint128_t q[16];
|
||||
uint32_t fpsr;
|
||||
uint32_t fpcr;
|
||||
};
|
||||
#elif defined(__arm__)
|
||||
/*
|
||||
* No 128-bit intrinsic for ARM; leave it opaque for now.
|
||||
*/
|
||||
_STRUCT_ARM_NEON_STATE64
|
||||
{
|
||||
char opaque[(32 * 16) + (2 * sizeof(__uint32_t))];
|
||||
} __attribute__((aligned(16)));
|
||||
|
||||
_STRUCT_ARM_NEON_STATE
|
||||
{
|
||||
char opaque[(16 * 16) + (2 * sizeof(__uint32_t))];
|
||||
} __attribute__((aligned(16)));
|
||||
|
||||
#else
|
||||
#error Unknown architecture.
|
||||
#endif
|
||||
|
||||
#endif /* __DARWIN_UNIX03 */
|
||||
|
||||
#if __DARWIN_UNIX03
|
||||
#define _STRUCT_ARM_AMX_STATE_V1 struct __darwin_arm_amx_state_v1
|
||||
_STRUCT_ARM_AMX_STATE_V1
|
||||
{
|
||||
__uint8_t __x[8][64]; /* 8 64-byte registers */
|
||||
__uint8_t __y[8][64]; /* 8 64-byte registers */
|
||||
__uint8_t __z[64][64]; /* 64 64-byte registers in an M-by-N matrix */
|
||||
__uint64_t __amx_state_t_el1; /* AMX_STATE_T_EL1 value */
|
||||
} __attribute__((aligned(64)));
|
||||
#else /* !__DARWIN_UNIX03 */
|
||||
#define _STRUCT_ARM_AMX_STATE_V1 struct arm_amx_state_v1
|
||||
_STRUCT_ARM_AMX_STATE_V1
|
||||
{
|
||||
__uint8_t x[8][64]; /* 8 64-byte registers */
|
||||
__uint8_t y[8][64]; /* 8 64-byte registers */
|
||||
__uint8_t z[64][64]; /* 64 64-byte registers in an M-by-N matrix */
|
||||
__uint64_t amx_state_t_el1; /* AMX_STATE_T_EL1 value. */
|
||||
} __attribute__((aligned(64)));
|
||||
#endif /* __DARWIN_UNIX03 */
|
||||
|
||||
#define _STRUCT_ARM_PAGEIN_STATE struct __arm_pagein_state
|
||||
_STRUCT_ARM_PAGEIN_STATE
|
||||
{
|
||||
int __pagein_error;
|
||||
};
|
||||
|
||||
/*
|
||||
* Debug State
|
||||
*/
|
||||
#if defined(__arm__)
|
||||
/* Old-fashioned debug state is only for ARM */
|
||||
|
||||
#if __DARWIN_UNIX03
|
||||
#define _STRUCT_ARM_DEBUG_STATE struct __darwin_arm_debug_state
|
||||
_STRUCT_ARM_DEBUG_STATE
|
||||
{
|
||||
__uint32_t __bvr[16];
|
||||
__uint32_t __bcr[16];
|
||||
__uint32_t __wvr[16];
|
||||
__uint32_t __wcr[16];
|
||||
};
|
||||
#else /* !__DARWIN_UNIX03 */
|
||||
#define _STRUCT_ARM_DEBUG_STATE struct arm_debug_state
|
||||
_STRUCT_ARM_DEBUG_STATE
|
||||
{
|
||||
__uint32_t bvr[16];
|
||||
__uint32_t bcr[16];
|
||||
__uint32_t wvr[16];
|
||||
__uint32_t wcr[16];
|
||||
};
|
||||
#endif /* __DARWIN_UNIX03 */
|
||||
|
||||
#elif defined(__arm64__)
|
||||
|
||||
/* ARM's arm_debug_state is ARM64's arm_legacy_debug_state */
|
||||
|
||||
#if __DARWIN_UNIX03
|
||||
#define _STRUCT_ARM_LEGACY_DEBUG_STATE struct __arm_legacy_debug_state
|
||||
_STRUCT_ARM_LEGACY_DEBUG_STATE
|
||||
{
|
||||
__uint32_t __bvr[16];
|
||||
__uint32_t __bcr[16];
|
||||
__uint32_t __wvr[16];
|
||||
__uint32_t __wcr[16];
|
||||
};
|
||||
#else /* __DARWIN_UNIX03 */
|
||||
#define _STRUCT_ARM_LEGACY_DEBUG_STATE struct arm_legacy_debug_state
|
||||
_STRUCT_ARM_LEGACY_DEBUG_STATE
|
||||
{
|
||||
__uint32_t bvr[16];
|
||||
__uint32_t bcr[16];
|
||||
__uint32_t wvr[16];
|
||||
__uint32_t wcr[16];
|
||||
};
|
||||
#endif /* __DARWIN_UNIX03 */
|
||||
#else
|
||||
#error unknown architecture
|
||||
#endif
|
||||
|
||||
#if __DARWIN_UNIX03
|
||||
#define _STRUCT_ARM_DEBUG_STATE32 struct __darwin_arm_debug_state32
|
||||
_STRUCT_ARM_DEBUG_STATE32
|
||||
{
|
||||
__uint32_t __bvr[16];
|
||||
__uint32_t __bcr[16];
|
||||
__uint32_t __wvr[16];
|
||||
__uint32_t __wcr[16];
|
||||
__uint64_t __mdscr_el1; /* Bit 0 is SS (Hardware Single Step) */
|
||||
};
|
||||
|
||||
#define _STRUCT_ARM_DEBUG_STATE64 struct __darwin_arm_debug_state64
|
||||
_STRUCT_ARM_DEBUG_STATE64
|
||||
{
|
||||
__uint64_t __bvr[16];
|
||||
__uint64_t __bcr[16];
|
||||
__uint64_t __wvr[16];
|
||||
__uint64_t __wcr[16];
|
||||
__uint64_t __mdscr_el1; /* Bit 0 is SS (Hardware Single Step) */
|
||||
};
|
||||
#else /* !__DARWIN_UNIX03 */
|
||||
#define _STRUCT_ARM_DEBUG_STATE32 struct arm_debug_state32
|
||||
_STRUCT_ARM_DEBUG_STATE32
|
||||
{
|
||||
__uint32_t bvr[16];
|
||||
__uint32_t bcr[16];
|
||||
__uint32_t wvr[16];
|
||||
__uint32_t wcr[16];
|
||||
__uint64_t mdscr_el1; /* Bit 0 is SS (Hardware Single Step) */
|
||||
};
|
||||
|
||||
#define _STRUCT_ARM_DEBUG_STATE64 struct arm_debug_state64
|
||||
_STRUCT_ARM_DEBUG_STATE64
|
||||
{
|
||||
__uint64_t bvr[16];
|
||||
__uint64_t bcr[16];
|
||||
__uint64_t wvr[16];
|
||||
__uint64_t wcr[16];
|
||||
__uint64_t mdscr_el1; /* Bit 0 is SS (Hardware Single Step) */
|
||||
};
|
||||
#endif /* __DARWIN_UNIX03 */
|
||||
|
||||
#if __DARWIN_UNIX03
|
||||
#define _STRUCT_ARM_CPMU_STATE64 struct __darwin_arm_cpmu_state64
|
||||
_STRUCT_ARM_CPMU_STATE64
|
||||
{
|
||||
__uint64_t __ctrs[16];
|
||||
};
|
||||
#else /* __DARWIN_UNIX03 */
|
||||
#define _STRUCT_ARM_CPMU_STATE64 struct arm_cpmu_state64
|
||||
_STRUCT_ARM_CPMU_STATE64
|
||||
{
|
||||
__uint64_t ctrs[16];
|
||||
};
|
||||
#endif /* !__DARWIN_UNIX03 */
|
||||
|
||||
#endif /* _MACH_ARM__STRUCTS_H_ */
|
||||
70
lib/libc/include/aarch64-macos-gnu/mach/arm/boolean.h
Normal file
70
lib/libc/include/aarch64-macos-gnu/mach/arm/boolean.h
Normal file
@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2007 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/*
|
||||
* @OSF_COPYRIGHT@
|
||||
*/
|
||||
/*
|
||||
* Mach Operating System
|
||||
* Copyright (c) 1991,1990,1989 Carnegie Mellon University
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission to use, copy, modify and distribute this software and its
|
||||
* documentation is hereby granted, provided that both the copyright
|
||||
* notice and this permission notice appear in all copies of the
|
||||
* software, derivative works or modified versions, and any portions
|
||||
* thereof, and that both notices appear in supporting documentation.
|
||||
*
|
||||
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
||||
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
|
||||
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
||||
*
|
||||
* Carnegie Mellon requests users of this software to return to
|
||||
*
|
||||
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
||||
* School of Computer Science
|
||||
* Carnegie Mellon University
|
||||
* Pittsburgh PA 15213-3890
|
||||
*
|
||||
* any improvements or extensions that they make and grant Carnegie Mellon
|
||||
* the rights to redistribute these changes.
|
||||
*/
|
||||
/*
|
||||
*/
|
||||
|
||||
/*
|
||||
* File: boolean.h
|
||||
*
|
||||
* Boolean type, for ARM.
|
||||
*/
|
||||
|
||||
#ifndef _MACH_ARM_BOOLEAN_H_
|
||||
#define _MACH_ARM_BOOLEAN_H_
|
||||
|
||||
typedef int boolean_t;
|
||||
|
||||
#endif /* _MACH_ARM_BOOLEAN_H_ */
|
||||
79
lib/libc/include/aarch64-macos-gnu/mach/arm/exception.h
Normal file
79
lib/libc/include/aarch64-macos-gnu/mach/arm/exception.h
Normal file
@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Copyright (c) 2007 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef _MACH_ARM_EXCEPTION_H_
|
||||
#define _MACH_ARM_EXCEPTION_H_
|
||||
|
||||
#define EXC_TYPES_COUNT 14 /* incl. illegal exception 0 */
|
||||
|
||||
#define EXC_MASK_MACHINE 0
|
||||
|
||||
#define EXCEPTION_CODE_MAX 2 /* code and subcode */
|
||||
|
||||
|
||||
/*
|
||||
* Trap numbers as defined by the hardware exception vectors.
|
||||
*/
|
||||
|
||||
/*
|
||||
* EXC_BAD_INSTRUCTION
|
||||
*/
|
||||
|
||||
#define EXC_ARM_UNDEFINED 1 /* Undefined */
|
||||
|
||||
/*
|
||||
* EXC_ARITHMETIC
|
||||
*/
|
||||
|
||||
#define EXC_ARM_FP_UNDEFINED 0 /* Undefined Floating Point Exception */
|
||||
#define EXC_ARM_FP_IO 1 /* Invalid Floating Point Operation */
|
||||
#define EXC_ARM_FP_DZ 2 /* Floating Point Divide by Zero */
|
||||
#define EXC_ARM_FP_OF 3 /* Floating Point Overflow */
|
||||
#define EXC_ARM_FP_UF 4 /* Floating Point Underflow */
|
||||
#define EXC_ARM_FP_IX 5 /* Inexact Floating Point Result */
|
||||
#define EXC_ARM_FP_ID 6 /* Floating Point Denormal Input */
|
||||
|
||||
/*
|
||||
* EXC_BAD_ACCESS
|
||||
* Note: do not conflict with kern_return_t values returned by vm_fault
|
||||
*/
|
||||
|
||||
#define EXC_ARM_DA_ALIGN 0x101 /* Alignment Fault */
|
||||
#define EXC_ARM_DA_DEBUG 0x102 /* Debug (watch/break) Fault */
|
||||
#define EXC_ARM_SP_ALIGN 0x103 /* SP Alignment Fault */
|
||||
#define EXC_ARM_SWP 0x104 /* SWP instruction */
|
||||
#define EXC_ARM_PAC_FAIL 0x105 /* PAC authentication failure */
|
||||
|
||||
/*
|
||||
* EXC_BREAKPOINT
|
||||
*/
|
||||
|
||||
#define EXC_ARM_BREAKPOINT 1 /* breakpoint trap */
|
||||
|
||||
|
||||
#endif /* _MACH_ARM_EXCEPTION_H_ */
|
||||
74
lib/libc/include/aarch64-macos-gnu/mach/arm/kern_return.h
Normal file
74
lib/libc/include/aarch64-macos-gnu/mach/arm/kern_return.h
Normal file
@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2007 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/*
|
||||
* @OSF_COPYRIGHT@
|
||||
*/
|
||||
/*
|
||||
* Mach Operating System
|
||||
* Copyright (c) 1991,1990,1989 Carnegie Mellon University
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission to use, copy, modify and distribute this software and its
|
||||
* documentation is hereby granted, provided that both the copyright
|
||||
* notice and this permission notice appear in all copies of the
|
||||
* software, derivative works or modified versions, and any portions
|
||||
* thereof, and that both notices appear in supporting documentation.
|
||||
*
|
||||
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
||||
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
|
||||
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
||||
*
|
||||
* Carnegie Mellon requests users of this software to return to
|
||||
*
|
||||
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
||||
* School of Computer Science
|
||||
* Carnegie Mellon University
|
||||
* Pittsburgh PA 15213-3890
|
||||
*
|
||||
* any improvements or extensions that they make and grant Carnegie Mellon
|
||||
* the rights to redistribute these changes.
|
||||
*/
|
||||
/*
|
||||
*/
|
||||
|
||||
/*
|
||||
* File: kern_return.h
|
||||
* Author: Avadis Tevanian, Jr., Michael Wayne Young
|
||||
* Date: 1985
|
||||
*
|
||||
* Machine-dependent kernel return definitions.
|
||||
*/
|
||||
|
||||
#ifndef _MACH_ARM_KERN_RETURN_H_
|
||||
#define _MACH_ARM_KERN_RETURN_H_
|
||||
|
||||
#ifndef ASSEMBLER
|
||||
typedef int kern_return_t;
|
||||
#endif /* ASSEMBLER */
|
||||
|
||||
#endif /* _MACH_ARM_KERN_RETURN_H_ */
|
||||
72
lib/libc/include/aarch64-macos-gnu/mach/arm/processor_info.h
Normal file
72
lib/libc/include/aarch64-macos-gnu/mach/arm/processor_info.h
Normal file
@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Copyright (c) 2007-2018 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef _MACH_ARM_PROCESSOR_INFO_H_
|
||||
#define _MACH_ARM_PROCESSOR_INFO_H_
|
||||
|
||||
#define PROCESSOR_CPU_STAT 0x10000003 /* Low-level CPU statistics */
|
||||
#define PROCESSOR_CPU_STAT64 0x10000004 /* Low-level CPU statistics, in full 64-bit */
|
||||
|
||||
#include <stdint.h> /* uint32_t, uint64_t */
|
||||
|
||||
struct processor_cpu_stat {
|
||||
uint32_t irq_ex_cnt;
|
||||
uint32_t ipi_cnt;
|
||||
uint32_t timer_cnt;
|
||||
uint32_t undef_ex_cnt;
|
||||
uint32_t unaligned_cnt;
|
||||
uint32_t vfp_cnt;
|
||||
uint32_t vfp_shortv_cnt;
|
||||
uint32_t data_ex_cnt;
|
||||
uint32_t instr_ex_cnt;
|
||||
};
|
||||
|
||||
typedef struct processor_cpu_stat processor_cpu_stat_data_t;
|
||||
typedef struct processor_cpu_stat *processor_cpu_stat_t;
|
||||
#define PROCESSOR_CPU_STAT_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof(processor_cpu_stat_data_t) / sizeof(natural_t)))
|
||||
|
||||
struct processor_cpu_stat64 {
|
||||
uint64_t irq_ex_cnt;
|
||||
uint64_t ipi_cnt;
|
||||
uint64_t timer_cnt;
|
||||
uint64_t undef_ex_cnt;
|
||||
uint64_t unaligned_cnt;
|
||||
uint64_t vfp_cnt;
|
||||
uint64_t vfp_shortv_cnt;
|
||||
uint64_t data_ex_cnt;
|
||||
uint64_t instr_ex_cnt;
|
||||
uint64_t pmi_cnt;
|
||||
} __attribute__((packed, aligned(4)));
|
||||
|
||||
typedef struct processor_cpu_stat64 processor_cpu_stat64_data_t;
|
||||
typedef struct processor_cpu_stat64 *processor_cpu_stat64_t;
|
||||
#define PROCESSOR_CPU_STAT64_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof(processor_cpu_stat64_data_t) / sizeof(integer_t)))
|
||||
|
||||
#endif /* _MACH_ARM_PROCESSOR_INFO_H_ */
|
||||
35
lib/libc/include/aarch64-macos-gnu/mach/arm/rpc.h
Normal file
35
lib/libc/include/aarch64-macos-gnu/mach/arm/rpc.h
Normal file
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2007 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/*
|
||||
* @OSF_COPYRIGHT@
|
||||
*/
|
||||
|
||||
#ifndef _MACH_ARM_RPC_H_
|
||||
#define _MACH_ARM_RPC_H_
|
||||
|
||||
#endif /* _MACH_ARM_RPC_H_ */
|
||||
44
lib/libc/include/aarch64-macos-gnu/mach/arm/thread_state.h
Normal file
44
lib/libc/include/aarch64-macos-gnu/mach/arm/thread_state.h
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2007 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/*
|
||||
* @OSF_COPYRIGHT@
|
||||
*/
|
||||
|
||||
#ifndef _MACH_ARM_THREAD_STATE_H_
|
||||
#define _MACH_ARM_THREAD_STATE_H_
|
||||
|
||||
/* Size of maximum exported thread state in words */
|
||||
#define ARM_THREAD_STATE_MAX (1296) /* Size of biggest state possible */
|
||||
|
||||
#if defined (__arm__) || defined(__arm64__)
|
||||
#define THREAD_STATE_MAX ARM_THREAD_STATE_MAX
|
||||
#else
|
||||
#error Unsupported arch
|
||||
#endif
|
||||
|
||||
#endif /* _MACH_ARM_THREAD_STATE_H_ */
|
||||
249
lib/libc/include/aarch64-macos-gnu/mach/arm/thread_status.h
Normal file
249
lib/libc/include/aarch64-macos-gnu/mach/arm/thread_status.h
Normal file
@ -0,0 +1,249 @@
|
||||
/*
|
||||
* Copyright (c) 2007 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/*
|
||||
* FILE_ID: thread_status.h
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _ARM_THREAD_STATUS_H_
|
||||
#define _ARM_THREAD_STATUS_H_
|
||||
|
||||
#include <mach/machine/_structs.h>
|
||||
#include <mach/message.h>
|
||||
#include <mach/vm_types.h>
|
||||
#include <mach/arm/thread_state.h>
|
||||
|
||||
/*
|
||||
* Support for determining the state of a thread
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Flavors
|
||||
*/
|
||||
|
||||
#define ARM_THREAD_STATE 1
|
||||
#define ARM_UNIFIED_THREAD_STATE ARM_THREAD_STATE
|
||||
#define ARM_VFP_STATE 2
|
||||
#define ARM_EXCEPTION_STATE 3
|
||||
#define ARM_DEBUG_STATE 4 /* pre-armv8 */
|
||||
#define THREAD_STATE_NONE 5
|
||||
#define ARM_THREAD_STATE64 6
|
||||
#define ARM_EXCEPTION_STATE64 7
|
||||
// ARM_THREAD_STATE_LAST 8 /* legacy */
|
||||
#define ARM_THREAD_STATE32 9
|
||||
|
||||
|
||||
/* API */
|
||||
#define ARM_DEBUG_STATE32 14
|
||||
#define ARM_DEBUG_STATE64 15
|
||||
#define ARM_NEON_STATE 16
|
||||
#define ARM_NEON_STATE64 17
|
||||
#define ARM_CPMU_STATE64 18
|
||||
|
||||
|
||||
/* API */
|
||||
#define ARM_AMX_STATE 24
|
||||
#define ARM_AMX_STATE_V1 25
|
||||
#define ARM_STATE_FLAVOR_IS_OTHER_VALID(_flavor_) \
|
||||
((_flavor_) == ARM_AMX_STATE_V1)
|
||||
#define ARM_PAGEIN_STATE 27
|
||||
|
||||
#define VALID_THREAD_STATE_FLAVOR(x) \
|
||||
((x == ARM_THREAD_STATE) || \
|
||||
(x == ARM_VFP_STATE) || \
|
||||
(x == ARM_EXCEPTION_STATE) || \
|
||||
(x == ARM_DEBUG_STATE) || \
|
||||
(x == THREAD_STATE_NONE) || \
|
||||
(x == ARM_THREAD_STATE32) || \
|
||||
(x == ARM_THREAD_STATE64) || \
|
||||
(x == ARM_EXCEPTION_STATE64) || \
|
||||
(x == ARM_NEON_STATE) || \
|
||||
(x == ARM_NEON_STATE64) || \
|
||||
(x == ARM_DEBUG_STATE32) || \
|
||||
(x == ARM_DEBUG_STATE64) || \
|
||||
(x == ARM_PAGEIN_STATE) || \
|
||||
(ARM_STATE_FLAVOR_IS_OTHER_VALID(x)))
|
||||
|
||||
struct arm_state_hdr {
|
||||
uint32_t flavor;
|
||||
uint32_t count;
|
||||
};
|
||||
typedef struct arm_state_hdr arm_state_hdr_t;
|
||||
|
||||
typedef _STRUCT_ARM_THREAD_STATE arm_thread_state_t;
|
||||
typedef _STRUCT_ARM_THREAD_STATE arm_thread_state32_t;
|
||||
typedef _STRUCT_ARM_THREAD_STATE64 arm_thread_state64_t;
|
||||
|
||||
#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL && defined(__arm64__)
|
||||
|
||||
/* Accessor macros for arm_thread_state64_t pointer fields */
|
||||
|
||||
/* Return pc field of arm_thread_state64_t as a data pointer value */
|
||||
#define arm_thread_state64_get_pc(ts) \
|
||||
__darwin_arm_thread_state64_get_pc(ts)
|
||||
/* Return pc field of arm_thread_state64_t as a function pointer. May return
|
||||
* NULL if a valid function pointer cannot be constructed, the caller should
|
||||
* fall back to the arm_thread_state64_get_pc() macro in that case. */
|
||||
#define arm_thread_state64_get_pc_fptr(ts) \
|
||||
__darwin_arm_thread_state64_get_pc_fptr(ts)
|
||||
/* Set pc field of arm_thread_state64_t to a function pointer */
|
||||
#define arm_thread_state64_set_pc_fptr(ts, fptr) \
|
||||
__darwin_arm_thread_state64_set_pc_fptr(ts, fptr)
|
||||
/* Return lr field of arm_thread_state64_t as a data pointer value */
|
||||
#define arm_thread_state64_get_lr(ts) \
|
||||
__darwin_arm_thread_state64_get_lr(ts)
|
||||
/* Return lr field of arm_thread_state64_t as a function pointer. May return
|
||||
* NULL if a valid function pointer cannot be constructed, the caller should
|
||||
* fall back to the arm_thread_state64_get_lr() macro in that case. */
|
||||
#define arm_thread_state64_get_lr_fptr(ts) \
|
||||
__darwin_arm_thread_state64_get_lr_fptr(ts)
|
||||
/* Set lr field of arm_thread_state64_t to a function pointer */
|
||||
#define arm_thread_state64_set_lr_fptr(ts, fptr) \
|
||||
__darwin_arm_thread_state64_set_lr_fptr(ts, fptr)
|
||||
/* Return sp field of arm_thread_state64_t as a data pointer value */
|
||||
#define arm_thread_state64_get_sp(ts) \
|
||||
__darwin_arm_thread_state64_get_sp(ts)
|
||||
/* Set sp field of arm_thread_state64_t to a data pointer value */
|
||||
#define arm_thread_state64_set_sp(ts, ptr) \
|
||||
__darwin_arm_thread_state64_set_sp(ts, ptr)
|
||||
/* Return fp field of arm_thread_state64_t as a data pointer value */
|
||||
#define arm_thread_state64_get_fp(ts) \
|
||||
__darwin_arm_thread_state64_get_fp(ts)
|
||||
/* Set fp field of arm_thread_state64_t to a data pointer value */
|
||||
#define arm_thread_state64_set_fp(ts, ptr) \
|
||||
__darwin_arm_thread_state64_set_fp(ts, ptr)
|
||||
/* Strip ptr auth bits from pc, lr, sp and fp field of arm_thread_state64_t */
|
||||
#define arm_thread_state64_ptrauth_strip(ts) \
|
||||
__darwin_arm_thread_state64_ptrauth_strip(ts)
|
||||
|
||||
#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL && defined(__arm64__) */
|
||||
|
||||
struct arm_unified_thread_state {
|
||||
arm_state_hdr_t ash;
|
||||
union {
|
||||
arm_thread_state32_t ts_32;
|
||||
arm_thread_state64_t ts_64;
|
||||
} uts;
|
||||
};
|
||||
#define ts_32 uts.ts_32
|
||||
#define ts_64 uts.ts_64
|
||||
typedef struct arm_unified_thread_state arm_unified_thread_state_t;
|
||||
|
||||
#define ARM_THREAD_STATE_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof (arm_thread_state_t)/sizeof(uint32_t)))
|
||||
#define ARM_THREAD_STATE32_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof (arm_thread_state32_t)/sizeof(uint32_t)))
|
||||
#define ARM_THREAD_STATE64_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof (arm_thread_state64_t)/sizeof(uint32_t)))
|
||||
#define ARM_UNIFIED_THREAD_STATE_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof (arm_unified_thread_state_t)/sizeof(uint32_t)))
|
||||
|
||||
|
||||
typedef _STRUCT_ARM_VFP_STATE arm_vfp_state_t;
|
||||
typedef _STRUCT_ARM_NEON_STATE arm_neon_state_t;
|
||||
typedef _STRUCT_ARM_NEON_STATE arm_neon_state32_t;
|
||||
typedef _STRUCT_ARM_NEON_STATE64 arm_neon_state64_t;
|
||||
|
||||
typedef _STRUCT_ARM_AMX_STATE_V1 arm_amx_state_v1_t;
|
||||
|
||||
typedef _STRUCT_ARM_EXCEPTION_STATE arm_exception_state_t;
|
||||
typedef _STRUCT_ARM_EXCEPTION_STATE arm_exception_state32_t;
|
||||
typedef _STRUCT_ARM_EXCEPTION_STATE64 arm_exception_state64_t;
|
||||
|
||||
typedef _STRUCT_ARM_DEBUG_STATE32 arm_debug_state32_t;
|
||||
typedef _STRUCT_ARM_DEBUG_STATE64 arm_debug_state64_t;
|
||||
|
||||
typedef _STRUCT_ARM_PAGEIN_STATE arm_pagein_state_t;
|
||||
|
||||
/*
|
||||
* Otherwise not ARM64 kernel and we must preserve legacy ARM definitions of
|
||||
* arm_debug_state for binary compatability of userland consumers of this file.
|
||||
*/
|
||||
#if defined(__arm__)
|
||||
typedef _STRUCT_ARM_DEBUG_STATE arm_debug_state_t;
|
||||
#elif defined(__arm64__)
|
||||
typedef _STRUCT_ARM_LEGACY_DEBUG_STATE arm_debug_state_t;
|
||||
#else /* defined(__arm__) */
|
||||
#error Undefined architecture
|
||||
#endif /* defined(__arm__) */
|
||||
|
||||
#define ARM_VFP_STATE_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof (arm_vfp_state_t)/sizeof(uint32_t)))
|
||||
|
||||
#define ARM_EXCEPTION_STATE_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof (arm_exception_state_t)/sizeof(uint32_t)))
|
||||
|
||||
#define ARM_EXCEPTION_STATE64_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof (arm_exception_state64_t)/sizeof(uint32_t)))
|
||||
|
||||
#define ARM_DEBUG_STATE_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof (arm_debug_state_t)/sizeof(uint32_t)))
|
||||
|
||||
#define ARM_DEBUG_STATE32_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof (arm_debug_state32_t)/sizeof(uint32_t)))
|
||||
|
||||
#define ARM_PAGEIN_STATE_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof (arm_pagein_state_t)/sizeof(uint32_t)))
|
||||
|
||||
#define ARM_DEBUG_STATE64_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof (arm_debug_state64_t)/sizeof(uint32_t)))
|
||||
|
||||
#define ARM_NEON_STATE_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof (arm_neon_state_t)/sizeof(uint32_t)))
|
||||
|
||||
#define ARM_NEON_STATE64_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof (arm_neon_state64_t)/sizeof(uint32_t)))
|
||||
|
||||
#define MACHINE_THREAD_STATE ARM_THREAD_STATE
|
||||
#define MACHINE_THREAD_STATE_COUNT ARM_UNIFIED_THREAD_STATE_COUNT
|
||||
|
||||
|
||||
struct arm_amx_state {
|
||||
arm_state_hdr_t ash;
|
||||
union {
|
||||
arm_amx_state_v1_t as_v1;
|
||||
} uas;
|
||||
};
|
||||
#define as_v1 uas.as_v1
|
||||
typedef struct arm_amx_state arm_amx_state_t;
|
||||
|
||||
#define ARM_AMX_STATE_V1_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof(arm_amx_state_v1_t)/sizeof(unsigned int)))
|
||||
|
||||
#define ARM_AMX_STATE_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof(arm_amx_state_t)/sizeof(unsigned int)))
|
||||
|
||||
|
||||
/*
|
||||
* Largest state on this machine:
|
||||
*/
|
||||
#define THREAD_MACHINE_STATE_MAX THREAD_STATE_MAX
|
||||
|
||||
|
||||
#endif /* _ARM_THREAD_STATUS_H_ */
|
||||
103
lib/libc/include/aarch64-macos-gnu/mach/arm/vm_param.h
Normal file
103
lib/libc/include/aarch64-macos-gnu/mach/arm/vm_param.h
Normal file
@ -0,0 +1,103 @@
|
||||
/*
|
||||
* Copyright (c) 2007 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/*
|
||||
* FILE_ID: vm_param.h
|
||||
*/
|
||||
|
||||
/*
|
||||
* ARM machine dependent virtual memory parameters.
|
||||
*/
|
||||
|
||||
#ifndef _MACH_ARM_VM_PARAM_H_
|
||||
#define _MACH_ARM_VM_PARAM_H_
|
||||
|
||||
|
||||
#if !defined (KERNEL) && !defined (__ASSEMBLER__)
|
||||
#include <mach/vm_page_size.h>
|
||||
#endif
|
||||
|
||||
#define BYTE_SIZE 8 /* byte size in bits */
|
||||
|
||||
|
||||
#define PAGE_SHIFT vm_page_shift
|
||||
#define PAGE_SIZE vm_page_size
|
||||
#define PAGE_MASK vm_page_mask
|
||||
|
||||
#define VM_PAGE_SIZE vm_page_size
|
||||
|
||||
#define machine_ptob(x) ((x) << PAGE_SHIFT)
|
||||
|
||||
|
||||
#define PAGE_MAX_SHIFT 14
|
||||
#define PAGE_MAX_SIZE (1 << PAGE_MAX_SHIFT)
|
||||
#define PAGE_MAX_MASK (PAGE_MAX_SIZE-1)
|
||||
|
||||
#define PAGE_MIN_SHIFT 12
|
||||
#define PAGE_MIN_SIZE (1 << PAGE_MIN_SHIFT)
|
||||
#define PAGE_MIN_MASK (PAGE_MIN_SIZE-1)
|
||||
|
||||
#define VM_MAX_PAGE_ADDRESS MACH_VM_MAX_ADDRESS
|
||||
|
||||
#ifndef __ASSEMBLER__
|
||||
|
||||
|
||||
#if defined (__arm__)
|
||||
|
||||
#define VM_MIN_ADDRESS ((vm_address_t) 0x00000000)
|
||||
#define VM_MAX_ADDRESS ((vm_address_t) 0x80000000)
|
||||
|
||||
/* system-wide values */
|
||||
#define MACH_VM_MIN_ADDRESS ((mach_vm_offset_t) 0)
|
||||
#define MACH_VM_MAX_ADDRESS ((mach_vm_offset_t) VM_MAX_ADDRESS)
|
||||
|
||||
#elif defined (__arm64__)
|
||||
|
||||
#define VM_MIN_ADDRESS ((vm_address_t) 0x0000000000000000ULL)
|
||||
#define VM_MAX_ADDRESS ((vm_address_t) 0x0000000080000000ULL)
|
||||
|
||||
/* system-wide values */
|
||||
#define MACH_VM_MIN_ADDRESS_RAW 0x0ULL
|
||||
#define MACH_VM_MAX_ADDRESS_RAW 0x00007FFFFE000000ULL
|
||||
|
||||
#define MACH_VM_MIN_ADDRESS ((mach_vm_offset_t) MACH_VM_MIN_ADDRESS_RAW)
|
||||
#define MACH_VM_MAX_ADDRESS ((mach_vm_offset_t) MACH_VM_MAX_ADDRESS_RAW)
|
||||
|
||||
|
||||
#else /* defined(__arm64__) */
|
||||
#error architecture not supported
|
||||
#endif
|
||||
|
||||
#define VM_MAP_MIN_ADDRESS VM_MIN_ADDRESS
|
||||
#define VM_MAP_MAX_ADDRESS VM_MAX_ADDRESS
|
||||
|
||||
|
||||
#endif /* !__ASSEMBLER__ */
|
||||
|
||||
#define SWI_SYSCALL 0x80
|
||||
|
||||
#endif /* _MACH_ARM_VM_PARAM_H_ */
|
||||
157
lib/libc/include/aarch64-macos-gnu/mach/arm/vm_types.h
Normal file
157
lib/libc/include/aarch64-macos-gnu/mach/arm/vm_types.h
Normal file
@ -0,0 +1,157 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2007 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/*
|
||||
* @OSF_COPYRIGHT@
|
||||
*/
|
||||
/*
|
||||
* Mach Operating System
|
||||
* Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission to use, copy, modify and distribute this software and its
|
||||
* documentation is hereby granted, provided that both the copyright
|
||||
* notice and this permission notice appear in all copies of the
|
||||
* software, derivative works or modified versions, and any portions
|
||||
* thereof, and that both notices appear in supporting documentation.
|
||||
*
|
||||
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
||||
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
|
||||
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
||||
*
|
||||
* Carnegie Mellon requests users of this software to return to
|
||||
*
|
||||
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
||||
* School of Computer Science
|
||||
* Carnegie Mellon University
|
||||
* Pittsburgh PA 15213-3890
|
||||
*
|
||||
* any improvements or extensions that they make and grant Carnegie Mellon
|
||||
* the rights to redistribute these changes.
|
||||
*/
|
||||
/*
|
||||
*/
|
||||
|
||||
/*
|
||||
* File: vm_types.h
|
||||
* Author: Avadis Tevanian, Jr.
|
||||
* Date: 1985
|
||||
*
|
||||
* Header file for VM data types. ARM version.
|
||||
*/
|
||||
|
||||
#ifndef _MACH_ARM_VM_TYPES_H_
|
||||
#define _MACH_ARM_VM_TYPES_H_
|
||||
|
||||
#ifndef ASSEMBLER
|
||||
|
||||
#include <arm/_types.h>
|
||||
#include <stdint.h>
|
||||
#include <Availability.h>
|
||||
|
||||
/*
|
||||
* natural_t and integer_t are Mach's legacy types for machine-
|
||||
* independent integer types (unsigned, and signed, respectively).
|
||||
* Their original purpose was to define other types in a machine/
|
||||
* compiler independent way.
|
||||
*
|
||||
* They also had an implicit "same size as pointer" characteristic
|
||||
* to them (i.e. Mach's traditional types are very ILP32 or ILP64
|
||||
* centric). We will likely support x86 ABIs that do not follow
|
||||
* either ofthese models (specifically LP64). Therefore, we had to
|
||||
* make a choice between making these types scale with pointers or stay
|
||||
* tied to integers. Because their use is predominantly tied to
|
||||
* to the size of an integer, we are keeping that association and
|
||||
* breaking free from pointer size guarantees.
|
||||
*
|
||||
* New use of these types is discouraged.
|
||||
*/
|
||||
typedef __darwin_natural_t natural_t;
|
||||
typedef int integer_t;
|
||||
|
||||
/*
|
||||
* A vm_offset_t is a type-neutral pointer,
|
||||
* e.g. an offset into a virtual memory space.
|
||||
*/
|
||||
#ifdef __LP64__
|
||||
typedef uintptr_t vm_offset_t;
|
||||
typedef uintptr_t vm_size_t;
|
||||
|
||||
typedef uint64_t mach_vm_address_t;
|
||||
typedef uint64_t mach_vm_offset_t;
|
||||
typedef uint64_t mach_vm_size_t;
|
||||
|
||||
typedef uint64_t vm_map_offset_t;
|
||||
typedef uint64_t vm_map_address_t;
|
||||
typedef uint64_t vm_map_size_t;
|
||||
#else
|
||||
typedef natural_t vm_offset_t;
|
||||
/*
|
||||
* A vm_size_t is the proper type for e.g.
|
||||
* expressing the difference between two
|
||||
* vm_offset_t entities.
|
||||
*/
|
||||
typedef natural_t vm_size_t;
|
||||
|
||||
/*
|
||||
* This new type is independent of a particular vm map's
|
||||
* implementation size - and represents appropriate types
|
||||
* for all possible maps. This is used for interfaces
|
||||
* where the size of the map is not known - or we don't
|
||||
* want to have to distinguish.
|
||||
*/
|
||||
#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && (__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_5_0)
|
||||
typedef uint32_t mach_vm_address_t;
|
||||
typedef uint32_t mach_vm_offset_t;
|
||||
typedef uint32_t mach_vm_size_t;
|
||||
#else
|
||||
typedef uint64_t mach_vm_address_t;
|
||||
typedef uint64_t mach_vm_offset_t;
|
||||
typedef uint64_t mach_vm_size_t;
|
||||
#endif
|
||||
|
||||
typedef uint32_t vm_map_offset_t;
|
||||
typedef uint32_t vm_map_address_t;
|
||||
typedef uint32_t vm_map_size_t;
|
||||
#endif /* __LP64__ */
|
||||
|
||||
|
||||
typedef uint32_t vm32_offset_t;
|
||||
typedef uint32_t vm32_address_t;
|
||||
typedef uint32_t vm32_size_t;
|
||||
|
||||
typedef vm_offset_t mach_port_context_t;
|
||||
|
||||
|
||||
#endif /* ASSEMBLER */
|
||||
|
||||
/*
|
||||
* If composing messages by hand (please do not)
|
||||
*/
|
||||
#define MACH_MSG_TYPE_INTEGER_T MACH_MSG_TYPE_INTEGER_32
|
||||
|
||||
#endif /* _MACH_ARM_VM_TYPES_H_ */
|
||||
334
lib/libc/include/aarch64-macos-gnu/mach/kern_return.h
Normal file
334
lib/libc/include/aarch64-macos-gnu/mach/kern_return.h
Normal file
@ -0,0 +1,334 @@
|
||||
/*
|
||||
* Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/*
|
||||
* @OSF_COPYRIGHT@
|
||||
*/
|
||||
/*
|
||||
* Mach Operating System
|
||||
* Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission to use, copy, modify and distribute this software and its
|
||||
* documentation is hereby granted, provided that both the copyright
|
||||
* notice and this permission notice appear in all copies of the
|
||||
* software, derivative works or modified versions, and any portions
|
||||
* thereof, and that both notices appear in supporting documentation.
|
||||
*
|
||||
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
||||
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
|
||||
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
||||
*
|
||||
* Carnegie Mellon requests users of this software to return to
|
||||
*
|
||||
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
||||
* School of Computer Science
|
||||
* Carnegie Mellon University
|
||||
* Pittsburgh PA 15213-3890
|
||||
*
|
||||
* any improvements or extensions that they make and grant Carnegie Mellon
|
||||
* the rights to redistribute these changes.
|
||||
*/
|
||||
/*
|
||||
*/
|
||||
/*
|
||||
* File: h/kern_return.h
|
||||
* Author: Avadis Tevanian, Jr.
|
||||
* Date: 1985
|
||||
*
|
||||
* Kernel return codes.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _MACH_KERN_RETURN_H_
|
||||
#define _MACH_KERN_RETURN_H_
|
||||
|
||||
#include <mach/machine/kern_return.h>
|
||||
|
||||
#define KERN_SUCCESS 0
|
||||
|
||||
#define KERN_INVALID_ADDRESS 1
|
||||
/* Specified address is not currently valid.
|
||||
*/
|
||||
|
||||
#define KERN_PROTECTION_FAILURE 2
|
||||
/* Specified memory is valid, but does not permit the
|
||||
* required forms of access.
|
||||
*/
|
||||
|
||||
#define KERN_NO_SPACE 3
|
||||
/* The address range specified is already in use, or
|
||||
* no address range of the size specified could be
|
||||
* found.
|
||||
*/
|
||||
|
||||
#define KERN_INVALID_ARGUMENT 4
|
||||
/* The function requested was not applicable to this
|
||||
* type of argument, or an argument is invalid
|
||||
*/
|
||||
|
||||
#define KERN_FAILURE 5
|
||||
/* The function could not be performed. A catch-all.
|
||||
*/
|
||||
|
||||
#define KERN_RESOURCE_SHORTAGE 6
|
||||
/* A system resource could not be allocated to fulfill
|
||||
* this request. This failure may not be permanent.
|
||||
*/
|
||||
|
||||
#define KERN_NOT_RECEIVER 7
|
||||
/* The task in question does not hold receive rights
|
||||
* for the port argument.
|
||||
*/
|
||||
|
||||
#define KERN_NO_ACCESS 8
|
||||
/* Bogus access restriction.
|
||||
*/
|
||||
|
||||
#define KERN_MEMORY_FAILURE 9
|
||||
/* During a page fault, the target address refers to a
|
||||
* memory object that has been destroyed. This
|
||||
* failure is permanent.
|
||||
*/
|
||||
|
||||
#define KERN_MEMORY_ERROR 10
|
||||
/* During a page fault, the memory object indicated
|
||||
* that the data could not be returned. This failure
|
||||
* may be temporary; future attempts to access this
|
||||
* same data may succeed, as defined by the memory
|
||||
* object.
|
||||
*/
|
||||
|
||||
#define KERN_ALREADY_IN_SET 11
|
||||
/* The receive right is already a member of the portset.
|
||||
*/
|
||||
|
||||
#define KERN_NOT_IN_SET 12
|
||||
/* The receive right is not a member of a port set.
|
||||
*/
|
||||
|
||||
#define KERN_NAME_EXISTS 13
|
||||
/* The name already denotes a right in the task.
|
||||
*/
|
||||
|
||||
#define KERN_ABORTED 14
|
||||
/* The operation was aborted. Ipc code will
|
||||
* catch this and reflect it as a message error.
|
||||
*/
|
||||
|
||||
#define KERN_INVALID_NAME 15
|
||||
/* The name doesn't denote a right in the task.
|
||||
*/
|
||||
|
||||
#define KERN_INVALID_TASK 16
|
||||
/* Target task isn't an active task.
|
||||
*/
|
||||
|
||||
#define KERN_INVALID_RIGHT 17
|
||||
/* The name denotes a right, but not an appropriate right.
|
||||
*/
|
||||
|
||||
#define KERN_INVALID_VALUE 18
|
||||
/* A blatant range error.
|
||||
*/
|
||||
|
||||
#define KERN_UREFS_OVERFLOW 19
|
||||
/* Operation would overflow limit on user-references.
|
||||
*/
|
||||
|
||||
#define KERN_INVALID_CAPABILITY 20
|
||||
/* The supplied (port) capability is improper.
|
||||
*/
|
||||
|
||||
#define KERN_RIGHT_EXISTS 21
|
||||
/* The task already has send or receive rights
|
||||
* for the port under another name.
|
||||
*/
|
||||
|
||||
#define KERN_INVALID_HOST 22
|
||||
/* Target host isn't actually a host.
|
||||
*/
|
||||
|
||||
#define KERN_MEMORY_PRESENT 23
|
||||
/* An attempt was made to supply "precious" data
|
||||
* for memory that is already present in a
|
||||
* memory object.
|
||||
*/
|
||||
|
||||
#define KERN_MEMORY_DATA_MOVED 24
|
||||
/* A page was requested of a memory manager via
|
||||
* memory_object_data_request for an object using
|
||||
* a MEMORY_OBJECT_COPY_CALL strategy, with the
|
||||
* VM_PROT_WANTS_COPY flag being used to specify
|
||||
* that the page desired is for a copy of the
|
||||
* object, and the memory manager has detected
|
||||
* the page was pushed into a copy of the object
|
||||
* while the kernel was walking the shadow chain
|
||||
* from the copy to the object. This error code
|
||||
* is delivered via memory_object_data_error
|
||||
* and is handled by the kernel (it forces the
|
||||
* kernel to restart the fault). It will not be
|
||||
* seen by users.
|
||||
*/
|
||||
|
||||
#define KERN_MEMORY_RESTART_COPY 25
|
||||
/* A strategic copy was attempted of an object
|
||||
* upon which a quicker copy is now possible.
|
||||
* The caller should retry the copy using
|
||||
* vm_object_copy_quickly. This error code
|
||||
* is seen only by the kernel.
|
||||
*/
|
||||
|
||||
#define KERN_INVALID_PROCESSOR_SET 26
|
||||
/* An argument applied to assert processor set privilege
|
||||
* was not a processor set control port.
|
||||
*/
|
||||
|
||||
#define KERN_POLICY_LIMIT 27
|
||||
/* The specified scheduling attributes exceed the thread's
|
||||
* limits.
|
||||
*/
|
||||
|
||||
#define KERN_INVALID_POLICY 28
|
||||
/* The specified scheduling policy is not currently
|
||||
* enabled for the processor set.
|
||||
*/
|
||||
|
||||
#define KERN_INVALID_OBJECT 29
|
||||
/* The external memory manager failed to initialize the
|
||||
* memory object.
|
||||
*/
|
||||
|
||||
#define KERN_ALREADY_WAITING 30
|
||||
/* A thread is attempting to wait for an event for which
|
||||
* there is already a waiting thread.
|
||||
*/
|
||||
|
||||
#define KERN_DEFAULT_SET 31
|
||||
/* An attempt was made to destroy the default processor
|
||||
* set.
|
||||
*/
|
||||
|
||||
#define KERN_EXCEPTION_PROTECTED 32
|
||||
/* An attempt was made to fetch an exception port that is
|
||||
* protected, or to abort a thread while processing a
|
||||
* protected exception.
|
||||
*/
|
||||
|
||||
#define KERN_INVALID_LEDGER 33
|
||||
/* A ledger was required but not supplied.
|
||||
*/
|
||||
|
||||
#define KERN_INVALID_MEMORY_CONTROL 34
|
||||
/* The port was not a memory cache control port.
|
||||
*/
|
||||
|
||||
#define KERN_INVALID_SECURITY 35
|
||||
/* An argument supplied to assert security privilege
|
||||
* was not a host security port.
|
||||
*/
|
||||
|
||||
#define KERN_NOT_DEPRESSED 36
|
||||
/* thread_depress_abort was called on a thread which
|
||||
* was not currently depressed.
|
||||
*/
|
||||
|
||||
#define KERN_TERMINATED 37
|
||||
/* Object has been terminated and is no longer available
|
||||
*/
|
||||
|
||||
#define KERN_LOCK_SET_DESTROYED 38
|
||||
/* Lock set has been destroyed and is no longer available.
|
||||
*/
|
||||
|
||||
#define KERN_LOCK_UNSTABLE 39
|
||||
/* The thread holding the lock terminated before releasing
|
||||
* the lock
|
||||
*/
|
||||
|
||||
#define KERN_LOCK_OWNED 40
|
||||
/* The lock is already owned by another thread
|
||||
*/
|
||||
|
||||
#define KERN_LOCK_OWNED_SELF 41
|
||||
/* The lock is already owned by the calling thread
|
||||
*/
|
||||
|
||||
#define KERN_SEMAPHORE_DESTROYED 42
|
||||
/* Semaphore has been destroyed and is no longer available.
|
||||
*/
|
||||
|
||||
#define KERN_RPC_SERVER_TERMINATED 43
|
||||
/* Return from RPC indicating the target server was
|
||||
* terminated before it successfully replied
|
||||
*/
|
||||
|
||||
#define KERN_RPC_TERMINATE_ORPHAN 44
|
||||
/* Terminate an orphaned activation.
|
||||
*/
|
||||
|
||||
#define KERN_RPC_CONTINUE_ORPHAN 45
|
||||
/* Allow an orphaned activation to continue executing.
|
||||
*/
|
||||
|
||||
#define KERN_NOT_SUPPORTED 46
|
||||
/* Empty thread activation (No thread linked to it)
|
||||
*/
|
||||
|
||||
#define KERN_NODE_DOWN 47
|
||||
/* Remote node down or inaccessible.
|
||||
*/
|
||||
|
||||
#define KERN_NOT_WAITING 48
|
||||
/* A signalled thread was not actually waiting. */
|
||||
|
||||
#define KERN_OPERATION_TIMED_OUT 49
|
||||
/* Some thread-oriented operation (semaphore_wait) timed out
|
||||
*/
|
||||
|
||||
#define KERN_CODESIGN_ERROR 50
|
||||
/* During a page fault, indicates that the page was rejected
|
||||
* as a result of a signature check.
|
||||
*/
|
||||
|
||||
#define KERN_POLICY_STATIC 51
|
||||
/* The requested property cannot be changed at this time.
|
||||
*/
|
||||
|
||||
#define KERN_INSUFFICIENT_BUFFER_SIZE 52
|
||||
/* The provided buffer is of insufficient size for the requested data.
|
||||
*/
|
||||
|
||||
#define KERN_DENIED 53
|
||||
/* Denied by security policy
|
||||
*/
|
||||
|
||||
#define KERN_RETURN_MAX 0x100
|
||||
/* Maximum return value allowable
|
||||
*/
|
||||
|
||||
#endif /* _MACH_KERN_RETURN_H_ */
|
||||
1808
lib/libc/include/aarch64-macos-gnu/mach/mach_port.h
Normal file
1808
lib/libc/include/aarch64-macos-gnu/mach/mach_port.h
Normal file
File diff suppressed because it is too large
Load Diff
297
lib/libc/include/aarch64-macos-gnu/mach/mach_traps.h
Normal file
297
lib/libc/include/aarch64-macos-gnu/mach/mach_traps.h
Normal file
@ -0,0 +1,297 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2019 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/*
|
||||
* @OSF_COPYRIGHT@
|
||||
*/
|
||||
/*
|
||||
* Mach Operating System
|
||||
* Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission to use, copy, modify and distribute this software and its
|
||||
* documentation is hereby granted, provided that both the copyright
|
||||
* notice and this permission notice appear in all copies of the
|
||||
* software, derivative works or modified versions, and any portions
|
||||
* thereof, and that both notices appear in supporting documentation.
|
||||
*
|
||||
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
||||
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
|
||||
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
||||
*
|
||||
* Carnegie Mellon requests users of this software to return to
|
||||
*
|
||||
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
||||
* School of Computer Science
|
||||
* Carnegie Mellon University
|
||||
* Pittsburgh PA 15213-3890
|
||||
*
|
||||
* any improvements or extensions that they make and grant Carnegie Mellon
|
||||
* the rights to redistribute these changes.
|
||||
*/
|
||||
/*
|
||||
*/
|
||||
/*
|
||||
* Definitions of general Mach system traps.
|
||||
*
|
||||
* These are the definitions as seen from user-space.
|
||||
* The kernel definitions are in <mach/syscall_sw.h>.
|
||||
* Kernel RPC functions are defined in <mach/mach_interface.h>.
|
||||
*/
|
||||
|
||||
#ifndef _MACH_MACH_TRAPS_H_
|
||||
#define _MACH_MACH_TRAPS_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <mach/std_types.h>
|
||||
#include <mach/mach_types.h>
|
||||
#include <mach/kern_return.h>
|
||||
#include <mach/port.h>
|
||||
#include <mach/vm_types.h>
|
||||
#include <mach/clock_types.h>
|
||||
|
||||
#include <machine/endian.h>
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
|
||||
|
||||
extern kern_return_t clock_sleep_trap(
|
||||
mach_port_name_t clock_name,
|
||||
sleep_type_t sleep_type,
|
||||
int sleep_sec,
|
||||
int sleep_nsec,
|
||||
mach_timespec_t *wakeup_time);
|
||||
|
||||
extern kern_return_t _kernelrpc_mach_vm_allocate_trap(
|
||||
mach_port_name_t target,
|
||||
mach_vm_offset_t *addr,
|
||||
mach_vm_size_t size,
|
||||
int flags);
|
||||
|
||||
extern kern_return_t _kernelrpc_mach_vm_deallocate_trap(
|
||||
mach_port_name_t target,
|
||||
mach_vm_address_t address,
|
||||
mach_vm_size_t size
|
||||
);
|
||||
|
||||
extern kern_return_t _kernelrpc_mach_vm_protect_trap(
|
||||
mach_port_name_t target,
|
||||
mach_vm_address_t address,
|
||||
mach_vm_size_t size,
|
||||
boolean_t set_maximum,
|
||||
vm_prot_t new_protection
|
||||
);
|
||||
|
||||
extern kern_return_t _kernelrpc_mach_vm_map_trap(
|
||||
mach_port_name_t target,
|
||||
mach_vm_offset_t *address,
|
||||
mach_vm_size_t size,
|
||||
mach_vm_offset_t mask,
|
||||
int flags,
|
||||
vm_prot_t cur_protection
|
||||
);
|
||||
|
||||
extern kern_return_t _kernelrpc_mach_vm_purgable_control_trap(
|
||||
mach_port_name_t target,
|
||||
mach_vm_offset_t address,
|
||||
vm_purgable_t control,
|
||||
int *state);
|
||||
|
||||
extern kern_return_t _kernelrpc_mach_port_allocate_trap(
|
||||
mach_port_name_t target,
|
||||
mach_port_right_t right,
|
||||
mach_port_name_t *name
|
||||
);
|
||||
|
||||
extern kern_return_t _kernelrpc_mach_port_deallocate_trap(
|
||||
mach_port_name_t target,
|
||||
mach_port_name_t name
|
||||
);
|
||||
|
||||
extern kern_return_t _kernelrpc_mach_port_mod_refs_trap(
|
||||
mach_port_name_t target,
|
||||
mach_port_name_t name,
|
||||
mach_port_right_t right,
|
||||
mach_port_delta_t delta
|
||||
);
|
||||
|
||||
extern kern_return_t _kernelrpc_mach_port_move_member_trap(
|
||||
mach_port_name_t target,
|
||||
mach_port_name_t member,
|
||||
mach_port_name_t after
|
||||
);
|
||||
|
||||
extern kern_return_t _kernelrpc_mach_port_insert_right_trap(
|
||||
mach_port_name_t target,
|
||||
mach_port_name_t name,
|
||||
mach_port_name_t poly,
|
||||
mach_msg_type_name_t polyPoly
|
||||
);
|
||||
|
||||
extern kern_return_t _kernelrpc_mach_port_get_attributes_trap(
|
||||
mach_port_name_t target,
|
||||
mach_port_name_t name,
|
||||
mach_port_flavor_t flavor,
|
||||
mach_port_info_t port_info_out,
|
||||
mach_msg_type_number_t *port_info_outCnt
|
||||
);
|
||||
|
||||
extern kern_return_t _kernelrpc_mach_port_insert_member_trap(
|
||||
mach_port_name_t target,
|
||||
mach_port_name_t name,
|
||||
mach_port_name_t pset
|
||||
);
|
||||
|
||||
extern kern_return_t _kernelrpc_mach_port_extract_member_trap(
|
||||
mach_port_name_t target,
|
||||
mach_port_name_t name,
|
||||
mach_port_name_t pset
|
||||
);
|
||||
|
||||
extern kern_return_t _kernelrpc_mach_port_construct_trap(
|
||||
mach_port_name_t target,
|
||||
mach_port_options_t *options,
|
||||
uint64_t context,
|
||||
mach_port_name_t *name
|
||||
);
|
||||
|
||||
extern kern_return_t _kernelrpc_mach_port_destruct_trap(
|
||||
mach_port_name_t target,
|
||||
mach_port_name_t name,
|
||||
mach_port_delta_t srdelta,
|
||||
uint64_t guard
|
||||
);
|
||||
|
||||
extern kern_return_t _kernelrpc_mach_port_guard_trap(
|
||||
mach_port_name_t target,
|
||||
mach_port_name_t name,
|
||||
uint64_t guard,
|
||||
boolean_t strict
|
||||
);
|
||||
|
||||
extern kern_return_t _kernelrpc_mach_port_unguard_trap(
|
||||
mach_port_name_t target,
|
||||
mach_port_name_t name,
|
||||
uint64_t guard
|
||||
);
|
||||
|
||||
extern kern_return_t mach_generate_activity_id(
|
||||
mach_port_name_t target,
|
||||
int count,
|
||||
uint64_t *activity_id
|
||||
);
|
||||
|
||||
extern kern_return_t macx_swapon(
|
||||
uint64_t filename,
|
||||
int flags,
|
||||
int size,
|
||||
int priority);
|
||||
|
||||
extern kern_return_t macx_swapoff(
|
||||
uint64_t filename,
|
||||
int flags);
|
||||
|
||||
extern kern_return_t macx_triggers(
|
||||
int hi_water,
|
||||
int low_water,
|
||||
int flags,
|
||||
mach_port_t alert_port);
|
||||
|
||||
extern kern_return_t macx_backing_store_suspend(
|
||||
boolean_t suspend);
|
||||
|
||||
extern kern_return_t macx_backing_store_recovery(
|
||||
int pid);
|
||||
|
||||
extern boolean_t swtch_pri(int pri);
|
||||
|
||||
extern boolean_t swtch(void);
|
||||
|
||||
extern kern_return_t thread_switch(
|
||||
mach_port_name_t thread_name,
|
||||
int option,
|
||||
mach_msg_timeout_t option_time);
|
||||
|
||||
extern mach_port_name_t task_self_trap(void);
|
||||
|
||||
extern kern_return_t host_create_mach_voucher_trap(
|
||||
mach_port_name_t host,
|
||||
mach_voucher_attr_raw_recipe_array_t recipes,
|
||||
int recipes_size,
|
||||
mach_port_name_t *voucher);
|
||||
|
||||
extern kern_return_t mach_voucher_extract_attr_recipe_trap(
|
||||
mach_port_name_t voucher_name,
|
||||
mach_voucher_attr_key_t key,
|
||||
mach_voucher_attr_raw_recipe_t recipe,
|
||||
mach_msg_type_number_t *recipe_size);
|
||||
|
||||
extern kern_return_t _kernelrpc_mach_port_type_trap(
|
||||
ipc_space_t task,
|
||||
mach_port_name_t name,
|
||||
mach_port_type_t *ptype);
|
||||
|
||||
extern kern_return_t _kernelrpc_mach_port_request_notification_trap(
|
||||
ipc_space_t task,
|
||||
mach_port_name_t name,
|
||||
mach_msg_id_t msgid,
|
||||
mach_port_mscount_t sync,
|
||||
mach_port_name_t notify,
|
||||
mach_msg_type_name_t notifyPoly,
|
||||
mach_port_name_t *previous);
|
||||
|
||||
/*
|
||||
* Obsolete interfaces.
|
||||
*/
|
||||
|
||||
extern kern_return_t task_for_pid(
|
||||
mach_port_name_t target_tport,
|
||||
int pid,
|
||||
mach_port_name_t *t);
|
||||
|
||||
extern kern_return_t task_name_for_pid(
|
||||
mach_port_name_t target_tport,
|
||||
int pid,
|
||||
mach_port_name_t *tn);
|
||||
|
||||
extern kern_return_t pid_for_task(
|
||||
mach_port_name_t t,
|
||||
int *x);
|
||||
|
||||
extern kern_return_t debug_control_port_for_pid(
|
||||
mach_port_name_t target_tport,
|
||||
int pid,
|
||||
mach_port_name_t *t);
|
||||
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _MACH_MACH_TRAPS_H_ */
|
||||
283
lib/libc/include/aarch64-macos-gnu/mach/mach_types.h
Normal file
283
lib/libc/include/aarch64-macos-gnu/mach/mach_types.h
Normal file
@ -0,0 +1,283 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2018 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/*
|
||||
* @OSF_COPYRIGHT@
|
||||
*/
|
||||
/*
|
||||
* Mach Operating System
|
||||
* Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission to use, copy, modify and distribute this software and its
|
||||
* documentation is hereby granted, provided that both the copyright
|
||||
* notice and this permission notice appear in all copies of the
|
||||
* software, derivative works or modified versions, and any portions
|
||||
* thereof, and that both notices appear in supporting documentation.
|
||||
*
|
||||
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
||||
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
|
||||
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
||||
*
|
||||
* Carnegie Mellon requests users of this software to return to
|
||||
*
|
||||
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
||||
* School of Computer Science
|
||||
* Carnegie Mellon University
|
||||
* Pittsburgh PA 15213-3890
|
||||
*
|
||||
* any improvements or extensions that they make and grant Carnegie Mellon
|
||||
* the rights to redistribute these changes.
|
||||
*/
|
||||
/*
|
||||
*/
|
||||
/*
|
||||
* NOTICE: This file was modified by SPARTA, Inc. in 2005 to introduce
|
||||
* support for mandatory and extensible security protections. This notice
|
||||
* is included in support of clause 2.2 (b) of the Apple Public License,
|
||||
* Version 2.0.
|
||||
*/
|
||||
/*
|
||||
* File: mach/mach_types.h
|
||||
* Author: Avadis Tevanian, Jr., Michael Wayne Young
|
||||
* Date: 1986
|
||||
*
|
||||
* Mach external interface definitions.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _MACH_MACH_TYPES_H_
|
||||
#define _MACH_MACH_TYPES_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#include <mach/host_info.h>
|
||||
#include <mach/host_notify.h>
|
||||
#include <mach/host_special_ports.h>
|
||||
#include <mach/machine.h>
|
||||
#include <mach/machine/vm_types.h>
|
||||
#include <mach/memory_object_types.h>
|
||||
#include <mach/message.h>
|
||||
#include <mach/exception_types.h>
|
||||
#include <mach/port.h>
|
||||
#include <mach/mach_voucher_types.h>
|
||||
#include <mach/processor_info.h>
|
||||
#include <mach/task_info.h>
|
||||
#include <mach/task_inspect.h>
|
||||
#include <mach/task_policy.h>
|
||||
#include <mach/task_special_ports.h>
|
||||
#include <mach/thread_info.h>
|
||||
#include <mach/thread_policy.h>
|
||||
#include <mach/thread_special_ports.h>
|
||||
#include <mach/thread_status.h>
|
||||
#include <mach/time_value.h>
|
||||
#include <mach/clock_types.h>
|
||||
#include <mach/vm_attributes.h>
|
||||
#include <mach/vm_inherit.h>
|
||||
#include <mach/vm_purgable.h>
|
||||
#include <mach/vm_behavior.h>
|
||||
#include <mach/vm_prot.h>
|
||||
#include <mach/vm_statistics.h>
|
||||
#include <mach/vm_sync.h>
|
||||
#include <mach/vm_types.h>
|
||||
#include <mach/vm_region.h>
|
||||
#include <mach/kmod.h>
|
||||
#include <mach/dyld_kernel.h>
|
||||
|
||||
|
||||
/*
|
||||
* If we are not in the kernel, then these will all be represented by
|
||||
* ports at user-space.
|
||||
*/
|
||||
typedef mach_port_t task_t;
|
||||
typedef mach_port_t task_name_t;
|
||||
typedef mach_port_t task_policy_set_t;
|
||||
typedef mach_port_t task_policy_get_t;
|
||||
typedef mach_port_t task_inspect_t;
|
||||
typedef mach_port_t task_read_t;
|
||||
typedef mach_port_t task_suspension_token_t;
|
||||
typedef mach_port_t thread_t;
|
||||
typedef mach_port_t thread_act_t;
|
||||
typedef mach_port_t thread_inspect_t;
|
||||
typedef mach_port_t thread_read_t;
|
||||
typedef mach_port_t ipc_space_t;
|
||||
typedef mach_port_t ipc_space_read_t;
|
||||
typedef mach_port_t ipc_space_inspect_t;
|
||||
typedef mach_port_t coalition_t;
|
||||
typedef mach_port_t host_t;
|
||||
typedef mach_port_t host_priv_t;
|
||||
typedef mach_port_t host_security_t;
|
||||
typedef mach_port_t processor_t;
|
||||
typedef mach_port_t processor_set_t;
|
||||
typedef mach_port_t processor_set_control_t;
|
||||
typedef mach_port_t semaphore_t;
|
||||
typedef mach_port_t lock_set_t;
|
||||
typedef mach_port_t ledger_t;
|
||||
typedef mach_port_t alarm_t;
|
||||
typedef mach_port_t clock_serv_t;
|
||||
typedef mach_port_t clock_ctrl_t;
|
||||
typedef mach_port_t arcade_register_t;
|
||||
typedef mach_port_t ipc_eventlink_t;
|
||||
typedef mach_port_t eventlink_port_pair_t[2];
|
||||
typedef mach_port_t suid_cred_t;
|
||||
|
||||
|
||||
/*
|
||||
* These aren't really unique types. They are just called
|
||||
* out as unique types at one point in history. So we list
|
||||
* them here for compatibility.
|
||||
*/
|
||||
typedef processor_set_t processor_set_name_t;
|
||||
|
||||
/*
|
||||
* These types are just hard-coded as ports
|
||||
*/
|
||||
typedef mach_port_t clock_reply_t;
|
||||
typedef mach_port_t bootstrap_t;
|
||||
typedef mach_port_t mem_entry_name_port_t;
|
||||
typedef mach_port_t exception_handler_t;
|
||||
typedef exception_handler_t *exception_handler_array_t;
|
||||
typedef mach_port_t vm_task_entry_t;
|
||||
typedef mach_port_t io_master_t;
|
||||
typedef mach_port_t UNDServerRef;
|
||||
typedef mach_port_t mach_eventlink_t;
|
||||
|
||||
/*
|
||||
* Mig doesn't translate the components of an array.
|
||||
* For example, Mig won't use the thread_t translations
|
||||
* to translate a thread_array_t argument. So, these definitions
|
||||
* are not completely accurate at the moment for other kernel
|
||||
* components.
|
||||
*/
|
||||
typedef task_t *task_array_t;
|
||||
typedef thread_t *thread_array_t;
|
||||
typedef processor_set_t *processor_set_array_t;
|
||||
typedef processor_set_t *processor_set_name_array_t;
|
||||
typedef processor_t *processor_array_t;
|
||||
typedef thread_act_t *thread_act_array_t;
|
||||
typedef ledger_t *ledger_array_t;
|
||||
|
||||
/*
|
||||
* However the real mach_types got declared, we also have to declare
|
||||
* types with "port" in the name for compatability with the way OSF
|
||||
* had declared the user interfaces at one point. Someday these should
|
||||
* go away.
|
||||
*/
|
||||
typedef task_t task_port_t;
|
||||
typedef task_array_t task_port_array_t;
|
||||
typedef thread_t thread_port_t;
|
||||
typedef thread_array_t thread_port_array_t;
|
||||
typedef ipc_space_t ipc_space_port_t;
|
||||
typedef host_t host_name_t;
|
||||
typedef host_t host_name_port_t;
|
||||
typedef processor_set_t processor_set_port_t;
|
||||
typedef processor_set_t processor_set_name_port_t;
|
||||
typedef processor_set_array_t processor_set_name_port_array_t;
|
||||
typedef processor_set_t processor_set_control_port_t;
|
||||
typedef processor_t processor_port_t;
|
||||
typedef processor_array_t processor_port_array_t;
|
||||
typedef thread_act_t thread_act_port_t;
|
||||
typedef thread_act_array_t thread_act_port_array_t;
|
||||
typedef semaphore_t semaphore_port_t;
|
||||
typedef lock_set_t lock_set_port_t;
|
||||
typedef ledger_t ledger_port_t;
|
||||
typedef ledger_array_t ledger_port_array_t;
|
||||
typedef alarm_t alarm_port_t;
|
||||
typedef clock_serv_t clock_serv_port_t;
|
||||
typedef clock_ctrl_t clock_ctrl_port_t;
|
||||
typedef exception_handler_t exception_port_t;
|
||||
typedef exception_handler_array_t exception_port_arrary_t;
|
||||
typedef char vfs_path_t[4096];
|
||||
typedef char nspace_path_t[1024]; /* 1024 == PATH_MAX */
|
||||
typedef char suid_cred_path_t[1024];
|
||||
typedef uint32_t suid_cred_uid_t;
|
||||
|
||||
#define TASK_NULL ((task_t) 0)
|
||||
#define TASK_NAME_NULL ((task_name_t) 0)
|
||||
#define TASK_INSPECT_NULL ((task_inspect_t) 0)
|
||||
#define TASK_READ_NULL ((task_read_t) 0)
|
||||
#define THREAD_NULL ((thread_t) 0)
|
||||
#define THREAD_INSPECT_NULL ((thread_inspect_t) 0)
|
||||
#define THREAD_READ_NULL ((thread_read_t) 0)
|
||||
#define TID_NULL ((uint64_t) 0)
|
||||
#define THR_ACT_NULL ((thread_act_t) 0)
|
||||
#define IPC_SPACE_NULL ((ipc_space_t) 0)
|
||||
#define IPC_SPACE_READ_NULL ((ipc_space_read_t) 0)
|
||||
#define IPC_SPACE_INSPECT_NULL ((ipc_space_inspect_t) 0)
|
||||
#define COALITION_NULL ((coalition_t) 0)
|
||||
#define HOST_NULL ((host_t) 0)
|
||||
#define HOST_PRIV_NULL ((host_priv_t) 0)
|
||||
#define HOST_SECURITY_NULL ((host_security_t) 0)
|
||||
#define PROCESSOR_SET_NULL ((processor_set_t) 0)
|
||||
#define PROCESSOR_NULL ((processor_t) 0)
|
||||
#define SEMAPHORE_NULL ((semaphore_t) 0)
|
||||
#define LOCK_SET_NULL ((lock_set_t) 0)
|
||||
#define LEDGER_NULL ((ledger_t) 0)
|
||||
#define ALARM_NULL ((alarm_t) 0)
|
||||
#define CLOCK_NULL ((clock_t) 0)
|
||||
#define UND_SERVER_NULL ((UNDServerRef) 0)
|
||||
#define ARCADE_REG_NULL ((arcade_register_t) 0)
|
||||
#define MACH_EVENTLINK_NULL ((mach_eventlink_t) 0)
|
||||
#define IPC_EVENTLINK_NULL ((ipc_eventlink_t) 0)
|
||||
#define SUID_CRED_NULL ((suid_cred_t) 0)
|
||||
|
||||
/* capability strictly _DECREASING_.
|
||||
* not ordered the other way around because we want TASK_FLAVOR_CONTROL
|
||||
* to be closest to the itk_lock. see task.h.
|
||||
*/
|
||||
typedef unsigned int mach_task_flavor_t;
|
||||
#define TASK_FLAVOR_CONTROL 0 /* a task_t */
|
||||
#define TASK_FLAVOR_READ 1 /* a task_read_t */
|
||||
#define TASK_FLAVOR_INSPECT 2 /* a task_inspect_t */
|
||||
#define TASK_FLAVOR_NAME 3 /* a task_name_t */
|
||||
|
||||
/* capability strictly _DECREASING_ */
|
||||
typedef unsigned int mach_thread_flavor_t;
|
||||
#define THREAD_FLAVOR_CONTROL 0 /* a thread_t */
|
||||
#define THREAD_FLAVOR_READ 1 /* a thread_read_t */
|
||||
#define THREAD_FLAVOR_INSPECT 2 /* a thread_inspect_t */
|
||||
|
||||
/* DEPRECATED */
|
||||
typedef natural_t ledger_item_t;
|
||||
#define LEDGER_ITEM_INFINITY ((ledger_item_t) (~0))
|
||||
|
||||
typedef int64_t ledger_amount_t;
|
||||
#define LEDGER_LIMIT_INFINITY ((ledger_amount_t)((1ULL << 63) - 1))
|
||||
|
||||
typedef mach_vm_offset_t *emulation_vector_t;
|
||||
typedef char *user_subsystem_t;
|
||||
|
||||
typedef char *labelstr_t;
|
||||
/*
|
||||
* Backwards compatibility, for those programs written
|
||||
* before mach/{std,mach}_types.{defs,h} were set up.
|
||||
*/
|
||||
#include <mach/std_types.h>
|
||||
|
||||
#endif /* _MACH_MACH_TYPES_H_ */
|
||||
411
lib/libc/include/aarch64-macos-gnu/mach/machine.h
Normal file
411
lib/libc/include/aarch64-macos-gnu/mach/machine.h
Normal file
@ -0,0 +1,411 @@
|
||||
/*
|
||||
* Copyright (c) 2007-2016 Apple, Inc. All rights reserved.
|
||||
* Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/*
|
||||
* Mach Operating System
|
||||
* Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission to use, copy, modify and distribute this software and its
|
||||
* documentation is hereby granted, provided that both the copyright
|
||||
* notice and this permission notice appear in all copies of the
|
||||
* software, derivative works or modified versions, and any portions
|
||||
* thereof, and that both notices appear in supporting documentation.
|
||||
*
|
||||
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
||||
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
|
||||
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
||||
*
|
||||
* Carnegie Mellon requests users of this software to return to
|
||||
*
|
||||
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
||||
* School of Computer Science
|
||||
* Carnegie Mellon University
|
||||
* Pittsburgh PA 15213-3890
|
||||
*
|
||||
* any improvements or extensions that they make and grant Carnegie Mellon
|
||||
* the rights to redistribute these changes.
|
||||
*/
|
||||
/* File: machine.h
|
||||
* Author: Avadis Tevanian, Jr.
|
||||
* Date: 1986
|
||||
*
|
||||
* Machine independent machine abstraction.
|
||||
*/
|
||||
|
||||
#ifndef _MACH_MACHINE_H_
|
||||
#define _MACH_MACHINE_H_
|
||||
|
||||
#ifndef __ASSEMBLER__
|
||||
|
||||
#include <stdint.h>
|
||||
#include <mach/machine/vm_types.h>
|
||||
#include <mach/boolean.h>
|
||||
|
||||
typedef integer_t cpu_type_t;
|
||||
typedef integer_t cpu_subtype_t;
|
||||
typedef integer_t cpu_threadtype_t;
|
||||
|
||||
#define CPU_STATE_MAX 4
|
||||
|
||||
#define CPU_STATE_USER 0
|
||||
#define CPU_STATE_SYSTEM 1
|
||||
#define CPU_STATE_IDLE 2
|
||||
#define CPU_STATE_NICE 3
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Capability bits used in the definition of cpu_type.
|
||||
*/
|
||||
#define CPU_ARCH_MASK 0xff000000 /* mask for architecture bits */
|
||||
#define CPU_ARCH_ABI64 0x01000000 /* 64 bit ABI */
|
||||
#define CPU_ARCH_ABI64_32 0x02000000 /* ABI for 64-bit hardware with 32-bit types; LP32 */
|
||||
|
||||
/*
|
||||
* Machine types known by all.
|
||||
*/
|
||||
|
||||
#define CPU_TYPE_ANY ((cpu_type_t) -1)
|
||||
|
||||
#define CPU_TYPE_VAX ((cpu_type_t) 1)
|
||||
/* skip ((cpu_type_t) 2) */
|
||||
/* skip ((cpu_type_t) 3) */
|
||||
/* skip ((cpu_type_t) 4) */
|
||||
/* skip ((cpu_type_t) 5) */
|
||||
#define CPU_TYPE_MC680x0 ((cpu_type_t) 6)
|
||||
#define CPU_TYPE_X86 ((cpu_type_t) 7)
|
||||
#define CPU_TYPE_I386 CPU_TYPE_X86 /* compatibility */
|
||||
#define CPU_TYPE_X86_64 (CPU_TYPE_X86 | CPU_ARCH_ABI64)
|
||||
|
||||
/* skip CPU_TYPE_MIPS ((cpu_type_t) 8) */
|
||||
/* skip ((cpu_type_t) 9) */
|
||||
#define CPU_TYPE_MC98000 ((cpu_type_t) 10)
|
||||
#define CPU_TYPE_HPPA ((cpu_type_t) 11)
|
||||
#define CPU_TYPE_ARM ((cpu_type_t) 12)
|
||||
#define CPU_TYPE_ARM64 (CPU_TYPE_ARM | CPU_ARCH_ABI64)
|
||||
#define CPU_TYPE_ARM64_32 (CPU_TYPE_ARM | CPU_ARCH_ABI64_32)
|
||||
#define CPU_TYPE_MC88000 ((cpu_type_t) 13)
|
||||
#define CPU_TYPE_SPARC ((cpu_type_t) 14)
|
||||
#define CPU_TYPE_I860 ((cpu_type_t) 15)
|
||||
/* skip CPU_TYPE_ALPHA ((cpu_type_t) 16) */
|
||||
/* skip ((cpu_type_t) 17) */
|
||||
#define CPU_TYPE_POWERPC ((cpu_type_t) 18)
|
||||
#define CPU_TYPE_POWERPC64 (CPU_TYPE_POWERPC | CPU_ARCH_ABI64)
|
||||
/* skip ((cpu_type_t) 19) */
|
||||
/* skip ((cpu_type_t) 20 */
|
||||
/* skip ((cpu_type_t) 21 */
|
||||
/* skip ((cpu_type_t) 22 */
|
||||
|
||||
/*
|
||||
* Machine subtypes (these are defined here, instead of in a machine
|
||||
* dependent directory, so that any program can get all definitions
|
||||
* regardless of where is it compiled).
|
||||
*/
|
||||
|
||||
/*
|
||||
* Capability bits used in the definition of cpu_subtype.
|
||||
*/
|
||||
#define CPU_SUBTYPE_MASK 0xff000000 /* mask for feature flags */
|
||||
#define CPU_SUBTYPE_LIB64 0x80000000 /* 64 bit libraries */
|
||||
#define CPU_SUBTYPE_PTRAUTH_ABI 0x80000000 /* pointer authentication with versioned ABI */
|
||||
|
||||
/*
|
||||
* When selecting a slice, ANY will pick the slice with the best
|
||||
* grading for the selected cpu_type_t, unlike the "ALL" subtypes,
|
||||
* which are the slices that can run on any hardware for that cpu type.
|
||||
*/
|
||||
#define CPU_SUBTYPE_ANY ((cpu_subtype_t) -1)
|
||||
|
||||
/*
|
||||
* Object files that are hand-crafted to run on any
|
||||
* implementation of an architecture are tagged with
|
||||
* CPU_SUBTYPE_MULTIPLE. This functions essentially the same as
|
||||
* the "ALL" subtype of an architecture except that it allows us
|
||||
* to easily find object files that may need to be modified
|
||||
* whenever a new implementation of an architecture comes out.
|
||||
*
|
||||
* It is the responsibility of the implementor to make sure the
|
||||
* software handles unsupported implementations elegantly.
|
||||
*/
|
||||
#define CPU_SUBTYPE_MULTIPLE ((cpu_subtype_t) -1)
|
||||
#define CPU_SUBTYPE_LITTLE_ENDIAN ((cpu_subtype_t) 0)
|
||||
#define CPU_SUBTYPE_BIG_ENDIAN ((cpu_subtype_t) 1)
|
||||
|
||||
/*
|
||||
* Machine threadtypes.
|
||||
* This is none - not defined - for most machine types/subtypes.
|
||||
*/
|
||||
#define CPU_THREADTYPE_NONE ((cpu_threadtype_t) 0)
|
||||
|
||||
/*
|
||||
* VAX subtypes (these do *not* necessary conform to the actual cpu
|
||||
* ID assigned by DEC available via the SID register).
|
||||
*/
|
||||
|
||||
#define CPU_SUBTYPE_VAX_ALL ((cpu_subtype_t) 0)
|
||||
#define CPU_SUBTYPE_VAX780 ((cpu_subtype_t) 1)
|
||||
#define CPU_SUBTYPE_VAX785 ((cpu_subtype_t) 2)
|
||||
#define CPU_SUBTYPE_VAX750 ((cpu_subtype_t) 3)
|
||||
#define CPU_SUBTYPE_VAX730 ((cpu_subtype_t) 4)
|
||||
#define CPU_SUBTYPE_UVAXI ((cpu_subtype_t) 5)
|
||||
#define CPU_SUBTYPE_UVAXII ((cpu_subtype_t) 6)
|
||||
#define CPU_SUBTYPE_VAX8200 ((cpu_subtype_t) 7)
|
||||
#define CPU_SUBTYPE_VAX8500 ((cpu_subtype_t) 8)
|
||||
#define CPU_SUBTYPE_VAX8600 ((cpu_subtype_t) 9)
|
||||
#define CPU_SUBTYPE_VAX8650 ((cpu_subtype_t) 10)
|
||||
#define CPU_SUBTYPE_VAX8800 ((cpu_subtype_t) 11)
|
||||
#define CPU_SUBTYPE_UVAXIII ((cpu_subtype_t) 12)
|
||||
|
||||
/*
|
||||
* 680x0 subtypes
|
||||
*
|
||||
* The subtype definitions here are unusual for historical reasons.
|
||||
* NeXT used to consider 68030 code as generic 68000 code. For
|
||||
* backwards compatability:
|
||||
*
|
||||
* CPU_SUBTYPE_MC68030 symbol has been preserved for source code
|
||||
* compatability.
|
||||
*
|
||||
* CPU_SUBTYPE_MC680x0_ALL has been defined to be the same
|
||||
* subtype as CPU_SUBTYPE_MC68030 for binary comatability.
|
||||
*
|
||||
* CPU_SUBTYPE_MC68030_ONLY has been added to allow new object
|
||||
* files to be tagged as containing 68030-specific instructions.
|
||||
*/
|
||||
|
||||
#define CPU_SUBTYPE_MC680x0_ALL ((cpu_subtype_t) 1)
|
||||
#define CPU_SUBTYPE_MC68030 ((cpu_subtype_t) 1) /* compat */
|
||||
#define CPU_SUBTYPE_MC68040 ((cpu_subtype_t) 2)
|
||||
#define CPU_SUBTYPE_MC68030_ONLY ((cpu_subtype_t) 3)
|
||||
|
||||
/*
|
||||
* I386 subtypes
|
||||
*/
|
||||
|
||||
#define CPU_SUBTYPE_INTEL(f, m) ((cpu_subtype_t) (f) + ((m) << 4))
|
||||
|
||||
#define CPU_SUBTYPE_I386_ALL CPU_SUBTYPE_INTEL(3, 0)
|
||||
#define CPU_SUBTYPE_386 CPU_SUBTYPE_INTEL(3, 0)
|
||||
#define CPU_SUBTYPE_486 CPU_SUBTYPE_INTEL(4, 0)
|
||||
#define CPU_SUBTYPE_486SX CPU_SUBTYPE_INTEL(4, 8) // 8 << 4 = 128
|
||||
#define CPU_SUBTYPE_586 CPU_SUBTYPE_INTEL(5, 0)
|
||||
#define CPU_SUBTYPE_PENT CPU_SUBTYPE_INTEL(5, 0)
|
||||
#define CPU_SUBTYPE_PENTPRO CPU_SUBTYPE_INTEL(6, 1)
|
||||
#define CPU_SUBTYPE_PENTII_M3 CPU_SUBTYPE_INTEL(6, 3)
|
||||
#define CPU_SUBTYPE_PENTII_M5 CPU_SUBTYPE_INTEL(6, 5)
|
||||
#define CPU_SUBTYPE_CELERON CPU_SUBTYPE_INTEL(7, 6)
|
||||
#define CPU_SUBTYPE_CELERON_MOBILE CPU_SUBTYPE_INTEL(7, 7)
|
||||
#define CPU_SUBTYPE_PENTIUM_3 CPU_SUBTYPE_INTEL(8, 0)
|
||||
#define CPU_SUBTYPE_PENTIUM_3_M CPU_SUBTYPE_INTEL(8, 1)
|
||||
#define CPU_SUBTYPE_PENTIUM_3_XEON CPU_SUBTYPE_INTEL(8, 2)
|
||||
#define CPU_SUBTYPE_PENTIUM_M CPU_SUBTYPE_INTEL(9, 0)
|
||||
#define CPU_SUBTYPE_PENTIUM_4 CPU_SUBTYPE_INTEL(10, 0)
|
||||
#define CPU_SUBTYPE_PENTIUM_4_M CPU_SUBTYPE_INTEL(10, 1)
|
||||
#define CPU_SUBTYPE_ITANIUM CPU_SUBTYPE_INTEL(11, 0)
|
||||
#define CPU_SUBTYPE_ITANIUM_2 CPU_SUBTYPE_INTEL(11, 1)
|
||||
#define CPU_SUBTYPE_XEON CPU_SUBTYPE_INTEL(12, 0)
|
||||
#define CPU_SUBTYPE_XEON_MP CPU_SUBTYPE_INTEL(12, 1)
|
||||
|
||||
#define CPU_SUBTYPE_INTEL_FAMILY(x) ((x) & 15)
|
||||
#define CPU_SUBTYPE_INTEL_FAMILY_MAX 15
|
||||
|
||||
#define CPU_SUBTYPE_INTEL_MODEL(x) ((x) >> 4)
|
||||
#define CPU_SUBTYPE_INTEL_MODEL_ALL 0
|
||||
|
||||
/*
|
||||
* X86 subtypes.
|
||||
*/
|
||||
|
||||
#define CPU_SUBTYPE_X86_ALL ((cpu_subtype_t)3)
|
||||
#define CPU_SUBTYPE_X86_64_ALL ((cpu_subtype_t)3)
|
||||
#define CPU_SUBTYPE_X86_ARCH1 ((cpu_subtype_t)4)
|
||||
#define CPU_SUBTYPE_X86_64_H ((cpu_subtype_t)8) /* Haswell feature subset */
|
||||
|
||||
|
||||
#define CPU_THREADTYPE_INTEL_HTT ((cpu_threadtype_t) 1)
|
||||
|
||||
/*
|
||||
* Mips subtypes.
|
||||
*/
|
||||
|
||||
#define CPU_SUBTYPE_MIPS_ALL ((cpu_subtype_t) 0)
|
||||
#define CPU_SUBTYPE_MIPS_R2300 ((cpu_subtype_t) 1)
|
||||
#define CPU_SUBTYPE_MIPS_R2600 ((cpu_subtype_t) 2)
|
||||
#define CPU_SUBTYPE_MIPS_R2800 ((cpu_subtype_t) 3)
|
||||
#define CPU_SUBTYPE_MIPS_R2000a ((cpu_subtype_t) 4) /* pmax */
|
||||
#define CPU_SUBTYPE_MIPS_R2000 ((cpu_subtype_t) 5)
|
||||
#define CPU_SUBTYPE_MIPS_R3000a ((cpu_subtype_t) 6) /* 3max */
|
||||
#define CPU_SUBTYPE_MIPS_R3000 ((cpu_subtype_t) 7)
|
||||
|
||||
/*
|
||||
* MC98000 (PowerPC) subtypes
|
||||
*/
|
||||
#define CPU_SUBTYPE_MC98000_ALL ((cpu_subtype_t) 0)
|
||||
#define CPU_SUBTYPE_MC98601 ((cpu_subtype_t) 1)
|
||||
|
||||
/*
|
||||
* HPPA subtypes for Hewlett-Packard HP-PA family of
|
||||
* risc processors. Port by NeXT to 700 series.
|
||||
*/
|
||||
|
||||
#define CPU_SUBTYPE_HPPA_ALL ((cpu_subtype_t) 0)
|
||||
#define CPU_SUBTYPE_HPPA_7100 ((cpu_subtype_t) 0) /* compat */
|
||||
#define CPU_SUBTYPE_HPPA_7100LC ((cpu_subtype_t) 1)
|
||||
|
||||
/*
|
||||
* MC88000 subtypes.
|
||||
*/
|
||||
#define CPU_SUBTYPE_MC88000_ALL ((cpu_subtype_t) 0)
|
||||
#define CPU_SUBTYPE_MC88100 ((cpu_subtype_t) 1)
|
||||
#define CPU_SUBTYPE_MC88110 ((cpu_subtype_t) 2)
|
||||
|
||||
/*
|
||||
* SPARC subtypes
|
||||
*/
|
||||
#define CPU_SUBTYPE_SPARC_ALL ((cpu_subtype_t) 0)
|
||||
|
||||
/*
|
||||
* I860 subtypes
|
||||
*/
|
||||
#define CPU_SUBTYPE_I860_ALL ((cpu_subtype_t) 0)
|
||||
#define CPU_SUBTYPE_I860_860 ((cpu_subtype_t) 1)
|
||||
|
||||
/*
|
||||
* PowerPC subtypes
|
||||
*/
|
||||
#define CPU_SUBTYPE_POWERPC_ALL ((cpu_subtype_t) 0)
|
||||
#define CPU_SUBTYPE_POWERPC_601 ((cpu_subtype_t) 1)
|
||||
#define CPU_SUBTYPE_POWERPC_602 ((cpu_subtype_t) 2)
|
||||
#define CPU_SUBTYPE_POWERPC_603 ((cpu_subtype_t) 3)
|
||||
#define CPU_SUBTYPE_POWERPC_603e ((cpu_subtype_t) 4)
|
||||
#define CPU_SUBTYPE_POWERPC_603ev ((cpu_subtype_t) 5)
|
||||
#define CPU_SUBTYPE_POWERPC_604 ((cpu_subtype_t) 6)
|
||||
#define CPU_SUBTYPE_POWERPC_604e ((cpu_subtype_t) 7)
|
||||
#define CPU_SUBTYPE_POWERPC_620 ((cpu_subtype_t) 8)
|
||||
#define CPU_SUBTYPE_POWERPC_750 ((cpu_subtype_t) 9)
|
||||
#define CPU_SUBTYPE_POWERPC_7400 ((cpu_subtype_t) 10)
|
||||
#define CPU_SUBTYPE_POWERPC_7450 ((cpu_subtype_t) 11)
|
||||
#define CPU_SUBTYPE_POWERPC_970 ((cpu_subtype_t) 100)
|
||||
|
||||
/*
|
||||
* ARM subtypes
|
||||
*/
|
||||
#define CPU_SUBTYPE_ARM_ALL ((cpu_subtype_t) 0)
|
||||
#define CPU_SUBTYPE_ARM_V4T ((cpu_subtype_t) 5)
|
||||
#define CPU_SUBTYPE_ARM_V6 ((cpu_subtype_t) 6)
|
||||
#define CPU_SUBTYPE_ARM_V5TEJ ((cpu_subtype_t) 7)
|
||||
#define CPU_SUBTYPE_ARM_XSCALE ((cpu_subtype_t) 8)
|
||||
#define CPU_SUBTYPE_ARM_V7 ((cpu_subtype_t) 9) /* ARMv7-A and ARMv7-R */
|
||||
#define CPU_SUBTYPE_ARM_V7F ((cpu_subtype_t) 10) /* Cortex A9 */
|
||||
#define CPU_SUBTYPE_ARM_V7S ((cpu_subtype_t) 11) /* Swift */
|
||||
#define CPU_SUBTYPE_ARM_V7K ((cpu_subtype_t) 12)
|
||||
#define CPU_SUBTYPE_ARM_V8 ((cpu_subtype_t) 13)
|
||||
#define CPU_SUBTYPE_ARM_V6M ((cpu_subtype_t) 14) /* Not meant to be run under xnu */
|
||||
#define CPU_SUBTYPE_ARM_V7M ((cpu_subtype_t) 15) /* Not meant to be run under xnu */
|
||||
#define CPU_SUBTYPE_ARM_V7EM ((cpu_subtype_t) 16) /* Not meant to be run under xnu */
|
||||
#define CPU_SUBTYPE_ARM_V8M ((cpu_subtype_t) 17) /* Not meant to be run under xnu */
|
||||
|
||||
/*
|
||||
* ARM64 subtypes
|
||||
*/
|
||||
#define CPU_SUBTYPE_ARM64_ALL ((cpu_subtype_t) 0)
|
||||
#define CPU_SUBTYPE_ARM64_V8 ((cpu_subtype_t) 1)
|
||||
#define CPU_SUBTYPE_ARM64E ((cpu_subtype_t) 2)
|
||||
|
||||
/* CPU subtype feature flags for ptrauth on arm64e platforms */
|
||||
#define CPU_SUBTYPE_ARM64_PTR_AUTH_MASK 0x0f000000
|
||||
#define CPU_SUBTYPE_ARM64_PTR_AUTH_VERSION(x) (((x) & CPU_SUBTYPE_ARM64_PTR_AUTH_MASK) >> 24)
|
||||
|
||||
/*
|
||||
* ARM64_32 subtypes
|
||||
*/
|
||||
#define CPU_SUBTYPE_ARM64_32_ALL ((cpu_subtype_t) 0)
|
||||
#define CPU_SUBTYPE_ARM64_32_V8 ((cpu_subtype_t) 1)
|
||||
|
||||
#endif /* !__ASSEMBLER__ */
|
||||
|
||||
/*
|
||||
* CPU families (sysctl hw.cpufamily)
|
||||
*
|
||||
* These are meant to identify the CPU's marketing name - an
|
||||
* application can map these to (possibly) localized strings.
|
||||
* NB: the encodings of the CPU families are intentionally arbitrary.
|
||||
* There is no ordering, and you should never try to deduce whether
|
||||
* or not some feature is available based on the family.
|
||||
* Use feature flags (eg, hw.optional.altivec) to test for optional
|
||||
* functionality.
|
||||
*/
|
||||
#define CPUFAMILY_UNKNOWN 0
|
||||
#define CPUFAMILY_POWERPC_G3 0xcee41549
|
||||
#define CPUFAMILY_POWERPC_G4 0x77c184ae
|
||||
#define CPUFAMILY_POWERPC_G5 0xed76d8aa
|
||||
#define CPUFAMILY_INTEL_6_13 0xaa33392b
|
||||
#define CPUFAMILY_INTEL_PENRYN 0x78ea4fbc
|
||||
#define CPUFAMILY_INTEL_NEHALEM 0x6b5a4cd2
|
||||
#define CPUFAMILY_INTEL_WESTMERE 0x573b5eec
|
||||
#define CPUFAMILY_INTEL_SANDYBRIDGE 0x5490b78c
|
||||
#define CPUFAMILY_INTEL_IVYBRIDGE 0x1f65e835
|
||||
#define CPUFAMILY_INTEL_HASWELL 0x10b282dc
|
||||
#define CPUFAMILY_INTEL_BROADWELL 0x582ed09c
|
||||
#define CPUFAMILY_INTEL_SKYLAKE 0x37fc219f
|
||||
#define CPUFAMILY_INTEL_KABYLAKE 0x0f817246
|
||||
#define CPUFAMILY_INTEL_ICELAKE 0x38435547
|
||||
#if !defined(RC_HIDE_XNU_COMETLAKE)
|
||||
#define CPUFAMILY_INTEL_COMETLAKE 0x1cf8a03e
|
||||
#endif /* not RC_HIDE_XNU_COMETLAKE */
|
||||
#define CPUFAMILY_ARM_9 0xe73283ae
|
||||
#define CPUFAMILY_ARM_11 0x8ff620d8
|
||||
#define CPUFAMILY_ARM_XSCALE 0x53b005f5
|
||||
#define CPUFAMILY_ARM_12 0xbd1b0ae9
|
||||
#define CPUFAMILY_ARM_13 0x0cc90e64
|
||||
#define CPUFAMILY_ARM_14 0x96077ef1
|
||||
#define CPUFAMILY_ARM_15 0xa8511bca
|
||||
#define CPUFAMILY_ARM_SWIFT 0x1e2d6381
|
||||
#define CPUFAMILY_ARM_CYCLONE 0x37a09642
|
||||
#define CPUFAMILY_ARM_TYPHOON 0x2c91a47e
|
||||
#define CPUFAMILY_ARM_TWISTER 0x92fb37c8
|
||||
#define CPUFAMILY_ARM_HURRICANE 0x67ceee93
|
||||
#define CPUFAMILY_ARM_MONSOON_MISTRAL 0xe81e7ef6
|
||||
#define CPUFAMILY_ARM_VORTEX_TEMPEST 0x07d34b9f
|
||||
#define CPUFAMILY_ARM_LIGHTNING_THUNDER 0x462504d2
|
||||
#define CPUFAMILY_ARM_FIRESTORM_ICESTORM 0x1b588bb3
|
||||
|
||||
#define CPUSUBFAMILY_UNKNOWN 0
|
||||
#define CPUSUBFAMILY_ARM_HP 1
|
||||
#define CPUSUBFAMILY_ARM_HG 2
|
||||
#define CPUSUBFAMILY_ARM_M 3
|
||||
#define CPUSUBFAMILY_ARM_HS 4
|
||||
#define CPUSUBFAMILY_ARM_HC_HD 5
|
||||
|
||||
/* The following synonyms are deprecated: */
|
||||
#define CPUFAMILY_INTEL_6_23 CPUFAMILY_INTEL_PENRYN
|
||||
#define CPUFAMILY_INTEL_6_26 CPUFAMILY_INTEL_NEHALEM
|
||||
|
||||
|
||||
#endif /* _MACH_MACHINE_H_ */
|
||||
40
lib/libc/include/aarch64-macos-gnu/mach/machine/_structs.h
Normal file
40
lib/libc/include/aarch64-macos-gnu/mach/machine/_structs.h
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2017 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef _MACH_MACHINE__STRUCTS_H_
|
||||
#define _MACH_MACHINE__STRUCTS_H_
|
||||
|
||||
#if defined (__i386__) || defined(__x86_64__)
|
||||
#include "mach/i386/_structs.h"
|
||||
#elif defined (__arm__) || defined (__arm64__)
|
||||
#include "mach/arm/_structs.h"
|
||||
#else
|
||||
#error architecture not supported
|
||||
#endif
|
||||
|
||||
#endif /* _MACH_MACHINE__STRUCTS_H_ */
|
||||
40
lib/libc/include/aarch64-macos-gnu/mach/machine/boolean.h
Normal file
40
lib/libc/include/aarch64-macos-gnu/mach/machine/boolean.h
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2007 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef _MACH_MACHINE_BOOLEAN_H_
|
||||
#define _MACH_MACHINE_BOOLEAN_H_
|
||||
|
||||
#if defined (__i386__) || defined(__x86_64__)
|
||||
#include "mach/i386/boolean.h"
|
||||
#elif defined (__arm__) || defined (__arm64__)
|
||||
#include "mach/arm/boolean.h"
|
||||
#else
|
||||
#error architecture not supported
|
||||
#endif
|
||||
|
||||
#endif /* _MACH_MACHINE_BOOLEAN_H_ */
|
||||
40
lib/libc/include/aarch64-macos-gnu/mach/machine/exception.h
Normal file
40
lib/libc/include/aarch64-macos-gnu/mach/machine/exception.h
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2007 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef _MACH_MACHINE_EXCEPTION_H_
|
||||
#define _MACH_MACHINE_EXCEPTION_H_
|
||||
|
||||
#if defined (__i386__) || defined(__x86_64__)
|
||||
#include "mach/i386/exception.h"
|
||||
#elif defined (__arm__) || defined (__arm64__)
|
||||
#include "mach/arm/exception.h"
|
||||
#else
|
||||
#error architecture not supported
|
||||
#endif
|
||||
|
||||
#endif /* _MACH_MACHINE_EXCEPTION_H_ */
|
||||
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2007 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef _MACH_MACHINE_KERN_RETURN_H_
|
||||
#define _MACH_MACHINE_KERN_RETURN_H_
|
||||
|
||||
#if defined (__i386__) || defined(__x86_64__)
|
||||
#include "mach/i386/kern_return.h"
|
||||
#elif defined (__arm__) || defined (__arm64__)
|
||||
#include "mach/arm/kern_return.h"
|
||||
#else
|
||||
#error architecture not supported
|
||||
#endif
|
||||
|
||||
#endif /* _MACH_MACHINE_KERN_RETURN_H_ */
|
||||
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2007 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef _MACH_MACHINE_PROCESSOR_INFO_H_
|
||||
#define _MACH_MACHINE_PROCESSOR_INFO_H_
|
||||
|
||||
#if defined (__i386__) || defined(__x86_64__)
|
||||
#include "mach/i386/processor_info.h"
|
||||
#elif defined (__arm__) || defined (__arm64__)
|
||||
#include "mach/arm/processor_info.h"
|
||||
#else
|
||||
#error architecture not supported
|
||||
#endif
|
||||
|
||||
#endif /* _MACH_MACHINE_PROCESSOR_INFO_H_ */
|
||||
40
lib/libc/include/aarch64-macos-gnu/mach/machine/rpc.h
Normal file
40
lib/libc/include/aarch64-macos-gnu/mach/machine/rpc.h
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2007 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef _MACH_MACHINE_RPC_H_
|
||||
#define _MACH_MACHINE_RPC_H_
|
||||
|
||||
#if defined (__i386__) || defined(__x86_64__)
|
||||
#include "mach/i386/rpc.h"
|
||||
#elif defined (__arm__) || defined (__arm64__)
|
||||
#include "mach/arm/rpc.h"
|
||||
#else
|
||||
#error architecture not supported
|
||||
#endif
|
||||
|
||||
#endif /* _MACH_MACHINE_RPC_H_ */
|
||||
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2007 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef _MACH_MACHINE_THREAD_STATE_H_
|
||||
#define _MACH_MACHINE_THREAD_STATE_H_
|
||||
|
||||
#if defined (__i386__) || defined(__x86_64__)
|
||||
#include "mach/i386/thread_state.h"
|
||||
#elif defined (__arm__) || defined (__arm64__)
|
||||
#include "mach/arm/thread_state.h"
|
||||
#else
|
||||
#error architecture not supported
|
||||
#endif
|
||||
|
||||
#endif /* _MACH_MACHINE_THREAD_STATE_H_ */
|
||||
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2007 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef _MACH_MACHINE_THREAD_STATUS_H_
|
||||
#define _MACH_MACHINE_THREAD_STATUS_H_
|
||||
|
||||
#if defined (__i386__) || defined(__x86_64__)
|
||||
#include "mach/i386/thread_status.h"
|
||||
#elif defined (__arm__) || defined (__arm64__)
|
||||
#include "mach/arm/thread_status.h"
|
||||
#else
|
||||
#error architecture not supported
|
||||
#endif
|
||||
|
||||
#endif /* _MACH_MACHINE_THREAD_STATUS_H_ */
|
||||
40
lib/libc/include/aarch64-macos-gnu/mach/machine/vm_param.h
Normal file
40
lib/libc/include/aarch64-macos-gnu/mach/machine/vm_param.h
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2007 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef _MACH_MACHINE_VM_PARAM_H_
|
||||
#define _MACH_MACHINE_VM_PARAM_H_
|
||||
|
||||
#if defined (__i386__) || defined(__x86_64__)
|
||||
#include "mach/i386/vm_param.h"
|
||||
#elif defined (__arm__) || defined (__arm64__)
|
||||
#include "mach/arm/vm_param.h"
|
||||
#else
|
||||
#error architecture not supported
|
||||
#endif
|
||||
|
||||
#endif /* _MACH_MACHINE_VM_PARAM_H_ */
|
||||
40
lib/libc/include/aarch64-macos-gnu/mach/machine/vm_types.h
Normal file
40
lib/libc/include/aarch64-macos-gnu/mach/machine/vm_types.h
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2007 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef _MACH_MACHINE_VM_TYPES_H_
|
||||
#define _MACH_MACHINE_VM_TYPES_H_
|
||||
|
||||
#if defined (__i386__) || defined(__x86_64__)
|
||||
#include "mach/i386/vm_types.h"
|
||||
#elif defined (__arm__) || defined (__arm64__)
|
||||
#include "mach/arm/vm_types.h"
|
||||
#else
|
||||
#error architecture not supported
|
||||
#endif
|
||||
|
||||
#endif /* _MACH_MACHINE_VM_TYPES_H_ */
|
||||
908
lib/libc/include/aarch64-macos-gnu/mach/message.h
Normal file
908
lib/libc/include/aarch64-macos-gnu/mach/message.h
Normal file
@ -0,0 +1,908 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/*
|
||||
* @OSF_COPYRIGHT@
|
||||
*/
|
||||
/*
|
||||
* Mach Operating System
|
||||
* Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission to use, copy, modify and distribute this software and its
|
||||
* documentation is hereby granted, provided that both the copyright
|
||||
* notice and this permission notice appear in all copies of the
|
||||
* software, derivative works or modified versions, and any portions
|
||||
* thereof, and that both notices appear in supporting documentation.
|
||||
*
|
||||
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
||||
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
|
||||
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
||||
*
|
||||
* Carnegie Mellon requests users of this software to return to
|
||||
*
|
||||
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
||||
* School of Computer Science
|
||||
* Carnegie Mellon University
|
||||
* Pittsburgh PA 15213-3890
|
||||
*
|
||||
* any improvements or extensions that they make and grant Carnegie Mellon
|
||||
* the rights to redistribute these changes.
|
||||
*/
|
||||
/*
|
||||
* NOTICE: This file was modified by McAfee Research in 2004 to introduce
|
||||
* support for mandatory and extensible security protections. This notice
|
||||
* is included in support of clause 2.2 (b) of the Apple Public License,
|
||||
* Version 2.0.
|
||||
* Copyright (c) 2005 SPARTA, Inc.
|
||||
*/
|
||||
/*
|
||||
*/
|
||||
/*
|
||||
* File: mach/message.h
|
||||
*
|
||||
* Mach IPC message and primitive function definitions.
|
||||
*/
|
||||
|
||||
#ifndef _MACH_MESSAGE_H_
|
||||
#define _MACH_MESSAGE_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include <mach/port.h>
|
||||
#include <mach/boolean.h>
|
||||
#include <mach/kern_return.h>
|
||||
#include <mach/machine/vm_types.h>
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/appleapiopts.h>
|
||||
#include <Availability.h>
|
||||
|
||||
/*
|
||||
* The timeout mechanism uses mach_msg_timeout_t values,
|
||||
* passed by value. The timeout units are milliseconds.
|
||||
* It is controlled with the MACH_SEND_TIMEOUT
|
||||
* and MACH_RCV_TIMEOUT options.
|
||||
*/
|
||||
|
||||
typedef natural_t mach_msg_timeout_t;
|
||||
|
||||
/*
|
||||
* The value to be used when there is no timeout.
|
||||
* (No MACH_SEND_TIMEOUT/MACH_RCV_TIMEOUT option.)
|
||||
*/
|
||||
|
||||
#define MACH_MSG_TIMEOUT_NONE ((mach_msg_timeout_t) 0)
|
||||
|
||||
/*
|
||||
* The kernel uses MACH_MSGH_BITS_COMPLEX as a hint. If it isn't on, it
|
||||
* assumes the body of the message doesn't contain port rights or OOL
|
||||
* data. The field is set in received messages. A user task must
|
||||
* use caution in interpreting the body of a message if the bit isn't
|
||||
* on, because the mach_msg_type's in the body might "lie" about the
|
||||
* contents. If the bit isn't on, but the mach_msg_types
|
||||
* in the body specify rights or OOL data, the behavior is undefined.
|
||||
* (Ie, an error may or may not be produced.)
|
||||
*
|
||||
* The value of MACH_MSGH_BITS_REMOTE determines the interpretation
|
||||
* of the msgh_remote_port field. It is handled like a msgt_name,
|
||||
* but must result in a send or send-once type right.
|
||||
*
|
||||
* The value of MACH_MSGH_BITS_LOCAL determines the interpretation
|
||||
* of the msgh_local_port field. It is handled like a msgt_name,
|
||||
* and also must result in a send or send-once type right.
|
||||
*
|
||||
* The value of MACH_MSGH_BITS_VOUCHER determines the interpretation
|
||||
* of the msgh_voucher_port field. It is handled like a msgt_name,
|
||||
* but must result in a send right (and the msgh_voucher_port field
|
||||
* must be the name of a send right to a Mach voucher kernel object.
|
||||
*
|
||||
* MACH_MSGH_BITS() combines two MACH_MSG_TYPE_* values, for the remote
|
||||
* and local fields, into a single value suitable for msgh_bits.
|
||||
*
|
||||
* MACH_MSGH_BITS_CIRCULAR should be zero; is is used internally.
|
||||
*
|
||||
* The unused bits should be zero and are reserved for the kernel
|
||||
* or for future interface expansion.
|
||||
*/
|
||||
|
||||
#define MACH_MSGH_BITS_ZERO 0x00000000
|
||||
|
||||
#define MACH_MSGH_BITS_REMOTE_MASK 0x0000001f
|
||||
#define MACH_MSGH_BITS_LOCAL_MASK 0x00001f00
|
||||
#define MACH_MSGH_BITS_VOUCHER_MASK 0x001f0000
|
||||
|
||||
#define MACH_MSGH_BITS_PORTS_MASK \
|
||||
(MACH_MSGH_BITS_REMOTE_MASK | \
|
||||
MACH_MSGH_BITS_LOCAL_MASK | \
|
||||
MACH_MSGH_BITS_VOUCHER_MASK)
|
||||
|
||||
#define MACH_MSGH_BITS_COMPLEX 0x80000000U /* message is complex */
|
||||
|
||||
#define MACH_MSGH_BITS_USER 0x801f1f1fU /* allowed bits user->kernel */
|
||||
|
||||
#define MACH_MSGH_BITS_RAISEIMP 0x20000000U /* importance raised due to msg */
|
||||
#define MACH_MSGH_BITS_DENAP MACH_MSGH_BITS_RAISEIMP
|
||||
|
||||
#define MACH_MSGH_BITS_IMPHOLDASRT 0x10000000U /* assertion help, userland private */
|
||||
#define MACH_MSGH_BITS_DENAPHOLDASRT MACH_MSGH_BITS_IMPHOLDASRT
|
||||
|
||||
#define MACH_MSGH_BITS_CIRCULAR 0x10000000U /* message circular, kernel private */
|
||||
|
||||
#define MACH_MSGH_BITS_USED 0xb01f1f1fU
|
||||
|
||||
/* setter macros for the bits */
|
||||
#define MACH_MSGH_BITS(remote, local) /* legacy */ \
|
||||
((remote) | ((local) << 8))
|
||||
#define MACH_MSGH_BITS_SET_PORTS(remote, local, voucher) \
|
||||
(((remote) & MACH_MSGH_BITS_REMOTE_MASK) | \
|
||||
(((local) << 8) & MACH_MSGH_BITS_LOCAL_MASK) | \
|
||||
(((voucher) << 16) & MACH_MSGH_BITS_VOUCHER_MASK))
|
||||
#define MACH_MSGH_BITS_SET(remote, local, voucher, other) \
|
||||
(MACH_MSGH_BITS_SET_PORTS((remote), (local), (voucher)) \
|
||||
| ((other) &~ MACH_MSGH_BITS_PORTS_MASK))
|
||||
|
||||
/* getter macros for pulling values out of the bits field */
|
||||
#define MACH_MSGH_BITS_REMOTE(bits) \
|
||||
((bits) & MACH_MSGH_BITS_REMOTE_MASK)
|
||||
#define MACH_MSGH_BITS_LOCAL(bits) \
|
||||
(((bits) & MACH_MSGH_BITS_LOCAL_MASK) >> 8)
|
||||
#define MACH_MSGH_BITS_VOUCHER(bits) \
|
||||
(((bits) & MACH_MSGH_BITS_VOUCHER_MASK) >> 16)
|
||||
#define MACH_MSGH_BITS_PORTS(bits) \
|
||||
((bits) & MACH_MSGH_BITS_PORTS_MASK)
|
||||
#define MACH_MSGH_BITS_OTHER(bits) \
|
||||
((bits) &~ MACH_MSGH_BITS_PORTS_MASK)
|
||||
|
||||
/* checking macros */
|
||||
#define MACH_MSGH_BITS_HAS_REMOTE(bits) \
|
||||
(MACH_MSGH_BITS_REMOTE(bits) != MACH_MSGH_BITS_ZERO)
|
||||
#define MACH_MSGH_BITS_HAS_LOCAL(bits) \
|
||||
(MACH_MSGH_BITS_LOCAL(bits) != MACH_MSGH_BITS_ZERO)
|
||||
#define MACH_MSGH_BITS_HAS_VOUCHER(bits) \
|
||||
(MACH_MSGH_BITS_VOUCHER(bits) != MACH_MSGH_BITS_ZERO)
|
||||
#define MACH_MSGH_BITS_IS_COMPLEX(bits) \
|
||||
(((bits) & MACH_MSGH_BITS_COMPLEX) != MACH_MSGH_BITS_ZERO)
|
||||
|
||||
/* importance checking macros */
|
||||
#define MACH_MSGH_BITS_RAISED_IMPORTANCE(bits) \
|
||||
(((bits) & MACH_MSGH_BITS_RAISEIMP) != MACH_MSGH_BITS_ZERO)
|
||||
#define MACH_MSGH_BITS_HOLDS_IMPORTANCE_ASSERTION(bits) \
|
||||
(((bits) & MACH_MSGH_BITS_IMPHOLDASRT) != MACH_MSGH_BITS_ZERO)
|
||||
|
||||
/*
|
||||
* Every message starts with a message header.
|
||||
* Following the message header, if the message is complex, are a count
|
||||
* of type descriptors and the type descriptors themselves
|
||||
* (mach_msg_descriptor_t). The size of the message must be specified in
|
||||
* bytes, and includes the message header, descriptor count, descriptors,
|
||||
* and inline data.
|
||||
*
|
||||
* The msgh_remote_port field specifies the destination of the message.
|
||||
* It must specify a valid send or send-once right for a port.
|
||||
*
|
||||
* The msgh_local_port field specifies a "reply port". Normally,
|
||||
* This field carries a send-once right that the receiver will use
|
||||
* to reply to the message. It may carry the values MACH_PORT_NULL,
|
||||
* MACH_PORT_DEAD, a send-once right, or a send right.
|
||||
*
|
||||
* The msgh_voucher_port field specifies a Mach voucher port. Only
|
||||
* send rights to kernel-implemented Mach Voucher kernel objects in
|
||||
* addition to MACH_PORT_NULL or MACH_PORT_DEAD may be passed.
|
||||
*
|
||||
* The msgh_id field is uninterpreted by the message primitives.
|
||||
* It normally carries information specifying the format
|
||||
* or meaning of the message.
|
||||
*/
|
||||
|
||||
typedef unsigned int mach_msg_bits_t;
|
||||
typedef natural_t mach_msg_size_t;
|
||||
typedef integer_t mach_msg_id_t;
|
||||
|
||||
#define MACH_MSG_SIZE_NULL (mach_msg_size_t *) 0
|
||||
|
||||
typedef unsigned int mach_msg_priority_t;
|
||||
|
||||
#define MACH_MSG_PRIORITY_UNSPECIFIED (mach_msg_priority_t) 0
|
||||
|
||||
|
||||
typedef unsigned int mach_msg_type_name_t;
|
||||
|
||||
#define MACH_MSG_TYPE_MOVE_RECEIVE 16 /* Must hold receive right */
|
||||
#define MACH_MSG_TYPE_MOVE_SEND 17 /* Must hold send right(s) */
|
||||
#define MACH_MSG_TYPE_MOVE_SEND_ONCE 18 /* Must hold sendonce right */
|
||||
#define MACH_MSG_TYPE_COPY_SEND 19 /* Must hold send right(s) */
|
||||
#define MACH_MSG_TYPE_MAKE_SEND 20 /* Must hold receive right */
|
||||
#define MACH_MSG_TYPE_MAKE_SEND_ONCE 21 /* Must hold receive right */
|
||||
#define MACH_MSG_TYPE_COPY_RECEIVE 22 /* NOT VALID */
|
||||
#define MACH_MSG_TYPE_DISPOSE_RECEIVE 24 /* must hold receive right */
|
||||
#define MACH_MSG_TYPE_DISPOSE_SEND 25 /* must hold send right(s) */
|
||||
#define MACH_MSG_TYPE_DISPOSE_SEND_ONCE 26 /* must hold sendonce right */
|
||||
|
||||
typedef unsigned int mach_msg_copy_options_t;
|
||||
|
||||
#define MACH_MSG_PHYSICAL_COPY 0
|
||||
#define MACH_MSG_VIRTUAL_COPY 1
|
||||
#define MACH_MSG_ALLOCATE 2
|
||||
#define MACH_MSG_OVERWRITE 3 /* deprecated */
|
||||
#ifdef MACH_KERNEL
|
||||
#define MACH_MSG_KALLOC_COPY_T 4
|
||||
#endif /* MACH_KERNEL */
|
||||
|
||||
#define MACH_MSG_GUARD_FLAGS_NONE 0x0000
|
||||
#define MACH_MSG_GUARD_FLAGS_IMMOVABLE_RECEIVE 0x0001 /* Move the receive right and mark it as immovable */
|
||||
#define MACH_MSG_GUARD_FLAGS_UNGUARDED_ON_SEND 0x0002 /* Verify that the port is unguarded */
|
||||
#define MACH_MSG_GUARD_FLAGS_MASK 0x0003 /* Valid flag bits */
|
||||
typedef unsigned int mach_msg_guard_flags_t;
|
||||
|
||||
/*
|
||||
* In a complex mach message, the mach_msg_header_t is followed by
|
||||
* a descriptor count, then an array of that number of descriptors
|
||||
* (mach_msg_*_descriptor_t). The type field of mach_msg_type_descriptor_t
|
||||
* (which any descriptor can be cast to) indicates the flavor of the
|
||||
* descriptor.
|
||||
*
|
||||
* Note that in LP64, the various types of descriptors are no longer all
|
||||
* the same size as mach_msg_descriptor_t, so the array cannot be indexed
|
||||
* as expected.
|
||||
*/
|
||||
|
||||
typedef unsigned int mach_msg_descriptor_type_t;
|
||||
|
||||
#define MACH_MSG_PORT_DESCRIPTOR 0
|
||||
#define MACH_MSG_OOL_DESCRIPTOR 1
|
||||
#define MACH_MSG_OOL_PORTS_DESCRIPTOR 2
|
||||
#define MACH_MSG_OOL_VOLATILE_DESCRIPTOR 3
|
||||
#define MACH_MSG_GUARDED_PORT_DESCRIPTOR 4
|
||||
|
||||
#pragma pack(push, 4)
|
||||
|
||||
typedef struct{
|
||||
natural_t pad1;
|
||||
mach_msg_size_t pad2;
|
||||
unsigned int pad3 : 24;
|
||||
mach_msg_descriptor_type_t type : 8;
|
||||
} mach_msg_type_descriptor_t;
|
||||
|
||||
typedef struct{
|
||||
mach_port_t name;
|
||||
// Pad to 8 bytes everywhere except the K64 kernel where mach_port_t is 8 bytes
|
||||
mach_msg_size_t pad1;
|
||||
unsigned int pad2 : 16;
|
||||
mach_msg_type_name_t disposition : 8;
|
||||
mach_msg_descriptor_type_t type : 8;
|
||||
} mach_msg_port_descriptor_t;
|
||||
|
||||
typedef struct{
|
||||
uint32_t address;
|
||||
mach_msg_size_t size;
|
||||
boolean_t deallocate: 8;
|
||||
mach_msg_copy_options_t copy: 8;
|
||||
unsigned int pad1: 8;
|
||||
mach_msg_descriptor_type_t type: 8;
|
||||
} mach_msg_ool_descriptor32_t;
|
||||
|
||||
typedef struct{
|
||||
uint64_t address;
|
||||
boolean_t deallocate: 8;
|
||||
mach_msg_copy_options_t copy: 8;
|
||||
unsigned int pad1: 8;
|
||||
mach_msg_descriptor_type_t type: 8;
|
||||
mach_msg_size_t size;
|
||||
} mach_msg_ool_descriptor64_t;
|
||||
|
||||
typedef struct{
|
||||
void* address;
|
||||
#if !defined(__LP64__)
|
||||
mach_msg_size_t size;
|
||||
#endif
|
||||
boolean_t deallocate: 8;
|
||||
mach_msg_copy_options_t copy: 8;
|
||||
unsigned int pad1: 8;
|
||||
mach_msg_descriptor_type_t type: 8;
|
||||
#if defined(__LP64__)
|
||||
mach_msg_size_t size;
|
||||
#endif
|
||||
} mach_msg_ool_descriptor_t;
|
||||
|
||||
typedef struct{
|
||||
uint32_t address;
|
||||
mach_msg_size_t count;
|
||||
boolean_t deallocate: 8;
|
||||
mach_msg_copy_options_t copy: 8;
|
||||
mach_msg_type_name_t disposition : 8;
|
||||
mach_msg_descriptor_type_t type : 8;
|
||||
} mach_msg_ool_ports_descriptor32_t;
|
||||
|
||||
typedef struct{
|
||||
uint64_t address;
|
||||
boolean_t deallocate: 8;
|
||||
mach_msg_copy_options_t copy: 8;
|
||||
mach_msg_type_name_t disposition : 8;
|
||||
mach_msg_descriptor_type_t type : 8;
|
||||
mach_msg_size_t count;
|
||||
} mach_msg_ool_ports_descriptor64_t;
|
||||
|
||||
typedef struct{
|
||||
void* address;
|
||||
#if !defined(__LP64__)
|
||||
mach_msg_size_t count;
|
||||
#endif
|
||||
boolean_t deallocate: 8;
|
||||
mach_msg_copy_options_t copy: 8;
|
||||
mach_msg_type_name_t disposition : 8;
|
||||
mach_msg_descriptor_type_t type : 8;
|
||||
#if defined(__LP64__)
|
||||
mach_msg_size_t count;
|
||||
#endif
|
||||
} mach_msg_ool_ports_descriptor_t;
|
||||
|
||||
typedef struct{
|
||||
uint32_t context;
|
||||
mach_port_name_t name;
|
||||
mach_msg_guard_flags_t flags : 16;
|
||||
mach_msg_type_name_t disposition : 8;
|
||||
mach_msg_descriptor_type_t type : 8;
|
||||
} mach_msg_guarded_port_descriptor32_t;
|
||||
|
||||
typedef struct{
|
||||
uint64_t context;
|
||||
mach_msg_guard_flags_t flags : 16;
|
||||
mach_msg_type_name_t disposition : 8;
|
||||
mach_msg_descriptor_type_t type : 8;
|
||||
mach_port_name_t name;
|
||||
} mach_msg_guarded_port_descriptor64_t;
|
||||
|
||||
typedef struct{
|
||||
mach_port_context_t context;
|
||||
#if !defined(__LP64__)
|
||||
mach_port_name_t name;
|
||||
#endif
|
||||
mach_msg_guard_flags_t flags : 16;
|
||||
mach_msg_type_name_t disposition : 8;
|
||||
mach_msg_descriptor_type_t type : 8;
|
||||
#if defined(__LP64__)
|
||||
mach_port_name_t name;
|
||||
#endif /* defined(__LP64__) */
|
||||
} mach_msg_guarded_port_descriptor_t;
|
||||
|
||||
/*
|
||||
* LP64support - This union definition is not really
|
||||
* appropriate in LP64 mode because not all descriptors
|
||||
* are of the same size in that environment.
|
||||
*/
|
||||
typedef union{
|
||||
mach_msg_port_descriptor_t port;
|
||||
mach_msg_ool_descriptor_t out_of_line;
|
||||
mach_msg_ool_ports_descriptor_t ool_ports;
|
||||
mach_msg_type_descriptor_t type;
|
||||
mach_msg_guarded_port_descriptor_t guarded_port;
|
||||
} mach_msg_descriptor_t;
|
||||
|
||||
typedef struct{
|
||||
mach_msg_size_t msgh_descriptor_count;
|
||||
} mach_msg_body_t;
|
||||
|
||||
#define MACH_MSG_BODY_NULL (mach_msg_body_t *) 0
|
||||
#define MACH_MSG_DESCRIPTOR_NULL (mach_msg_descriptor_t *) 0
|
||||
|
||||
typedef struct{
|
||||
mach_msg_bits_t msgh_bits;
|
||||
mach_msg_size_t msgh_size;
|
||||
mach_port_t msgh_remote_port;
|
||||
mach_port_t msgh_local_port;
|
||||
mach_port_name_t msgh_voucher_port;
|
||||
mach_msg_id_t msgh_id;
|
||||
} mach_msg_header_t;
|
||||
|
||||
#define msgh_reserved msgh_voucher_port
|
||||
#define MACH_MSG_NULL (mach_msg_header_t *) 0
|
||||
|
||||
typedef struct{
|
||||
mach_msg_header_t header;
|
||||
mach_msg_body_t body;
|
||||
} mach_msg_base_t;
|
||||
|
||||
typedef unsigned int mach_msg_trailer_type_t;
|
||||
|
||||
#define MACH_MSG_TRAILER_FORMAT_0 0
|
||||
|
||||
typedef unsigned int mach_msg_trailer_size_t;
|
||||
typedef char *mach_msg_trailer_info_t;
|
||||
|
||||
typedef struct{
|
||||
mach_msg_trailer_type_t msgh_trailer_type;
|
||||
mach_msg_trailer_size_t msgh_trailer_size;
|
||||
} mach_msg_trailer_t;
|
||||
|
||||
/*
|
||||
* The msgh_seqno field carries a sequence number
|
||||
* associated with the received-from port. A port's
|
||||
* sequence number is incremented every time a message
|
||||
* is received from it and included in the received
|
||||
* trailer to help put messages back in sequence if
|
||||
* multiple threads receive and/or process received
|
||||
* messages.
|
||||
*/
|
||||
typedef struct{
|
||||
mach_msg_trailer_type_t msgh_trailer_type;
|
||||
mach_msg_trailer_size_t msgh_trailer_size;
|
||||
mach_port_seqno_t msgh_seqno;
|
||||
} mach_msg_seqno_trailer_t;
|
||||
|
||||
typedef struct{
|
||||
unsigned int val[2];
|
||||
} security_token_t;
|
||||
|
||||
typedef struct{
|
||||
mach_msg_trailer_type_t msgh_trailer_type;
|
||||
mach_msg_trailer_size_t msgh_trailer_size;
|
||||
mach_port_seqno_t msgh_seqno;
|
||||
security_token_t msgh_sender;
|
||||
} mach_msg_security_trailer_t;
|
||||
|
||||
/*
|
||||
* The audit token is an opaque token which identifies
|
||||
* Mach tasks and senders of Mach messages as subjects
|
||||
* to the BSM audit system. Only the appropriate BSM
|
||||
* library routines should be used to interpret the
|
||||
* contents of the audit token as the representation
|
||||
* of the subject identity within the token may change
|
||||
* over time.
|
||||
*/
|
||||
typedef struct{
|
||||
unsigned int val[8];
|
||||
} audit_token_t;
|
||||
|
||||
typedef struct{
|
||||
mach_msg_trailer_type_t msgh_trailer_type;
|
||||
mach_msg_trailer_size_t msgh_trailer_size;
|
||||
mach_port_seqno_t msgh_seqno;
|
||||
security_token_t msgh_sender;
|
||||
audit_token_t msgh_audit;
|
||||
} mach_msg_audit_trailer_t;
|
||||
|
||||
typedef struct{
|
||||
mach_msg_trailer_type_t msgh_trailer_type;
|
||||
mach_msg_trailer_size_t msgh_trailer_size;
|
||||
mach_port_seqno_t msgh_seqno;
|
||||
security_token_t msgh_sender;
|
||||
audit_token_t msgh_audit;
|
||||
mach_port_context_t msgh_context;
|
||||
} mach_msg_context_trailer_t;
|
||||
|
||||
|
||||
|
||||
typedef struct{
|
||||
mach_port_name_t sender;
|
||||
} msg_labels_t;
|
||||
|
||||
typedef int mach_msg_filter_id;
|
||||
#define MACH_MSG_FILTER_POLICY_ALLOW (mach_msg_filter_id)0
|
||||
|
||||
/*
|
||||
* Trailer type to pass MAC policy label info as a mach message trailer.
|
||||
*
|
||||
*/
|
||||
|
||||
typedef struct{
|
||||
mach_msg_trailer_type_t msgh_trailer_type;
|
||||
mach_msg_trailer_size_t msgh_trailer_size;
|
||||
mach_port_seqno_t msgh_seqno;
|
||||
security_token_t msgh_sender;
|
||||
audit_token_t msgh_audit;
|
||||
mach_port_context_t msgh_context;
|
||||
mach_msg_filter_id msgh_ad;
|
||||
msg_labels_t msgh_labels;
|
||||
} mach_msg_mac_trailer_t;
|
||||
|
||||
|
||||
#define MACH_MSG_TRAILER_MINIMUM_SIZE sizeof(mach_msg_trailer_t)
|
||||
|
||||
/*
|
||||
* These values can change from release to release - but clearly
|
||||
* code cannot request additional trailer elements one was not
|
||||
* compiled to understand. Therefore, it is safe to use this
|
||||
* constant when the same module specified the receive options.
|
||||
* Otherwise, you run the risk that the options requested by
|
||||
* another module may exceed the local modules notion of
|
||||
* MAX_TRAILER_SIZE.
|
||||
*/
|
||||
|
||||
typedef mach_msg_mac_trailer_t mach_msg_max_trailer_t;
|
||||
#define MAX_TRAILER_SIZE ((mach_msg_size_t)sizeof(mach_msg_max_trailer_t))
|
||||
|
||||
/*
|
||||
* Legacy requirements keep us from ever updating these defines (even
|
||||
* when the format_0 trailers gain new option data fields in the future).
|
||||
* Therefore, they shouldn't be used going forward. Instead, the sizes
|
||||
* should be compared against the specific element size requested using
|
||||
* REQUESTED_TRAILER_SIZE.
|
||||
*/
|
||||
typedef mach_msg_security_trailer_t mach_msg_format_0_trailer_t;
|
||||
|
||||
/*typedef mach_msg_mac_trailer_t mach_msg_format_0_trailer_t;
|
||||
*/
|
||||
|
||||
#define MACH_MSG_TRAILER_FORMAT_0_SIZE sizeof(mach_msg_format_0_trailer_t)
|
||||
|
||||
#define KERNEL_SECURITY_TOKEN_VALUE { {0, 1} }
|
||||
extern const security_token_t KERNEL_SECURITY_TOKEN;
|
||||
|
||||
#define KERNEL_AUDIT_TOKEN_VALUE { {0, 0, 0, 0, 0, 0, 0, 0} }
|
||||
extern const audit_token_t KERNEL_AUDIT_TOKEN;
|
||||
|
||||
typedef integer_t mach_msg_options_t;
|
||||
|
||||
typedef struct{
|
||||
mach_msg_header_t header;
|
||||
} mach_msg_empty_send_t;
|
||||
|
||||
typedef struct{
|
||||
mach_msg_header_t header;
|
||||
mach_msg_trailer_t trailer;
|
||||
} mach_msg_empty_rcv_t;
|
||||
|
||||
typedef union{
|
||||
mach_msg_empty_send_t send;
|
||||
mach_msg_empty_rcv_t rcv;
|
||||
} mach_msg_empty_t;
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
/* utility to round the message size - will become machine dependent */
|
||||
#define round_msg(x) (((mach_msg_size_t)(x) + sizeof (natural_t) - 1) & \
|
||||
~(sizeof (natural_t) - 1))
|
||||
|
||||
|
||||
/*
|
||||
* There is no fixed upper bound to the size of Mach messages.
|
||||
*/
|
||||
#define MACH_MSG_SIZE_MAX ((mach_msg_size_t) ~0)
|
||||
|
||||
#if defined(__APPLE_API_PRIVATE)
|
||||
/*
|
||||
* But architectural limits of a given implementation, or
|
||||
* temporal conditions may cause unpredictable send failures
|
||||
* for messages larger than MACH_MSG_SIZE_RELIABLE.
|
||||
*
|
||||
* In either case, waiting for memory is [currently] outside
|
||||
* the scope of send timeout values provided to IPC.
|
||||
*/
|
||||
#define MACH_MSG_SIZE_RELIABLE ((mach_msg_size_t) 256 * 1024)
|
||||
#endif
|
||||
/*
|
||||
* Compatibility definitions, for code written
|
||||
* when there was a msgh_kind instead of msgh_seqno.
|
||||
*/
|
||||
#define MACH_MSGH_KIND_NORMAL 0x00000000
|
||||
#define MACH_MSGH_KIND_NOTIFICATION 0x00000001
|
||||
#define msgh_kind msgh_seqno
|
||||
#define mach_msg_kind_t mach_port_seqno_t
|
||||
|
||||
typedef natural_t mach_msg_type_size_t;
|
||||
typedef natural_t mach_msg_type_number_t;
|
||||
|
||||
/*
|
||||
* Values received/carried in messages. Tells the receiver what
|
||||
* sort of port right he now has.
|
||||
*
|
||||
* MACH_MSG_TYPE_PORT_NAME is used to transfer a port name
|
||||
* which should remain uninterpreted by the kernel. (Port rights
|
||||
* are not transferred, just the port name.)
|
||||
*/
|
||||
|
||||
#define MACH_MSG_TYPE_PORT_NONE 0
|
||||
|
||||
#define MACH_MSG_TYPE_PORT_NAME 15
|
||||
#define MACH_MSG_TYPE_PORT_RECEIVE MACH_MSG_TYPE_MOVE_RECEIVE
|
||||
#define MACH_MSG_TYPE_PORT_SEND MACH_MSG_TYPE_MOVE_SEND
|
||||
#define MACH_MSG_TYPE_PORT_SEND_ONCE MACH_MSG_TYPE_MOVE_SEND_ONCE
|
||||
|
||||
#define MACH_MSG_TYPE_LAST 22 /* Last assigned */
|
||||
|
||||
/*
|
||||
* A dummy value. Mostly used to indicate that the actual value
|
||||
* will be filled in later, dynamically.
|
||||
*/
|
||||
|
||||
#define MACH_MSG_TYPE_POLYMORPHIC ((mach_msg_type_name_t) -1)
|
||||
|
||||
/*
|
||||
* Is a given item a port type?
|
||||
*/
|
||||
|
||||
#define MACH_MSG_TYPE_PORT_ANY(x) \
|
||||
(((x) >= MACH_MSG_TYPE_MOVE_RECEIVE) && \
|
||||
((x) <= MACH_MSG_TYPE_MAKE_SEND_ONCE))
|
||||
|
||||
#define MACH_MSG_TYPE_PORT_ANY_SEND(x) \
|
||||
(((x) >= MACH_MSG_TYPE_MOVE_SEND) && \
|
||||
((x) <= MACH_MSG_TYPE_MAKE_SEND_ONCE))
|
||||
|
||||
#define MACH_MSG_TYPE_PORT_ANY_RIGHT(x) \
|
||||
(((x) >= MACH_MSG_TYPE_MOVE_RECEIVE) && \
|
||||
((x) <= MACH_MSG_TYPE_MOVE_SEND_ONCE))
|
||||
|
||||
typedef integer_t mach_msg_option_t;
|
||||
|
||||
#define MACH_MSG_OPTION_NONE 0x00000000
|
||||
|
||||
#define MACH_SEND_MSG 0x00000001
|
||||
#define MACH_RCV_MSG 0x00000002
|
||||
|
||||
#define MACH_RCV_LARGE 0x00000004 /* report large message sizes */
|
||||
#define MACH_RCV_LARGE_IDENTITY 0x00000008 /* identify source of large messages */
|
||||
|
||||
#define MACH_SEND_TIMEOUT 0x00000010 /* timeout value applies to send */
|
||||
#define MACH_SEND_OVERRIDE 0x00000020 /* priority override for send */
|
||||
#define MACH_SEND_INTERRUPT 0x00000040 /* don't restart interrupted sends */
|
||||
#define MACH_SEND_NOTIFY 0x00000080 /* arm send-possible notify */
|
||||
#define MACH_SEND_ALWAYS 0x00010000 /* ignore qlimits - kernel only */
|
||||
#define MACH_SEND_TRAILER 0x00020000 /* sender-provided trailer */
|
||||
#define MACH_SEND_NOIMPORTANCE 0x00040000 /* msg won't carry importance */
|
||||
#define MACH_SEND_NODENAP MACH_SEND_NOIMPORTANCE
|
||||
#define MACH_SEND_IMPORTANCE 0x00080000 /* msg carries importance - kernel only */
|
||||
#define MACH_SEND_SYNC_OVERRIDE 0x00100000 /* msg should do sync ipc override */
|
||||
#define MACH_SEND_PROPAGATE_QOS 0x00200000 /* IPC should propagate the caller's QoS */
|
||||
#define MACH_SEND_SYNC_USE_THRPRI MACH_SEND_PROPAGATE_QOS /* obsolete name */
|
||||
#define MACH_SEND_KERNEL 0x00400000 /* full send from kernel space - kernel only */
|
||||
#define MACH_SEND_SYNC_BOOTSTRAP_CHECKIN 0x00800000 /* special reply port should boost thread doing sync bootstrap checkin */
|
||||
|
||||
#define MACH_RCV_TIMEOUT 0x00000100 /* timeout value applies to receive */
|
||||
#define MACH_RCV_NOTIFY 0x00000000 /* legacy name (value was: 0x00000200) */
|
||||
#define MACH_RCV_INTERRUPT 0x00000400 /* don't restart interrupted receive */
|
||||
#define MACH_RCV_VOUCHER 0x00000800 /* willing to receive voucher port */
|
||||
#define MACH_RCV_OVERWRITE 0x00000000 /* scatter receive (deprecated) */
|
||||
#define MACH_RCV_GUARDED_DESC 0x00001000 /* Can receive new guarded descriptor */
|
||||
#define MACH_RCV_SYNC_WAIT 0x00004000 /* sync waiter waiting for rcv */
|
||||
#define MACH_RCV_SYNC_PEEK 0x00008000 /* sync waiter waiting to peek */
|
||||
|
||||
#define MACH_MSG_STRICT_REPLY 0x00000200 /* Enforce specific properties about the reply port, and
|
||||
* the context in which a thread replies to a message.
|
||||
* This flag must be passed on both the SEND and RCV */
|
||||
|
||||
|
||||
/*
|
||||
* NOTE: a 0x00------ RCV mask implies to ask for
|
||||
* a MACH_MSG_TRAILER_FORMAT_0 with 0 Elements,
|
||||
* which is equivalent to a mach_msg_trailer_t.
|
||||
*
|
||||
* XXXMAC: unlike the rest of the MACH_RCV_* flags, MACH_RCV_TRAILER_LABELS
|
||||
* needs its own private bit since we only calculate its fields when absolutely
|
||||
* required.
|
||||
*/
|
||||
#define MACH_RCV_TRAILER_NULL 0
|
||||
#define MACH_RCV_TRAILER_SEQNO 1
|
||||
#define MACH_RCV_TRAILER_SENDER 2
|
||||
#define MACH_RCV_TRAILER_AUDIT 3
|
||||
#define MACH_RCV_TRAILER_CTX 4
|
||||
#define MACH_RCV_TRAILER_AV 7
|
||||
#define MACH_RCV_TRAILER_LABELS 8
|
||||
|
||||
#define MACH_RCV_TRAILER_TYPE(x) (((x) & 0xf) << 28)
|
||||
#define MACH_RCV_TRAILER_ELEMENTS(x) (((x) & 0xf) << 24)
|
||||
#define MACH_RCV_TRAILER_MASK ((0xf << 24))
|
||||
|
||||
#define GET_RCV_ELEMENTS(y) (((y) >> 24) & 0xf)
|
||||
|
||||
|
||||
/*
|
||||
* XXXMAC: note that in the case of MACH_RCV_TRAILER_LABELS,
|
||||
* we just fall through to mach_msg_max_trailer_t.
|
||||
* This is correct behavior since mach_msg_max_trailer_t is defined as
|
||||
* mac_msg_mac_trailer_t which is used for the LABELS trailer.
|
||||
* It also makes things work properly if MACH_RCV_TRAILER_LABELS is ORed
|
||||
* with one of the other options.
|
||||
*/
|
||||
|
||||
#define REQUESTED_TRAILER_SIZE_NATIVE(y) \
|
||||
((mach_msg_trailer_size_t) \
|
||||
((GET_RCV_ELEMENTS(y) == MACH_RCV_TRAILER_NULL) ? \
|
||||
sizeof(mach_msg_trailer_t) : \
|
||||
((GET_RCV_ELEMENTS(y) == MACH_RCV_TRAILER_SEQNO) ? \
|
||||
sizeof(mach_msg_seqno_trailer_t) : \
|
||||
((GET_RCV_ELEMENTS(y) == MACH_RCV_TRAILER_SENDER) ? \
|
||||
sizeof(mach_msg_security_trailer_t) : \
|
||||
((GET_RCV_ELEMENTS(y) == MACH_RCV_TRAILER_AUDIT) ? \
|
||||
sizeof(mach_msg_audit_trailer_t) : \
|
||||
((GET_RCV_ELEMENTS(y) == MACH_RCV_TRAILER_CTX) ? \
|
||||
sizeof(mach_msg_context_trailer_t) : \
|
||||
((GET_RCV_ELEMENTS(y) == MACH_RCV_TRAILER_AV) ? \
|
||||
sizeof(mach_msg_mac_trailer_t) : \
|
||||
sizeof(mach_msg_max_trailer_t))))))))
|
||||
|
||||
|
||||
#define REQUESTED_TRAILER_SIZE(y) REQUESTED_TRAILER_SIZE_NATIVE(y)
|
||||
|
||||
/*
|
||||
* Much code assumes that mach_msg_return_t == kern_return_t.
|
||||
* This definition is useful for descriptive purposes.
|
||||
*
|
||||
* See <mach/error.h> for the format of error codes.
|
||||
* IPC errors are system 4. Send errors are subsystem 0;
|
||||
* receive errors are subsystem 1. The code field is always non-zero.
|
||||
* The high bits of the code field communicate extra information
|
||||
* for some error codes. MACH_MSG_MASK masks off these special bits.
|
||||
*/
|
||||
|
||||
typedef kern_return_t mach_msg_return_t;
|
||||
|
||||
#define MACH_MSG_SUCCESS 0x00000000
|
||||
|
||||
|
||||
#define MACH_MSG_MASK 0x00003e00
|
||||
/* All special error code bits defined below. */
|
||||
#define MACH_MSG_IPC_SPACE 0x00002000
|
||||
/* No room in IPC name space for another capability name. */
|
||||
#define MACH_MSG_VM_SPACE 0x00001000
|
||||
/* No room in VM address space for out-of-line memory. */
|
||||
#define MACH_MSG_IPC_KERNEL 0x00000800
|
||||
/* Kernel resource shortage handling an IPC capability. */
|
||||
#define MACH_MSG_VM_KERNEL 0x00000400
|
||||
/* Kernel resource shortage handling out-of-line memory. */
|
||||
|
||||
#define MACH_SEND_IN_PROGRESS 0x10000001
|
||||
/* Thread is waiting to send. (Internal use only.) */
|
||||
#define MACH_SEND_INVALID_DATA 0x10000002
|
||||
/* Bogus in-line data. */
|
||||
#define MACH_SEND_INVALID_DEST 0x10000003
|
||||
/* Bogus destination port. */
|
||||
#define MACH_SEND_TIMED_OUT 0x10000004
|
||||
/* Message not sent before timeout expired. */
|
||||
#define MACH_SEND_INVALID_VOUCHER 0x10000005
|
||||
/* Bogus voucher port. */
|
||||
#define MACH_SEND_INTERRUPTED 0x10000007
|
||||
/* Software interrupt. */
|
||||
#define MACH_SEND_MSG_TOO_SMALL 0x10000008
|
||||
/* Data doesn't contain a complete message. */
|
||||
#define MACH_SEND_INVALID_REPLY 0x10000009
|
||||
/* Bogus reply port. */
|
||||
#define MACH_SEND_INVALID_RIGHT 0x1000000a
|
||||
/* Bogus port rights in the message body. */
|
||||
#define MACH_SEND_INVALID_NOTIFY 0x1000000b
|
||||
/* Bogus notify port argument. */
|
||||
#define MACH_SEND_INVALID_MEMORY 0x1000000c
|
||||
/* Invalid out-of-line memory pointer. */
|
||||
#define MACH_SEND_NO_BUFFER 0x1000000d
|
||||
/* No message buffer is available. */
|
||||
#define MACH_SEND_TOO_LARGE 0x1000000e
|
||||
/* Send is too large for port */
|
||||
#define MACH_SEND_INVALID_TYPE 0x1000000f
|
||||
/* Invalid msg-type specification. */
|
||||
#define MACH_SEND_INVALID_HEADER 0x10000010
|
||||
/* A field in the header had a bad value. */
|
||||
#define MACH_SEND_INVALID_TRAILER 0x10000011
|
||||
/* The trailer to be sent does not match kernel format. */
|
||||
#define MACH_SEND_INVALID_CONTEXT 0x10000012
|
||||
/* The sending thread context did not match the context on the dest port */
|
||||
#define MACH_SEND_INVALID_RT_OOL_SIZE 0x10000015
|
||||
/* compatibility: no longer a returned error */
|
||||
#define MACH_SEND_NO_GRANT_DEST 0x10000016
|
||||
/* The destination port doesn't accept ports in body */
|
||||
#define MACH_SEND_MSG_FILTERED 0x10000017
|
||||
/* Message send was rejected by message filter */
|
||||
|
||||
#define MACH_RCV_IN_PROGRESS 0x10004001
|
||||
/* Thread is waiting for receive. (Internal use only.) */
|
||||
#define MACH_RCV_INVALID_NAME 0x10004002
|
||||
/* Bogus name for receive port/port-set. */
|
||||
#define MACH_RCV_TIMED_OUT 0x10004003
|
||||
/* Didn't get a message within the timeout value. */
|
||||
#define MACH_RCV_TOO_LARGE 0x10004004
|
||||
/* Message buffer is not large enough for inline data. */
|
||||
#define MACH_RCV_INTERRUPTED 0x10004005
|
||||
/* Software interrupt. */
|
||||
#define MACH_RCV_PORT_CHANGED 0x10004006
|
||||
/* compatibility: no longer a returned error */
|
||||
#define MACH_RCV_INVALID_NOTIFY 0x10004007
|
||||
/* Bogus notify port argument. */
|
||||
#define MACH_RCV_INVALID_DATA 0x10004008
|
||||
/* Bogus message buffer for inline data. */
|
||||
#define MACH_RCV_PORT_DIED 0x10004009
|
||||
/* Port/set was sent away/died during receive. */
|
||||
#define MACH_RCV_IN_SET 0x1000400a
|
||||
/* compatibility: no longer a returned error */
|
||||
#define MACH_RCV_HEADER_ERROR 0x1000400b
|
||||
/* Error receiving message header. See special bits. */
|
||||
#define MACH_RCV_BODY_ERROR 0x1000400c
|
||||
/* Error receiving message body. See special bits. */
|
||||
#define MACH_RCV_INVALID_TYPE 0x1000400d
|
||||
/* Invalid msg-type specification in scatter list. */
|
||||
#define MACH_RCV_SCATTER_SMALL 0x1000400e
|
||||
/* Out-of-line overwrite region is not large enough */
|
||||
#define MACH_RCV_INVALID_TRAILER 0x1000400f
|
||||
/* trailer type or number of trailer elements not supported */
|
||||
#define MACH_RCV_IN_PROGRESS_TIMED 0x10004011
|
||||
/* Waiting for receive with timeout. (Internal use only.) */
|
||||
#define MACH_RCV_INVALID_REPLY 0x10004012
|
||||
/* invalid reply port used in a STRICT_REPLY message */
|
||||
|
||||
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/*
|
||||
* Routine: mach_msg_overwrite
|
||||
* Purpose:
|
||||
* Send and/or receive a message. If the message operation
|
||||
* is interrupted, and the user did not request an indication
|
||||
* of that fact, then restart the appropriate parts of the
|
||||
* operation silently (trap version does not restart).
|
||||
*
|
||||
* Distinct send and receive buffers may be specified. If
|
||||
* no separate receive buffer is specified, the msg parameter
|
||||
* will be used for both send and receive operations.
|
||||
*
|
||||
* In addition to a distinct receive buffer, that buffer may
|
||||
* already contain scatter control information to direct the
|
||||
* receiving of the message.
|
||||
*/
|
||||
__WATCHOS_PROHIBITED __TVOS_PROHIBITED
|
||||
extern mach_msg_return_t mach_msg_overwrite(
|
||||
mach_msg_header_t *msg,
|
||||
mach_msg_option_t option,
|
||||
mach_msg_size_t send_size,
|
||||
mach_msg_size_t rcv_size,
|
||||
mach_port_name_t rcv_name,
|
||||
mach_msg_timeout_t timeout,
|
||||
mach_port_name_t notify,
|
||||
mach_msg_header_t *rcv_msg,
|
||||
mach_msg_size_t rcv_limit);
|
||||
|
||||
|
||||
/*
|
||||
* Routine: mach_msg
|
||||
* Purpose:
|
||||
* Send and/or receive a message. If the message operation
|
||||
* is interrupted, and the user did not request an indication
|
||||
* of that fact, then restart the appropriate parts of the
|
||||
* operation silently (trap version does not restart).
|
||||
*/
|
||||
__WATCHOS_PROHIBITED __TVOS_PROHIBITED
|
||||
extern mach_msg_return_t mach_msg(
|
||||
mach_msg_header_t *msg,
|
||||
mach_msg_option_t option,
|
||||
mach_msg_size_t send_size,
|
||||
mach_msg_size_t rcv_size,
|
||||
mach_port_name_t rcv_name,
|
||||
mach_msg_timeout_t timeout,
|
||||
mach_port_name_t notify);
|
||||
|
||||
/*
|
||||
* Routine: mach_voucher_deallocate
|
||||
* Purpose:
|
||||
* Deallocate a mach voucher created or received in a message. Drops
|
||||
* one (send right) reference to the voucher.
|
||||
*/
|
||||
__WATCHOS_PROHIBITED __TVOS_PROHIBITED
|
||||
extern kern_return_t mach_voucher_deallocate(
|
||||
mach_port_name_t voucher);
|
||||
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _MACH_MESSAGE_H_ */
|
||||
429
lib/libc/include/aarch64-macos-gnu/mach/port.h
Normal file
429
lib/libc/include/aarch64-macos-gnu/mach/port.h
Normal file
@ -0,0 +1,429 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/*
|
||||
* @OSF_COPYRIGHT@
|
||||
*/
|
||||
/*
|
||||
* Mach Operating System
|
||||
* Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission to use, copy, modify and distribute this software and its
|
||||
* documentation is hereby granted, provided that both the copyright
|
||||
* notice and this permission notice appear in all copies of the
|
||||
* software, derivative works or modified versions, and any portions
|
||||
* thereof, and that both notices appear in supporting documentation.
|
||||
*
|
||||
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
||||
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
|
||||
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
||||
*
|
||||
* Carnegie Mellon requests users of this software to return to
|
||||
*
|
||||
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
||||
* School of Computer Science
|
||||
* Carnegie Mellon University
|
||||
* Pittsburgh PA 15213-3890
|
||||
*
|
||||
* any improvements or extensions that they make and grant Carnegie Mellon
|
||||
* the rights to redistribute these changes.
|
||||
*/
|
||||
/*
|
||||
* NOTICE: This file was modified by McAfee Research in 2004 to introduce
|
||||
* support for mandatory and extensible security protections. This notice
|
||||
* is included in support of clause 2.2 (b) of the Apple Public License,
|
||||
* Version 2.0.
|
||||
*/
|
||||
/*
|
||||
*/
|
||||
/*
|
||||
* File: mach/port.h
|
||||
*
|
||||
* Definition of a Mach port
|
||||
*
|
||||
* Mach ports are the endpoints to Mach-implemented communications
|
||||
* channels (usually uni-directional message queues, but other types
|
||||
* also exist).
|
||||
*
|
||||
* Unique collections of these endpoints are maintained for each
|
||||
* Mach task. Each Mach port in the task's collection is given a
|
||||
* [task-local] name to identify it - and the the various "rights"
|
||||
* held by the task for that specific endpoint.
|
||||
*
|
||||
* This header defines the types used to identify these Mach ports
|
||||
* and the various rights associated with them. For more info see:
|
||||
*
|
||||
* <mach/mach_port.h> - manipulation of port rights in a given space
|
||||
* <mach/message.h> - message queue [and port right passing] mechanism
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _MACH_PORT_H_
|
||||
#define _MACH_PORT_H_
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <stdint.h>
|
||||
#include <mach/boolean.h>
|
||||
#include <mach/machine/vm_types.h>
|
||||
|
||||
/*
|
||||
* mach_port_name_t - the local identity for a Mach port
|
||||
*
|
||||
* The name is Mach port namespace specific. It is used to
|
||||
* identify the rights held for that port by the task whose
|
||||
* namespace is implied [or specifically provided].
|
||||
*
|
||||
* Use of this type usually implies just a name - no rights.
|
||||
* See mach_port_t for a type that implies a "named right."
|
||||
*
|
||||
*/
|
||||
|
||||
typedef natural_t mach_port_name_t;
|
||||
typedef mach_port_name_t *mach_port_name_array_t;
|
||||
|
||||
|
||||
/*
|
||||
* mach_port_t - a named port right
|
||||
*
|
||||
* In user-space, "rights" are represented by the name of the
|
||||
* right in the Mach port namespace. Even so, this type is
|
||||
* presented as a unique one to more clearly denote the presence
|
||||
* of a right coming along with the name.
|
||||
*
|
||||
* Often, various rights for a port held in a single name space
|
||||
* will coalesce and are, therefore, be identified by a single name
|
||||
* [this is the case for send and receive rights]. But not
|
||||
* always [send-once rights currently get a unique name for
|
||||
* each right].
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/_types.h>
|
||||
#include <sys/_types/_mach_port_t.h>
|
||||
|
||||
|
||||
typedef mach_port_t *mach_port_array_t;
|
||||
|
||||
/*
|
||||
* MACH_PORT_NULL is a legal value that can be carried in messages.
|
||||
* It indicates the absence of any port or port rights. (A port
|
||||
* argument keeps the message from being "simple", even if the
|
||||
* value is MACH_PORT_NULL.) The value MACH_PORT_DEAD is also a legal
|
||||
* value that can be carried in messages. It indicates
|
||||
* that a port right was present, but it died.
|
||||
*/
|
||||
|
||||
#define MACH_PORT_NULL 0 /* intentional loose typing */
|
||||
#define MACH_PORT_DEAD ((mach_port_name_t) ~0)
|
||||
#define MACH_PORT_VALID(name) \
|
||||
(((name) != MACH_PORT_NULL) && \
|
||||
((name) != MACH_PORT_DEAD))
|
||||
|
||||
|
||||
/*
|
||||
* For kernel-selected [assigned] port names, the name is
|
||||
* comprised of two parts: a generation number and an index.
|
||||
* This approach keeps the exact same name from being generated
|
||||
* and reused too quickly [to catch right/reference counting bugs].
|
||||
* The dividing line between the constituent parts is exposed so
|
||||
* that efficient "mach_port_name_t to data structure pointer"
|
||||
* conversion implementation can be made. But it is possible
|
||||
* for user-level code to assign their own names to Mach ports.
|
||||
* These are not required to participate in this algorithm. So
|
||||
* care should be taken before "assuming" this model.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef NO_PORT_GEN
|
||||
|
||||
#define MACH_PORT_INDEX(name) ((name) >> 8)
|
||||
#define MACH_PORT_GEN(name) (((name) & 0xff) << 24)
|
||||
#define MACH_PORT_MAKE(index, gen) \
|
||||
(((index) << 8) | (gen) >> 24)
|
||||
|
||||
#else /* NO_PORT_GEN */
|
||||
|
||||
#define MACH_PORT_INDEX(name) (name)
|
||||
#define MACH_PORT_GEN(name) (0)
|
||||
#define MACH_PORT_MAKE(index, gen) (index)
|
||||
|
||||
#endif /* NO_PORT_GEN */
|
||||
|
||||
|
||||
/*
|
||||
* These are the different rights a task may have for a port.
|
||||
* The MACH_PORT_RIGHT_* definitions are used as arguments
|
||||
* to mach_port_allocate, mach_port_get_refs, etc, to specify
|
||||
* a particular right to act upon. The mach_port_names and
|
||||
* mach_port_type calls return bitmasks using the MACH_PORT_TYPE_*
|
||||
* definitions. This is because a single name may denote
|
||||
* multiple rights.
|
||||
*/
|
||||
|
||||
typedef natural_t mach_port_right_t;
|
||||
|
||||
#define MACH_PORT_RIGHT_SEND ((mach_port_right_t) 0)
|
||||
#define MACH_PORT_RIGHT_RECEIVE ((mach_port_right_t) 1)
|
||||
#define MACH_PORT_RIGHT_SEND_ONCE ((mach_port_right_t) 2)
|
||||
#define MACH_PORT_RIGHT_PORT_SET ((mach_port_right_t) 3)
|
||||
#define MACH_PORT_RIGHT_DEAD_NAME ((mach_port_right_t) 4)
|
||||
#define MACH_PORT_RIGHT_LABELH ((mach_port_right_t) 5) /* obsolete right */
|
||||
#define MACH_PORT_RIGHT_NUMBER ((mach_port_right_t) 6) /* right not implemented */
|
||||
|
||||
|
||||
typedef natural_t mach_port_type_t;
|
||||
typedef mach_port_type_t *mach_port_type_array_t;
|
||||
|
||||
#define MACH_PORT_TYPE(right) \
|
||||
((mach_port_type_t)(((mach_port_type_t) 1) \
|
||||
<< ((right) + ((mach_port_right_t) 16))))
|
||||
#define MACH_PORT_TYPE_NONE ((mach_port_type_t) 0L)
|
||||
#define MACH_PORT_TYPE_SEND MACH_PORT_TYPE(MACH_PORT_RIGHT_SEND)
|
||||
#define MACH_PORT_TYPE_RECEIVE MACH_PORT_TYPE(MACH_PORT_RIGHT_RECEIVE)
|
||||
#define MACH_PORT_TYPE_SEND_ONCE MACH_PORT_TYPE(MACH_PORT_RIGHT_SEND_ONCE)
|
||||
#define MACH_PORT_TYPE_PORT_SET MACH_PORT_TYPE(MACH_PORT_RIGHT_PORT_SET)
|
||||
#define MACH_PORT_TYPE_DEAD_NAME MACH_PORT_TYPE(MACH_PORT_RIGHT_DEAD_NAME)
|
||||
#define MACH_PORT_TYPE_LABELH MACH_PORT_TYPE(MACH_PORT_RIGHT_LABELH) /* obsolete */
|
||||
|
||||
|
||||
|
||||
/* Convenient combinations. */
|
||||
|
||||
#define MACH_PORT_TYPE_SEND_RECEIVE \
|
||||
(MACH_PORT_TYPE_SEND|MACH_PORT_TYPE_RECEIVE)
|
||||
#define MACH_PORT_TYPE_SEND_RIGHTS \
|
||||
(MACH_PORT_TYPE_SEND|MACH_PORT_TYPE_SEND_ONCE)
|
||||
#define MACH_PORT_TYPE_PORT_RIGHTS \
|
||||
(MACH_PORT_TYPE_SEND_RIGHTS|MACH_PORT_TYPE_RECEIVE)
|
||||
#define MACH_PORT_TYPE_PORT_OR_DEAD \
|
||||
(MACH_PORT_TYPE_PORT_RIGHTS|MACH_PORT_TYPE_DEAD_NAME)
|
||||
#define MACH_PORT_TYPE_ALL_RIGHTS \
|
||||
(MACH_PORT_TYPE_PORT_OR_DEAD|MACH_PORT_TYPE_PORT_SET)
|
||||
|
||||
/* Dummy type bits that mach_port_type/mach_port_names can return. */
|
||||
|
||||
#define MACH_PORT_TYPE_DNREQUEST 0x80000000
|
||||
#define MACH_PORT_TYPE_SPREQUEST 0x40000000
|
||||
#define MACH_PORT_TYPE_SPREQUEST_DELAYED 0x20000000
|
||||
|
||||
/* User-references for capabilities. */
|
||||
|
||||
typedef natural_t mach_port_urefs_t;
|
||||
typedef integer_t mach_port_delta_t; /* change in urefs */
|
||||
|
||||
/* Attributes of ports. (See mach_port_get_receive_status.) */
|
||||
|
||||
typedef natural_t mach_port_seqno_t; /* sequence number */
|
||||
typedef natural_t mach_port_mscount_t; /* make-send count */
|
||||
typedef natural_t mach_port_msgcount_t; /* number of msgs */
|
||||
typedef natural_t mach_port_rights_t; /* number of rights */
|
||||
|
||||
/*
|
||||
* Are there outstanding send rights for a given port?
|
||||
*/
|
||||
#define MACH_PORT_SRIGHTS_NONE 0 /* no srights */
|
||||
#define MACH_PORT_SRIGHTS_PRESENT 1 /* srights */
|
||||
typedef unsigned int mach_port_srights_t; /* status of send rights */
|
||||
|
||||
typedef struct mach_port_status {
|
||||
mach_port_rights_t mps_pset; /* count of containing port sets */
|
||||
mach_port_seqno_t mps_seqno; /* sequence number */
|
||||
mach_port_mscount_t mps_mscount; /* make-send count */
|
||||
mach_port_msgcount_t mps_qlimit; /* queue limit */
|
||||
mach_port_msgcount_t mps_msgcount; /* number in the queue */
|
||||
mach_port_rights_t mps_sorights; /* how many send-once rights */
|
||||
boolean_t mps_srights; /* do send rights exist? */
|
||||
boolean_t mps_pdrequest; /* port-deleted requested? */
|
||||
boolean_t mps_nsrequest; /* no-senders requested? */
|
||||
natural_t mps_flags; /* port flags */
|
||||
} mach_port_status_t;
|
||||
|
||||
/* System-wide values for setting queue limits on a port */
|
||||
#define MACH_PORT_QLIMIT_ZERO (0)
|
||||
#define MACH_PORT_QLIMIT_BASIC (5)
|
||||
#define MACH_PORT_QLIMIT_SMALL (16)
|
||||
#define MACH_PORT_QLIMIT_LARGE (1024)
|
||||
#define MACH_PORT_QLIMIT_KERNEL (65534)
|
||||
#define MACH_PORT_QLIMIT_MIN MACH_PORT_QLIMIT_ZERO
|
||||
#define MACH_PORT_QLIMIT_DEFAULT MACH_PORT_QLIMIT_BASIC
|
||||
#define MACH_PORT_QLIMIT_MAX MACH_PORT_QLIMIT_LARGE
|
||||
|
||||
typedef struct mach_port_limits {
|
||||
mach_port_msgcount_t mpl_qlimit; /* number of msgs */
|
||||
} mach_port_limits_t;
|
||||
|
||||
/* Possible values for mps_flags (part of mach_port_status_t) */
|
||||
#define MACH_PORT_STATUS_FLAG_TEMPOWNER 0x01
|
||||
#define MACH_PORT_STATUS_FLAG_GUARDED 0x02
|
||||
#define MACH_PORT_STATUS_FLAG_STRICT_GUARD 0x04
|
||||
#define MACH_PORT_STATUS_FLAG_IMP_DONATION 0x08
|
||||
#define MACH_PORT_STATUS_FLAG_REVIVE 0x10
|
||||
#define MACH_PORT_STATUS_FLAG_TASKPTR 0x20
|
||||
#define MACH_PORT_STATUS_FLAG_GUARD_IMMOVABLE_RECEIVE 0x40
|
||||
#define MACH_PORT_STATUS_FLAG_NO_GRANT 0x80
|
||||
|
||||
typedef struct mach_port_info_ext {
|
||||
mach_port_status_t mpie_status;
|
||||
mach_port_msgcount_t mpie_boost_cnt;
|
||||
uint32_t reserved[6];
|
||||
} mach_port_info_ext_t;
|
||||
|
||||
typedef integer_t *mach_port_info_t; /* varying array of natural_t */
|
||||
|
||||
/* Flavors for mach_port_get/set_attributes() */
|
||||
typedef int mach_port_flavor_t;
|
||||
#define MACH_PORT_LIMITS_INFO 1 /* uses mach_port_limits_t */
|
||||
#define MACH_PORT_RECEIVE_STATUS 2 /* uses mach_port_status_t */
|
||||
#define MACH_PORT_DNREQUESTS_SIZE 3 /* info is int */
|
||||
#define MACH_PORT_TEMPOWNER 4 /* indicates receive right will be reassigned to another task */
|
||||
#define MACH_PORT_IMPORTANCE_RECEIVER 5 /* indicates recieve right accepts priority donation */
|
||||
#define MACH_PORT_DENAP_RECEIVER 6 /* indicates receive right accepts de-nap donation */
|
||||
#define MACH_PORT_INFO_EXT 7 /* uses mach_port_info_ext_t */
|
||||
|
||||
#define MACH_PORT_LIMITS_INFO_COUNT ((natural_t) \
|
||||
(sizeof(mach_port_limits_t)/sizeof(natural_t)))
|
||||
#define MACH_PORT_RECEIVE_STATUS_COUNT ((natural_t) \
|
||||
(sizeof(mach_port_status_t)/sizeof(natural_t)))
|
||||
#define MACH_PORT_DNREQUESTS_SIZE_COUNT 1
|
||||
#define MACH_PORT_INFO_EXT_COUNT ((natural_t) \
|
||||
(sizeof(mach_port_info_ext_t)/sizeof(natural_t)))
|
||||
/*
|
||||
* Structure used to pass information about port allocation requests.
|
||||
* Must be padded to 64-bits total length.
|
||||
*/
|
||||
typedef struct mach_port_qos {
|
||||
unsigned int name:1; /* name given */
|
||||
unsigned int prealloc:1; /* prealloced message */
|
||||
boolean_t pad1:30;
|
||||
natural_t len;
|
||||
} mach_port_qos_t;
|
||||
|
||||
/* Mach Port Guarding definitions */
|
||||
|
||||
/*
|
||||
* Flags for mach_port_options (used for
|
||||
* invocation of mach_port_construct).
|
||||
* Indicates attributes to be set for the newly
|
||||
* allocated port.
|
||||
*/
|
||||
#define MPO_CONTEXT_AS_GUARD 0x01 /* Add guard to the port */
|
||||
#define MPO_QLIMIT 0x02 /* Set qlimit for the port msg queue */
|
||||
#define MPO_TEMPOWNER 0x04 /* Set the tempowner bit of the port */
|
||||
#define MPO_IMPORTANCE_RECEIVER 0x08 /* Mark the port as importance receiver */
|
||||
#define MPO_INSERT_SEND_RIGHT 0x10 /* Insert a send right for the port */
|
||||
#define MPO_STRICT 0x20 /* Apply strict guarding for port */
|
||||
#define MPO_DENAP_RECEIVER 0x40 /* Mark the port as App de-nap receiver */
|
||||
#define MPO_IMMOVABLE_RECEIVE 0x80 /* Mark the port as immovable; protected by the guard context */
|
||||
#define MPO_FILTER_MSG 0x100 /* Allow message filtering */
|
||||
#define MPO_TG_BLOCK_TRACKING 0x200 /* Track blocking relationship for thread group during sync IPC */
|
||||
|
||||
/*
|
||||
* Structure to define optional attributes for a newly
|
||||
* constructed port.
|
||||
*/
|
||||
typedef struct mach_port_options {
|
||||
uint32_t flags; /* Flags defining attributes for port */
|
||||
mach_port_limits_t mpl; /* Message queue limit for port */
|
||||
union {
|
||||
uint64_t reserved[2]; /* Reserved */
|
||||
mach_port_name_t work_interval_port; /* Work interval port */
|
||||
};
|
||||
}mach_port_options_t;
|
||||
|
||||
typedef mach_port_options_t *mach_port_options_ptr_t;
|
||||
|
||||
/*
|
||||
* EXC_GUARD represents a guard violation for both
|
||||
* mach ports and file descriptors. GUARD_TYPE_ is used
|
||||
* to differentiate among them.
|
||||
*/
|
||||
#define GUARD_TYPE_MACH_PORT 0x1
|
||||
|
||||
/* Reasons for exception for a guarded mach port */
|
||||
enum mach_port_guard_exception_codes {
|
||||
kGUARD_EXC_DESTROY = 1u << 0,
|
||||
kGUARD_EXC_MOD_REFS = 1u << 1,
|
||||
kGUARD_EXC_SET_CONTEXT = 1u << 2,
|
||||
kGUARD_EXC_UNGUARDED = 1u << 3,
|
||||
kGUARD_EXC_INCORRECT_GUARD = 1u << 4,
|
||||
kGUARD_EXC_IMMOVABLE = 1u << 5,
|
||||
kGUARD_EXC_STRICT_REPLY = 1u << 6,
|
||||
kGUARD_EXC_MSG_FILTERED = 1u << 7,
|
||||
/* start of [optionally] non-fatal guards */
|
||||
kGUARD_EXC_INVALID_RIGHT = 1u << 8,
|
||||
kGUARD_EXC_INVALID_NAME = 1u << 9,
|
||||
kGUARD_EXC_INVALID_VALUE = 1u << 10,
|
||||
kGUARD_EXC_INVALID_ARGUMENT = 1u << 11,
|
||||
kGUARD_EXC_RIGHT_EXISTS = 1u << 12,
|
||||
kGUARD_EXC_KERN_NO_SPACE = 1u << 13,
|
||||
kGUARD_EXC_KERN_FAILURE = 1u << 14,
|
||||
kGUARD_EXC_KERN_RESOURCE = 1u << 15,
|
||||
kGUARD_EXC_SEND_INVALID_REPLY = 1u << 16,
|
||||
kGUARD_EXC_SEND_INVALID_VOUCHER = 1u << 17,
|
||||
kGUARD_EXC_SEND_INVALID_RIGHT = 1u << 18,
|
||||
kGUARD_EXC_RCV_INVALID_NAME = 1u << 19,
|
||||
kGUARD_EXC_RCV_GUARDED_DESC = 1u << 20, /* should never be fatal; for development only */
|
||||
};
|
||||
|
||||
#define MAX_FATAL_kGUARD_EXC_CODE (1u << 6)
|
||||
|
||||
/*
|
||||
* These flags are used as bits in the subcode of kGUARD_EXC_STRICT_REPLY exceptions.
|
||||
*/
|
||||
#define MPG_FLAGS_STRICT_REPLY_INVALID_REPLY_DISP (0x01ull << 56)
|
||||
#define MPG_FLAGS_STRICT_REPLY_INVALID_REPLY_PORT (0x02ull << 56)
|
||||
#define MPG_FLAGS_STRICT_REPLY_INVALID_VOUCHER (0x04ull << 56)
|
||||
#define MPG_FLAGS_STRICT_REPLY_NO_BANK_ATTR (0x08ull << 56)
|
||||
#define MPG_FLAGS_STRICT_REPLY_MISMATCHED_PERSONA (0x10ull << 56)
|
||||
#define MPG_FLAGS_STRICT_REPLY_MASK (0xffull << 56)
|
||||
|
||||
/*
|
||||
* Flags for mach_port_guard_with_flags. These flags extend
|
||||
* the attributes associated with a guarded port.
|
||||
*/
|
||||
#define MPG_STRICT 0x01 /* Apply strict guarding for a port */
|
||||
#define MPG_IMMOVABLE_RECEIVE 0x02 /* Receive right cannot be moved out of the space */
|
||||
|
||||
#if !__DARWIN_UNIX03 && !defined(_NO_PORT_T_FROM_MACH)
|
||||
/*
|
||||
* Mach 3.0 renamed everything to have mach_ in front of it.
|
||||
* These types and macros are provided for backward compatibility
|
||||
* but are deprecated.
|
||||
*/
|
||||
typedef mach_port_t port_t;
|
||||
typedef mach_port_name_t port_name_t;
|
||||
typedef mach_port_name_t *port_name_array_t;
|
||||
|
||||
#define PORT_NULL ((port_t) 0)
|
||||
#define PORT_DEAD ((port_t) ~0)
|
||||
#define PORT_VALID(name) \
|
||||
((port_t)(name) != PORT_NULL && (port_t)(name) != PORT_DEAD)
|
||||
|
||||
#endif /* !__DARWIN_UNIX03 && !_NO_PORT_T_FROM_MACH */
|
||||
|
||||
#endif /* _MACH_PORT_H_ */
|
||||
585
lib/libc/include/aarch64-macos-gnu/mach/processor_set.h
Normal file
585
lib/libc/include/aarch64-macos-gnu/mach/processor_set.h
Normal file
@ -0,0 +1,585 @@
|
||||
#ifndef _processor_set_user_
|
||||
#define _processor_set_user_
|
||||
|
||||
/* Module processor_set */
|
||||
|
||||
#include <string.h>
|
||||
#include <mach/ndr.h>
|
||||
#include <mach/boolean.h>
|
||||
#include <mach/kern_return.h>
|
||||
#include <mach/notify.h>
|
||||
#include <mach/mach_types.h>
|
||||
#include <mach/message.h>
|
||||
#include <mach/mig_errors.h>
|
||||
#include <mach/port.h>
|
||||
|
||||
/* BEGIN MIG_STRNCPY_ZEROFILL CODE */
|
||||
|
||||
#if defined(__has_include)
|
||||
#if __has_include(<mach/mig_strncpy_zerofill_support.h>)
|
||||
#ifndef USING_MIG_STRNCPY_ZEROFILL
|
||||
#define USING_MIG_STRNCPY_ZEROFILL
|
||||
#endif
|
||||
#ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__
|
||||
#define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
extern int mig_strncpy_zerofill(char *dest, const char *src, int len) __attribute__((weak_import));
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ */
|
||||
#endif /* __has_include(<mach/mig_strncpy_zerofill_support.h>) */
|
||||
#endif /* __has_include */
|
||||
|
||||
/* END MIG_STRNCPY_ZEROFILL CODE */
|
||||
|
||||
|
||||
#ifdef AUTOTEST
|
||||
#ifndef FUNCTION_PTR_T
|
||||
#define FUNCTION_PTR_T
|
||||
typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t);
|
||||
typedef struct {
|
||||
char *name;
|
||||
function_ptr_t function;
|
||||
} function_table_entry;
|
||||
typedef function_table_entry *function_table_t;
|
||||
#endif /* FUNCTION_PTR_T */
|
||||
#endif /* AUTOTEST */
|
||||
|
||||
#ifndef processor_set_MSG_COUNT
|
||||
#define processor_set_MSG_COUNT 11
|
||||
#endif /* processor_set_MSG_COUNT */
|
||||
|
||||
#include <mach/std_types.h>
|
||||
#include <mach/mig.h>
|
||||
#include <mach/mig.h>
|
||||
#include <mach/mach_types.h>
|
||||
|
||||
#ifdef __BeforeMigUserHeader
|
||||
__BeforeMigUserHeader
|
||||
#endif /* __BeforeMigUserHeader */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__BEGIN_DECLS
|
||||
|
||||
|
||||
/* Routine processor_set_statistics */
|
||||
#ifdef mig_external
|
||||
mig_external
|
||||
#else
|
||||
extern
|
||||
#endif /* mig_external */
|
||||
kern_return_t processor_set_statistics
|
||||
(
|
||||
processor_set_name_t pset,
|
||||
processor_set_flavor_t flavor,
|
||||
processor_set_info_t info_out,
|
||||
mach_msg_type_number_t *info_outCnt
|
||||
);
|
||||
|
||||
/* Routine processor_set_destroy */
|
||||
#ifdef mig_external
|
||||
mig_external
|
||||
#else
|
||||
extern
|
||||
#endif /* mig_external */
|
||||
kern_return_t processor_set_destroy
|
||||
(
|
||||
processor_set_t set
|
||||
);
|
||||
|
||||
/* Routine processor_set_max_priority */
|
||||
#ifdef mig_external
|
||||
mig_external
|
||||
#else
|
||||
extern
|
||||
#endif /* mig_external */
|
||||
kern_return_t processor_set_max_priority
|
||||
(
|
||||
processor_set_t processor_set,
|
||||
int max_priority,
|
||||
boolean_t change_threads
|
||||
);
|
||||
|
||||
/* Routine processor_set_policy_enable */
|
||||
#ifdef mig_external
|
||||
mig_external
|
||||
#else
|
||||
extern
|
||||
#endif /* mig_external */
|
||||
kern_return_t processor_set_policy_enable
|
||||
(
|
||||
processor_set_t processor_set,
|
||||
int policy
|
||||
);
|
||||
|
||||
/* Routine processor_set_policy_disable */
|
||||
#ifdef mig_external
|
||||
mig_external
|
||||
#else
|
||||
extern
|
||||
#endif /* mig_external */
|
||||
kern_return_t processor_set_policy_disable
|
||||
(
|
||||
processor_set_t processor_set,
|
||||
int policy,
|
||||
boolean_t change_threads
|
||||
);
|
||||
|
||||
/* Routine processor_set_tasks */
|
||||
#ifdef mig_external
|
||||
mig_external
|
||||
#else
|
||||
extern
|
||||
#endif /* mig_external */
|
||||
kern_return_t processor_set_tasks
|
||||
(
|
||||
processor_set_t processor_set,
|
||||
task_array_t *task_list,
|
||||
mach_msg_type_number_t *task_listCnt
|
||||
);
|
||||
|
||||
/* Routine processor_set_threads */
|
||||
#ifdef mig_external
|
||||
mig_external
|
||||
#else
|
||||
extern
|
||||
#endif /* mig_external */
|
||||
kern_return_t processor_set_threads
|
||||
(
|
||||
processor_set_t processor_set,
|
||||
thread_act_array_t *thread_list,
|
||||
mach_msg_type_number_t *thread_listCnt
|
||||
);
|
||||
|
||||
/* Routine processor_set_policy_control */
|
||||
#ifdef mig_external
|
||||
mig_external
|
||||
#else
|
||||
extern
|
||||
#endif /* mig_external */
|
||||
kern_return_t processor_set_policy_control
|
||||
(
|
||||
processor_set_t pset,
|
||||
processor_set_flavor_t flavor,
|
||||
processor_set_info_t policy_info,
|
||||
mach_msg_type_number_t policy_infoCnt,
|
||||
boolean_t change
|
||||
);
|
||||
|
||||
/* Routine processor_set_stack_usage */
|
||||
#ifdef mig_external
|
||||
mig_external
|
||||
#else
|
||||
extern
|
||||
#endif /* mig_external */
|
||||
kern_return_t processor_set_stack_usage
|
||||
(
|
||||
processor_set_t pset,
|
||||
unsigned *ltotal,
|
||||
vm_size_t *space,
|
||||
vm_size_t *resident,
|
||||
vm_size_t *maxusage,
|
||||
vm_offset_t *maxstack
|
||||
);
|
||||
|
||||
/* Routine processor_set_info */
|
||||
#ifdef mig_external
|
||||
mig_external
|
||||
#else
|
||||
extern
|
||||
#endif /* mig_external */
|
||||
kern_return_t processor_set_info
|
||||
(
|
||||
processor_set_name_t set_name,
|
||||
int flavor,
|
||||
host_t *host,
|
||||
processor_set_info_t info_out,
|
||||
mach_msg_type_number_t *info_outCnt
|
||||
);
|
||||
|
||||
/* Routine processor_set_tasks_with_flavor */
|
||||
#ifdef mig_external
|
||||
mig_external
|
||||
#else
|
||||
extern
|
||||
#endif /* mig_external */
|
||||
kern_return_t processor_set_tasks_with_flavor
|
||||
(
|
||||
processor_set_t processor_set,
|
||||
mach_task_flavor_t flavor,
|
||||
task_array_t *task_list,
|
||||
mach_msg_type_number_t *task_listCnt
|
||||
);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
/********************** Caution **************************/
|
||||
/* The following data types should be used to calculate */
|
||||
/* maximum message sizes only. The actual message may be */
|
||||
/* smaller, and the position of the arguments within the */
|
||||
/* message layout may vary from what is presented here. */
|
||||
/* For example, if any of the arguments are variable- */
|
||||
/* sized, and less than the maximum is sent, the data */
|
||||
/* will be packed tight in the actual message to reduce */
|
||||
/* the presence of holes. */
|
||||
/********************** Caution **************************/
|
||||
|
||||
/* typedefs for all requests */
|
||||
|
||||
#ifndef __Request__processor_set_subsystem__defined
|
||||
#define __Request__processor_set_subsystem__defined
|
||||
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(push, 4)
|
||||
#endif
|
||||
typedef struct {
|
||||
mach_msg_header_t Head;
|
||||
NDR_record_t NDR;
|
||||
processor_set_flavor_t flavor;
|
||||
mach_msg_type_number_t info_outCnt;
|
||||
} __Request__processor_set_statistics_t __attribute__((unused));
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(push, 4)
|
||||
#endif
|
||||
typedef struct {
|
||||
mach_msg_header_t Head;
|
||||
} __Request__processor_set_destroy_t __attribute__((unused));
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(push, 4)
|
||||
#endif
|
||||
typedef struct {
|
||||
mach_msg_header_t Head;
|
||||
NDR_record_t NDR;
|
||||
int max_priority;
|
||||
boolean_t change_threads;
|
||||
} __Request__processor_set_max_priority_t __attribute__((unused));
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(push, 4)
|
||||
#endif
|
||||
typedef struct {
|
||||
mach_msg_header_t Head;
|
||||
NDR_record_t NDR;
|
||||
int policy;
|
||||
} __Request__processor_set_policy_enable_t __attribute__((unused));
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(push, 4)
|
||||
#endif
|
||||
typedef struct {
|
||||
mach_msg_header_t Head;
|
||||
NDR_record_t NDR;
|
||||
int policy;
|
||||
boolean_t change_threads;
|
||||
} __Request__processor_set_policy_disable_t __attribute__((unused));
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(push, 4)
|
||||
#endif
|
||||
typedef struct {
|
||||
mach_msg_header_t Head;
|
||||
} __Request__processor_set_tasks_t __attribute__((unused));
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(push, 4)
|
||||
#endif
|
||||
typedef struct {
|
||||
mach_msg_header_t Head;
|
||||
} __Request__processor_set_threads_t __attribute__((unused));
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(push, 4)
|
||||
#endif
|
||||
typedef struct {
|
||||
mach_msg_header_t Head;
|
||||
NDR_record_t NDR;
|
||||
processor_set_flavor_t flavor;
|
||||
mach_msg_type_number_t policy_infoCnt;
|
||||
integer_t policy_info[5];
|
||||
boolean_t change;
|
||||
} __Request__processor_set_policy_control_t __attribute__((unused));
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(push, 4)
|
||||
#endif
|
||||
typedef struct {
|
||||
mach_msg_header_t Head;
|
||||
} __Request__processor_set_stack_usage_t __attribute__((unused));
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(push, 4)
|
||||
#endif
|
||||
typedef struct {
|
||||
mach_msg_header_t Head;
|
||||
NDR_record_t NDR;
|
||||
int flavor;
|
||||
mach_msg_type_number_t info_outCnt;
|
||||
} __Request__processor_set_info_t __attribute__((unused));
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(push, 4)
|
||||
#endif
|
||||
typedef struct {
|
||||
mach_msg_header_t Head;
|
||||
NDR_record_t NDR;
|
||||
mach_task_flavor_t flavor;
|
||||
} __Request__processor_set_tasks_with_flavor_t __attribute__((unused));
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
#endif /* !__Request__processor_set_subsystem__defined */
|
||||
|
||||
/* union of all requests */
|
||||
|
||||
#ifndef __RequestUnion__processor_set_subsystem__defined
|
||||
#define __RequestUnion__processor_set_subsystem__defined
|
||||
union __RequestUnion__processor_set_subsystem {
|
||||
__Request__processor_set_statistics_t Request_processor_set_statistics;
|
||||
__Request__processor_set_destroy_t Request_processor_set_destroy;
|
||||
__Request__processor_set_max_priority_t Request_processor_set_max_priority;
|
||||
__Request__processor_set_policy_enable_t Request_processor_set_policy_enable;
|
||||
__Request__processor_set_policy_disable_t Request_processor_set_policy_disable;
|
||||
__Request__processor_set_tasks_t Request_processor_set_tasks;
|
||||
__Request__processor_set_threads_t Request_processor_set_threads;
|
||||
__Request__processor_set_policy_control_t Request_processor_set_policy_control;
|
||||
__Request__processor_set_stack_usage_t Request_processor_set_stack_usage;
|
||||
__Request__processor_set_info_t Request_processor_set_info;
|
||||
__Request__processor_set_tasks_with_flavor_t Request_processor_set_tasks_with_flavor;
|
||||
};
|
||||
#endif /* !__RequestUnion__processor_set_subsystem__defined */
|
||||
/* typedefs for all replies */
|
||||
|
||||
#ifndef __Reply__processor_set_subsystem__defined
|
||||
#define __Reply__processor_set_subsystem__defined
|
||||
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(push, 4)
|
||||
#endif
|
||||
typedef struct {
|
||||
mach_msg_header_t Head;
|
||||
NDR_record_t NDR;
|
||||
kern_return_t RetCode;
|
||||
mach_msg_type_number_t info_outCnt;
|
||||
integer_t info_out[5];
|
||||
} __Reply__processor_set_statistics_t __attribute__((unused));
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(push, 4)
|
||||
#endif
|
||||
typedef struct {
|
||||
mach_msg_header_t Head;
|
||||
NDR_record_t NDR;
|
||||
kern_return_t RetCode;
|
||||
} __Reply__processor_set_destroy_t __attribute__((unused));
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(push, 4)
|
||||
#endif
|
||||
typedef struct {
|
||||
mach_msg_header_t Head;
|
||||
NDR_record_t NDR;
|
||||
kern_return_t RetCode;
|
||||
} __Reply__processor_set_max_priority_t __attribute__((unused));
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(push, 4)
|
||||
#endif
|
||||
typedef struct {
|
||||
mach_msg_header_t Head;
|
||||
NDR_record_t NDR;
|
||||
kern_return_t RetCode;
|
||||
} __Reply__processor_set_policy_enable_t __attribute__((unused));
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(push, 4)
|
||||
#endif
|
||||
typedef struct {
|
||||
mach_msg_header_t Head;
|
||||
NDR_record_t NDR;
|
||||
kern_return_t RetCode;
|
||||
} __Reply__processor_set_policy_disable_t __attribute__((unused));
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(push, 4)
|
||||
#endif
|
||||
typedef struct {
|
||||
mach_msg_header_t Head;
|
||||
/* start of the kernel processed data */
|
||||
mach_msg_body_t msgh_body;
|
||||
mach_msg_ool_ports_descriptor_t task_list;
|
||||
/* end of the kernel processed data */
|
||||
NDR_record_t NDR;
|
||||
mach_msg_type_number_t task_listCnt;
|
||||
} __Reply__processor_set_tasks_t __attribute__((unused));
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(push, 4)
|
||||
#endif
|
||||
typedef struct {
|
||||
mach_msg_header_t Head;
|
||||
/* start of the kernel processed data */
|
||||
mach_msg_body_t msgh_body;
|
||||
mach_msg_ool_ports_descriptor_t thread_list;
|
||||
/* end of the kernel processed data */
|
||||
NDR_record_t NDR;
|
||||
mach_msg_type_number_t thread_listCnt;
|
||||
} __Reply__processor_set_threads_t __attribute__((unused));
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(push, 4)
|
||||
#endif
|
||||
typedef struct {
|
||||
mach_msg_header_t Head;
|
||||
NDR_record_t NDR;
|
||||
kern_return_t RetCode;
|
||||
} __Reply__processor_set_policy_control_t __attribute__((unused));
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(push, 4)
|
||||
#endif
|
||||
typedef struct {
|
||||
mach_msg_header_t Head;
|
||||
NDR_record_t NDR;
|
||||
kern_return_t RetCode;
|
||||
unsigned ltotal;
|
||||
vm_size_t space;
|
||||
vm_size_t resident;
|
||||
vm_size_t maxusage;
|
||||
vm_offset_t maxstack;
|
||||
} __Reply__processor_set_stack_usage_t __attribute__((unused));
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(push, 4)
|
||||
#endif
|
||||
typedef struct {
|
||||
mach_msg_header_t Head;
|
||||
/* start of the kernel processed data */
|
||||
mach_msg_body_t msgh_body;
|
||||
mach_msg_port_descriptor_t host;
|
||||
/* end of the kernel processed data */
|
||||
NDR_record_t NDR;
|
||||
mach_msg_type_number_t info_outCnt;
|
||||
integer_t info_out[5];
|
||||
} __Reply__processor_set_info_t __attribute__((unused));
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(push, 4)
|
||||
#endif
|
||||
typedef struct {
|
||||
mach_msg_header_t Head;
|
||||
/* start of the kernel processed data */
|
||||
mach_msg_body_t msgh_body;
|
||||
mach_msg_ool_ports_descriptor_t task_list;
|
||||
/* end of the kernel processed data */
|
||||
NDR_record_t NDR;
|
||||
mach_msg_type_number_t task_listCnt;
|
||||
} __Reply__processor_set_tasks_with_flavor_t __attribute__((unused));
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
#endif /* !__Reply__processor_set_subsystem__defined */
|
||||
|
||||
/* union of all replies */
|
||||
|
||||
#ifndef __ReplyUnion__processor_set_subsystem__defined
|
||||
#define __ReplyUnion__processor_set_subsystem__defined
|
||||
union __ReplyUnion__processor_set_subsystem {
|
||||
__Reply__processor_set_statistics_t Reply_processor_set_statistics;
|
||||
__Reply__processor_set_destroy_t Reply_processor_set_destroy;
|
||||
__Reply__processor_set_max_priority_t Reply_processor_set_max_priority;
|
||||
__Reply__processor_set_policy_enable_t Reply_processor_set_policy_enable;
|
||||
__Reply__processor_set_policy_disable_t Reply_processor_set_policy_disable;
|
||||
__Reply__processor_set_tasks_t Reply_processor_set_tasks;
|
||||
__Reply__processor_set_threads_t Reply_processor_set_threads;
|
||||
__Reply__processor_set_policy_control_t Reply_processor_set_policy_control;
|
||||
__Reply__processor_set_stack_usage_t Reply_processor_set_stack_usage;
|
||||
__Reply__processor_set_info_t Reply_processor_set_info;
|
||||
__Reply__processor_set_tasks_with_flavor_t Reply_processor_set_tasks_with_flavor;
|
||||
};
|
||||
#endif /* !__RequestUnion__processor_set_subsystem__defined */
|
||||
|
||||
#ifndef subsystem_to_name_map_processor_set
|
||||
#define subsystem_to_name_map_processor_set \
|
||||
{ "processor_set_statistics", 4000 },\
|
||||
{ "processor_set_destroy", 4001 },\
|
||||
{ "processor_set_max_priority", 4002 },\
|
||||
{ "processor_set_policy_enable", 4003 },\
|
||||
{ "processor_set_policy_disable", 4004 },\
|
||||
{ "processor_set_tasks", 4005 },\
|
||||
{ "processor_set_threads", 4006 },\
|
||||
{ "processor_set_policy_control", 4007 },\
|
||||
{ "processor_set_stack_usage", 4008 },\
|
||||
{ "processor_set_info", 4009 },\
|
||||
{ "processor_set_tasks_with_flavor", 4010 }
|
||||
#endif
|
||||
|
||||
#ifdef __AfterMigUserHeader
|
||||
__AfterMigUserHeader
|
||||
#endif /* __AfterMigUserHeader */
|
||||
|
||||
#endif /* _processor_set_user_ */
|
||||
2523
lib/libc/include/aarch64-macos-gnu/mach/task.h
Normal file
2523
lib/libc/include/aarch64-macos-gnu/mach/task.h
Normal file
File diff suppressed because it is too large
Load Diff
524
lib/libc/include/aarch64-macos-gnu/mach/task_info.h
Normal file
524
lib/libc/include/aarch64-macos-gnu/mach/task_info.h
Normal file
@ -0,0 +1,524 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2007, 2015 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/*
|
||||
* @OSF_COPYRIGHT@
|
||||
*/
|
||||
/*
|
||||
* Mach Operating System
|
||||
* Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission to use, copy, modify and distribute this software and its
|
||||
* documentation is hereby granted, provided that both the copyright
|
||||
* notice and this permission notice appear in all copies of the
|
||||
* software, derivative works or modified versions, and any portions
|
||||
* thereof, and that both notices appear in supporting documentation.
|
||||
*
|
||||
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
||||
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
|
||||
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
||||
*
|
||||
* Carnegie Mellon requests users of this software to return to
|
||||
*
|
||||
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
||||
* School of Computer Science
|
||||
* Carnegie Mellon University
|
||||
* Pittsburgh PA 15213-3890
|
||||
*
|
||||
* any improvements or extensions that they make and grant Carnegie Mellon
|
||||
* the rights to redistribute these changes.
|
||||
*/
|
||||
/*
|
||||
* Machine-independent task information structures and definitions.
|
||||
*
|
||||
* The definitions in this file are exported to the user. The kernel
|
||||
* will translate its internal data structures to these structures
|
||||
* as appropriate.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _MACH_TASK_INFO_H_
|
||||
#define _MACH_TASK_INFO_H_
|
||||
|
||||
#include <mach/message.h>
|
||||
#include <mach/machine/vm_types.h>
|
||||
#include <mach/time_value.h>
|
||||
#include <mach/policy.h>
|
||||
#include <mach/vm_statistics.h> /* for vm_extmod_statistics_data_t */
|
||||
#include <Availability.h>
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
/*
|
||||
* Generic information structure to allow for expansion.
|
||||
*/
|
||||
typedef natural_t task_flavor_t;
|
||||
typedef integer_t *task_info_t; /* varying array of int */
|
||||
|
||||
/* Deprecated, use per structure _data_t's instead */
|
||||
#define TASK_INFO_MAX (1024) /* maximum array size */
|
||||
typedef integer_t task_info_data_t[TASK_INFO_MAX];
|
||||
|
||||
/*
|
||||
* Currently defined information structures.
|
||||
*/
|
||||
|
||||
#pragma pack(push, 4)
|
||||
|
||||
/* Don't use this, use MACH_TASK_BASIC_INFO instead */
|
||||
#define TASK_BASIC_INFO_32 4 /* basic information */
|
||||
#define TASK_BASIC2_INFO_32 6
|
||||
|
||||
struct task_basic_info_32 {
|
||||
integer_t suspend_count; /* suspend count for task */
|
||||
natural_t virtual_size; /* virtual memory size (bytes) */
|
||||
natural_t resident_size; /* resident memory size (bytes) */
|
||||
time_value_t user_time; /* total user run time for
|
||||
* terminated threads */
|
||||
time_value_t system_time; /* total system run time for
|
||||
* terminated threads */
|
||||
policy_t policy; /* default policy for new threads */
|
||||
};
|
||||
typedef struct task_basic_info_32 task_basic_info_32_data_t;
|
||||
typedef struct task_basic_info_32 *task_basic_info_32_t;
|
||||
#define TASK_BASIC_INFO_32_COUNT \
|
||||
(sizeof(task_basic_info_32_data_t) / sizeof(natural_t))
|
||||
|
||||
/* Don't use this, use MACH_TASK_BASIC_INFO instead */
|
||||
struct task_basic_info_64 {
|
||||
integer_t suspend_count; /* suspend count for task */
|
||||
#if defined(__arm__) || defined(__arm64__)
|
||||
mach_vm_size_t virtual_size; /* virtual memory size (bytes) */
|
||||
mach_vm_size_t resident_size; /* resident memory size (bytes) */
|
||||
#else /* defined(__arm__) || defined(__arm64__) */
|
||||
mach_vm_size_t virtual_size; /* virtual memory size (bytes) */
|
||||
mach_vm_size_t resident_size; /* resident memory size (bytes) */
|
||||
#endif /* defined(__arm__) || defined(__arm64__) */
|
||||
time_value_t user_time; /* total user run time for
|
||||
* terminated threads */
|
||||
time_value_t system_time; /* total system run time for
|
||||
* terminated threads */
|
||||
policy_t policy; /* default policy for new threads */
|
||||
};
|
||||
typedef struct task_basic_info_64 task_basic_info_64_data_t;
|
||||
typedef struct task_basic_info_64 *task_basic_info_64_t;
|
||||
|
||||
#if defined(__arm__) || defined(__arm64__)
|
||||
#if defined(__arm__) && defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && (__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_5_0)
|
||||
/*
|
||||
* Note: arm64 can't use the old flavor. If you somehow manage to,
|
||||
* you can cope with the nonsense data yourself.
|
||||
*/
|
||||
#define TASK_BASIC_INFO_64 5
|
||||
#define TASK_BASIC_INFO_64_COUNT \
|
||||
(sizeof(task_basic_info_64_data_t) / sizeof(natural_t))
|
||||
|
||||
#else
|
||||
|
||||
#define TASK_BASIC_INFO_64 TASK_BASIC_INFO_64_2
|
||||
#define TASK_BASIC_INFO_64_COUNT TASK_BASIC_INFO_64_2_COUNT
|
||||
#endif
|
||||
#else /* defined(__arm__) || defined(__arm64__) */
|
||||
#define TASK_BASIC_INFO_64 5 /* 64-bit capable basic info */
|
||||
#define TASK_BASIC_INFO_64_COUNT \
|
||||
(sizeof(task_basic_info_64_data_t) / sizeof(natural_t))
|
||||
#endif
|
||||
|
||||
|
||||
/* localized structure - cannot be safely passed between tasks of differing sizes */
|
||||
/* Don't use this, use MACH_TASK_BASIC_INFO instead */
|
||||
struct task_basic_info {
|
||||
integer_t suspend_count; /* suspend count for task */
|
||||
vm_size_t virtual_size; /* virtual memory size (bytes) */
|
||||
vm_size_t resident_size; /* resident memory size (bytes) */
|
||||
time_value_t user_time; /* total user run time for
|
||||
* terminated threads */
|
||||
time_value_t system_time; /* total system run time for
|
||||
* terminated threads */
|
||||
policy_t policy; /* default policy for new threads */
|
||||
};
|
||||
|
||||
typedef struct task_basic_info task_basic_info_data_t;
|
||||
typedef struct task_basic_info *task_basic_info_t;
|
||||
#define TASK_BASIC_INFO_COUNT \
|
||||
(sizeof(task_basic_info_data_t) / sizeof(natural_t))
|
||||
#if !defined(__LP64__)
|
||||
#define TASK_BASIC_INFO TASK_BASIC_INFO_32
|
||||
#else
|
||||
#define TASK_BASIC_INFO TASK_BASIC_INFO_64
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#define TASK_EVENTS_INFO 2 /* various event counts */
|
||||
|
||||
struct task_events_info {
|
||||
integer_t faults; /* number of page faults */
|
||||
integer_t pageins; /* number of actual pageins */
|
||||
integer_t cow_faults; /* number of copy-on-write faults */
|
||||
integer_t messages_sent; /* number of messages sent */
|
||||
integer_t messages_received; /* number of messages received */
|
||||
integer_t syscalls_mach; /* number of mach system calls */
|
||||
integer_t syscalls_unix; /* number of unix system calls */
|
||||
integer_t csw; /* number of context switches */
|
||||
};
|
||||
typedef struct task_events_info task_events_info_data_t;
|
||||
typedef struct task_events_info *task_events_info_t;
|
||||
#define TASK_EVENTS_INFO_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof(task_events_info_data_t) / sizeof(natural_t)))
|
||||
|
||||
#define TASK_THREAD_TIMES_INFO 3 /* total times for live threads -
|
||||
* only accurate if suspended */
|
||||
|
||||
struct task_thread_times_info {
|
||||
time_value_t user_time; /* total user run time for
|
||||
* live threads */
|
||||
time_value_t system_time; /* total system run time for
|
||||
* live threads */
|
||||
};
|
||||
|
||||
typedef struct task_thread_times_info task_thread_times_info_data_t;
|
||||
typedef struct task_thread_times_info *task_thread_times_info_t;
|
||||
#define TASK_THREAD_TIMES_INFO_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof(task_thread_times_info_data_t) / sizeof(natural_t)))
|
||||
|
||||
#define TASK_ABSOLUTETIME_INFO 1
|
||||
|
||||
struct task_absolutetime_info {
|
||||
uint64_t total_user;
|
||||
uint64_t total_system;
|
||||
uint64_t threads_user; /* existing threads only */
|
||||
uint64_t threads_system;
|
||||
};
|
||||
|
||||
typedef struct task_absolutetime_info task_absolutetime_info_data_t;
|
||||
typedef struct task_absolutetime_info *task_absolutetime_info_t;
|
||||
#define TASK_ABSOLUTETIME_INFO_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof (task_absolutetime_info_data_t) / sizeof (natural_t)))
|
||||
|
||||
#define TASK_KERNELMEMORY_INFO 7
|
||||
|
||||
struct task_kernelmemory_info {
|
||||
uint64_t total_palloc; /* private kernel mem alloc'ed */
|
||||
uint64_t total_pfree; /* private kernel mem freed */
|
||||
uint64_t total_salloc; /* shared kernel mem alloc'ed */
|
||||
uint64_t total_sfree; /* shared kernel mem freed */
|
||||
};
|
||||
|
||||
typedef struct task_kernelmemory_info task_kernelmemory_info_data_t;
|
||||
typedef struct task_kernelmemory_info *task_kernelmemory_info_t;
|
||||
#define TASK_KERNELMEMORY_INFO_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof (task_kernelmemory_info_data_t) / sizeof (natural_t)))
|
||||
|
||||
#define TASK_SECURITY_TOKEN 13
|
||||
#define TASK_SECURITY_TOKEN_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof(security_token_t) / sizeof(natural_t)))
|
||||
|
||||
#define TASK_AUDIT_TOKEN 15
|
||||
#define TASK_AUDIT_TOKEN_COUNT \
|
||||
(sizeof(audit_token_t) / sizeof(natural_t))
|
||||
|
||||
|
||||
#define TASK_AFFINITY_TAG_INFO 16 /* This is experimental. */
|
||||
|
||||
struct task_affinity_tag_info {
|
||||
integer_t set_count;
|
||||
integer_t min;
|
||||
integer_t max;
|
||||
integer_t task_count;
|
||||
};
|
||||
typedef struct task_affinity_tag_info task_affinity_tag_info_data_t;
|
||||
typedef struct task_affinity_tag_info *task_affinity_tag_info_t;
|
||||
#define TASK_AFFINITY_TAG_INFO_COUNT \
|
||||
(sizeof(task_affinity_tag_info_data_t) / sizeof(natural_t))
|
||||
|
||||
#define TASK_DYLD_INFO 17
|
||||
|
||||
struct task_dyld_info {
|
||||
mach_vm_address_t all_image_info_addr;
|
||||
mach_vm_size_t all_image_info_size;
|
||||
integer_t all_image_info_format;
|
||||
};
|
||||
typedef struct task_dyld_info task_dyld_info_data_t;
|
||||
typedef struct task_dyld_info *task_dyld_info_t;
|
||||
#define TASK_DYLD_INFO_COUNT \
|
||||
(sizeof(task_dyld_info_data_t) / sizeof(natural_t))
|
||||
#define TASK_DYLD_ALL_IMAGE_INFO_32 0 /* format value */
|
||||
#define TASK_DYLD_ALL_IMAGE_INFO_64 1 /* format value */
|
||||
|
||||
#if defined(__arm__) || defined(__arm64__)
|
||||
|
||||
/* Don't use this, use MACH_TASK_BASIC_INFO instead */
|
||||
/* Compatibility for old 32-bit mach_vm_*_t */
|
||||
#define TASK_BASIC_INFO_64_2 18 /* 64-bit capable basic info */
|
||||
|
||||
struct task_basic_info_64_2 {
|
||||
integer_t suspend_count; /* suspend count for task */
|
||||
mach_vm_size_t virtual_size; /* virtual memory size (bytes) */
|
||||
mach_vm_size_t resident_size; /* resident memory size (bytes) */
|
||||
time_value_t user_time; /* total user run time for
|
||||
* terminated threads */
|
||||
time_value_t system_time; /* total system run time for
|
||||
* terminated threads */
|
||||
policy_t policy; /* default policy for new threads */
|
||||
};
|
||||
typedef struct task_basic_info_64_2 task_basic_info_64_2_data_t;
|
||||
typedef struct task_basic_info_64_2 *task_basic_info_64_2_t;
|
||||
#define TASK_BASIC_INFO_64_2_COUNT \
|
||||
(sizeof(task_basic_info_64_2_data_t) / sizeof(natural_t))
|
||||
#endif
|
||||
|
||||
#define TASK_EXTMOD_INFO 19
|
||||
|
||||
struct task_extmod_info {
|
||||
unsigned char task_uuid[16];
|
||||
vm_extmod_statistics_data_t extmod_statistics;
|
||||
};
|
||||
typedef struct task_extmod_info task_extmod_info_data_t;
|
||||
typedef struct task_extmod_info *task_extmod_info_t;
|
||||
#define TASK_EXTMOD_INFO_COUNT \
|
||||
(sizeof(task_extmod_info_data_t) / sizeof(natural_t))
|
||||
|
||||
|
||||
#define MACH_TASK_BASIC_INFO 20 /* always 64-bit basic info */
|
||||
struct mach_task_basic_info {
|
||||
mach_vm_size_t virtual_size; /* virtual memory size (bytes) */
|
||||
mach_vm_size_t resident_size; /* resident memory size (bytes) */
|
||||
mach_vm_size_t resident_size_max; /* maximum resident memory size (bytes) */
|
||||
time_value_t user_time; /* total user run time for
|
||||
* terminated threads */
|
||||
time_value_t system_time; /* total system run time for
|
||||
* terminated threads */
|
||||
policy_t policy; /* default policy for new threads */
|
||||
integer_t suspend_count; /* suspend count for task */
|
||||
};
|
||||
typedef struct mach_task_basic_info mach_task_basic_info_data_t;
|
||||
typedef struct mach_task_basic_info *mach_task_basic_info_t;
|
||||
#define MACH_TASK_BASIC_INFO_COUNT \
|
||||
(sizeof(mach_task_basic_info_data_t) / sizeof(natural_t))
|
||||
|
||||
|
||||
#define TASK_POWER_INFO 21
|
||||
|
||||
struct task_power_info {
|
||||
uint64_t total_user;
|
||||
uint64_t total_system;
|
||||
uint64_t task_interrupt_wakeups;
|
||||
uint64_t task_platform_idle_wakeups;
|
||||
uint64_t task_timer_wakeups_bin_1;
|
||||
uint64_t task_timer_wakeups_bin_2;
|
||||
};
|
||||
|
||||
typedef struct task_power_info task_power_info_data_t;
|
||||
typedef struct task_power_info *task_power_info_t;
|
||||
#define TASK_POWER_INFO_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof (task_power_info_data_t) / sizeof (natural_t)))
|
||||
|
||||
|
||||
|
||||
#define TASK_VM_INFO 22
|
||||
#define TASK_VM_INFO_PURGEABLE 23
|
||||
struct task_vm_info {
|
||||
mach_vm_size_t virtual_size; /* virtual memory size (bytes) */
|
||||
integer_t region_count; /* number of memory regions */
|
||||
integer_t page_size;
|
||||
mach_vm_size_t resident_size; /* resident memory size (bytes) */
|
||||
mach_vm_size_t resident_size_peak; /* peak resident size (bytes) */
|
||||
|
||||
mach_vm_size_t device;
|
||||
mach_vm_size_t device_peak;
|
||||
mach_vm_size_t internal;
|
||||
mach_vm_size_t internal_peak;
|
||||
mach_vm_size_t external;
|
||||
mach_vm_size_t external_peak;
|
||||
mach_vm_size_t reusable;
|
||||
mach_vm_size_t reusable_peak;
|
||||
mach_vm_size_t purgeable_volatile_pmap;
|
||||
mach_vm_size_t purgeable_volatile_resident;
|
||||
mach_vm_size_t purgeable_volatile_virtual;
|
||||
mach_vm_size_t compressed;
|
||||
mach_vm_size_t compressed_peak;
|
||||
mach_vm_size_t compressed_lifetime;
|
||||
|
||||
/* added for rev1 */
|
||||
mach_vm_size_t phys_footprint;
|
||||
|
||||
/* added for rev2 */
|
||||
mach_vm_address_t min_address;
|
||||
mach_vm_address_t max_address;
|
||||
|
||||
/* added for rev3 */
|
||||
int64_t ledger_phys_footprint_peak;
|
||||
int64_t ledger_purgeable_nonvolatile;
|
||||
int64_t ledger_purgeable_novolatile_compressed;
|
||||
int64_t ledger_purgeable_volatile;
|
||||
int64_t ledger_purgeable_volatile_compressed;
|
||||
int64_t ledger_tag_network_nonvolatile;
|
||||
int64_t ledger_tag_network_nonvolatile_compressed;
|
||||
int64_t ledger_tag_network_volatile;
|
||||
int64_t ledger_tag_network_volatile_compressed;
|
||||
int64_t ledger_tag_media_footprint;
|
||||
int64_t ledger_tag_media_footprint_compressed;
|
||||
int64_t ledger_tag_media_nofootprint;
|
||||
int64_t ledger_tag_media_nofootprint_compressed;
|
||||
int64_t ledger_tag_graphics_footprint;
|
||||
int64_t ledger_tag_graphics_footprint_compressed;
|
||||
int64_t ledger_tag_graphics_nofootprint;
|
||||
int64_t ledger_tag_graphics_nofootprint_compressed;
|
||||
int64_t ledger_tag_neural_footprint;
|
||||
int64_t ledger_tag_neural_footprint_compressed;
|
||||
int64_t ledger_tag_neural_nofootprint;
|
||||
int64_t ledger_tag_neural_nofootprint_compressed;
|
||||
|
||||
/* added for rev4 */
|
||||
uint64_t limit_bytes_remaining;
|
||||
|
||||
/* added for rev5 */
|
||||
integer_t decompressions;
|
||||
};
|
||||
typedef struct task_vm_info task_vm_info_data_t;
|
||||
typedef struct task_vm_info *task_vm_info_t;
|
||||
#define TASK_VM_INFO_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof (task_vm_info_data_t) / sizeof (natural_t)))
|
||||
#define TASK_VM_INFO_REV5_COUNT TASK_VM_INFO_COUNT
|
||||
#define TASK_VM_INFO_REV4_COUNT /* doesn't include decompressions */ \
|
||||
((mach_msg_type_number_t) (TASK_VM_INFO_REV5_COUNT - 1))
|
||||
#define TASK_VM_INFO_REV3_COUNT /* doesn't include limit bytes */ \
|
||||
((mach_msg_type_number_t) (TASK_VM_INFO_REV4_COUNT - 2))
|
||||
#define TASK_VM_INFO_REV2_COUNT /* doesn't include extra ledgers info */ \
|
||||
((mach_msg_type_number_t) (TASK_VM_INFO_REV3_COUNT - 42))
|
||||
#define TASK_VM_INFO_REV1_COUNT /* doesn't include min and max address */ \
|
||||
((mach_msg_type_number_t) (TASK_VM_INFO_REV2_COUNT - 4))
|
||||
#define TASK_VM_INFO_REV0_COUNT /* doesn't include phys_footprint */ \
|
||||
((mach_msg_type_number_t) (TASK_VM_INFO_REV1_COUNT - 2))
|
||||
|
||||
typedef struct vm_purgeable_info task_purgable_info_t;
|
||||
|
||||
|
||||
#define TASK_TRACE_MEMORY_INFO 24 /* no longer supported */
|
||||
struct task_trace_memory_info {
|
||||
uint64_t user_memory_address; /* address of start of trace memory buffer */
|
||||
uint64_t buffer_size; /* size of buffer in bytes */
|
||||
uint64_t mailbox_array_size; /* size of mailbox area in bytes */
|
||||
};
|
||||
typedef struct task_trace_memory_info task_trace_memory_info_data_t;
|
||||
typedef struct task_trace_memory_info * task_trace_memory_info_t;
|
||||
#define TASK_TRACE_MEMORY_INFO_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof(task_trace_memory_info_data_t) / sizeof(natural_t)))
|
||||
|
||||
#define TASK_WAIT_STATE_INFO 25 /* deprecated. */
|
||||
struct task_wait_state_info {
|
||||
uint64_t total_wait_state_time; /* Time that all threads past and present have been in a wait state */
|
||||
uint64_t total_wait_sfi_state_time; /* Time that threads have been in SFI wait (should be a subset of total wait state time */
|
||||
uint32_t _reserved[4];
|
||||
};
|
||||
typedef struct task_wait_state_info task_wait_state_info_data_t;
|
||||
typedef struct task_wait_state_info * task_wait_state_info_t;
|
||||
#define TASK_WAIT_STATE_INFO_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof(task_wait_state_info_data_t) / sizeof(natural_t)))
|
||||
|
||||
#define TASK_POWER_INFO_V2 26
|
||||
|
||||
typedef struct {
|
||||
uint64_t task_gpu_utilisation;
|
||||
uint64_t task_gpu_stat_reserved0;
|
||||
uint64_t task_gpu_stat_reserved1;
|
||||
uint64_t task_gpu_stat_reserved2;
|
||||
} gpu_energy_data;
|
||||
|
||||
typedef gpu_energy_data *gpu_energy_data_t;
|
||||
struct task_power_info_v2 {
|
||||
task_power_info_data_t cpu_energy;
|
||||
gpu_energy_data gpu_energy;
|
||||
#if defined(__arm__) || defined(__arm64__)
|
||||
uint64_t task_energy;
|
||||
#endif /* defined(__arm__) || defined(__arm64__) */
|
||||
uint64_t task_ptime;
|
||||
uint64_t task_pset_switches;
|
||||
};
|
||||
|
||||
typedef struct task_power_info_v2 task_power_info_v2_data_t;
|
||||
typedef struct task_power_info_v2 *task_power_info_v2_t;
|
||||
#define TASK_POWER_INFO_V2_COUNT_OLD \
|
||||
((mach_msg_type_number_t) (sizeof (task_power_info_v2_data_t) - sizeof(uint64_t)*2) / sizeof (natural_t))
|
||||
#define TASK_POWER_INFO_V2_COUNT \
|
||||
((mach_msg_type_number_t) (sizeof (task_power_info_v2_data_t) / sizeof (natural_t)))
|
||||
|
||||
#define TASK_VM_INFO_PURGEABLE_ACCOUNT 27 /* Used for xnu purgeable vm unit tests */
|
||||
|
||||
|
||||
#define TASK_FLAGS_INFO 28 /* return t_flags field */
|
||||
struct task_flags_info {
|
||||
uint32_t flags; /* task flags */
|
||||
};
|
||||
typedef struct task_flags_info task_flags_info_data_t;
|
||||
typedef struct task_flags_info * task_flags_info_t;
|
||||
#define TASK_FLAGS_INFO_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof(task_flags_info_data_t) / sizeof (natural_t)))
|
||||
|
||||
#define TF_LP64 0x00000001 /* task has 64-bit addressing */
|
||||
#define TF_64B_DATA 0x00000002 /* task has 64-bit data registers */
|
||||
|
||||
#define TASK_DEBUG_INFO_INTERNAL 29 /* Used for kernel internal development tests. */
|
||||
|
||||
|
||||
/*
|
||||
* Type to control EXC_GUARD delivery options for a task
|
||||
* via task_get/set_exc_guard_behavior interface(s).
|
||||
*/
|
||||
typedef uint32_t task_exc_guard_behavior_t;
|
||||
|
||||
/* EXC_GUARD optional delivery settings on a per-task basis */
|
||||
#define TASK_EXC_GUARD_VM_DELIVER 0x01 /* Deliver virtual memory EXC_GUARD exceptions */
|
||||
#define TASK_EXC_GUARD_VM_ONCE 0x02 /* Deliver them only once */
|
||||
#define TASK_EXC_GUARD_VM_CORPSE 0x04 /* Deliver them via a forked corpse */
|
||||
#define TASK_EXC_GUARD_VM_FATAL 0x08 /* Virtual Memory EXC_GUARD delivery is fatal */
|
||||
#define TASK_EXC_GUARD_VM_ALL 0x0f
|
||||
|
||||
#define TASK_EXC_GUARD_MP_DELIVER 0x10 /* Deliver mach port EXC_GUARD exceptions */
|
||||
#define TASK_EXC_GUARD_MP_ONCE 0x20 /* Deliver them only once */
|
||||
#define TASK_EXC_GUARD_MP_CORPSE 0x40 /* Deliver them via a forked corpse */
|
||||
#define TASK_EXC_GUARD_MP_FATAL 0x80 /* mach port EXC_GUARD delivery is fatal */
|
||||
#define TASK_EXC_GUARD_MP_ALL 0xf0
|
||||
|
||||
#define TASK_EXC_GUARD_ALL 0xff /* All optional deliver settings */
|
||||
|
||||
|
||||
/*
|
||||
* Obsolete interfaces.
|
||||
*/
|
||||
|
||||
#define TASK_SCHED_TIMESHARE_INFO 10
|
||||
#define TASK_SCHED_RR_INFO 11
|
||||
#define TASK_SCHED_FIFO_INFO 12
|
||||
|
||||
#define TASK_SCHED_INFO 14
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
#endif /* _MACH_TASK_INFO_H_ */
|
||||
186
lib/libc/include/aarch64-macos-gnu/mach/task_policy.h
Normal file
186
lib/libc/include/aarch64-macos-gnu/mach/task_policy.h
Normal file
@ -0,0 +1,186 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef _MACH_TASK_POLICY_H_
|
||||
#define _MACH_TASK_POLICY_H_
|
||||
|
||||
#include <mach/mach_types.h>
|
||||
|
||||
/*
|
||||
* These are the calls for accessing the policy parameters
|
||||
* of a particular task.
|
||||
*
|
||||
* The extra 'get_default' parameter to the second call is
|
||||
* IN/OUT as follows:
|
||||
* 1) if asserted on the way in it indicates that the default
|
||||
* values should be returned, not the ones currently set, in
|
||||
* this case 'get_default' will always be asserted on return;
|
||||
* 2) if unasserted on the way in, the current settings are
|
||||
* desired and if still unasserted on return, then the info
|
||||
* returned reflects the current settings, otherwise if
|
||||
* 'get_default' returns asserted, it means that there are no
|
||||
* current settings due to other parameters taking precedence,
|
||||
* and the default ones are being returned instead.
|
||||
*/
|
||||
|
||||
typedef natural_t task_policy_flavor_t;
|
||||
typedef integer_t *task_policy_t;
|
||||
|
||||
/*
|
||||
* kern_return_t task_policy_set(
|
||||
* task_t task,
|
||||
* task_policy_flavor_t flavor,
|
||||
* task_policy_t policy_info,
|
||||
* mach_msg_type_number_t count);
|
||||
*
|
||||
* kern_return_t task_policy_get(
|
||||
* task_t task,
|
||||
* task_policy_flavor_t flavor,
|
||||
* task_policy_t policy_info,
|
||||
* mach_msg_type_number_t *count,
|
||||
* boolean_t *get_default);
|
||||
*/
|
||||
|
||||
/*
|
||||
* Defined flavors.
|
||||
*/
|
||||
/*
|
||||
* TASK_CATEGORY_POLICY:
|
||||
*
|
||||
* This provides information to the kernel about the role
|
||||
* of the task in the system.
|
||||
*
|
||||
* Parameters:
|
||||
*
|
||||
* role: Enumerated as follows:
|
||||
*
|
||||
* TASK_UNSPECIFIED is the default, since the role is not
|
||||
* inherited from the parent.
|
||||
*
|
||||
* TASK_FOREGROUND_APPLICATION should be assigned when the
|
||||
* task is a normal UI application in the foreground from
|
||||
* the HI point of view.
|
||||
* **N.B. There may be more than one of these at a given time.
|
||||
*
|
||||
* TASK_BACKGROUND_APPLICATION should be assigned when the
|
||||
* task is a normal UI application in the background from
|
||||
* the HI point of view.
|
||||
*
|
||||
* TASK_CONTROL_APPLICATION should be assigned to the unique
|
||||
* UI application which implements the pop-up application dialog.
|
||||
* There can only be one task at a time with this designation,
|
||||
* which is assigned FCFS.
|
||||
*
|
||||
* TASK_GRAPHICS_SERVER should be assigned to the graphics
|
||||
* management (window) server. There can only be one task at
|
||||
* a time with this designation, which is assigned FCFS.
|
||||
*/
|
||||
|
||||
#define TASK_CATEGORY_POLICY 1
|
||||
|
||||
#define TASK_SUPPRESSION_POLICY 3
|
||||
#define TASK_POLICY_STATE 4
|
||||
#define TASK_BASE_QOS_POLICY 8
|
||||
#define TASK_OVERRIDE_QOS_POLICY 9
|
||||
#define TASK_BASE_LATENCY_QOS_POLICY 10
|
||||
#define TASK_BASE_THROUGHPUT_QOS_POLICY 11
|
||||
|
||||
typedef enum task_role {
|
||||
TASK_RENICED = -1,
|
||||
TASK_UNSPECIFIED = 0,
|
||||
TASK_FOREGROUND_APPLICATION = 1,
|
||||
TASK_BACKGROUND_APPLICATION = 2,
|
||||
TASK_CONTROL_APPLICATION = 3,
|
||||
TASK_GRAPHICS_SERVER = 4,
|
||||
TASK_THROTTLE_APPLICATION = 5,
|
||||
TASK_NONUI_APPLICATION = 6,
|
||||
TASK_DEFAULT_APPLICATION = 7,
|
||||
TASK_DARWINBG_APPLICATION = 8,
|
||||
} task_role_t;
|
||||
|
||||
struct task_category_policy {
|
||||
task_role_t role;
|
||||
};
|
||||
|
||||
typedef struct task_category_policy task_category_policy_data_t;
|
||||
typedef struct task_category_policy *task_category_policy_t;
|
||||
|
||||
#define TASK_CATEGORY_POLICY_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof (task_category_policy_data_t) / sizeof (integer_t)))
|
||||
|
||||
|
||||
enum task_latency_qos {
|
||||
LATENCY_QOS_TIER_UNSPECIFIED = 0x0,
|
||||
LATENCY_QOS_TIER_0 = ((0xFF << 16) | 1),
|
||||
LATENCY_QOS_TIER_1 = ((0xFF << 16) | 2),
|
||||
LATENCY_QOS_TIER_2 = ((0xFF << 16) | 3),
|
||||
LATENCY_QOS_TIER_3 = ((0xFF << 16) | 4),
|
||||
LATENCY_QOS_TIER_4 = ((0xFF << 16) | 5),
|
||||
LATENCY_QOS_TIER_5 = ((0xFF << 16) | 6)
|
||||
};
|
||||
typedef integer_t task_latency_qos_t;
|
||||
enum task_throughput_qos {
|
||||
THROUGHPUT_QOS_TIER_UNSPECIFIED = 0x0,
|
||||
THROUGHPUT_QOS_TIER_0 = ((0xFE << 16) | 1),
|
||||
THROUGHPUT_QOS_TIER_1 = ((0xFE << 16) | 2),
|
||||
THROUGHPUT_QOS_TIER_2 = ((0xFE << 16) | 3),
|
||||
THROUGHPUT_QOS_TIER_3 = ((0xFE << 16) | 4),
|
||||
THROUGHPUT_QOS_TIER_4 = ((0xFE << 16) | 5),
|
||||
THROUGHPUT_QOS_TIER_5 = ((0xFE << 16) | 6),
|
||||
};
|
||||
|
||||
#define LATENCY_QOS_LAUNCH_DEFAULT_TIER LATENCY_QOS_TIER_3
|
||||
#define THROUGHPUT_QOS_LAUNCH_DEFAULT_TIER THROUGHPUT_QOS_TIER_3
|
||||
|
||||
typedef integer_t task_throughput_qos_t;
|
||||
|
||||
struct task_qos_policy {
|
||||
task_latency_qos_t task_latency_qos_tier;
|
||||
task_throughput_qos_t task_throughput_qos_tier;
|
||||
};
|
||||
|
||||
typedef struct task_qos_policy *task_qos_policy_t;
|
||||
#define TASK_QOS_POLICY_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof (struct task_qos_policy) / sizeof (integer_t)))
|
||||
|
||||
/* These should be removed - they belong in proc_info.h */
|
||||
#define PROC_FLAG_DARWINBG 0x8000 /* process in darwin background */
|
||||
#define PROC_FLAG_EXT_DARWINBG 0x10000 /* process in darwin background - external enforcement */
|
||||
#define PROC_FLAG_IOS_APPLEDAEMON 0x20000 /* process is apple ios daemon */
|
||||
#define PROC_FLAG_IOS_IMPPROMOTION 0x80000 /* process is apple ios daemon */
|
||||
#define PROC_FLAG_ADAPTIVE 0x100000 /* Process is adaptive */
|
||||
#define PROC_FLAG_ADAPTIVE_IMPORTANT 0x200000 /* Process is adaptive, and is currently important */
|
||||
#define PROC_FLAG_IMPORTANCE_DONOR 0x400000 /* Process is marked as an importance donor */
|
||||
#define PROC_FLAG_SUPPRESSED 0x800000 /* Process is suppressed */
|
||||
#define PROC_FLAG_APPLICATION 0x1000000 /* Process is an application */
|
||||
#define PROC_FLAG_IOS_APPLICATION PROC_FLAG_APPLICATION /* Process is an application */
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* _MACH_TASK_POLICY_H_ */
|
||||
133
lib/libc/include/aarch64-macos-gnu/mach/task_special_ports.h
Normal file
133
lib/libc/include/aarch64-macos-gnu/mach/task_special_ports.h
Normal file
@ -0,0 +1,133 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2010 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/*
|
||||
* @OSF_COPYRIGHT@
|
||||
*/
|
||||
/*
|
||||
* Mach Operating System
|
||||
* Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission to use, copy, modify and distribute this software and its
|
||||
* documentation is hereby granted, provided that both the copyright
|
||||
* notice and this permission notice appear in all copies of the
|
||||
* software, derivative works or modified versions, and any portions
|
||||
* thereof, and that both notices appear in supporting documentation.
|
||||
*
|
||||
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
||||
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
|
||||
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
||||
*
|
||||
* Carnegie Mellon requests users of this software to return to
|
||||
*
|
||||
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
||||
* School of Computer Science
|
||||
* Carnegie Mellon University
|
||||
* Pittsburgh PA 15213-3890
|
||||
*
|
||||
* any improvements or extensions that they make and grant Carnegie Mellon
|
||||
* the rights to redistribute these changes.
|
||||
*/
|
||||
/*
|
||||
*/
|
||||
/*
|
||||
* File: mach/task_special_ports.h
|
||||
*
|
||||
* Defines codes for special_purpose task ports. These are NOT
|
||||
* port identifiers - they are only used for the task_get_special_port
|
||||
* and task_set_special_port routines.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _MACH_TASK_SPECIAL_PORTS_H_
|
||||
#define _MACH_TASK_SPECIAL_PORTS_H_
|
||||
|
||||
typedef int task_special_port_t;
|
||||
|
||||
#define TASK_KERNEL_PORT 1 /* The full task port for task. */
|
||||
|
||||
#define TASK_HOST_PORT 2 /* The host (priv) port for task. */
|
||||
|
||||
#define TASK_NAME_PORT 3 /* The name port for task. */
|
||||
|
||||
#define TASK_BOOTSTRAP_PORT 4 /* Bootstrap environment for task. */
|
||||
|
||||
#define TASK_INSPECT_PORT 5 /* The inspect port for task. */
|
||||
|
||||
#define TASK_READ_PORT 6 /* The read port for task. */
|
||||
|
||||
|
||||
|
||||
#define TASK_SEATBELT_PORT 7 /* Seatbelt compiler/DEM port for task. */
|
||||
|
||||
/* PORT 8 was the GSSD TASK PORT which transformed to a host port */
|
||||
|
||||
#define TASK_ACCESS_PORT 9 /* Permission check for task_for_pid. */
|
||||
|
||||
#define TASK_DEBUG_CONTROL_PORT 10 /* debug control port */
|
||||
|
||||
#define TASK_RESOURCE_NOTIFY_PORT 11 /* overrides host special RN port */
|
||||
|
||||
#define TASK_MAX_SPECIAL_PORT TASK_RESOURCE_NOTIFY_PORT
|
||||
|
||||
/*
|
||||
* Definitions for ease of use
|
||||
*/
|
||||
|
||||
#define task_get_kernel_port(task, port) \
|
||||
(task_get_special_port((task), TASK_KERNEL_PORT, (port)))
|
||||
|
||||
#define task_set_kernel_port(task, port) \
|
||||
(task_set_special_port((task), TASK_KERNEL_PORT, (port)))
|
||||
|
||||
#define task_get_host_port(task, port) \
|
||||
(task_get_special_port((task), TASK_HOST_PORT, (port)))
|
||||
|
||||
#define task_set_host_port(task, port) \
|
||||
(task_set_special_port((task), TASK_HOST_PORT, (port)))
|
||||
|
||||
#define task_get_bootstrap_port(task, port) \
|
||||
(task_get_special_port((task), TASK_BOOTSTRAP_PORT, (port)))
|
||||
|
||||
#define task_get_debug_control_port(task, port) \
|
||||
(task_get_special_port((task), TASK_DEBUG_CONTROL_PORT, (port)))
|
||||
|
||||
#define task_set_bootstrap_port(task, port) \
|
||||
(task_set_special_port((task), TASK_BOOTSTRAP_PORT, (port)))
|
||||
|
||||
#define task_get_task_access_port(task, port) \
|
||||
(task_get_special_port((task), TASK_ACCESS_PORT, (port)))
|
||||
|
||||
#define task_set_task_access_port(task, port) \
|
||||
(task_set_special_port((task), TASK_ACCESS_PORT, (port)))
|
||||
|
||||
#define task_set_task_debug_control_port(task, port) \
|
||||
(task_set_special_port((task), TASK_DEBUG_CONTROL_PORT, (port)))
|
||||
|
||||
|
||||
#endif /* _MACH_TASK_SPECIAL_PORTS_H_ */
|
||||
1386
lib/libc/include/aarch64-macos-gnu/mach/thread_act.h
Normal file
1386
lib/libc/include/aarch64-macos-gnu/mach/thread_act.h
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/*
|
||||
* @OSF_COPYRIGHT@
|
||||
*/
|
||||
/*
|
||||
* Mach Operating System
|
||||
* Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission to use, copy, modify and distribute this software and its
|
||||
* documentation is hereby granted, provided that both the copyright
|
||||
* notice and this permission notice appear in all copies of the
|
||||
* software, derivative works or modified versions, and any portions
|
||||
* thereof, and that both notices appear in supporting documentation.
|
||||
*
|
||||
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
||||
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
|
||||
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
||||
*
|
||||
* Carnegie Mellon requests users of this software to return to
|
||||
*
|
||||
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
||||
* School of Computer Science
|
||||
* Carnegie Mellon University
|
||||
* Pittsburgh PA 15213-3890
|
||||
*
|
||||
* any improvements or extensions that they make and grant Carnegie Mellon
|
||||
* the rights to redistribute these changes.
|
||||
*/
|
||||
/*
|
||||
*/
|
||||
/*
|
||||
* File: mach/thread_special_ports.h
|
||||
*
|
||||
* Defines codes for special_purpose thread ports. These are NOT
|
||||
* port identifiers - they are only used for the thread_get_special_port
|
||||
* and thread_set_special_port routines.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _MACH_THREAD_SPECIAL_PORTS_H_
|
||||
#define _MACH_THREAD_SPECIAL_PORTS_H_
|
||||
|
||||
#define THREAD_KERNEL_PORT 1 /* The full thread port for thread. */
|
||||
|
||||
#define THREAD_INSPECT_PORT 2 /* The inspect port for thread. */
|
||||
|
||||
#define THREAD_READ_PORT 3 /* The read port for thread. */
|
||||
|
||||
/*
|
||||
* Definitions for ease of use
|
||||
*/
|
||||
|
||||
#define thread_get_kernel_port(thread, port) \
|
||||
(thread_get_special_port((thread), THREAD_KERNEL_PORT, (port)))
|
||||
|
||||
#define thread_set_kernel_port(thread, port) \
|
||||
(thread_set_special_port((thread), THREAD_KERNEL_PORT, (port)))
|
||||
|
||||
#endif /* _MACH_THREAD_SPECIAL_PORTS_H_ */
|
||||
100
lib/libc/include/aarch64-macos-gnu/mach/thread_status.h
Normal file
100
lib/libc/include/aarch64-macos-gnu/mach/thread_status.h
Normal file
@ -0,0 +1,100 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/*
|
||||
* @OSF_COPYRIGHT@
|
||||
*/
|
||||
/*
|
||||
* Mach Operating System
|
||||
* Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission to use, copy, modify and distribute this software and its
|
||||
* documentation is hereby granted, provided that both the copyright
|
||||
* notice and this permission notice appear in all copies of the
|
||||
* software, derivative works or modified versions, and any portions
|
||||
* thereof, and that both notices appear in supporting documentation.
|
||||
*
|
||||
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
||||
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
|
||||
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
||||
*
|
||||
* Carnegie Mellon requests users of this software to return to
|
||||
*
|
||||
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
||||
* School of Computer Science
|
||||
* Carnegie Mellon University
|
||||
* Pittsburgh PA 15213-3890
|
||||
*
|
||||
* any improvements or extensions that they make and grant Carnegie Mellon
|
||||
* the rights to redistribute these changes.
|
||||
*/
|
||||
/*
|
||||
*/
|
||||
/*
|
||||
* File: mach/thread_status.h
|
||||
* Author: Avadis Tevanian, Jr.
|
||||
*
|
||||
* This file contains the structure definitions for the user-visible
|
||||
* thread state. This thread state is examined with the thread_get_state
|
||||
* kernel call and may be changed with the thread_set_state kernel call.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _MACH_THREAD_STATUS_H_
|
||||
#define _MACH_THREAD_STATUS_H_
|
||||
|
||||
/*
|
||||
* The actual structure that comprises the thread state is defined
|
||||
* in the machine dependent module.
|
||||
*/
|
||||
#include <mach/machine/vm_types.h>
|
||||
#include <mach/machine/thread_status.h>
|
||||
#include <mach/machine/thread_state.h>
|
||||
|
||||
/*
|
||||
* Generic definition for machine-dependent thread status.
|
||||
*/
|
||||
|
||||
typedef natural_t *thread_state_t; /* Variable-length array */
|
||||
|
||||
/* THREAD_STATE_MAX is now defined in <mach/machine/thread_state.h> */
|
||||
typedef natural_t thread_state_data_t[THREAD_STATE_MAX];
|
||||
|
||||
#define THREAD_STATE_FLAVOR_LIST 0 /* List of valid flavors */
|
||||
#define THREAD_STATE_FLAVOR_LIST_NEW 128
|
||||
#define THREAD_STATE_FLAVOR_LIST_10_9 129
|
||||
#define THREAD_STATE_FLAVOR_LIST_10_13 130
|
||||
#define THREAD_STATE_FLAVOR_LIST_10_15 131
|
||||
|
||||
typedef int thread_state_flavor_t;
|
||||
typedef thread_state_flavor_t *thread_state_flavor_array_t;
|
||||
|
||||
#define THREAD_CONVERT_THREAD_STATE_TO_SELF 1
|
||||
#define THREAD_CONVERT_THREAD_STATE_FROM_SELF 2
|
||||
|
||||
#endif /* _MACH_THREAD_STATUS_H_ */
|
||||
153
lib/libc/include/aarch64-macos-gnu/mach/vm_prot.h
Normal file
153
lib/libc/include/aarch64-macos-gnu/mach/vm_prot.h
Normal file
@ -0,0 +1,153 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/*
|
||||
* @OSF_COPYRIGHT@
|
||||
*/
|
||||
/*
|
||||
* Mach Operating System
|
||||
* Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission to use, copy, modify and distribute this software and its
|
||||
* documentation is hereby granted, provided that both the copyright
|
||||
* notice and this permission notice appear in all copies of the
|
||||
* software, derivative works or modified versions, and any portions
|
||||
* thereof, and that both notices appear in supporting documentation.
|
||||
*
|
||||
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
||||
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
|
||||
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
||||
*
|
||||
* Carnegie Mellon requests users of this software to return to
|
||||
*
|
||||
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
||||
* School of Computer Science
|
||||
* Carnegie Mellon University
|
||||
* Pittsburgh PA 15213-3890
|
||||
*
|
||||
* any improvements or extensions that they make and grant Carnegie Mellon
|
||||
* the rights to redistribute these changes.
|
||||
*/
|
||||
/*
|
||||
*/
|
||||
/*
|
||||
* File: mach/vm_prot.h
|
||||
* Author: Avadis Tevanian, Jr., Michael Wayne Young
|
||||
*
|
||||
* Virtual memory protection definitions.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _MACH_VM_PROT_H_
|
||||
#define _MACH_VM_PROT_H_
|
||||
|
||||
/*
|
||||
* Types defined:
|
||||
*
|
||||
* vm_prot_t VM protection values.
|
||||
*/
|
||||
|
||||
typedef int vm_prot_t;
|
||||
|
||||
/*
|
||||
* Protection values, defined as bits within the vm_prot_t type
|
||||
*/
|
||||
|
||||
#define VM_PROT_NONE ((vm_prot_t) 0x00)
|
||||
|
||||
#define VM_PROT_READ ((vm_prot_t) 0x01) /* read permission */
|
||||
#define VM_PROT_WRITE ((vm_prot_t) 0x02) /* write permission */
|
||||
#define VM_PROT_EXECUTE ((vm_prot_t) 0x04) /* execute permission */
|
||||
|
||||
/*
|
||||
* The default protection for newly-created virtual memory
|
||||
*/
|
||||
|
||||
#define VM_PROT_DEFAULT (VM_PROT_READ|VM_PROT_WRITE)
|
||||
|
||||
/*
|
||||
* The maximum privileges possible, for parameter checking.
|
||||
*/
|
||||
|
||||
#define VM_PROT_ALL (VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE)
|
||||
|
||||
/*
|
||||
* An invalid protection value.
|
||||
* Used only by memory_object_lock_request to indicate no change
|
||||
* to page locks. Using -1 here is a bad idea because it
|
||||
* looks like VM_PROT_ALL and then some.
|
||||
*/
|
||||
|
||||
#define VM_PROT_NO_CHANGE ((vm_prot_t) 0x08)
|
||||
|
||||
/*
|
||||
* When a caller finds that he cannot obtain write permission on a
|
||||
* mapped entry, the following flag can be used. The entry will
|
||||
* be made "needs copy" effectively copying the object (using COW),
|
||||
* and write permission will be added to the maximum protections
|
||||
* for the associated entry.
|
||||
*/
|
||||
|
||||
#define VM_PROT_COPY ((vm_prot_t) 0x10)
|
||||
|
||||
|
||||
/*
|
||||
* Another invalid protection value.
|
||||
* Used only by memory_object_data_request upon an object
|
||||
* which has specified a copy_call copy strategy. It is used
|
||||
* when the kernel wants a page belonging to a copy of the
|
||||
* object, and is only asking the object as a result of
|
||||
* following a shadow chain. This solves the race between pages
|
||||
* being pushed up by the memory manager and the kernel
|
||||
* walking down the shadow chain.
|
||||
*/
|
||||
|
||||
#define VM_PROT_WANTS_COPY ((vm_prot_t) 0x10)
|
||||
|
||||
|
||||
/*
|
||||
* Another invalid protection value.
|
||||
* Indicates that the other protection bits are to be applied as a mask
|
||||
* against the actual protection bits of the map entry.
|
||||
*/
|
||||
#define VM_PROT_IS_MASK ((vm_prot_t) 0x40)
|
||||
|
||||
/*
|
||||
* Another invalid protection value to support execute-only protection.
|
||||
* VM_PROT_STRIP_READ is a special marker that tells mprotect to not
|
||||
* set VM_PROT_READ. We have to do it this way because existing code
|
||||
* expects the system to set VM_PROT_READ if VM_PROT_EXECUTE is set.
|
||||
* VM_PROT_EXECUTE_ONLY is just a convenience value to indicate that
|
||||
* the memory should be executable and explicitly not readable. It will
|
||||
* be ignored on platforms that do not support this type of protection.
|
||||
*/
|
||||
#define VM_PROT_STRIP_READ ((vm_prot_t) 0x80)
|
||||
#define VM_PROT_EXECUTE_ONLY (VM_PROT_EXECUTE|VM_PROT_STRIP_READ)
|
||||
|
||||
|
||||
#endif /* _MACH_VM_PROT_H_ */
|
||||
550
lib/libc/include/aarch64-macos-gnu/mach/vm_statistics.h
Normal file
550
lib/libc/include/aarch64-macos-gnu/mach/vm_statistics.h
Normal file
@ -0,0 +1,550 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2020 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/*
|
||||
* @OSF_COPYRIGHT@
|
||||
*/
|
||||
/*
|
||||
* Mach Operating System
|
||||
* Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission to use, copy, modify and distribute this software and its
|
||||
* documentation is hereby granted, provided that both the copyright
|
||||
* notice and this permission notice appear in all copies of the
|
||||
* software, derivative works or modified versions, and any portions
|
||||
* thereof, and that both notices appear in supporting documentation.
|
||||
*
|
||||
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
||||
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
|
||||
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
||||
*
|
||||
* Carnegie Mellon requests users of this software to return to
|
||||
*
|
||||
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
||||
* School of Computer Science
|
||||
* Carnegie Mellon University
|
||||
* Pittsburgh PA 15213-3890
|
||||
*
|
||||
* any improvements or extensions that they make and grant Carnegie Mellon
|
||||
* the rights to redistribute these changes.
|
||||
*/
|
||||
/*
|
||||
*/
|
||||
/*
|
||||
* File: mach/vm_statistics.h
|
||||
* Author: Avadis Tevanian, Jr., Michael Wayne Young, David Golub
|
||||
*
|
||||
* Virtual memory statistics structure.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _MACH_VM_STATISTICS_H_
|
||||
#define _MACH_VM_STATISTICS_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <mach/machine/vm_types.h>
|
||||
#include <mach/machine/kern_return.h>
|
||||
|
||||
/*
|
||||
* vm_statistics
|
||||
*
|
||||
* History:
|
||||
* rev0 - original structure.
|
||||
* rev1 - added purgable info (purgable_count and purges).
|
||||
* rev2 - added speculative_count.
|
||||
*
|
||||
* Note: you cannot add any new fields to this structure. Add them below in
|
||||
* vm_statistics64.
|
||||
*/
|
||||
|
||||
struct vm_statistics {
|
||||
natural_t free_count; /* # of pages free */
|
||||
natural_t active_count; /* # of pages active */
|
||||
natural_t inactive_count; /* # of pages inactive */
|
||||
natural_t wire_count; /* # of pages wired down */
|
||||
natural_t zero_fill_count; /* # of zero fill pages */
|
||||
natural_t reactivations; /* # of pages reactivated */
|
||||
natural_t pageins; /* # of pageins */
|
||||
natural_t pageouts; /* # of pageouts */
|
||||
natural_t faults; /* # of faults */
|
||||
natural_t cow_faults; /* # of copy-on-writes */
|
||||
natural_t lookups; /* object cache lookups */
|
||||
natural_t hits; /* object cache hits */
|
||||
|
||||
/* added for rev1 */
|
||||
natural_t purgeable_count; /* # of pages purgeable */
|
||||
natural_t purges; /* # of pages purged */
|
||||
|
||||
/* added for rev2 */
|
||||
/*
|
||||
* NB: speculative pages are already accounted for in "free_count",
|
||||
* so "speculative_count" is the number of "free" pages that are
|
||||
* used to hold data that was read speculatively from disk but
|
||||
* haven't actually been used by anyone so far.
|
||||
*/
|
||||
natural_t speculative_count; /* # of pages speculative */
|
||||
};
|
||||
|
||||
/* Used by all architectures */
|
||||
typedef struct vm_statistics *vm_statistics_t;
|
||||
typedef struct vm_statistics vm_statistics_data_t;
|
||||
|
||||
/*
|
||||
* vm_statistics64
|
||||
*
|
||||
* History:
|
||||
* rev0 - original structure.
|
||||
* rev1 - added purgable info (purgable_count and purges).
|
||||
* rev2 - added speculative_count.
|
||||
* ----
|
||||
* rev3 - changed name to vm_statistics64.
|
||||
* changed some fields in structure to 64-bit on
|
||||
* arm, i386 and x86_64 architectures.
|
||||
* rev4 - require 64-bit alignment for efficient access
|
||||
* in the kernel. No change to reported data.
|
||||
*
|
||||
*/
|
||||
|
||||
struct vm_statistics64 {
|
||||
natural_t free_count; /* # of pages free */
|
||||
natural_t active_count; /* # of pages active */
|
||||
natural_t inactive_count; /* # of pages inactive */
|
||||
natural_t wire_count; /* # of pages wired down */
|
||||
uint64_t zero_fill_count; /* # of zero fill pages */
|
||||
uint64_t reactivations; /* # of pages reactivated */
|
||||
uint64_t pageins; /* # of pageins */
|
||||
uint64_t pageouts; /* # of pageouts */
|
||||
uint64_t faults; /* # of faults */
|
||||
uint64_t cow_faults; /* # of copy-on-writes */
|
||||
uint64_t lookups; /* object cache lookups */
|
||||
uint64_t hits; /* object cache hits */
|
||||
uint64_t purges; /* # of pages purged */
|
||||
natural_t purgeable_count; /* # of pages purgeable */
|
||||
/*
|
||||
* NB: speculative pages are already accounted for in "free_count",
|
||||
* so "speculative_count" is the number of "free" pages that are
|
||||
* used to hold data that was read speculatively from disk but
|
||||
* haven't actually been used by anyone so far.
|
||||
*/
|
||||
natural_t speculative_count; /* # of pages speculative */
|
||||
|
||||
/* added for rev1 */
|
||||
uint64_t decompressions; /* # of pages decompressed */
|
||||
uint64_t compressions; /* # of pages compressed */
|
||||
uint64_t swapins; /* # of pages swapped in (via compression segments) */
|
||||
uint64_t swapouts; /* # of pages swapped out (via compression segments) */
|
||||
natural_t compressor_page_count; /* # of pages used by the compressed pager to hold all the compressed data */
|
||||
natural_t throttled_count; /* # of pages throttled */
|
||||
natural_t external_page_count; /* # of pages that are file-backed (non-swap) */
|
||||
natural_t internal_page_count; /* # of pages that are anonymous */
|
||||
uint64_t total_uncompressed_pages_in_compressor; /* # of pages (uncompressed) held within the compressor. */
|
||||
} __attribute__((aligned(8)));
|
||||
|
||||
typedef struct vm_statistics64 *vm_statistics64_t;
|
||||
typedef struct vm_statistics64 vm_statistics64_data_t;
|
||||
|
||||
kern_return_t vm_stats(void *info, unsigned int *count);
|
||||
|
||||
/*
|
||||
* VM_STATISTICS_TRUNCATE_TO_32_BIT
|
||||
*
|
||||
* This is used by host_statistics() to truncate and peg the 64-bit in-kernel values from
|
||||
* vm_statistics64 to the 32-bit values of the older structure above (vm_statistics).
|
||||
*/
|
||||
#define VM_STATISTICS_TRUNCATE_TO_32_BIT(value) ((uint32_t)(((value) > UINT32_MAX ) ? UINT32_MAX : (value)))
|
||||
|
||||
/*
|
||||
* vm_extmod_statistics
|
||||
*
|
||||
* Structure to record modifications to a task by an
|
||||
* external agent.
|
||||
*
|
||||
* History:
|
||||
* rev0 - original structure.
|
||||
*/
|
||||
|
||||
struct vm_extmod_statistics {
|
||||
int64_t task_for_pid_count; /* # of times task port was looked up */
|
||||
int64_t task_for_pid_caller_count; /* # of times this task called task_for_pid */
|
||||
int64_t thread_creation_count; /* # of threads created in task */
|
||||
int64_t thread_creation_caller_count; /* # of threads created by task */
|
||||
int64_t thread_set_state_count; /* # of register state sets in task */
|
||||
int64_t thread_set_state_caller_count; /* # of register state sets by task */
|
||||
} __attribute__((aligned(8)));
|
||||
|
||||
typedef struct vm_extmod_statistics *vm_extmod_statistics_t;
|
||||
typedef struct vm_extmod_statistics vm_extmod_statistics_data_t;
|
||||
|
||||
typedef struct vm_purgeable_stat {
|
||||
uint64_t count;
|
||||
uint64_t size;
|
||||
}vm_purgeable_stat_t;
|
||||
|
||||
struct vm_purgeable_info {
|
||||
vm_purgeable_stat_t fifo_data[8];
|
||||
vm_purgeable_stat_t obsolete_data;
|
||||
vm_purgeable_stat_t lifo_data[8];
|
||||
};
|
||||
|
||||
typedef struct vm_purgeable_info *vm_purgeable_info_t;
|
||||
|
||||
/* included for the vm_map_page_query call */
|
||||
|
||||
#define VM_PAGE_QUERY_PAGE_PRESENT 0x1
|
||||
#define VM_PAGE_QUERY_PAGE_FICTITIOUS 0x2
|
||||
#define VM_PAGE_QUERY_PAGE_REF 0x4
|
||||
#define VM_PAGE_QUERY_PAGE_DIRTY 0x8
|
||||
#define VM_PAGE_QUERY_PAGE_PAGED_OUT 0x10
|
||||
#define VM_PAGE_QUERY_PAGE_COPIED 0x20
|
||||
#define VM_PAGE_QUERY_PAGE_SPECULATIVE 0x40
|
||||
#define VM_PAGE_QUERY_PAGE_EXTERNAL 0x80
|
||||
#define VM_PAGE_QUERY_PAGE_CS_VALIDATED 0x100
|
||||
#define VM_PAGE_QUERY_PAGE_CS_TAINTED 0x200
|
||||
#define VM_PAGE_QUERY_PAGE_CS_NX 0x400
|
||||
#define VM_PAGE_QUERY_PAGE_REUSABLE 0x800
|
||||
|
||||
|
||||
/*
|
||||
* VM allocation flags:
|
||||
*
|
||||
* VM_FLAGS_FIXED
|
||||
* (really the absence of VM_FLAGS_ANYWHERE)
|
||||
* Allocate new VM region at the specified virtual address, if possible.
|
||||
*
|
||||
* VM_FLAGS_ANYWHERE
|
||||
* Allocate new VM region anywhere it would fit in the address space.
|
||||
*
|
||||
* VM_FLAGS_PURGABLE
|
||||
* Create a purgable VM object for that new VM region.
|
||||
*
|
||||
* VM_FLAGS_4GB_CHUNK
|
||||
* The new VM region will be chunked up into 4GB sized pieces.
|
||||
*
|
||||
* VM_FLAGS_NO_PMAP_CHECK
|
||||
* (for DEBUG kernel config only, ignored for other configs)
|
||||
* Do not check that there is no stale pmap mapping for the new VM region.
|
||||
* This is useful for kernel memory allocations at bootstrap when building
|
||||
* the initial kernel address space while some memory is already in use.
|
||||
*
|
||||
* VM_FLAGS_OVERWRITE
|
||||
* The new VM region can replace existing VM regions if necessary
|
||||
* (to be used in combination with VM_FLAGS_FIXED).
|
||||
*
|
||||
* VM_FLAGS_NO_CACHE
|
||||
* Pages brought in to this VM region are placed on the speculative
|
||||
* queue instead of the active queue. In other words, they are not
|
||||
* cached so that they will be stolen first if memory runs low.
|
||||
*/
|
||||
|
||||
#define VM_FLAGS_FIXED 0x0000
|
||||
#define VM_FLAGS_ANYWHERE 0x0001
|
||||
#define VM_FLAGS_PURGABLE 0x0002
|
||||
#define VM_FLAGS_4GB_CHUNK 0x0004
|
||||
#define VM_FLAGS_RANDOM_ADDR 0x0008
|
||||
#define VM_FLAGS_NO_CACHE 0x0010
|
||||
#define VM_FLAGS_RESILIENT_CODESIGN 0x0020
|
||||
#define VM_FLAGS_RESILIENT_MEDIA 0x0040
|
||||
#define VM_FLAGS_OVERWRITE 0x4000 /* delete any existing mappings first */
|
||||
/*
|
||||
* VM_FLAGS_SUPERPAGE_MASK
|
||||
* 3 bits that specify whether large pages should be used instead of
|
||||
* base pages (!=0), as well as the requested page size.
|
||||
*/
|
||||
#define VM_FLAGS_SUPERPAGE_MASK 0x70000 /* bits 0x10000, 0x20000, 0x40000 */
|
||||
#define VM_FLAGS_RETURN_DATA_ADDR 0x100000 /* Return address of target data, rather than base of page */
|
||||
#define VM_FLAGS_RETURN_4K_DATA_ADDR 0x800000 /* Return 4K aligned address of target data */
|
||||
#define VM_FLAGS_ALIAS_MASK 0xFF000000
|
||||
#define VM_GET_FLAGS_ALIAS(flags, alias) \
|
||||
(alias) = ((flags) & VM_FLAGS_ALIAS_MASK) >> 24
|
||||
#define VM_SET_FLAGS_ALIAS(flags, alias) \
|
||||
(flags) = (((flags) & ~VM_FLAGS_ALIAS_MASK) | \
|
||||
(((alias) & ~VM_FLAGS_ALIAS_MASK) << 24))
|
||||
|
||||
/* These are the flags that we accept from user-space */
|
||||
#define VM_FLAGS_USER_ALLOCATE (VM_FLAGS_FIXED | \
|
||||
VM_FLAGS_ANYWHERE | \
|
||||
VM_FLAGS_PURGABLE | \
|
||||
VM_FLAGS_4GB_CHUNK | \
|
||||
VM_FLAGS_RANDOM_ADDR | \
|
||||
VM_FLAGS_NO_CACHE | \
|
||||
VM_FLAGS_OVERWRITE | \
|
||||
VM_FLAGS_SUPERPAGE_MASK | \
|
||||
VM_FLAGS_ALIAS_MASK)
|
||||
#define VM_FLAGS_USER_MAP (VM_FLAGS_USER_ALLOCATE | \
|
||||
VM_FLAGS_RETURN_4K_DATA_ADDR | \
|
||||
VM_FLAGS_RETURN_DATA_ADDR)
|
||||
#define VM_FLAGS_USER_REMAP (VM_FLAGS_FIXED | \
|
||||
VM_FLAGS_ANYWHERE | \
|
||||
VM_FLAGS_RANDOM_ADDR | \
|
||||
VM_FLAGS_OVERWRITE| \
|
||||
VM_FLAGS_RETURN_DATA_ADDR | \
|
||||
VM_FLAGS_RESILIENT_CODESIGN | \
|
||||
VM_FLAGS_RESILIENT_MEDIA)
|
||||
|
||||
#define VM_FLAGS_SUPERPAGE_SHIFT 16
|
||||
#define SUPERPAGE_NONE 0 /* no superpages, if all bits are 0 */
|
||||
#define SUPERPAGE_SIZE_ANY 1
|
||||
#define VM_FLAGS_SUPERPAGE_NONE (SUPERPAGE_NONE << VM_FLAGS_SUPERPAGE_SHIFT)
|
||||
#define VM_FLAGS_SUPERPAGE_SIZE_ANY (SUPERPAGE_SIZE_ANY << VM_FLAGS_SUPERPAGE_SHIFT)
|
||||
#define SUPERPAGE_SIZE_2MB 2
|
||||
#define VM_FLAGS_SUPERPAGE_SIZE_2MB (SUPERPAGE_SIZE_2MB<<VM_FLAGS_SUPERPAGE_SHIFT)
|
||||
|
||||
/*
|
||||
* EXC_GUARD definitions for virtual memory.
|
||||
*/
|
||||
#define GUARD_TYPE_VIRT_MEMORY 0x5
|
||||
|
||||
/* Reasons for exception for virtual memory */
|
||||
enum virtual_memory_guard_exception_codes {
|
||||
kGUARD_EXC_DEALLOC_GAP = 1u << 0
|
||||
};
|
||||
|
||||
|
||||
/* current accounting postmark */
|
||||
#define __VM_LEDGER_ACCOUNTING_POSTMARK 2019032600
|
||||
|
||||
/* discrete values: */
|
||||
#define VM_LEDGER_TAG_NONE 0x00000000
|
||||
#define VM_LEDGER_TAG_DEFAULT 0x00000001
|
||||
#define VM_LEDGER_TAG_NETWORK 0x00000002
|
||||
#define VM_LEDGER_TAG_MEDIA 0x00000003
|
||||
#define VM_LEDGER_TAG_GRAPHICS 0x00000004
|
||||
#define VM_LEDGER_TAG_NEURAL 0x00000005
|
||||
#define VM_LEDGER_TAG_MAX 0x00000005
|
||||
/* individual bits: */
|
||||
#define VM_LEDGER_FLAG_NO_FOOTPRINT 0x00000001
|
||||
#define VM_LEDGER_FLAGS (VM_LEDGER_FLAG_NO_FOOTPRINT)
|
||||
|
||||
|
||||
#define VM_MEMORY_MALLOC 1
|
||||
#define VM_MEMORY_MALLOC_SMALL 2
|
||||
#define VM_MEMORY_MALLOC_LARGE 3
|
||||
#define VM_MEMORY_MALLOC_HUGE 4
|
||||
#define VM_MEMORY_SBRK 5// uninteresting -- no one should call
|
||||
#define VM_MEMORY_REALLOC 6
|
||||
#define VM_MEMORY_MALLOC_TINY 7
|
||||
#define VM_MEMORY_MALLOC_LARGE_REUSABLE 8
|
||||
#define VM_MEMORY_MALLOC_LARGE_REUSED 9
|
||||
|
||||
#define VM_MEMORY_ANALYSIS_TOOL 10
|
||||
|
||||
#define VM_MEMORY_MALLOC_NANO 11
|
||||
#define VM_MEMORY_MALLOC_MEDIUM 12
|
||||
#define VM_MEMORY_MALLOC_PGUARD 13
|
||||
|
||||
#define VM_MEMORY_MACH_MSG 20
|
||||
#define VM_MEMORY_IOKIT 21
|
||||
#define VM_MEMORY_STACK 30
|
||||
#define VM_MEMORY_GUARD 31
|
||||
#define VM_MEMORY_SHARED_PMAP 32
|
||||
/* memory containing a dylib */
|
||||
#define VM_MEMORY_DYLIB 33
|
||||
#define VM_MEMORY_OBJC_DISPATCHERS 34
|
||||
|
||||
/* Was a nested pmap (VM_MEMORY_SHARED_PMAP) which has now been unnested */
|
||||
#define VM_MEMORY_UNSHARED_PMAP 35
|
||||
|
||||
|
||||
// Placeholders for now -- as we analyze the libraries and find how they
|
||||
// use memory, we can make these labels more specific.
|
||||
#define VM_MEMORY_APPKIT 40
|
||||
#define VM_MEMORY_FOUNDATION 41
|
||||
#define VM_MEMORY_COREGRAPHICS 42
|
||||
#define VM_MEMORY_CORESERVICES 43
|
||||
#define VM_MEMORY_CARBON VM_MEMORY_CORESERVICES
|
||||
#define VM_MEMORY_JAVA 44
|
||||
#define VM_MEMORY_COREDATA 45
|
||||
#define VM_MEMORY_COREDATA_OBJECTIDS 46
|
||||
#define VM_MEMORY_ATS 50
|
||||
#define VM_MEMORY_LAYERKIT 51
|
||||
#define VM_MEMORY_CGIMAGE 52
|
||||
#define VM_MEMORY_TCMALLOC 53
|
||||
|
||||
/* private raster data (i.e. layers, some images, QGL allocator) */
|
||||
#define VM_MEMORY_COREGRAPHICS_DATA 54
|
||||
|
||||
/* shared image and font caches */
|
||||
#define VM_MEMORY_COREGRAPHICS_SHARED 55
|
||||
|
||||
/* Memory used for virtual framebuffers, shadowing buffers, etc... */
|
||||
#define VM_MEMORY_COREGRAPHICS_FRAMEBUFFERS 56
|
||||
|
||||
/* Window backing stores, custom shadow data, and compressed backing stores */
|
||||
#define VM_MEMORY_COREGRAPHICS_BACKINGSTORES 57
|
||||
|
||||
/* x-alloc'd memory */
|
||||
#define VM_MEMORY_COREGRAPHICS_XALLOC 58
|
||||
|
||||
/* catch-all for other uses, such as the read-only shared data page */
|
||||
#define VM_MEMORY_COREGRAPHICS_MISC VM_MEMORY_COREGRAPHICS
|
||||
|
||||
/* memory allocated by the dynamic loader for itself */
|
||||
#define VM_MEMORY_DYLD 60
|
||||
/* malloc'd memory created by dyld */
|
||||
#define VM_MEMORY_DYLD_MALLOC 61
|
||||
|
||||
/* Used for sqlite page cache */
|
||||
#define VM_MEMORY_SQLITE 62
|
||||
|
||||
/* JavaScriptCore heaps */
|
||||
#define VM_MEMORY_JAVASCRIPT_CORE 63
|
||||
#define VM_MEMORY_WEBASSEMBLY VM_MEMORY_JAVASCRIPT_CORE
|
||||
/* memory allocated for the JIT */
|
||||
#define VM_MEMORY_JAVASCRIPT_JIT_EXECUTABLE_ALLOCATOR 64
|
||||
#define VM_MEMORY_JAVASCRIPT_JIT_REGISTER_FILE 65
|
||||
|
||||
/* memory allocated for GLSL */
|
||||
#define VM_MEMORY_GLSL 66
|
||||
|
||||
/* memory allocated for OpenCL.framework */
|
||||
#define VM_MEMORY_OPENCL 67
|
||||
|
||||
/* memory allocated for QuartzCore.framework */
|
||||
#define VM_MEMORY_COREIMAGE 68
|
||||
|
||||
/* memory allocated for WebCore Purgeable Buffers */
|
||||
#define VM_MEMORY_WEBCORE_PURGEABLE_BUFFERS 69
|
||||
|
||||
/* ImageIO memory */
|
||||
#define VM_MEMORY_IMAGEIO 70
|
||||
|
||||
/* CoreProfile memory */
|
||||
#define VM_MEMORY_COREPROFILE 71
|
||||
|
||||
/* assetsd / MobileSlideShow memory */
|
||||
#define VM_MEMORY_ASSETSD 72
|
||||
|
||||
/* libsystem_kernel os_once_alloc */
|
||||
#define VM_MEMORY_OS_ALLOC_ONCE 73
|
||||
|
||||
/* libdispatch internal allocator */
|
||||
#define VM_MEMORY_LIBDISPATCH 74
|
||||
|
||||
/* Accelerate.framework image backing stores */
|
||||
#define VM_MEMORY_ACCELERATE 75
|
||||
|
||||
/* CoreUI image block data */
|
||||
#define VM_MEMORY_COREUI 76
|
||||
|
||||
/* CoreUI image file */
|
||||
#define VM_MEMORY_COREUIFILE 77
|
||||
|
||||
/* Genealogy buffers */
|
||||
#define VM_MEMORY_GENEALOGY 78
|
||||
|
||||
/* RawCamera VM allocated memory */
|
||||
#define VM_MEMORY_RAWCAMERA 79
|
||||
|
||||
/* corpse info for dead process */
|
||||
#define VM_MEMORY_CORPSEINFO 80
|
||||
|
||||
/* Apple System Logger (ASL) messages */
|
||||
#define VM_MEMORY_ASL 81
|
||||
|
||||
/* Swift runtime */
|
||||
#define VM_MEMORY_SWIFT_RUNTIME 82
|
||||
|
||||
/* Swift metadata */
|
||||
#define VM_MEMORY_SWIFT_METADATA 83
|
||||
|
||||
/* DHMM data */
|
||||
#define VM_MEMORY_DHMM 84
|
||||
|
||||
|
||||
/* memory allocated by SceneKit.framework */
|
||||
#define VM_MEMORY_SCENEKIT 86
|
||||
|
||||
/* memory allocated by skywalk networking */
|
||||
#define VM_MEMORY_SKYWALK 87
|
||||
|
||||
#define VM_MEMORY_IOSURFACE 88
|
||||
|
||||
#define VM_MEMORY_LIBNETWORK 89
|
||||
|
||||
#define VM_MEMORY_AUDIO 90
|
||||
|
||||
#define VM_MEMORY_VIDEOBITSTREAM 91
|
||||
|
||||
/* memory allocated by CoreMedia */
|
||||
#define VM_MEMORY_CM_XPC 92
|
||||
|
||||
#define VM_MEMORY_CM_RPC 93
|
||||
|
||||
#define VM_MEMORY_CM_MEMORYPOOL 94
|
||||
|
||||
#define VM_MEMORY_CM_READCACHE 95
|
||||
|
||||
#define VM_MEMORY_CM_CRABS 96
|
||||
|
||||
/* memory allocated for QuickLookThumbnailing */
|
||||
#define VM_MEMORY_QUICKLOOK_THUMBNAILS 97
|
||||
|
||||
/* memory allocated by Accounts framework */
|
||||
#define VM_MEMORY_ACCOUNTS 98
|
||||
|
||||
/* memory allocated by Sanitizer runtime libraries */
|
||||
#define VM_MEMORY_SANITIZER 99
|
||||
|
||||
/* Differentiate memory needed by GPU drivers and frameworks from generic IOKit allocations */
|
||||
#define VM_MEMORY_IOACCELERATOR 100
|
||||
|
||||
/* memory allocated by CoreMedia for global image registration of frames */
|
||||
#define VM_MEMORY_CM_REGWARP 101
|
||||
|
||||
/* memory allocated by EmbeddedAcousticRecognition for speech decoder */
|
||||
#define VM_MEMORY_EAR_DECODER 102
|
||||
|
||||
/* CoreUI cached image data */
|
||||
#define VM_MEMORY_COREUI_CACHED_IMAGE_DATA 103
|
||||
|
||||
/* Reserve 230-239 for Rosetta */
|
||||
#define VM_MEMORY_ROSETTA 230
|
||||
#define VM_MEMORY_ROSETTA_THREAD_CONTEXT 231
|
||||
#define VM_MEMORY_ROSETTA_INDIRECT_BRANCH_MAP 232
|
||||
#define VM_MEMORY_ROSETTA_RETURN_STACK 233
|
||||
#define VM_MEMORY_ROSETTA_EXECUTABLE_HEAP 234
|
||||
#define VM_MEMORY_ROSETTA_USER_LDT 235
|
||||
#define VM_MEMORY_ROSETTA_ARENA 236
|
||||
#define VM_MEMORY_ROSETTA_10 239
|
||||
|
||||
/* Reserve 240-255 for application */
|
||||
#define VM_MEMORY_APPLICATION_SPECIFIC_1 240
|
||||
#define VM_MEMORY_APPLICATION_SPECIFIC_16 255
|
||||
|
||||
#define VM_MAKE_TAG(tag) ((tag) << 24)
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _MACH_VM_STATISTICS_H_ */
|
||||
97
lib/libc/include/aarch64-macos-gnu/mach/vm_types.h
Normal file
97
lib/libc/include/aarch64-macos-gnu/mach/vm_types.h
Normal file
@ -0,0 +1,97 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2018 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/*
|
||||
* @OSF_COPYRIGHT@
|
||||
*
|
||||
*/
|
||||
#ifndef _MACH_VM_TYPES_H_
|
||||
#define _MACH_VM_TYPES_H_
|
||||
|
||||
#include <mach/port.h>
|
||||
#include <mach/machine/vm_types.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
typedef vm_offset_t pointer_t;
|
||||
typedef vm_offset_t vm_address_t;
|
||||
|
||||
/*
|
||||
* We use addr64_t for 64-bit addresses that are used on both
|
||||
* 32 and 64-bit machines. On PPC, they are passed and returned as
|
||||
* two adjacent 32-bit GPRs. We use addr64_t in places where
|
||||
* common code must be useable both on 32 and 64-bit machines.
|
||||
*/
|
||||
typedef uint64_t addr64_t; /* Basic effective address */
|
||||
|
||||
/*
|
||||
* We use reg64_t for addresses that are 32 bits on a 32-bit
|
||||
* machine, and 64 bits on a 64-bit machine, but are always
|
||||
* passed and returned in a single GPR on PPC. This type
|
||||
* cannot be used in generic 32-bit c, since on a 64-bit
|
||||
* machine the upper half of the register will be ignored
|
||||
* by the c compiler in 32-bit mode. In c, we can only use the
|
||||
* type in prototypes of functions that are written in and called
|
||||
* from assembly language. This type is basically a comment.
|
||||
*/
|
||||
typedef uint32_t reg64_t;
|
||||
|
||||
/*
|
||||
* To minimize the use of 64-bit fields, we keep some physical
|
||||
* addresses (that are page aligned) as 32-bit page numbers.
|
||||
* This limits the physical address space to 16TB of RAM.
|
||||
*/
|
||||
typedef uint32_t ppnum_t; /* Physical page number */
|
||||
#define PPNUM_MAX UINT32_MAX
|
||||
|
||||
|
||||
|
||||
typedef mach_port_t vm_map_t, vm_map_read_t, vm_map_inspect_t;
|
||||
|
||||
|
||||
#define VM_MAP_NULL ((vm_map_t) 0)
|
||||
#define VM_MAP_INSPECT_NULL ((vm_map_inspect_t) 0)
|
||||
#define VM_MAP_READ_NULL ((vm_map_read_t) 0)
|
||||
|
||||
/*
|
||||
* Evolving definitions, likely to change.
|
||||
*/
|
||||
|
||||
typedef uint64_t vm_object_offset_t;
|
||||
typedef uint64_t vm_object_size_t;
|
||||
|
||||
|
||||
|
||||
|
||||
typedef mach_port_t upl_t;
|
||||
typedef mach_port_t vm_named_entry_t;
|
||||
|
||||
|
||||
#define UPL_NULL ((upl_t) 0)
|
||||
#define VM_NAMED_ENTRY_NULL ((vm_named_entry_t) 0)
|
||||
|
||||
#endif /* _MACH_VM_TYPES_H_ */
|
||||
34
lib/libc/include/aarch64-macos-gnu/machine/_mcontext.h
Normal file
34
lib/libc/include/aarch64-macos-gnu/machine/_mcontext.h
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2012 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
#if defined (__i386__) || defined (__x86_64__)
|
||||
#include "i386/_mcontext.h"
|
||||
#elif defined (__arm__) || defined (__arm64__)
|
||||
#include "arm/_mcontext.h"
|
||||
#else
|
||||
#error architecture not supported
|
||||
#endif
|
||||
34
lib/libc/include/aarch64-macos-gnu/machine/_param.h
Normal file
34
lib/libc/include/aarch64-macos-gnu/machine/_param.h
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2007 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
#if defined (__i386__) || defined (__x86_64__)
|
||||
#include <i386/_param.h>
|
||||
#elif defined (__arm__) || defined (__arm64__)
|
||||
#include <arm/_param.h>
|
||||
#else
|
||||
#error architecture not supported
|
||||
#endif
|
||||
39
lib/libc/include/aarch64-macos-gnu/machine/_types.h
Normal file
39
lib/libc/include/aarch64-macos-gnu/machine/_types.h
Normal file
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2007 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
#ifndef _BSD_MACHINE__TYPES_H_
|
||||
#define _BSD_MACHINE__TYPES_H_
|
||||
|
||||
#if defined (__i386__) || defined(__x86_64__)
|
||||
#include "i386/_types.h"
|
||||
#elif defined (__arm__) || defined (__arm64__)
|
||||
#include "arm/_types.h"
|
||||
#else
|
||||
#error architecture not supported
|
||||
#endif
|
||||
|
||||
#endif /* _BSD_MACHINE__TYPES_H_ */
|
||||
42
lib/libc/include/aarch64-macos-gnu/machine/endian.h
Normal file
42
lib/libc/include/aarch64-macos-gnu/machine/endian.h
Normal file
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2007 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/*
|
||||
* Copyright 1995 NeXT Computer, Inc. All rights reserved.
|
||||
*/
|
||||
#ifndef _BSD_MACHINE_ENDIAN_H_
|
||||
#define _BSD_MACHINE_ENDIAN_H_
|
||||
|
||||
#if defined (__i386__) || defined(__x86_64__)
|
||||
#include "i386/endian.h"
|
||||
#elif defined (__arm__) || defined (__arm64__)
|
||||
#include "arm/endian.h"
|
||||
#else
|
||||
#error architecture not supported
|
||||
#endif
|
||||
|
||||
#endif /* _BSD_MACHINE_ENDIAN_H_ */
|
||||
11
lib/libc/include/aarch64-macos-gnu/machine/limits.h
Normal file
11
lib/libc/include/aarch64-macos-gnu/machine/limits.h
Normal file
@ -0,0 +1,11 @@
|
||||
/* This is the `system' limits.h, independent of any particular
|
||||
* compiler. GCC provides its own limits.h which can be found in
|
||||
* /usr/lib/gcc, although it is not very informative.
|
||||
* This file is public domain. */
|
||||
#if defined (__i386__) || defined(__x86_64__)
|
||||
#include <i386/limits.h>
|
||||
#elif defined (__arm__) || defined (__arm64__)
|
||||
#include <arm/limits.h>
|
||||
#else
|
||||
#error architecture not supported
|
||||
#endif
|
||||
42
lib/libc/include/aarch64-macos-gnu/machine/param.h
Normal file
42
lib/libc/include/aarch64-macos-gnu/machine/param.h
Normal file
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2007 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/*
|
||||
* Copyright 1995 NeXT Computer, Inc. All rights reserved.
|
||||
*/
|
||||
#ifndef _BSD_MACHINE_PARAM_H_
|
||||
#define _BSD_MACHINE_PARAM_H_
|
||||
|
||||
#if defined (__i386__) || defined(__x86_64__)
|
||||
#include <i386/param.h>
|
||||
#elif defined (__arm__) || defined (__arm64__)
|
||||
#include <arm/param.h>
|
||||
#else
|
||||
#error architecture not supported
|
||||
#endif
|
||||
|
||||
#endif /* _BSD_MACHINE_PARAM_H_ */
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user