Repository: fubark/zig-v8 Branch: master Commit: 168c4a868287 Files: 301 Total size: 2.0 MB Directory structure: gitextract_5ufvb6_p/ ├── .gitattributes ├── .github/ │ └── workflows/ │ ├── build-single.yml │ └── build.yml ├── .gitignore ├── .gn ├── BUILD.gclient.gn ├── BUILD.gn ├── LICENSE ├── README.md ├── V8_REVISION ├── build.zig ├── cross-macos/ │ └── sysroot/ │ └── macos-12/ │ └── usr/ │ └── include/ │ ├── libkern/ │ │ ├── OSAtomic.h │ │ ├── OSAtomicDeprecated.h │ │ ├── OSAtomicQueue.h │ │ ├── OSByteOrder.h │ │ ├── OSCacheControl.h │ │ ├── OSDebug.h │ │ ├── OSKextLib.h │ │ ├── OSReturn.h │ │ ├── OSSpinLockDeprecated.h │ │ ├── OSThermalNotification.h │ │ ├── OSTypes.h │ │ ├── _OSByteOrder.h │ │ ├── arm/ │ │ │ └── OSByteOrder.h │ │ ├── i386/ │ │ │ ├── OSByteOrder.h │ │ │ └── _OSByteOrder.h │ │ └── machine/ │ │ └── OSByteOrder.h │ ├── mach-o/ │ │ ├── arch.h │ │ ├── arm/ │ │ │ └── reloc.h │ │ ├── arm64/ │ │ │ └── reloc.h │ │ ├── compact_unwind_encoding.h │ │ ├── compact_unwind_encoding.modulemap │ │ ├── dyld.h │ │ ├── dyld.modulemap │ │ ├── dyld_images.h │ │ ├── fat.h │ │ ├── fixup-chains.h │ │ ├── getsect.h │ │ ├── i386/ │ │ │ └── swap.h │ │ ├── ldsyms.h │ │ ├── loader.h │ │ ├── module.modulemap │ │ ├── nlist.h │ │ ├── ranlib.h │ │ ├── reloc.h │ │ ├── stab.h │ │ ├── swap.h │ │ └── x86_64/ │ │ └── reloc.h │ ├── os/ │ │ ├── _workgroup.h │ │ ├── activity.h │ │ ├── atomic.h │ │ ├── availability.h │ │ ├── base.h │ │ ├── clock.h │ │ ├── lock.h │ │ ├── log.h │ │ ├── object.h │ │ ├── overflow.h │ │ ├── proc.h │ │ ├── signpost.h │ │ ├── trace.h │ │ ├── trace_base.h │ │ ├── workgroup.h │ │ ├── workgroup_base.h │ │ ├── workgroup_interval.h │ │ ├── workgroup_object.h │ │ └── workgroup_parallel.h │ └── sys/ │ ├── _endian.h │ ├── _posix_availability.h │ ├── _pthread/ │ │ ├── _pthread_attr_t.h │ │ ├── _pthread_cond_t.h │ │ ├── _pthread_condattr_t.h │ │ ├── _pthread_key_t.h │ │ ├── _pthread_mutex_t.h │ │ ├── _pthread_mutexattr_t.h │ │ ├── _pthread_once_t.h │ │ ├── _pthread_rwlock_t.h │ │ ├── _pthread_rwlockattr_t.h │ │ ├── _pthread_t.h │ │ └── _pthread_types.h │ ├── _select.h │ ├── _structs.h │ ├── _symbol_aliasing.h │ ├── _types/ │ │ ├── _blkcnt_t.h │ │ ├── _blksize_t.h │ │ ├── _caddr_t.h │ │ ├── _clock_t.h │ │ ├── _ct_rune_t.h │ │ ├── _dev_t.h │ │ ├── _errno_t.h │ │ ├── _fd_clr.h │ │ ├── _fd_copy.h │ │ ├── _fd_def.h │ │ ├── _fd_isset.h │ │ ├── _fd_set.h │ │ ├── _fd_setsize.h │ │ ├── _fd_zero.h │ │ ├── _filesec_t.h │ │ ├── _fsblkcnt_t.h │ │ ├── _fsfilcnt_t.h │ │ ├── _fsid_t.h │ │ ├── _fsobj_id_t.h │ │ ├── _gid_t.h │ │ ├── _guid_t.h │ │ ├── _id_t.h │ │ ├── _in_addr_t.h │ │ ├── _in_port_t.h │ │ ├── _ino64_t.h │ │ ├── _ino_t.h │ │ ├── _int16_t.h │ │ ├── _int32_t.h │ │ ├── _int64_t.h │ │ ├── _int8_t.h │ │ ├── _intptr_t.h │ │ ├── _iovec_t.h │ │ ├── _key_t.h │ │ ├── _mach_port_t.h │ │ ├── _mbstate_t.h │ │ ├── _mode_t.h │ │ ├── _nlink_t.h │ │ ├── _null.h │ │ ├── _o_dsync.h │ │ ├── _o_sync.h │ │ ├── _off_t.h │ │ ├── _offsetof.h │ │ ├── _os_inline.h │ │ ├── _pid_t.h │ │ ├── _posix_vdisable.h │ │ ├── _ptrdiff_t.h │ │ ├── _rsize_t.h │ │ ├── _rune_t.h │ │ ├── _s_ifmt.h │ │ ├── _sa_family_t.h │ │ ├── _seek_set.h │ │ ├── _sigaltstack.h │ │ ├── _sigset_t.h │ │ ├── _size_t.h │ │ ├── _socklen_t.h │ │ ├── _ssize_t.h │ │ ├── _suseconds_t.h │ │ ├── _time_t.h │ │ ├── _timespec.h │ │ ├── _timeval.h │ │ ├── _timeval32.h │ │ ├── _timeval64.h │ │ ├── _u_char.h │ │ ├── _u_int.h │ │ ├── _u_int16_t.h │ │ ├── _u_int32_t.h │ │ ├── _u_int64_t.h │ │ ├── _u_int8_t.h │ │ ├── _u_short.h │ │ ├── _ucontext.h │ │ ├── _ucontext64.h │ │ ├── _uid_t.h │ │ ├── _uintptr_t.h │ │ ├── _useconds_t.h │ │ ├── _uuid_t.h │ │ ├── _va_list.h │ │ ├── _wchar_t.h │ │ └── _wint_t.h │ ├── _types.h │ ├── acct.h │ ├── acl.h │ ├── aio.h │ ├── appleapiopts.h │ ├── attr.h │ ├── buf.h │ ├── cdefs.h │ ├── clonefile.h │ ├── commpage.h │ ├── conf.h │ ├── dir.h │ ├── dirent.h │ ├── disk.h │ ├── dkstat.h │ ├── domain.h │ ├── dtrace.h │ ├── dtrace_glue.h │ ├── dtrace_impl.h │ ├── errno.h │ ├── ev.h │ ├── event.h │ ├── fasttrap.h │ ├── fasttrap_isa.h │ ├── fcntl.h │ ├── file.h │ ├── filedesc.h │ ├── filio.h │ ├── fsgetpath.h │ ├── gmon.h │ ├── ioccom.h │ ├── ioctl.h │ ├── ioctl_compat.h │ ├── ipc.h │ ├── kauth.h │ ├── kdebug.h │ ├── kdebug_signpost.h │ ├── kern_control.h │ ├── kern_event.h │ ├── kernel.h │ ├── kernel_types.h │ ├── lctx.h │ ├── loadable_fs.h │ ├── lock.h │ ├── lockf.h │ ├── lockstat.h │ ├── log_data.h │ ├── malloc.h │ ├── mbuf.h │ ├── mman.h │ ├── mount.h │ ├── msg.h │ ├── msgbuf.h │ ├── netport.h │ ├── param.h │ ├── paths.h │ ├── pipe.h │ ├── poll.h │ ├── posix_sem.h │ ├── posix_shm.h │ ├── proc.h │ ├── proc_info.h │ ├── protosw.h │ ├── ptrace.h │ ├── qos.h │ ├── queue.h │ ├── quota.h │ ├── random.h │ ├── rbtree.h │ ├── reboot.h │ ├── resource.h │ ├── resourcevar.h │ ├── sbuf.h │ ├── sdt.h │ ├── select.h │ ├── sem.h │ ├── semaphore.h │ ├── shm.h │ ├── signal.h │ ├── signalvar.h │ ├── snapshot.h │ ├── socket.h │ ├── socketvar.h │ ├── sockio.h │ ├── spawn.h │ ├── stat.h │ ├── statvfs.h │ ├── stdio.h │ ├── sys_domain.h │ ├── syscall.h │ ├── sysctl.h │ ├── syslimits.h │ ├── syslog.h │ ├── termios.h │ ├── time.h │ ├── timeb.h │ ├── times.h │ ├── timex.h │ ├── tprintf.h │ ├── trace.h │ ├── tty.h │ ├── ttychars.h │ ├── ttycom.h │ ├── ttydefaults.h │ ├── ttydev.h │ ├── types.h │ ├── ubc.h │ ├── ucontext.h │ ├── ucred.h │ ├── uio.h │ ├── un.h │ ├── unistd.h │ ├── unpcb.h │ ├── user.h │ ├── utfconv.h │ ├── utsname.h │ ├── vadvise.h │ ├── vcmd.h │ ├── vm.h │ ├── vmmeter.h │ ├── vmparam.h │ ├── vnioctl.h │ ├── vnode.h │ ├── vnode_if.h │ ├── vsock.h │ ├── vstat.h │ ├── wait.h │ └── xattr.h ├── cross-windows/ │ ├── TraceLoggingProvider.h │ ├── VersionHelpers.h │ ├── Windows.h │ └── src/ │ └── base/ │ └── win32-headers.h ├── parse_deps.py ├── patches/ │ ├── v8.patch │ └── v8_build.patch └── src/ ├── binding.cpp ├── binding.h ├── shell.zig ├── test.zig └── v8.zig ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitattributes ================================================ *.zig text eol=lf *.md text eol=lf *.patch text eol=lf V8_REVISION text eol=lf cross-macos/** linguist-vendored ================================================ FILE: .github/workflows/build-single.yml ================================================ name: Build V8 (Single) on: workflow_dispatch: inputs: host: type: choice description: Host options: - ubuntu-22.04 - macos-12 - windows-2019 target: type: choice description: Target options: - x86_64-linux-gnu - x86_64-macos-none - x86_64-windows-msvc - x86_64-windows-gnu - aarch64-macos-none mode: type: choice description: Mode options: - release toolchain: type: choice description: Toolchain options: - v8 - zig jobs: build: name: host=${{ github.event.inputs.host }} target=${{ github.event.inputs.target }} mode=${{ github.event.inputs.mode }} tc=${{ github.event.inputs.toolchain }} runs-on: ${{ github.event.inputs.host }} env: ARCH_OS: >- ${{ fromJson('{ "x86_64-windows-gnu": "x86_64-windows", "x86_64-windows-msvc": "x86_64-windows", "x86_64-linux-gnu": "x86_64-linux", "x86_64-macos-none": "x86_64-macos", "aarch64-macos-none": "aarch64-macos", }')[github.event.inputs.target] }} ZIG_TARGET_FLAG: >- ${{ fromJson('{ "x86_64-windows-gnu": "-Dtarget=x86_64-windows-gnu -Dcpu=baseline", "x86_64-windows-msvc": "-Dtarget=x86_64-windows-msvc -Dcpu=baseline", "x86_64-linux-gnu": "-Dtarget=x86_64-linux-gnu -Dcpu=baseline", "x86_64-macos-none": "-Dtarget=x86_64-macos.12-none -Dcpu=baseline", "aarch64-macos-none": "-Dtarget=aarch64-macos.12-none -Dcpu=baseline", }')[github.event.inputs.target] }} LIB_NAME: ${{ contains(github.event.inputs.target, 'windows') && 'c_v8' || 'libc_v8' }} LIB_EXT: ${{ contains(github.event.inputs.target, 'windows') && 'lib' || 'a' }} BUILD_HOST: ${{ matrix.config.host }} BUILD_TARGET: ${{ github.event.inputs.target }} BUILD_MODE: ${{ github.event.inputs.mode }} BUILD_TOOLCHAIN: ${{ github.event.inputs.toolchain }} steps: - name: Clone repo. uses: actions/checkout@v2 with: fetch-depth: 1 submodules: recursive - name: Get build tag. shell: bash # Need single quotes or path sep becomes escapes on windows host. xargs does trimming. run: echo "BUILD_TAG=$(cat '${{ github.workspace }}/V8_REVISION' | xargs)" >> $GITHUB_ENV - name: Create/Update tag. uses: actions/github-script@v5 with: script: | const ref = 'tags/${{ env.BUILD_TAG }}'; const res = await github.rest.git.listMatchingRefs({ owner: context.repo.owner, repo: context.repo.repo, ref: 'tags/${{ env.BUILD_TAG }}', }); if (res.data.length > 0) { await github.rest.git.updateRef({ owner: context.repo.owner, repo: context.repo.repo, ref: 'tags/${{ env.BUILD_TAG }}', sha: context.sha, }); } else { await github.rest.git.createRef({ owner: context.repo.owner, repo: context.repo.repo, // Only create needs full path ref: 'refs/tags/${{ env.BUILD_TAG }}', sha: context.sha, }); } - name: Install zig. if: env.BUILD_HOST == 'ubuntu-22.04' run: | wget -c https://ziglang.org/builds/zig-linux-x86_64-0.11.0-dev.944+a193ec432.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin - name: Install zig. if: env.BUILD_HOST == 'macos-12' run: | wget -c https://ziglang.org/builds/zig-macos-x86_64-0.11.0-dev.944+a193ec432.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin xcode-select --print-path - name: Cache. if: env.BUILD_TOOLCHAIN == 'zig' uses: actions/cache@v2 with: path: |- ~/.cache/zig key: c_v8-${{ env.BUILD_TARGET }}-${{ env.BUILD_MODE }}-zig2 restore-keys: c_v8-${{ env.BUILD_TARGET }}-${{ env.BUILD_MODE }}-zig2 - name: Cache. if: env.BUILD_TOOLCHAIN == 'v8' uses: actions/cache@v2 with: # Restore sccache so subsequent runs can reuse the cache. # TODO: Might be useful to restore some of v8 source deps so get-v8 does less work. path: |- sccache key: # The cache can behave unexpectedly (usually happens when we change the path), so we just increase a simple id counter to create a new cache. c_v8-${{ env.BUILD_TARGET }}-${{ env.BUILD_MODE }}-2 restore-keys: # Reuse a previous cache. c_v8-${{ env.BUILD_TARGET }}-${{ env.BUILD_MODE }}- - name: Install and start sccache. if: env.BUILD_TOOLCHAIN == 'v8' shell: pwsh env: SCCACHE_DIR: ${{ github.workspace }}/sccache # Compiling all of v8 takes up about 100M for debug builds so this is a good starting point. SCCACHE_CACHE_SIZE: 128M SCCACHE_IDLE_TIMEOUT: 0 run: | $version = "v0.2.15" $platform = @{ "macOS" = "x86_64-apple-darwin" "Linux" = "x86_64-unknown-linux-musl" "Windows" = "x86_64-pc-windows-msvc" }.${{ runner.os }} $basename = "sccache-$version-$platform" $url = "https://github.com/mozilla/sccache/releases/download/" + "$version/$basename.tar.gz" cd ~ curl -LO $url tar -xzvf "$basename.tar.gz" chmod a+x $basename/sccache . $basename/sccache --start-server echo "$(pwd)/$basename" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - name: Get V8 Tools. run: zig build get-tools - name: Get V8 Source. run: zig build get-v8 - name: Build release. if: env.BUILD_MODE == 'release' && env.BUILD_TOOLCHAIN == 'v8' run: zig build -Drelease-safe ${{ env.ZIG_TARGET_FLAG }} - name: Build release. if: env.BUILD_MODE == 'release' && env.BUILD_TOOLCHAIN == 'zig' run: zig build -Drelease-safe ${{ env.ZIG_TARGET_FLAG }} -Dzig-toolchain - name: Build debug. if: env.BUILD_MODE == 'debug' run: zig build - name: Copy binary. if: env.BUILD_TARGET != 'x86_64-windows-gnu' continue-on-error: true run: cp v8-build/${{ env.ARCH_OS }}/${{ env.BUILD_MODE }}/ninja/obj/zig/${{ env.LIB_NAME }}.${{ env.LIB_EXT }} v8-build/${{ env.LIB_NAME }}_${{ env.BUILD_TARGET }}_${{ env.BUILD_MODE }}_${{ env.BUILD_TAG }}.${{ env.LIB_EXT }} - name: Copy binary. if: env.BUILD_TARGET == 'x86_64-windows-gnu' continue-on-error: true run: cp v8-build/${{ env.ARCH_OS }}/${{ env.BUILD_MODE }}/ninja/obj/zig/libc_v8.a v8-build/${{ env.LIB_NAME }}_${{ env.BUILD_TARGET }}_${{ env.BUILD_MODE }}_${{ env.BUILD_TAG }}.${{ env.LIB_EXT }} - name: Github Release. uses: softprops/action-gh-release@v0.1.14 # Github requires tags for releases. #if: startsWith(github.ref, 'refs/tags/') env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: body: Release name: ${{ env.BUILD_TAG }} tag_name: ${{ env.BUILD_TAG }} files: v8-build/${{ env.LIB_NAME }}_${{ env.BUILD_TARGET }}_${{ env.BUILD_MODE }}_${{ env.BUILD_TAG }}.${{ env.LIB_EXT }} - name: Stop sccache. if: env.BUILD_TOOLCHAIN == 'v8' && always() run: | sccache --show-stats sccache --stop-server ================================================ FILE: .github/workflows/build.yml ================================================ name: Build V8 on: [workflow_dispatch, push] concurrency: group: my-group cancel-in-progress: true jobs: build: name: host=${{ matrix.config.host }} target=${{ matrix.config.target }} mode=${{ matrix.config.mode }} tc=${{ matrix.config.toolchain }} runs-on: ${{ matrix.config.host }} strategy: fail-fast: true matrix: config: - host: ubuntu-22.04 target: x86_64-linux-gnu mode: release toolchain: zig - host: macos-12 target: x86_64-macos-none mode: release toolchain: v8 - host: ubuntu-22.04 target: x86_64-windows-gnu mode: release toolchain: zig - host: ubuntu-22.04 target: aarch64-macos-none mode: release toolchain: zig env: ARCH_OS: >- ${{ fromJson('{ "x86_64-windows-gnu": "x86_64-windows", "x86_64-linux-gnu": "x86_64-linux", "x86_64-macos-none": "x86_64-macos", "aarch64-macos-none": "aarch64-macos", }')[matrix.config.target] }} ZIG_TARGET_FLAG: >- ${{ fromJson('{ "x86_64-windows-gnu": "-Dtarget=x86_64-windows-gnu -Dcpu=baseline", "x86_64-linux-gnu": "-Dtarget=x86_64-linux-gnu -Dcpu=baseline", "x86_64-macos-gnu": "-Dtarget=x86_64-macos.12-none -Dcpu=baseline", "aarch64-macos-gnu": "-Dtarget=aarch64-macos.12-none -Dcpu=baseline", }')[matrix.config.target] }} BUILD_HOST: ${{ matrix.config.host }} BUILD_TARGET: ${{ matrix.config.target }} BUILD_MODE: ${{ matrix.config.mode }} BUILD_TOOLCHAIN: ${{ matrix.config.toolchain }} LIB_NAME: ${{ contains(matrix.config.target, 'windows') && 'c_v8' || 'libc_v8' }} LIB_EXT: ${{ contains(matrix.config.target, 'windows') && 'lib' || 'a' }} steps: - name: Clone repo. uses: actions/checkout@v2 with: fetch-depth: 1 submodules: recursive - name: Get build tag. shell: bash # Need single quotes or path sep becomes escapes on windows host. xargs does trimming. run: echo "BUILD_TAG=$(cat '${{ github.workspace }}/V8_REVISION' | xargs)" >> $GITHUB_ENV - name: Create/Update tag. uses: actions/github-script@v5 with: script: | const ref = 'tags/${{ env.BUILD_TAG }}'; const res = await github.rest.git.listMatchingRefs({ owner: context.repo.owner, repo: context.repo.repo, ref: 'tags/${{ env.BUILD_TAG }}', }); if (res.data.length > 0) { await github.rest.git.updateRef({ owner: context.repo.owner, repo: context.repo.repo, ref: 'tags/${{ env.BUILD_TAG }}', sha: context.sha, }); } else { await github.rest.git.createRef({ owner: context.repo.owner, repo: context.repo.repo, // Only create needs full path ref: 'refs/tags/${{ env.BUILD_TAG }}', sha: context.sha, }); } - name: Install zig. if: env.BUILD_HOST == 'ubuntu-22.04' run: | wget -c https://ziglang.org/builds/zig-linux-x86_64-0.11.0-dev.1797+d3c9bfada.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin - name: Install zig. if: env.BUILD_HOST == 'macos-12' run: | wget -c https://ziglang.org/builds/zig-macos-x86_64-0.11.0-dev.1797+d3c9bfada.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin xcode-select --print-path - name: Cache. if: env.BUILD_TOOLCHAIN == 'zig' uses: actions/cache@v2 with: path: |- ~/.cache/zig key: c_v8-${{ env.BUILD_TARGET }}-${{ env.BUILD_MODE }}-zig2 restore-keys: c_v8-${{ env.BUILD_TARGET }}-${{ env.BUILD_MODE }}-zig2 - name: Cache. if: env.BUILD_TOOLCHAIN == 'v8' uses: actions/cache@v2 with: # Restore sccache so subsequent runs can reuse the cache. # TODO: Might be useful to restore some of v8 source deps so get-v8 does less work. path: |- sccache key: # The cache can behave unexpectedly (usually happens when we change the path), so we just increase a simple id counter to create a new cache. c_v8-${{ env.BUILD_TARGET }}-${{ env.BUILD_MODE }}-2 restore-keys: # Reuse a previous cache. c_v8-${{ env.BUILD_TARGET }}-${{ env.BUILD_MODE }}- - name: Install and start sccache. if: env.BUILD_TOOLCHAIN == 'v8' shell: pwsh env: SCCACHE_DIR: ${{ github.workspace }}/sccache # Compiling all of v8 takes up about 100M for debug builds so this is a good starting point. SCCACHE_CACHE_SIZE: 128M SCCACHE_IDLE_TIMEOUT: 0 run: | $version = "v0.2.15" $platform = @{ "macOS" = "x86_64-apple-darwin" "Linux" = "x86_64-unknown-linux-musl" "Windows" = "x86_64-pc-windows-msvc" }.${{ runner.os }} $basename = "sccache-$version-$platform" $url = "https://github.com/mozilla/sccache/releases/download/" + "$version/$basename.tar.gz" cd ~ curl -LO $url tar -xzvf "$basename.tar.gz" chmod a+x $basename/sccache . $basename/sccache --start-server echo "$(pwd)/$basename" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - name: Get V8 Tools. run: zig build get-tools - name: Get V8 Source. run: zig build get-v8 - name: Build release. if: env.BUILD_MODE == 'release' && env.BUILD_TOOLCHAIN == 'v8' run: zig build -Doptimize=ReleaseSafe ${{ env.ZIG_TARGET_FLAG }} - name: Build release. if: env.BUILD_MODE == 'release' && env.BUILD_TOOLCHAIN == 'zig' run: zig build -Doptimize=ReleaseSafe ${{ env.ZIG_TARGET_FLAG }} -Dzig-toolchain - name: Build debug. if: env.BUILD_MODE == 'debug' run: zig build - name: Copy binary. if: env.BUILD_TARGET != 'x86_64-windows-gnu' continue-on-error: true run: cp v8-build/${{ env.ARCH_OS }}/${{ env.BUILD_MODE }}/ninja/obj/zig/${{ env.LIB_NAME }}.${{ env.LIB_EXT }} v8-build/${{ env.LIB_NAME }}_${{ env.BUILD_TARGET }}_${{ env.BUILD_MODE }}_${{ env.BUILD_TAG }}.${{ env.LIB_EXT }} - name: Copy binary. if: env.BUILD_TARGET == 'x86_64-windows-gnu' continue-on-error: true run: cp v8-build/${{ env.ARCH_OS }}/${{ env.BUILD_MODE }}/ninja/obj/zig/libc_v8.a v8-build/${{ env.LIB_NAME }}_${{ env.BUILD_TARGET }}_${{ env.BUILD_MODE }}_${{ env.BUILD_TAG }}.${{ env.LIB_EXT }} - name: Github Release. uses: softprops/action-gh-release@v0.1.14 # Github requires tags for releases. #if: startsWith(github.ref, 'refs/tags/') env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: body: Release name: ${{ env.BUILD_TAG }} tag_name: ${{ env.BUILD_TAG }} files: v8-build/${{ env.LIB_NAME }}_${{ env.BUILD_TARGET }}_${{ env.BUILD_MODE }}_${{ env.BUILD_TAG }}.${{ env.LIB_EXT }} - name: Stop sccache. if: env.BUILD_TOOLCHAIN == 'v8' && always() run: | sccache --show-stats sccache --stop-server ================================================ FILE: .gitignore ================================================ /zig-cache/ /tools/ninja_gn_binaries* /v8-build/ /gclient/ /v8/ /zig-out/ /vendor /libc_v8.a /tools/ ================================================ FILE: .gn ================================================ # This file is used by the GN meta build system to find the root of the source # tree and to set startup options. For documentation on the values set in this # file, run "gn help dotfile" at the command line. # Use the default python3 so gn succeeds. Not sure why deno requires python2 atm. script_executable = "python3" # The location of the build configuration file. buildconfig = "//build/config/BUILDCONFIG.gn" # These are the targets to check headers for by default. The files in targets # matching these patterns (see "gn help label_pattern" for format) will have # their includes checked for proper dependencies when you run either # "gn check" or "gn gen --check". check_targets = [] # The secondary source root is a parallel directory tree where # GN build files are placed when they can not be placed directly # in the source tree, e.g. for third party source trees. #secondary_source = "//gclient/v8" default_args = { linux_use_bundled_binutils = false use_sysroot = false use_dummy_lastchange = true treat_warnings_as_errors = true v8_enable_shared_ro_heap = false v8_imminent_deprecation_warnings = false clang_use_chrome_plugins = false v8_monolithic = false v8_use_external_startup_data = false v8_use_snapshot = true is_component_build = false win_crt_flavor_agnostic = true } ================================================ FILE: BUILD.gclient.gn ================================================ # Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. # Based on https://github.com/denoland/rusty_v8/blob/main/BUILD.gn import("//build/config/host_byteorder.gni") static_library("c_v8") { complete_static_lib = true sources = [ "../../../src/binding.cpp" ] deps = [ "//build/config:shared_library_deps", "//:v8", "//:v8_libbase", "//:v8_libplatform", ] configs -= [ "//build/config/compiler:default_init_stack_vars", "//build/config/compiler:thin_archive", ] configs += [ ":c_v8_config" ] } config("c_v8_config") { configs = [ "//:external_config", "//:toolchain", "//:features", ] cflags = [] # We need these directories in the search path to be able to include some # internal V8 headers. include_dirs = [ "v8", "$target_gen_dir/v8", ] if (is_debug) { defines = [ "DEBUG" ] } if (is_clang) { cflags += [ "-fcolor-diagnostics", "-fansi-escape-codes", ] } if (is_debug && is_clang && !is_win) { cflags += [ "-glldb" ] } } ================================================ FILE: BUILD.gn ================================================ # Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. # Based on https://github.com/denoland/rusty_v8/blob/main/BUILD.gn import("//build/config/host_byteorder.gni") import("//build/toolchain/gcc_toolchain.gni") import("//build/config/c++/c++.gni") static_library("c_v8") { complete_static_lib = true sources = [ "../../src/binding.cpp" ] deps = [ "//build/config:shared_library_deps", "//:v8", "//:v8_libbase", "//:v8_libplatform", ] configs -= [ "//build/config/compiler:default_init_stack_vars", "//build/config/compiler:thin_archive", ] configs += [ ":c_v8_config" ] } config("c_v8_config") { configs = [ "//:external_config", "//:toolchain", "//:features", ] cflags = [] # We need these directories in the search path to be able to include some # internal V8 headers. include_dirs = [ "v8", "$target_gen_dir/v8", ] if (is_debug) { defines = [ "DEBUG" ] } if (is_clang) { cflags += [ "-fcolor-diagnostics", "-fansi-escape-codes", ] } if (is_debug && is_clang && !is_win) { cflags += [ "-glldb" ] } } # Based on template("clang_toolchain") in build/toolchain/gcc_toolchain.gni template("zig_toolchain") { gcc_toolchain(target_name) { prefix = rebase_path("$clang_base_path/bin", root_build_dir) readelf = "${prefix}/llvm-readelf" # Is this even used? nm = "${prefix}/llvm-nm" if (current_cpu == "x64" && current_os == "linux") { # From //build/toolchain/linux:clang_x64 # Output linker map files for binary size analysis. enable_linker_map = true } forward_variables_from(invoker, [ "strip", "default_shlib_subdir", "dwp", "enable_linker_map", "loadable_module_extension", "use_unstripped_as_runtime_outputs", "cc", "cxx", "ld", "ar", "extra_cppflags", ]) toolchain_args = { if (defined(invoker.toolchain_args)) { forward_variables_from(invoker.toolchain_args, "*") } is_clang = true } } } # Used to compile the v8 library. zig_toolchain("main_zig_toolchain") { cc = zig_cc cxx = zig_cxx # ld commands in v8 use cxx with -fuse-ld ld = cxx #ar = "${prefix}/llvm-ar" ar = "zig ar" extra_cppflags = "-Wno-unused-but-set-variable" toolchain_args = { current_cpu = target_cpu current_os = target_os } } # Used to compile v8 snapshots/generators to run locally. # v8_current_cpu indicates that we are still targeting a different arch but must compile tools to run on host machine. # See gni/snapshot_toolchain.gni zig_toolchain("v8_zig_toolchain") { cc = host_zig_cc cxx = host_zig_cxx # ld commands in v8 use cxx with -fuse-ld ld = cxx #ar = "${prefix}/llvm-ar" ar = "zig ar" extra_cppflags = "-Wno-unused-but-set-variable" toolchain_args = { current_os = host_os current_cpu = host_cpu v8_current_cpu = target_cpu } } ================================================ FILE: LICENSE ================================================ MIT License Copyright (c) 2021 fubark Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: README.md ================================================ # zig-v8 Builds V8 from official source and provides C bindings and a Zig API. This would be used for embedding the V8 runtime into your Zig or C ABI compatible projects. V8 is the JS/WASM runtime that powers Google Chrome and Microsoft Edge. ## Project Status Static libs are built and released with [Github Actions](https://github.com/fubark/zig-v8/actions). | Native | Cross Compile | Target | Demo Binary ([shell.zig](https://github.com/fubark/zig-v8/blob/master/src/shell.zig))* | | ------ | ------ | -------- | -------- | | ✅ | | Linux x64 | shell - 19 M | | ✅ | ✅ | Windows x64 | shell.exe - 14 M | | ✅ | | macOS x64 | shell - 24 M | | ✅ | ✅ | macOS arm64 | shell - 21 M | \* shell.zig is a JS repl and statically linked with v8. Compiled with -Doptimize=ReleaseSafe. The V8 dependency can be further reduced in size if you don't need all the features (eg. disable WASM runtime). | Toolchain | Fresh Build* | Cached Build* | | ------ | ------ | ------ | | gclient, full feature + v8 toolchain | 1.5-2 hrs | with sccache: 10-20min | | minimal feature + v8 toolchain | 40-50 min | with sccache: 5-10min | | minimal feature + zig c++ toolchain | | with zig caching: | \* Time is measured on standard Github instances. ## System Requirements - Zig compiler (0.11.0). You can get that [here](https://ziglang.org/download/). - Python 3 (2.7 seems to work as well) - For native macOS builds: - XCode (You won't need this when using zig's c++ toolchain!)
if you come across this error:
`xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance`
run `sudo xcode-select -s /Applications/Xcode.app/Contents/Developer` ## Build By default UseGclient=false in build.zig. This will pull the minimum sources and deps needed to build v8 and reduce build times. If you want to include everything, set UseGclient=true. Build times can be quite long using gclient but afterwards rerunning "zig build" should be incremental. You can also use sccache for better incremental build times. ```sh # Clone the repo. git clone https://github.com/fubark/zig-v8.git cd zig-v8 # Pull prebuilt GN/Ninja. If UseGclient=true, it also pulls depot_tools. zig build get-tools # Pull v8 source zig build get-v8 # Build, resulting static library should be at: # v8-build/{target}/{debug/release}/ninja/obj/zig/libc_v8.a # On windows, use msvc: zig build -Doptimize=ReleaseSafe -Dtarget=x86_64-windows-msvc zig build -Doptimize=ReleaseSafe ``` ## Demo ```sh # shell.zig is a simple JS repl. # Assumes you've already built v8. zig build run -Dpath="src/shell.zig" -Doptimize=ReleaseSafe # If you built v8 using the zig toolchain, you'll need to add the flag here as well. zig build run -Dpath="src/shell.zig" -Doptimize=ReleaseSafe -Dzig-toolchain ``` ## Cross Compiling With Zig's toolchain, we can build V8 from libstdc++ that's bundled with zig and cross compile to foreign targets/cpus! Simply amazing. Eventually, this will also replace the default V8 toolchain for native builds after further testing. ### Linux x64 (Host) to MacOS arm64 (Target) ```sh # Assumes you've fetched tools and v8 sources. See above build steps. # Resulting static lib will be at: # v8-build/aarch64-macos/release/ninja/obj/zig/libc_v8.a zig build -Doptimize=ReleaseSafe -Dtarget=aarch64-macos-gnu -Dzig-toolchain ``` ### Cross compile to Windows with gnu (mingw64) Zig comes with mingw64 source and headers so you'll be able to target Windows without MSVC. ```sh zig build -Doptimize=ReleaseSafe -Dtarget=x86_64-windows-gnu -Dzig-toolchain ``` ## Usage See src/shell.zig or test/test.zig on how to use the library with the Zig API as well as build.zig (fn linkV8) on how to link with the built V8 static library. ## Contributing The C bindings is incomplete but it should be relatively easy to add more as we need them. C API naming convention should closely follow the V8 C++ API. ## Troubleshooting If you get an error saying that it can't find any of the following: ``` pkg-config glib-2.0 gmodule-2.0 gobject-2.0 gthread-2.0 ``` You'll need to run the following command before continuing: ``` sudo apt install -y pkg-config libglib2.0-dev ``` Or your distro's equivalent ================================================ FILE: V8_REVISION ================================================ 11.1.134 ================================================ FILE: build.zig ================================================ const std = @import("std"); const json = std.json; const Builder = std.Build; const Step = std.Build.Step; const print = std.debug.print; const builtin = @import("builtin"); const Pkg = std.build.Pkg; const fs = std.fs; pub fn build(b: *Builder) !void { // Options. //const build_v8 = b.option(bool, "build_v8", "Whether to build from v8 source") orelse false; const path = b.option([]const u8, "path", "Path to main file, for: build, run") orelse ""; const use_zig_tc = b.option(bool, "zig-toolchain", "Experimental: Use zig cc/c++/ld to build v8.") orelse false; const mode = b.standardOptimizeOption(.{}); //FIXED const target = b.standardTargetOptions(.{}); _ = createGetTools(b); _ = createGetV8(b); const v8 = try createV8_Build(b, target, mode, use_zig_tc); const tests = createTest(b, target, mode, use_zig_tc); tests.step.dependOn(v8); const test_step = b.addRunArtifact(tests); b.step("test", "Run unit tests").dependOn(&test_step.step); const build_exe = createBuildExeStep(b, path, target, mode, use_zig_tc); const run_exe = b.addRunArtifact(build_exe); b.step("run", "Run with main file at -Dpath").dependOn(&run_exe.step); b.default_step.dependOn(v8); } // When this is true, we'll strip V8 features down to a minimum so the resulting library is smaller. // eg. i18n will be excluded. const MinimalV8 = true; // gclient is comprehensive and will pull everything for the v8 project. // Set this to false to pull the minimal required src by parsing v8/DEPS and whitelisting deps we care about. const UseGclient = false; // V8's build process is complex and porting it to zig could take quite awhile. // It would be nice if there was a way to import .gn files into the zig build system. // For now we just use gn/ninja like rusty_v8 does: https://github.com/denoland/rusty_v8/blob/main/build.rs fn createV8_Build(b: *Builder, target: std.Build.ResolvedTarget, mode: std.builtin.OptimizeMode, use_zig_tc: bool) !*std.Build.Step { const step = b.step("v8", "Build v8 c binding lib."); if (UseGclient) { const mkpath = MakePathStep.create(b, "./gclient/v8/zig"); step.dependOn(&mkpath.step); const cp = CopyFileStep.create(b, b.pathFromRoot("BUILD.gclient.gn"), b.pathFromRoot("gclient/v8/zig/BUILD.gn")); step.dependOn(&cp.step); } else { const mkpath = MakePathStep.create(b, "./v8/zig"); step.dependOn(&mkpath.step); const cp = CopyFileStep.create(b, b.pathFromRoot("BUILD.gn"), b.pathFromRoot("v8/zig/BUILD.gn")); step.dependOn(&cp.step); } var gn_args = std.ArrayList([]const u8).init(b.allocator); switch (target.result.os.tag) { .macos => try gn_args.append("target_os=\"mac\""), .windows => { try gn_args.append("target_os=\"win\""); if (!UseGclient) { // Don't use depot_tools. try b.graph.env_map.put("DEPOT_TOOLS_WIN_TOOLCHAIN", "0"); } }, .linux => try gn_args.append("target_os=\"linux\""), else => {}, } switch (target.result.cpu.arch) { .x86_64 => try gn_args.append("target_cpu=\"x64\""), .aarch64 => try gn_args.append("target_cpu=\"arm64\""), else => {}, } var zig_cc = std.ArrayList([]const u8).init(b.allocator); var zig_cxx = std.ArrayList([]const u8).init(b.allocator); var host_zig_cc = std.ArrayList([]const u8).init(b.allocator); var host_zig_cxx = std.ArrayList([]const u8).init(b.allocator); if (mode == .Debug) { try gn_args.append("is_debug=true"); // full debug info (symbol_level=2). // Setting symbol_level=1 will produce enough information for stack traces, but not line-by-line debugging. // Setting symbol_level=0 will include no debug symbols at all. Either will speed up the build compared to full symbols. // This will eventually pass down to v8_symbol_level. try gn_args.append("symbol_level=1"); } else { try gn_args.append("is_debug=false"); try gn_args.append("symbol_level=0"); // is_official_build is meant to ship chrome. // It might be interesting to see how far we can get with it (previously saw illegal instruction in Zone::NewExpand during mksnapshot_default since stacktraces were removed) // but a better approach for now is to set to false and slowly enable optimizations. eg. We probably still want to unwind stack traces. try gn_args.append("is_official_build=false"); // is_official_build will do pgo optimization by default for chrome specific builds that require gclient to fetch profile data. // https://groups.google.com/a/chromium.org/g/chromium-dev/c/-0t4s0RlmOI // Disable that with this: //try gn_args.append("chrome_pgo_phase=0"); //if (use_zig_tc) { // is_official_build will enable cfi but zig does not come with the default cfi_ignorelist. //try zig_cppflags.append("-fno-sanitize-ignorelist"); //} // TODO: Might want to turn V8_ENABLE_CHECKS off to remove asserts. } if (MinimalV8) { // Don't add i18n for now. It has a large dependency on third_party/icu. try gn_args.append("v8_enable_i18n_support=false"); } if (mode != .Debug) { // TODO: document try gn_args.append("v8_enable_handle_zapping=false"); } // Fix GN's host_cpu detection when using x86_64 bins on Apple Silicon if (builtin.os.tag == .macos and builtin.cpu.arch == .aarch64) { try gn_args.append("host_cpu=\"arm64\""); } if (use_zig_tc) { // Set target and cpu for building the lib. // TODO: If mcpu is equavalent to -Dcpu then use that instead try zig_cc.append(b.fmt("zig cc --target={s} -mcpu=baseline", .{try target.result.zigTriple(b.allocator)})); try zig_cxx.append(b.fmt("zig c++ --target={s} -mcpu=baseline", .{try target.result.zigTriple(b.allocator)})); try host_zig_cc.append("zig cc --target=native"); try host_zig_cxx.append("zig c++ --target=native"); // Ignore "a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype]" try zig_cc.append("-Wno-deprecated-non-prototype"); try zig_cxx.append("-Wno-deprecated-non-prototype"); try host_zig_cc.append("-Wno-deprecated-non-prototype"); try host_zig_cxx.append("-Wno-deprecated-non-prototype"); // For zlib. try zig_cc.append("-mcrc32"); try zig_cxx.append("-mcrc32"); if (target.result.os.tag == .windows and target.result.abi == .gnu) { // V8 expects __declspec(dllexport) to not expand in it's test in src/base/export-template.h but it does when compiling with mingw. try zig_cxx.append("-DEXPORT_TEMPLATE_TEST_MSVC_HACK_DEFAULT\\(...\\)=true"); } if (target.result.os.tag == .windows and builtin.os.tag != .windows) { // Cross building to windows probably is case sensitive to header files, so provide them in include. // Note: Directory is relative to ninja build folder. try zig_cxx.append("-I../../../../cross-windows"); // Make src/base/bits.h include win32-headers.h try zig_cxx.append("-DV8_OS_WIN32=1"); // Use wchar_t unicode functions. try zig_cxx.append("-DUNICODE=1"); // clang doesn't seem to recognize guard(nocf) even with -fdeclspec. It might be because mingw has a macro for __declspec. try zig_cxx.append("-Wno-error=unknown-attributes"); // include/v8config.h doesn't set mingw flags if __clang__ is defined. try zig_cxx.append("-DV8_CC_MINGW32=1"); try zig_cxx.append("-DV8_CC_MINGW64=1"); try zig_cxx.append("-DV8_CC_MINGW=1"); // Windows version. See build/config/win/BUILD.gn try zig_cxx.append("-DNTDDI_VERSION=NTDDI_WIN10_VB"); try zig_cxx.append("-D_WIN32_WINNT=0x0A00"); try zig_cxx.append("-DWINVER=0x0A00"); // Enable support for MSVC pragmas. try zig_cxx.append("-fms-extensions"); // Disable instrumentation since mingw doesn't have TraceLoggingProvider.h try gn_args.append("v8_enable_system_instrumentation=false"); try gn_args.append("v8_enable_etw_stack_walking=false"); } // Use zig's libcxx instead. // If there are problems we can see what types of flags are enabled when this is true. try gn_args.append("use_custom_libcxx=false"); // custom_toolchain is how we can set zig as the cc/cxx compiler and linker. try gn_args.append("custom_toolchain=\"//zig:main_zig_toolchain\""); if (target.result.os.tag == .linux and target.result.cpu.arch == .x86_64) { // Should add target flags that matches: //build/config/compiler:compiler_cpu_abi try zig_cc.append("-m64"); try zig_cxx.append("-m64"); } else if (target.result.os.tag == .macos) { if (!target.query.isNative()) { // Cross compiling. const sysroot_abs = b.pathFromRoot("./cross-macos/sysroot/macos-12/usr/include"); try zig_cc.append("-isystem"); try zig_cc.append(sysroot_abs); try zig_cxx.append("-isystem"); try zig_cxx.append(sysroot_abs); } } if (builtin.cpu.arch != target.result.cpu.arch or builtin.os.tag != target.result.os.tag) { try gn_args.append("v8_snapshot_toolchain=\"//zig:v8_zig_toolchain\""); } // Just warn for now. TODO: Check to remove after next clang update. // https://bugs.chromium.org/p/chromium/issues/detail?id=1016945 try zig_cxx.append("-Wno-error=builtin-assume-aligned-alignment"); try host_zig_cxx.append("-Wno-error=builtin-assume-aligned-alignment"); try gn_args.append("use_zig_tc=true"); try gn_args.append("cxx_use_ld=\"zig ld.lld\""); // Build zig cc strings. var arg = b.fmt("zig_cc=\"{s}\"", .{try std.mem.join(b.allocator, " ", zig_cc.items)}); try gn_args.append(arg); arg = b.fmt("zig_cxx=\"{s}\"", .{try std.mem.join(b.allocator, " ", zig_cxx.items)}); try gn_args.append(arg); arg = b.fmt("host_zig_cc=\"{s}\"", .{try std.mem.join(b.allocator, " ", host_zig_cc.items)}); try gn_args.append(arg); arg = b.fmt("host_zig_cxx=\"{s}\"", .{try std.mem.join(b.allocator, " ", host_zig_cxx.items)}); try gn_args.append(arg); } else { if (builtin.os.tag != .windows) { try gn_args.append("cxx_use_ld=\"lld\""); } } // sccache, currently does not work with zig cc if (!use_zig_tc) { if (b.graph.env_map.get("SCCACHE")) |path| { const cc_wrapper = try std.fmt.allocPrint(b.allocator, "cc_wrapper=\"{s}\"", .{path}); try gn_args.append(cc_wrapper); } else { if (builtin.os.tag == .windows) { // findProgram look for "PATH" case sensitive. try b.graph.env_map.put("PATH", b.graph.env_map.get("Path") orelse ""); } if (b.findProgram(&.{"sccache"}, &.{})) |_| { const cc_wrapper = try std.fmt.allocPrint(b.allocator, "cc_wrapper=\"{s}\"", .{"sccache"}); try gn_args.append(cc_wrapper); } else |err| { if (err != error.FileNotFound) { unreachable; } } if (builtin.os.tag == .windows) { // After creating PATH for windows so findProgram can find sccache, we need to delete it // or a gn tool (build/toolchain/win/setup_toolchain.py) will complain about not finding cl.exe. b.graph.env_map.remove("PATH"); } } } // var check_deps = CheckV8DepsStep.create(b); // step.step.dependOn(&check_deps.step); const mode_str: []const u8 = if (mode == .Debug) "debug" else "release"; // GN will generate ninja build files in ninja_out_path which will also contain the artifacts after running ninja. const ninja_out_path = try std.fmt.allocPrint(b.allocator, "v8-build/{s}/{s}/ninja", .{ getTargetId(b.allocator, target), mode_str, }); const gn = getGnPath(b); const arg_items = try std.mem.join(b.allocator, " ", gn_args.items); const args = try std.mem.join(b.allocator, "", &.{ "--args=", arg_items }); // Currently we have to use gclient/v8 as the source root since all those nested gn files expects it, (otherwise, we'll run into duplicate argument declaration errors.) // --dotfile lets us use a different .gn outside of the source root. // --root-target is a directory that must be inside the source root where we can have a custom BUILD.gn. // Since gclient/v8 is not part of our repo, we copy over BUILD.gn to gclient/v8/zig/BUILD.gn before we run gn. // To see v8 dependency tree: // cd gclient/v8 && gn desc ../../v8-build/x86_64-linux/release/ninja/ :v8 --tree // We can't see our own config because gn desc doesn't accept a --root-target. // One idea is to append our BUILD.gn to the v8 BUILD.gn instead of putting it in a subdirectory. if (UseGclient) { var run_gn = b.addSystemCommand(&.{ gn, "--root=gclient/v8", "--root-target=//zig", "--dotfile=.gn", "gen", ninja_out_path, args }); step.dependOn(&run_gn.step); } else { // To see available args for gn: cd v8 && gn args --list ../v8-build/{target}/release/ninja/ var run_gn = b.addSystemCommand(&.{ gn, "--root=v8", "--root-target=//zig", "--dotfile=.gn", "gen", ninja_out_path, args }); step.dependOn(&run_gn.step); } const ninja = getNinjaPath(b); // Only build our target. If no target is specified, ninja will build all the targets which includes developer tools, tests, etc. var run_ninja = b.addSystemCommand(&.{ ninja, "-C", ninja_out_path, "c_v8" }); step.dependOn(&run_ninja.step); return step; } fn getArchOs(alloc: std.mem.Allocator, arch: std.Target.Cpu.Arch, os: std.Target.Os.Tag) []const u8 { return std.fmt.allocPrint(alloc, "{s}-{s}-gnu", .{ @tagName(arch), @tagName(os) }) catch unreachable; } fn getTargetId(alloc: std.mem.Allocator, target: std.Build.ResolvedTarget) []const u8 { return std.fmt.allocPrint(alloc, "{s}-{s}", .{ @tagName(target.result.cpu.arch), @tagName(target.result.os.tag) }) catch unreachable; } const CheckV8DepsStep = struct { const Self = @This(); step: Step, b: *Builder, fn create(b: *Builder) *Self { const step = b.allocator.create(Self) catch unreachable; step.* = .{ .step = Step.init(.custom, "check_v8_deps", b.allocator, make), .b = b, }; return step; } fn make(step: *Step) !void { const self: *Self = @fieldParentPtr("step", step); const output = try self.b.execFromStep(&.{ "clang", "--version" }, step); print("clang: {s}", .{output}); // TODO: Find out the actual minimum and check against other clang flavors. if (std.mem.startsWith(u8, output, "Homebrew clang version ")) { const i = std.mem.indexOfScalar(u8, output, '.').?; const major_v = try std.fmt.parseInt(u8, output["Homebrew clang version ".len..i], 10); if (major_v < 13) { return error.BadClangVersion; } } } }; fn createGetV8(b: *Builder) *std.Build.Step { const step = b.step("get-v8", "Gets v8 source using gclient."); if (UseGclient) { const mkpath = MakePathStep.create(b, "./gclient"); step.dependOn(&mkpath.step); // About depot_tools: https://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_setting_up const cmd = b.addSystemCommand(&.{ b.pathFromRoot("./tools/depot_tools/fetch"), "v8" }); cmd.cwd = "./gclient"; cmd.addPathDir(b.pathFromRoot("./tools/depot_tools")); step.dependOn(&cmd.step); } else { const get = GetV8SourceStep.create(b); step.dependOn(&get.step); } return step; } fn createGetTools(b: *Builder) *std.Build.Step { const step = b.step("get-tools", "Gets the build tools."); //var sub_step = b.addSystemCommand(&.{ "python", "./tools/get_ninja_gn_binaries.py", "--dir", "./tools" }); var sub_step = b.addSystemCommand(&.{ "git", "clone", "https://github.com/denoland/ninja_gn_binaries.git", "./tools" }); step.dependOn(&sub_step.step); if (UseGclient) { // Pull depot_tools for fetch tool. sub_step = b.addSystemCommand(&.{ "git", "clone", "--depth=1", "https://chromium.googlesource.com/chromium/tools/depot_tools.git", "tools/depot_tools" }); step.dependOn(&sub_step.step); } return step; } fn getNinjaPath(b: *Builder) []const u8 { const platform = switch (builtin.os.tag) { .windows => "win", .linux => "linux", .macos => "mac", else => unreachable, }; const arch = switch (builtin.cpu.arch) { .x86_64 => "amd64", .aarch64 => "arm64", else => unreachable, }; const ext = if (builtin.os.tag == .windows) ".exe" else ""; const bin = std.mem.concat(b.allocator, u8, &.{ "ninja", ext }) catch unreachable; const subFolder = std.mem.concat(b.allocator, u8, &.{ platform, "-", arch }) catch unreachable; return std.fs.path.resolve(b.allocator, &.{ "./tools", subFolder, bin }) catch unreachable; } fn getGnPath(b: *Builder) []const u8 { const platform = switch (builtin.os.tag) { .windows => "win", .linux => "linux", .macos => "mac", else => unreachable, }; const arch = switch (builtin.cpu.arch) { .x86_64 => "amd64", .aarch64 => "arm64", else => unreachable, }; const ext = if (builtin.os.tag == .windows) ".exe" else ""; const bin = std.mem.concat(b.allocator, u8, &.{ "gn", ext }) catch unreachable; const subFolder = std.mem.concat(b.allocator, u8, &.{ platform, "-", arch }) catch unreachable; return std.fs.path.resolve(b.allocator, &.{ "./tools", subFolder, bin }) catch unreachable; } const MakePathStep = struct { const Self = @This(); step: std.Build.Step, b: *Builder, path: []const u8, fn create(b: *Builder, root_path: []const u8) *Self { const new = b.allocator.create(Self) catch unreachable; new.* = .{ .step = std.Build.Step.init(.{ .id = .custom, .name = b.fmt("make-path", .{}), .owner = b, .makeFn = make, }), .b = b, .path = root_path, }; return new; } fn make(step: *std.Build.Step, prog_node: std.Progress.Node) anyerror!void { _ = prog_node; const self: *Self = @fieldParentPtr("step", step); const cwd = fs.cwd(); const stat = try statPathFromRoot(self.b, self.path); if (stat == .NotExist) { try cwd.makeDir(self.path); } } }; const CopyFileStep = struct { const Self = @This(); step: std.Build.Step, b: *Builder, src_path: []const u8, dst_path: []const u8, fn create(b: *Builder, src_path: []const u8, dst_path: []const u8) *Self { const new = b.allocator.create(Self) catch unreachable; new.* = .{ .step = std.Build.Step.init(.{ .id = .custom, .name = b.fmt("cp", .{}), .owner = b, .makeFn = make, }), .b = b, .src_path = src_path, .dst_path = dst_path, }; return new; } fn make(step: *std.Build.Step, prog_node: std.Progress.Node) anyerror!void { _ = prog_node; const self: *Self = @fieldParentPtr("step", step); try std.fs.copyFileAbsolute(self.src_path, self.dst_path, .{}); } }; // TODO: Make this usable from external project. fn linkV8(b: *Builder, step: *std.Build.Step.Compile, mode: std.builtin.OptimizeMode, target: std.Build.ResolvedTarget, use_zig_tc: bool) void { const mode_str: []const u8 = if (mode == .Debug) "debug" else "release"; const lib: []const u8 = if (target.result.os.tag == .windows and target.result.abi == .msvc) "c_v8.lib" else "libc_v8.a"; const lib_path = std.fmt.allocPrint(b.allocator, "./v8-build/{s}/{s}/ninja/obj/zig/{s}", .{ getTargetId(b.allocator, target), mode_str, lib, }) catch unreachable; step.addAssemblyFile(b.path(lib_path)); if (builtin.os.tag == .linux) { if (use_zig_tc) { // TODO: This should be linked already when we built v8. step.linkLibCpp(); } step.linkSystemLibrary("unwind"); } else if (target.result.os.tag == .windows) { if (target.result.abi == .gnu) { step.linkLibCpp(); } else { step.linkSystemLibrary("Dbghelp"); step.linkSystemLibrary("Winmm"); step.linkSystemLibrary("Advapi32"); // We need libcpmt to statically link with c++ stl for exception_ptr references from V8. // Zig already adds the SDK path to the linker but doesn't sync it to the internal libs array which linkSystemLibrary checks against. // For now we'll hardcode the MSVC path here. step.addLibraryPath(b.path("C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/lib/x64")); step.linkSystemLibrary("libcpmt"); } } } fn createTest(b: *Builder, target: std.Build.ResolvedTarget, mode: std.builtin.OptimizeMode, use_zig_tc: bool) *std.Build.Step.Compile { const step = b.addTest(.{ .root_source_file = b.path("src/test.zig"), .target = target, .optimize = mode, }); //FIXED step.addIncludePath(b.path("src")); step.linkLibC(); linkV8(b, step, mode, target, use_zig_tc); return step; } const DepEntry = struct { const Self = @This(); alloc: std.mem.Allocator, repo_url: []const u8, repo_rev: []const u8, pub fn deinit(self: Self) void { self.alloc.free(self.repo_url); self.alloc.free(self.repo_rev); } }; fn getV8Rev(b: *Builder) ![]const u8 { var file: std.fs.File = undefined; if (comptime isMinZigVersion()) { file = try std.fs.openFileAbsolute(b.pathFromRoot("V8_REVISION"), .{ .read = true, .write = false }); } else { file = try std.fs.openFileAbsolute(b.pathFromRoot("V8_REVISION"), .{ .mode = std.fs.File.OpenMode.read_write }); } defer file.close(); return std.mem.trim(u8, try file.readToEndAlloc(b.allocator, 1e9), "\n\r "); } pub const GetV8SourceStep = struct { const Self = @This(); step: Step, b: *Builder, pub fn create(b: *Builder) *Self { const self = b.allocator.create(Self) catch unreachable; self.* = .{ .b = b, .step = Step.init(.{ .id = .run, .name = "Get V8 Sources.", .owner = b, .makeFn = make, }), }; return self; } fn parseDep(self: Self, deps: json.Value, key: []const u8) !DepEntry { const val = deps.object.get(key).?; const i = std.mem.lastIndexOfScalar(u8, val.string, '@').?; const repo_rev = try self.b.allocator.dupe(u8, val.string[i + 1 ..]); const repo_url = try std.mem.replaceOwned(u8, self.b.allocator, val.string[0..i], "@chromium_url", "https://chromium.googlesource.com"); return DepEntry{ .alloc = self.b.allocator, .repo_url = repo_url, .repo_rev = repo_rev, }; } fn getDep(self: *Self, deps: json.Value, key: []const u8, local_path: []const u8) !void { const dep = try self.parseDep(deps, key); defer dep.deinit(); const stat = try statPathFromRoot(self.b, local_path); if (stat == .NotExist) { _ = self.b.run(&.{ "git", "clone", dep.repo_url, local_path }); } _ = self.b.run(&.{ "git", "-C", local_path, "checkout", dep.repo_rev }); if (stat == .NotExist) { // Apply patch for v8/build if (std.mem.eql(u8, key, "build")) { _ = self.b.run(&.{ "git", "apply", "--ignore-space-change", "--ignore-whitespace", "patches/v8_build.patch", "--directory=v8/build" }); } } } fn runHook(self: *Self, hooks: json.Value, name: []const u8) !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; const alloc = gpa.allocator(); defer _ = gpa.deinit(); for (hooks.array.items) |hook| { if (std.mem.eql(u8, name, hook.object.get("name").?.string)) { const cmd = hook.object.get("action").?.array; var args = std.ArrayList([]const u8).init(self.b.allocator); defer args.deinit(); for (cmd.items) |it| { try args.append(it.string); } const cwd = self.b.pathFromRoot("v8"); const cmd_path = try std.fmt.allocPrint(alloc, "{s}/{s}", .{ cwd, args.items[1] }); defer alloc.free(cmd_path); _ = self.b.run(&.{ args.items[0], cmd_path }); break; } } } fn make(step: *Step, prog_node: std.Progress.Node) !void { _ = prog_node; const self: *Self = @fieldParentPtr("step", step); // Pull the minimum source we need by looking at DEPS. // TODO: Check if we have the right branches, otherwise reclone. // Get revision/tag to checkout. const v8_rev = try getV8Rev(self.b); // Clone V8. const stat = try statPathFromRoot(self.b, "v8"); if (stat == .NotExist) { _ = self.b.run(&.{ "git", "clone", "--depth=1", "--branch", v8_rev, "https://chromium.googlesource.com/v8/v8.git", "v8" }); // Apply patch for v8 root. _ = self.b.run(&.{ "git", "apply", "--ignore-space-change", "--ignore-whitespace", "patches/v8.patch", "--directory=v8" }); } // Get DEPS in json. const deps_json = self.b.run(&.{ "python3", "parse_deps.py", "v8/DEPS" }); defer self.b.allocator.free(deps_json); var tree = try json.parseFromSlice(json.Value, self.b.allocator, deps_json, .{}); defer tree.deinit(); const deps = tree.value.object.get("deps").?; const hooks = tree.value.object.get("hooks").?; // build try self.getDep(deps, "build", "v8/build"); // Add an empty gclient_args.gni so gn is happy. gclient also creates an empty file. const file = try std.fs.createFileAbsolute(self.b.pathFromRoot("v8/build/config/gclient_args.gni"), .{ .read = false, .truncate = true }); try file.writeAll("# Generated from build.zig"); file.close(); // buildtools try self.getDep(deps, "buildtools", "v8/buildtools"); // libc++ try self.getDep(deps, "buildtools/third_party/libc++/trunk", "v8/buildtools/third_party/libc++/trunk"); // tools/clang try self.getDep(deps, "tools/clang", "v8/tools/clang"); try self.runHook(hooks, "clang"); // third_party/zlib try self.getDep(deps, "third_party/zlib", "v8/third_party/zlib"); // libc++abi try self.getDep(deps, "buildtools/third_party/libc++abi/trunk", "v8/buildtools/third_party/libc++abi/trunk"); // googletest try self.getDep(deps, "third_party/googletest/src", "v8/third_party/googletest/src"); // trace_event try self.getDep(deps, "base/trace_event/common", "v8/base/trace_event/common"); // jinja2 try self.getDep(deps, "third_party/jinja2", "v8/third_party/jinja2"); // markupsafe try self.getDep(deps, "third_party/markupsafe", "v8/third_party/markupsafe"); // For windows. if (builtin.os.tag == .windows) { // lastchange.py is flaky when it tries to do git commands from subprocess.Popen. Will sometimes get [WinError 50]. // For now we'll just do it in zig. // try self.runHook(hooks, "lastchange"); const merge_base_sha = "HEAD"; const commit_filter = "^Change-Id:"; const grep_arg = try std.fmt.allocPrint(self.b.allocator, "--grep={s}", .{commit_filter}); const version_info = try self.b.execFromStep(&.{ "git", "-C", "v8/build", "log", "-1", "--format=%H %ct", grep_arg, merge_base_sha }, &self.step); const idx = std.mem.indexOfScalar(u8, version_info, ' ').?; const commit_timestamp = version_info[idx + 1 ..]; // build/timestamp.gni expects the file to be just the unix timestamp. const write = std.fs.createFileAbsolute(self.b.pathFromRoot("v8/build/util/LASTCHANGE.committime"), .{ .truncate = true }) catch unreachable; defer write.close(); write.writeAll(commit_timestamp) catch unreachable; } } }; fn createBuildExeStep(b: *Builder, path: []const u8, target: std.Build.ResolvedTarget, mode: std.builtin.OptimizeMode, use_zig_tc: bool) *std.Build.Step.Compile { _ = b.step("exe", "Build exe with main file at -Dpath"); const basename = std.fs.path.basename(path); const i = std.mem.indexOf(u8, basename, ".zig") orelse basename.len; const name = basename[0..i]; const step = b.addExecutable(.{ .target = target, .root_source_file = b.path(path), .name = name, .optimize = mode, }); //FIXED //step.setBuildMode(mode); //step.setTarget(target); step.linkLibC(); step.addIncludePath(b.path("src")); if (mode == .ReleaseSafe) { step.root_module.strip = true; } linkV8(b, step, mode, target, use_zig_tc); return step; } const PathStat = enum { NotExist, Directory, File, SymLink, Unknown, }; fn statPathFromRoot(b: *Builder, path_rel: []const u8) !PathStat { const path_abs = b.pathFromRoot(path_rel); var file: std.fs.File = undefined; if (comptime isMinZigVersion()) { file = std.fs.openFileAbsolute(path_abs, .{ .read = false, .write = false }) catch |err| { if (err == error.FileNotFound) { return .NotExist; } else if (err == error.IsDir) { return .Directory; } else { return err; } }; } else { file = std.fs.openFileAbsolute(path_abs, .{ .mode = std.fs.File.OpenMode.read_only }) catch |err| { if (err == error.FileNotFound) { return .NotExist; } else if (err == error.IsDir) { return .Directory; } else { return err; } }; } defer file.close(); const stat = try file.stat(); switch (stat.kind) { .sym_link => return .SymLink, .directory => return .Directory, .file => return .File, else => return .Unknown, } } fn isMinZigVersion() bool { return builtin.zig_version.major == 0 and builtin.zig_version.minor == 9; } ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/libkern/OSAtomic.h ================================================ /* * 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 primitives. * * Define OSSPINLOCK_USE_INLINED=1 to get inline implementations of the * OSSpinLock interfaces in terms of the primitives. * * These are intended as a transition convenience, direct use of those * primitives should be preferred. */ #include #include "OSAtomicDeprecated.h" #include "OSSpinLockDeprecated.h" #include "OSAtomicQueue.h" #endif /* _OSATOMIC_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/libkern/OSAtomicDeprecated.h ================================================ /* * 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_DEPRECATED_H_ #define _OSATOMIC_DEPRECATED_H_ /*! @header * These are deprecated legacy interfaces for atomic operations. * The C11 interfaces in resp. C++11 interfaces in * should be used instead. * * Define OSATOMIC_USE_INLINED=1 to get inline implementations of these * interfaces in terms of the resp. primitives. * This is intended as a transition convenience, direct use of those primitives * is preferred. */ #include #if !(defined(OSATOMIC_USE_INLINED) && OSATOMIC_USE_INLINED) #include #include #include #include #ifndef OSATOMIC_DEPRECATED #define OSATOMIC_DEPRECATED 1 #ifndef __cplusplus #define OSATOMIC_BARRIER_DEPRECATED_MSG(_r) \ "Use " #_r "() from instead" #define OSATOMIC_DEPRECATED_MSG(_r) \ "Use " #_r "_explicit(memory_order_relaxed) from instead" #else #define OSATOMIC_BARRIER_DEPRECATED_MSG(_r) \ "Use std::" #_r "() from instead" #define OSATOMIC_DEPRECATED_MSG(_r) \ "Use std::" #_r "_explicit(std::memory_order_relaxed) from instead" #endif #define OSATOMIC_BARRIER_DEPRECATED_REPLACE_WITH(_r) \ __OS_AVAILABILITY_MSG(macosx, deprecated=10.12, OSATOMIC_BARRIER_DEPRECATED_MSG(_r)) \ __OS_AVAILABILITY_MSG(ios, deprecated=10.0, OSATOMIC_BARRIER_DEPRECATED_MSG(_r)) \ __OS_AVAILABILITY_MSG(tvos, deprecated=10.0, OSATOMIC_BARRIER_DEPRECATED_MSG(_r)) \ __OS_AVAILABILITY_MSG(watchos, deprecated=3.0, OSATOMIC_BARRIER_DEPRECATED_MSG(_r)) #define OSATOMIC_DEPRECATED_REPLACE_WITH(_r) \ __OS_AVAILABILITY_MSG(macosx, deprecated=10.12, OSATOMIC_DEPRECATED_MSG(_r)) \ __OS_AVAILABILITY_MSG(ios, deprecated=10.0, OSATOMIC_DEPRECATED_MSG(_r)) \ __OS_AVAILABILITY_MSG(tvos, deprecated=10.0, OSATOMIC_DEPRECATED_MSG(_r)) \ __OS_AVAILABILITY_MSG(watchos, deprecated=3.0, OSATOMIC_DEPRECATED_MSG(_r)) #else #undef OSATOMIC_DEPRECATED #define OSATOMIC_DEPRECATED 0 #define OSATOMIC_BARRIER_DEPRECATED_REPLACE_WITH(_r) #define OSATOMIC_DEPRECATED_REPLACE_WITH(_r) #endif /* * WARNING: all addresses passed to these functions must be "naturally aligned", * i.e. int32_t pointers must be 32-bit aligned (low 2 bits of * address are zeroes), and int64_t pointers must be 64-bit * aligned (low 3 bits of address are zeroes.). * Note that this is not the default alignment of the int64_t type * in the iOS ARMv7 ABI, see * {@link //apple_ref/doc/uid/TP40009021-SW8 iPhoneOSABIReference} * * Note that some versions of the atomic functions incorporate memory barriers * and some do not. Barriers strictly order memory access on weakly-ordered * architectures such as ARM. All loads and stores that appear (in sequential * program order) before the barrier are guaranteed to complete before any * load or store that appears after the barrier. * * The barrier operation is typically a no-op on uniprocessor systems and * fully enabled on multiprocessor systems. On some platforms, such as ARM, * the barrier can be quite expensive. * * Most code should use the barrier functions to ensure that memory shared * between threads is properly synchronized. For example, if you want to * initialize a shared data structure and then atomically increment a variable * to indicate that the initialization is complete, you must use * {@link OSAtomicIncrement32Barrier} to ensure that the stores to your data * structure complete before the atomic increment. * * Likewise, the consumer of that data structure must use * {@link OSAtomicDecrement32Barrier}, * in order to ensure that their loads of the structure are not executed before * the atomic decrement. On the other hand, if you are simply incrementing a * global counter, then it is safe and potentially faster to use * {@link OSAtomicIncrement32}. * * If you are unsure which version to use, prefer the barrier variants as they * are safer. * * For the kernel-space version of this header, see * {@link //apple_ref/doc/header/OSAtomic.h OSAtomic.h (Kernel Framework)} * * @apiuid //apple_ref/doc/header/user_space_OSAtomic.h */ __BEGIN_DECLS /*! @typedef OSAtomic_int64_aligned64_t * 64-bit aligned int64_t type. * Use for variables whose addresses are passed to OSAtomic*64() functions to * get the compiler to generate the required alignment. */ #if __has_attribute(aligned) typedef int64_t __attribute__((__aligned__((sizeof(int64_t))))) OSAtomic_int64_aligned64_t; #else typedef int64_t OSAtomic_int64_aligned64_t; #endif /*! @group Arithmetic functions All functions in this group return the new value. */ /*! @abstract Atomically adds two 32-bit values. @discussion This function adds the value given by __theAmount to the value in the memory location referenced by __theValue, storing the result back to that memory location atomically. @result Returns the new value. */ OSATOMIC_DEPRECATED_REPLACE_WITH(atomic_fetch_add) __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) int32_t OSAtomicAdd32( int32_t __theAmount, volatile int32_t *__theValue ); /*! @abstract Atomically adds two 32-bit values. @discussion This function adds the value given by __theAmount to the value in the memory location referenced by __theValue, storing the result back to that memory location atomically. This function is equivalent to {@link OSAtomicAdd32} except that it also introduces a barrier. @result Returns the new value. */ OSATOMIC_BARRIER_DEPRECATED_REPLACE_WITH(atomic_fetch_add) __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) int32_t OSAtomicAdd32Barrier( int32_t __theAmount, volatile int32_t *__theValue ); #if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_10 || __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_7_1 || TARGET_OS_DRIVERKIT /*! @abstract Atomically increments a 32-bit value. @result Returns the new value. */ OSATOMIC_DEPRECATED_REPLACE_WITH(atomic_fetch_add) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_7_1) int32_t OSAtomicIncrement32( volatile int32_t *__theValue ); /*! @abstract Atomically increments a 32-bit value with a barrier. @discussion This function is equivalent to {@link OSAtomicIncrement32} except that it also introduces a barrier. @result Returns the new value. */ OSATOMIC_BARRIER_DEPRECATED_REPLACE_WITH(atomic_fetch_add) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_7_1) int32_t OSAtomicIncrement32Barrier( volatile int32_t *__theValue ); /*! @abstract Atomically decrements a 32-bit value. @result Returns the new value. */ OSATOMIC_DEPRECATED_REPLACE_WITH(atomic_fetch_sub) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_7_1) int32_t OSAtomicDecrement32( volatile int32_t *__theValue ); /*! @abstract Atomically decrements a 32-bit value with a barrier. @discussion This function is equivalent to {@link OSAtomicDecrement32} except that it also introduces a barrier. @result Returns the new value. */ OSATOMIC_BARRIER_DEPRECATED_REPLACE_WITH(atomic_fetch_sub) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_7_1) int32_t OSAtomicDecrement32Barrier( volatile int32_t *__theValue ); #else __inline static int32_t OSAtomicIncrement32( volatile int32_t *__theValue ) { return OSAtomicAdd32( 1, __theValue); } __inline static int32_t OSAtomicIncrement32Barrier( volatile int32_t *__theValue ) { return OSAtomicAdd32Barrier( 1, __theValue); } __inline static int32_t OSAtomicDecrement32( volatile int32_t *__theValue ) { return OSAtomicAdd32( -1, __theValue); } __inline static int32_t OSAtomicDecrement32Barrier( volatile int32_t *__theValue ) { return OSAtomicAdd32Barrier( -1, __theValue); } #endif /*! @abstract Atomically adds two 64-bit values. @discussion This function adds the value given by __theAmount to the value in the memory location referenced by __theValue, storing the result back to that memory location atomically. @result Returns the new value. */ OSATOMIC_DEPRECATED_REPLACE_WITH(atomic_fetch_add) __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) int64_t OSAtomicAdd64( int64_t __theAmount, volatile OSAtomic_int64_aligned64_t *__theValue ); /*! @abstract Atomically adds two 64-bit values with a barrier. @discussion This function adds the value given by __theAmount to the value in the memory location referenced by __theValue, storing the result back to that memory location atomically. This function is equivalent to {@link OSAtomicAdd64} except that it also introduces a barrier. @result Returns the new value. */ OSATOMIC_BARRIER_DEPRECATED_REPLACE_WITH(atomic_fetch_add) __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_3_2) int64_t OSAtomicAdd64Barrier( int64_t __theAmount, volatile OSAtomic_int64_aligned64_t *__theValue ); #if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_10 || __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_7_1 || TARGET_OS_DRIVERKIT /*! @abstract Atomically increments a 64-bit value. @result Returns the new value. */ OSATOMIC_DEPRECATED_REPLACE_WITH(atomic_fetch_add) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_7_1) int64_t OSAtomicIncrement64( volatile OSAtomic_int64_aligned64_t *__theValue ); /*! @abstract Atomically increments a 64-bit value with a barrier. @discussion This function is equivalent to {@link OSAtomicIncrement64} except that it also introduces a barrier. @result Returns the new value. */ OSATOMIC_BARRIER_DEPRECATED_REPLACE_WITH(atomic_fetch_add) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_7_1) int64_t OSAtomicIncrement64Barrier( volatile OSAtomic_int64_aligned64_t *__theValue ); /*! @abstract Atomically decrements a 64-bit value. @result Returns the new value. */ OSATOMIC_DEPRECATED_REPLACE_WITH(atomic_fetch_sub) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_7_1) int64_t OSAtomicDecrement64( volatile OSAtomic_int64_aligned64_t *__theValue ); /*! @abstract Atomically decrements a 64-bit value with a barrier. @discussion This function is equivalent to {@link OSAtomicDecrement64} except that it also introduces a barrier. @result Returns the new value. */ OSATOMIC_BARRIER_DEPRECATED_REPLACE_WITH(atomic_fetch_sub) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_7_1) int64_t OSAtomicDecrement64Barrier( volatile OSAtomic_int64_aligned64_t *__theValue ); #else __inline static int64_t OSAtomicIncrement64( volatile OSAtomic_int64_aligned64_t *__theValue ) { return OSAtomicAdd64( 1, __theValue); } __inline static int64_t OSAtomicIncrement64Barrier( volatile OSAtomic_int64_aligned64_t *__theValue ) { return OSAtomicAdd64Barrier( 1, __theValue); } __inline static int64_t OSAtomicDecrement64( volatile OSAtomic_int64_aligned64_t *__theValue ) { return OSAtomicAdd64( -1, __theValue); } __inline static int64_t OSAtomicDecrement64Barrier( volatile OSAtomic_int64_aligned64_t *__theValue ) { return OSAtomicAdd64Barrier( -1, __theValue); } #endif /*! @group Boolean functions (AND, OR, XOR) * * @discussion Functions in this group come in four variants for each operation: * with and without barriers, and functions that return the original value or * the result value of the operation. * * The "Orig" versions return the original value, (before the operation); the non-Orig * versions return the value after the operation. All are layered on top of * {@link OSAtomicCompareAndSwap32} and similar. */ /*! @abstract Atomic bitwise OR of two 32-bit values. @discussion This function performs the bitwise OR of the value given by __theMask with the value in the memory location referenced by __theValue, storing the result back to that memory location atomically. @result Returns the new value. */ OSATOMIC_DEPRECATED_REPLACE_WITH(atomic_fetch_or) __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) int32_t OSAtomicOr32( uint32_t __theMask, volatile uint32_t *__theValue ); /*! @abstract Atomic bitwise OR of two 32-bit values with barrier. @discussion This function performs the bitwise OR of the value given by __theMask with the value in the memory location referenced by __theValue, storing the result back to that memory location atomically. This function is equivalent to {@link OSAtomicOr32} except that it also introduces a barrier. @result Returns the new value. */ OSATOMIC_BARRIER_DEPRECATED_REPLACE_WITH(atomic_fetch_or) __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) int32_t OSAtomicOr32Barrier( uint32_t __theMask, volatile uint32_t *__theValue ); /*! @abstract Atomic bitwise OR of two 32-bit values returning original. @discussion This function performs the bitwise OR of the value given by __theMask with the value in the memory location referenced by __theValue, storing the result back to that memory location atomically. @result Returns the original value referenced by __theValue. */ OSATOMIC_DEPRECATED_REPLACE_WITH(atomic_fetch_or) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_3_2) int32_t OSAtomicOr32Orig( uint32_t __theMask, volatile uint32_t *__theValue ); /*! @abstract Atomic bitwise OR of two 32-bit values returning original with barrier. @discussion This function performs the bitwise OR of the value given by __theMask with the value in the memory location referenced by __theValue, storing the result back to that memory location atomically. This function is equivalent to {@link OSAtomicOr32Orig} except that it also introduces a barrier. @result Returns the original value referenced by __theValue. */ OSATOMIC_BARRIER_DEPRECATED_REPLACE_WITH(atomic_fetch_or) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_3_2) int32_t OSAtomicOr32OrigBarrier( uint32_t __theMask, volatile uint32_t *__theValue ); /*! @abstract Atomic bitwise AND of two 32-bit values. @discussion This function performs the bitwise AND of the value given by __theMask with the value in the memory location referenced by __theValue, storing the result back to that memory location atomically. @result Returns the new value. */ OSATOMIC_DEPRECATED_REPLACE_WITH(atomic_fetch_and) __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) int32_t OSAtomicAnd32( uint32_t __theMask, volatile uint32_t *__theValue ); /*! @abstract Atomic bitwise AND of two 32-bit values with barrier. @discussion This function performs the bitwise AND of the value given by __theMask with the value in the memory location referenced by __theValue, storing the result back to that memory location atomically. This function is equivalent to {@link OSAtomicAnd32} except that it also introduces a barrier. @result Returns the new value. */ OSATOMIC_BARRIER_DEPRECATED_REPLACE_WITH(atomic_fetch_and) __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) int32_t OSAtomicAnd32Barrier( uint32_t __theMask, volatile uint32_t *__theValue ); /*! @abstract Atomic bitwise AND of two 32-bit values returning original. @discussion This function performs the bitwise AND of the value given by __theMask with the value in the memory location referenced by __theValue, storing the result back to that memory location atomically. @result Returns the original value referenced by __theValue. */ OSATOMIC_DEPRECATED_REPLACE_WITH(atomic_fetch_and) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_3_2) int32_t OSAtomicAnd32Orig( uint32_t __theMask, volatile uint32_t *__theValue ); /*! @abstract Atomic bitwise AND of two 32-bit values returning original with barrier. @discussion This function performs the bitwise AND of the value given by __theMask with the value in the memory location referenced by __theValue, storing the result back to that memory location atomically. This function is equivalent to {@link OSAtomicAnd32Orig} except that it also introduces a barrier. @result Returns the original value referenced by __theValue. */ OSATOMIC_BARRIER_DEPRECATED_REPLACE_WITH(atomic_fetch_and) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_3_2) int32_t OSAtomicAnd32OrigBarrier( uint32_t __theMask, volatile uint32_t *__theValue ); /*! @abstract Atomic bitwise XOR of two 32-bit values. @discussion This function performs the bitwise XOR of the value given by __theMask with the value in the memory location referenced by __theValue, storing the result back to that memory location atomically. @result Returns the new value. */ OSATOMIC_DEPRECATED_REPLACE_WITH(atomic_fetch_xor) __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) int32_t OSAtomicXor32( uint32_t __theMask, volatile uint32_t *__theValue ); /*! @abstract Atomic bitwise XOR of two 32-bit values with barrier. @discussion This function performs the bitwise XOR of the value given by __theMask with the value in the memory location referenced by __theValue, storing the result back to that memory location atomically. This function is equivalent to {@link OSAtomicXor32} except that it also introduces a barrier. @result Returns the new value. */ OSATOMIC_BARRIER_DEPRECATED_REPLACE_WITH(atomic_fetch_xor) __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) int32_t OSAtomicXor32Barrier( uint32_t __theMask, volatile uint32_t *__theValue ); /*! @abstract Atomic bitwise XOR of two 32-bit values returning original. @discussion This function performs the bitwise XOR of the value given by __theMask with the value in the memory location referenced by __theValue, storing the result back to that memory location atomically. @result Returns the original value referenced by __theValue. */ OSATOMIC_DEPRECATED_REPLACE_WITH(atomic_fetch_xor) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_3_2) int32_t OSAtomicXor32Orig( uint32_t __theMask, volatile uint32_t *__theValue ); /*! @abstract Atomic bitwise XOR of two 32-bit values returning original with barrier. @discussion This function performs the bitwise XOR of the value given by __theMask with the value in the memory location referenced by __theValue, storing the result back to that memory location atomically. This function is equivalent to {@link OSAtomicXor32Orig} except that it also introduces a barrier. @result Returns the original value referenced by __theValue. */ OSATOMIC_BARRIER_DEPRECATED_REPLACE_WITH(atomic_fetch_xor) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_3_2) int32_t OSAtomicXor32OrigBarrier( uint32_t __theMask, volatile uint32_t *__theValue ); /*! @group Compare and swap * Functions in this group return true if the swap occured. There are several versions, * depending on data type and on whether or not a barrier is used. */ /*! @abstract Compare and swap for 32-bit values. @discussion This function compares the value in __oldValue to the value in the memory location referenced by __theValue. If the values match, this function stores the value from __newValue into that memory location atomically. @result Returns TRUE on a match, FALSE otherwise. */ OSATOMIC_DEPRECATED_REPLACE_WITH(atomic_compare_exchange_strong) __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) bool OSAtomicCompareAndSwap32( int32_t __oldValue, int32_t __newValue, volatile int32_t *__theValue ); /*! @abstract Compare and swap for 32-bit values with barrier. @discussion This function compares the value in __oldValue to the value in the memory location referenced by __theValue. If the values match, this function stores the value from __newValue into that memory location atomically. This function is equivalent to {@link OSAtomicCompareAndSwap32} except that it also introduces a barrier. @result Returns TRUE on a match, FALSE otherwise. */ OSATOMIC_BARRIER_DEPRECATED_REPLACE_WITH(atomic_compare_exchange_strong) __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) bool OSAtomicCompareAndSwap32Barrier( int32_t __oldValue, int32_t __newValue, volatile int32_t *__theValue ); /*! @abstract Compare and swap pointers. @discussion This function compares the pointer stored in __oldValue to the pointer in the memory location referenced by __theValue. If the pointers match, this function stores the pointer from __newValue into that memory location atomically. @result Returns TRUE on a match, FALSE otherwise. */ OSATOMIC_DEPRECATED_REPLACE_WITH(atomic_compare_exchange_strong) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0) bool OSAtomicCompareAndSwapPtr( void *__oldValue, void *__newValue, void * volatile *__theValue ); /*! @abstract Compare and swap pointers with barrier. @discussion This function compares the pointer stored in __oldValue to the pointer in the memory location referenced by __theValue. If the pointers match, this function stores the pointer from __newValue into that memory location atomically. This function is equivalent to {@link OSAtomicCompareAndSwapPtr} except that it also introduces a barrier. @result Returns TRUE on a match, FALSE otherwise. */ OSATOMIC_BARRIER_DEPRECATED_REPLACE_WITH(atomic_compare_exchange_strong) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0) bool OSAtomicCompareAndSwapPtrBarrier( void *__oldValue, void *__newValue, void * volatile *__theValue ); /*! @abstract Compare and swap for int values. @discussion This function compares the value in __oldValue to the value in the memory location referenced by __theValue. If the values match, this function stores the value from __newValue into that memory location atomically. This function is equivalent to {@link OSAtomicCompareAndSwap32}. @result Returns TRUE on a match, FALSE otherwise. */ OSATOMIC_DEPRECATED_REPLACE_WITH(atomic_compare_exchange_strong) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0) bool OSAtomicCompareAndSwapInt( int __oldValue, int __newValue, volatile int *__theValue ); /*! @abstract Compare and swap for int values. @discussion This function compares the value in __oldValue to the value in the memory location referenced by __theValue. If the values match, this function stores the value from __newValue into that memory location atomically. This function is equivalent to {@link OSAtomicCompareAndSwapInt} except that it also introduces a barrier. This function is equivalent to {@link OSAtomicCompareAndSwap32Barrier}. @result Returns TRUE on a match, FALSE otherwise. */ OSATOMIC_BARRIER_DEPRECATED_REPLACE_WITH(atomic_compare_exchange_strong) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0) bool OSAtomicCompareAndSwapIntBarrier( int __oldValue, int __newValue, volatile int *__theValue ); /*! @abstract Compare and swap for long values. @discussion This function compares the value in __oldValue to the value in the memory location referenced by __theValue. If the values match, this function stores the value from __newValue into that memory location atomically. This function is equivalent to {@link OSAtomicCompareAndSwap32} on 32-bit architectures, or {@link OSAtomicCompareAndSwap64} on 64-bit architectures. @result Returns TRUE on a match, FALSE otherwise. */ OSATOMIC_DEPRECATED_REPLACE_WITH(atomic_compare_exchange_strong) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0) bool OSAtomicCompareAndSwapLong( long __oldValue, long __newValue, volatile long *__theValue ); /*! @abstract Compare and swap for long values. @discussion This function compares the value in __oldValue to the value in the memory location referenced by __theValue. If the values match, this function stores the value from __newValue into that memory location atomically. This function is equivalent to {@link OSAtomicCompareAndSwapLong} except that it also introduces a barrier. This function is equivalent to {@link OSAtomicCompareAndSwap32} on 32-bit architectures, or {@link OSAtomicCompareAndSwap64} on 64-bit architectures. @result Returns TRUE on a match, FALSE otherwise. */ OSATOMIC_BARRIER_DEPRECATED_REPLACE_WITH(atomic_compare_exchange_strong) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0) bool OSAtomicCompareAndSwapLongBarrier( long __oldValue, long __newValue, volatile long *__theValue ); /*! @abstract Compare and swap for uint64_t values. @discussion This function compares the value in __oldValue to the value in the memory location referenced by __theValue. If the values match, this function stores the value from __newValue into that memory location atomically. @result Returns TRUE on a match, FALSE otherwise. */ OSATOMIC_DEPRECATED_REPLACE_WITH(atomic_compare_exchange_strong) __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) bool OSAtomicCompareAndSwap64( int64_t __oldValue, int64_t __newValue, volatile OSAtomic_int64_aligned64_t *__theValue ); /*! @abstract Compare and swap for uint64_t values. @discussion This function compares the value in __oldValue to the value in the memory location referenced by __theValue. If the values match, this function stores the value from __newValue into that memory location atomically. This function is equivalent to {@link OSAtomicCompareAndSwap64} except that it also introduces a barrier. @result Returns TRUE on a match, FALSE otherwise. */ OSATOMIC_BARRIER_DEPRECATED_REPLACE_WITH(atomic_compare_exchange_strong) __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_3_2) bool OSAtomicCompareAndSwap64Barrier( int64_t __oldValue, int64_t __newValue, volatile OSAtomic_int64_aligned64_t *__theValue ); /* Test and set. * They return the original value of the bit, and operate on bit (0x80>>(n&7)) * in byte ((char*)theAddress + (n>>3)). */ /*! @abstract Atomic test and set @discussion This function tests a bit in the value referenced by __theAddress and if it is not set, sets it. The bit is chosen by the value of __n such that the operation will be performed on bit (0x80 >> (__n & 7)) of byte ((char *)__theAddress + (n >> 3)). For example, if __theAddress points to a 64-bit value, to compare the value of the most significant bit, you would specify 56 for __n. @result Returns the original value of the bit being tested. */ OSATOMIC_DEPRECATED_REPLACE_WITH(atomic_fetch_or) __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) bool OSAtomicTestAndSet( uint32_t __n, volatile void *__theAddress ); /*! @abstract Atomic test and set with barrier @discussion This function tests a bit in the value referenced by __theAddress and if it is not set, sets it. The bit is chosen by the value of __n such that the operation will be performed on bit (0x80 >> (__n & 7)) of byte ((char *)__theAddress + (n >> 3)). For example, if __theAddress points to a 64-bit value, to compare the value of the most significant bit, you would specify 56 for __n. This function is equivalent to {@link OSAtomicTestAndSet} except that it also introduces a barrier. @result Returns the original value of the bit being tested. */ OSATOMIC_BARRIER_DEPRECATED_REPLACE_WITH(atomic_fetch_or) __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) bool OSAtomicTestAndSetBarrier( uint32_t __n, volatile void *__theAddress ); /*! @abstract Atomic test and clear @discussion This function tests a bit in the value referenced by __theAddress and if it is not cleared, clears it. The bit is chosen by the value of __n such that the operation will be performed on bit (0x80 >> (__n & 7)) of byte ((char *)__theAddress + (n >> 3)). For example, if __theAddress points to a 64-bit value, to compare the value of the most significant bit, you would specify 56 for __n. @result Returns the original value of the bit being tested. */ OSATOMIC_DEPRECATED_REPLACE_WITH(atomic_fetch_and) __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) bool OSAtomicTestAndClear( uint32_t __n, volatile void *__theAddress ); /*! @abstract Atomic test and clear @discussion This function tests a bit in the value referenced by __theAddress and if it is not cleared, clears it. The bit is chosen by the value of __n such that the operation will be performed on bit (0x80 >> (__n & 7)) of byte ((char *)__theAddress + (n >> 3)). For example, if __theAddress points to a 64-bit value, to compare the value of the most significant bit, you would specify 56 for __n. This function is equivalent to {@link OSAtomicTestAndSet} except that it also introduces a barrier. @result Returns the original value of the bit being tested. */ OSATOMIC_BARRIER_DEPRECATED_REPLACE_WITH(atomic_fetch_and) __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) bool OSAtomicTestAndClearBarrier( uint32_t __n, volatile void *__theAddress ); /*! @group Memory barriers */ /*! @abstract Memory barrier. @discussion This function serves as both a read and write barrier. */ OSATOMIC_BARRIER_DEPRECATED_REPLACE_WITH(atomic_thread_fence) __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) void OSMemoryBarrier( void ); __END_DECLS #else // defined(OSATOMIC_USE_INLINED) && OSATOMIC_USE_INLINED /* * Inline implementations of the legacy OSAtomic interfaces in terms of * C11 resp. C++11 primitives. * Direct use of those primitives is preferred. */ #include #include #include #include #ifdef __cplusplus extern "C++" { #if !(__has_include() && __has_extension(cxx_atomic)) #error Cannot use inlined OSAtomic without and C++11 atomics #endif #include typedef std::atomic _OSAtomic_uint8_t; typedef std::atomic _OSAtomic_int32_t; typedef std::atomic _OSAtomic_uint32_t; typedef std::atomic _OSAtomic_int64_t; typedef std::atomic _OSAtomic_void_ptr_t; #define OSATOMIC_STD(_a) std::_a __BEGIN_DECLS #else #if !(__has_include() && __has_extension(c_atomic)) #error Cannot use inlined OSAtomic without and C11 atomics #endif #include typedef _Atomic(uint8_t) _OSAtomic_uint8_t; typedef _Atomic(int32_t) _OSAtomic_int32_t; typedef _Atomic(uint32_t) _OSAtomic_uint32_t; typedef _Atomic(int64_t) _OSAtomic_int64_t; typedef _Atomic(void*) _OSAtomic_void_ptr_t; #define OSATOMIC_STD(_a) _a #endif #if __has_extension(c_alignof) && __has_attribute(aligned) typedef int64_t __attribute__((__aligned__(_Alignof(_OSAtomic_int64_t)))) OSAtomic_int64_aligned64_t; #elif __has_attribute(aligned) typedef int64_t __attribute__((__aligned__((sizeof(_OSAtomic_int64_t))))) OSAtomic_int64_aligned64_t; #else typedef int64_t OSAtomic_int64_aligned64_t; #endif #if __has_attribute(always_inline) #define OSATOMIC_INLINE static __inline __attribute__((__always_inline__)) #else #define OSATOMIC_INLINE static __inline #endif OSATOMIC_INLINE int32_t OSAtomicAdd32(int32_t __theAmount, volatile int32_t *__theValue) { return (OSATOMIC_STD(atomic_fetch_add_explicit)( (volatile _OSAtomic_int32_t*) __theValue, __theAmount, OSATOMIC_STD(memory_order_relaxed)) + __theAmount); } OSATOMIC_INLINE int32_t OSAtomicAdd32Barrier(int32_t __theAmount, volatile int32_t *__theValue) { return (OSATOMIC_STD(atomic_fetch_add_explicit)( (volatile _OSAtomic_int32_t*) __theValue, __theAmount, OSATOMIC_STD(memory_order_seq_cst)) + __theAmount); } OSATOMIC_INLINE int32_t OSAtomicIncrement32(volatile int32_t *__theValue) { return OSAtomicAdd32(1, __theValue); } OSATOMIC_INLINE int32_t OSAtomicIncrement32Barrier(volatile int32_t *__theValue) { return OSAtomicAdd32Barrier(1, __theValue); } OSATOMIC_INLINE int32_t OSAtomicDecrement32(volatile int32_t *__theValue) { return OSAtomicAdd32(-1, __theValue); } OSATOMIC_INLINE int32_t OSAtomicDecrement32Barrier(volatile int32_t *__theValue) { return OSAtomicAdd32Barrier(-1, __theValue); } OSATOMIC_INLINE int64_t OSAtomicAdd64(int64_t __theAmount, volatile OSAtomic_int64_aligned64_t *__theValue) { return (OSATOMIC_STD(atomic_fetch_add_explicit)( (volatile _OSAtomic_int64_t*) __theValue, __theAmount, OSATOMIC_STD(memory_order_relaxed)) + __theAmount); } OSATOMIC_INLINE int64_t OSAtomicAdd64Barrier(int64_t __theAmount, volatile OSAtomic_int64_aligned64_t *__theValue) { return (OSATOMIC_STD(atomic_fetch_add_explicit)( (volatile _OSAtomic_int64_t*) __theValue, __theAmount, OSATOMIC_STD(memory_order_seq_cst)) + __theAmount); } OSATOMIC_INLINE int64_t OSAtomicIncrement64(volatile OSAtomic_int64_aligned64_t *__theValue) { return OSAtomicAdd64(1, __theValue); } OSATOMIC_INLINE int64_t OSAtomicIncrement64Barrier(volatile OSAtomic_int64_aligned64_t *__theValue) { return OSAtomicAdd64Barrier(1, __theValue); } OSATOMIC_INLINE int64_t OSAtomicDecrement64(volatile OSAtomic_int64_aligned64_t *__theValue) { return OSAtomicAdd64(-1, __theValue); } OSATOMIC_INLINE int64_t OSAtomicDecrement64Barrier(volatile OSAtomic_int64_aligned64_t *__theValue) { return OSAtomicAdd64Barrier(-1, __theValue); } OSATOMIC_INLINE int32_t OSAtomicOr32(uint32_t __theMask, volatile uint32_t *__theValue) { return (int32_t)(OSATOMIC_STD(atomic_fetch_or_explicit)( (volatile _OSAtomic_uint32_t*)__theValue, __theMask, OSATOMIC_STD(memory_order_relaxed)) | __theMask); } OSATOMIC_INLINE int32_t OSAtomicOr32Barrier(uint32_t __theMask, volatile uint32_t *__theValue) { return (int32_t)(OSATOMIC_STD(atomic_fetch_or_explicit)( (volatile _OSAtomic_uint32_t*)__theValue, __theMask, OSATOMIC_STD(memory_order_seq_cst)) | __theMask); } OSATOMIC_INLINE int32_t OSAtomicOr32Orig(uint32_t __theMask, volatile uint32_t *__theValue) { return (int32_t)(OSATOMIC_STD(atomic_fetch_or_explicit)( (volatile _OSAtomic_uint32_t*)__theValue, __theMask, OSATOMIC_STD(memory_order_relaxed))); } OSATOMIC_INLINE int32_t OSAtomicOr32OrigBarrier(uint32_t __theMask, volatile uint32_t *__theValue) { return (int32_t)(OSATOMIC_STD(atomic_fetch_or_explicit)( (volatile _OSAtomic_uint32_t*)__theValue, __theMask, OSATOMIC_STD(memory_order_seq_cst))); } OSATOMIC_INLINE int32_t OSAtomicAnd32(uint32_t __theMask, volatile uint32_t *__theValue) { return (int32_t)(OSATOMIC_STD(atomic_fetch_and_explicit)( (volatile _OSAtomic_uint32_t*)__theValue, __theMask, OSATOMIC_STD(memory_order_relaxed)) & __theMask); } OSATOMIC_INLINE int32_t OSAtomicAnd32Barrier(uint32_t __theMask, volatile uint32_t *__theValue) { return (int32_t)(OSATOMIC_STD(atomic_fetch_and_explicit)( (volatile _OSAtomic_uint32_t*)__theValue, __theMask, OSATOMIC_STD(memory_order_seq_cst)) & __theMask); } OSATOMIC_INLINE int32_t OSAtomicAnd32Orig(uint32_t __theMask, volatile uint32_t *__theValue) { return (int32_t)(OSATOMIC_STD(atomic_fetch_and_explicit)( (volatile _OSAtomic_uint32_t*)__theValue, __theMask, OSATOMIC_STD(memory_order_relaxed))); } OSATOMIC_INLINE int32_t OSAtomicAnd32OrigBarrier(uint32_t __theMask, volatile uint32_t *__theValue) { return (int32_t)(OSATOMIC_STD(atomic_fetch_and_explicit)( (volatile _OSAtomic_uint32_t*)__theValue, __theMask, OSATOMIC_STD(memory_order_seq_cst))); } OSATOMIC_INLINE int32_t OSAtomicXor32(uint32_t __theMask, volatile uint32_t *__theValue) { return (int32_t)(OSATOMIC_STD(atomic_fetch_xor_explicit)( (volatile _OSAtomic_uint32_t*)__theValue, __theMask, OSATOMIC_STD(memory_order_relaxed)) ^ __theMask); } OSATOMIC_INLINE int32_t OSAtomicXor32Barrier(uint32_t __theMask, volatile uint32_t *__theValue) { return (int32_t)(OSATOMIC_STD(atomic_fetch_xor_explicit)( (volatile _OSAtomic_uint32_t*)__theValue, __theMask, OSATOMIC_STD(memory_order_seq_cst)) ^ __theMask); } OSATOMIC_INLINE int32_t OSAtomicXor32Orig(uint32_t __theMask, volatile uint32_t *__theValue) { return (int32_t)(OSATOMIC_STD(atomic_fetch_xor_explicit)( (volatile _OSAtomic_uint32_t*)__theValue, __theMask, OSATOMIC_STD(memory_order_relaxed))); } OSATOMIC_INLINE int32_t OSAtomicXor32OrigBarrier(uint32_t __theMask, volatile uint32_t *__theValue) { return (int32_t)(OSATOMIC_STD(atomic_fetch_xor_explicit)( (volatile _OSAtomic_uint32_t*)__theValue, __theMask, OSATOMIC_STD(memory_order_seq_cst))); } OSATOMIC_INLINE bool OSAtomicCompareAndSwap32(int32_t __oldValue, int32_t __newValue, volatile int32_t *__theValue) { return (OSATOMIC_STD(atomic_compare_exchange_strong_explicit)( (volatile _OSAtomic_int32_t*)__theValue, &__oldValue, __newValue, OSATOMIC_STD(memory_order_relaxed), OSATOMIC_STD(memory_order_relaxed))); } OSATOMIC_INLINE bool OSAtomicCompareAndSwap32Barrier(int32_t __oldValue, int32_t __newValue, volatile int32_t *__theValue) { return (OSATOMIC_STD(atomic_compare_exchange_strong_explicit)( (volatile _OSAtomic_int32_t*)__theValue, &__oldValue, __newValue, OSATOMIC_STD(memory_order_seq_cst), OSATOMIC_STD(memory_order_relaxed))); } OSATOMIC_INLINE bool OSAtomicCompareAndSwapPtr(void *__oldValue, void *__newValue, void * volatile *__theValue) { return (OSATOMIC_STD(atomic_compare_exchange_strong_explicit)( (volatile _OSAtomic_void_ptr_t*)__theValue, &__oldValue, __newValue, OSATOMIC_STD(memory_order_relaxed), OSATOMIC_STD(memory_order_relaxed))); } OSATOMIC_INLINE bool OSAtomicCompareAndSwapPtrBarrier(void *__oldValue, void *__newValue, void * volatile *__theValue) { return (OSATOMIC_STD(atomic_compare_exchange_strong_explicit)( (volatile _OSAtomic_void_ptr_t*)__theValue, &__oldValue, __newValue, OSATOMIC_STD(memory_order_seq_cst), OSATOMIC_STD(memory_order_relaxed))); } OSATOMIC_INLINE bool OSAtomicCompareAndSwapInt(int __oldValue, int __newValue, volatile int *__theValue) { return (OSATOMIC_STD(atomic_compare_exchange_strong_explicit)( (volatile OSATOMIC_STD(atomic_int)*)__theValue, &__oldValue, __newValue, OSATOMIC_STD(memory_order_relaxed), OSATOMIC_STD(memory_order_relaxed))); } OSATOMIC_INLINE bool OSAtomicCompareAndSwapIntBarrier(int __oldValue, int __newValue, volatile int *__theValue) { return (OSATOMIC_STD(atomic_compare_exchange_strong_explicit)( (volatile OSATOMIC_STD(atomic_int)*)__theValue, &__oldValue, __newValue, OSATOMIC_STD(memory_order_seq_cst), OSATOMIC_STD(memory_order_relaxed))); } OSATOMIC_INLINE bool OSAtomicCompareAndSwapLong(long __oldValue, long __newValue, volatile long *__theValue) { return (OSATOMIC_STD(atomic_compare_exchange_strong_explicit)( (volatile OSATOMIC_STD(atomic_long)*)__theValue, &__oldValue, __newValue, OSATOMIC_STD(memory_order_relaxed), OSATOMIC_STD(memory_order_relaxed))); } OSATOMIC_INLINE bool OSAtomicCompareAndSwapLongBarrier(long __oldValue, long __newValue, volatile long *__theValue) { return (OSATOMIC_STD(atomic_compare_exchange_strong_explicit)( (volatile OSATOMIC_STD(atomic_long)*)__theValue, &__oldValue, __newValue, OSATOMIC_STD(memory_order_seq_cst), OSATOMIC_STD(memory_order_relaxed))); } OSATOMIC_INLINE bool OSAtomicCompareAndSwap64(int64_t __oldValue, int64_t __newValue, volatile OSAtomic_int64_aligned64_t *__theValue) { return (OSATOMIC_STD(atomic_compare_exchange_strong_explicit)( (volatile _OSAtomic_int64_t*)__theValue, &__oldValue, __newValue, OSATOMIC_STD(memory_order_relaxed), OSATOMIC_STD(memory_order_relaxed))); } OSATOMIC_INLINE bool OSAtomicCompareAndSwap64Barrier(int64_t __oldValue, int64_t __newValue, volatile OSAtomic_int64_aligned64_t *__theValue) { return (OSATOMIC_STD(atomic_compare_exchange_strong_explicit)( (volatile _OSAtomic_int64_t*)__theValue, &__oldValue, __newValue, OSATOMIC_STD(memory_order_seq_cst), OSATOMIC_STD(memory_order_relaxed))); } OSATOMIC_INLINE bool OSAtomicTestAndSet(uint32_t __n, volatile void *__theAddress) { uintptr_t a = (uintptr_t)__theAddress + (__n >> 3); uint8_t v = (0x80u >> (__n & 7)); return (OSATOMIC_STD(atomic_fetch_or_explicit)((_OSAtomic_uint8_t*)a, v, OSATOMIC_STD(memory_order_relaxed)) & v); } OSATOMIC_INLINE bool OSAtomicTestAndSetBarrier(uint32_t __n, volatile void *__theAddress) { uintptr_t a = (uintptr_t)__theAddress + (__n >> 3); uint8_t v = (0x80u >> (__n & 7)); return (OSATOMIC_STD(atomic_fetch_or_explicit)((_OSAtomic_uint8_t*)a, v, OSATOMIC_STD(memory_order_seq_cst)) & v); } OSATOMIC_INLINE bool OSAtomicTestAndClear(uint32_t __n, volatile void *__theAddress) { uintptr_t a = (uintptr_t)__theAddress + (__n >> 3); uint8_t v = (0x80u >> (__n & 7)); return (OSATOMIC_STD(atomic_fetch_and_explicit)((_OSAtomic_uint8_t*)a, (uint8_t)~v, OSATOMIC_STD(memory_order_relaxed)) & v); } OSATOMIC_INLINE bool OSAtomicTestAndClearBarrier(uint32_t __n, volatile void *__theAddress) { uintptr_t a = (uintptr_t)__theAddress + (__n >> 3); uint8_t v = (0x80u >> (__n & 7)); return (OSATOMIC_STD(atomic_fetch_and_explicit)((_OSAtomic_uint8_t*)a, (uint8_t)~v, OSATOMIC_STD(memory_order_seq_cst)) & v); } OSATOMIC_INLINE void OSMemoryBarrier(void) { OSATOMIC_STD(atomic_thread_fence)(OSATOMIC_STD(memory_order_seq_cst)); } #undef OSATOMIC_INLINE #undef OSATOMIC_STD #ifdef __cplusplus __END_DECLS } // extern "C++" #endif #endif // defined(OSATOMIC_USE_INLINED) && OSATOMIC_USE_INLINED #if TARGET_OS_OSX || TARGET_OS_DRIVERKIT __BEGIN_DECLS /*! @group Lockless atomic fifo enqueue and dequeue * These routines manipulate singly-linked FIFO lists. * * This API is deprecated and no longer recommended */ /*! @abstract The data structure for a fifo queue head. @discussion You should always initialize a fifo queue head structure with the initialization vector {@link OS_ATOMIC_FIFO_QUEUE_INIT} before use. */ #if defined(__LP64__) typedef volatile struct { void *opaque1; void *opaque2; int opaque3; } __attribute__ ((aligned (16))) OSFifoQueueHead; #else typedef volatile struct { void *opaque1; void *opaque2; int opaque3; } OSFifoQueueHead; #endif /*! @abstract The initialization vector for a fifo queue head. */ #define OS_ATOMIC_FIFO_QUEUE_INIT { NULL, 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 (__new). The link field should be a pointer type. The __offset 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 offsetset(), defined in stddef.h is the common way to specify the __offset value. @note This API is deprecated and no longer recommended */ __API_DEPRECATED("No longer supported", macos(10.7, 11.0)) void OSAtomicFifoEnqueue( OSFifoQueueHead *__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 (__new). The link field should be a pointer type. The __offset 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 offsetset(), defined in stddef.h is the common way to specify the __offset value. @result Returns the oldest enqueued element, or NULL if the list is empty. @note This API is deprecated and no longer recommended */ __API_DEPRECATED("No longer supported", macos(10.7, 11.0)) void* OSAtomicFifoDequeue( OSFifoQueueHead *__list, size_t __offset); __END_DECLS #endif /* TARGET_OS_OSX || TARGET_OS_DRIVERKIT */ #endif /* _OSATOMIC_DEPRECATED_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/libkern/OSAtomicQueue.h ================================================ /* * 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 #include #include #include #include "OSAtomicDeprecated.h" #include /*! @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 (__new). The link field should be a pointer type. The __offset 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 offsetset(), defined in stddef.h is the common way to specify the __offset 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 (__new). The link field should be a pointer type. The __offset 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 offsetset(), defined in stddef.h is the common way to specify the __offset 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 NULL 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_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/libkern/OSByteOrder.h ================================================ /* * 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 #include /* 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 #elif defined (__arm__) || defined(__arm64__) #include #else #include #endif #else /* ! __GNUC__ */ #include #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 */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/libkern/OSCacheControl.h ================================================ /* * Copyright (c) 2006 Apple Computer, 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 _OS_CACHE_CONTROL_H_ #define _OS_CACHE_CONTROL_H_ #include #include #include #include __BEGIN_DECLS /* Functions performed by sys_cache_control(): */ /* Prepare memory for execution. This should be called * after writing machine instructions to memory, before * executing them. It syncs the dcache and icache. * On IA32 processors this function is a NOP, because * no synchronization is required. */ #define kCacheFunctionPrepareForExecution 1 /* Flush data cache(s). This ensures that cached data * makes it all the way out to DRAM, and then removes * copies of the data from all processor caches. * It can be useful when dealing with cache incoherent * devices or DMA. */ #define kCacheFunctionFlushDcache 2 /* perform one of the above cache functions: */ int sys_cache_control( int function, void *start, size_t len) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0); /* equivalent to sys_cache_control(kCacheFunctionPrepareForExecution): */ void sys_icache_invalidate( void *start, size_t len) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0); /* equivalent to sys_cache_control(kCacheFunctionFlushDcache): */ void sys_dcache_flush( void *start, size_t len) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0); __END_DECLS #endif /* _OS_CACHE_CONTROL_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/libkern/OSDebug.h ================================================ /* * 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@ */ /* * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. * * HISTORY * */ #ifndef _OS_OSDEBBUG_H #define _OS_OSDEBBUG_H #include #include __BEGIN_DECLS extern int log_leaks; /* Use kernel_debug() to log a backtrace */ extern void trace_backtrace(unsigned int debugid, unsigned int debugid2, unsigned long size, unsigned long data); /* Report a message with a 4 entry backtrace - very slow */ extern void OSReportWithBacktrace(const char *str, ...); extern unsigned OSBacktrace(void **bt, unsigned maxAddrs); /* Simple dump of 20 backtrace entries */ extern void OSPrintBacktrace(void); /*! @function OSKernelStackRemaining * @abstract Returns bytes available below the current stack frame. * @discussion Returns bytes available below the current stack frame. Safe for interrupt or thread context. * @result Approximate byte count available. */ vm_offset_t OSKernelStackRemaining( void ); __END_DECLS #define TRACE_MACHLEAKS(a, b, c, d) \ do { \ if (__builtin_expect(!!log_leaks, 0)) \ trace_backtrace(a,b,c,d); \ } while(0) #endif /* !_OS_OSDEBBUG_H */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/libkern/OSKextLib.h ================================================ /* * Copyright (c) 2008 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 _LIBKERN_OSKEXTLIB_H #define _LIBKERN_OSKEXTLIB_H #include __BEGIN_DECLS #include #include #include #include #include /*! * @header * * Declares functions, basic return values, and other constants * related to kernel extensions (kexts). */ #if PRAGMA_MARK #pragma mark - /********************************************************************/ #pragma mark OSReturn Values for Kernel Extensions /********************************************************************/ #endif /*! * @group OSReturn Values for Kernel Extensions * Many kext-related functions return these values, * as well as those defined under * @link //apple_ref/c/tdef/OSReturn OSReturn@/link * and other variants of kern_return_t. */ #define sub_libkern_kext err_sub(2) #define libkern_kext_err(code) (sys_libkern|sub_libkern_kext|(code)) /*! * @define kOSKextReturnInternalError * @abstract An internal error in the kext library. * Contrast with @link //apple_ref/c/econst/OSReturnError * OSReturnError@/link. */ #define kOSKextReturnInternalError libkern_kext_err(0x1) /*! * @define kOSKextReturnNoMemory * @abstract Memory allocation failed. */ #define kOSKextReturnNoMemory libkern_kext_err(0x2) /*! * @define kOSKextReturnNoResources * @abstract Some resource other than memory (such as available load tags) * is exhausted. */ #define kOSKextReturnNoResources libkern_kext_err(0x3) /*! * @define kOSKextReturnNotPrivileged * @abstract The caller lacks privileges to perform the requested operation. */ #define kOSKextReturnNotPrivileged libkern_kext_err(0x4) /*! * @define kOSKextReturnInvalidArgument * @abstract Invalid argument. */ #define kOSKextReturnInvalidArgument libkern_kext_err(0x5) /*! * @define kOSKextReturnNotFound * @abstract Search item not found. */ #define kOSKextReturnNotFound libkern_kext_err(0x6) /*! * @define kOSKextReturnBadData * @abstract Malformed data (not used for XML). */ #define kOSKextReturnBadData libkern_kext_err(0x7) /*! * @define kOSKextReturnSerialization * @abstract Error converting or (un)serializing URL, string, or XML. */ #define kOSKextReturnSerialization libkern_kext_err(0x8) /*! * @define kOSKextReturnUnsupported * @abstract Operation is no longer or not yet supported. */ #define kOSKextReturnUnsupported libkern_kext_err(0x9) /*! * @define kOSKextReturnDisabled * @abstract Operation is currently disabled. */ #define kOSKextReturnDisabled libkern_kext_err(0xa) /*! * @define kOSKextReturnNotAKext * @abstract Bundle is not a kernel extension. */ #define kOSKextReturnNotAKext libkern_kext_err(0xb) /*! * @define kOSKextReturnValidation * @abstract Validation failures encountered; check diagnostics for details. */ #define kOSKextReturnValidation libkern_kext_err(0xc) /*! * @define kOSKextReturnAuthentication * @abstract Authetication failures encountered; check diagnostics for details. */ #define kOSKextReturnAuthentication libkern_kext_err(0xd) /*! * @define kOSKextReturnDependencies * @abstract Dependency resolution failures encountered; check diagnostics for details. */ #define kOSKextReturnDependencies libkern_kext_err(0xe) /*! * @define kOSKextReturnArchNotFound * @abstract Kext does not contain code for the requested architecture. */ #define kOSKextReturnArchNotFound libkern_kext_err(0xf) /*! * @define kOSKextReturnCache * @abstract An error occurred processing a system kext cache. */ #define kOSKextReturnCache libkern_kext_err(0x10) /*! * @define kOSKextReturnDeferred * @abstract Operation has been posted asynchronously to user space (kernel only). */ #define kOSKextReturnDeferred libkern_kext_err(0x11) /*! * @define kOSKextReturnBootLevel * @abstract Kext not loadable or operation not allowed at current boot level. */ #define kOSKextReturnBootLevel libkern_kext_err(0x12) /*! * @define kOSKextReturnNotLoadable * @abstract Kext cannot be loaded; check diagnostics for details. */ #define kOSKextReturnNotLoadable libkern_kext_err(0x13) /*! * @define kOSKextReturnLoadedVersionDiffers * @abstract A different version (or executable UUID, or executable by checksum) * of the requested kext is already loaded. */ #define kOSKextReturnLoadedVersionDiffers libkern_kext_err(0x14) /*! * @define kOSKextReturnDependencyLoadError * @abstract A load error occurred on a dependency of the kext being loaded. */ #define kOSKextReturnDependencyLoadError libkern_kext_err(0x15) /*! * @define kOSKextReturnLinkError * @abstract A link failure occured with this kext or a dependency. */ #define kOSKextReturnLinkError libkern_kext_err(0x16) /*! * @define kOSKextReturnStartStopError * @abstract The kext start or stop routine returned an error. */ #define kOSKextReturnStartStopError libkern_kext_err(0x17) /*! * @define kOSKextReturnInUse * @abstract The kext is currently in use or has outstanding references, * and cannot be unloaded. */ #define kOSKextReturnInUse libkern_kext_err(0x18) /*! * @define kOSKextReturnTimeout * @abstract A kext request has timed out. */ #define kOSKextReturnTimeout libkern_kext_err(0x19) /*! * @define kOSKextReturnStopping * @abstract The kext is in the process of stopping; requests cannot be made. */ #define kOSKextReturnStopping libkern_kext_err(0x1a) /*! * @define kOSKextReturnSystemPolicy * @abstract The kext was prevented from loading due to system policy. */ #define kOSKextReturnSystemPolicy libkern_kext_err(0x1b) /*! * @define kOSKextReturnKCLoadFailure * @abstract Loading of the System KC failed */ #define kOSKextReturnKCLoadFailure libkern_kext_err(0x1c) /*! * @define kOSKextReturnKCLoadFailureSystemKC * @abstract Loading of the System KC failed * * This a sub-code of kOSKextReturnKCLoadFailure. It can be OR'd together * with: kOSKextReturnKCLoadFailureAuxKC * * If both the System and Aux KCs fail to load, then the error code will be: * libkern_kext_err(0x1f) */ #define kOSKextReturnKCLoadFailureSystemKC libkern_kext_err(0x1d) /*! * @define kOSKextReturnKCLoadFailureAuxKC * @abstract Loading of the Aux KC failed * * This a sub-code of kOSKextReturnKCLoadFailure. It can be OR'd together * with: kOSKextReturnKCLoadFailureSystemKC * * If both the System and Aux KCs fail to load, then the error code will be: * libkern_kext_err(0x1f) */ #define kOSKextReturnKCLoadFailureAuxKC libkern_kext_err(0x1e) /* next available error is: libkern_kext_err(0x20) */ #if PRAGMA_MARK #pragma mark - /********************************************************************/ #pragma mark Kext/OSBundle Property List Keys /********************************************************************/ #endif /*! * @group Kext Property List Keys * These constants cover CFBundle properties defined for kernel extensions. * Because they are used in the kernel, if you want to use one with * CFBundle APIs you'll need to wrap it in a CFSTR() macro. */ /*! * @define kOSBundleCompatibleVersionKey * @abstract A string giving the backwards-compatible version of a library kext * in extended Mac OS 'vers' format (####.##.##s{1-255} where 's' * is a build stage 'd', 'a', 'b', 'f' or 'fc'). */ #define kOSBundleCompatibleVersionKey "OSBundleCompatibleVersion" /*! * @define kOSBundleEnableKextLoggingKey * @abstract Set to true to have the kernel kext logging spec applied * to the kext. * See @link //apple_ref/c/econst/OSKextLogSpec * OSKextLogSpec@/link. */ #define kOSBundleEnableKextLoggingKey "OSBundleEnableKextLogging" /*! * @define kOSBundleIsInterfaceKey * @abstract A boolean value indicating whether the kext executable * contains only symbol references. */ #define kOSBundleIsInterfaceKey "OSBundleIsInterface" /*! * @define kOSBundleLibrariesKey * @abstract A dictionary listing link dependencies for this kext. * Keys are bundle identifiers, values are version strings. */ #define kOSBundleLibrariesKey "OSBundleLibraries" /*! * @define kOSBundleRequiredKey * @abstract A string indicating in which kinds of startup this kext * may need to load during early startup (before * @link //apple_ref/doc/man/8/kextd kextcache(8)@/link). * @discussion * The value is one of: *
    *
  • @link kOSBundleRequiredRoot "OSBundleRequiredRoot"@/link
  • *
  • @link kOSBundleRequiredLocalRoot "OSBundleRequiredLocalRoot"@/link
  • *
  • @link kOSBundleRequiredNetworkRoot "OSBundleRequiredNetworkRoot"@/link
  • *
  • @link kOSBundleRequiredSafeBoot "OSBundleRequiredSafeBoot"@/link
  • *
  • @link kOSBundleRequiredConsole "OSBundleRequiredConsole"@/link
  • *
* * Use this property judiciously. * Every kext that declares a value other than "OSBundleRequiredSafeBoot" * increases startup time, as the booter must read it into memory, * or startup kext caches must include it. */ #define kOSBundleRequiredKey "OSBundleRequired" /*! * @define kOSBundleRequireExplicitLoadKey * @abstract A boolean value indicating whether the kext requires an * explicit kextload in order to start/match. */ #define kOSBundleRequireExplicitLoadKey "OSBundleRequireExplicitLoad" /*! * @define kOSBundleAllowUserLoadKey * @abstract A boolean value indicating whether * @link //apple_ref/doc/man/8/kextd kextcache(8)@/link * will honor a non-root process's request to load a kext. * @discussion * See @link //apple_ref/doc/compositePage/c/func/KextManagerLoadKextWithURL * KextManagerLoadKextWithURL@/link * and @link //apple_ref/doc/compositePage/c/func/KextManagerLoadKextWithIdentifier * KextManagerLoadKextWithIdentifier@/link. */ #define kOSBundleAllowUserLoadKey "OSBundleAllowUserLoad" /*! * @define kOSBundleAllowUserTerminateKey * @abstract A boolean value indicating whether the kextunload tool * is allowed to issue IOService terminate to classes defined in this kext. * @discussion A boolean value indicating whether the kextunload tool * is allowed to issue IOService terminate to classes defined in this kext. */ #define kOSBundleAllowUserTerminateKey "OSBundleAllowUserTerminate" /*! * @define kOSKernelResourceKey * @abstract A boolean value indicating whether the kext represents a built-in * component of the kernel. */ #define kOSKernelResourceKey "OSKernelResource" /*! * @define kOSKextVariantOverrideKey * @abstract A dictionary with target names as key and a target-specific variant * name as value. */ #define kOSKextVariantOverrideKey "OSKextVariantOverride" /*! * @define kIOKitPersonalitiesKey * @abstract A dictionary of dictionaries used in matching for I/O Kit drivers. */ #define kIOKitPersonalitiesKey "IOKitPersonalities" /* * @define kIOPersonalityPublisherKey * @abstract Used in personalities sent to the I/O Kit, * contains the CFBundleIdentifier of the kext * that the personality originated in. */ #define kIOPersonalityPublisherKey "IOPersonalityPublisher" #if CONFIG_KEC_FIPS /* * @define kAppleTextHashesKey * @abstract A dictionary conataining hashes for corecrypto kext. */ #define kAppleTextHashesKey "AppleTextHashes" #endif /*! * @define kOSMutableSegmentCopy * @abstract A boolean value indicating whether the kext requires a copy of * its mutable segments to be kept in memory, and then reset when the kext * unloads. This should be used with caution as it will increase the * amount of memory used by the kext. */ #define kOSMutableSegmentCopy "OSMutableSegmentCopy" #if PRAGMA_MARK /********************************************************************/ #pragma mark Kext/OSBundle Property Deprecated Keys /********************************************************************/ #endif /* * @define kOSBundleDebugLevelKey * @abstract * Deprecated (used on some releases of Mac OS X prior to 10.6 Snow Leopard). * Value is an integer from 1-6, corresponding to the verbose levels * of kext tools on those releases. * On 10.6 Snow Leopard, use @link OSKextEnableKextLogging * OSKextEnableKextLogging@/link. */ #define kOSBundleDebugLevelKey "OSBundleDebugLevel" /*! * @define kOSBundleSharedExecutableIdentifierKey * @abstract Deprecated (used on some releases of Mac OS X * prior to 10.6 Snow Leopard). * Value is the bundle identifier of the pseudokext * that contains an executable shared by this kext. */ #define kOSBundleSharedExecutableIdentifierKey "OSBundleSharedExecutableIdentifier" #if PRAGMA_MARK /********************************************************************/ #pragma mark Kext/OSBundle Property List Values /********************************************************************/ #endif /*! * @group Kext Property List Values * These constants encompass established values * for kernel extension bundle properties. */ /*! * @define kOSKextKernelIdentifier * @abstract * This is the CFBundleIdentifier user for the kernel itself. */ #define kOSKextKernelIdentifier "__kernel__" /*! * @define kOSKextBundlePackageTypeKext * @abstract * The bundle type value for Kernel Extensions. */ #define kOSKextBundlePackageTypeKext "KEXT" /*! * @define kOSKextBundlePackageTypeDriverKit * @abstract * The bundle type value for Driver Extensions. */ #define kOSKextBundlePackageTypeDriverKit "DEXT" /*! * @define kOSBundleRequiredRoot * @abstract * This @link kOSBundleRequiredKey OSBundleRequired@/link * value indicates that the kext may be needed to mount the root filesystem * whether starting from a local or a network volume. */ #define kOSBundleRequiredRoot "Root" /*! * @define kOSBundleRequiredLocalRoot * @abstract * This @link kOSBundleRequiredKey OSBundleRequired@/link * value indicates that the kext may be needed to mount the root filesystem * when starting from a local disk. */ #define kOSBundleRequiredLocalRoot "Local-Root" /*! * @define kOSBundleRequiredNetworkRoot * @abstract * This @link kOSBundleRequiredKey OSBundleRequired@/link * value indicates that the kext may be needed to mount the root filesystem * when starting over a network connection. */ #define kOSBundleRequiredNetworkRoot "Network-Root" /*! * @define kOSBundleRequiredSafeBoot * @abstract * This @link kOSBundleRequiredKey OSBundleRequired@/link * value indicates that the kext can be loaded during a safe startup. * This value does not normally cause the kext to be read by the booter * or included in startup kext caches. */ #define kOSBundleRequiredSafeBoot "Safe Boot" /*! * @define kOSBundleRequiredConsole * @abstract * This @link kOSBundleRequiredKey OSBundleRequired@/link * value indicates that the kext may be needed for console access * (specifically in a single-user startup when * @link //apple_ref/doc/man/8/kextd kextd(8)@/link. * does not run) * and should be loaded during early startup. */ #define kOSBundleRequiredConsole "Console" /*! * @define kOSBundleRequiredDriverKit * @abstract * This @link kOSBundleRequiredKey OSBundleRequired@/link * value indicates that the driver extension's (DriverKit driver's) * personalities must be present in the kernel at early boot (specifically * before @link //apple_ref/doc/man/8/kextd kextd(8)@/link starts) * in order to compete with kexts built into the prelinkedkernel. Note that * kextd is still required to launch the user space driver binary. The IOKit * matching will happen during early boot, and the actual driver launch * will happen after kextd starts. */ #define kOSBundleRequiredDriverKit "DriverKit" #if PRAGMA_MARK #pragma mark - /********************************************************************/ #pragma mark Kext Information /********************************************************************/ #endif /*! * @group Kext Information * Types, constants, and macros providing a kext with information * about itself. */ /*! * @typedef OSKextLoadTag * * @abstract * A unique identifier assigned to a loaded instanace of a kext. * * @discussion * If a kext is unloaded and later reloaded, the new instance * has a different load tag. * * A kext can get its own load tag in the kmod_info_t * structure passed into its module start routine, as the * id field (cast to this type). */ typedef uint32_t OSKextLoadTag; /*! * @define kOSKextInvalidLoadTag * * @abstract * A load tag value that will never be used for a loaded kext; * indicates kext not found. */ #define kOSKextInvalidLoadTag ((OSKextLoadTag)(-1)) __END_DECLS #endif /* _LIBKERN_OSKEXTLIB_H */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/libkern/OSReturn.h ================================================ /* * Copyright (c) 2000 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 (c) 1998 Apple Inc. All rights reserved. * * HISTORY * */ /* * Core OSReturn values. */ #ifndef __LIBKERN_OSRETURN_H #define __LIBKERN_OSRETURN_H #include __BEGIN_DECLS #include /*! * @header * * Declares functions, basic return values, and other constants * related to kernel extensions (kexts). */ #if PRAGMA_MARK #pragma mark Core OSReturn Values for Libkern #endif /********************************************************************* * Core OSReturn Values for Libkern *********************************************************************/ /*! * @group Core OSReturn Values for Libkern * Some kext and I/O Kit functions can return these values, * as well as other values of * kern_return_t. * * Many of these return values represent internal errors * in the Libkern C++ run-time typing information system * based on @link //apple_ref/doc/class/OSMetaClass OSMetaClass@/link; * you are unlikely to ever see them. * */ /*! * @typedef OSReturn * @abstract The return type for many Libkern functions. */ typedef kern_return_t OSReturn; #ifndef sys_libkern #define sys_libkern err_system(0x37) #endif /* sys_libkern */ #define sub_libkern_common err_sub(0) #define sub_libkern_metaclass err_sub(1) #define sub_libkern_reserved err_sub(-1) #define libkern_common_err(return ) (sys_libkern|sub_libkern_common|(return)) #define libkern_metaclass_err(return ) (sys_libkern|sub_libkern_metaclass|(return)) /* See OSKextLib.h for these * #define sub_libkern_kext err_sub(2) * #define libkern_kext_err(code) (sys_libkern|sub_libkern_kext|(code)) */ /*! * @define kOSReturnSuccess * @abstract Operation successful. * Equal to @link //apple_ref/c/econst/KERN_SUCCESS * KERN_SUCCESS@/link. */ #define kOSReturnSuccess KERN_SUCCESS /*! * @define kOSReturnError * @abstract Unspecified Libkern error. * Not equal to * @link //apple_ref/c/econst/KERN_FAILURE * KERN_FAILURE@/link. */ #define kOSReturnError libkern_common_err(1) /*! * @define kOSMetaClassInternal * @abstract Internal OSMetaClass run-time error. */ #define kOSMetaClassInternal libkern_metaclass_err(1) /*! * @define kOSMetaClassHasInstances * @abstract A kext cannot be unloaded because there are instances * derived from Libkern C++ classes that it defines. */ #define kOSMetaClassHasInstances libkern_metaclass_err(2) /*! * @define kOSMetaClassNoInit * @abstract Internal error: The Libkern C++ class registration system * was not properly initialized during kext loading. */ #define kOSMetaClassNoInit libkern_metaclass_err(3) // OSMetaClass::preModLoad wasn't called, runtime internal error /*! * @define kOSMetaClassNoTempData * @abstract Internal error: An allocation failure occurred * registering Libkern C++ classes during kext loading. */ #define kOSMetaClassNoTempData libkern_metaclass_err(4) // Allocation failure internal data /*! * @define kOSMetaClassNoDicts * @abstract Internal error: An allocation failure occurred * registering Libkern C++ classes during kext loading. */ #define kOSMetaClassNoDicts libkern_metaclass_err(5) // Allocation failure for Metaclass internal dictionaries /*! * @define kOSMetaClassNoKModSet * @abstract Internal error: An allocation failure occurred * registering Libkern C++ classes during kext loading. */ #define kOSMetaClassNoKModSet libkern_metaclass_err(6) // Allocation failure for internal kmodule set /*! * @define kOSMetaClassNoInsKModSet * @abstract Internal error: An error occurred registering * a specific Libkern C++ class during kext loading. */ #define kOSMetaClassNoInsKModSet libkern_metaclass_err(7) // Can't insert the KMod set into the module dictionary /*! * @define kOSMetaClassNoSuper * @abstract Internal error: No superclass can be found * for a specific Libkern C++ class during kext loading. */ #define kOSMetaClassNoSuper libkern_metaclass_err(8) /*! * @define kOSMetaClassInstNoSuper * @abstract Internal error: No superclass can be found when constructing * an instance of a Libkern C++ class. */ #define kOSMetaClassInstNoSuper libkern_metaclass_err(9) /*! * @define kOSMetaClassDuplicateClass * @abstract A duplicate Libkern C++ classname was encountered * during kext loading. */ #define kOSMetaClassDuplicateClass libkern_metaclass_err(10) /*! * @define kOSMetaClassNoKext * @abstract Internal error: The kext for a Libkern C++ class * can't be found during kext loading. */ #define kOSMetaClassNoKext libkern_metaclass_err(11) __END_DECLS #endif /* ! __LIBKERN_OSRETURN_H */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/libkern/OSSpinLockDeprecated.h ================================================ /* * 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 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 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 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 #include #include #include #include __BEGIN_DECLS /*! @abstract The default value for an OSSpinLock. @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 false if the lock was already held by another thread, true 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 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 __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 #include #include #include #include #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_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/libkern/OSThermalNotification.h ================================================ /* * Copyright (c) 2007 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 _OSTHERMALNOTIFICATION_H_ #define _OSTHERMALNOTIFICATION_H_ #include #include /* ** OSThermalNotification.h ** ** Notification mechanism to alert registered tasks when device thermal conditions ** reach certain thresholds. Notifications are triggered in both directions ** so clients can manage their memory usage more and less aggressively. ** */ __BEGIN_DECLS /* Define pressure levels usable by OSThermalPressureLevel */ typedef enum { #if TARGET_OS_OSX || TARGET_OS_MACCATALYST kOSThermalPressureLevelNominal = 0, kOSThermalPressureLevelModerate, kOSThermalPressureLevelHeavy, kOSThermalPressureLevelTrapping, kOSThermalPressureLevelSleeping #else kOSThermalPressureLevelNominal = 0, kOSThermalPressureLevelLight = 10, kOSThermalPressureLevelModerate = 20, kOSThermalPressureLevelHeavy = 30, kOSThermalPressureLevelTrapping = 40, kOSThermalPressureLevelSleeping = 50 #endif } OSThermalPressureLevel; /* ** External notify(3) string for thermal pressure level notification */ __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_7_0) extern const char * const kOSThermalNotificationPressureLevelName; #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && \ __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_2_0 typedef enum { OSThermalNotificationLevelAny = -1, OSThermalNotificationLevelNormal = 0, } OSThermalNotificationLevel; extern OSThermalNotificationLevel _OSThermalNotificationLevelForBehavior(int) __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_4_2); extern void _OSThermalNotificationSetLevelForBehavior(int, int) __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_4_2); enum { kOSThermalMitigationNone, kOSThermalMitigation70PercentTorch, kOSThermalMitigation70PercentBacklight, kOSThermalMitigation50PercentTorch, kOSThermalMitigation50PercentBacklight, kOSThermalMitigationDisableTorch, kOSThermalMitigation25PercentBacklight, kOSThermalMitigationDisableMapsHalo, kOSThermalMitigationAppTerminate, kOSThermalMitigationDeviceRestart, kOSThermalMitigationThermalTableReady, kOSThermalMitigationCount }; #define OSThermalNotificationLevel70PercentTorch _OSThermalNotificationLevelForBehavior(kOSThermalMitigation70PercentTorch) #define OSThermalNotificationLevel70PercentBacklight _OSThermalNotificationLevelForBehavior(kOSThermalMitigation70PercentBacklight) #define OSThermalNotificationLevel50PercentTorch _OSThermalNotificationLevelForBehavior(kOSThermalMitigation50PercentTorch) #define OSThermalNotificationLevel50PercentBacklight _OSThermalNotificationLevelForBehavior(kOSThermalMitigation50PercentBacklight) #define OSThermalNotificationLevelDisableTorch _OSThermalNotificationLevelForBehavior(kOSThermalMitigationDisableTorch) #define OSThermalNotificationLevel25PercentBacklight _OSThermalNotificationLevelForBehavior(kOSThermalMitigation25PercentBacklight) #define OSThermalNotificationLevelDisableMapsHalo _OSThermalNotificationLevelForBehavior(kOSThermalMitigationDisableMapsHalo) #define OSThermalNotificationLevelAppTerminate _OSThermalNotificationLevelForBehavior(kOSThermalMitigationAppTerminate) #define OSThermalNotificationLevelDeviceRestart _OSThermalNotificationLevelForBehavior(kOSThermalMitigationDeviceRestart) /* Backwards compatibility */ #define OSThermalNotificationLevelWarning OSThermalNotificationLevel70PercentBacklight #define OSThermalNotificationLevelUrgent OSThermalNotificationLevelAppTerminate #define OSThermalNotificationLevelCritical OSThermalNotificationLevelDeviceRestart /* ** Simple polling interface to detect current thermal level */ __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_2_0) extern OSThermalNotificationLevel OSThermalNotificationCurrentLevel(void); /* ** External notify(3) string for manual notification setup */ __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_2_0) extern const char * const kOSThermalNotificationName; /* ** External notify(3) string for alerting user of a thermal condition */ __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_6_0) extern const char * const kOSThermalNotificationAlert; /* ** External notify(3) string for notifying system the options taken to resolve thermal condition */ __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_6_0) extern const char * const kOSThermalNotificationDecision; #endif // __IPHONE_OS_VERSION_MIN_REQUIRED __END_DECLS #endif /* _OSTHERMALNOTIFICATION_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/libkern/OSTypes.h ================================================ /* * Copyright (c) 1999-2012 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@ */ #include #ifndef _OS_OSTYPES_H #define _OS_OSTYPES_H #define OSTYPES_K64_REV 2 typedef unsigned int UInt; typedef signed int SInt; #include #endif /* _OS_OSTYPES_H */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/libkern/_OSByteOrder.h ================================================ /* * 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 . However, * 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 * for little-endian architectures. */ #include /* 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 #endif #if defined (__arm__) || defined(__arm64__) #include #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 */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/libkern/arm/OSByteOrder.h ================================================ /* * Copyright (c) 1999-2007 Apple Inc. All rights reserved. */ #ifndef _OS_OSBYTEORDERARM_H #define _OS_OSBYTEORDERARM_H #include #include /* 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 */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/libkern/i386/OSByteOrder.h ================================================ /* * Copyright (c) 1999-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_OSBYTEORDERI386_H #define _OS_OSBYTEORDERI386_H #include #include #include /* Functions for byte reversed loads. */ OS_INLINE uint16_t OSReadSwapInt16( const volatile void * base, uintptr_t byteOffset ) { uint16_t result; result = *(volatile uint16_t *)((uintptr_t)base + byteOffset); return _OSSwapInt16(result); } OS_INLINE uint32_t OSReadSwapInt32( const volatile void * base, uintptr_t byteOffset ) { uint32_t result; result = *(volatile uint32_t *)((uintptr_t)base + byteOffset); return _OSSwapInt32(result); } OS_INLINE uint64_t OSReadSwapInt64( const volatile void * base, uintptr_t byteOffset ) { uint64_t result; result = *(volatile uint64_t *)((uintptr_t)base + byteOffset); return _OSSwapInt64(result); } /* Functions for byte reversed stores. */ OS_INLINE void OSWriteSwapInt16( volatile void * base, uintptr_t byteOffset, uint16_t data ) { *(volatile uint16_t *)((uintptr_t)base + byteOffset) = _OSSwapInt16(data); } OS_INLINE void OSWriteSwapInt32( volatile void * base, uintptr_t byteOffset, uint32_t data ) { *(volatile uint32_t *)((uintptr_t)base + byteOffset) = _OSSwapInt32(data); } OS_INLINE void OSWriteSwapInt64( volatile void * base, uintptr_t byteOffset, uint64_t data ) { *(volatile uint64_t *)((uintptr_t)base + byteOffset) = _OSSwapInt64(data); } #endif /* ! _OS_OSBYTEORDERI386_H */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/libkern/i386/_OSByteOrder.h ================================================ /* * Copyright (c) 2006-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 _OS__OSBYTEORDERI386_H #define _OS__OSBYTEORDERI386_H #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 /* Generic byte swapping functions. */ __DARWIN_OS_INLINE __uint16_t _OSSwapInt16( __uint16_t _data ) { return (__uint16_t)((_data << 8) | (_data >> 8)); } __DARWIN_OS_INLINE __uint32_t _OSSwapInt32( __uint32_t _data ) { #if defined(__llvm__) return __builtin_bswap32(_data); #else __asm__ ("bswap %0" : "+r" (_data)); return _data; #endif } #if defined(__llvm__) __DARWIN_OS_INLINE __uint64_t _OSSwapInt64( __uint64_t _data ) { return __builtin_bswap64(_data); } #elif defined(__i386__) __DARWIN_OS_INLINE __uint64_t _OSSwapInt64( __uint64_t _data ) { __asm__ ("bswap %%eax\n\t" "bswap %%edx\n\t" "xchgl %%eax, %%edx" : "+A" (_data)); return _data; } #elif defined(__x86_64__) __DARWIN_OS_INLINE __uint64_t _OSSwapInt64( __uint64_t _data ) { __asm__ ("bswap %0" : "+r" (_data)); return _data; } #else #error Unknown architecture #endif #endif /* ! _OS__OSBYTEORDERI386_H */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/libkern/machine/OSByteOrder.h ================================================ /* * 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 _OS_OSBYTEORDERMACHINE_H #define _OS_OSBYTEORDERMACHINE_H #include #if !defined(OS_INLINE) # if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L # define OS_INLINE static inline # elif defined(__MWERKS__) || defined(__cplusplus) # define OS_INLINE static inline # else # define OS_INLINE static __inline__ # endif #endif /* Generic byte swapping functions. */ OS_INLINE uint16_t _OSSwapInt16( uint16_t data ) { return OSSwapConstInt16(data); } OS_INLINE uint32_t _OSSwapInt32( uint32_t data ) { return OSSwapConstInt32(data); } OS_INLINE uint64_t _OSSwapInt64( uint64_t data ) { return OSSwapConstInt64(data); } /* Functions for byte reversed loads. */ OS_INLINE uint16_t OSReadSwapInt16( const volatile void * base, uintptr_t byteOffset ) { uint16_t data = *(volatile uint16_t *)((uintptr_t)base + byteOffset); return _OSSwapInt16(data); } OS_INLINE uint32_t OSReadSwapInt32( const volatile void * base, uintptr_t byteOffset ) { uint32_t data = *(volatile uint32_t *)((uintptr_t)base + byteOffset); return _OSSwapInt32(data); } OS_INLINE uint64_t OSReadSwapInt64( const volatile void * base, uintptr_t byteOffset ) { uint64_t data = *(volatile uint64_t *)((uintptr_t)base + byteOffset); return _OSSwapInt64(data); } /* Functions for byte reversed stores. */ OS_INLINE void OSWriteSwapInt16( volatile void * base, uintptr_t byteOffset, uint16_t data ) { *(volatile uint16_t *)((uintptr_t)base + byteOffset) = _OSSwapInt16(data); } OS_INLINE void OSWriteSwapInt32( volatile void * base, uintptr_t byteOffset, uint32_t data ) { *(volatile uint32_t *)((uintptr_t)base + byteOffset) = _OSSwapInt32(data); } OS_INLINE void OSWriteSwapInt64( volatile void * base, uintptr_t byteOffset, uint64_t data ) { *(volatile uint64_t *)((uintptr_t)base + byteOffset) = _OSSwapInt64(data); } #endif /* ! _OS_OSBYTEORDERMACHINE_H */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/mach-o/arch.h ================================================ /* * Copyright (c) 1999 Apple Computer, 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_ARCH_H_ #define _MACH_O_ARCH_H_ /* * Copyright (c) 1997 Apple Computer, Inc. * * Functions that deal with information about architectures. * */ #include #include #include /* The NXArchInfo structs contain the architectures symbolic name * (such as "ppc"), its CPU type and CPU subtype as defined in * mach/machine.h, the byte order for the architecture, and a * describing string (such as "PowerPC"). * There will both be entries for specific CPUs (such as ppc604e) as * well as generic "family" entries (such as ppc). */ typedef struct { const char *name; cpu_type_t cputype; cpu_subtype_t cpusubtype; enum NXByteOrder byteorder; const char *description; } NXArchInfo; #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /* NXGetAllArchInfos() returns a pointer to an array of all known * NXArchInfo structures. The last NXArchInfo is marked by a NULL name. */ extern const NXArchInfo *NXGetAllArchInfos(void); /* NXGetLocalArchInfo() returns the NXArchInfo for the local host, or NULL * if none is known. */ extern const NXArchInfo *NXGetLocalArchInfo(void); /* NXGetArchInfoFromName() and NXGetArchInfoFromCpuType() return the * NXArchInfo from the architecture's name or cputype/cpusubtype * combination. A cpusubtype of CPU_SUBTYPE_MULTIPLE can be used * to request the most general NXArchInfo known for the given cputype. * NULL is returned if no matching NXArchInfo can be found. */ extern const NXArchInfo *NXGetArchInfoFromName(const char *name); extern const NXArchInfo *NXGetArchInfoFromCpuType(cpu_type_t cputype, cpu_subtype_t cpusubtype); /* The above interfaces that return pointers to NXArchInfo structs in normal * cases returns a pointer from the array returned in NXGetAllArchInfos(). * In some cases when the cputype is CPU_TYPE_I386 or CPU_TYPE_POWERPC it will * retun malloc(3)'ed NXArchInfo struct which contains a string in the * description field also a malloc(3)'ed pointer. To allow programs not to * leak memory they can call NXFreeArchInfo() on pointers returned from the * above interfaces. Since this is a new API on older systems can use the * code below. Going forward the above interfaces will only return pointers * from the array returned in NXGetAllArchInfos(). */ extern void NXFreeArchInfo(const NXArchInfo *x); /* The code that can be used for NXFreeArchInfo() when it is not available is: * * static void NXFreeArchInfo( * const NXArchInfo *x) * { * const NXArchInfo *p; * * p = NXGetAllArchInfos(); * while(p->name != NULL){ * if(x == p) * return; * p++; * } * free((char *)x->description); * free((NXArchInfo *)x); * } */ /* NXFindBestFatArch() is passed a cputype and cpusubtype and a set of * fat_arch structs and selects the best one that matches (if any) and returns * a pointer to that fat_arch struct (or NULL). The fat_arch structs must be * in the host byte order and correct such that the fat_archs really points to * enough memory for nfat_arch structs. It is possible that this routine could * fail if new cputypes or cpusubtypes are added and an old version of this * routine is used. But if there is an exact match between the cputype and * cpusubtype and one of the fat_arch structs this routine will always succeed. */ extern struct fat_arch *NXFindBestFatArch(cpu_type_t cputype, cpu_subtype_t cpusubtype, struct fat_arch *fat_archs, uint32_t nfat_archs); /* NXFindBestFatArch_64() is passed a cputype and cpusubtype and a set of * fat_arch_64 structs and selects the best one that matches (if any) and * returns a pointer to that fat_arch_64 struct (or NULL). The fat_arch_64 * structs must be in the host byte order and correct such that the fat_archs64 * really points to enough memory for nfat_arch structs. It is possible that * this routine could fail if new cputypes or cpusubtypes are added and an old * version of this routine is used. But if there is an exact match between the * cputype and cpusubtype and one of the fat_arch_64 structs this routine will * always succeed. */ extern struct fat_arch_64 *NXFindBestFatArch_64(cpu_type_t cputype, cpu_subtype_t cpusubtype, struct fat_arch_64 *fat_archs64, uint32_t nfat_archs); /* NXCombineCpuSubtypes() returns the resulting cpusubtype when combining two * different cpusubtypes for the specified cputype. If the two cpusubtypes * can't be combined (the specific subtypes are mutually exclusive) -1 is * returned indicating it is an error to combine them. This can also fail and * return -1 if new cputypes or cpusubtypes are added and an old version of * this routine is used. But if the cpusubtypes are the same they can always * be combined and this routine will return the cpusubtype pass in. */ extern cpu_subtype_t NXCombineCpuSubtypes(cpu_type_t cputype, cpu_subtype_t cpusubtype1, cpu_subtype_t cpusubtype2); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* _MACH_O_ARCH_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/mach-o/arm/reloc.h ================================================ /* * Copyright (c) 1999 Apple Computer, 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@ */ /* * Relocation types used in the arm implementation. Relocation entries for * things other than instructions use the same generic relocation as discribed * in and their r_type is ARM_RELOC_VANILLA, one of the * *_SECTDIFF or the *_PB_LA_PTR types. The rest of the relocation types are * for instructions. Since they are for instructions the r_address field * indicates the 32 bit instruction that the relocation is to be preformed on. */ enum reloc_type_arm { ARM_RELOC_VANILLA, /* generic relocation as discribed above */ ARM_RELOC_PAIR, /* the second relocation entry of a pair */ ARM_RELOC_SECTDIFF, /* a PAIR follows with subtract symbol value */ ARM_RELOC_LOCAL_SECTDIFF, /* like ARM_RELOC_SECTDIFF, but the symbol referenced was local. */ ARM_RELOC_PB_LA_PTR,/* prebound lazy pointer */ ARM_RELOC_BR24, /* 24 bit branch displacement (to a word address) */ ARM_THUMB_RELOC_BR22, /* 22 bit branch displacement (to a half-word address) */ ARM_THUMB_32BIT_BRANCH, /* obsolete - a thumb 32-bit branch instruction possibly needing page-spanning branch workaround */ /* * For these two r_type relocations they always have a pair following them * and the r_length bits are used differently. The encoding of the * r_length is as follows: * low bit of r_length: * 0 - :lower16: for movw instructions * 1 - :upper16: for movt instructions * high bit of r_length: * 0 - arm instructions * 1 - thumb instructions * the other half of the relocated expression is in the following pair * relocation entry in the the low 16 bits of r_address field. */ ARM_RELOC_HALF, ARM_RELOC_HALF_SECTDIFF }; ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/mach-o/arm64/reloc.h ================================================ /* * Copyright (c) 2010 Apple Computer, 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 _MACHO_ARM64_RELOC_H_ #define _MACHO_ARM64_RELOC_H_ /* * Relocation types used in the arm64 implementation. */ enum reloc_type_arm64 { ARM64_RELOC_UNSIGNED, // for pointers ARM64_RELOC_SUBTRACTOR, // must be followed by a ARM64_RELOC_UNSIGNED ARM64_RELOC_BRANCH26, // a B/BL instruction with 26-bit displacement ARM64_RELOC_PAGE21, // pc-rel distance to page of target ARM64_RELOC_PAGEOFF12, // offset within page, scaled by r_length ARM64_RELOC_GOT_LOAD_PAGE21, // pc-rel distance to page of GOT slot ARM64_RELOC_GOT_LOAD_PAGEOFF12, // offset within page of GOT slot, // scaled by r_length ARM64_RELOC_POINTER_TO_GOT, // for pointers to GOT slots ARM64_RELOC_TLVP_LOAD_PAGE21, // pc-rel distance to page of TLVP slot ARM64_RELOC_TLVP_LOAD_PAGEOFF12, // offset within page of TLVP slot, // scaled by r_length ARM64_RELOC_ADDEND, // must be followed by PAGE21 or PAGEOFF12 // An arm64e authenticated pointer. // // Represents a pointer to a symbol (like ARM64_RELOC_UNSIGNED). // Additionally, the resulting pointer is signed. The signature is // specified in the target location: the addend is restricted to the lower // 32 bits (instead of the full 64 bits for ARM64_RELOC_UNSIGNED): // // |63|62|61-51|50-49| 48 |47 - 32|31 - 0| // | 1| 0| 0 | key | addr | discriminator | addend | // // The key is one of: // IA: 00 IB: 01 // DA: 10 DB: 11 // // The discriminator field is used as extra signature diversification. // // The addr field indicates whether the target address should be blended // into the discriminator. // ARM64_RELOC_AUTHENTICATED_POINTER, }; #endif /* #ifndef _MACHO_ARM64_RELOC_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/mach-o/compact_unwind_encoding.h ================================================ //===------------------ mach-o/compact_unwind_encoding.h ------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // // Darwin's alternative to DWARF based unwind encodings. // //===----------------------------------------------------------------------===// #ifndef __COMPACT_UNWIND_ENCODING__ #define __COMPACT_UNWIND_ENCODING__ #include // // Compilers can emit standard DWARF FDEs in the __TEXT,__eh_frame section // of object files. Or compilers can emit compact unwind information in // the __LD,__compact_unwind section. // // When the linker creates a final linked image, it will create a // __TEXT,__unwind_info section. This section is a small and fast way for the // runtime to access unwind info for any given function. If the compiler // emitted compact unwind info for the function, that compact unwind info will // be encoded in the __TEXT,__unwind_info section. If the compiler emitted // DWARF unwind info, the __TEXT,__unwind_info section will contain the offset // of the FDE in the __TEXT,__eh_frame section in the final linked image. // // Note: Previously, the linker would transform some DWARF unwind infos into // compact unwind info. But that is fragile and no longer done. // // The compact unwind endoding is a 32-bit value which encoded in an // architecture specific way, which registers to restore from where, and how // to unwind out of the function. // typedef uint32_t compact_unwind_encoding_t; // architecture independent bits enum { UNWIND_IS_NOT_FUNCTION_START = 0x80000000, UNWIND_HAS_LSDA = 0x40000000, UNWIND_PERSONALITY_MASK = 0x30000000, }; // // x86 // // 1-bit: start // 1-bit: has lsda // 2-bit: personality index // // 4-bits: 0=old, 1=ebp based, 2=stack-imm, 3=stack-ind, 4=DWARF // ebp based: // 15-bits (5*3-bits per reg) register permutation // 8-bits for stack offset // frameless: // 8-bits stack size // 3-bits stack adjust // 3-bits register count // 10-bits register permutation // enum { UNWIND_X86_MODE_MASK = 0x0F000000, UNWIND_X86_MODE_EBP_FRAME = 0x01000000, UNWIND_X86_MODE_STACK_IMMD = 0x02000000, UNWIND_X86_MODE_STACK_IND = 0x03000000, UNWIND_X86_MODE_DWARF = 0x04000000, UNWIND_X86_EBP_FRAME_REGISTERS = 0x00007FFF, UNWIND_X86_EBP_FRAME_OFFSET = 0x00FF0000, UNWIND_X86_FRAMELESS_STACK_SIZE = 0x00FF0000, UNWIND_X86_FRAMELESS_STACK_ADJUST = 0x0000E000, UNWIND_X86_FRAMELESS_STACK_REG_COUNT = 0x00001C00, UNWIND_X86_FRAMELESS_STACK_REG_PERMUTATION = 0x000003FF, UNWIND_X86_DWARF_SECTION_OFFSET = 0x00FFFFFF, }; enum { UNWIND_X86_REG_NONE = 0, UNWIND_X86_REG_EBX = 1, UNWIND_X86_REG_ECX = 2, UNWIND_X86_REG_EDX = 3, UNWIND_X86_REG_EDI = 4, UNWIND_X86_REG_ESI = 5, UNWIND_X86_REG_EBP = 6, }; // // For x86 there are four modes for the compact unwind encoding: // UNWIND_X86_MODE_EBP_FRAME: // EBP based frame where EBP is push on stack immediately after return address, // then ESP is moved to EBP. Thus, to unwind ESP is restored with the current // EPB value, then EBP is restored by popping off the stack, and the return // is done by popping the stack once more into the pc. // All non-volatile registers that need to be restored must have been saved // in a small range in the stack that starts EBP-4 to EBP-1020. The offset/4 // is encoded in the UNWIND_X86_EBP_FRAME_OFFSET bits. The registers saved // are encoded in the UNWIND_X86_EBP_FRAME_REGISTERS bits as five 3-bit entries. // Each entry contains which register to restore. // UNWIND_X86_MODE_STACK_IMMD: // A "frameless" (EBP not used as frame pointer) function with a small // constant stack size. To return, a constant (encoded in the compact // unwind encoding) is added to the ESP. Then the return is done by // popping the stack into the pc. // All non-volatile registers that need to be restored must have been saved // on the stack immediately after the return address. The stack_size/4 is // encoded in the UNWIND_X86_FRAMELESS_STACK_SIZE (max stack size is 1024). // The number of registers saved is encoded in UNWIND_X86_FRAMELESS_STACK_REG_COUNT. // UNWIND_X86_FRAMELESS_STACK_REG_PERMUTATION constains which registers were // saved and their order. // UNWIND_X86_MODE_STACK_IND: // A "frameless" (EBP not used as frame pointer) function large constant // stack size. This case is like the previous, except the stack size is too // large to encode in the compact unwind encoding. Instead it requires that // the function contains "subl $nnnnnnnn,ESP" in its prolog. The compact // encoding contains the offset to the nnnnnnnn value in the function in // UNWIND_X86_FRAMELESS_STACK_SIZE. // UNWIND_X86_MODE_DWARF: // No compact unwind encoding is available. Instead the low 24-bits of the // compact encoding is the offset of the DWARF FDE in the __eh_frame section. // This mode is never used in object files. It is only generated by the // linker in final linked images which have only DWARF unwind info for a // function. // // The permutation encoding is a Lehmer code sequence encoded into a // single variable-base number so we can encode the ordering of up to // six registers in a 10-bit space. // // The following is the algorithm used to create the permutation encoding used // with frameless stacks. It is passed the number of registers to be saved and // an array of the register numbers saved. // //uint32_t permute_encode(uint32_t registerCount, const uint32_t registers[6]) //{ // uint32_t renumregs[6]; // for (int i=6-registerCount; i < 6; ++i) { // int countless = 0; // for (int j=6-registerCount; j < i; ++j) { // if ( registers[j] < registers[i] ) // ++countless; // } // renumregs[i] = registers[i] - countless -1; // } // uint32_t permutationEncoding = 0; // switch ( registerCount ) { // case 6: // permutationEncoding |= (120*renumregs[0] + 24*renumregs[1] // + 6*renumregs[2] + 2*renumregs[3] // + renumregs[4]); // break; // case 5: // permutationEncoding |= (120*renumregs[1] + 24*renumregs[2] // + 6*renumregs[3] + 2*renumregs[4] // + renumregs[5]); // break; // case 4: // permutationEncoding |= (60*renumregs[2] + 12*renumregs[3] // + 3*renumregs[4] + renumregs[5]); // break; // case 3: // permutationEncoding |= (20*renumregs[3] + 4*renumregs[4] // + renumregs[5]); // break; // case 2: // permutationEncoding |= (5*renumregs[4] + renumregs[5]); // break; // case 1: // permutationEncoding |= (renumregs[5]); // break; // } // return permutationEncoding; //} // // // x86_64 // // 1-bit: start // 1-bit: has lsda // 2-bit: personality index // // 4-bits: 0=old, 1=rbp based, 2=stack-imm, 3=stack-ind, 4=DWARF // rbp based: // 15-bits (5*3-bits per reg) register permutation // 8-bits for stack offset // frameless: // 8-bits stack size // 3-bits stack adjust // 3-bits register count // 10-bits register permutation // enum { UNWIND_X86_64_MODE_MASK = 0x0F000000, UNWIND_X86_64_MODE_RBP_FRAME = 0x01000000, UNWIND_X86_64_MODE_STACK_IMMD = 0x02000000, UNWIND_X86_64_MODE_STACK_IND = 0x03000000, UNWIND_X86_64_MODE_DWARF = 0x04000000, UNWIND_X86_64_RBP_FRAME_REGISTERS = 0x00007FFF, UNWIND_X86_64_RBP_FRAME_OFFSET = 0x00FF0000, UNWIND_X86_64_FRAMELESS_STACK_SIZE = 0x00FF0000, UNWIND_X86_64_FRAMELESS_STACK_ADJUST = 0x0000E000, UNWIND_X86_64_FRAMELESS_STACK_REG_COUNT = 0x00001C00, UNWIND_X86_64_FRAMELESS_STACK_REG_PERMUTATION = 0x000003FF, UNWIND_X86_64_DWARF_SECTION_OFFSET = 0x00FFFFFF, }; enum { UNWIND_X86_64_REG_NONE = 0, UNWIND_X86_64_REG_RBX = 1, UNWIND_X86_64_REG_R12 = 2, UNWIND_X86_64_REG_R13 = 3, UNWIND_X86_64_REG_R14 = 4, UNWIND_X86_64_REG_R15 = 5, UNWIND_X86_64_REG_RBP = 6, }; // // For x86_64 there are four modes for the compact unwind encoding: // UNWIND_X86_64_MODE_RBP_FRAME: // RBP based frame where RBP is push on stack immediately after return address, // then RSP is moved to RBP. Thus, to unwind RSP is restored with the current // EPB value, then RBP is restored by popping off the stack, and the return // is done by popping the stack once more into the pc. // All non-volatile registers that need to be restored must have been saved // in a small range in the stack that starts RBP-8 to RBP-2040. The offset/8 // is encoded in the UNWIND_X86_64_RBP_FRAME_OFFSET bits. The registers saved // are encoded in the UNWIND_X86_64_RBP_FRAME_REGISTERS bits as five 3-bit entries. // Each entry contains which register to restore. // UNWIND_X86_64_MODE_STACK_IMMD: // A "frameless" (RBP not used as frame pointer) function with a small // constant stack size. To return, a constant (encoded in the compact // unwind encoding) is added to the RSP. Then the return is done by // popping the stack into the pc. // All non-volatile registers that need to be restored must have been saved // on the stack immediately after the return address. The stack_size/8 is // encoded in the UNWIND_X86_64_FRAMELESS_STACK_SIZE (max stack size is 2048). // The number of registers saved is encoded in UNWIND_X86_64_FRAMELESS_STACK_REG_COUNT. // UNWIND_X86_64_FRAMELESS_STACK_REG_PERMUTATION constains which registers were // saved and their order. // UNWIND_X86_64_MODE_STACK_IND: // A "frameless" (RBP not used as frame pointer) function large constant // stack size. This case is like the previous, except the stack size is too // large to encode in the compact unwind encoding. Instead it requires that // the function contains "subq $nnnnnnnn,RSP" in its prolog. The compact // encoding contains the offset to the nnnnnnnn value in the function in // UNWIND_X86_64_FRAMELESS_STACK_SIZE. // UNWIND_X86_64_MODE_DWARF: // No compact unwind encoding is available. Instead the low 24-bits of the // compact encoding is the offset of the DWARF FDE in the __eh_frame section. // This mode is never used in object files. It is only generated by the // linker in final linked images which have only DWARF unwind info for a // function. // // ARM64 // // 1-bit: start // 1-bit: has lsda // 2-bit: personality index // // 4-bits: 4=frame-based, 3=DWARF, 2=frameless // frameless: // 12-bits of stack size // frame-based: // 4-bits D reg pairs saved // 5-bits X reg pairs saved // DWARF: // 24-bits offset of DWARF FDE in __eh_frame section // enum { UNWIND_ARM64_MODE_MASK = 0x0F000000, UNWIND_ARM64_MODE_FRAMELESS = 0x02000000, UNWIND_ARM64_MODE_DWARF = 0x03000000, UNWIND_ARM64_MODE_FRAME = 0x04000000, UNWIND_ARM64_FRAME_X19_X20_PAIR = 0x00000001, UNWIND_ARM64_FRAME_X21_X22_PAIR = 0x00000002, UNWIND_ARM64_FRAME_X23_X24_PAIR = 0x00000004, UNWIND_ARM64_FRAME_X25_X26_PAIR = 0x00000008, UNWIND_ARM64_FRAME_X27_X28_PAIR = 0x00000010, UNWIND_ARM64_FRAME_D8_D9_PAIR = 0x00000100, UNWIND_ARM64_FRAME_D10_D11_PAIR = 0x00000200, UNWIND_ARM64_FRAME_D12_D13_PAIR = 0x00000400, UNWIND_ARM64_FRAME_D14_D15_PAIR = 0x00000800, UNWIND_ARM64_FRAMELESS_STACK_SIZE_MASK = 0x00FFF000, UNWIND_ARM64_DWARF_SECTION_OFFSET = 0x00FFFFFF, }; // For arm64 there are three modes for the compact unwind encoding: // UNWIND_ARM64_MODE_FRAME: // This is a standard arm64 prolog where FP/LR are immediately pushed on the // stack, then SP is copied to FP. If there are any non-volatile registers // saved, then are copied into the stack frame in pairs in a contiguous // range right below the saved FP/LR pair. Any subset of the five X pairs // and four D pairs can be saved, but the memory layout must be in register // number order. // UNWIND_ARM64_MODE_FRAMELESS: // A "frameless" leaf function, where FP/LR are not saved. The return address // remains in LR throughout the function. If any non-volatile registers // are saved, they must be pushed onto the stack before any stack space is // allocated for local variables. The stack sized (including any saved // non-volatile registers) divided by 16 is encoded in the bits // UNWIND_ARM64_FRAMELESS_STACK_SIZE_MASK. // UNWIND_ARM64_MODE_DWARF: // No compact unwind encoding is available. Instead the low 24-bits of the // compact encoding is the offset of the DWARF FDE in the __eh_frame section. // This mode is never used in object files. It is only generated by the // linker in final linked images which have only DWARF unwind info for a // function. // #ifndef __OPEN_SOURCE__ // // armv7k // // 1-bit: start // 1-bit: has lsda // 2-bit: personality index // // 4-bits: 1=frame, 2=frame+dregs, 4=dwarf // enum { UNWIND_ARM_MODE_MASK = 0x0F000000, UNWIND_ARM_MODE_FRAME = 0x01000000, UNWIND_ARM_MODE_FRAME_D = 0x02000000, UNWIND_ARM_MODE_DWARF = 0x04000000, UNWIND_ARM_FRAME_STACK_ADJUST_MASK = 0x00C00000, UNWIND_ARM_FRAME_FIRST_PUSH_R4 = 0x00000001, UNWIND_ARM_FRAME_FIRST_PUSH_R5 = 0x00000002, UNWIND_ARM_FRAME_FIRST_PUSH_R6 = 0x00000004, UNWIND_ARM_FRAME_SECOND_PUSH_R8 = 0x00000008, UNWIND_ARM_FRAME_SECOND_PUSH_R9 = 0x00000010, UNWIND_ARM_FRAME_SECOND_PUSH_R10 = 0x00000020, UNWIND_ARM_FRAME_SECOND_PUSH_R11 = 0x00000040, UNWIND_ARM_FRAME_SECOND_PUSH_R12 = 0x00000080, UNWIND_ARM_FRAME_D_REG_COUNT_MASK = 0x00000700, UNWIND_ARM_DWARF_SECTION_OFFSET = 0x00FFFFFF, }; // For armv7k there are three modes for the compact unwind encoding: // UNWIND_ARM_MODE_FRAME: // This is a standard arm prolog where lr/r7 are immediately pushed on the // stack. As part of that first push r4, r5, or r6 can be also pushed // and if so the FIRST_PUSH bit is set in the compact unwind. Additionally // there can be a second push multiple which can save r8 through r12. // If that is used, the registers saved is recorded with a SECOND_PUSH bit. // Lastly, for var-args support, the prolog may save r1, r2, r3 to the // stack before the frame push. If that is done the STACK_ADJUST_MASK // records that the stack pointer must be adjust (e.g 0x00800000 means // the stack pointer was adjusted 8 bytes down and the unwinder would // need to add back 8 bytes to SP when unwinding through this function. // UNWIND_ARM_MODE_FRAME_D: // This is the same as UNWIND_ARM_MODE_FRAME, except that additionally // some D registers were saved. The D_REG_COUNT_MASK contains which // set if D registers were saved and where. There are currently 8 (0-7) // possible D register save patterns supported. // UNWIND_ARM_MODE_DWARF: // No compact unwind encoding is available. Instead the low 24-bits of the // compact encoding is the offset of the dwarf FDE in the __eh_frame section. // The offset only exists in final linked images. It is zero in object files. #endif //////////////////////////////////////////////////////////////////////////////// // // Relocatable Object Files: __LD,__compact_unwind // //////////////////////////////////////////////////////////////////////////////// // // A compiler can generated compact unwind information for a function by adding // a "row" to the __LD,__compact_unwind section. This section has the // S_ATTR_DEBUG bit set, so the section will be ignored by older linkers. // It is removed by the new linker, so never ends up in final executables. // This section is a table, initially with one row per function (that needs // unwind info). The table columns and some conceptual entries are: // // range-start pointer to start of function/range // range-length // compact-unwind-encoding 32-bit encoding // personality-function or zero if no personality function // lsda or zero if no LSDA data // // The length and encoding fields are 32-bits. The other are all pointer sized. // // In x86_64 assembly, these entry would look like: // // .section __LD,__compact_unwind,regular,debug // // #compact unwind for _foo // .quad _foo // .set L1,LfooEnd-_foo // .long L1 // .long 0x01010001 // .quad 0 // .quad 0 // // #compact unwind for _bar // .quad _bar // .set L2,LbarEnd-_bar // .long L2 // .long 0x01020011 // .quad __gxx_personality // .quad except_tab1 // // // Notes: There is no need for any labels in the the __compact_unwind section. // The use of the .set directive is to force the evaluation of the // range-length at assembly time, instead of generating relocations. // // To support future compiler optimizations where which non-volatile registers // are saved changes within a function (e.g. delay saving non-volatiles until // necessary), there can by multiple lines in the __compact_unwind table for one // function, each with a different (non-overlapping) range and each with // different compact unwind encodings that correspond to the non-volatiles // saved at that range of the function. // // If a particular function is so wacky that there is no compact unwind way // to encode it, then the compiler can emit traditional DWARF unwind info. // The runtime will use which ever is available. // // Runtime support for compact unwind encodings are only available on 10.6 // and later. So, the compiler should not generate it when targeting pre-10.6. //////////////////////////////////////////////////////////////////////////////// // // Final Linked Images: __TEXT,__unwind_info // //////////////////////////////////////////////////////////////////////////////// // // The __TEXT,__unwind_info section is laid out for an efficient two level lookup. // The header of the section contains a coarse index that maps function address // to the page (4096 byte block) containing the unwind info for that function. // #define UNWIND_SECTION_VERSION 1 struct unwind_info_section_header { uint32_t version; // UNWIND_SECTION_VERSION uint32_t commonEncodingsArraySectionOffset; uint32_t commonEncodingsArrayCount; uint32_t personalityArraySectionOffset; uint32_t personalityArrayCount; uint32_t indexSectionOffset; uint32_t indexCount; // compact_unwind_encoding_t[] // uint32_t personalities[] // unwind_info_section_header_index_entry[] // unwind_info_section_header_lsda_index_entry[] }; struct unwind_info_section_header_index_entry { uint32_t functionOffset; uint32_t secondLevelPagesSectionOffset; // section offset to start of regular or compress page uint32_t lsdaIndexArraySectionOffset; // section offset to start of lsda_index array for this range }; struct unwind_info_section_header_lsda_index_entry { uint32_t functionOffset; uint32_t lsdaOffset; }; // // There are two kinds of second level index pages: regular and compressed. // A compressed page can hold up to 1021 entries, but it cannot be used // if too many different encoding types are used. The regular page holds // 511 entries. // struct unwind_info_regular_second_level_entry { uint32_t functionOffset; compact_unwind_encoding_t encoding; }; #define UNWIND_SECOND_LEVEL_REGULAR 2 struct unwind_info_regular_second_level_page_header { uint32_t kind; // UNWIND_SECOND_LEVEL_REGULAR uint16_t entryPageOffset; uint16_t entryCount; // entry array }; #define UNWIND_SECOND_LEVEL_COMPRESSED 3 struct unwind_info_compressed_second_level_page_header { uint32_t kind; // UNWIND_SECOND_LEVEL_COMPRESSED uint16_t entryPageOffset; uint16_t entryCount; uint16_t encodingsPageOffset; uint16_t encodingsCount; // 32-bit entry array // encodings array }; #define UNWIND_INFO_COMPRESSED_ENTRY_FUNC_OFFSET(entry) (entry & 0x00FFFFFF) #define UNWIND_INFO_COMPRESSED_ENTRY_ENCODING_INDEX(entry) ((entry >> 24) & 0xFF) #endif ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/mach-o/compact_unwind_encoding.modulemap ================================================ module MachO.compact_unwind_encoding [system] [extern_c] { header "compact_unwind_encoding.h" export * } ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/mach-o/dyld.h ================================================ /* * 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 #include #include #include #include #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 . * 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_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/mach-o/dyld.modulemap ================================================ module MachO.dyld [system] [extern_c] { header "dyld.h" export * } ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/mach-o/dyld_images.h ================================================ /* * Copyright (c) 2006-2010 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 _DYLD_IMAGES_ #define _DYLD_IMAGES_ #include #include #include #include #if defined(__cplusplus) && (BUILDING_LIBDYLD || BUILDING_DYLD) #include #endif #ifdef __cplusplus extern "C" { #endif /* * Beginning in Mac OS X 10.4, this is how gdb discovers which mach-o images are loaded in a process. * * gdb looks for the symbol "_dyld_all_image_infos" in dyld. It contains the fields below. * * For a snashot of what images are currently loaded, the infoArray fields contain a pointer * to an array of all images. If infoArray is NULL, it means it is being modified, come back later. * * To be notified of changes, gdb sets a break point on the address pointed to by the notificationn * field. The function it points to is called by dyld with an array of information about what images * have been added (dyld_image_adding) or are about to be removed (dyld_image_removing). * * The notification is called after infoArray is updated. This means that if gdb attaches to a process * and infoArray is NULL, gdb can set a break point on notification and let the proccess continue to * run until the break point. Then gdb can inspect the full infoArray. * * The dyldVersion field always points to a C string that contains the dyld version. For instance, * in dyld-127.3, dyldVersion would contain a pointer to "127.3". * * The errorMessage and terminationFlags fields are normally zero. If dyld terminates a process * (for instance because a required dylib or symbol is missing), then the errorMessage field will * be set to point to a C string message buffer containing the reason dyld terminate the process. * The low bit of the terminationFlags will be set if dyld terminated the process before any user * code ran, in which case there is no need for the crash log to contain the backtrace. * * When dyld terminates a process because some required dylib or symbol cannot be bound, in * addition to the errorMessage field, it now sets the errorKind field and the corresponding * fields: errorClientOfDylibPath, errorTargetDylibPath, errorSymbol. * */ enum dyld_image_mode { dyld_image_adding=0, dyld_image_removing=1, dyld_image_info_change=2 }; struct dyld_image_info { const struct mach_header* imageLoadAddress; /* base address image is mapped into */ const char* imageFilePath; /* path dyld used to load the image */ uintptr_t imageFileModDate; /* time_t of image file */ /* if stat().st_mtime of imageFilePath does not match imageFileModDate, */ /* then file has been modified since dyld loaded it */ }; struct dyld_uuid_info { const struct mach_header* imageLoadAddress; /* base address image is mapped into */ uuid_t imageUUID; /* UUID of image */ }; #define DYLD_AOT_IMAGE_KEY_SIZE 32 struct dyld_aot_image_info { const struct mach_header* x86LoadAddress; const struct mach_header* aotLoadAddress; uint64_t aotImageSize; uint8_t aotImageKey[DYLD_AOT_IMAGE_KEY_SIZE]; // uniquely identifying SHA-256 key for this aot }; struct dyld_aot_shared_cache_info { const uintptr_t cacheBaseAddress; uuid_t cacheUUID; }; typedef void (*dyld_image_notifier)(enum dyld_image_mode mode, uint32_t infoCount, const struct dyld_image_info info[]); /* for use in dyld_all_image_infos.errorKind field */ enum { dyld_error_kind_none=0, dyld_error_kind_dylib_missing=1, dyld_error_kind_dylib_wrong_arch=2, dyld_error_kind_dylib_version=3, dyld_error_kind_symbol_missing=4 }; /* internal limit */ #define DYLD_MAX_PROCESS_INFO_NOTIFY_COUNT 8 struct dyld_all_image_infos { uint32_t version; /* 1 in Mac OS X 10.4 and 10.5 */ uint32_t infoArrayCount; #if defined(__cplusplus) && (BUILDING_LIBDYLD || BUILDING_DYLD) std::atomic infoArray; #else const struct dyld_image_info* infoArray; #endif dyld_image_notifier notification; bool processDetachedFromSharedRegion; /* the following fields are only in version 2 (Mac OS X 10.6, iPhoneOS 2.0) and later */ bool libSystemInitialized; const struct mach_header* dyldImageLoadAddress; /* the following field is only in version 3 (Mac OS X 10.6, iPhoneOS 3.0) and later */ void* jitInfo; /* the following fields are only in version 5 (Mac OS X 10.6, iPhoneOS 3.0) and later */ const char* dyldVersion; const char* errorMessage; uintptr_t terminationFlags; /* the following field is only in version 6 (Mac OS X 10.6, iPhoneOS 3.1) and later */ void* coreSymbolicationShmPage; /* the following field is only in version 7 (Mac OS X 10.6, iPhoneOS 3.1) and later */ uintptr_t systemOrderFlag; /* the following field is only in version 8 (Mac OS X 10.7, iPhoneOS 3.1) and later */ uintptr_t uuidArrayCount; const struct dyld_uuid_info* uuidArray; /* only images not in dyld shared cache */ /* the following field is only in version 9 (Mac OS X 10.7, iOS 4.0) and later */ struct dyld_all_image_infos* dyldAllImageInfosAddress; /* the following field is only in version 10 (Mac OS X 10.7, iOS 4.2) and later */ uintptr_t initialImageCount; /* the following field is only in version 11 (Mac OS X 10.7, iOS 4.2) and later */ uintptr_t errorKind; const char* errorClientOfDylibPath; const char* errorTargetDylibPath; const char* errorSymbol; /* the following field is only in version 12 (Mac OS X 10.7, iOS 4.3) and later */ uintptr_t sharedCacheSlide; /* the following field is only in version 13 (Mac OS X 10.9, iOS 7.0) and later */ uint8_t sharedCacheUUID[16]; /* the following field is only in version 15 (macOS 10.12, iOS 10.0) and later */ uintptr_t sharedCacheBaseAddress; #if defined(__cplusplus) && (BUILDING_LIBDYLD || BUILDING_DYLD) // We want this to be atomic in libdyld so that we can see updates when we map it shared std::atomic infoArrayChangeTimestamp; #else uint64_t infoArrayChangeTimestamp; #endif const char* dyldPath; mach_port_t notifyPorts[DYLD_MAX_PROCESS_INFO_NOTIFY_COUNT]; #if __LP64__ uintptr_t reserved[11-(DYLD_MAX_PROCESS_INFO_NOTIFY_COUNT/2)]; #else uintptr_t reserved[9-DYLD_MAX_PROCESS_INFO_NOTIFY_COUNT]; #endif // The following fields were added in version 18 (previously they were reserved padding fields) uint64_t sharedCacheFSID; uint64_t sharedCacheFSObjID; /* the following field is only in version 16 (macOS 10.13, iOS 11.0) and later */ uintptr_t compact_dyld_image_info_addr; size_t compact_dyld_image_info_size; uint32_t platform; // FIXME: really a dyld_platform_t, but those aren't exposed here. /* the following field is only in version 17 (macOS 10.16) and later */ uint32_t aotInfoCount; const struct dyld_aot_image_info* aotInfoArray; uint64_t aotInfoArrayChangeTimestamp; uintptr_t aotSharedCacheBaseAddress; uint8_t aotSharedCacheUUID[16]; }; /* * Beginning in Mac OS X 10.5, this is how gdb discovers where the shared cache is in a process. * Images that are in the shared cache have their segments rearranged, so when using imageFilePath * to load the file from disk, you have to know to adjust addresses based on how their segment * was rearranged. * * gdb looks for the symbol "_dyld_shared_region_ranges" in dyld. * * It contains information the count of shared regions used by the process. The count is * the number of start/length pairs. */ struct dyld_shared_cache_ranges { uintptr_t sharedRegionsCount; /* how many ranges follow */ struct { uintptr_t start; uintptr_t length; } ranges[4]; /* max regions */ }; extern struct dyld_shared_cache_ranges dyld_shared_cache_ranges __attribute__((visibility("hidden"))); #ifdef __cplusplus } #endif #endif /* _DYLD_IMAGES_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/mach-o/fat.h ================================================ /* * Copyright (c) 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 _MACH_O_FAT_H_ #define _MACH_O_FAT_H_ /* * This header file describes the structures of the file format for "fat" * architecture specific file (wrapper design). At the begining of the file * there is one fat_header structure followed by a number of fat_arch * structures. For each architecture in the file, specified by a pair of * cputype and cpusubtype, the fat_header describes the file offset, file * size and alignment in the file of the architecture specific member. * The padded bytes in the file to place each member on it's specific alignment * are defined to be read as zeros and can be left as "holes" if the file system * can support them as long as they read as zeros. * * All structures defined here are always written and read to/from disk * in big-endian order. */ /* * is needed here for the cpu_type_t and cpu_subtype_t types * and contains the constants for the possible values of these types. */ #include #include #include #define FAT_MAGIC 0xcafebabe #define FAT_CIGAM 0xbebafeca /* NXSwapLong(FAT_MAGIC) */ struct fat_header { uint32_t magic; /* FAT_MAGIC or FAT_MAGIC_64 */ uint32_t nfat_arch; /* number of structs that follow */ }; struct fat_arch { cpu_type_t cputype; /* cpu specifier (int) */ cpu_subtype_t cpusubtype; /* machine specifier (int) */ uint32_t offset; /* file offset to this object file */ uint32_t size; /* size of this object file */ uint32_t align; /* alignment as a power of 2 */ }; /* * The support for the 64-bit fat file format described here is a work in * progress and not yet fully supported in all the Apple Developer Tools. * * When a slice is greater than 4mb or an offset to a slice is greater than 4mb * then the 64-bit fat file format is used. */ #define FAT_MAGIC_64 0xcafebabf #define FAT_CIGAM_64 0xbfbafeca /* NXSwapLong(FAT_MAGIC_64) */ struct fat_arch_64 { cpu_type_t cputype; /* cpu specifier (int) */ cpu_subtype_t cpusubtype; /* machine specifier (int) */ uint64_t offset; /* file offset to this object file */ uint64_t size; /* size of this object file */ uint32_t align; /* alignment as a power of 2 */ uint32_t reserved; /* reserved */ }; #endif /* _MACH_O_FAT_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/mach-o/fixup-chains.h ================================================ /* -*- mode: C++; c-basic-offset: 4; tab-width: 4 -*- * * Copyright (c) 2018 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_FIXUP_CHAINS__ #define __MACH_O_FIXUP_CHAINS__ 6 #include //#define LC_DYLD_EXPORTS_TRIE 0x80000033 // used with linkedit_data_command //#define LC_DYLD_CHAINED_FIXUPS 0x80000034 // used with linkedit_data_command, payload is dyld_chained_fixups_header // header of the LC_DYLD_CHAINED_FIXUPS payload struct dyld_chained_fixups_header { uint32_t fixups_version; // 0 uint32_t starts_offset; // offset of dyld_chained_starts_in_image in chain_data uint32_t imports_offset; // offset of imports table in chain_data uint32_t symbols_offset; // offset of symbol strings in chain_data uint32_t imports_count; // number of imported symbol names uint32_t imports_format; // DYLD_CHAINED_IMPORT* uint32_t symbols_format; // 0 => uncompressed, 1 => zlib compressed }; // This struct is embedded in LC_DYLD_CHAINED_FIXUPS payload struct dyld_chained_starts_in_image { uint32_t seg_count; uint32_t seg_info_offset[1]; // each entry is offset into this struct for that segment // followed by pool of dyld_chain_starts_in_segment data }; // This struct is embedded in dyld_chain_starts_in_image // and passed down to the kernel for page-in linking struct dyld_chained_starts_in_segment { uint32_t size; // size of this (amount kernel needs to copy) uint16_t page_size; // 0x1000 or 0x4000 uint16_t pointer_format; // DYLD_CHAINED_PTR_* uint64_t segment_offset; // offset in memory to start of segment uint32_t max_valid_pointer; // for 32-bit OS, any value beyond this is not a pointer uint16_t page_count; // how many pages are in array uint16_t page_start[1]; // each entry is offset in each page of first element in chain // or DYLD_CHAINED_PTR_START_NONE if no fixups on page // uint16_t chain_starts[1]; // some 32-bit formats may require multiple starts per page. // for those, if high bit is set in page_starts[], then it // is index into chain_starts[] which is a list of starts // the last of which has the high bit set }; enum { DYLD_CHAINED_PTR_START_NONE = 0xFFFF, // used in page_start[] to denote a page with no fixups DYLD_CHAINED_PTR_START_MULTI = 0x8000, // used in page_start[] to denote a page which has multiple starts DYLD_CHAINED_PTR_START_LAST = 0x8000, // used in chain_starts[] to denote last start in list for page }; // This struct is embedded in __TEXT,__chain_starts section in firmware struct dyld_chained_starts_offsets { uint32_t pointer_format; // DYLD_CHAINED_PTR_32_FIRMWARE uint32_t starts_count; // number of starts in array uint32_t chain_starts[1]; // array chain start offsets }; // values for dyld_chained_starts_in_segment.pointer_format enum { DYLD_CHAINED_PTR_ARM64E = 1, // stride 8, unauth target is vmaddr DYLD_CHAINED_PTR_64 = 2, // target is vmaddr DYLD_CHAINED_PTR_32 = 3, DYLD_CHAINED_PTR_32_CACHE = 4, DYLD_CHAINED_PTR_32_FIRMWARE = 5, DYLD_CHAINED_PTR_64_OFFSET = 6, // target is vm offset DYLD_CHAINED_PTR_ARM64E_OFFSET = 7, // old name DYLD_CHAINED_PTR_ARM64E_KERNEL = 7, // stride 4, unauth target is vm offset DYLD_CHAINED_PTR_64_KERNEL_CACHE = 8, DYLD_CHAINED_PTR_ARM64E_USERLAND = 9, // stride 8, unauth target is vm offset DYLD_CHAINED_PTR_ARM64E_FIRMWARE = 10, // stride 4, unauth target is vmaddr DYLD_CHAINED_PTR_X86_64_KERNEL_CACHE = 11, // stride 1, x86_64 kernel caches DYLD_CHAINED_PTR_ARM64E_USERLAND24 = 12, // stride 8, unauth target is vm offset, 24-bit bind }; // DYLD_CHAINED_PTR_ARM64E struct dyld_chained_ptr_arm64e_rebase { uint64_t target : 43, high8 : 8, next : 11, // 4 or 8-byte stide bind : 1, // == 0 auth : 1; // == 0 }; // DYLD_CHAINED_PTR_ARM64E struct dyld_chained_ptr_arm64e_bind { uint64_t ordinal : 16, zero : 16, addend : 19, // +/-256K next : 11, // 4 or 8-byte stide bind : 1, // == 1 auth : 1; // == 0 }; // DYLD_CHAINED_PTR_ARM64E struct dyld_chained_ptr_arm64e_auth_rebase { uint64_t target : 32, // runtimeOffset diversity : 16, addrDiv : 1, key : 2, next : 11, // 4 or 8-byte stide bind : 1, // == 0 auth : 1; // == 1 }; // DYLD_CHAINED_PTR_ARM64E struct dyld_chained_ptr_arm64e_auth_bind { uint64_t ordinal : 16, zero : 16, diversity : 16, addrDiv : 1, key : 2, next : 11, // 4 or 8-byte stide bind : 1, // == 1 auth : 1; // == 1 }; // DYLD_CHAINED_PTR_64/DYLD_CHAINED_PTR_64_OFFSET struct dyld_chained_ptr_64_rebase { uint64_t target : 36, // 64GB max image size (DYLD_CHAINED_PTR_64 => vmAddr, DYLD_CHAINED_PTR_64_OFFSET => runtimeOffset) high8 : 8, // top 8 bits set to this (DYLD_CHAINED_PTR_64 => after slide added, DYLD_CHAINED_PTR_64_OFFSET => before slide added) reserved : 7, // all zeros next : 12, // 4-byte stride bind : 1; // == 0 }; // DYLD_CHAINED_PTR_ARM64E_USERLAND24 struct dyld_chained_ptr_arm64e_bind24 { uint64_t ordinal : 24, zero : 8, addend : 19, // +/-256K next : 11, // 8-byte stide bind : 1, // == 1 auth : 1; // == 0 }; // DYLD_CHAINED_PTR_ARM64E_USERLAND24 struct dyld_chained_ptr_arm64e_auth_bind24 { uint64_t ordinal : 24, zero : 8, diversity : 16, addrDiv : 1, key : 2, next : 11, // 8-byte stide bind : 1, // == 1 auth : 1; // == 1 }; // DYLD_CHAINED_PTR_64 struct dyld_chained_ptr_64_bind { uint64_t ordinal : 24, addend : 8, // 0 thru 255 reserved : 19, // all zeros next : 12, // 4-byte stride bind : 1; // == 1 }; // DYLD_CHAINED_PTR_64_KERNEL_CACHE, DYLD_CHAINED_PTR_X86_64_KERNEL_CACHE struct dyld_chained_ptr_64_kernel_cache_rebase { uint64_t target : 30, // basePointers[cacheLevel] + target cacheLevel : 2, // what level of cache to bind to (indexes a mach_header array) diversity : 16, addrDiv : 1, key : 2, next : 12, // 1 or 4-byte stide isAuth : 1; // 0 -> not authenticated. 1 -> authenticated }; // DYLD_CHAINED_PTR_32 // Note: for DYLD_CHAINED_PTR_32 some non-pointer values are co-opted into the chain // as out of range rebases. If an entry in the chain is > max_valid_pointer, then it // is not a pointer. To restore the value, subtract off the bias, which is // (64MB+max_valid_pointer)/2. struct dyld_chained_ptr_32_rebase { uint32_t target : 26, // vmaddr, 64MB max image size next : 5, // 4-byte stride bind : 1; // == 0 }; // DYLD_CHAINED_PTR_32 struct dyld_chained_ptr_32_bind { uint32_t ordinal : 20, addend : 6, // 0 thru 63 next : 5, // 4-byte stride bind : 1; // == 1 }; // DYLD_CHAINED_PTR_32_CACHE struct dyld_chained_ptr_32_cache_rebase { uint32_t target : 30, // 1GB max dyld cache TEXT and DATA next : 2; // 4-byte stride }; // DYLD_CHAINED_PTR_32_FIRMWARE struct dyld_chained_ptr_32_firmware_rebase { uint32_t target : 26, // 64MB max firmware TEXT and DATA next : 6; // 4-byte stride }; // values for dyld_chained_fixups_header.imports_format enum { DYLD_CHAINED_IMPORT = 1, DYLD_CHAINED_IMPORT_ADDEND = 2, DYLD_CHAINED_IMPORT_ADDEND64 = 3, }; // DYLD_CHAINED_IMPORT struct dyld_chained_import { uint32_t lib_ordinal : 8, weak_import : 1, name_offset : 23; }; // DYLD_CHAINED_IMPORT_ADDEND struct dyld_chained_import_addend { uint32_t lib_ordinal : 8, weak_import : 1, name_offset : 23; int32_t addend; }; // DYLD_CHAINED_IMPORT_ADDEND64 struct dyld_chained_import_addend64 { uint64_t lib_ordinal : 16, weak_import : 1, reserved : 15, name_offset : 32; uint64_t addend; }; #endif // __MACH_O_FIXUP_CHAINS__ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/mach-o/getsect.h ================================================ /* * Copyright (c) 2004 Apple Computer, 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_GETSECT_H_ #define _MACH_O_GETSECT_H_ #include #include #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /* * Runtime interfaces for Mach-O programs. For both 32-bit and 64-bit programs, * where the sizes returned will be 32-bit or 64-bit based on the size of * 'unsigned long'. */ extern char *getsectdata( const char *segname, const char *sectname, unsigned long *size); extern char *getsectdatafromFramework( const char *FrameworkName, const char *segname, const char *sectname, unsigned long *size); extern unsigned long get_end(void); extern unsigned long get_etext(void); extern unsigned long get_edata(void); #ifndef __LP64__ /* * Runtime interfaces for 32-bit Mach-O programs. */ extern const struct section *getsectbyname( const char *segname, const char *sectname); extern uint8_t *getsectiondata( const struct mach_header *mhp, const char *segname, const char *sectname, unsigned long *size); extern const struct segment_command *getsegbyname( const char *segname); extern uint8_t *getsegmentdata( const struct mach_header *mhp, const char *segname, unsigned long *size); #else /* defined(__LP64__) */ /* * Runtime interfaces for 64-bit Mach-O programs. */ extern const struct section_64 *getsectbyname( const char *segname, const char *sectname); extern uint8_t *getsectiondata( const struct mach_header_64 *mhp, const char *segname, const char *sectname, unsigned long *size); extern const struct segment_command_64 *getsegbyname( const char *segname); extern uint8_t *getsegmentdata( const struct mach_header_64 *mhp, const char *segname, unsigned long *size); #endif /* defined(__LP64__) */ /* * Interfaces for tools working with 32-bit Mach-O files. */ extern char *getsectdatafromheader( const struct mach_header *mhp, const char *segname, const char *sectname, uint32_t *size); extern const struct section *getsectbynamefromheader( const struct mach_header *mhp, const char *segname, const char *sectname); extern const struct section *getsectbynamefromheaderwithswap( struct mach_header *mhp, const char *segname, const char *sectname, int fSwap); /* * Interfaces for tools working with 64-bit Mach-O files. */ extern char *getsectdatafromheader_64( const struct mach_header_64 *mhp, const char *segname, const char *sectname, uint64_t *size); extern const struct section_64 *getsectbynamefromheader_64( const struct mach_header_64 *mhp, const char *segname, const char *sectname); extern const struct section *getsectbynamefromheaderwithswap_64( struct mach_header_64 *mhp, const char *segname, const char *sectname, int fSwap); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* _MACH_O_GETSECT_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/mach-o/i386/swap.h ================================================ /* * Copyright (c) 1999 Apple Computer, 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@ */ #include #include struct i386_float_state; extern void swap_i386_thread_state( i386_thread_state_t *cpu, enum NXByteOrder target_byte_order); /* current i386 thread states */ #if i386_THREAD_STATE == 1 extern void swap_i386_float_state( struct i386_float_state *fpu, enum NXByteOrder target_byte_order); extern void swap_i386_exception_state( i386_exception_state_t *exc, enum NXByteOrder target_byte_order); #endif /* i386_THREAD_STATE == 1 */ /* i386 thread states on older releases */ #if i386_THREAD_STATE == -1 extern void swap_i386_thread_fpstate( i386_thread_fpstate_t *fpu, enum NXByteOrder target_byte_order); extern void swap_i386_thread_exceptstate( i386_thread_exceptstate_t *exc, enum NXByteOrder target_byte_order); extern void swap_i386_thread_cthreadstate( i386_thread_cthreadstate_t *user, enum NXByteOrder target_byte_order); #endif /* i386_THREAD_STATE == -1 */ #ifdef x86_THREAD_STATE64 extern void swap_x86_thread_state64( x86_thread_state64_t *cpu, enum NXByteOrder target_byte_order); extern void swap_x86_state_hdr( x86_state_hdr_t *hdr, enum NXByteOrder target_byte_order); extern void swap_x86_float_state64( x86_float_state64_t *fpu, enum NXByteOrder target_byte_order); extern void swap_x86_exception_state64( x86_exception_state64_t *exc, enum NXByteOrder target_byte_order); extern void swap_x86_thread_state( x86_thread_state_t *cpu, enum NXByteOrder target_byte_order); extern void swap_x86_float_state( x86_float_state_t *fpu, enum NXByteOrder target_byte_order); extern void swap_x86_exception_state( x86_exception_state_t *exc, enum NXByteOrder target_byte_order); extern void swap_x86_debug_state32( x86_debug_state32_t *debug, enum NXByteOrder target_byte_order); extern void swap_x86_debug_state64( x86_debug_state64_t *debug, enum NXByteOrder target_byte_order); extern void swap_x86_debug_state( x86_debug_state_t *debug, enum NXByteOrder target_byte_order); #endif /* x86_THREAD_STATE64 */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/mach-o/ldsyms.h ================================================ /* * Copyright (c) 1999 Apple Computer, 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 _MACHO_LDSYMS_H_ #define _MACHO_LDSYMS_H_ #include /* * This file describes the link editor defined symbols. The semantics of a * link editor symbol is that it is defined by the link editor only if it is * referenced and it is an error for the user to define them (see the man page * ld(1)). The standard UNIX link editor symbols: __end, __etext and __edata * are not not supported by the Apple Mach-O link editor. These symbols are * really not meaningful in a Mach-O object file and the link editor symbols * that are supported (described here) replace them. In the case of the * standard UNIX link editor symbols the program can use the symbol * __mh_execute_header and walk the load commands of it's program to determine * the ending (or beginning) of any section or segment in the program. Note * that the compiler prepends an underbar to all external symbol names coded * in a high level language. Thus in 'C' names are coded without an underbar * and symbol names in the symbol table have an underbar. There are two cpp * macros for each link editor defined name in this file. The macro with a * leading underbar is the symbol name and the one without is the name as * coded in 'C'. */ /* * The value of the link editor defined symbol _MH_EXECUTE_SYM is the address * of the mach header in a Mach-O executable file type. It does not appear in * any file type other than a MH_EXECUTE file type. The type of the symbol is * absolute as the header is not part of any section. */ #define _MH_EXECUTE_SYM "__mh_execute_header" #define MH_EXECUTE_SYM "_mh_execute_header" extern const struct #ifdef __LP64__ mach_header_64 #else mach_header #endif _mh_execute_header; /* * The value of the link editor defined symbol _MH_BUNDLE_SYM is the address * of the mach header in a Mach-O bundle file type. It does not appear in * any file type other than a MH_BUNDLE file type. The type of the symbol is * an N_SECT symbol even thought the header is not part of any section. This * symbol is private to the code in the bundle it is a part of. */ #define _MH_BUNDLE_SYM "__mh_bundle_header" #define MH_BUNDLE_SYM "_mh_bundle_header" extern const struct #ifdef __LP64__ mach_header_64 #else mach_header #endif _mh_bundle_header; /* * The value of the link editor defined symbol _MH_DYLIB_SYM is the address * of the mach header in a Mach-O dylib file type. It does not appear in * any file type other than a MH_DYLIB file type. The type of the symbol is * an N_SECT symbol even thought the header is not part of any section. This * symbol is private to the code in the library it is a part of. */ #define _MH_DYLIB_SYM "__mh_dylib_header" #define MH_DYLIB_SYM "_mh_dylib_header" extern const struct #ifdef __LP64__ mach_header_64 #else mach_header #endif _mh_dylib_header; /* * The value of the link editor defined symbol _MH_DYLINKER_SYM is the address * of the mach header in a Mach-O dylinker file type. It does not appear in * any file type other than a MH_DYLINKER file type. The type of the symbol is * an N_SECT symbol even thought the header is not part of any section. This * symbol is private to the code in the dynamic linker it is a part of. */ #define _MH_DYLINKER_SYM "__mh_dylinker_header" #define MH_DYLINKER_SYM "_mh_dylinker_header" extern const struct #ifdef __LP64__ mach_header_64 #else mach_header #endif _mh_dylinker_header; /* * For the MH_PRELOAD file type the headers are not loaded as part of any * segment so the link editor defines symbols defined for the beginning * and ending of each segment and each section in each segment. The names for * the symbols for a segment's beginning and end will have the form: * __SEGNAME__begin and __SEGNAME__end where __SEGNAME is the name of the * segment. The names for the symbols for a section's beginning and end will * have the form: __SEGNAME__sectname__begin and __SEGNAME__sectname__end * where __sectname is the name of the section and __SEGNAME is the segment it * is in. * * The above symbols' types are those of the section they are referring to. * This is true even for symbols who's values are end's of a section and * that value is next address after that section and not really in that * section. This results in these symbols having types referring to sections * who's values are not in that section. */ #endif /* _MACHO_LDSYMS_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/mach-o/loader.h ================================================ /* * Copyright (c) 1999-2010 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 _MACHO_LOADER_H_ #define _MACHO_LOADER_H_ /* * This file describes the format of mach object files. */ #include /* * is needed here for the cpu_type_t and cpu_subtype_t types * and contains the constants for the possible values of these types. */ #include /* * is needed here for the vm_prot_t type and contains the * constants that are or'ed together for the possible values of this type. */ #include /* * is expected to define the flavors of the thread * states and the structures of those flavors for each machine. */ #include #include /* * The 32-bit mach header appears at the very beginning of the object file for * 32-bit architectures. */ struct mach_header { uint32_t magic; /* mach magic number identifier */ cpu_type_t cputype; /* cpu specifier */ cpu_subtype_t cpusubtype; /* machine specifier */ uint32_t filetype; /* type of file */ uint32_t ncmds; /* number of load commands */ uint32_t sizeofcmds; /* the size of all the load commands */ uint32_t flags; /* flags */ }; /* Constant for the magic field of the mach_header (32-bit architectures) */ #define MH_MAGIC 0xfeedface /* the mach magic number */ #define MH_CIGAM 0xcefaedfe /* NXSwapInt(MH_MAGIC) */ /* * The 64-bit mach header appears at the very beginning of object files for * 64-bit architectures. */ struct mach_header_64 { uint32_t magic; /* mach magic number identifier */ cpu_type_t cputype; /* cpu specifier */ cpu_subtype_t cpusubtype; /* machine specifier */ uint32_t filetype; /* type of file */ uint32_t ncmds; /* number of load commands */ uint32_t sizeofcmds; /* the size of all the load commands */ uint32_t flags; /* flags */ uint32_t reserved; /* reserved */ }; /* Constant for the magic field of the mach_header_64 (64-bit architectures) */ #define MH_MAGIC_64 0xfeedfacf /* the 64-bit mach magic number */ #define MH_CIGAM_64 0xcffaedfe /* NXSwapInt(MH_MAGIC_64) */ /* * The layout of the file depends on the filetype. For all but the MH_OBJECT * file type the segments are padded out and aligned on a segment alignment * boundary for efficient demand pageing. The MH_EXECUTE, MH_FVMLIB, MH_DYLIB, * MH_DYLINKER and MH_BUNDLE file types also have the headers included as part * of their first segment. * * The file type MH_OBJECT is a compact format intended as output of the * assembler and input (and possibly output) of the link editor (the .o * format). All sections are in one unnamed segment with no segment padding. * This format is used as an executable format when the file is so small the * segment padding greatly increases its size. * * The file type MH_PRELOAD is an executable format intended for things that * are not executed under the kernel (proms, stand alones, kernels, etc). The * format can be executed under the kernel but may demand paged it and not * preload it before execution. * * A core file is in MH_CORE format and can be any in an arbritray legal * Mach-O file. * * Constants for the filetype field of the mach_header */ #define MH_OBJECT 0x1 /* relocatable object file */ #define MH_EXECUTE 0x2 /* demand paged executable file */ #define MH_FVMLIB 0x3 /* fixed VM shared library file */ #define MH_CORE 0x4 /* core file */ #define MH_PRELOAD 0x5 /* preloaded executable file */ #define MH_DYLIB 0x6 /* dynamically bound shared library */ #define MH_DYLINKER 0x7 /* dynamic link editor */ #define MH_BUNDLE 0x8 /* dynamically bound bundle file */ #define MH_DYLIB_STUB 0x9 /* shared library stub for static linking only, no section contents */ #define MH_DSYM 0xa /* companion file with only debug sections */ #define MH_KEXT_BUNDLE 0xb /* x86_64 kexts */ #define MH_FILESET 0xc /* a file composed of other Mach-Os to be run in the same userspace sharing a single linkedit. */ /* Constants for the flags field of the mach_header */ #define MH_NOUNDEFS 0x1 /* the object file has no undefined references */ #define MH_INCRLINK 0x2 /* the object file is the output of an incremental link against a base file and can't be link edited again */ #define MH_DYLDLINK 0x4 /* the object file is input for the dynamic linker and can't be staticly link edited again */ #define MH_BINDATLOAD 0x8 /* the object file's undefined references are bound by the dynamic linker when loaded. */ #define MH_PREBOUND 0x10 /* the file has its dynamic undefined references prebound. */ #define MH_SPLIT_SEGS 0x20 /* the file has its read-only and read-write segments split */ #define MH_LAZY_INIT 0x40 /* the shared library init routine is to be run lazily via catching memory faults to its writeable segments (obsolete) */ #define MH_TWOLEVEL 0x80 /* the image is using two-level name space bindings */ #define MH_FORCE_FLAT 0x100 /* the executable is forcing all images to use flat name space bindings */ #define MH_NOMULTIDEFS 0x200 /* this umbrella guarantees no multiple defintions of symbols in its sub-images so the two-level namespace hints can always be used. */ #define MH_NOFIXPREBINDING 0x400 /* do not have dyld notify the prebinding agent about this executable */ #define MH_PREBINDABLE 0x800 /* the binary is not prebound but can have its prebinding redone. only used when MH_PREBOUND is not set. */ #define MH_ALLMODSBOUND 0x1000 /* indicates that this binary binds to all two-level namespace modules of its dependent libraries. only used when MH_PREBINDABLE and MH_TWOLEVEL are both set. */ #define MH_SUBSECTIONS_VIA_SYMBOLS 0x2000/* safe to divide up the sections into sub-sections via symbols for dead code stripping */ #define MH_CANONICAL 0x4000 /* the binary has been canonicalized via the unprebind operation */ #define MH_WEAK_DEFINES 0x8000 /* the final linked image contains external weak symbols */ #define MH_BINDS_TO_WEAK 0x10000 /* the final linked image uses weak symbols */ #define MH_ALLOW_STACK_EXECUTION 0x20000/* When this bit is set, all stacks in the task will be given stack execution privilege. Only used in MH_EXECUTE filetypes. */ #define MH_ROOT_SAFE 0x40000 /* When this bit is set, the binary declares it is safe for use in processes with uid zero */ #define MH_SETUID_SAFE 0x80000 /* When this bit is set, the binary declares it is safe for use in processes when issetugid() is true */ #define MH_NO_REEXPORTED_DYLIBS 0x100000 /* When this bit is set on a dylib, the static linker does not need to examine dependent dylibs to see if any are re-exported */ #define MH_PIE 0x200000 /* When this bit is set, the OS will load the main executable at a random address. Only used in MH_EXECUTE filetypes. */ #define MH_DEAD_STRIPPABLE_DYLIB 0x400000 /* Only for use on dylibs. When linking against a dylib that has this bit set, the static linker will automatically not create a LC_LOAD_DYLIB load command to the dylib if no symbols are being referenced from the dylib. */ #define MH_HAS_TLV_DESCRIPTORS 0x800000 /* Contains a section of type S_THREAD_LOCAL_VARIABLES */ #define MH_NO_HEAP_EXECUTION 0x1000000 /* When this bit is set, the OS will run the main executable with a non-executable heap even on platforms (e.g. i386) that don't require it. Only used in MH_EXECUTE filetypes. */ #define MH_APP_EXTENSION_SAFE 0x02000000 /* The code was linked for use in an application extension. */ #define MH_NLIST_OUTOFSYNC_WITH_DYLDINFO 0x04000000 /* The external symbols listed in the nlist symbol table do not include all the symbols listed in the dyld info. */ #define MH_SIM_SUPPORT 0x08000000 /* Allow LC_MIN_VERSION_MACOS and LC_BUILD_VERSION load commands with the platforms macOS, macCatalyst, iOSSimulator, tvOSSimulator and watchOSSimulator. */ #define MH_DYLIB_IN_CACHE 0x80000000 /* Only for use on dylibs. When this bit is set, the dylib is part of the dyld shared cache, rather than loose in the filesystem. */ /* * The load commands directly follow the mach_header. The total size of all * of the commands is given by the sizeofcmds field in the mach_header. All * load commands must have as their first two fields cmd and cmdsize. The cmd * field is filled in with a constant for that command type. Each command type * has a structure specifically for it. The cmdsize field is the size in bytes * of the particular load command structure plus anything that follows it that * is a part of the load command (i.e. section structures, strings, etc.). To * advance to the next load command the cmdsize can be added to the offset or * pointer of the current load command. The cmdsize for 32-bit architectures * MUST be a multiple of 4 bytes and for 64-bit architectures MUST be a multiple * of 8 bytes (these are forever the maximum alignment of any load commands). * The padded bytes must be zero. All tables in the object file must also * follow these rules so the file can be memory mapped. Otherwise the pointers * to these tables will not work well or at all on some machines. With all * padding zeroed like objects will compare byte for byte. */ struct load_command { uint32_t cmd; /* type of load command */ uint32_t cmdsize; /* total size of command in bytes */ }; /* * After MacOS X 10.1 when a new load command is added that is required to be * understood by the dynamic linker for the image to execute properly the * LC_REQ_DYLD bit will be or'ed into the load command constant. If the dynamic * linker sees such a load command it it does not understand will issue a * "unknown load command required for execution" error and refuse to use the * image. Other load commands without this bit that are not understood will * simply be ignored. */ #define LC_REQ_DYLD 0x80000000 /* Constants for the cmd field of all load commands, the type */ #define LC_SEGMENT 0x1 /* segment of this file to be mapped */ #define LC_SYMTAB 0x2 /* link-edit stab symbol table info */ #define LC_SYMSEG 0x3 /* link-edit gdb symbol table info (obsolete) */ #define LC_THREAD 0x4 /* thread */ #define LC_UNIXTHREAD 0x5 /* unix thread (includes a stack) */ #define LC_LOADFVMLIB 0x6 /* load a specified fixed VM shared library */ #define LC_IDFVMLIB 0x7 /* fixed VM shared library identification */ #define LC_IDENT 0x8 /* object identification info (obsolete) */ #define LC_FVMFILE 0x9 /* fixed VM file inclusion (internal use) */ #define LC_PREPAGE 0xa /* prepage command (internal use) */ #define LC_DYSYMTAB 0xb /* dynamic link-edit symbol table info */ #define LC_LOAD_DYLIB 0xc /* load a dynamically linked shared library */ #define LC_ID_DYLIB 0xd /* dynamically linked shared lib ident */ #define LC_LOAD_DYLINKER 0xe /* load a dynamic linker */ #define LC_ID_DYLINKER 0xf /* dynamic linker identification */ #define LC_PREBOUND_DYLIB 0x10 /* modules prebound for a dynamically */ /* linked shared library */ #define LC_ROUTINES 0x11 /* image routines */ #define LC_SUB_FRAMEWORK 0x12 /* sub framework */ #define LC_SUB_UMBRELLA 0x13 /* sub umbrella */ #define LC_SUB_CLIENT 0x14 /* sub client */ #define LC_SUB_LIBRARY 0x15 /* sub library */ #define LC_TWOLEVEL_HINTS 0x16 /* two-level namespace lookup hints */ #define LC_PREBIND_CKSUM 0x17 /* prebind checksum */ /* * load a dynamically linked shared library that is allowed to be missing * (all symbols are weak imported). */ #define LC_LOAD_WEAK_DYLIB (0x18 | LC_REQ_DYLD) #define LC_SEGMENT_64 0x19 /* 64-bit segment of this file to be mapped */ #define LC_ROUTINES_64 0x1a /* 64-bit image routines */ #define LC_UUID 0x1b /* the uuid */ #define LC_RPATH (0x1c | LC_REQ_DYLD) /* runpath additions */ #define LC_CODE_SIGNATURE 0x1d /* local of code signature */ #define LC_SEGMENT_SPLIT_INFO 0x1e /* local of info to split segments */ #define LC_REEXPORT_DYLIB (0x1f | LC_REQ_DYLD) /* load and re-export dylib */ #define LC_LAZY_LOAD_DYLIB 0x20 /* delay load of dylib until first use */ #define LC_ENCRYPTION_INFO 0x21 /* encrypted segment information */ #define LC_DYLD_INFO 0x22 /* compressed dyld information */ #define LC_DYLD_INFO_ONLY (0x22|LC_REQ_DYLD) /* compressed dyld information only */ #define LC_LOAD_UPWARD_DYLIB (0x23 | LC_REQ_DYLD) /* load upward dylib */ #define LC_VERSION_MIN_MACOSX 0x24 /* build for MacOSX min OS version */ #define LC_VERSION_MIN_IPHONEOS 0x25 /* build for iPhoneOS min OS version */ #define LC_FUNCTION_STARTS 0x26 /* compressed table of function start addresses */ #define LC_DYLD_ENVIRONMENT 0x27 /* string for dyld to treat like environment variable */ #define LC_MAIN (0x28|LC_REQ_DYLD) /* replacement for LC_UNIXTHREAD */ #define LC_DATA_IN_CODE 0x29 /* table of non-instructions in __text */ #define LC_SOURCE_VERSION 0x2A /* source version used to build binary */ #define LC_DYLIB_CODE_SIGN_DRS 0x2B /* Code signing DRs copied from linked dylibs */ #define LC_ENCRYPTION_INFO_64 0x2C /* 64-bit encrypted segment information */ #define LC_LINKER_OPTION 0x2D /* linker options in MH_OBJECT files */ #define LC_LINKER_OPTIMIZATION_HINT 0x2E /* optimization hints in MH_OBJECT files */ #define LC_VERSION_MIN_TVOS 0x2F /* build for AppleTV min OS version */ #define LC_VERSION_MIN_WATCHOS 0x30 /* build for Watch min OS version */ #define LC_NOTE 0x31 /* arbitrary data included within a Mach-O file */ #define LC_BUILD_VERSION 0x32 /* build for platform min OS version */ #define LC_DYLD_EXPORTS_TRIE (0x33 | LC_REQ_DYLD) /* used with linkedit_data_command, payload is trie */ #define LC_DYLD_CHAINED_FIXUPS (0x34 | LC_REQ_DYLD) /* used with linkedit_data_command */ #define LC_FILESET_ENTRY (0x35 | LC_REQ_DYLD) /* used with fileset_entry_command */ /* * A variable length string in a load command is represented by an lc_str * union. The strings are stored just after the load command structure and * the offset is from the start of the load command structure. The size * of the string is reflected in the cmdsize field of the load command. * Once again any padded bytes to bring the cmdsize field to a multiple * of 4 bytes must be zero. */ union lc_str { uint32_t offset; /* offset to the string */ #ifndef __LP64__ char *ptr; /* pointer to the string */ #endif }; /* * The segment load command indicates that a part of this file is to be * mapped into the task's address space. The size of this segment in memory, * vmsize, maybe equal to or larger than the amount to map from this file, * filesize. The file is mapped starting at fileoff to the beginning of * the segment in memory, vmaddr. The rest of the memory of the segment, * if any, is allocated zero fill on demand. The segment's maximum virtual * memory protection and initial virtual memory protection are specified * by the maxprot and initprot fields. If the segment has sections then the * section structures directly follow the segment command and their size is * reflected in cmdsize. */ struct segment_command { /* for 32-bit architectures */ uint32_t cmd; /* LC_SEGMENT */ uint32_t cmdsize; /* includes sizeof section structs */ char segname[16]; /* segment name */ uint32_t vmaddr; /* memory address of this segment */ uint32_t vmsize; /* memory size of this segment */ uint32_t fileoff; /* file offset of this segment */ uint32_t filesize; /* amount to map from the file */ vm_prot_t maxprot; /* maximum VM protection */ vm_prot_t initprot; /* initial VM protection */ uint32_t nsects; /* number of sections in segment */ uint32_t flags; /* flags */ }; /* * The 64-bit segment load command indicates that a part of this file is to be * mapped into a 64-bit task's address space. If the 64-bit segment has * sections then section_64 structures directly follow the 64-bit segment * command and their size is reflected in cmdsize. */ struct segment_command_64 { /* for 64-bit architectures */ uint32_t cmd; /* LC_SEGMENT_64 */ uint32_t cmdsize; /* includes sizeof section_64 structs */ char segname[16]; /* segment name */ uint64_t vmaddr; /* memory address of this segment */ uint64_t vmsize; /* memory size of this segment */ uint64_t fileoff; /* file offset of this segment */ uint64_t filesize; /* amount to map from the file */ vm_prot_t maxprot; /* maximum VM protection */ vm_prot_t initprot; /* initial VM protection */ uint32_t nsects; /* number of sections in segment */ uint32_t flags; /* flags */ }; /* Constants for the flags field of the segment_command */ #define SG_HIGHVM 0x1 /* the file contents for this segment is for the high part of the VM space, the low part is zero filled (for stacks in core files) */ #define SG_FVMLIB 0x2 /* this segment is the VM that is allocated by a fixed VM library, for overlap checking in the link editor */ #define SG_NORELOC 0x4 /* this segment has nothing that was relocated in it and nothing relocated to it, that is it maybe safely replaced without relocation*/ #define SG_PROTECTED_VERSION_1 0x8 /* This segment is protected. If the segment starts at file offset 0, the first page of the segment is not protected. All other pages of the segment are protected. */ #define SG_READ_ONLY 0x10 /* This segment is made read-only after fixups */ /* * A segment is made up of zero or more sections. Non-MH_OBJECT files have * all of their segments with the proper sections in each, and padded to the * specified segment alignment when produced by the link editor. The first * segment of a MH_EXECUTE and MH_FVMLIB format file contains the mach_header * and load commands of the object file before its first section. The zero * fill sections are always last in their segment (in all formats). This * allows the zeroed segment padding to be mapped into memory where zero fill * sections might be. The gigabyte zero fill sections, those with the section * type S_GB_ZEROFILL, can only be in a segment with sections of this type. * These segments are then placed after all other segments. * * The MH_OBJECT format has all of its sections in one segment for * compactness. There is no padding to a specified segment boundary and the * mach_header and load commands are not part of the segment. * * Sections with the same section name, sectname, going into the same segment, * segname, are combined by the link editor. The resulting section is aligned * to the maximum alignment of the combined sections and is the new section's * alignment. The combined sections are aligned to their original alignment in * the combined section. Any padded bytes to get the specified alignment are * zeroed. * * The format of the relocation entries referenced by the reloff and nreloc * fields of the section structure for mach object files is described in the * header file . */ struct section { /* for 32-bit architectures */ char sectname[16]; /* name of this section */ char segname[16]; /* segment this section goes in */ uint32_t addr; /* memory address of this section */ uint32_t size; /* size in bytes of this section */ uint32_t offset; /* file offset of this section */ uint32_t align; /* section alignment (power of 2) */ uint32_t reloff; /* file offset of relocation entries */ uint32_t nreloc; /* number of relocation entries */ uint32_t flags; /* flags (section type and attributes)*/ uint32_t reserved1; /* reserved (for offset or index) */ uint32_t reserved2; /* reserved (for count or sizeof) */ }; struct section_64 { /* for 64-bit architectures */ char sectname[16]; /* name of this section */ char segname[16]; /* segment this section goes in */ uint64_t addr; /* memory address of this section */ uint64_t size; /* size in bytes of this section */ uint32_t offset; /* file offset of this section */ uint32_t align; /* section alignment (power of 2) */ uint32_t reloff; /* file offset of relocation entries */ uint32_t nreloc; /* number of relocation entries */ uint32_t flags; /* flags (section type and attributes)*/ uint32_t reserved1; /* reserved (for offset or index) */ uint32_t reserved2; /* reserved (for count or sizeof) */ uint32_t reserved3; /* reserved */ }; /* * The flags field of a section structure is separated into two parts a section * type and section attributes. The section types are mutually exclusive (it * can only have one type) but the section attributes are not (it may have more * than one attribute). */ #define SECTION_TYPE 0x000000ff /* 256 section types */ #define SECTION_ATTRIBUTES 0xffffff00 /* 24 section attributes */ /* Constants for the type of a section */ #define S_REGULAR 0x0 /* regular section */ #define S_ZEROFILL 0x1 /* zero fill on demand section */ #define S_CSTRING_LITERALS 0x2 /* section with only literal C strings*/ #define S_4BYTE_LITERALS 0x3 /* section with only 4 byte literals */ #define S_8BYTE_LITERALS 0x4 /* section with only 8 byte literals */ #define S_LITERAL_POINTERS 0x5 /* section with only pointers to */ /* literals */ /* * For the two types of symbol pointers sections and the symbol stubs section * they have indirect symbol table entries. For each of the entries in the * section the indirect symbol table entries, in corresponding order in the * indirect symbol table, start at the index stored in the reserved1 field * of the section structure. Since the indirect symbol table entries * correspond to the entries in the section the number of indirect symbol table * entries is inferred from the size of the section divided by the size of the * entries in the section. For symbol pointers sections the size of the entries * in the section is 4 bytes and for symbol stubs sections the byte size of the * stubs is stored in the reserved2 field of the section structure. */ #define S_NON_LAZY_SYMBOL_POINTERS 0x6 /* section with only non-lazy symbol pointers */ #define S_LAZY_SYMBOL_POINTERS 0x7 /* section with only lazy symbol pointers */ #define S_SYMBOL_STUBS 0x8 /* section with only symbol stubs, byte size of stub in the reserved2 field */ #define S_MOD_INIT_FUNC_POINTERS 0x9 /* section with only function pointers for initialization*/ #define S_MOD_TERM_FUNC_POINTERS 0xa /* section with only function pointers for termination */ #define S_COALESCED 0xb /* section contains symbols that are to be coalesced */ #define S_GB_ZEROFILL 0xc /* zero fill on demand section (that can be larger than 4 gigabytes) */ #define S_INTERPOSING 0xd /* section with only pairs of function pointers for interposing */ #define S_16BYTE_LITERALS 0xe /* section with only 16 byte literals */ #define S_DTRACE_DOF 0xf /* section contains DTrace Object Format */ #define S_LAZY_DYLIB_SYMBOL_POINTERS 0x10 /* section with only lazy symbol pointers to lazy loaded dylibs */ /* * Section types to support thread local variables */ #define S_THREAD_LOCAL_REGULAR 0x11 /* template of initial values for TLVs */ #define S_THREAD_LOCAL_ZEROFILL 0x12 /* template of initial values for TLVs */ #define S_THREAD_LOCAL_VARIABLES 0x13 /* TLV descriptors */ #define S_THREAD_LOCAL_VARIABLE_POINTERS 0x14 /* pointers to TLV descriptors */ #define S_THREAD_LOCAL_INIT_FUNCTION_POINTERS 0x15 /* functions to call to initialize TLV values */ #define S_INIT_FUNC_OFFSETS 0x16 /* 32-bit offsets to initializers */ /* * Constants for the section attributes part of the flags field of a section * structure. */ #define SECTION_ATTRIBUTES_USR 0xff000000 /* User setable attributes */ #define S_ATTR_PURE_INSTRUCTIONS 0x80000000 /* section contains only true machine instructions */ #define S_ATTR_NO_TOC 0x40000000 /* section contains coalesced symbols that are not to be in a ranlib table of contents */ #define S_ATTR_STRIP_STATIC_SYMS 0x20000000 /* ok to strip static symbols in this section in files with the MH_DYLDLINK flag */ #define S_ATTR_NO_DEAD_STRIP 0x10000000 /* no dead stripping */ #define S_ATTR_LIVE_SUPPORT 0x08000000 /* blocks are live if they reference live blocks */ #define S_ATTR_SELF_MODIFYING_CODE 0x04000000 /* Used with i386 code stubs written on by dyld */ /* * If a segment contains any sections marked with S_ATTR_DEBUG then all * sections in that segment must have this attribute. No section other than * a section marked with this attribute may reference the contents of this * section. A section with this attribute may contain no symbols and must have * a section type S_REGULAR. The static linker will not copy section contents * from sections with this attribute into its output file. These sections * generally contain DWARF debugging info. */ #define S_ATTR_DEBUG 0x02000000 /* a debug section */ #define SECTION_ATTRIBUTES_SYS 0x00ffff00 /* system setable attributes */ #define S_ATTR_SOME_INSTRUCTIONS 0x00000400 /* section contains some machine instructions */ #define S_ATTR_EXT_RELOC 0x00000200 /* section has external relocation entries */ #define S_ATTR_LOC_RELOC 0x00000100 /* section has local relocation entries */ /* * The names of segments and sections in them are mostly meaningless to the * link-editor. But there are few things to support traditional UNIX * executables that require the link-editor and assembler to use some names * agreed upon by convention. * * The initial protection of the "__TEXT" segment has write protection turned * off (not writeable). * * The link-editor will allocate common symbols at the end of the "__common" * section in the "__DATA" segment. It will create the section and segment * if needed. */ /* The currently known segment names and the section names in those segments */ #define SEG_PAGEZERO "__PAGEZERO" /* the pagezero segment which has no */ /* protections and catches NULL */ /* references for MH_EXECUTE files */ #define SEG_TEXT "__TEXT" /* the tradition UNIX text segment */ #define SECT_TEXT "__text" /* the real text part of the text */ /* section no headers, and no padding */ #define SECT_FVMLIB_INIT0 "__fvmlib_init0" /* the fvmlib initialization */ /* section */ #define SECT_FVMLIB_INIT1 "__fvmlib_init1" /* the section following the */ /* fvmlib initialization */ /* section */ #define SEG_DATA "__DATA" /* the tradition UNIX data segment */ #define SECT_DATA "__data" /* the real initialized data section */ /* no padding, no bss overlap */ #define SECT_BSS "__bss" /* the real uninitialized data section*/ /* no padding */ #define SECT_COMMON "__common" /* the section common symbols are */ /* allocated in by the link editor */ #define SEG_OBJC "__OBJC" /* objective-C runtime segment */ #define SECT_OBJC_SYMBOLS "__symbol_table" /* symbol table */ #define SECT_OBJC_MODULES "__module_info" /* module information */ #define SECT_OBJC_STRINGS "__selector_strs" /* string table */ #define SECT_OBJC_REFS "__selector_refs" /* string table */ #define SEG_ICON "__ICON" /* the icon segment */ #define SECT_ICON_HEADER "__header" /* the icon headers */ #define SECT_ICON_TIFF "__tiff" /* the icons in tiff format */ #define SEG_LINKEDIT "__LINKEDIT" /* the segment containing all structs */ /* created and maintained by the link */ /* editor. Created with -seglinkedit */ /* option to ld(1) for MH_EXECUTE and */ /* FVMLIB file types only */ #define SEG_UNIXSTACK "__UNIXSTACK" /* the unix stack segment */ #define SEG_IMPORT "__IMPORT" /* the segment for the self (dyld) */ /* modifing code stubs that has read, */ /* write and execute permissions */ /* * Fixed virtual memory shared libraries are identified by two things. The * target pathname (the name of the library as found for execution), and the * minor version number. The address of where the headers are loaded is in * header_addr. (THIS IS OBSOLETE and no longer supported). */ struct fvmlib { union lc_str name; /* library's target pathname */ uint32_t minor_version; /* library's minor version number */ uint32_t header_addr; /* library's header address */ }; /* * A fixed virtual shared library (filetype == MH_FVMLIB in the mach header) * contains a fvmlib_command (cmd == LC_IDFVMLIB) to identify the library. * An object that uses a fixed virtual shared library also contains a * fvmlib_command (cmd == LC_LOADFVMLIB) for each library it uses. * (THIS IS OBSOLETE and no longer supported). */ struct fvmlib_command { uint32_t cmd; /* LC_IDFVMLIB or LC_LOADFVMLIB */ uint32_t cmdsize; /* includes pathname string */ struct fvmlib fvmlib; /* the library identification */ }; /* * Dynamicly linked shared libraries are identified by two things. The * pathname (the name of the library as found for execution), and the * compatibility version number. The pathname must match and the compatibility * number in the user of the library must be greater than or equal to the * library being used. The time stamp is used to record the time a library was * built and copied into user so it can be use to determined if the library used * at runtime is exactly the same as used to built the program. */ struct dylib { union lc_str name; /* library's path name */ uint32_t timestamp; /* library's build time stamp */ uint32_t current_version; /* library's current version number */ uint32_t compatibility_version; /* library's compatibility vers number*/ }; /* * A dynamically linked shared library (filetype == MH_DYLIB in the mach header) * contains a dylib_command (cmd == LC_ID_DYLIB) to identify the library. * An object that uses a dynamically linked shared library also contains a * dylib_command (cmd == LC_LOAD_DYLIB, LC_LOAD_WEAK_DYLIB, or * LC_REEXPORT_DYLIB) for each library it uses. */ struct dylib_command { uint32_t cmd; /* LC_ID_DYLIB, LC_LOAD_{,WEAK_}DYLIB, LC_REEXPORT_DYLIB */ uint32_t cmdsize; /* includes pathname string */ struct dylib dylib; /* the library identification */ }; /* * A dynamically linked shared library may be a subframework of an umbrella * framework. If so it will be linked with "-umbrella umbrella_name" where * Where "umbrella_name" is the name of the umbrella framework. A subframework * can only be linked against by its umbrella framework or other subframeworks * that are part of the same umbrella framework. Otherwise the static link * editor produces an error and states to link against the umbrella framework. * The name of the umbrella framework for subframeworks is recorded in the * following structure. */ struct sub_framework_command { uint32_t cmd; /* LC_SUB_FRAMEWORK */ uint32_t cmdsize; /* includes umbrella string */ union lc_str umbrella; /* the umbrella framework name */ }; /* * For dynamically linked shared libraries that are subframework of an umbrella * framework they can allow clients other than the umbrella framework or other * subframeworks in the same umbrella framework. To do this the subframework * is built with "-allowable_client client_name" and an LC_SUB_CLIENT load * command is created for each -allowable_client flag. The client_name is * usually a framework name. It can also be a name used for bundles clients * where the bundle is built with "-client_name client_name". */ struct sub_client_command { uint32_t cmd; /* LC_SUB_CLIENT */ uint32_t cmdsize; /* includes client string */ union lc_str client; /* the client name */ }; /* * A dynamically linked shared library may be a sub_umbrella of an umbrella * framework. If so it will be linked with "-sub_umbrella umbrella_name" where * Where "umbrella_name" is the name of the sub_umbrella framework. When * staticly linking when -twolevel_namespace is in effect a twolevel namespace * umbrella framework will only cause its subframeworks and those frameworks * listed as sub_umbrella frameworks to be implicited linked in. Any other * dependent dynamic libraries will not be linked it when -twolevel_namespace * is in effect. The primary library recorded by the static linker when * resolving a symbol in these libraries will be the umbrella framework. * Zero or more sub_umbrella frameworks may be use by an umbrella framework. * The name of a sub_umbrella framework is recorded in the following structure. */ struct sub_umbrella_command { uint32_t cmd; /* LC_SUB_UMBRELLA */ uint32_t cmdsize; /* includes sub_umbrella string */ union lc_str sub_umbrella; /* the sub_umbrella framework name */ }; /* * A dynamically linked shared library may be a sub_library of another shared * library. If so it will be linked with "-sub_library library_name" where * Where "library_name" is the name of the sub_library shared library. When * staticly linking when -twolevel_namespace is in effect a twolevel namespace * shared library will only cause its subframeworks and those frameworks * listed as sub_umbrella frameworks and libraries listed as sub_libraries to * be implicited linked in. Any other dependent dynamic libraries will not be * linked it when -twolevel_namespace is in effect. The primary library * recorded by the static linker when resolving a symbol in these libraries * will be the umbrella framework (or dynamic library). Zero or more sub_library * shared libraries may be use by an umbrella framework or (or dynamic library). * The name of a sub_library framework is recorded in the following structure. * For example /usr/lib/libobjc_profile.A.dylib would be recorded as "libobjc". */ struct sub_library_command { uint32_t cmd; /* LC_SUB_LIBRARY */ uint32_t cmdsize; /* includes sub_library string */ union lc_str sub_library; /* the sub_library name */ }; /* * A program (filetype == MH_EXECUTE) that is * prebound to its dynamic libraries has one of these for each library that * the static linker used in prebinding. It contains a bit vector for the * modules in the library. The bits indicate which modules are bound (1) and * which are not (0) from the library. The bit for module 0 is the low bit * of the first byte. So the bit for the Nth module is: * (linked_modules[N/8] >> N%8) & 1 */ struct prebound_dylib_command { uint32_t cmd; /* LC_PREBOUND_DYLIB */ uint32_t cmdsize; /* includes strings */ union lc_str name; /* library's path name */ uint32_t nmodules; /* number of modules in library */ union lc_str linked_modules; /* bit vector of linked modules */ }; /* * A program that uses a dynamic linker contains a dylinker_command to identify * the name of the dynamic linker (LC_LOAD_DYLINKER). And a dynamic linker * contains a dylinker_command to identify the dynamic linker (LC_ID_DYLINKER). * A file can have at most one of these. * This struct is also used for the LC_DYLD_ENVIRONMENT load command and * contains string for dyld to treat like environment variable. */ struct dylinker_command { uint32_t cmd; /* LC_ID_DYLINKER, LC_LOAD_DYLINKER or LC_DYLD_ENVIRONMENT */ uint32_t cmdsize; /* includes pathname string */ union lc_str name; /* dynamic linker's path name */ }; /* * Thread commands contain machine-specific data structures suitable for * use in the thread state primitives. The machine specific data structures * follow the struct thread_command as follows. * Each flavor of machine specific data structure is preceded by an uint32_t * constant for the flavor of that data structure, an uint32_t that is the * count of uint32_t's of the size of the state data structure and then * the state data structure follows. This triple may be repeated for many * flavors. The constants for the flavors, counts and state data structure * definitions are expected to be in the header file . * These machine specific data structures sizes must be multiples of * 4 bytes. The cmdsize reflects the total size of the thread_command * and all of the sizes of the constants for the flavors, counts and state * data structures. * * For executable objects that are unix processes there will be one * thread_command (cmd == LC_UNIXTHREAD) created for it by the link-editor. * This is the same as a LC_THREAD, except that a stack is automatically * created (based on the shell's limit for the stack size). Command arguments * and environment variables are copied onto that stack. */ struct thread_command { uint32_t cmd; /* LC_THREAD or LC_UNIXTHREAD */ uint32_t cmdsize; /* total size of this command */ /* uint32_t flavor flavor of thread state */ /* uint32_t count count of uint32_t's in thread state */ /* struct XXX_thread_state state thread state for this flavor */ /* ... */ }; /* * The routines command contains the address of the dynamic shared library * initialization routine and an index into the module table for the module * that defines the routine. Before any modules are used from the library the * dynamic linker fully binds the module that defines the initialization routine * and then calls it. This gets called before any module initialization * routines (used for C++ static constructors) in the library. */ struct routines_command { /* for 32-bit architectures */ uint32_t cmd; /* LC_ROUTINES */ uint32_t cmdsize; /* total size of this command */ uint32_t init_address; /* address of initialization routine */ uint32_t init_module; /* index into the module table that */ /* the init routine is defined in */ uint32_t reserved1; uint32_t reserved2; uint32_t reserved3; uint32_t reserved4; uint32_t reserved5; uint32_t reserved6; }; /* * The 64-bit routines command. Same use as above. */ struct routines_command_64 { /* for 64-bit architectures */ uint32_t cmd; /* LC_ROUTINES_64 */ uint32_t cmdsize; /* total size of this command */ uint64_t init_address; /* address of initialization routine */ uint64_t init_module; /* index into the module table that */ /* the init routine is defined in */ uint64_t reserved1; uint64_t reserved2; uint64_t reserved3; uint64_t reserved4; uint64_t reserved5; uint64_t reserved6; }; /* * The symtab_command contains the offsets and sizes of the link-edit 4.3BSD * "stab" style symbol table information as described in the header files * and . */ struct symtab_command { uint32_t cmd; /* LC_SYMTAB */ uint32_t cmdsize; /* sizeof(struct symtab_command) */ uint32_t symoff; /* symbol table offset */ uint32_t nsyms; /* number of symbol table entries */ uint32_t stroff; /* string table offset */ uint32_t strsize; /* string table size in bytes */ }; /* * This is the second set of the symbolic information which is used to support * the data structures for the dynamically link editor. * * The original set of symbolic information in the symtab_command which contains * the symbol and string tables must also be present when this load command is * present. When this load command is present the symbol table is organized * into three groups of symbols: * local symbols (static and debugging symbols) - grouped by module * defined external symbols - grouped by module (sorted by name if not lib) * undefined external symbols (sorted by name if MH_BINDATLOAD is not set, * and in order the were seen by the static * linker if MH_BINDATLOAD is set) * In this load command there are offsets and counts to each of the three groups * of symbols. * * This load command contains a the offsets and sizes of the following new * symbolic information tables: * table of contents * module table * reference symbol table * indirect symbol table * The first three tables above (the table of contents, module table and * reference symbol table) are only present if the file is a dynamically linked * shared library. For executable and object modules, which are files * containing only one module, the information that would be in these three * tables is determined as follows: * table of contents - the defined external symbols are sorted by name * module table - the file contains only one module so everything in the * file is part of the module. * reference symbol table - is the defined and undefined external symbols * * For dynamically linked shared library files this load command also contains * offsets and sizes to the pool of relocation entries for all sections * separated into two groups: * external relocation entries * local relocation entries * For executable and object modules the relocation entries continue to hang * off the section structures. */ struct dysymtab_command { uint32_t cmd; /* LC_DYSYMTAB */ uint32_t cmdsize; /* sizeof(struct dysymtab_command) */ /* * The symbols indicated by symoff and nsyms of the LC_SYMTAB load command * are grouped into the following three groups: * local symbols (further grouped by the module they are from) * defined external symbols (further grouped by the module they are from) * undefined symbols * * The local symbols are used only for debugging. The dynamic binding * process may have to use them to indicate to the debugger the local * symbols for a module that is being bound. * * The last two groups are used by the dynamic binding process to do the * binding (indirectly through the module table and the reference symbol * table when this is a dynamically linked shared library file). */ uint32_t ilocalsym; /* index to local symbols */ uint32_t nlocalsym; /* number of local symbols */ uint32_t iextdefsym;/* index to externally defined symbols */ uint32_t nextdefsym;/* number of externally defined symbols */ uint32_t iundefsym; /* index to undefined symbols */ uint32_t nundefsym; /* number of undefined symbols */ /* * For the for the dynamic binding process to find which module a symbol * is defined in the table of contents is used (analogous to the ranlib * structure in an archive) which maps defined external symbols to modules * they are defined in. This exists only in a dynamically linked shared * library file. For executable and object modules the defined external * symbols are sorted by name and is use as the table of contents. */ uint32_t tocoff; /* file offset to table of contents */ uint32_t ntoc; /* number of entries in table of contents */ /* * To support dynamic binding of "modules" (whole object files) the symbol * table must reflect the modules that the file was created from. This is * done by having a module table that has indexes and counts into the merged * tables for each module. The module structure that these two entries * refer to is described below. This exists only in a dynamically linked * shared library file. For executable and object modules the file only * contains one module so everything in the file belongs to the module. */ uint32_t modtaboff; /* file offset to module table */ uint32_t nmodtab; /* number of module table entries */ /* * To support dynamic module binding the module structure for each module * indicates the external references (defined and undefined) each module * makes. For each module there is an offset and a count into the * reference symbol table for the symbols that the module references. * This exists only in a dynamically linked shared library file. For * executable and object modules the defined external symbols and the * undefined external symbols indicates the external references. */ uint32_t extrefsymoff; /* offset to referenced symbol table */ uint32_t nextrefsyms; /* number of referenced symbol table entries */ /* * The sections that contain "symbol pointers" and "routine stubs" have * indexes and (implied counts based on the size of the section and fixed * size of the entry) into the "indirect symbol" table for each pointer * and stub. For every section of these two types the index into the * indirect symbol table is stored in the section header in the field * reserved1. An indirect symbol table entry is simply a 32bit index into * the symbol table to the symbol that the pointer or stub is referring to. * The indirect symbol table is ordered to match the entries in the section. */ uint32_t indirectsymoff; /* file offset to the indirect symbol table */ uint32_t nindirectsyms; /* number of indirect symbol table entries */ /* * To support relocating an individual module in a library file quickly the * external relocation entries for each module in the library need to be * accessed efficiently. Since the relocation entries can't be accessed * through the section headers for a library file they are separated into * groups of local and external entries further grouped by module. In this * case the presents of this load command who's extreloff, nextrel, * locreloff and nlocrel fields are non-zero indicates that the relocation * entries of non-merged sections are not referenced through the section * structures (and the reloff and nreloc fields in the section headers are * set to zero). * * Since the relocation entries are not accessed through the section headers * this requires the r_address field to be something other than a section * offset to identify the item to be relocated. In this case r_address is * set to the offset from the vmaddr of the first LC_SEGMENT command. * For MH_SPLIT_SEGS images r_address is set to the the offset from the * vmaddr of the first read-write LC_SEGMENT command. * * The relocation entries are grouped by module and the module table * entries have indexes and counts into them for the group of external * relocation entries for that the module. * * For sections that are merged across modules there must not be any * remaining external relocation entries for them (for merged sections * remaining relocation entries must be local). */ uint32_t extreloff; /* offset to external relocation entries */ uint32_t nextrel; /* number of external relocation entries */ /* * All the local relocation entries are grouped together (they are not * grouped by their module since they are only used if the object is moved * from it staticly link edited address). */ uint32_t locreloff; /* offset to local relocation entries */ uint32_t nlocrel; /* number of local relocation entries */ }; /* * An indirect symbol table entry is simply a 32bit index into the symbol table * to the symbol that the pointer or stub is refering to. Unless it is for a * non-lazy symbol pointer section for a defined symbol which strip(1) as * removed. In which case it has the value INDIRECT_SYMBOL_LOCAL. If the * symbol was also absolute INDIRECT_SYMBOL_ABS is or'ed with that. */ #define INDIRECT_SYMBOL_LOCAL 0x80000000 #define INDIRECT_SYMBOL_ABS 0x40000000 /* a table of contents entry */ struct dylib_table_of_contents { uint32_t symbol_index; /* the defined external symbol (index into the symbol table) */ uint32_t module_index; /* index into the module table this symbol is defined in */ }; /* a module table entry */ struct dylib_module { uint32_t module_name; /* the module name (index into string table) */ uint32_t iextdefsym; /* index into externally defined symbols */ uint32_t nextdefsym; /* number of externally defined symbols */ uint32_t irefsym; /* index into reference symbol table */ uint32_t nrefsym; /* number of reference symbol table entries */ uint32_t ilocalsym; /* index into symbols for local symbols */ uint32_t nlocalsym; /* number of local symbols */ uint32_t iextrel; /* index into external relocation entries */ uint32_t nextrel; /* number of external relocation entries */ uint32_t iinit_iterm; /* low 16 bits are the index into the init section, high 16 bits are the index into the term section */ uint32_t ninit_nterm; /* low 16 bits are the number of init section entries, high 16 bits are the number of term section entries */ uint32_t /* for this module address of the start of */ objc_module_info_addr; /* the (__OBJC,__module_info) section */ uint32_t /* for this module size of */ objc_module_info_size; /* the (__OBJC,__module_info) section */ }; /* a 64-bit module table entry */ struct dylib_module_64 { uint32_t module_name; /* the module name (index into string table) */ uint32_t iextdefsym; /* index into externally defined symbols */ uint32_t nextdefsym; /* number of externally defined symbols */ uint32_t irefsym; /* index into reference symbol table */ uint32_t nrefsym; /* number of reference symbol table entries */ uint32_t ilocalsym; /* index into symbols for local symbols */ uint32_t nlocalsym; /* number of local symbols */ uint32_t iextrel; /* index into external relocation entries */ uint32_t nextrel; /* number of external relocation entries */ uint32_t iinit_iterm; /* low 16 bits are the index into the init section, high 16 bits are the index into the term section */ uint32_t ninit_nterm; /* low 16 bits are the number of init section entries, high 16 bits are the number of term section entries */ uint32_t /* for this module size of */ objc_module_info_size; /* the (__OBJC,__module_info) section */ uint64_t /* for this module address of the start of */ objc_module_info_addr; /* the (__OBJC,__module_info) section */ }; /* * The entries in the reference symbol table are used when loading the module * (both by the static and dynamic link editors) and if the module is unloaded * or replaced. Therefore all external symbols (defined and undefined) are * listed in the module's reference table. The flags describe the type of * reference that is being made. The constants for the flags are defined in * as they are also used for symbol table entries. */ struct dylib_reference { uint32_t isym:24, /* index into the symbol table */ flags:8; /* flags to indicate the type of reference */ }; /* * The twolevel_hints_command contains the offset and number of hints in the * two-level namespace lookup hints table. */ struct twolevel_hints_command { uint32_t cmd; /* LC_TWOLEVEL_HINTS */ uint32_t cmdsize; /* sizeof(struct twolevel_hints_command) */ uint32_t offset; /* offset to the hint table */ uint32_t nhints; /* number of hints in the hint table */ }; /* * The entries in the two-level namespace lookup hints table are twolevel_hint * structs. These provide hints to the dynamic link editor where to start * looking for an undefined symbol in a two-level namespace image. The * isub_image field is an index into the sub-images (sub-frameworks and * sub-umbrellas list) that made up the two-level image that the undefined * symbol was found in when it was built by the static link editor. If * isub-image is 0 the the symbol is expected to be defined in library and not * in the sub-images. If isub-image is non-zero it is an index into the array * of sub-images for the umbrella with the first index in the sub-images being * 1. The array of sub-images is the ordered list of sub-images of the umbrella * that would be searched for a symbol that has the umbrella recorded as its * primary library. The table of contents index is an index into the * library's table of contents. This is used as the starting point of the * binary search or a directed linear search. */ struct twolevel_hint { uint32_t isub_image:8, /* index into the sub images */ itoc:24; /* index into the table of contents */ }; /* * The prebind_cksum_command contains the value of the original check sum for * prebound files or zero. When a prebound file is first created or modified * for other than updating its prebinding information the value of the check sum * is set to zero. When the file has it prebinding re-done and if the value of * the check sum is zero the original check sum is calculated and stored in * cksum field of this load command in the output file. If when the prebinding * is re-done and the cksum field is non-zero it is left unchanged from the * input file. */ struct prebind_cksum_command { uint32_t cmd; /* LC_PREBIND_CKSUM */ uint32_t cmdsize; /* sizeof(struct prebind_cksum_command) */ uint32_t cksum; /* the check sum or zero */ }; /* * The uuid load command contains a single 128-bit unique random number that * identifies an object produced by the static link editor. */ struct uuid_command { uint32_t cmd; /* LC_UUID */ uint32_t cmdsize; /* sizeof(struct uuid_command) */ uint8_t uuid[16]; /* the 128-bit uuid */ }; /* * The rpath_command contains a path which at runtime should be added to * the current run path used to find @rpath prefixed dylibs. */ struct rpath_command { uint32_t cmd; /* LC_RPATH */ uint32_t cmdsize; /* includes string */ union lc_str path; /* path to add to run path */ }; /* * The linkedit_data_command contains the offsets and sizes of a blob * of data in the __LINKEDIT segment. */ struct linkedit_data_command { uint32_t cmd; /* LC_CODE_SIGNATURE, LC_SEGMENT_SPLIT_INFO, LC_FUNCTION_STARTS, LC_DATA_IN_CODE, LC_DYLIB_CODE_SIGN_DRS, LC_LINKER_OPTIMIZATION_HINT, LC_DYLD_EXPORTS_TRIE, or LC_DYLD_CHAINED_FIXUPS. */ uint32_t cmdsize; /* sizeof(struct linkedit_data_command) */ uint32_t dataoff; /* file offset of data in __LINKEDIT segment */ uint32_t datasize; /* file size of data in __LINKEDIT segment */ }; /* * The encryption_info_command contains the file offset and size of an * of an encrypted segment. */ struct encryption_info_command { uint32_t cmd; /* LC_ENCRYPTION_INFO */ uint32_t cmdsize; /* sizeof(struct encryption_info_command) */ uint32_t cryptoff; /* file offset of encrypted range */ uint32_t cryptsize; /* file size of encrypted range */ uint32_t cryptid; /* which enryption system, 0 means not-encrypted yet */ }; /* * The encryption_info_command_64 contains the file offset and size of an * of an encrypted segment (for use in x86_64 targets). */ struct encryption_info_command_64 { uint32_t cmd; /* LC_ENCRYPTION_INFO_64 */ uint32_t cmdsize; /* sizeof(struct encryption_info_command_64) */ uint32_t cryptoff; /* file offset of encrypted range */ uint32_t cryptsize; /* file size of encrypted range */ uint32_t cryptid; /* which enryption system, 0 means not-encrypted yet */ uint32_t pad; /* padding to make this struct's size a multiple of 8 bytes */ }; /* * The version_min_command contains the min OS version on which this * binary was built to run. */ struct version_min_command { uint32_t cmd; /* LC_VERSION_MIN_MACOSX or LC_VERSION_MIN_IPHONEOS or LC_VERSION_MIN_WATCHOS or LC_VERSION_MIN_TVOS */ uint32_t cmdsize; /* sizeof(struct min_version_command) */ uint32_t version; /* X.Y.Z is encoded in nibbles xxxx.yy.zz */ uint32_t sdk; /* X.Y.Z is encoded in nibbles xxxx.yy.zz */ }; /* * The build_version_command contains the min OS version on which this * binary was built to run for its platform. The list of known platforms and * tool values following it. */ struct build_version_command { uint32_t cmd; /* LC_BUILD_VERSION */ uint32_t cmdsize; /* sizeof(struct build_version_command) plus */ /* ntools * sizeof(struct build_tool_version) */ uint32_t platform; /* platform */ uint32_t minos; /* X.Y.Z is encoded in nibbles xxxx.yy.zz */ uint32_t sdk; /* X.Y.Z is encoded in nibbles xxxx.yy.zz */ uint32_t ntools; /* number of tool entries following this */ }; struct build_tool_version { uint32_t tool; /* enum for the tool */ uint32_t version; /* version number of the tool */ }; /* Known values for the platform field above. */ #define PLATFORM_MACOS 1 #define PLATFORM_IOS 2 #define PLATFORM_TVOS 3 #define PLATFORM_WATCHOS 4 #define PLATFORM_BRIDGEOS 5 #define PLATFORM_MACCATALYST 6 #define PLATFORM_IOSSIMULATOR 7 #define PLATFORM_TVOSSIMULATOR 8 #define PLATFORM_WATCHOSSIMULATOR 9 #define PLATFORM_DRIVERKIT 10 /* Known values for the tool field above. */ #define TOOL_CLANG 1 #define TOOL_SWIFT 2 #define TOOL_LD 3 /* * The dyld_info_command contains the file offsets and sizes of * the new compressed form of the information dyld needs to * load the image. This information is used by dyld on Mac OS X * 10.6 and later. All information pointed to by this command * is encoded using byte streams, so no endian swapping is needed * to interpret it. */ struct dyld_info_command { uint32_t cmd; /* LC_DYLD_INFO or LC_DYLD_INFO_ONLY */ uint32_t cmdsize; /* sizeof(struct dyld_info_command) */ /* * Dyld rebases an image whenever dyld loads it at an address different * from its preferred address. The rebase information is a stream * of byte sized opcodes whose symbolic names start with REBASE_OPCODE_. * Conceptually the rebase information is a table of tuples: * * The opcodes are a compressed way to encode the table by only * encoding when a column changes. In addition simple patterns * like "every n'th offset for m times" can be encoded in a few * bytes. */ uint32_t rebase_off; /* file offset to rebase info */ uint32_t rebase_size; /* size of rebase info */ /* * Dyld binds an image during the loading process, if the image * requires any pointers to be initialized to symbols in other images. * The bind information is a stream of byte sized * opcodes whose symbolic names start with BIND_OPCODE_. * Conceptually the bind information is a table of tuples: * * The opcodes are a compressed way to encode the table by only * encoding when a column changes. In addition simple patterns * like for runs of pointers initialzed to the same value can be * encoded in a few bytes. */ uint32_t bind_off; /* file offset to binding info */ uint32_t bind_size; /* size of binding info */ /* * Some C++ programs require dyld to unique symbols so that all * images in the process use the same copy of some code/data. * This step is done after binding. The content of the weak_bind * info is an opcode stream like the bind_info. But it is sorted * alphabetically by symbol name. This enable dyld to walk * all images with weak binding information in order and look * for collisions. If there are no collisions, dyld does * no updating. That means that some fixups are also encoded * in the bind_info. For instance, all calls to "operator new" * are first bound to libstdc++.dylib using the information * in bind_info. Then if some image overrides operator new * that is detected when the weak_bind information is processed * and the call to operator new is then rebound. */ uint32_t weak_bind_off; /* file offset to weak binding info */ uint32_t weak_bind_size; /* size of weak binding info */ /* * Some uses of external symbols do not need to be bound immediately. * Instead they can be lazily bound on first use. The lazy_bind * are contains a stream of BIND opcodes to bind all lazy symbols. * Normal use is that dyld ignores the lazy_bind section when * loading an image. Instead the static linker arranged for the * lazy pointer to initially point to a helper function which * pushes the offset into the lazy_bind area for the symbol * needing to be bound, then jumps to dyld which simply adds * the offset to lazy_bind_off to get the information on what * to bind. */ uint32_t lazy_bind_off; /* file offset to lazy binding info */ uint32_t lazy_bind_size; /* size of lazy binding infs */ /* * The symbols exported by a dylib are encoded in a trie. This * is a compact representation that factors out common prefixes. * It also reduces LINKEDIT pages in RAM because it encodes all * information (name, address, flags) in one small, contiguous range. * The export area is a stream of nodes. The first node sequentially * is the start node for the trie. * * Nodes for a symbol start with a uleb128 that is the length of * the exported symbol information for the string so far. * If there is no exported symbol, the node starts with a zero byte. * If there is exported info, it follows the length. * * First is a uleb128 containing flags. Normally, it is followed by * a uleb128 encoded offset which is location of the content named * by the symbol from the mach_header for the image. If the flags * is EXPORT_SYMBOL_FLAGS_REEXPORT, then following the flags is * a uleb128 encoded library ordinal, then a zero terminated * UTF8 string. If the string is zero length, then the symbol * is re-export from the specified dylib with the same name. * If the flags is EXPORT_SYMBOL_FLAGS_STUB_AND_RESOLVER, then following * the flags is two uleb128s: the stub offset and the resolver offset. * The stub is used by non-lazy pointers. The resolver is used * by lazy pointers and must be called to get the actual address to use. * * After the optional exported symbol information is a byte of * how many edges (0-255) that this node has leaving it, * followed by each edge. * Each edge is a zero terminated UTF8 of the addition chars * in the symbol, followed by a uleb128 offset for the node that * edge points to. * */ uint32_t export_off; /* file offset to lazy binding info */ uint32_t export_size; /* size of lazy binding infs */ }; /* * The following are used to encode rebasing information */ #define REBASE_TYPE_POINTER 1 #define REBASE_TYPE_TEXT_ABSOLUTE32 2 #define REBASE_TYPE_TEXT_PCREL32 3 #define REBASE_OPCODE_MASK 0xF0 #define REBASE_IMMEDIATE_MASK 0x0F #define REBASE_OPCODE_DONE 0x00 #define REBASE_OPCODE_SET_TYPE_IMM 0x10 #define REBASE_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB 0x20 #define REBASE_OPCODE_ADD_ADDR_ULEB 0x30 #define REBASE_OPCODE_ADD_ADDR_IMM_SCALED 0x40 #define REBASE_OPCODE_DO_REBASE_IMM_TIMES 0x50 #define REBASE_OPCODE_DO_REBASE_ULEB_TIMES 0x60 #define REBASE_OPCODE_DO_REBASE_ADD_ADDR_ULEB 0x70 #define REBASE_OPCODE_DO_REBASE_ULEB_TIMES_SKIPPING_ULEB 0x80 /* * The following are used to encode binding information */ #define BIND_TYPE_POINTER 1 #define BIND_TYPE_TEXT_ABSOLUTE32 2 #define BIND_TYPE_TEXT_PCREL32 3 #define BIND_SPECIAL_DYLIB_SELF 0 #define BIND_SPECIAL_DYLIB_MAIN_EXECUTABLE -1 #define BIND_SPECIAL_DYLIB_FLAT_LOOKUP -2 #define BIND_SPECIAL_DYLIB_WEAK_LOOKUP -3 #define BIND_SYMBOL_FLAGS_WEAK_IMPORT 0x1 #define BIND_SYMBOL_FLAGS_NON_WEAK_DEFINITION 0x8 #define BIND_OPCODE_MASK 0xF0 #define BIND_IMMEDIATE_MASK 0x0F #define BIND_OPCODE_DONE 0x00 #define BIND_OPCODE_SET_DYLIB_ORDINAL_IMM 0x10 #define BIND_OPCODE_SET_DYLIB_ORDINAL_ULEB 0x20 #define BIND_OPCODE_SET_DYLIB_SPECIAL_IMM 0x30 #define BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM 0x40 #define BIND_OPCODE_SET_TYPE_IMM 0x50 #define BIND_OPCODE_SET_ADDEND_SLEB 0x60 #define BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB 0x70 #define BIND_OPCODE_ADD_ADDR_ULEB 0x80 #define BIND_OPCODE_DO_BIND 0x90 #define BIND_OPCODE_DO_BIND_ADD_ADDR_ULEB 0xA0 #define BIND_OPCODE_DO_BIND_ADD_ADDR_IMM_SCALED 0xB0 #define BIND_OPCODE_DO_BIND_ULEB_TIMES_SKIPPING_ULEB 0xC0 #define BIND_OPCODE_THREADED 0xD0 #define BIND_SUBOPCODE_THREADED_SET_BIND_ORDINAL_TABLE_SIZE_ULEB 0x00 #define BIND_SUBOPCODE_THREADED_APPLY 0x01 /* * The following are used on the flags byte of a terminal node * in the export information. */ #define EXPORT_SYMBOL_FLAGS_KIND_MASK 0x03 #define EXPORT_SYMBOL_FLAGS_KIND_REGULAR 0x00 #define EXPORT_SYMBOL_FLAGS_KIND_THREAD_LOCAL 0x01 #define EXPORT_SYMBOL_FLAGS_KIND_ABSOLUTE 0x02 #define EXPORT_SYMBOL_FLAGS_WEAK_DEFINITION 0x04 #define EXPORT_SYMBOL_FLAGS_REEXPORT 0x08 #define EXPORT_SYMBOL_FLAGS_STUB_AND_RESOLVER 0x10 #define EXPORT_SYMBOL_FLAGS_STATIC_RESOLVER 0x20 /* * The linker_option_command contains linker options embedded in object files. */ struct linker_option_command { uint32_t cmd; /* LC_LINKER_OPTION only used in MH_OBJECT filetypes */ uint32_t cmdsize; uint32_t count; /* number of strings */ /* concatenation of zero terminated UTF8 strings. Zero filled at end to align */ }; /* * The symseg_command contains the offset and size of the GNU style * symbol table information as described in the header file . * The symbol roots of the symbol segments must also be aligned properly * in the file. So the requirement of keeping the offsets aligned to a * multiple of a 4 bytes translates to the length field of the symbol * roots also being a multiple of a long. Also the padding must again be * zeroed. (THIS IS OBSOLETE and no longer supported). */ struct symseg_command { uint32_t cmd; /* LC_SYMSEG */ uint32_t cmdsize; /* sizeof(struct symseg_command) */ uint32_t offset; /* symbol segment offset */ uint32_t size; /* symbol segment size in bytes */ }; /* * The ident_command contains a free format string table following the * ident_command structure. The strings are null terminated and the size of * the command is padded out with zero bytes to a multiple of 4 bytes/ * (THIS IS OBSOLETE and no longer supported). */ struct ident_command { uint32_t cmd; /* LC_IDENT */ uint32_t cmdsize; /* strings that follow this command */ }; /* * The fvmfile_command contains a reference to a file to be loaded at the * specified virtual address. (Presently, this command is reserved for * internal use. The kernel ignores this command when loading a program into * memory). */ struct fvmfile_command { uint32_t cmd; /* LC_FVMFILE */ uint32_t cmdsize; /* includes pathname string */ union lc_str name; /* files pathname */ uint32_t header_addr; /* files virtual address */ }; /* * The entry_point_command is a replacement for thread_command. * It is used for main executables to specify the location (file offset) * of main(). If -stack_size was used at link time, the stacksize * field will contain the stack size need for the main thread. */ struct entry_point_command { uint32_t cmd; /* LC_MAIN only used in MH_EXECUTE filetypes */ uint32_t cmdsize; /* 24 */ uint64_t entryoff; /* file (__TEXT) offset of main() */ uint64_t stacksize;/* if not zero, initial stack size */ }; /* * The source_version_command is an optional load command containing * the version of the sources used to build the binary. */ struct source_version_command { uint32_t cmd; /* LC_SOURCE_VERSION */ uint32_t cmdsize; /* 16 */ uint64_t version; /* A.B.C.D.E packed as a24.b10.c10.d10.e10 */ }; /* * The LC_DATA_IN_CODE load commands uses a linkedit_data_command * to point to an array of data_in_code_entry entries. Each entry * describes a range of data in a code section. */ struct data_in_code_entry { uint32_t offset; /* from mach_header to start of data range*/ uint16_t length; /* number of bytes in data range */ uint16_t kind; /* a DICE_KIND_* value */ }; #define DICE_KIND_DATA 0x0001 #define DICE_KIND_JUMP_TABLE8 0x0002 #define DICE_KIND_JUMP_TABLE16 0x0003 #define DICE_KIND_JUMP_TABLE32 0x0004 #define DICE_KIND_ABS_JUMP_TABLE32 0x0005 /* * Sections of type S_THREAD_LOCAL_VARIABLES contain an array * of tlv_descriptor structures. */ struct tlv_descriptor { void* (*thunk)(struct tlv_descriptor*); unsigned long key; unsigned long offset; }; /* * LC_NOTE commands describe a region of arbitrary data included in a Mach-O * file. Its initial use is to record extra data in MH_CORE files. */ struct note_command { uint32_t cmd; /* LC_NOTE */ uint32_t cmdsize; /* sizeof(struct note_command) */ char data_owner[16]; /* owner name for this LC_NOTE */ uint64_t offset; /* file offset of this data */ uint64_t size; /* length of data region */ }; /* * LC_FILESET_ENTRY commands describe constituent Mach-O files that are part * of a fileset. In one implementation, entries are dylibs with individual * mach headers and repositionable text and data segments. Each entry is * further described by its own mach header. */ struct fileset_entry_command { uint32_t cmd; /* LC_FILESET_ENTRY */ uint32_t cmdsize; /* includes entry_id string */ uint64_t vmaddr; /* memory address of the entry */ uint64_t fileoff; /* file offset of the entry */ union lc_str entry_id; /* contained entry id */ uint32_t reserved; /* reserved */ }; /* * These deprecated values may still be used within Apple but are mechanically * removed from public API. The mechanical process may produce unusual results. */ #if (!defined(PLATFORM_MACCATALYST)) #define PLATFORM_MACCATALYST PLATFORM_MACCATALYST #endif #endif /* _MACHO_LOADER_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/mach-o/module.modulemap ================================================ module MachO [system] [extern_c] { extern module dyld "dyld.modulemap" extern module compact_unwind_encoding "compact_unwind_encoding.modulemap" export * module arch { header "arch.h" export * } module fat { header "fat.h" export * } module getsect { header "getsect.h" export * } module ldsyms { header "ldsyms.h" export * } module loader { header "loader.h" export * } module nlist { header "nlist.h" export * } module ranlib { header "ranlib.h" export * } module reloc { header "reloc.h" export * } module stab { header "stab.h" export * } module swap { header "swap.h" export * } } ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/mach-o/nlist.h ================================================ /* * Copyright (c) 1999-2003 Apple Computer, 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 _MACHO_NLIST_H_ #define _MACHO_NLIST_H_ /* $NetBSD: nlist.h,v 1.5 1994/10/26 00:56:11 cgd Exp $ */ /*- * Copyright (c) 1991, 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. * * @(#)nlist.h 8.2 (Berkeley) 1/21/94 */ #include /* * Format of a symbol table entry of a Mach-O file for 32-bit architectures. * Modified from the BSD format. The modifications from the original format * were changing n_other (an unused field) to n_sect and the addition of the * N_SECT type. These modifications are required to support symbols in a larger * number of sections not just the three sections (text, data and bss) in a BSD * file. */ struct nlist { union { #ifndef __LP64__ char *n_name; /* for use when in-core */ #endif uint32_t n_strx; /* index into the string table */ } n_un; uint8_t n_type; /* type flag, see below */ uint8_t n_sect; /* section number or NO_SECT */ int16_t n_desc; /* see */ uint32_t n_value; /* value of this symbol (or stab offset) */ }; /* * This is the symbol table entry structure for 64-bit architectures. */ struct nlist_64 { union { uint32_t n_strx; /* index into the string table */ } n_un; uint8_t n_type; /* type flag, see below */ uint8_t n_sect; /* section number or NO_SECT */ uint16_t n_desc; /* see */ uint64_t n_value; /* value of this symbol (or stab offset) */ }; /* * Symbols with a index into the string table of zero (n_un.n_strx == 0) are * defined to have a null, "", name. Therefore all string indexes to non null * names must not have a zero string index. This is bit historical information * that has never been well documented. */ /* * The n_type field really contains four fields: * unsigned char N_STAB:3, * N_PEXT:1, * N_TYPE:3, * N_EXT:1; * which are used via the following masks. */ #define N_STAB 0xe0 /* if any of these bits set, a symbolic debugging entry */ #define N_PEXT 0x10 /* private external symbol bit */ #define N_TYPE 0x0e /* mask for the type bits */ #define N_EXT 0x01 /* external symbol bit, set for external symbols */ /* * Only symbolic debugging entries have some of the N_STAB bits set and if any * of these bits are set then it is a symbolic debugging entry (a stab). In * which case then the values of the n_type field (the entire field) are given * in */ /* * Values for N_TYPE bits of the n_type field. */ #define N_UNDF 0x0 /* undefined, n_sect == NO_SECT */ #define N_ABS 0x2 /* absolute, n_sect == NO_SECT */ #define N_SECT 0xe /* defined in section number n_sect */ #define N_PBUD 0xc /* prebound undefined (defined in a dylib) */ #define N_INDR 0xa /* indirect */ /* * If the type is N_INDR then the symbol is defined to be the same as another * symbol. In this case the n_value field is an index into the string table * of the other symbol's name. When the other symbol is defined then they both * take on the defined type and value. */ /* * If the type is N_SECT then the n_sect field contains an ordinal of the * section the symbol is defined in. The sections are numbered from 1 and * refer to sections in order they appear in the load commands for the file * they are in. This means the same ordinal may very well refer to different * sections in different files. * * The n_value field for all symbol table entries (including N_STAB's) gets * updated by the link editor based on the value of it's n_sect field and where * the section n_sect references gets relocated. If the value of the n_sect * field is NO_SECT then it's n_value field is not changed by the link editor. */ #define NO_SECT 0 /* symbol is not in any section */ #define MAX_SECT 255 /* 1 thru 255 inclusive */ /* * Common symbols are represented by undefined (N_UNDF) external (N_EXT) types * who's values (n_value) are non-zero. In which case the value of the n_value * field is the size (in bytes) of the common symbol. The n_sect field is set * to NO_SECT. The alignment of a common symbol may be set as a power of 2 * between 2^1 and 2^15 as part of the n_desc field using the macros below. If * the alignment is not set (a value of zero) then natural alignment based on * the size is used. */ #define GET_COMM_ALIGN(n_desc) (((n_desc) >> 8) & 0x0f) #define SET_COMM_ALIGN(n_desc,align) \ (n_desc) = (((n_desc) & 0xf0ff) | (((align) & 0x0f) << 8)) /* * To support the lazy binding of undefined symbols in the dynamic link-editor, * the undefined symbols in the symbol table (the nlist structures) are marked * with the indication if the undefined reference is a lazy reference or * non-lazy reference. If both a non-lazy reference and a lazy reference is * made to the same symbol the non-lazy reference takes precedence. A reference * is lazy only when all references to that symbol are made through a symbol * pointer in a lazy symbol pointer section. * * The implementation of marking nlist structures in the symbol table for * undefined symbols will be to use some of the bits of the n_desc field as a * reference type. The mask REFERENCE_TYPE will be applied to the n_desc field * of an nlist structure for an undefined symbol to determine the type of * undefined reference (lazy or non-lazy). * * The constants for the REFERENCE FLAGS are propagated to the reference table * in a shared library file. In that case the constant for a defined symbol, * REFERENCE_FLAG_DEFINED, is also used. */ /* Reference type bits of the n_desc field of undefined symbols */ #define REFERENCE_TYPE 0x7 /* types of references */ #define REFERENCE_FLAG_UNDEFINED_NON_LAZY 0 #define REFERENCE_FLAG_UNDEFINED_LAZY 1 #define REFERENCE_FLAG_DEFINED 2 #define REFERENCE_FLAG_PRIVATE_DEFINED 3 #define REFERENCE_FLAG_PRIVATE_UNDEFINED_NON_LAZY 4 #define REFERENCE_FLAG_PRIVATE_UNDEFINED_LAZY 5 /* * To simplify stripping of objects that use are used with the dynamic link * editor, the static link editor marks the symbols defined an object that are * referenced by a dynamicly bound object (dynamic shared libraries, bundles). * With this marking strip knows not to strip these symbols. */ #define REFERENCED_DYNAMICALLY 0x0010 /* * For images created by the static link editor with the -twolevel_namespace * option in effect the flags field of the mach header is marked with * MH_TWOLEVEL. And the binding of the undefined references of the image are * determined by the static link editor. Which library an undefined symbol is * bound to is recorded by the static linker in the high 8 bits of the n_desc * field using the SET_LIBRARY_ORDINAL macro below. The ordinal recorded * references the libraries listed in the Mach-O's LC_LOAD_DYLIB, * LC_LOAD_WEAK_DYLIB, LC_REEXPORT_DYLIB, LC_LOAD_UPWARD_DYLIB, and * LC_LAZY_LOAD_DYLIB, etc. load commands in the order they appear in the * headers. The library ordinals start from 1. * For a dynamic library that is built as a two-level namespace image the * undefined references from module defined in another use the same nlist struct * an in that case SELF_LIBRARY_ORDINAL is used as the library ordinal. For * defined symbols in all images they also must have the library ordinal set to * SELF_LIBRARY_ORDINAL. The EXECUTABLE_ORDINAL refers to the executable * image for references from plugins that refer to the executable that loads * them. * * The DYNAMIC_LOOKUP_ORDINAL is for undefined symbols in a two-level namespace * image that are looked up by the dynamic linker with flat namespace semantics. * This ordinal was added as a feature in Mac OS X 10.3 by reducing the * value of MAX_LIBRARY_ORDINAL by one. So it is legal for existing binaries * or binaries built with older tools to have 0xfe (254) dynamic libraries. In * this case the ordinal value 0xfe (254) must be treated as a library ordinal * for compatibility. */ #define GET_LIBRARY_ORDINAL(n_desc) (((n_desc) >> 8) & 0xff) #define SET_LIBRARY_ORDINAL(n_desc,ordinal) \ (n_desc) = (((n_desc) & 0x00ff) | (((ordinal) & 0xff) << 8)) #define SELF_LIBRARY_ORDINAL 0x0 #define MAX_LIBRARY_ORDINAL 0xfd #define DYNAMIC_LOOKUP_ORDINAL 0xfe #define EXECUTABLE_ORDINAL 0xff /* * The bit 0x0020 of the n_desc field is used for two non-overlapping purposes * and has two different symbolic names, N_NO_DEAD_STRIP and N_DESC_DISCARDED. */ /* * The N_NO_DEAD_STRIP bit of the n_desc field only ever appears in a * relocatable .o file (MH_OBJECT filetype). And is used to indicate to the * static link editor it is never to dead strip the symbol. */ #define N_NO_DEAD_STRIP 0x0020 /* symbol is not to be dead stripped */ /* * The N_DESC_DISCARDED bit of the n_desc field never appears in linked image. * But is used in very rare cases by the dynamic link editor to mark an in * memory symbol as discared and longer used for linking. */ #define N_DESC_DISCARDED 0x0020 /* symbol is discarded */ /* * The N_WEAK_REF bit of the n_desc field indicates to the dynamic linker that * the undefined symbol is allowed to be missing and is to have the address of * zero when missing. */ #define N_WEAK_REF 0x0040 /* symbol is weak referenced */ /* * The N_WEAK_DEF bit of the n_desc field indicates to the static and dynamic * linkers that the symbol definition is weak, allowing a non-weak symbol to * also be used which causes the weak definition to be discared. Currently this * is only supported for symbols in coalesed sections. */ #define N_WEAK_DEF 0x0080 /* coalesed symbol is a weak definition */ /* * The N_REF_TO_WEAK bit of the n_desc field indicates to the dynamic linker * that the undefined symbol should be resolved using flat namespace searching. */ #define N_REF_TO_WEAK 0x0080 /* reference to a weak symbol */ /* * The N_ARM_THUMB_DEF bit of the n_desc field indicates that the symbol is * a defintion of a Thumb function. */ #define N_ARM_THUMB_DEF 0x0008 /* symbol is a Thumb function (ARM) */ /* * The N_SYMBOL_RESOLVER bit of the n_desc field indicates that the * that the function is actually a resolver function and should * be called to get the address of the real function to use. * This bit is only available in .o files (MH_OBJECT filetype) */ #define N_SYMBOL_RESOLVER 0x0100 /* * The N_ALT_ENTRY bit of the n_desc field indicates that the * symbol is pinned to the previous content. */ #define N_ALT_ENTRY 0x0200 /* * The N_COLD_FUNC bit of the n_desc field indicates that the symbol is used * infrequently and the linker should order it towards the end of the section. */ #define N_COLD_FUNC 0x0400 #ifndef __STRICT_BSD__ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /* * The function nlist(3) from the C library. */ extern int nlist (const char *filename, struct nlist *list); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* __STRICT_BSD__ */ #endif /* _MACHO_LIST_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/mach-o/ranlib.h ================================================ /* * Copyright (c) 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@ */ /* ranlib.h 4.1 83/05/03 */ #ifndef _MACH_O_RANLIB_H_ #define _MACH_O_RANLIB_H_ #include #include /* off_t */ /* * There are two known orders of table of contents for archives. The first is * the order ranlib(1) originally produced and still produces without any * options. This table of contents has the archive member name "__.SYMDEF" * This order has the ranlib structures in the order the objects appear in the * archive and the symbol names of those objects in the order of symbol table. * The second know order is sorted by symbol name and is produced with the -s * option to ranlib(1). This table of contents has the archive member name * "__.SYMDEF SORTED" and many programs (notably the 1.0 version of ld(1) can't * tell the difference between names because of the imbedded blank in the name * and works with either table of contents). This second order is used by the * post 1.0 link editor to produce faster linking. The original 1.0 version of * ranlib(1) gets confused when it is run on a archive with the second type of * table of contents because it and ar(1) which it uses use different ways to * determined the member name (ar(1) treats all blanks in the name as * significant and ranlib(1) only checks for the first one). */ #define SYMDEF "__.SYMDEF" #define SYMDEF_SORTED "__.SYMDEF SORTED" /* * Structure of the __.SYMDEF table of contents for an archive. * __.SYMDEF begins with a uint32_t giving the size in bytes of the ranlib * structures which immediately follow, and then continues with a string * table consisting of a uint32_t giving the number of bytes of strings which * follow and then the strings themselves. The ran_strx fields index the * string table whose first byte is numbered 0. */ struct ranlib { union { uint32_t ran_strx; /* string table index of */ #ifndef __LP64__ char *ran_name; /* symbol defined by */ #endif } ran_un; uint32_t ran_off; /* library member at this offset */ }; #define SYMDEF_64 "__.SYMDEF_64" #define SYMDEF_64_SORTED "__.SYMDEF_64 SORTED" /* * The support for the 64-bit table of contents described here is a work in * progress and not yet fully supported in all the Apple Developer Tools. * * When an archive offset to a library member is more than 32-bits then this is * the structure of the __.SYMDEF_64 table of contents for an archive. * __.SYMDEF_64 begins with a uint64_t giving the size in bytes of the ranlib * structures which immediately follow, and then continues with a string * table consisting of a uint64_t giving the number of bytes of strings which * follow and then the strings themselves. The ran_strx fields index the * string table whose first byte is numbered 0. */ struct ranlib_64 { union { uint64_t ran_strx; /* string table index of */ } ran_un; uint64_t ran_off; /* library member at this offset */ }; #endif /* _MACH_O_RANLIB_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/mach-o/reloc.h ================================================ /* * Copyright (c) 1999 Apple Computer, 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@ */ /* $NetBSD: exec.h,v 1.6 1994/10/27 04:16:05 cgd Exp $ */ /* * Copyright (c) 1993 Christopher G. Demetriou * 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. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. */ #ifndef _MACHO_RELOC_H_ #define _MACHO_RELOC_H_ #include /* * Format of a relocation entry of a Mach-O file. Modified from the 4.3BSD * format. The modifications from the original format were changing the value * of the r_symbolnum field for "local" (r_extern == 0) relocation entries. * This modification is required to support symbols in an arbitrary number of * sections not just the three sections (text, data and bss) in a 4.3BSD file. * Also the last 4 bits have had the r_type tag added to them. */ struct relocation_info { int32_t r_address; /* offset in the section to what is being relocated */ uint32_t r_symbolnum:24, /* symbol index if r_extern == 1 or section ordinal if r_extern == 0 */ r_pcrel:1, /* was relocated pc relative already */ r_length:2, /* 0=byte, 1=word, 2=long, 3=quad */ r_extern:1, /* does not include value of sym referenced */ r_type:4; /* if not 0, machine specific relocation type */ }; #define R_ABS 0 /* absolute relocation type for Mach-O files */ /* * The r_address is not really the address as it's name indicates but an offset. * In 4.3BSD a.out objects this offset is from the start of the "segment" for * which relocation entry is for (text or data). For Mach-O object files it is * also an offset but from the start of the "section" for which the relocation * entry is for. See comments in about the r_address feild * in images for used with the dynamic linker. * * In 4.3BSD a.out objects if r_extern is zero then r_symbolnum is an ordinal * for the segment the symbol being relocated is in. These ordinals are the * symbol types N_TEXT, N_DATA, N_BSS or N_ABS. In Mach-O object files these * ordinals refer to the sections in the object file in the order their section * structures appear in the headers of the object file they are in. The first * section has the ordinal 1, the second 2, and so on. This means that the * same ordinal in two different object files could refer to two different * sections. And further could have still different ordinals when combined * by the link-editor. The value R_ABS is used for relocation entries for * absolute symbols which need no further relocation. */ /* * For RISC machines some of the references are split across two instructions * and the instruction does not contain the complete value of the reference. * In these cases a second, or paired relocation entry, follows each of these * relocation entries, using a PAIR r_type, which contains the other part of the * reference not contained in the instruction. This other part is stored in the * pair's r_address field. The exact number of bits of the other part of the * reference store in the r_address field is dependent on the particular * relocation type for the particular architecture. */ /* * To make scattered loading by the link editor work correctly "local" * relocation entries can't be used when the item to be relocated is the value * of a symbol plus an offset (where the resulting expresion is outside the * block the link editor is moving, a blocks are divided at symbol addresses). * In this case. where the item is a symbol value plus offset, the link editor * needs to know more than just the section the symbol was defined. What is * needed is the actual value of the symbol without the offset so it can do the * relocation correctly based on where the value of the symbol got relocated to * not the value of the expression (with the offset added to the symbol value). * So for the NeXT 2.0 release no "local" relocation entries are ever used when * there is a non-zero offset added to a symbol. The "external" and "local" * relocation entries remain unchanged. * * The implemention is quite messy given the compatibility with the existing * relocation entry format. The ASSUMPTION is that a section will never be * bigger than 2**24 - 1 (0x00ffffff or 16,777,215) bytes. This assumption * allows the r_address (which is really an offset) to fit in 24 bits and high * bit of the r_address field in the relocation_info structure to indicate * it is really a scattered_relocation_info structure. Since these are only * used in places where "local" relocation entries are used and not where * "external" relocation entries are used the r_extern field has been removed. * * For scattered loading to work on a RISC machine where some of the references * are split across two instructions the link editor needs to be assured that * each reference has a unique 32 bit reference (that more than one reference is * NOT sharing the same high 16 bits for example) so it move each referenced * item independent of each other. Some compilers guarantees this but the * compilers don't so scattered loading can be done on those that do guarantee * this. */ #if defined(__BIG_ENDIAN__) || defined(__LITTLE_ENDIAN__) /* * The reason for the ifdef's of __BIG_ENDIAN__ and __LITTLE_ENDIAN__ are that * when stattered relocation entries were added the mistake of using a mask * against a structure that is made up of bit fields was used. To make this * design work this structure must be laid out in memory the same way so the * mask can be applied can check the same bit each time (r_scattered). */ #endif /* defined(__BIG_ENDIAN__) || defined(__LITTLE_ENDIAN__) */ #define R_SCATTERED 0x80000000 /* mask to be applied to the r_address field of a relocation_info structure to tell that is is really a scattered_relocation_info stucture */ struct scattered_relocation_info { #ifdef __BIG_ENDIAN__ uint32_t r_scattered:1, /* 1=scattered, 0=non-scattered (see above) */ r_pcrel:1, /* was relocated pc relative already */ r_length:2, /* 0=byte, 1=word, 2=long, 3=quad */ r_type:4, /* if not 0, machine specific relocation type */ r_address:24; /* offset in the section to what is being relocated */ int32_t r_value; /* the value the item to be relocated is refering to (without any offset added) */ #endif /* __BIG_ENDIAN__ */ #ifdef __LITTLE_ENDIAN__ uint32_t r_address:24, /* offset in the section to what is being relocated */ r_type:4, /* if not 0, machine specific relocation type */ r_length:2, /* 0=byte, 1=word, 2=long, 3=quad */ r_pcrel:1, /* was relocated pc relative already */ r_scattered:1; /* 1=scattered, 0=non-scattered (see above) */ int32_t r_value; /* the value the item to be relocated is refering to (without any offset added) */ #endif /* __LITTLE_ENDIAN__ */ }; /* * Relocation types used in a generic implementation. Relocation entries for * normal things use the generic relocation as discribed above and their r_type * is GENERIC_RELOC_VANILLA (a value of zero). * * Another type of generic relocation, GENERIC_RELOC_SECTDIFF, is to support * the difference of two symbols defined in different sections. That is the * expression "symbol1 - symbol2 + constant" is a relocatable expression when * both symbols are defined in some section. For this type of relocation the * both relocations entries are scattered relocation entries. The value of * symbol1 is stored in the first relocation entry's r_value field and the * value of symbol2 is stored in the pair's r_value field. * * A special case for a prebound lazy pointer is needed to beable to set the * value of the lazy pointer back to its non-prebound state. This is done * using the GENERIC_RELOC_PB_LA_PTR r_type. This is a scattered relocation * entry where the r_value feild is the value of the lazy pointer not prebound. */ enum reloc_type_generic { GENERIC_RELOC_VANILLA, /* generic relocation as discribed above */ GENERIC_RELOC_PAIR, /* Only follows a GENERIC_RELOC_SECTDIFF */ GENERIC_RELOC_SECTDIFF, GENERIC_RELOC_PB_LA_PTR, /* prebound lazy pointer */ GENERIC_RELOC_LOCAL_SECTDIFF, GENERIC_RELOC_TLV /* thread local variables */ }; #endif /* _MACHO_RELOC_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/mach-o/stab.h ================================================ /* * Copyright (c) 1999 Apple Computer, 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 _MACHO_STAB_H_ #define _MACHO_STAB_H_ /* $NetBSD: stab.h,v 1.4 1994/10/26 00:56:25 cgd Exp $ */ /*- * Copyright (c) 1991 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. * * @(#)stab.h 5.2 (Berkeley) 4/4/91 */ /* * This file gives definitions supplementing for permanent symbol * table entries of Mach-O files. Modified from the BSD definitions. The * modifications from the original definitions were changing what the values of * what was the n_other field (an unused field) which is now the n_sect field. * These modifications are required to support symbols in an arbitrary number of * sections not just the three sections (text, data and bss) in a BSD file. * The values of the defined constants have NOT been changed. * * These must have one of the N_STAB bits on. The n_value fields are subject * to relocation according to the value of their n_sect field. So for types * that refer to things in sections the n_sect field must be filled in with the * proper section ordinal. For types that are not to have their n_value field * relocatated the n_sect field must be NO_SECT. */ /* * Symbolic debugger symbols. The comments give the conventional use for * * .stabs "n_name", n_type, n_sect, n_desc, n_value * * where n_type is the defined constant and not listed in the comment. Other * fields not listed are zero. n_sect is the section ordinal the entry is * refering to. */ #define N_GSYM 0x20 /* global symbol: name,,NO_SECT,type,0 */ #define N_FNAME 0x22 /* procedure name (f77 kludge): name,,NO_SECT,0,0 */ #define N_FUN 0x24 /* procedure: name,,n_sect,linenumber,address */ #define N_STSYM 0x26 /* static symbol: name,,n_sect,type,address */ #define N_LCSYM 0x28 /* .lcomm symbol: name,,n_sect,type,address */ #define N_BNSYM 0x2e /* begin nsect sym: 0,,n_sect,0,address */ #define N_AST 0x32 /* AST file path: name,,NO_SECT,0,0 */ #define N_OPT 0x3c /* emitted with gcc2_compiled and in gcc source */ #define N_RSYM 0x40 /* register sym: name,,NO_SECT,type,register */ #define N_SLINE 0x44 /* src line: 0,,n_sect,linenumber,address */ #define N_ENSYM 0x4e /* end nsect sym: 0,,n_sect,0,address */ #define N_SSYM 0x60 /* structure elt: name,,NO_SECT,type,struct_offset */ #define N_SO 0x64 /* source file name: name,,n_sect,0,address */ #define N_OSO 0x66 /* object file name: name,,(see below),0,st_mtime */ /* historically N_OSO set n_sect to 0. The N_OSO * n_sect may instead hold the low byte of the * cpusubtype value from the Mach-O header. */ #define N_LSYM 0x80 /* local sym: name,,NO_SECT,type,offset */ #define N_BINCL 0x82 /* include file beginning: name,,NO_SECT,0,sum */ #define N_SOL 0x84 /* #included file name: name,,n_sect,0,address */ #define N_PARAMS 0x86 /* compiler parameters: name,,NO_SECT,0,0 */ #define N_VERSION 0x88 /* compiler version: name,,NO_SECT,0,0 */ #define N_OLEVEL 0x8A /* compiler -O level: name,,NO_SECT,0,0 */ #define N_PSYM 0xa0 /* parameter: name,,NO_SECT,type,offset */ #define N_EINCL 0xa2 /* include file end: name,,NO_SECT,0,0 */ #define N_ENTRY 0xa4 /* alternate entry: name,,n_sect,linenumber,address */ #define N_LBRAC 0xc0 /* left bracket: 0,,NO_SECT,nesting level,address */ #define N_EXCL 0xc2 /* deleted include file: name,,NO_SECT,0,sum */ #define N_RBRAC 0xe0 /* right bracket: 0,,NO_SECT,nesting level,address */ #define N_BCOMM 0xe2 /* begin common: name,,NO_SECT,0,0 */ #define N_ECOMM 0xe4 /* end common: name,,n_sect,0,0 */ #define N_ECOML 0xe8 /* end common (local name): 0,,n_sect,0,address */ #define N_LENG 0xfe /* second stab entry with length information */ /* * for the berkeley pascal compiler, pc(1): */ #define N_PC 0x30 /* global pascal symbol: name,,NO_SECT,subtype,line */ #endif /* _MACHO_STAB_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/mach-o/swap.h ================================================ /* * Copyright (c) 1999 Apple Computer, 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_SWAP_H_ #define _MACH_O_SWAP_H_ #include #include #include #include #include #include #include #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ extern void swap_fat_header( struct fat_header *fat_header, enum NXByteOrder target_byte_order); extern void swap_fat_arch( struct fat_arch *fat_archs, uint32_t nfat_arch, enum NXByteOrder target_byte_order); extern void swap_fat_arch_64( struct fat_arch_64 *fat_archs64, uint32_t nfat_arch, enum NXByteOrder target_byte_order); extern void swap_mach_header( struct mach_header *mh, enum NXByteOrder target_byte_order); extern void swap_mach_header_64( struct mach_header_64 *mh, enum NXByteOrder target_byte_order); extern void swap_load_command( struct load_command *lc, enum NXByteOrder target_byte_order); extern void swap_segment_command( struct segment_command *sg, enum NXByteOrder target_byte_order); extern void swap_segment_command_64( struct segment_command_64 *sg, enum NXByteOrder target_byte_order); extern void swap_section( struct section *s, uint32_t nsects, enum NXByteOrder target_byte_order); extern void swap_section_64( struct section_64 *s, uint32_t nsects, enum NXByteOrder target_byte_order); extern void swap_symtab_command( struct symtab_command *st, enum NXByteOrder target_byte_order); extern void swap_dysymtab_command( struct dysymtab_command *dyst, enum NXByteOrder target_byte_sex); extern void swap_symseg_command( struct symseg_command *ss, enum NXByteOrder target_byte_order); extern void swap_fvmlib_command( struct fvmlib_command *fl, enum NXByteOrder target_byte_order); extern void swap_dylib_command( struct dylib_command *dl, enum NXByteOrder target_byte_sex); extern void swap_sub_framework_command( struct sub_framework_command *sub, enum NXByteOrder target_byte_sex); extern void swap_sub_umbrella_command( struct sub_umbrella_command *usub, enum NXByteOrder target_byte_sex); extern void swap_sub_library_command( struct sub_library_command *lsub, enum NXByteOrder target_byte_sex); extern void swap_sub_client_command( struct sub_client_command *csub, enum NXByteOrder target_byte_sex); extern void swap_prebound_dylib_command( struct prebound_dylib_command *pbdylib, enum NXByteOrder target_byte_sex); extern void swap_dylinker_command( struct dylinker_command *dyld, enum NXByteOrder target_byte_sex); extern void swap_fvmfile_command( struct fvmfile_command *ff, enum NXByteOrder target_byte_order); extern void swap_thread_command( struct thread_command *ut, enum NXByteOrder target_byte_order); extern void swap_ident_command( struct ident_command *ident, enum NXByteOrder target_byte_order); extern void swap_routines_command( struct routines_command *r_cmd, enum NXByteOrder target_byte_sex); extern void swap_routines_command_64( struct routines_command_64 *r_cmd, enum NXByteOrder target_byte_sex); extern void swap_twolevel_hints_command( struct twolevel_hints_command *hints_cmd, enum NXByteOrder target_byte_sex); extern void swap_prebind_cksum_command( struct prebind_cksum_command *cksum_cmd, enum NXByteOrder target_byte_sex); extern void swap_uuid_command( struct uuid_command *uuid_cmd, enum NXByteOrder target_byte_sex); extern void swap_linkedit_data_command( struct linkedit_data_command *ld, enum NXByteOrder target_byte_sex); extern void swap_version_min_command( struct version_min_command *ver_cmd, enum NXByteOrder target_byte_sex); extern void swap_rpath_command( struct rpath_command *rpath_cmd, enum NXByteOrder target_byte_sex); extern void swap_encryption_command( struct encryption_info_command *ec, enum NXByteOrder target_byte_sex); extern void swap_encryption_command_64( struct encryption_info_command_64 *ec, enum NXByteOrder target_byte_sex); extern void swap_linker_option_command( struct linker_option_command *lo, enum NXByteOrder target_byte_sex); extern void swap_dyld_info_command( struct dyld_info_command *ed, enum NXByteOrder target_byte_sex); extern void swap_entry_point_command( struct entry_point_command *ep, enum NXByteOrder target_byte_sex); extern void swap_source_version_command( struct source_version_command *sv, enum NXByteOrder target_byte_sex); extern void swap_note_command( struct note_command *nc, enum NXByteOrder target_byte_sex); extern void swap_build_version_command( struct build_version_command *bv, enum NXByteOrder target_byte_sex); extern void swap_build_tool_version( struct build_tool_version *bt, uint32_t ntools, enum NXByteOrder target_byte_sex); extern void swap_prebind_cksum_command( struct prebind_cksum_command *cksum_cmd, enum NXByteOrder target_byte_sex); extern void swap_uuid_command( struct uuid_command *uuid_cmd, enum NXByteOrder target_byte_sex); extern void swap_twolevel_hint( struct twolevel_hint *hints, uint32_t nhints, enum NXByteOrder target_byte_sex); extern void swap_fileset_entry_command( struct fileset_entry_command *lc, enum NXByteOrder target_byte_sex); extern void swap_nlist( struct nlist *symbols, uint32_t nsymbols, enum NXByteOrder target_byte_order); extern void swap_nlist_64( struct nlist_64 *symbols, uint32_t nsymbols, enum NXByteOrder target_byte_order); extern void swap_ranlib( struct ranlib *ranlibs, uint32_t nranlibs, enum NXByteOrder target_byte_order); extern void swap_ranlib_64( struct ranlib_64 *ranlibs, uint64_t nranlibs, enum NXByteOrder target_byte_order); extern void swap_relocation_info( struct relocation_info *relocs, uint32_t nrelocs, enum NXByteOrder target_byte_order); extern void swap_indirect_symbols( uint32_t *indirect_symbols, uint32_t nindirect_symbols, enum NXByteOrder target_byte_sex); extern void swap_dylib_reference( struct dylib_reference *refs, uint32_t nrefs, enum NXByteOrder target_byte_sex); extern void swap_dylib_module( struct dylib_module *mods, uint32_t nmods, enum NXByteOrder target_byte_sex); extern void swap_dylib_module_64( struct dylib_module_64 *mods, uint32_t nmods, enum NXByteOrder target_byte_sex); extern void swap_dylib_table_of_contents( struct dylib_table_of_contents *tocs, uint32_t ntocs, enum NXByteOrder target_byte_sex); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* _MACH_O_SWAP_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/mach-o/x86_64/reloc.h ================================================ /* * Copyright (c) 2006 Apple Computer, 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@ */ /* * Relocations for x86_64 are a bit different than for other architectures in * Mach-O: Scattered relocations are not used. Almost all relocations produced * by the compiler are external relocations. An external relocation has the * r_extern bit set to 1 and the r_symbolnum field contains the symbol table * index of the target label. * * When the assembler is generating relocations, if the target label is a local * label (begins with 'L'), then the previous non-local label in the same * section is used as the target of the external relocation. An addend is used * with the distance from that non-local label to the target label. Only when * there is no previous non-local label in the section is an internal * relocation used. * * The addend (i.e. the 4 in _foo+4) is encoded in the instruction (Mach-O does * not have RELA relocations). For PC-relative relocations, the addend is * stored directly in the instruction. This is different from other Mach-O * architectures, which encode the addend minus the current section offset. * * The relocation types are: * * X86_64_RELOC_UNSIGNED // for absolute addresses * X86_64_RELOC_SIGNED // for signed 32-bit displacement * X86_64_RELOC_BRANCH // a CALL/JMP instruction with 32-bit displacement * X86_64_RELOC_GOT_LOAD // a MOVQ load of a GOT entry * X86_64_RELOC_GOT // other GOT references * X86_64_RELOC_SUBTRACTOR // must be followed by a X86_64_RELOC_UNSIGNED * * The following are sample assembly instructions, followed by the relocation * and section content they generate in an object file: * * call _foo * r_type=X86_64_RELOC_BRANCH, r_length=2, r_extern=1, r_pcrel=1, r_symbolnum=_foo * E8 00 00 00 00 * * call _foo+4 * r_type=X86_64_RELOC_BRANCH, r_length=2, r_extern=1, r_pcrel=1, r_symbolnum=_foo * E8 04 00 00 00 * * movq _foo@GOTPCREL(%rip), %rax * r_type=X86_64_RELOC_GOT_LOAD, r_length=2, r_extern=1, r_pcrel=1, r_symbolnum=_foo * 48 8B 05 00 00 00 00 * * pushq _foo@GOTPCREL(%rip) * r_type=X86_64_RELOC_GOT, r_length=2, r_extern=1, r_pcrel=1, r_symbolnum=_foo * FF 35 00 00 00 00 * * movl _foo(%rip), %eax * r_type=X86_64_RELOC_SIGNED, r_length=2, r_extern=1, r_pcrel=1, r_symbolnum=_foo * 8B 05 00 00 00 00 * * movl _foo+4(%rip), %eax * r_type=X86_64_RELOC_SIGNED, r_length=2, r_extern=1, r_pcrel=1, r_symbolnum=_foo * 8B 05 04 00 00 00 * * movb $0x12, _foo(%rip) * r_type=X86_64_RELOC_SIGNED, r_length=2, r_extern=1, r_pcrel=1, r_symbolnum=_foo * C6 05 FF FF FF FF 12 * * movl $0x12345678, _foo(%rip) * r_type=X86_64_RELOC_SIGNED, r_length=2, r_extern=1, r_pcrel=1, r_symbolnum=_foo * C7 05 FC FF FF FF 78 56 34 12 * * .quad _foo * r_type=X86_64_RELOC_UNSIGNED, r_length=3, r_extern=1, r_pcrel=0, r_symbolnum=_foo * 00 00 00 00 00 00 00 00 * * .quad _foo+4 * r_type=X86_64_RELOC_UNSIGNED, r_length=3, r_extern=1, r_pcrel=0, r_symbolnum=_foo * 04 00 00 00 00 00 00 00 * * .quad _foo - _bar * r_type=X86_64_RELOC_SUBTRACTOR, r_length=3, r_extern=1, r_pcrel=0, r_symbolnum=_bar * r_type=X86_64_RELOC_UNSIGNED, r_length=3, r_extern=1, r_pcrel=0, r_symbolnum=_foo * 00 00 00 00 00 00 00 00 * * .quad _foo - _bar + 4 * r_type=X86_64_RELOC_SUBTRACTOR, r_length=3, r_extern=1, r_pcrel=0, r_symbolnum=_bar * r_type=X86_64_RELOC_UNSIGNED, r_length=3, r_extern=1, r_pcrel=0, r_symbolnum=_foo * 04 00 00 00 00 00 00 00 * * .long _foo - _bar * r_type=X86_64_RELOC_SUBTRACTOR, r_length=2, r_extern=1, r_pcrel=0, r_symbolnum=_bar * r_type=X86_64_RELOC_UNSIGNED, r_length=2, r_extern=1, r_pcrel=0, r_symbolnum=_foo * 00 00 00 00 * * lea L1(%rip), %rax * r_type=X86_64_RELOC_SIGNED, r_length=2, r_extern=1, r_pcrel=1, r_symbolnum=_prev * 48 8d 05 12 00 00 00 * // assumes _prev is the first non-local label 0x12 bytes before L1 * * lea L0(%rip), %rax * r_type=X86_64_RELOC_SIGNED, r_length=2, r_extern=0, r_pcrel=1, r_symbolnum=3 * 48 8d 05 56 00 00 00 * // assumes L0 is in third section and there is no previous non-local label. * // The rip-relative-offset of 0x00000056 is L0-address_of_next_instruction. * // address_of_next_instruction is the address of the relocation + 4. * * add $6,L0(%rip) * r_type=X86_64_RELOC_SIGNED_1, r_length=2, r_extern=0, r_pcrel=1, r_symbolnum=3 * 83 05 18 00 00 00 06 * // assumes L0 is in third section and there is no previous non-local label. * // The rip-relative-offset of 0x00000018 is L0-address_of_next_instruction. * // address_of_next_instruction is the address of the relocation + 4 + 1. * // The +1 comes from SIGNED_1. This is used because the relocation is not * // at the end of the instruction. * * .quad L1 * r_type=X86_64_RELOC_UNSIGNED, r_length=3, r_extern=1, r_pcrel=0, r_symbolnum=_prev * 12 00 00 00 00 00 00 00 * // assumes _prev is the first non-local label 0x12 bytes before L1 * * .quad L0 * r_type=X86_64_RELOC_UNSIGNED, r_length=3, r_extern=0, r_pcrel=0, r_symbolnum=3 * 56 00 00 00 00 00 00 00 * // assumes L0 is in third section, has an address of 0x00000056 in .o * // file, and there is no previous non-local label * * .quad _foo - . * r_type=X86_64_RELOC_SUBTRACTOR, r_length=3, r_extern=1, r_pcrel=0, r_symbolnum=_prev * r_type=X86_64_RELOC_UNSIGNED, r_length=3, r_extern=1, r_pcrel=0, r_symbolnum=_foo * EE FF FF FF FF FF FF FF * // assumes _prev is the first non-local label 0x12 bytes before this * // .quad * * .quad _foo - L1 * r_type=X86_64_RELOC_SUBTRACTOR, r_length=3, r_extern=1, r_pcrel=0, r_symbolnum=_prev * r_type=X86_64_RELOC_UNSIGNED, r_length=3, r_extern=1, r_pcrel=0, r_symbolnum=_foo * EE FF FF FF FF FF FF FF * // assumes _prev is the first non-local label 0x12 bytes before L1 * * .quad L1 - _prev * // No relocations. This is an assembly time constant. * 12 00 00 00 00 00 00 00 * // assumes _prev is the first non-local label 0x12 bytes before L1 * * * * In final linked images, there are only two valid relocation kinds: * * r_type=X86_64_RELOC_UNSIGNED, r_length=3, r_pcrel=0, r_extern=1, r_symbolnum=sym_index * This tells dyld to add the address of a symbol to a pointer sized (8-byte) * piece of data (i.e on disk the 8-byte piece of data contains the addend). The * r_symbolnum contains the index into the symbol table of the target symbol. * * r_type=X86_64_RELOC_UNSIGNED, r_length=3, r_pcrel=0, r_extern=0, r_symbolnum=0 * This tells dyld to adjust the pointer sized (8-byte) piece of data by the amount * the containing image was loaded from its base address (e.g. slide). * */ enum reloc_type_x86_64 { X86_64_RELOC_UNSIGNED, // for absolute addresses X86_64_RELOC_SIGNED, // for signed 32-bit displacement X86_64_RELOC_BRANCH, // a CALL/JMP instruction with 32-bit displacement X86_64_RELOC_GOT_LOAD, // a MOVQ load of a GOT entry X86_64_RELOC_GOT, // other GOT references X86_64_RELOC_SUBTRACTOR, // must be followed by a X86_64_RELOC_UNSIGNED X86_64_RELOC_SIGNED_1, // for signed 32-bit displacement with a -1 addend X86_64_RELOC_SIGNED_2, // for signed 32-bit displacement with a -2 addend X86_64_RELOC_SIGNED_4, // for signed 32-bit displacement with a -4 addend X86_64_RELOC_TLV, // for thread local variables }; ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/os/_workgroup.h ================================================ /* * Copyright (c) 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 ___WORKGROUP_H__ #define ___WORKGROUP_H__ #if !defined(__has_feature) # define __has_feature(x) 0 #endif #if (!__has_feature(modules)) #error "Do not include this header directly, please include instead" #endif #include #endif /* ___WORKGROUP_H__ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/os/activity.h ================================================ /* * Copyright (c) 2013-2016 Apple Inc. All rights reserved. */ #ifndef __OS_ACTIVITY_H__ #define __OS_ACTIVITY_H__ #include __BEGIN_DECLS OS_ASSUME_NONNULL_BEGIN #pragma mark - types and globals #if OS_LOG_TARGET_HAS_10_12_FEATURES #ifndef OS_ACTIVITY_OBJECT_API #define OS_ACTIVITY_OBJECT_API 1 #endif // OS_ACTIVITY_OBJECT_API #else #if OS_ACTIVITY_OBJECT_API #error Please change your minimum OS requirements because OS_ACTIVITY_OBJECT_API is not available #endif // OS_ACTIVITY_OBJECT_API #define OS_ACTIVITY_OBJECT_API 0 #endif // OS_LOG_TARGET_HAS_10_12_FEATURES /*! * @enum os_activity_flag_t * * @discussion * Support flags for os_activity_create or os_activity_start. * * @constant OS_ACTIVITY_FLAG_DEFAULT * Use the default flags. * * @constant OS_ACTIVITY_FLAG_DETACHED * Detach the newly created activity from the provided activity (if any). If * passed in conjunction with an exiting activity, the activity will only note * what activity "created" the new one, but will make the new activity a top * level activity. This allows users to see what activity triggered work * without actually relating the activities. * * @constant OS_ACTIVITY_FLAG_IF_NONE_PRESENT * Will only create a new activity if none present. If an activity ID is * already present, a new object will be returned with the same activity ID * underneath. * * Passing both OS_ACTIVITY_FLAG_DETACHED and OS_ACTIVITY_FLAG_IF_NONE_PRESENT * is undefined. */ OS_ENUM(os_activity_flag, uint32_t, OS_ACTIVITY_FLAG_DEFAULT = 0, OS_ACTIVITY_FLAG_DETACHED = 0x1, OS_ACTIVITY_FLAG_IF_NONE_PRESENT = 0x2 ); #if OS_ACTIVITY_OBJECT_API #define OS_ACTIVITY_NULL NULL /*! * @typedef os_activity_t * An opaque activity object. */ API_AVAILABLE(macos(10.12), ios(10.0), watchos(3.0), tvos(10.0)) #if OS_OBJECT_USE_OBJC OS_OBJECT_DECL(os_activity); #else typedef struct os_activity_s *os_activity_t; #endif /* OS_OBJECT_USE_OBJC */ /*! * @const OS_ACTIVITY_NONE * * @discussion * Create activity with no current traits, this is the equivalent of a * detached activity. */ #define OS_ACTIVITY_NONE OS_OBJECT_GLOBAL_OBJECT(os_activity_t, _os_activity_none) API_AVAILABLE(macos(10.12), ios(10.0), watchos(3.0), tvos(10.0)) OS_EXPORT struct os_activity_s _os_activity_none; /*! * @const OS_ACTIVITY_CURRENT * * @discussion * Create activity and links to the current activity if one is present. * If no activity is present it is treated as if it is detached. */ #define OS_ACTIVITY_CURRENT OS_OBJECT_GLOBAL_OBJECT(os_activity_t, _os_activity_current) API_AVAILABLE(macos(10.12), ios(10.0), watchos(3.0), tvos(10.0)) OS_EXPORT struct os_activity_s _os_activity_current; #else // !OS_ACTIVITY_OBJECT_API #define OS_ACTIVITY_NULL 0 /*! * @typedef os_activity_t * An opaque activity identifier. */ API_AVAILABLE(macos(10.10), ios(8.0), watchos(2.0), tvos(9.0)) typedef uint64_t os_activity_t; #endif // OS_ACTIVITY_OBJECT_API /*! * @typedef os_activity_id_t * An value representing the activity ID assigned to an newly created activity. */ API_AVAILABLE(macos(10.10), ios(8.0), watchos(2.0), tvos(9.0)) typedef uint64_t os_activity_id_t; /*! * @typedef os_activity_scope_state_t * Structure that is populated by os_activity_scope_enter and restored using * os_activity_scope_leave. */ API_AVAILABLE(macos(10.12), ios(10.0), watchos(3.0), tvos(10.0)) typedef struct os_activity_scope_state_s { uint64_t opaque[2]; } *os_activity_scope_state_t; #pragma mark - Internal support functions #if OS_ACTIVITY_OBJECT_API API_AVAILABLE(macos(10.12), ios(10.0), watchos(3.0), tvos(10.0)) OS_EXPORT OS_NOTHROW OS_WARN_RESULT_NEEDS_RELEASE OS_NOT_TAIL_CALLED OS_OBJECT_RETURNS_RETAINED os_activity_t _os_activity_create(void *dso, const char *description, os_activity_t activity, os_activity_flag_t flags); #endif /*! * @function _os_activity_label_useraction * * @abstract * Internal function for use by os_activity_label_useraction. * * @warning * Do not use directly. */ API_AVAILABLE(macos(10.12), ios(10.0), watchos(3.0), tvos(10.0)) OS_EXPORT OS_NOTHROW OS_NOT_TAIL_CALLED void _os_activity_label_useraction(void *dso, const char *name); /*! * @function _os_activity_initiate * * @abstract * Do not use directly because your description will not be preserved. */ API_AVAILABLE(macos(10.10), ios(8.0), watchos(2.0), tvos(9.0)) OS_EXPORT OS_NOTHROW OS_NOT_TAIL_CALLED void _os_activity_initiate(void *dso, const char *description, os_activity_flag_t flags, os_block_t activity_block OS_NOESCAPE); /*! * @function _os_activity_initiate_f * * @abstract * Do not use directly because your description will not be preserved. */ API_AVAILABLE(macos(10.10), ios(8.0), watchos(2.0), tvos(9.0)) OS_EXPORT OS_NOTHROW OS_NOT_TAIL_CALLED void _os_activity_initiate_f(void *dso, const char *description, os_activity_flag_t flags, void *context, os_function_t function); #pragma mark - activity related /*! * @function os_activity_initiate * * @abstract * Synchronously initiates an activity using provided block. * * @discussion * Synchronously initiates an activity using the provided block and creates * a tracing buffer as appropriate. All new activities are created as a * subactivity of an existing activity on the current thread. * * * os_activity_initiate("indexing database", OS_ACTIVITY_FLAG_DEFAULT, ^(void) { * // either do work directly or issue work asynchronously * }); * * * @param description * A constant string describing the activity, e.g., "performClick" or * "menuSelection". * * @param flags * Flags to be used when initiating the activity, typically * OS_ACTIVITY_FLAG_DEFAULT. * * @param activity_block * The block to execute a given activity */ #define os_activity_initiate(description, flags, activity_block) __extension__({ \ OS_LOG_STRING(ACT, __description, description); \ _os_activity_initiate(&__dso_handle, __description, flags, activity_block); \ }) /*! * @function os_activity_initiate_f * * @abstract * Synchronously initiates an activity using the provided function. * * @discussion * Synchronously initiates an activity using the provided function and creates * a tracing buffer as appropriate. All new activities are created as a * subactivity of an existing activity on the current thread. * * * os_activity_initiate_f("indexing database", OS_ACTIVITY_FLAG_DEFAULT, context, function); * * * @param description * A constant string describing the activity, e.g., "performClick" or * "menuSelection". * * @param flags * Flags to be used when initiating the activity, typically * OS_ACTIVITY_FLAG_DEFAULT. * * @param context * An optional context that will be supplied to the activity function. * * @param activity_func * The function to execute for the new activity. */ #define os_activity_initiate_f(description, flags, context, function) __extension__({ \ OS_LOG_STRING(ACT, __description, description); \ _os_activity_initiate_f(&__dso_handle, __description, flags, context, function); \ }) #if OS_ACTIVITY_OBJECT_API /*! * @function os_activity_create * * @abstract * Creates an os_activity_t object which can be passed to os_activity_apply * function. * * @param description * Pass a description for the activity. The description must be a constant * string within the calling executable or library. * * @param parent_activity * Depending on flags will link the newly created activity to the value passed * or note where the activity was created. Possible activities include: * OS_ACTIVITY_NONE, OS_ACTIVITY_CURRENT or any existing os_activity_t object * created using os_activity_create. * * @param flags * A valid os_activity_flag_t which will determine behavior of the newly created * activity. * * If the OS_ACTIVITY_FLAG_DETACHED flag is passed, the value passed to the * parent_activity argument is ignored, and OS_ACTIVITY_NONE is used instead. * * If the OS_ACTIVITY_FLAG_IF_NONE_PRESENT flag is passed, then passing another * value than OS_ACTIVITY_CURRENT to the parent_activity argument is undefined. * * @result * Returns an os_activity_t object which can be used with os_activity_apply. */ #define os_activity_create(description, parent_activity, flags) __extension__({ \ OS_LOG_STRING(ACT, __description, description); \ _os_activity_create(&__dso_handle, __description, parent_activity, flags); \ }) /*! * @function os_activity_apply * * @abstract * Execute a block using a given activity object. * * @param activity * The given activity object created with os_activity_create() or * OS_ACTIVITY_NONE. * * @param block * Pass the block to be executed within the context of the given activity. */ API_AVAILABLE(macos(10.12), ios(10.0), watchos(3.0), tvos(10.0)) OS_EXPORT OS_NOTHROW void os_activity_apply(os_activity_t activity, os_block_t block OS_NOESCAPE); /*! * @function os_activity_apply_f * * @abstract * Execute a given function with a provided activity. * * @param activity * The given activity object created with os_activity_create() or * OS_ACTIVITY_NONE. * * @param context * Context to pass to the function which may be NULL. * * @param function * Pass the function to be executed within the context of the given activity. */ API_AVAILABLE(macos(10.12), ios(10.0), watchos(3.0), tvos(10.0)) OS_EXPORT OS_NOTHROW void os_activity_apply_f(os_activity_t activity, void *context, os_function_t function); /*! * @function os_activity_scope_enter * * @abstract * Will change the current execution context to use the provided activity. * * @discussion * Will change the current execution context to use the provided activity. * An activity can be created and then applied to the current scope by doing: * * * struct os_activity_scope_state_s state; * os_activity_t activity = os_activity_create("my new activity", 0); * os_activity_scope_enter(activity, &state); * ... do some work ... * os_activity_scope_leave(&state); * * * To auto-cleanup state call: * * os_activity_scope(activity); * * @param activity * Pass a valid activity created with os_activity_create or any global object. * * @param state * A stack-based struct os_activity_scope_state_s to store the state. */ API_AVAILABLE(macos(10.12), ios(10.0), watchos(3.0), tvos(10.0)) OS_EXPORT OS_NOTHROW void os_activity_scope_enter(os_activity_t activity, os_activity_scope_state_t state); /*! * @function os_activity_scope_leave * * @abstract * Will pop state up to the state provided. * * @discussion * Will leave scope using the state provided. If state is not present an error * will be generated. * * @param state * Must be a valid value filled by os_activity_scope_enter call. */ API_AVAILABLE(macos(10.12), ios(10.0), watchos(3.0), tvos(10.0)) OS_EXPORT OS_NOTHROW void os_activity_scope_leave(os_activity_scope_state_t state); #if defined(__GNUC__) #define _os_activity_scope(var, activity) \ struct os_activity_scope_state_s var __attribute__((__cleanup__(os_activity_scope_leave))); \ os_activity_scope_enter(activity, &var) #define os_activity_scope(activity) _os_activity_scope(OS_CONCAT(scope, __COUNTER__), activity) #endif #endif // OS_ACTIVITY_OBJECT_API /*! * @function os_activity_get_active * * @abstract * Returns the stack of nested activities associated with the current thread. * * @discussion * Activities have a sense of nesting and therefore there could be more than * one activity involved on the current thread. This should be used by * diagnostic tools only for making additional decisions about a situation. * * @param entries * Pass a buffer of sufficient size to hold the the number of os_activity_id_t * being requested. * * @param count * Pointer to the requested number of activity identifiers. * On output will be filled with the number of activities that are available. * * @result * Number of activity identifiers written to 'entries' */ API_DEPRECATED("No longer supported", macos(10.10, 10.12), ios(8.0, 10.0), watchos(2.0, 3.0), tvos(9.0, 10.0)) OS_EXPORT OS_NOTHROW unsigned int os_activity_get_active(os_activity_id_t *entries, unsigned int *count); /*! * @function os_activity_get_identifier * * @abstract * Returns the current activity ID and will fill the parent_id if present. * * @discussion * Returns the current activity ID and will fill the parent_id if present. * * @param parent_id * If non-null will set the parent activity ID. * * @result * The identifier for the provided activity. */ API_AVAILABLE(macos(10.12), ios(10.0), watchos(3.0), tvos(10.0)) OS_EXPORT OS_NOTHROW OS_WARN_RESULT os_activity_id_t os_activity_get_identifier(os_activity_t activity, os_activity_id_t *_Nullable parent_id); /*! * @function os_activity_label_useraction * * @abstract * Label an activity that is auto-generated by AppKit/UIKit with a name that is * useful for debugging macro-level user actions. * * @discussion * Label an activity that is auto-generated by AppKit/UIKit with a name that is * useful for debugging macro-level user actions. The API should be called * early within the scope of the IBAction and before any sub-activities are * created. The name provided will be shown in tools in additon to the * underlying AppKit/UIKit provided name. This API can only be called once and * only on the activity created by AppKit/UIKit. These actions help determine * workflow of the user in order to reproduce problems that occur. For example, * a control press and/or menu item selection can be labeled: * * * os_activity_label_useraction("New mail message"); * os_activity_label_useraction("Empty trash"); * * * Where the underlying AppKit/UIKit name will be "gesture:" or "menuSelect:". * * @param name * A constant string that describes the the action. */ #define os_activity_label_useraction(label) __extension__({ \ OS_LOG_STRING(ACT, __label, label); \ _os_activity_label_useraction(&__dso_handle, __label); \ }) #pragma mark - deprecated function support /*! * @function _os_activity_start * * @abstract * Internal function for activity start, do not use directly will not preserve * description. */ API_DEPRECATED("use combination of os_activity_create and os_activity_apply/os_activity_scope", macos(10.10, 10.12), ios(8.0, 10.0), watchos(2.0, 3.0), tvos(9.0, 10.0)) OS_EXPORT OS_NOTHROW OS_WARN_RESULT OS_NOT_TAIL_CALLED os_activity_t _os_activity_start(void *dso, const char *description, os_activity_flag_t flags); /*! * @function os_activity_start * * @warning * Deprecated please use new os_activity_create and os_activity_apply. */ #define os_activity_start(description, flags) __extension__({ \ OS_LOG_STRING(ACT, __description, description); \ _os_activity_start(&__dso_handle, __description, flags); \ }) /*! * @function os_activity_end * * @warning * Deprecated please use new os_activity_create and os_activity_apply. */ API_DEPRECATED("use combination of os_activity_create and os_activity_apply/os_activity_scope", macos(10.10, 10.12), ios(8.0, 10.0), watchos(2.0, 3.0), tvos(9.0, 10.0)) OS_EXPORT OS_NOTHROW void os_activity_end(os_activity_t activity); /*! * @typedef os_breadcrumb_t * An opaque value for the breadcrumb ID. */ API_DEPRECATED("No longer supported", macos(10.10, 10.12), ios(8.0, 10.0), watchos(2.0, 3.0), tvos(9.0, 10.0)) typedef uint32_t os_breadcrumb_t; /*! * @function _os_activity_set_breadcrumb * * @warning * Deprecated, please use os_activity_label_useraction. */ API_DEPRECATED_WITH_REPLACEMENT("os_activity_label_useraction", macos(10.10, 10.12), ios(8.0, 10.0), watchos(2.0, 3.0), tvos(9.0, 10.0)) OS_EXPORT OS_NOTHROW OS_NOT_TAIL_CALLED void _os_activity_set_breadcrumb(void *dso, const char *name); /*! * @function os_activity_set_breadcrumb * * @warning * Deprecated, please use os_activity_label_useraction. */ #define os_activity_set_breadcrumb(name) __extension__({ \ OS_LOG_STRING(ACT, __name, name); \ _os_activity_set_breadcrumb(&__dso_handle, __name); \ }) OS_ASSUME_NONNULL_END __END_DECLS #endif // __OS_ACTIVITY_H__ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/os/atomic.h ================================================ /* * Copyright (c) 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@ */ #ifndef __OS_ATOMIC_H__ #define __OS_ATOMIC_H__ /*! * @file * * @brief * Small header that helps write code that works with both C11 and C++11, * or pre-C11 type declarations. * * @discussion * The macros below allow to write code like this, that can be put in a header * and will work with both C11 and C++11: * * * struct old_type { * int atomic_field; * } old_variable; * * os_atomic_std(atomic_fetch_add_explicit)( * os_cast_to_atomic_pointer(&old_variable), 1, * os_atomic_std(memory_order_relaxed)); * */ #include #ifndef OS_ATOMIC_USES_CXX #if defined(__cplusplus) && __cplusplus >= 201103L #define OS_ATOMIC_USES_CXX 1 #else #define OS_ATOMIC_USES_CXX 0 #endif #endif #if OS_ATOMIC_USES_CXX #include #define OS_ATOMIC_STD std:: #define os_atomic_std(op) std::op #define os_atomic(type) std::atomic volatile #define os_cast_to_atomic_pointer(p) os::cast_to_atomic_pointer(p) #define os_atomic_basetypeof(p) decltype(os_cast_to_atomic_pointer(p)->load()) #define os_cast_to_nonatomic_pointer(p) os::cast_to_nonatomic_pointer(p) #else /* !OS_ATOMIC_USES_CXX */ #include #define OS_ATOMIC_STD #define os_atomic_std(op) op #define os_atomic(type) type volatile _Atomic #define os_cast_to_atomic_pointer(p) (__typeof__(*(p)) volatile _Atomic *)(uintptr_t)(p) #define os_atomic_basetypeof(p) __typeof__(atomic_load(os_cast_to_atomic_pointer(p))) #define os_cast_to_nonatomic_pointer(p) (os_atomic_basetypeof(p) *)(uintptr_t)(p) #endif /* !OS_ATOMIC_USES_CXX */ /*! * @group Internal implementation details * * @discussion The functions below are not intended to be used directly. */ #if OS_ATOMIC_USES_CXX #include namespace os { template using add_volatile_t = typename std::add_volatile::type; template using remove_volatile_t = typename std::remove_volatile::type; template inline add_volatile_t > > * cast_to_atomic_pointer(T *v) { return reinterpret_cast > > *>(v); } template inline add_volatile_t > > * cast_to_atomic_pointer(std::atomic *v) { return reinterpret_cast > > *>(v); } template inline remove_volatile_t * cast_to_nonatomic_pointer(T *v) { return const_cast *>(v); } template inline remove_volatile_t * cast_to_nonatomic_pointer(std::atomic *v) { return reinterpret_cast *>(v); } template inline remove_volatile_t * cast_to_nonatomic_pointer(volatile std::atomic *v) { auto _v = const_cast *>(v); return reinterpret_cast *>(_v); } }; #endif /* OS_ATOMIC_USES_CXX */ #endif /* __OS_ATOMIC_H__ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/os/availability.h ================================================ /* * Copyright (c) 2008-2017 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 __OS_AVAILABILITY__ #define __OS_AVAILABILITY__ /* * 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 -DAPI_TO_BE_DEPRECATED=10.12 * (iOS) * clang -DAPI_TO_BE_DEPRECATED=11.0 */ #ifndef API_TO_BE_DEPRECATED #define API_TO_BE_DEPRECATED 100000 #endif #include #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)) */ #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() #include #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 /* __OS_AVAILABILITY__ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/os/base.h ================================================ /* * Copyright (c) 2008-2020 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 __OS_BASE__ #define __OS_BASE__ #include #ifndef __has_builtin #define __has_builtin(x) 0 #endif #ifndef __has_include #define __has_include(x) 0 #endif #ifndef __has_feature #define __has_feature(x) 0 #endif #ifndef __has_attribute #define __has_attribute(x) 0 #endif #ifndef __has_extension #define __has_extension(x) 0 #endif #undef OS_INLINE // #if __GNUC__ #define OS_NORETURN __attribute__((__noreturn__)) #define OS_NOTHROW __attribute__((__nothrow__)) #define OS_NONNULL1 __attribute__((__nonnull__(1))) #define OS_NONNULL2 __attribute__((__nonnull__(2))) #define OS_NONNULL3 __attribute__((__nonnull__(3))) #define OS_NONNULL4 __attribute__((__nonnull__(4))) #define OS_NONNULL5 __attribute__((__nonnull__(5))) #define OS_NONNULL6 __attribute__((__nonnull__(6))) #define OS_NONNULL7 __attribute__((__nonnull__(7))) #define OS_NONNULL8 __attribute__((__nonnull__(8))) #define OS_NONNULL9 __attribute__((__nonnull__(9))) #define OS_NONNULL10 __attribute__((__nonnull__(10))) #define OS_NONNULL11 __attribute__((__nonnull__(11))) #define OS_NONNULL12 __attribute__((__nonnull__(12))) #define OS_NONNULL13 __attribute__((__nonnull__(13))) #define OS_NONNULL14 __attribute__((__nonnull__(14))) #define OS_NONNULL15 __attribute__((__nonnull__(15))) #define OS_NONNULL_ALL __attribute__((__nonnull__)) #define OS_SENTINEL __attribute__((__sentinel__)) #define OS_PURE __attribute__((__pure__)) #define OS_CONST __attribute__((__const__)) #define OS_WARN_RESULT __attribute__((__warn_unused_result__)) #define OS_MALLOC __attribute__((__malloc__)) #define OS_USED __attribute__((__used__)) #define OS_UNUSED __attribute__((__unused__)) #define OS_COLD __attribute__((__cold__)) #define OS_WEAK __attribute__((__weak__)) #define OS_WEAK_IMPORT __attribute__((__weak_import__)) #define OS_NOINLINE __attribute__((__noinline__)) #define OS_ALWAYS_INLINE __attribute__((__always_inline__)) #define OS_TRANSPARENT_UNION __attribute__((__transparent_union__)) #define OS_ALIGNED(n) __attribute__((__aligned__((n)))) #define OS_FORMAT_PRINTF(x, y) __attribute__((__format__(printf,x,y))) #define OS_EXPORT extern __attribute__((__visibility__("default"))) #define OS_INLINE static __inline__ #define OS_EXPECT(x, v) __builtin_expect((x), (v)) #else #define OS_NORETURN #define OS_NOTHROW #define OS_NONNULL1 #define OS_NONNULL2 #define OS_NONNULL3 #define OS_NONNULL4 #define OS_NONNULL5 #define OS_NONNULL6 #define OS_NONNULL7 #define OS_NONNULL8 #define OS_NONNULL9 #define OS_NONNULL10 #define OS_NONNULL11 #define OS_NONNULL12 #define OS_NONNULL13 #define OS_NONNULL14 #define OS_NONNULL15 #define OS_NONNULL_ALL #define OS_SENTINEL #define OS_PURE #define OS_CONST #define OS_WARN_RESULT #define OS_MALLOC #define OS_USED #define OS_UNUSED #define OS_COLD #define OS_WEAK #define OS_WEAK_IMPORT #define OS_NOINLINE #define OS_ALWAYS_INLINE #define OS_TRANSPARENT_UNION #define OS_ALIGNED(n) #define OS_FORMAT_PRINTF(x, y) #define OS_EXPORT extern #define OS_INLINE static inline #define OS_EXPECT(x, v) (x) #endif #if __has_attribute(noescape) #define OS_NOESCAPE __attribute__((__noescape__)) #else #define OS_NOESCAPE #endif #if defined(__cplusplus) && defined(__clang__) #define OS_FALLTHROUGH [[clang::fallthrough]] #elif __has_attribute(fallthrough) #define OS_FALLTHROUGH __attribute__((__fallthrough__)) #else #define OS_FALLTHROUGH #endif #if __has_feature(assume_nonnull) #define OS_ASSUME_NONNULL_BEGIN _Pragma("clang assume_nonnull begin") #define OS_ASSUME_NONNULL_END _Pragma("clang assume_nonnull end") #else #define OS_ASSUME_NONNULL_BEGIN #define OS_ASSUME_NONNULL_END #endif #if __has_builtin(__builtin_assume) #define OS_COMPILER_CAN_ASSUME(expr) __builtin_assume(expr) #else #define OS_COMPILER_CAN_ASSUME(expr) ((void)(expr)) #endif #if __has_extension(attribute_overloadable) #define OS_OVERLOADABLE __attribute__((__overloadable__)) #else #define OS_OVERLOADABLE #endif #if __has_attribute(analyzer_suppress) #define OS_ANALYZER_SUPPRESS(RADAR) __attribute__((analyzer_suppress)) #else #define OS_ANALYZER_SUPPRESS(RADAR) #endif #if __has_attribute(enum_extensibility) #define __OS_ENUM_ATTR __attribute__((enum_extensibility(open))) #define __OS_ENUM_ATTR_CLOSED __attribute__((enum_extensibility(closed))) #else #define __OS_ENUM_ATTR #define __OS_ENUM_ATTR_CLOSED #endif // __has_attribute(enum_extensibility) #if __has_attribute(flag_enum) /*! * Compile with -Wflag-enum and -Wassign-enum to enforce at definition and * assignment, respectively, i.e. -Wflag-enum prevents you from creating new * enumeration values from illegal values within the enum definition, and * -Wassign-enum prevents you from assigning illegal values to a variable of the * enum type. */ #define __OS_OPTIONS_ATTR __attribute__((flag_enum)) #else #define __OS_OPTIONS_ATTR #endif // __has_attribute(flag_enum) #if __has_feature(objc_fixed_enum) || __has_extension(cxx_fixed_enum) || \ __has_extension(cxx_strong_enums) #define OS_ENUM(_name, _type, ...) \ typedef enum : _type { __VA_ARGS__ } _name##_t #define OS_CLOSED_ENUM(_name, _type, ...) \ typedef enum : _type { __VA_ARGS__ } __OS_ENUM_ATTR_CLOSED _name##_t #define OS_OPTIONS(_name, _type, ...) \ typedef enum : _type { __VA_ARGS__ } __OS_ENUM_ATTR __OS_OPTIONS_ATTR _name##_t #define OS_CLOSED_OPTIONS(_name, _type, ...) \ typedef enum : _type { __VA_ARGS__ } __OS_ENUM_ATTR_CLOSED __OS_OPTIONS_ATTR _name##_t #else /*! * There is unfortunately no good way in plain C to have both fixed-type enums * and enforcement for clang's enum_extensibility extensions. The primary goal * of these macros is to allow you to define an enum and specify its width in a * single statement, and for plain C that is accomplished by defining an * anonymous enum and then separately typedef'ing the requested type name to the * requested underlying integer type. So the type emitted actually has no * relationship at all to the enum, and therefore while the compiler could * enforce enum extensibility if you used the enum type, it cannot do so if you * use the "_t" type resulting from this expression. * * But we still define a named enum type and decorate it appropriately for you, * so if you really want the enum extensibility enforcement, you can use the * enum type yourself, i.e. when compiling with a C compiler: * * OS_CLOSED_ENUM(my_type, uint64_t, * FOO, * BAR, * BAZ, * ); * * my_type_t mt = 98; // legal * enum my_type emt = 98; // illegal * * But be aware that the underlying enum type's width is subject only to the C * language's guarantees -- namely that it will be compatible with int, char, * and unsigned char. It is not safe to rely on the size of this type. * * When compiling in ObjC or C++, both of the above assignments are illegal. */ #define __OS_ENUM_C_FALLBACK(_name, _type, ...) \ typedef _type _name##_t; enum _name { __VA_ARGS__ } #define OS_ENUM(_name, _type, ...) \ typedef _type _name##_t; enum { __VA_ARGS__ } #define OS_CLOSED_ENUM(_name, _type, ...) \ __OS_ENUM_C_FALLBACK(_name, _type, ## __VA_ARGS__) \ __OS_ENUM_ATTR_CLOSED #define OS_OPTIONS(_name, _type, ...) \ __OS_ENUM_C_FALLBACK(_name, _type, ## __VA_ARGS__) \ __OS_ENUM_ATTR __OS_OPTIONS_ATTR #define OS_CLOSED_OPTIONS(_name, _type, ...) \ __OS_ENUM_C_FALLBACK(_name, _type, ## __VA_ARGS__) \ __OS_ENUM_ATTR_CLOSED __OS_OPTIONS_ATTR #endif // __has_feature(objc_fixed_enum) || __has_extension(cxx_strong_enums) #if __has_feature(attribute_availability_swift) // equivalent to __SWIFT_UNAVAILABLE from Availability.h #define OS_SWIFT_UNAVAILABLE(_msg) \ __attribute__((__availability__(swift, unavailable, message=_msg))) #else #define OS_SWIFT_UNAVAILABLE(_msg) #endif #if __has_attribute(swift_private) # define OS_REFINED_FOR_SWIFT __attribute__((__swift_private__)) #else # define OS_REFINED_FOR_SWIFT #endif #if __has_attribute(swift_name) # define OS_SWIFT_NAME(_name) __attribute__((__swift_name__(#_name))) #else # define OS_SWIFT_NAME(_name) #endif #define __OS_STRINGIFY(s) #s #define OS_STRINGIFY(s) __OS_STRINGIFY(s) #define __OS_CONCAT(x, y) x ## y #define OS_CONCAT(x, y) __OS_CONCAT(x, y) #ifdef __GNUC__ #define os_prevent_tail_call_optimization() __asm__("") #define os_is_compile_time_constant(expr) __builtin_constant_p(expr) #define os_compiler_barrier() __asm__ __volatile__("" ::: "memory") #else #define os_prevent_tail_call_optimization() do { } while (0) #define os_is_compile_time_constant(expr) 0 #define os_compiler_barrier() do { } while (0) #endif #if __has_attribute(not_tail_called) #define OS_NOT_TAIL_CALLED __attribute__((__not_tail_called__)) #else #define OS_NOT_TAIL_CALLED #endif typedef void (*os_function_t)(void *_Nullable); #ifdef __BLOCKS__ /*! * @typedef os_block_t * * @abstract * Generic type for a block taking no arguments and returning no 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: * * os_block_t block; * if (x) { * block = ^{ printf("true\n"); }; * } else { * block = ^{ printf("false\n"); }; * } * block(); // unsafe!!! * * * What is happening behind the scenes: * * if (x) { * struct Block __tmp_1 = ...; // setup details * block = &__tmp_1; * } else { * struct Block __tmp_2 = ...; // setup details * block = &__tmp_2; * } * * * 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 (^os_block_t)(void); #endif #endif // __OS_BASE__ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/os/clock.h ================================================ #ifndef __OS_CLOCK__ #define __OS_CLOCK__ #include #include /* * @typedef os_clockid_t * * @abstract * Describes the kind of clock that the workgroup timestamp parameters are * specified in */ OS_ENUM(os_clockid, uint32_t, OS_CLOCK_MACH_ABSOLUTE_TIME = 32, ); #endif /* __OS_CLOCK__ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/os/lock.h ================================================ /* * Copyright (c) 2016 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 __OS_LOCK__ #define __OS_LOCK__ #include #include #include #include #include #include OS_ASSUME_NONNULL_BEGIN /*! @header * Low-level lock API. */ #define OS_LOCK_API_VERSION 20160309 __BEGIN_DECLS #define OS_UNFAIR_LOCK_AVAILABILITY \ __API_AVAILABLE(macos(10.12), ios(10.0), tvos(10.0), watchos(3.0)) /*! * @typedef os_unfair_lock * * @abstract * Low-level lock that allows waiters to block efficiently on contention. * * In general, higher level synchronization primitives such as those provided by * the pthread or dispatch subsystems should be preferred. * * The values stored in the lock should be considered opaque and implementation * defined, they contain thread ownership information that the system may use * to attempt to resolve priority inversions. * * This lock must be unlocked from the same thread that locked it, attempts to * unlock from a different thread will cause an assertion aborting the process. * * This lock must not be accessed from multiple processes or threads via shared * or multiply-mapped memory, the lock implementation relies on the address of * the lock value and owning process. * * Must be initialized with OS_UNFAIR_LOCK_INIT * * @discussion * Replacement for the deprecated OSSpinLock. Does not spin on contention but * waits in the kernel to be woken up by an unlock. * * As with OSSpinLock there is no attempt at fairness or lock ordering, e.g. an * unlocker can potentially immediately reacquire the lock before a woken up * waiter gets an opportunity to attempt to acquire the lock. This may be * advantageous for performance reasons, but also makes starvation of waiters a * possibility. */ OS_UNFAIR_LOCK_AVAILABILITY typedef struct os_unfair_lock_s { uint32_t _os_unfair_lock_opaque; } os_unfair_lock, *os_unfair_lock_t; #ifndef OS_UNFAIR_LOCK_INIT #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define OS_UNFAIR_LOCK_INIT ((os_unfair_lock){0}) #elif defined(__cplusplus) && __cplusplus >= 201103L #define OS_UNFAIR_LOCK_INIT (os_unfair_lock{}) #elif defined(__cplusplus) #define OS_UNFAIR_LOCK_INIT (os_unfair_lock()) #else #define OS_UNFAIR_LOCK_INIT {0} #endif #endif // OS_UNFAIR_LOCK_INIT /*! * @function os_unfair_lock_lock * * @abstract * Locks an os_unfair_lock. * * @param lock * Pointer to an os_unfair_lock. */ OS_UNFAIR_LOCK_AVAILABILITY OS_EXPORT OS_NOTHROW OS_NONNULL_ALL void os_unfair_lock_lock(os_unfair_lock_t lock); /*! * @function os_unfair_lock_trylock * * @abstract * Locks an os_unfair_lock if it is not already locked. * * @discussion * It is invalid to surround this function with a retry loop, if this function * returns false, the program must be able to proceed without having acquired * the lock, or it must call os_unfair_lock_lock() directly (a retry loop around * os_unfair_lock_trylock() amounts to an inefficient implementation of * os_unfair_lock_lock() that hides the lock waiter from the system and prevents * resolution of priority inversions). * * @param lock * Pointer to an os_unfair_lock. * * @result * Returns true if the lock was succesfully locked and false if the lock was * already locked. */ OS_UNFAIR_LOCK_AVAILABILITY OS_EXPORT OS_NOTHROW OS_WARN_RESULT OS_NONNULL_ALL bool os_unfair_lock_trylock(os_unfair_lock_t lock); /*! * @function os_unfair_lock_unlock * * @abstract * Unlocks an os_unfair_lock. * * @param lock * Pointer to an os_unfair_lock. */ OS_UNFAIR_LOCK_AVAILABILITY OS_EXPORT OS_NOTHROW OS_NONNULL_ALL void os_unfair_lock_unlock(os_unfair_lock_t lock); /*! * @function os_unfair_lock_assert_owner * * @abstract * Asserts that the calling thread is the current owner of the specified * unfair lock. * * @discussion * If the lock is currently owned by the calling thread, this function returns. * * If the lock is unlocked or owned by a different thread, this function * asserts and terminates the process. * * @param lock * Pointer to an os_unfair_lock. */ OS_UNFAIR_LOCK_AVAILABILITY OS_EXPORT OS_NOTHROW OS_NONNULL_ALL void os_unfair_lock_assert_owner(os_unfair_lock_t lock); /*! * @function os_unfair_lock_assert_not_owner * * @abstract * Asserts that the calling thread is not the current owner of the specified * unfair lock. * * @discussion * If the lock is unlocked or owned by a different thread, this function * returns. * * If the lock is currently owned by the current thread, this function asserts * and terminates the process. * * @param lock * Pointer to an os_unfair_lock. */ OS_UNFAIR_LOCK_AVAILABILITY OS_EXPORT OS_NOTHROW OS_NONNULL_ALL void os_unfair_lock_assert_not_owner(os_unfair_lock_t lock); __END_DECLS OS_ASSUME_NONNULL_END #endif // __OS_LOCK__ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/os/log.h ================================================ /* * Copyright (c) 2015-2016 Apple Inc. All rights reserved. */ #ifndef __OS_LOG_H__ #define __OS_LOG_H__ #include #include #include #include #include #include #include #if !__has_builtin(__builtin_os_log_format) #error using os/log.h requires Xcode 8 or later #endif __BEGIN_DECLS #if OS_OBJECT_SWIFT3 OS_OBJECT_DECL_SWIFT(os_log); #elif OS_OBJECT_USE_OBJC OS_OBJECT_DECL(os_log); #else typedef struct os_log_s *os_log_t; #endif /* OS_OBJECT_USE_OBJC */ /*! * @const OS_LOG_DISABLED * * @discussion * Use this to disable a specific log message. */ #if OS_LOG_TARGET_HAS_10_13_FEATURES #define OS_LOG_DISABLED OS_OBJECT_GLOBAL_OBJECT(os_log_t, _os_log_disabled) API_AVAILABLE(macosx(10.13), ios(11.0), watchos(4.0), tvos(11.0)) OS_EXPORT struct os_log_s _os_log_disabled; #else #define OS_LOG_DISABLED ((os_log_t _Nonnull)NULL) #endif /*! * @const OS_LOG_DEFAULT * * @discussion * Use this to log a message in accordance with current system settings. */ #define OS_LOG_DEFAULT OS_OBJECT_GLOBAL_OBJECT(os_log_t, _os_log_default) API_AVAILABLE(macos(10.11), ios(9.0), watchos(2.0), tvos(9.0)) OS_EXPORT struct os_log_s _os_log_default; /*! * @enum os_log_type_t * * @discussion * Supported log message types. * * @constant OS_LOG_TYPE_DEFAULT * Equivalent type for "os_log()" messages, i.e., default messages that are * always captured to memory or disk. * * @constant OS_LOG_TYPE_INFO * Equivalent type for "os_log_info()" messages, i.e., additional informational * messages. * * @constant OS_LOG_TYPE_DEBUG * Equivalent type for "os_log_debug()" messages, i.e., debug messages. * * @constant OS_LOG_TYPE_ERROR * Equivalent type for "os_log_error()" messages, i.e., messages indicating * error conditions. * * @constant OS_LOG_TYPE_FAULT * Equivalent type for "os_log_fault()" messages, i.e., messages indicating * that an unexpected condition occurred that likely indicates the presence of a * bug. */ OS_ENUM(os_log_type, uint8_t, OS_LOG_TYPE_DEFAULT = 0x00, OS_LOG_TYPE_INFO = 0x01, OS_LOG_TYPE_DEBUG = 0x02, OS_LOG_TYPE_ERROR = 0x10, OS_LOG_TYPE_FAULT = 0x11, ); /*! * @function os_log_create * * @abstract * Creates a log object to be used with other log related functions. * * @discussion * Creates a log object to be used with other log related functions. The * log object serves two purposes: (1) tag related messages by subsystem * and category name for easy filtering, and (2) control logging system * behavior for messages. * * @param subsystem * The identifier of the given subsystem should be in reverse DNS form * (i.e., com.company.mysubsystem). * * @param category * The category within the given subsystem that specifies the settings for * the log object. * * @result * Returns an os_log_t value to be passed to other os_log API calls. The * logging runtime maintains a global collection of all os_log_t objects, one * per subsystem/category pair. The os_log_t for a given subsystem/category is * created upon the first call to os_log_create and any subsequent calls return * the same object. These objects are never deallocated, so dynamic creation * (e.g. on a per-operation basis) is generally inappropriate. * * A value will always be returned to allow for dynamic enablement. */ API_AVAILABLE(macos(10.12), ios(10.0), watchos(3.0), tvos(10.0)) OS_EXPORT OS_NOTHROW OS_WARN_RESULT OS_OBJECT_RETURNS_RETAINED OS_NONNULL_ALL os_log_t os_log_create(const char *subsystem, const char *category); /*! * @function os_log_info_enabled * * @abstract * Returns if additional information is enabled * * @discussion * Returns if additional information is enabled * * @param log * Pass OS_LOG_DEFAULT or a log object previously created with os_log_create. * * @result * Returns ‘true’ if info log messages are enabled. */ #define os_log_info_enabled(log) os_log_type_enabled(log, OS_LOG_TYPE_INFO) /*! * @function os_log_debug_enabled * * @abstract * Returns if debug log messages are enabled for a particular log object. * * @discussion * Returns if debug log messages are enabled for a particular log object. * * @param log * Pass OS_LOG_DEFAULT or a log object previously created with os_log_create. * * @result * Returns ‘true’ if debug log messages are enabled. */ #define os_log_debug_enabled(log) os_log_type_enabled(log, OS_LOG_TYPE_DEBUG) /*! * @function os_log_with_type * * @abstract * Log a message using a specific type. * * @discussion * Will log a message with the provided os_log_type_t. * * @param log * Pass OS_LOG_DEFAULT or a log object previously created with os_log_create. * * @param type * Pass a valid type from os_log_type_t. * * @param format * A format string to generate a human-readable log message when the log * line is decoded. This string must be a constant string, not dynamically * generated. Supports all standard printf types in addition to %@ (objects). */ #define os_log_with_type(log, type, format, ...) __extension__({ \ os_log_t _log_tmp = (log); \ os_log_type_t _type_tmp = (type); \ if (os_log_type_enabled(_log_tmp, _type_tmp)) { \ OS_LOG_CALL_WITH_FORMAT(_os_log_impl, \ (&__dso_handle, _log_tmp, _type_tmp), format, ##__VA_ARGS__); \ } \ }) /*! * @function os_log * * @abstract * Insert a log message into the Unified Logging and Tracing system. * * @discussion * Insert a log message into the Unified Logging and Tracing system in * accordance with the preferences specified by the provided log object. * These messages cannot be disabled and therefore always captured either * to memory or disk. * * When an os_activity_id_t is present, the log message will also be scoped by * that identifier. Activities provide granular filtering of log messages * across threads and processes. * * There is a physical cap of 1024 bytes per log line for dynamic content, * such as %s and %@, that can be written to the persistence store. * All content exceeding the limit will be truncated before it is * written to disk. * * @param log * Pass OS_LOG_DEFAULT or a log object previously created with os_log_create. * * @param format * A format string to generate a human-readable log message when the log * line is decoded. This string must be a constant string, not dynamically * generated. Supports all standard printf types and %@ (objects). */ #define os_log(log, format, ...) \ os_log_with_type(log, OS_LOG_TYPE_DEFAULT, format, ##__VA_ARGS__) /*! * @function os_log_info * * @abstract * Insert an additional information log message into the Unified Logging * and Tracing system. * * @discussion * Insert a log message into the Unified Logging and Tracing system in * accordance with the preferences specified by the provided log object. * * When an os_activity_id_t is present, the log message will also be scoped by * that identifier. Activities provide granular filtering of log messages * across threads and processes. * * There is a physical cap of 256 bytes per entry for dynamic content, * i.e., %s and %@, that can be written to the persistence store. As such, * all content exceeding the limit will be truncated before written to disk. * Live streams will continue to show the full content. * * @param log * Pass OS_LOG_DEFAULT or a log object previously created with os_log_create. * * @param format * A format string to generate a human-readable log message when the log * line is decoded. This string must be a constant string, not dynamically * generated. Supports all standard printf types and %@ (objects). */ #define os_log_info(log, format, ...) \ os_log_with_type(log, OS_LOG_TYPE_INFO, format, ##__VA_ARGS__) /*! * @function os_log_debug * * @abstract * Insert a debug log message into the Unified Logging and Tracing system. * * @discussion * Insert a debug log message into the Unified Logging and Tracing system in * accordance with the preferences specified by the provided log object. * * When an os_activity_id_t is present, the log message will also be scoped by * that identifier. Activities provide granular filtering of log messages * across threads and processes. * * There is a physical cap of 256 bytes per entry for dynamic content, * i.e., %s and %@, that can be written to the persistence store. As such, * all content exceeding the limit will be truncated before written to disk. * Live streams will continue to show the full content. * * @param log * Pass OS_LOG_DEFAULT or a log object previously created with os_log_create. * * @param format * A format string to generate a human-readable log message when the log * line is decoded. This string must be a constant string, not dynamically * generated. Supports all standard printf types and %@ (objects). */ #if OS_LOG_TARGET_HAS_10_15_FEATURES #define os_log_debug(log, format, ...) __extension__({ \ os_log_t _log_tmp = (log); \ os_log_type_t _type_tmp = OS_LOG_TYPE_DEBUG; \ if (os_log_type_enabled(_log_tmp, _type_tmp)) { \ OS_LOG_CALL_WITH_FORMAT(_os_log_debug_impl, \ (&__dso_handle, _log_tmp, _type_tmp), format, ##__VA_ARGS__); \ } \ }) #else #define os_log_debug(log, format, ...) \ os_log_with_type(log, OS_LOG_TYPE_DEBUG, format, ##__VA_ARGS__) #endif // OS_LOG_TARGET_HAS_10_15_FEATURES /*! * @function os_log_error * * @abstract * Insert an error log message into the Unified Logging and Tracing system. * * @discussion * Insert an error log message into the Unified Logging and Tracing system. * * When an os_activity_id_t is present, the log message will also be scoped by * that identifier. Activities provide granular filtering of log messages * across threads and processes. * * There is a physical cap of 256 bytes per entry for dynamic content, * i.e., %s and %@, that can be written to the persistence store. As such, * all content exceeding the limit will be truncated before written to disk. * Live streams will continue to show the full content. * * Note, in a debugger, it is possible to set a breakpoint on _os_log_error_impl * to break on any error being emitted. * * A common use of os_log_error is to log failures from system calls and * library functions, including the value of errno. Like other system calls * and library functions, the os_log functions do not preserve the value of * errno across calls. errno can change even if the log message is logged * successfully. Consider saving errno into a local variable before calling * os_log, if you still need errno's value afterward. * * @param log * Pass OS_LOG_DEFAULT or a log object previously created with os_log_create. * * @param format * A format string to generate a human-readable log message when the log * line is decoded. This string must be a constant string, not dynamically * generated. Supports all standard printf types and %@ (objects). */ #if OS_LOG_TARGET_HAS_10_13_FEATURES #define os_log_error(log, format, ...) __extension__({ \ os_log_t _log_tmp = (log); \ os_log_type_t _type_tmp = OS_LOG_TYPE_ERROR; \ if (os_log_type_enabled(_log_tmp, _type_tmp)) { \ OS_LOG_CALL_WITH_FORMAT(_os_log_error_impl, \ (&__dso_handle, _log_tmp, _type_tmp), format, ##__VA_ARGS__); \ } \ }) #else #define os_log_error(log, format, ...) \ os_log_with_type(log, OS_LOG_TYPE_ERROR, format, ##__VA_ARGS__) #endif // OS_LOG_TARGET_HAS_10_13_FEATURES /*! * @function os_log_fault * * @abstract * Insert a fault log message into the Unified Logging and Tracing system. * * @discussion * Log a fault message into the Unified Logging and Tracing system. * * Faults should be used to report conditions which indicate the * presence of a bug. Faults will gather more expensive contextual information * and record it for later inspection. They may also be reported to other * debugging tools for display or aggregation. * * Note that faults should only be used for unexpected error conditions in * which there's a clear and safe recovery path. If such a path does not * exist, consider the os_crash(3) family of APIs instead. * * When an os_activity_id_t is present, the log message will also be scoped by * that identifier. Activities provide granular filtering of log messages * across threads and processes. * * There is a physical cap of 256 bytes per entry for dynamic content, * i.e., %s and %@, that can be written to the persistence store. As such, * all content exceeding the limit will be truncated before written to disk. * Live streams will continue to show the full content. * * Note, in a debugger, it is possible to set a breakpoint on _os_log_fault_impl * to break on any fault being emitted. * * @param log * Pass OS_LOG_DEFAULT or a log object previously created with os_log_create. * * @param format * A format string to generate a human-readable log message when the log * line is decoded. This string must be a constant string, not dynamically * generated. Supports all standard printf types and %@ (objects). */ #if OS_LOG_TARGET_HAS_10_13_FEATURES #define os_log_fault(log, format, ...) __extension__({ \ os_log_t _log_tmp = (log); \ os_log_type_t _type_tmp = OS_LOG_TYPE_FAULT; \ if (os_log_type_enabled(_log_tmp, _type_tmp)) { \ OS_LOG_CALL_WITH_FORMAT(_os_log_fault_impl, \ (&__dso_handle, _log_tmp, _type_tmp), format, ##__VA_ARGS__); \ } \ }) #else #define os_log_fault(log, format, ...) \ os_log_with_type(log, OS_LOG_TYPE_FAULT, format, ##__VA_ARGS__) #endif // OS_LOG_TARGET_HAS_10_13_FEATURES /*! * @function os_log_type_enabled * * @abstract * Evaluate if a specific log type is enabled before doing work * * @discussion * Evaluate if a specific log type is enabled before doing work * * @param oslog * Pass OS_LOG_DEFAULT or a log object previously created with os_log_create. * * @param type * Pass a valid type from os_log_type_t. * * @result * Will return a boolean. */ API_AVAILABLE(macos(10.12), ios(10.0), watchos(3.0), tvos(10.0)) OS_EXPORT OS_NOTHROW OS_WARN_RESULT OS_PURE bool os_log_type_enabled(os_log_t oslog, os_log_type_t type); /*! * @function _os_log_impl * * @abstract * Internal function that takes compiler generated encoding and captures the necessary content. */ API_AVAILABLE(macos(10.12), ios(10.0), watchos(3.0), tvos(10.0)) OS_EXPORT OS_NOTHROW OS_NOT_TAIL_CALLED void _os_log_impl(void *dso, os_log_t log, os_log_type_t type, const char *format, uint8_t *buf, uint32_t size); /*! * @function _os_log_debug_impl * * @abstract * Internal function that is taken for any debug log emitted in the system. */ API_AVAILABLE(macos(10.15), ios(13.0), tvos(13.0), watchos(6.0)) OS_EXPORT OS_NOTHROW OS_NOT_TAIL_CALLED OS_COLD void _os_log_debug_impl(void *dso, os_log_t log, os_log_type_t type, const char *format, uint8_t *buf, uint32_t size); /*! * @function _os_log_error_impl * * @abstract * Internal function that is taken for any error emitted in the system. */ API_AVAILABLE(macos(10.13), ios(11.0), tvos(11.0), watchos(4.0)) OS_EXPORT OS_NOTHROW OS_NOT_TAIL_CALLED OS_COLD void _os_log_error_impl(void *dso, os_log_t log, os_log_type_t type, const char *format, uint8_t *buf, uint32_t size); /*! * @function _os_log_fault_impl * * @abstract * Internal function that is taken for any fault emitted in the system. */ API_AVAILABLE(macos(10.13), ios(11.0), tvos(11.0), watchos(4.0)) OS_EXPORT OS_NOTHROW OS_NOT_TAIL_CALLED OS_COLD void _os_log_fault_impl(void *dso, os_log_t log, os_log_type_t type, const char *format, uint8_t *buf, uint32_t size); /* * Support for older iteration of API for source compatibility only... */ API_DEPRECATED("no longer supported, use os_log_debug(OS_LOG_DEFAULT, ...)", macos(10.11,10.12), ios(9.0,10.0), watchos(2.0,3.0), tvos(9.0,10.0)) OS_EXPORT OS_NOTHROW OS_NOT_TAIL_CALLED void _os_log_internal(void *dso, os_log_t log, os_log_type_t type, const char *message, ...); API_AVAILABLE(macos(10.11), ios(9.0), watchos(2.0), tvos(9.0)) OS_EXPORT OS_NOTHROW OS_WARN_RESULT OS_OBJECT_RETURNS_RETAINED OS_NOT_TAIL_CALLED OS_NONNULL_ALL os_log_t _os_log_create(void *dso, const char *subsystem, const char *category); API_DEPRECATED("no longer suppored - always returns true", macos(10.11,10.12), ios(9.0,10.0), watchos(2.0,3.0), tvos(9.0,10.0)) OS_EXPORT OS_NOTHROW OS_WARN_RESULT bool os_log_is_enabled(os_log_t log); API_DEPRECATED_WITH_REPLACEMENT("os_log_debug_enabled", macos(10.11,10.12), ios(9.0,10.0), watchos(2.0,3.0), tvos(9.0,10.0)) OS_EXPORT OS_NOTHROW OS_WARN_RESULT bool os_log_is_debug_enabled(os_log_t log); API_DEPRECATED("no longer supported - use os_log with per-parameter privacy options", macos(10.11,10.12), ios(9.0,10.0), watchos(2.0,3.0), tvos(9.0,10.0)) OS_NOTHROW OS_ALWAYS_INLINE static inline void _os_log_sensitive_deprecated(void) { } #define os_log_sensitive(log, format, ...) __extension__({ \ os_log_with_type(log, OS_LOG_TYPE_DEFAULT, format, ##__VA_ARGS__); \ _os_log_sensitive_deprecated(); \ }) #define os_log_sensitive_debug(log, format, ...) __extension__({ \ os_log_with_type(log, OS_LOG_TYPE_DEBUG, format, ##__VA_ARGS__); \ _os_log_sensitive_deprecated(); \ }) #if !OS_LOG_TARGET_HAS_10_12_FEATURES #undef os_log_with_type #define os_log_with_type(log, type, format, ...) __extension__({ \ _Pragma("clang diagnostic push") \ _Pragma("clang diagnostic error \"-Wformat\"") \ _Static_assert(__builtin_constant_p(format), "format argument must be a string constant"); \ _os_log_internal(&__dso_handle, log, type, format, ##__VA_ARGS__); \ _Pragma("clang diagnostic pop") \ }) #undef os_log_debug_enabled #define os_log_debug_enabled(...) os_log_is_debug_enabled(__VA_ARGS__) #undef os_log_create #define os_log_create(subsystem, category) \ _os_log_create(&__dso_handle, subsystem, category) #endif // !OS_LOG_TARGET_HAS_10_12_FEATURES __END_DECLS #endif // !__OS_LOG_H__ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/os/object.h ================================================ /* * Copyright (c) 2011-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 __OS_OBJECT__ #define __OS_OBJECT__ #ifdef __APPLE__ #include #include #include #include #elif defined(_WIN32) #include #elif defined(__unix__) #include #endif /*! * @header * * @preprocinfo * By default, libSystem objects such as GCD and XPC 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. * * NOTE: this requires explicit cancellation of dispatch sources and xpc * connections whose handler blocks capture the source/connection object, * resp. ensuring that such captures do not form retain cycles (e.g. by * declaring the source as __weak). * * To opt-out of this default behavior, add -DOS_OBJECT_USE_OBJC=0 to your * compiler flags. * * This mode requires a platform with the modern Objective-C runtime, the * Objective-C GC compiler option to be disabled, and at least a Mac OS X 10.8 * or iOS 6.0 deployment target. */ #ifndef OS_OBJECT_HAVE_OBJC_SUPPORT #if !defined(__OBJC__) || defined(__OBJC_GC__) # define OS_OBJECT_HAVE_OBJC_SUPPORT 0 #elif !defined(TARGET_OS_MAC) || !TARGET_OS_MAC # define OS_OBJECT_HAVE_OBJC_SUPPORT 0 #elif TARGET_OS_IOS && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_6_0 # define OS_OBJECT_HAVE_OBJC_SUPPORT 0 #elif TARGET_OS_MAC && !TARGET_OS_IPHONE # if __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_8 # define OS_OBJECT_HAVE_OBJC_SUPPORT 0 # elif defined(__i386__) && __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_12 # define OS_OBJECT_HAVE_OBJC_SUPPORT 0 # else # define OS_OBJECT_HAVE_OBJC_SUPPORT 1 # endif #else # define OS_OBJECT_HAVE_OBJC_SUPPORT 1 #endif #endif // OS_OBJECT_HAVE_OBJC_SUPPORT #if OS_OBJECT_HAVE_OBJC_SUPPORT #if defined(__swift__) && __swift__ && !OS_OBJECT_USE_OBJC #define OS_OBJECT_USE_OBJC 1 #endif #ifndef OS_OBJECT_USE_OBJC #define OS_OBJECT_USE_OBJC 1 #endif #elif defined(OS_OBJECT_USE_OBJC) && OS_OBJECT_USE_OBJC /* Unsupported platform for OS_OBJECT_USE_OBJC=1 */ #undef OS_OBJECT_USE_OBJC #define OS_OBJECT_USE_OBJC 0 #else #define OS_OBJECT_USE_OBJC 0 #endif #ifndef OS_OBJECT_SWIFT3 #ifdef __swift__ #define OS_OBJECT_SWIFT3 1 #else // __swift__ #define OS_OBJECT_SWIFT3 0 #endif // __swift__ #endif // OS_OBJECT_SWIFT3 #if __has_feature(assume_nonnull) #define OS_OBJECT_ASSUME_NONNULL_BEGIN _Pragma("clang assume_nonnull begin") #define OS_OBJECT_ASSUME_NONNULL_END _Pragma("clang assume_nonnull end") #else #define OS_OBJECT_ASSUME_NONNULL_BEGIN #define OS_OBJECT_ASSUME_NONNULL_END #endif #define OS_OBJECT_WARN_UNUSED_RESULT __attribute__((__warn_unused_result__)) #if OS_OBJECT_USE_OBJC #import #if __has_attribute(objc_independent_class) #define OS_OBJC_INDEPENDENT_CLASS __attribute__((objc_independent_class)) #endif // __has_attribute(objc_independent_class) #ifndef OS_OBJC_INDEPENDENT_CLASS #define OS_OBJC_INDEPENDENT_CLASS #endif #define OS_OBJECT_CLASS(name) OS_##name #define OS_OBJECT_DECL_PROTOCOL(name, ...) \ @protocol OS_OBJECT_CLASS(name) __VA_ARGS__ \ @end #define OS_OBJECT_CLASS_IMPLEMENTS_PROTOCOL_IMPL(name, proto) \ @interface name () \ @end #define OS_OBJECT_CLASS_IMPLEMENTS_PROTOCOL(name, proto) \ OS_OBJECT_CLASS_IMPLEMENTS_PROTOCOL_IMPL( \ OS_OBJECT_CLASS(name), OS_OBJECT_CLASS(proto)) #define OS_OBJECT_DECL_IMPL(name, adhere, ...) \ OS_OBJECT_DECL_PROTOCOL(name, __VA_ARGS__) \ typedef adhere \ * OS_OBJC_INDEPENDENT_CLASS name##_t #define OS_OBJECT_DECL_BASE(name, ...) \ @interface OS_OBJECT_CLASS(name) : __VA_ARGS__ \ - (instancetype)init OS_SWIFT_UNAVAILABLE("Unavailable in Swift"); \ @end #define OS_OBJECT_DECL_IMPL_CLASS(name, ...) \ OS_OBJECT_DECL_BASE(name, ## __VA_ARGS__) \ typedef OS_OBJECT_CLASS(name) \ * OS_OBJC_INDEPENDENT_CLASS name##_t #define OS_OBJECT_DECL(name, ...) \ OS_OBJECT_DECL_IMPL(name, NSObject, ) #define OS_OBJECT_DECL_SUBCLASS(name, super) \ OS_OBJECT_DECL_IMPL(name, NSObject, ) #if __has_attribute(ns_returns_retained) #define OS_OBJECT_RETURNS_RETAINED __attribute__((__ns_returns_retained__)) #else #define OS_OBJECT_RETURNS_RETAINED #endif #if __has_attribute(ns_consumed) #define OS_OBJECT_CONSUMED __attribute__((__ns_consumed__)) #else #define OS_OBJECT_CONSUMED #endif #if __has_feature(objc_arc) #define OS_OBJECT_BRIDGE __bridge #define OS_WARN_RESULT_NEEDS_RELEASE #else #define OS_OBJECT_BRIDGE #define OS_WARN_RESULT_NEEDS_RELEASE OS_WARN_RESULT #endif #if __has_attribute(objc_runtime_visible) && \ ((defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && \ __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_12) || \ (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && \ !defined(__TV_OS_VERSION_MIN_REQUIRED) && \ !defined(__WATCH_OS_VERSION_MIN_REQUIRED) && \ __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_10_0) || \ (defined(__TV_OS_VERSION_MIN_REQUIRED) && \ __TV_OS_VERSION_MIN_REQUIRED < __TVOS_10_0) || \ (defined(__WATCH_OS_VERSION_MIN_REQUIRED) && \ __WATCH_OS_VERSION_MIN_REQUIRED < __WATCHOS_3_0)) /* * To provide backward deployment of ObjC objects in Swift on pre-10.12 * SDKs, OS_object classes can be marked as OS_OBJECT_OBJC_RUNTIME_VISIBLE. * When compiling with a deployment target earlier than OS X 10.12 (iOS 10.0, * tvOS 10.0, watchOS 3.0) the Swift compiler will only refer to this type at * runtime (using the ObjC runtime). */ #define OS_OBJECT_OBJC_RUNTIME_VISIBLE __attribute__((objc_runtime_visible)) #else #define OS_OBJECT_OBJC_RUNTIME_VISIBLE #endif #ifndef OS_OBJECT_USE_OBJC_RETAIN_RELEASE #if defined(__clang_analyzer__) #define OS_OBJECT_USE_OBJC_RETAIN_RELEASE 1 #elif __has_feature(objc_arc) && !OS_OBJECT_SWIFT3 #define OS_OBJECT_USE_OBJC_RETAIN_RELEASE 1 #else #define OS_OBJECT_USE_OBJC_RETAIN_RELEASE 0 #endif #endif #if OS_OBJECT_SWIFT3 #define OS_OBJECT_DECL_SWIFT(name) \ OS_EXPORT OS_OBJECT_OBJC_RUNTIME_VISIBLE \ OS_OBJECT_DECL_IMPL_CLASS(name, NSObject) #define OS_OBJECT_DECL_SUBCLASS_SWIFT(name, super) \ OS_EXPORT OS_OBJECT_OBJC_RUNTIME_VISIBLE \ OS_OBJECT_DECL_IMPL_CLASS(name, OS_OBJECT_CLASS(super)) #endif // OS_OBJECT_SWIFT3 OS_EXPORT OS_OBJECT_OBJC_RUNTIME_VISIBLE OS_OBJECT_DECL_BASE(object, NSObject); #else /*! @parseOnly */ #define OS_OBJECT_RETURNS_RETAINED /*! @parseOnly */ #define OS_OBJECT_CONSUMED /*! @parseOnly */ #define OS_OBJECT_BRIDGE /*! @parseOnly */ #define OS_WARN_RESULT_NEEDS_RELEASE OS_WARN_RESULT /*! @parseOnly */ #define OS_OBJECT_OBJC_RUNTIME_VISIBLE #define OS_OBJECT_USE_OBJC_RETAIN_RELEASE 0 #endif #if OS_OBJECT_SWIFT3 #define OS_OBJECT_DECL_CLASS(name) \ OS_OBJECT_DECL_SUBCLASS_SWIFT(name, object) #elif OS_OBJECT_USE_OBJC #define OS_OBJECT_DECL_CLASS(name) \ OS_OBJECT_DECL(name) #else #define OS_OBJECT_DECL_CLASS(name) \ typedef struct name##_s *name##_t #endif #if OS_OBJECT_USE_OBJC /* Declares a class of the specific name and exposes the interface and typedefs * name##_t to the pointer to the class */ #define OS_OBJECT_SHOW_CLASS(name, ...) \ OS_EXPORT OS_OBJECT_OBJC_RUNTIME_VISIBLE \ OS_OBJECT_DECL_IMPL_CLASS(name, ## __VA_ARGS__ ) /* Declares a subclass of the same name, and * subclass adheres to protocol specified. Typedefs baseclass * to subclass##_t */ #define OS_OBJECT_SHOW_SUBCLASS(subclass_name, super, proto_name) \ OS_EXPORT OS_OBJECT_OBJC_RUNTIME_VISIBLE \ OS_OBJECT_DECL_BASE(subclass_name, OS_OBJECT_CLASS(super)); \ typedef OS_OBJECT_CLASS(super) \ * OS_OBJC_INDEPENDENT_CLASS subclass_name##_t #else /* Plain C */ #define OS_OBJECT_DECL_PROTOCOL(name, ...) #define OS_OBJECT_SHOW_CLASS(name, ...) \ typedef struct name##_s *name##_t #define OS_OBJECT_SHOW_SUBCLASS(name, super, ...) \ typedef super##_t name##_t #endif #define OS_OBJECT_GLOBAL_OBJECT(type, object) ((OS_OBJECT_BRIDGE type)&(object)) __BEGIN_DECLS /*! * @function os_retain * * @abstract * Increment the reference count of an os_object. * * @discussion * On a platform with the modern Objective-C runtime this is exactly equivalent * to sending the object the -[retain] message. * * @param object * The object to retain. * * @result * The retained object. */ API_AVAILABLE(macos(10.10), ios(8.0)) OS_EXPORT OS_SWIFT_UNAVAILABLE("Can't be used with ARC") void* os_retain(void *object); #if OS_OBJECT_USE_OBJC #undef os_retain #define os_retain(object) [object retain] #endif /*! * @function os_release * * @abstract * Decrement the reference count of a os_object. * * @discussion * On a platform with the modern Objective-C runtime this is exactly equivalent * to sending the object the -[release] message. * * @param object * The object to release. */ API_AVAILABLE(macos(10.10), ios(8.0)) OS_EXPORT void OS_SWIFT_UNAVAILABLE("Can't be used with ARC") os_release(void *object); #if OS_OBJECT_USE_OBJC #undef os_release #define os_release(object) [object release] #endif __END_DECLS #endif ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/os/overflow.h ================================================ /* * Copyright (c) 2015-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@ */ /* * Facilities for performing type- and overflow-checked arithmetic. These * functions return non-zero if overflow occured, zero otherwise. In either case, * the potentially overflowing operation is fully performed, mod the size of the * output type. See: * http://clang.llvm.org/docs/LanguageExtensions.html#checked-arithmetic-builtins * for full details. * * The compiler enforces that users of os_*_overflow() check the return value to * determine whether overflow occured. */ #ifndef _OS_OVERFLOW_H #define _OS_OVERFLOW_H #include #include #include bool __header_always_inline OS_WARN_RESULT __os_warn_unused(__const bool x) { return x; } #if __has_builtin(__builtin_add_overflow) && \ __has_builtin(__builtin_sub_overflow) && \ __has_builtin(__builtin_mul_overflow) #define os_add_overflow(a, b, res) __os_warn_unused(__builtin_add_overflow((a), (b), (res))) #define os_sub_overflow(a, b, res) __os_warn_unused(__builtin_sub_overflow((a), (b), (res))) #define os_mul_overflow(a, b, res) __os_warn_unused(__builtin_mul_overflow((a), (b), (res))) #else # error os_overflow expects type-generic builtins #endif /* __has_builtin(...) */ /* os_add3_overflow(a, b, c) -> (a + b + c) */ #define os_add3_overflow(a, b, c, res) __os_warn_unused(__extension__({ \ __typeof(*(res)) _tmp; \ bool _s, _t; \ _s = os_add_overflow((a), (b), &_tmp); \ _t = os_add_overflow((c), _tmp, (res)); \ _s | _t; \ })) /* os_mul3_overflow(a, b, c) -> (a * b * c) */ #define os_mul3_overflow(a, b, c, res) __os_warn_unused(__extension__({ \ __typeof(*(res)) _tmp; \ bool _s, _t; \ _s = os_mul_overflow((a), (b), &_tmp); \ _t = os_mul_overflow((c), _tmp, (res)); \ _s | _t; \ })) /* os_add_and_mul_overflow(a, b, x) -> (a + b)*x */ #define os_add_and_mul_overflow(a, b, x, res) __os_warn_unused(__extension__({ \ __typeof(*(res)) _tmp; \ bool _s, _t; \ _s = os_add_overflow((a), (b), &_tmp); \ _t = os_mul_overflow((x), _tmp, (res)); \ _s | _t; \ })) /* os_mul_and_add_overflow(a, x, b) -> a*x + b */ #define os_mul_and_add_overflow(a, x, b, res) __os_warn_unused(__extension__({ \ __typeof(*(res)) _tmp; \ bool _s, _t; \ _s = os_mul_overflow((a), (x), &_tmp); \ _t = os_add_overflow((b), _tmp, (res)); \ _s | _t; \ })) /* os_convert_overflow(a) -> a [converted to the result type] */ #define os_convert_overflow(a, res) os_add_overflow((a), 0, (res)) /* os_inc_overflow(res) -> *res += 1 */ #define os_inc_overflow(res) __os_warn_unused(__extension__({ \ __typeof((res)) _tmp = (res); \ os_add_overflow(*_tmp, 1, _tmp); \ })) /* os_dec_overflow(res) -> *res -= 1 */ #define os_dec_overflow(res) __os_warn_unused(__extension__({ \ __typeof((res)) _tmp = (res); \ os_sub_overflow(*_tmp, 1, _tmp); \ })) #endif /* _OS_OVERFLOW_H */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/os/proc.h ================================================ /* * Copyright (c) 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@ */ #ifndef __OS_PROC__ #define __OS_PROC__ #include #include #include /*! * @header * * @preprocinfo * This is for functions that operate on the calling process alone. */ __BEGIN_DECLS /*! * @function os_proc_available_memory * * @abstract * Return the number of bytes remaining, at the time of the call, before the * current process will hit its current dirty memory limit. * * @discussion * Developers can query this value efficiently whenever it is needed. The return * value is only a snapshot at the time of the call. Caching the result is not * advised. The result may be instantaneously invalidated by actions taken in * another thread or another framework. * * Memory limits can change during the app life cycle. Make sure to check accordingly. * * The size returned is not representative of the total memory of the device, it * is the current dirty memory limit minus the dirty memory footprint used at the * time of the query. * * This interface allows an app to efficiently consume all available memory resources. * Significant memory use, even under the current memory limit, may still cause * system-wide performance including the termination of other apps and system * processes. Take care to use the minimum amount of memory needed to satisfy the * user’s need. * * If you need more information than just the available memory, you can use task_info(). * The information returned is equivalent to the task_vm_info.limit_bytes_remaining * field. task_info() is a more expensive call, and will return information such * as your phys_footprint, which is used to calculate the return of this function. * * Dirty memory contains data that must be kept in RAM (or the equivalent) even * when unused. It is memory that has been modified. * * @param none * * @result * The remaining bytes. 0 is returned if the calling process is not an app, or * the calling process exceeds its memory limit. */ API_UNAVAILABLE(macos) API_AVAILABLE(ios(13.0), tvos(13.0), watchos(6.0)) extern size_t os_proc_available_memory(void); __END_DECLS #endif ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/os/signpost.h ================================================ /* * Copyright (c) 2017-2018 Apple Inc. All rights reserved. */ #ifndef __OS_SIGNPOST_H__ #define __OS_SIGNPOST_H__ #include __BEGIN_DECLS OS_ASSUME_NONNULL_BEGIN /*! * @header os_signpost * * The os_signpost APIs let clients add lightweight instrumentation to * code for collection and visualization by performance analysis tooling. * * Clients of os_signpost can instrument interesting periods of time * ('intervals') and single points in time ('events'). Intervals can span * processes, be specific to one process, or be specific to a single thread. * * Intervals and events include an os_log-style format string and arguments * which can be used to convey contextual information. */ #pragma mark - Interval Matching Scope /*! * The matching scope for signpost intervals logged with a given os_log_t is * specified in that log handles's configuration plist using the * 'Signpost-Scope' key and defaults to process-wide scope (i.e. 'Process' * value) if unspecified. * * Signpost interval begin and end matching can have 3 different scopes: * * - Thread-wide: The search scope for matching begins and ends is restricted to * single threads. To set this as the search scope for an os_log_t, set * 'Thread' as the string value for the 'Signpost-Scope' key in the * os_log_t's configuration plist. * * - Process-wide (Default value): The search scope for matching begins and ends * is restricted to a single process. (i.e. no cross-process intervals) * To set this as the search scope for an os_log_t, set * 'Process' as the string value for the 'Signpost-Scope' key in the * os_log_t's configuration plist or do not specify any 'Signpost-Scope' key- * value pair. * * - System-wide: The search scope for matching begins and ends is not * restricted. (i.e. cross-process intervals are possible) * To set this as the search scope for an os_log_t, set * 'System' as the string value for the 'Signpost-Scope' key in the * os_log_t's configuration plist. * */ #pragma mark - Signpost IDs /*! * Disambiguating intervals with signpost IDs * * Intervals with the same log handle and interval name can be in flight * simultaneously. In order for tools to correctly match begin signposts with * end signposts, it is necessary to identify each interval with an * os_signpost_id_t. * * If only one interval with a given os_log_t and interval name will ever be in * flight at a time, use the os_signpost_t convenience value * OS_SIGNPOST_ID_EXCLUSIVE. This can avoid having to share state between begin * and end callsites. * * If there exists some non-pointer uint64_t value that uniquely identifies * begin/end pairs, that value can be cast directly to an os_signpost_id_t. * Note that the values OS_SIGNPOST_ID_NULL and OS_SIGNPOST_ID_INVALID are * reserved and identical values may not be used in this manner. * * If there exists a pointer which can identify begin/end pairs, an * os_signpost_id_t can be generated from that pointer with * os_signpost_id_make_with_pointer(). This approach is not applicable to * signposts that span process boundaries. * * If no existing pointer or value is applicable, a new unique value can be * generated using the os_signpost_id_generate() function. The returned value * is guaranteed to be unique within the matching scope specified on the log * handle. */ /*! * @typedef os_signpost_id_t * * @brief * The type to represent a signpost ID. * * @discussion. * Any 64-bit value can be cast to an os_signpost_id_t except for the * OS_SIGNPOST_ID_NULL and OS_SIGNPOST_ID_INVALID reserved values. * * @const OS_SIGNPOST_ID_NULL * Represents the null (absent) signpost ID. It is used by the signpost * subsystem when a given signpost is disabled. * * @const OS_SIGNPOST_ID_INVALID * Represents an invalid signpost ID, which signals that an error has occurred. * * @const OS_SIGNPOST_ID_EXCLUSIVE * A convenience value for signpost intervals that will never occur * concurrently. */ typedef uint64_t os_signpost_id_t; #ifndef __swift__ #define OS_SIGNPOST_ID_NULL ((os_signpost_id_t)0) #define OS_SIGNPOST_ID_INVALID ((os_signpost_id_t)~0) #define OS_SIGNPOST_ID_EXCLUSIVE ((os_signpost_id_t)0xEEEEB0B5B2B2EEEE) #endif /*! * @function os_signpost_id_make_with_pointer * * @abstract * Make an os_signpost_id from a pointer value. * * @discussion * Mangles the pointer to create a valid os_signpost_id, including removing * address randomization. Checks that the signpost matching scope is not * system-wide. * * @param log * Log handle previously created with os_log_create. * * @param ptr * Any pointer that disambiguates among concurrent intervals with the same * os_log_t and interval names. * * @result * Returns a valid os_signpost_id_t. Returns OS_SIGNPOST_ID_NULL if signposts * are turned off. Returns OS_SIGNPOST_ID_INVALID if the log handle is * system-scoped. */ API_AVAILABLE(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0)) OS_EXPORT OS_NOTHROW os_signpost_id_t os_signpost_id_make_with_pointer(os_log_t log, const void *_Nullable ptr); #if __OBJC__ /*! * @function os_signpost_id_make_with_id * * @abstract * Make an os_signpost_id from an Objective-C id, as in * os_signpost_id_make_with_pointer. */ #define os_signpost_id_make_with_id(log, ptr) \ os_signpost_id_make_with_pointer(log, (__bridge const void *_Nullable)(ptr)) #endif /* __OBJC__ */ /*! * @function os_signpost_id_generate * * @abstract * Generates an ID guaranteed to be unique within the matching scope of the * provided log handle. * * @discussion * Each call to os_signpost_id_generate() with a given log handle and its * matching scope will return a different os_signpost_id_t. * * @param log * Log handle previously created with os_log_create. * * @result * Returns a valid os_signpost_id_t. Returns OS_SIGNPOST_ID_NULL if signposts * are disabled. */ API_AVAILABLE(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0)) OS_EXPORT OS_NOTHROW OS_WARN_RESULT os_signpost_id_t os_signpost_id_generate(os_log_t log); #pragma mark - Signpost Enablement /*! * @function os_signpost_enabled * * @abstract * Returns true if signpost log messages are enabled for a particular log * handle. * * @discussion * Returns true if signpost log messages are enabled for a particular log. * Use this to avoid doing expensive argument marshalling leading into a call * to os_signpost_* * * @param log * Log handle previously created with os_log_create. * * @result * Returns ‘true’ if signpost log messages are enabled. */ API_AVAILABLE(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0)) OS_EXPORT OS_NOTHROW OS_PURE OS_WARN_RESULT bool os_signpost_enabled(os_log_t log); #pragma mark - Interval begin/end /*! * @function os_signpost_interval_begin * * @abstract * Begins a signposted interval. * * @param log * Log handle previously created with os_log_create. * * @param interval_id * An ID for the event, see Signpost IDs above. * * @param name * The name of this event. This must be a string literal. * * @param ... (format + arguments) * Additional information to include with this signpost. This format string * must be a string literal, as with the os_log family of functions. */ #define os_signpost_interval_begin(log, interval_id, name, ...) \ os_signpost_emit_with_type(log, OS_SIGNPOST_INTERVAL_BEGIN, \ interval_id, name, ##__VA_ARGS__) /*! * @function os_signpost_animation_interval_begin * * @abstract * Begins a signposted interval that is tagged as an animation. * * @param log * Log handle previously created with os_log_create. * * @param interval_id * An ID for the event, see Signpost IDs above. * * @param name * The name of this event. This must be a string literal. * * @param ... (format + arguments) * Additional information to include with this signpost. This format string * must be a string literal, as with the os_log family of functions. */ #define os_signpost_animation_interval_begin(log, interval_id, name, ...) \ _os_signpost_animation_interval_begin(log, interval_id, name, \ "" __VA_ARGS__) /*! * @function os_signpost_interval_end * * @abstract * Ends a signposted interval. * * @param log * The log handle which was provided to os_signpost_interval_begin, * * @param interval_id * The ID for the event which was provided to os_signpost_interval_begin. See * Signpost IDs above. * * @param name * The name of the event provided to os_signost_interval_begin. This must be a * string literal. * * @param ... (format + arguments) * Additional information to include with this signpost. This format string * must be a string literal, as with the os_log family of functions. */ #define os_signpost_interval_end(log, interval_id, name, ...) \ os_signpost_emit_with_type(log, OS_SIGNPOST_INTERVAL_END, \ interval_id, name, ##__VA_ARGS__) #pragma mark - Signpost event marking /*! * @function os_signpost_event_emit * * @abstract * os_signpost_event_emit marks a point of interest in time with no duration. * * @param log * Log handle previously created with os_log_create. * * @param event_id * An ID for the event, see Signpost IDs above. This ID can be used to convey * additional information about the event that is being emitted without * incurring extra performance overhead. * * @param name * The name of this event. This must be a string literal. * * @param ... (format + arguments) * Additional information to include with this signpost. This format string * must be a string literal, as with the os_log family of functions. */ #define os_signpost_event_emit(log, event_id, name, ...) \ os_signpost_emit_with_type(log, OS_SIGNPOST_EVENT, \ event_id, name, ##__VA_ARGS__) #pragma mark - Points of Interest /*! * @const OS_LOG_CATEGORY_POINTS_OF_INTEREST * * Provide this value as the category to os_log_create to indicate that * signposts on the resulting log handle provide high-level events that can be * used to orient a developer looking at performance data. These will be * displayed by default by performance tools like Instruments.app. */ #ifndef __swift__ #define OS_LOG_CATEGORY_POINTS_OF_INTEREST "PointsOfInterest" #endif #pragma mark - Dynamic Tracing /*! * @const OS_LOG_CATEGORY_DYNAMIC_TRACING * * Provide this value as the category to os_log_create to indicate that * signposts emitted to the resulting log handle should be disabled by * default, reducing the runtime overhead. os_signpost_enabled calls on * the resulting log handle will only return 'true' when a performance * tool like Instruments.app is recording. */ #if OS_LOG_TARGET_HAS_10_15_FEATURES #ifndef __swift__ #define OS_LOG_CATEGORY_DYNAMIC_TRACING "DynamicTracing" #endif #endif /*! * @const OS_LOG_CATEGORY_DYNAMIC_STACK_TRACING * * Provide this value as the category to os_log_create to indicate that * signposts emitted to the resulting log handle should capture user * backtraces. This behavior is more expensive, so os_signpost_enabled * will only return 'true' when a performance tool like Instruments.app * is recording. */ #if OS_LOG_TARGET_HAS_10_15_FEATURES #ifndef __swift__ #define OS_LOG_CATEGORY_DYNAMIC_STACK_TRACING "DynamicStackTracing" #endif #endif #pragma mark - Signpost Internals /*! * @typedef os_signpost_type_t * * @brief * The type of a signpost tracepoint, do not use directly. */ OS_ENUM(os_signpost_type, uint8_t, OS_SIGNPOST_EVENT = 0x00, OS_SIGNPOST_INTERVAL_BEGIN = 0x01, OS_SIGNPOST_INTERVAL_END = 0x02, ); #ifndef __swift__ #define OS_SIGNPOST_TYPE_MASK 0x03 #endif #define _OS_SIGNPOST_ANIMATION_INTERVAL_TAG "isAnimation=YES" #define _os_signpost_animation_interval_begin(log, spid, name, fmt, ...) \ os_signpost_interval_begin(log, spid, name, \ fmt " " _OS_SIGNPOST_ANIMATION_INTERVAL_TAG, \ ##__VA_ARGS__) API_AVAILABLE(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0)) OS_EXPORT OS_NOTHROW OS_NOT_TAIL_CALLED void _os_signpost_emit_with_name_impl(void *dso, os_log_t log, os_signpost_type_t type, os_signpost_id_t spid, const char *name, const char *format, uint8_t *buf, uint32_t size); #define _os_signpost_emit_with_type(emitfn, log, type, spid, name, ...) \ __extension__({ \ os_log_t _log_tmp = (log); \ os_signpost_type_t _type_tmp = (type); \ os_signpost_id_t _spid_tmp = (spid); \ if (_spid_tmp != OS_SIGNPOST_ID_NULL && \ _spid_tmp != OS_SIGNPOST_ID_INVALID && \ os_signpost_enabled(_log_tmp)) { \ OS_LOG_CALL_WITH_FORMAT_NAME((emitfn), \ (&__dso_handle, _log_tmp, _type_tmp, _spid_tmp), \ name, "" __VA_ARGS__); \ } \ }) #if OS_LOG_TARGET_HAS_10_14_FEATURES #define os_signpost_emit_with_type(log, type, spid, name, ...) \ _os_signpost_emit_with_type(_os_signpost_emit_with_name_impl, log, \ type, spid, name, ##__VA_ARGS__) #else #define os_signpost_emit_with_type(log, type, spid, name, ...) \ __extension__({ \ if (_os_signpost_emit_with_name_impl != NULL) { \ _os_signpost_emit_with_type(_os_signpost_emit_with_name_impl, log, \ type, spid, name, ##__VA_ARGS__); \ } \ }) #endif OS_ASSUME_NONNULL_END __END_DECLS #endif // __OS_SIGNPOST_H__ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/os/trace.h ================================================ /* * Copyright (c) 2013-2016 Apple Inc. All rights reserved. */ #ifndef __OS_TRACE_H__ #define __OS_TRACE_H__ #include #if __has_include() #include typedef xpc_object_t os_trace_payload_object_t; #else typedef void *os_trace_payload_object_t; #endif #if !__GNUC__ #error "must be GNU C compatible" #endif __BEGIN_DECLS /* We need at least clang 7.3 or later due to bugs in os_log_format parsing */ #if __has_builtin(__builtin_os_log_format) && (__clang_major__ > 7 || (__clang_major__ == 7 && __clang_minor__ >= 3)) OS_ALWAYS_INLINE __attribute__((format(os_trace, 1, 2))) static inline void _os_trace_verify_printf(const char *msg, ...) { #pragma unused(msg) } #if __has_attribute(uninitialized) #define OS_TRACE_UNINITIALIZED __attribute__((uninitialized)) #else #define OS_TRACE_UNINITIALIZED #endif /* Previous OSes must go through older style... * * Format: * Items: [ ] * Item sizes: [ * 8 bits * count * ] * Item count: 8 bits */ #define OS_TRACE_CALL(_t, _p, _f, ...) __extension__({ \ if (os_trace_type_enabled(_t)) { \ _os_trace_verify_printf(_f, ##__VA_ARGS__); \ OS_LOG_STRING(TRACE, __f, _f); \ uint32_t __size = (uint32_t)__builtin_os_log_format_buffer_size(_f, ##__VA_ARGS__); \ OS_TRACE_UNINITIALIZED uint8_t _buf[__size]; \ __builtin_os_log_format(_buf, _f, ##__VA_ARGS__); \ uint32_t tz = 0; \ OS_TRACE_UNINITIALIZED uint8_t tb[__size]; \ uint8_t *buff = _buf; \ uint8_t *p = ++buff; \ uint8_t count = *p++; \ uint8_t trailer[count + 1]; \ trailer[count] = count; \ for (uint8_t ii = 0; ii < count; ii++) { \ uint8_t desc = *p++; \ uint8_t size = *p++; \ uint8_t *value = p; \ p += size; \ if ((desc >> 4) || (desc & 0x1)) { \ size = 0;\ }\ if (size) {\ memcpy(&tb[tz], value, size);\ tz += size;\ }\ trailer[ii] = size;\ }\ memcpy(&tb[tz], trailer, sizeof(trailer));\ tz += sizeof(trailer);\ _os_trace_with_buffer(&__dso_handle, __f, _t, tb, tz, _p);\ } \ }) #else #define OS_TRACE_CALL(...) #endif // macros to re-order arguments so we can call log function #define _os_trace_with_payload_1(_t, _f, _p) OS_TRACE_CALL(_t, _p, _f) #define _os_trace_with_payload_2(_t, _f, _1, _p) OS_TRACE_CALL(_t, _p, _f, _1) #define _os_trace_with_payload_3(_t, _f, _1, _2, _p) OS_TRACE_CALL(_t, _p, _f, _1, _2) #define _os_trace_with_payload_4(_t, _f, _1, _2, _3, _p) OS_TRACE_CALL(_t, _p, _f, _1, _2, _3) #define _os_trace_with_payload_5(_t, _f, _1, _2, _3, _4, _p) OS_TRACE_CALL(_t, _p, _f, _1, _2, _3, _4) #define _os_trace_with_payload_6(_t, _f, _1, _2, _3, _4, _5, _p) OS_TRACE_CALL(_t, _p, _f, _1, _2, _3, _4, _5) #define _os_trace_with_payload_7(_t, _f, _1, _2, _3, _4, _5, _6, _p) OS_TRACE_CALL(_t, _p, _f, _1, _2, _3, _4, _5, _6) #define _os_trace_with_payload_8(_t, _f, _1, _2, _3, _4, _5, _6, _7, _p) OS_TRACE_CALL(_t, _p, _f, _1, _2, _3, _4, _5, _6, _7) #define _os_trace_call_n(_t, _f, ...) OS_TRACE_CALL(_t, NULL, _f, ##__VA_ARGS__) /*! * * @abstract * Hashtags in trace messages * * @discussion * Developers are encouraged to include hashtags in log messages, regardless of * what API you use. * A hashtag is composed of a hash (#) symbol, followed by at least three * non-whitespace characters, terminated by whitespace or the end of the * message. Hashtags may not begin with a number. * * Below is the list of predefined tags: * #System - Message in the context of a system process. * #User - Message in the context of a user process. * #Developer - Message in the context of software development. For example, * deprecated APIs and debugging messages. * #Attention - Message that should be investigated by a system * administrator, because it may be a sign of a larger issue. * For example, errors from a hard drive controller that * typically occur when the drive is about to fail. * #Critical - Message in the context of a critical event or failure. * #Error - Message that is a noncritical error. * #Comment - Message that is a comment. * #Marker - Message that marks a change to divide the messages around it * into those before and those after the change. * #Clue - Message containing extra key/value pairs with additional * information to help reconstruct the context. * #Security - Message related to security concerns. * #Filesystem - Message describing a file system related event. * #Network - Message describing a network-related event. * #Hardware - Message describing a hardware-related event. * #CPU - Message describing CPU related event, e.g., initiating heavy * work load * #State - Message describing state changed, e.g., global state, * preference, etc. * #Graphics - Message describing significant graphics event * #Disk - Message describing disk activity * */ #pragma mark - Other defines /*! * @define OS_TRACE_TYPE_RELEASE * Trace messages to be captured on a typical user install. These should be * limited to things which improve diagnosis of a failure/crash/hang. Trace * buffers are generally smaller on a production system. */ #define OS_TRACE_TYPE_RELEASE (1u << 0) /*! * @define OS_TRACE_TYPE_DEBUG * Trace messages to be captured while debugger or other development tool is * attached to the originator. */ #define OS_TRACE_TYPE_DEBUG (1u << 1) /*! * @define OS_TRACE_TYPE_INFO * Trace messages that are captured when a debugger is attached, system or * Application mode has been increased to include additional information. */ #define OS_TRACE_TYPE_INFO (1u << 2) /*! * @define OS_TRACE_TYPE_ERROR * Trace the message as an error and force a collection as a failure may be * imminent. */ #define OS_TRACE_TYPE_ERROR ((1u << 6) | (1u << 0)) /*! * @define OS_TRACE_TYPE_FAULT * Trace the message as a fatal error which forces a collection and a diagnostic * to be initiated. */ #define OS_TRACE_TYPE_FAULT ((1u << 7) | (1u << 6) | (1u << 0)) /*! * @typedef os_trace_payload_t * * @abstract * A block that populates an xpc_object_t of type XPC_TYPE_DICTIONARY to * represent complex data. * * @discussion * This block will only be invoked under conditions where tools have attached to * the process. The payload can be used to send arbitrary data via the trace * call. Tools may use the data to validate state for integration tests or * provide other introspection services. No assumptions are made about the * format or structure of the data. */ #ifdef __BLOCKS__ typedef void (^os_trace_payload_t)(os_trace_payload_object_t xdict); #else typedef void *os_trace_payload_t; #endif // __BLOCKS__ #pragma mark - function declarations /*! * @function os_trace * * @abstract * Always inserts a trace message into a buffer pool for later decoding. * * @discussion * Trace message that will be recorded on a typical user install. These should * be limited to things which help diagnose a failure during postmortem * analysis. Trace buffers are generally smaller on a production system. * * @param format * A printf-style format string to generate a human-readable log message when * the trace line is decoded. Only scalar types are supported, attempts * to pass arbitrary strings will store a pointer that is unresolvable and * will generate an error during decode. * * * os_trace("network event: %ld, last seen: %ld, avg: %g", * event_id, last_seen, avg); * */ #define os_trace(format, ...) OS_TRACE_CALL(OS_TRACE_TYPE_RELEASE, NULL, format, ##__VA_ARGS__) #if OS_LOG_TARGET_HAS_10_12_FEATURES /*! * @function os_trace_info * * @abstract * Optionally inserts a trace message containing additional information into a * buffer pool for later decoding. * * @discussion * Trace messages that will be captured when additional information is needed * and are not captured by default. They will only be captured if the * system/process/activity mode has been increased or if a Development tool has * been attached to the process. * * @param format * A printf-style format string that represents a human-readable message when * the trace line is decoded. Only scalar types are supported, attempts * to pass arbitrary strings will store a pointer that is unresolvable and * will generate an error during decode. * * * os_trace_info("network interface status %ld", status); * */ #define os_trace_info(format, ...) \ OS_TRACE_CALL(OS_TRACE_TYPE_INFO, NULL, format, ##__VA_ARGS__) #endif /*! * @function os_trace_debug * * @abstract * Insert debug trace message into a buffer pool for later decoding. * * @discussion * Debug trace message to be recorded while debugger or other development tool * is attached to the originator. This is transported interprocess to help * diagnose the entire call chain including external helpers. * * @param format * A printf-style format string that represents a human-readable message when * the trace line is decoded. Only scalar types are supported, attempts * to pass arbitrary strings will store a pointer that is unresolvable and * will generate an error during decode. * * * os_trace_debug("network interface status %ld", status); * */ #define os_trace_debug(format, ...) \ OS_TRACE_CALL(OS_TRACE_TYPE_DEBUG, NULL, format, ##__VA_ARGS__) /*! * @function os_trace_info_enabled * * @abstract * Avoid unnecessary work for a trace point by checking if additional * information is enabled. * * @discussion * Avoid unnecessary work for a trace point by checking if additional * information is enabled. Generally trace points should not involve expensive * operations, but some circumstances warrant it. Use this function to avoid * doing the work unless debug level trace messages are requested. * * * if (os_trace_info_enabled()) { * os_trace_info("value = %d, average = %d", * [[dict objectForKey: @"myKey"] intValue], * (int)[self getAverage:dict]); * } * * * @result * Returns true if info types are enabled. */ API_DEPRECATED_WITH_REPLACEMENT("os_log_info_enabled", macos(10.12,10.13), ios(10.0,11.0), watchos(3.0,4.0), tvos(10.0,11.0)) OS_EXPORT OS_NOTHROW OS_WARN_RESULT bool os_trace_info_enabled(void); /*! * @function os_trace_debug_enabled * * @abstract * Avoid unnecessary work for a trace point by checking if debug level is * enabled. * * @discussion * Avoid unnecessary work for a trace point by checking if debug level is * enabled. Generally trace points should not involve expensive operations, but * some circumstances warrant it. Use this function to avoid doing the work * unless debug level trace messages are requested. * * * if (os_trace_debug_enabled()) { * os_trace_debug("value = %d, average = %d", * [[dict objectForKey: @"myKey"] intValue], * (int)[self getAverage:dict]); * } * * * @result * Returns true if debug mode is enabled. */ API_DEPRECATED_WITH_REPLACEMENT("os_log_debug_enabled", macos(10.10,10.13), ios(8.0,11.0), watchos(2.0,4.0), tvos(8.0,11.0)) OS_EXPORT OS_NOTHROW OS_WARN_RESULT bool os_trace_debug_enabled(void); /*! * @function os_trace_type_enabled * * @abstract * Avoid unnecessary work for a trace point by checking a specific type * * @discussion * Avoid unnecessary work for a trace point by checking a specific type * * @result * Returns true if type is enabled. */ API_DEPRECATED_WITH_REPLACEMENT("os_log_type_enabled", macos(10.10,10.13), ios(8.0,11.0), watchos(2.0,4.0), tvos(8.0,11.0)) OS_NOTHROW OS_WARN_RESULT OS_ALWAYS_INLINE static inline bool os_trace_type_enabled(uint8_t type) { switch (type) { case OS_TRACE_TYPE_INFO: return os_trace_info_enabled(); case OS_TRACE_TYPE_DEBUG: return os_trace_debug_enabled(); } return true; } /*! * @function os_trace_error * * @abstract * Trace the message as an error and force a collection of the trace buffer as * a failure may be imminent. * * @discussion * Trace the message as an error and force a collection of the trace buffer as * a failure may be imminent. * * @param format * A printf-style format string to generate a human-readable log message when * the trace line is decoded. Only scalar types are supported, attempts to pass * arbitrary strings will store a pointer that is unresolvable and will generate * an error during decode. * * * os_trace_error("socket %d connection timeout %ld", fd, secs); * */ #define os_trace_error(format, ...) \ OS_TRACE_CALL(OS_TRACE_TYPE_ERROR, NULL, format, ##__VA_ARGS__) /*! * @function os_trace_fault * * @abstract * Trace the message as a fault which forces a collection of the trace buffer * and diagnostic of the activity. * * @discussion * Trace the message as a fault which forces a collection of the trace buffer * and diagnostic of the activity. * * @param format * A printf-style format string to generate a human-readable log message when * the trace line is decoded. Only scalar types are supported, attempts * to pass arbitrary strings will store a pointer that is unresolvable and * will generate an error during decode. * * * os_trace_fault("failed to lookup uid %d - aborting", uid); * */ #define os_trace_fault(format, ...) \ OS_TRACE_CALL(OS_TRACE_TYPE_FAULT, NULL, format, ##__VA_ARGS__) #ifdef __BLOCKS__ #if __has_include() /*! * @function os_trace_with_payload * * @abstract * Add a trace entry containing the provided values and call the block if * appropriate. * * @discussion * Will insert a trace entry into a limited ring buffer for an activity or * process. Trace points are for recording interesting data that would improve * diagnosis of unexpected crashes, failures and hangs. The block will only be * called under the required conditions. * * @param trace_msg * A printf-style format string to generate a human-readable log message when * the trace line is decoded. Only scalar types are supported. Attempts * to pass arbitrary strings will store a pointer that is unresolvable and * will generate an error during decode. * * The final parameter must be a block of type os_trace_payload_t. * * * os_trace_with_payload("network event %ld", event, ^(xpc_object_t xdict) { * * // validate the network interface and address where what was expected * xpc_dictionary_set_string(xdict, "network", ifp->ifa_name); * xpc_dictionary_set_string(xdict, "ip_address", _get_address(ifp)); * }); * */ #define os_trace_with_payload(format, ...) \ OS_CONCAT(_os_trace_with_payload, OS_COUNT_ARGS(__VA_ARGS__))(\ OS_TRACE_TYPE_RELEASE, format, ##__VA_ARGS__) #if OS_LOG_TARGET_HAS_10_12_FEATURES #define os_trace_info_with_payload(format, ...) \ OS_CONCAT(_os_trace_with_payload, OS_COUNT_ARGS(__VA_ARGS__))(\ OS_TRACE_TYPE_INFO, format, ##__VA_ARGS__) #else API_DEPRECATED_WITH_REPLACEMENT("os_log_info", macos(10.12,10.13), ios(10.0,11.0), watchos(3.0,4.0), tvos(10.0,11.0)) OS_EXPORT OS_NOTHROW OS_NOT_TAIL_CALLED void os_trace_info_with_payload(const char *format, ...); #endif // !OS_LOG_TARGET_HAS_10_12_FEATURES #define os_trace_debug_with_payload(format, ...) \ OS_CONCAT(_os_trace_with_payload, OS_COUNT_ARGS(__VA_ARGS__))(\ OS_TRACE_TYPE_DEBUG, format, ##__VA_ARGS__) #define os_trace_error_with_payload(format, ...) \ OS_CONCAT(_os_trace_with_payload, OS_COUNT_ARGS(__VA_ARGS__))(\ OS_TRACE_TYPE_ERROR, format, ##__VA_ARGS__) #define os_trace_fault_with_payload(format, ...) \ OS_CONCAT(_os_trace_with_payload, OS_COUNT_ARGS(__VA_ARGS__))(\ OS_TRACE_TYPE_FAULT, format, ##__VA_ARGS__) #endif // __has_include() #endif // __BLOCKS__ /*! * @function _os_trace_with_buffer * * @abstract * Internal function to support pre-encoded buffer. */ API_DEPRECATED("use one of the following calls instead: os_log_info, os_log_debug, os_log_error, os_log_fault", macos(10.10,10.13), ios(8.0,11.0), watchos(2.0,4.0), tvos(8.0,11.0)) OS_EXPORT OS_NOTHROW OS_NOT_TAIL_CALLED void _os_trace_with_buffer(void *dso, const char *message, uint8_t type, const void *buffer, size_t buffer_size, os_trace_payload_t payload); __END_DECLS #endif // !__OS_TRACE_H__ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/os/trace_base.h ================================================ /* * Copyright (c) 2016 Apple Inc. All rights reserved. */ #ifndef __OS_TRACE_BASE_H__ #define __OS_TRACE_BASE_H__ #include #include #include #include #include #include #include #include #include #include #define OS_LOG_FORMATLIKE(x, y) __attribute__((format(os_log, x, y))) #define __OS_LOG_OS_FEATURES_AT_LEAST(macos, ios, tvos, watchos) \ ( (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_##macos) \ || (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_##ios) \ || (defined(__TV_OS_VERSION_MIN_REQUIRED) && __TV_OS_VERSION_MIN_REQUIRED >= __TVOS_##tvos) \ || (defined(__WATCH_OS_VERSION_MIN_REQUIRED) && __WATCH_OS_VERSION_MIN_REQUIRED >= __WATCHOS_##watchos) \ ) #if __OS_LOG_OS_FEATURES_AT_LEAST(10_15, 13_0, 13_0, 6_0) #define OS_LOG_TARGET_HAS_10_15_FEATURES 1 #else #define OS_LOG_TARGET_HAS_10_15_FEATURES 0 #endif #if __OS_LOG_OS_FEATURES_AT_LEAST(10_14, 12_0, 12_0, 5_0) #define OS_LOG_TARGET_HAS_10_14_FEATURES 1 #else #define OS_LOG_TARGET_HAS_10_14_FEATURES 0 #endif #if __OS_LOG_OS_FEATURES_AT_LEAST(10_13, 11_0, 11_0, 4_0) #define OS_LOG_TARGET_HAS_10_13_FEATURES 1 #else #define OS_LOG_TARGET_HAS_10_13_FEATURES 0 #endif #if __OS_LOG_OS_FEATURES_AT_LEAST(10_12, 10_0, 10_0, 3_0) #define OS_LOG_TARGET_HAS_10_12_FEATURES 1 #else #define OS_LOG_TARGET_HAS_10_12_FEATURES 0 #endif #ifndef OS_COUNT_ARGS #define OS_COUNT_ARGS(...) OS_COUNT_ARGS1(, ##__VA_ARGS__, _8, _7, _6, _5, _4, _3, _2, _1, _0) #define OS_COUNT_ARGS1(z, a, b, c, d, e, f, g, h, cnt, ...) cnt #endif #ifdef OS_LOG_FORMAT_WARNINGS #define OS_LOG_FORMAT_ERRORS _Pragma("clang diagnostic warning \"-Wformat\"") #else #define OS_LOG_FORMAT_ERRORS _Pragma("clang diagnostic error \"-Wformat\"") #endif #define OS_LOG_PRAGMA_PUSH \ _Pragma("clang diagnostic push") \ _Pragma("clang diagnostic ignored \"-Wvla\"") \ OS_LOG_FORMAT_ERRORS #define OS_LOG_PRAGMA_POP _Pragma("clang diagnostic pop") #if __has_attribute(uninitialized) #define OS_LOG_UNINITIALIZED __attribute__((uninitialized)) #else #define OS_LOG_UNINITIALIZED #endif #define OS_LOG_STRING(_ns, _var, _str) \ _Static_assert(__builtin_constant_p(_str), \ "format/label/description argument must be a string constant"); \ __attribute__((section("__TEXT,__oslogstring,cstring_literals"),internal_linkage)) \ static const char _var[] __asm(OS_STRINGIFY(OS_CONCAT(LOS_##_ns, __COUNTER__))) = _str #define OS_LOG_REMOVE_PARENS(...) __VA_ARGS__ #define OS_LOG_CALL_WITH_FORMAT(fun, fun_args, fmt, ...) __extension__({ \ OS_LOG_PRAGMA_PUSH OS_LOG_STRING(LOG, _os_fmt_str, fmt); \ uint8_t _Alignas(16) OS_LOG_UNINITIALIZED _os_fmt_buf[__builtin_os_log_format_buffer_size(fmt, ##__VA_ARGS__)]; \ fun(OS_LOG_REMOVE_PARENS fun_args, _os_fmt_str, \ (uint8_t *)__builtin_os_log_format(_os_fmt_buf, fmt, ##__VA_ARGS__), \ (uint32_t)sizeof(_os_fmt_buf)) OS_LOG_PRAGMA_POP; \ }) #define OS_LOG_CALL_WITH_FORMAT_NAME(fun, fun_args, name, fmt, ...) __extension__({ \ OS_LOG_PRAGMA_PUSH OS_LOG_STRING(LOG, _os_fmt_str, fmt); \ OS_LOG_STRING(LOG, _os_name_str, name); \ uint8_t _Alignas(16) OS_LOG_UNINITIALIZED _os_fmt_buf[__builtin_os_log_format_buffer_size(fmt, ##__VA_ARGS__)]; \ fun(OS_LOG_REMOVE_PARENS fun_args, _os_name_str, _os_fmt_str, \ (uint8_t *)__builtin_os_log_format(_os_fmt_buf, fmt, ##__VA_ARGS__), \ (uint32_t)sizeof(_os_fmt_buf)) OS_LOG_PRAGMA_POP; \ }) __BEGIN_DECLS extern struct mach_header __dso_handle; __END_DECLS #endif // !__OS_TRACE_BASE_H__ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/os/workgroup.h ================================================ /* * Copyright (c) 2020 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 __OS_WORKGROUP__ #define __OS_WORKGROUP__ #ifndef __DISPATCH_BUILDING_DISPATCH__ #ifndef __OS_WORKGROUP_INDIRECT__ #define __OS_WORKGROUP_INDIRECT__ #endif /* __OS_WORKGROUP_INDIRECT__ */ #include #include #include #include #undef __OS_WORKGROUP_INDIRECT__ #endif /* __DISPATCH_BUILDING_DISPATCH__ */ #endif /* __OS_WORKGROUP__ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/os/workgroup_base.h ================================================ #ifndef __OS_WORKGROUP_BASE__ #define __OS_WORKGROUP_BASE__ #ifndef __OS_WORKGROUP_INDIRECT__ #error "Please #include instead of this file directly." #endif #include #include #include #include #include #include #include #include #include #include #include #if __has_feature(assume_nonnull) #define OS_WORKGROUP_ASSUME_NONNULL_BEGIN _Pragma("clang assume_nonnull begin") #define OS_WORKGROUP_ASSUME_NONNULL_END _Pragma("clang assume_nonnull end") #else #define OS_WORKGROUP_ASSUME_NONNULL_BEGIN #define OS_WORKGROUP_ASSUME_NONNULL_END #endif #define OS_WORKGROUP_WARN_RESULT __attribute__((__warn_unused_result__)) #define OS_WORKGROUP_EXPORT OS_EXPORT #define OS_WORKGROUP_RETURNS_RETAINED OS_OBJECT_RETURNS_RETAINED #define OS_WORKGROUP_DECL(name, swift_name) \ OS_SWIFT_NAME(swift_name) \ OS_OBJECT_SHOW_CLASS(name, OS_OBJECT_CLASS(object)) #if OS_OBJECT_USE_OBJC #define OS_WORKGROUP_SUBCLASS_DECL_PROTO(name, swift_name, ...) \ OS_SWIFT_NAME(swift_name) \ OS_OBJECT_DECL_PROTOCOL(name ## __VA_ARGS__ ) #else #define OS_WORKGROUP_SUBCLASS_DECL_PROTO(name, swift_name, ...) #endif #define OS_WORKGROUP_SUBCLASS_DECL(name, super, swift_name, ...) \ OS_SWIFT_NAME(swift_name) \ OS_OBJECT_SHOW_SUBCLASS(name, super, name, ## __VA_ARGS__) #if defined(__LP64__) #define __OS_WORKGROUP_ATTR_SIZE__ 60 #define __OS_WORKGROUP_INTERVAL_DATA_SIZE__ 56 #define __OS_WORKGROUP_JOIN_TOKEN_SIZE__ 36 #else #define __OS_WORKGROUP_ATTR_SIZE__ 60 #define __OS_WORKGROUP_INTERVAL_DATA_SIZE__ 56 #define __OS_WORKGROUP_JOIN_TOKEN_SIZE__ 28 #endif #define _OS_WORKGROUP_ATTR_SIG_DEFAULT_INIT 0x2FA863B4 #define _OS_WORKGROUP_ATTR_SIG_EMPTY_INIT 0x2FA863C4 struct OS_REFINED_FOR_SWIFT os_workgroup_attr_opaque_s { uint32_t sig; char opaque[__OS_WORKGROUP_ATTR_SIZE__]; }; #define _OS_WORKGROUP_INTERVAL_DATA_SIG_INIT 0x52A74C4D struct OS_REFINED_FOR_SWIFT os_workgroup_interval_data_opaque_s { uint32_t sig; char opaque[__OS_WORKGROUP_INTERVAL_DATA_SIZE__]; }; struct OS_REFINED_FOR_SWIFT os_workgroup_join_token_opaque_s { uint32_t sig; char opaque[__OS_WORKGROUP_JOIN_TOKEN_SIZE__]; }; #endif /* __OS_WORKGROUP_BASE__ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/os/workgroup_interval.h ================================================ /* * Copyright (c) 2020 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 __OS_WORKGROUP_INTERVAL__ #define __OS_WORKGROUP_INTERVAL__ #ifndef __OS_WORKGROUP_INDIRECT__ #error "Please #include instead of this file directly." #include // For header doc #endif __BEGIN_DECLS OS_WORKGROUP_ASSUME_NONNULL_BEGIN /*! * @typedef os_workgroup_interval_t * * @abstract * A subclass of an os_workgroup_t for tracking work performed as part of * a repeating interval-driven workload. */ OS_WORKGROUP_SUBCLASS_DECL_PROTO(os_workgroup_interval, Repeatable); OS_WORKGROUP_SUBCLASS_DECL(os_workgroup_interval, os_workgroup, WorkGroupInterval); /* During the first instance of this API, the only supported interval * workgroups are for audio workloads. Please refer to the AudioToolbox * framework for more information. */ /* * @typedef os_workgroup_interval_data, os_workgroup_interval_data_t * * @abstract * An opaque structure containing additional configuration for the workgroup * interval. */ typedef struct os_workgroup_interval_data_opaque_s os_workgroup_interval_data_s; typedef struct os_workgroup_interval_data_opaque_s *os_workgroup_interval_data_t; #define OS_WORKGROUP_INTERVAL_DATA_INITIALIZER \ { .sig = _OS_WORKGROUP_INTERVAL_DATA_SIG_INIT } /*! * @function os_workgroup_interval_start * * @abstract * Indicates to the system that the member threads of this * os_workgroup_interval_t have begun working on an instance of the repeatable * interval workload with the specified timestamps. This function is real time * safe. * * This function will set and return an errno in the following cases: * * - The current thread is not a member of the os_workgroup_interval_t * - The os_workgroup_interval_t has been cancelled * - The timestamps passed in are malformed * - os_workgroup_interval_start() was previously called on the * os_workgroup_interval_t without an intervening os_workgroup_interval_finish() * - A concurrent workgroup interval configuration operation is taking place. * * @param start * Start timestamp specified in the os_clockid_t with which the * os_workgroup_interval_t was created. This is generally a time in the past and * indicates when the workgroup started working on an interval period * * @param deadline * Deadline timestamp specified in the os_clockid_t with which the * os_workgroup_interval_t was created. This specifies the deadline which the * interval period would like to meet. * * @param data * This field is currently unused and should be NULL */ API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0), watchos(7.0)) OS_REFINED_FOR_SWIFT OS_WORKGROUP_EXPORT OS_WORKGROUP_WARN_RESULT int os_workgroup_interval_start(os_workgroup_interval_t wg, uint64_t start, uint64_t deadline, os_workgroup_interval_data_t _Nullable data); /*! * @function os_workgroup_interval_update * * @abstract * Updates an already started interval workgroup to have the new * deadline specified. This function is real time safe. * * This function will return an error in the following cases: * - The current thread is not a member of the os_workgroup_interval_t * - The os_workgroup_interval_t has been cancelled * - The timestamp passed in is malformed * - os_workgroup_interval_start() was not previously called on the * os_workgroup_interval_t or was already matched with an * os_workgroup_interval_finish() * - A concurrent workgroup interval configuration operation is taking place * * @param deadline * Timestamp specified in the os_clockid_t with * which the os_workgroup_interval_t was created. * * @param data * This field is currently unused and should be NULL */ API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0), watchos(7.0)) OS_REFINED_FOR_SWIFT OS_WORKGROUP_EXPORT OS_WORKGROUP_WARN_RESULT int os_workgroup_interval_update(os_workgroup_interval_t wg, uint64_t deadline, os_workgroup_interval_data_t _Nullable data); /*! * @function os_workgroup_interval_finish * * @abstract * Indicates to the system that the member threads of * this os_workgroup_interval_t have finished working on the current instance * of the interval workload. This function is real time safe. * * This function will return an error in the following cases: * - The current thread is not a member of the os_workgroup_interval_t * - os_workgroup_interval_start() was not previously called on the * os_workgroup_interval_t or was already matched with an * os_workgroup_interval_finish() * - A concurrent workgroup interval configuration operation is taking place. * * @param data * This field is currently unused and should be NULL * */ API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0), watchos(7.0)) OS_REFINED_FOR_SWIFT OS_WORKGROUP_EXPORT OS_WORKGROUP_WARN_RESULT int os_workgroup_interval_finish(os_workgroup_interval_t wg, os_workgroup_interval_data_t _Nullable data); OS_WORKGROUP_ASSUME_NONNULL_END __END_DECLS #endif /* __OS_WORKGROUP_INTERVAL__ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/os/workgroup_object.h ================================================ /* * Copyright (c) 2020 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 __OS_WORKGROUP_OBJECT__ #define __OS_WORKGROUP_OBJECT__ #ifndef __OS_WORKGROUP_INDIRECT__ #error "Please #include instead of this file directly." #include // For header doc #endif __BEGIN_DECLS OS_WORKGROUP_ASSUME_NONNULL_BEGIN /*! * @typedef os_workgroup_t * * @abstract * A reference counted os object representing a workload that needs to * be distinctly recognized and tracked by the system. The workgroup * tracks a collection of threads all working cooperatively. An os_workgroup * object - when not an instance of a specific os_workgroup_t subclass - * represents a generic workload and makes no assumptions about the kind of * work done. * * @discussion * Threads can explicitly join an os_workgroup_t to mark themselves as * participants in the workload. */ OS_WORKGROUP_DECL(os_workgroup, WorkGroup); /* Attribute creation and specification */ /*! * @typedef os_workgroup_attr_t * * @abstract * Pointer to an opaque structure for describing attributes that can be * configured on a workgroup at creation. */ typedef struct os_workgroup_attr_opaque_s os_workgroup_attr_s; typedef struct os_workgroup_attr_opaque_s *os_workgroup_attr_t; /* os_workgroup_t attributes need to be initialized before use. This initializer * allows you to create a workgroup with the system default attributes. */ #define OS_WORKGROUP_ATTR_INITIALIZER_DEFAULT \ { .sig = _OS_WORKGROUP_ATTR_SIG_DEFAULT_INIT } /* The main use of the workgroup API is through instantiations of the concrete * subclasses - please refer to os/workgroup_interval.h and * os/workgroup_parallel.h for more information on creating workgroups. * * The functions below operate on all subclasses of os_workgroup_t. */ /*! * @function os_workgroup_copy_port * * @abstract * Returns a reference to a send right representing this workgroup that is to be * sent to other processes. This port is to be passed to * os_workgroup_create_with_port() to create a workgroup object. * * It is the client's responsibility to release the send right reference. * * If an error is encountered, errno is set and returned. */ API_AVAILABLE(macos(11.0)) API_UNAVAILABLE(ios, tvos, watchos) OS_REFINED_FOR_SWIFT OS_WORKGROUP_EXPORT OS_WORKGROUP_WARN_RESULT int os_workgroup_copy_port(os_workgroup_t wg, mach_port_t *mach_port_out); /*! * @function os_workgroup_create_with_port * * @abstract * Create an os_workgroup_t object from a send right returned by a previous * call to os_workgroup_copy_port, potentially in a different process. * * A newly created os_workgroup_t has no initial member threads - in particular * the creating thread does not join the os_workgroup_t implicitly. * * @param name * A client specified string for labelling the workgroup. This parameter is * optional and can be NULL. * * @param mach_port * The send right to create the workgroup from. No reference is consumed * on the specified send right. */ API_AVAILABLE(macos(11.0)) API_UNAVAILABLE(ios, tvos, watchos) OS_SWIFT_NAME(WorkGroup.init(__name:port:)) OS_WORKGROUP_EXPORT OS_WORKGROUP_RETURNS_RETAINED os_workgroup_t _Nullable os_workgroup_create_with_port(const char *_Nullable name, mach_port_t mach_port); /*! * @function os_workgroup_create_with_workgroup * * @abstract * Create a new os_workgroup object from an existing os_workgroup. * * The newly created os_workgroup has no initial member threads - in particular * the creating threaad does not join the os_workgroup_t implicitly. * * @param name * A client specified string for labelling the workgroup. This parameter is * optional and can be NULL. * * @param wg * The existing workgroup to create a new workgroup object from. */ API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0), watchos(7.0)) OS_REFINED_FOR_SWIFT OS_WORKGROUP_EXPORT OS_WORKGROUP_RETURNS_RETAINED os_workgroup_t _Nullable os_workgroup_create_with_workgroup(const char * _Nullable name, os_workgroup_t wg); /*! * @typedef os_workgroup_join_token, os_workgroup_join_token_t * * @abstract * An opaque join token which the client needs to pass to os_workgroup_join * and os_workgroup_leave */ OS_REFINED_FOR_SWIFT typedef struct os_workgroup_join_token_opaque_s os_workgroup_join_token_s; OS_REFINED_FOR_SWIFT typedef struct os_workgroup_join_token_opaque_s *os_workgroup_join_token_t; /*! * @function os_workgroup_join * * @abstract * Joins the current thread to the specified workgroup and populates the join * token that has been passed in. This API is real-time safe. * * @param wg * The workgroup that the current thread would like to join * * @param token_out * Pointer to a client allocated struct which the function will populate * with the join token. This token must be passed in by the thread when it calls * os_workgroup_leave(). * * Errors will be returned in the following cases: * * EALREADY The thread is already part of a workgroup that the specified * workgroup does not nest with * EINVAL The workgroup has been cancelled */ API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0), watchos(7.0)) OS_REFINED_FOR_SWIFT OS_WORKGROUP_EXPORT OS_WORKGROUP_WARN_RESULT int os_workgroup_join(os_workgroup_t wg, os_workgroup_join_token_t token_out); /*! * @function os_workgroup_leave * * @abstract * This removes the current thread from a workgroup it has previously * joined. Threads must leave all workgroups in the reverse order that they * have joined them. Failing to do so before exiting will result in undefined * behavior. * * If the join token is malformed, the process will be aborted. * * This API is real time safe. * * @param wg * The workgroup that the current thread would like to leave. * * @param token * This is the join token populated by the most recent call to * os_workgroup_join(). */ API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0), watchos(7.0)) OS_REFINED_FOR_SWIFT OS_WORKGROUP_EXPORT void os_workgroup_leave(os_workgroup_t wg, os_workgroup_join_token_t token); /* Working Arena index of a thread in a workgroup */ typedef uint32_t os_workgroup_index; /* Destructor for Working Arena */ typedef void (*os_workgroup_working_arena_destructor_t)(void * _Nullable); /*! * @function os_workgroup_set_working_arena * * @abstract * Associates a client defined working arena with the workgroup. The arena * is local to the workgroup object in the process. This is intended for * distributing a manually managed memory allocation between member threads * of the workgroup. * * This function can be called multiple times and the client specified * destructor will be called on the previously assigned arena, if any. This * function can only be called when no threads have currently joined the * workgroup and all workloops associated with the workgroup are idle. * * @param wg * The workgroup to associate the working arena with * * @param arena * The client managed arena to associate with the workgroup. This value can * be NULL. * * @param max_workers * The maximum number of threads that will ever query the workgroup for the * arena and request an index into it. If the arena is not used to partition * work amongst member threads, then this field can be 0. * * @param destructor * A destructor to call on the previously assigned working arena, if any */ API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0), watchos(7.0)) OS_REFINED_FOR_SWIFT OS_WORKGROUP_EXPORT OS_WORKGROUP_WARN_RESULT int os_workgroup_set_working_arena(os_workgroup_t wg, void * _Nullable arena, uint32_t max_workers, os_workgroup_working_arena_destructor_t destructor); /*! * @function os_workgroup_get_working_arena * * @abstract * Returns the working arena associated with the workgroup and the current * thread's index in the workgroup. This function can only be called by a member * of the workgroup. Multiple calls to this API by a member thread will return * the same arena and index until the thread leaves the workgroup. * * For workloops with an associated workgroup, every work item on the workloop * will receive the same index in the arena. * * This method returns NULL if no arena is set on the workgroup. The index * returned by this function is zero-based and is namespaced per workgroup * object in the process. The indices provided are strictly monotonic and never * reused until a future call to os_workgroup_set_working_arena. * * @param wg * The workgroup to get the working arena from. * * @param index_out * A pointer to a os_workgroup_index which will be populated by the caller's * index in the workgroup. */ API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0), watchos(7.0)) OS_REFINED_FOR_SWIFT OS_WORKGROUP_EXPORT void * _Nullable os_workgroup_get_working_arena(os_workgroup_t wg, os_workgroup_index * _Nullable index_out); /*! * @function os_workgroup_cancel * * @abstract * This API invalidates a workgroup and indicates to the system that the * workload is no longer relevant to the caller. * * No new work should be initiated for a cancelled workgroup and * work that is already underway should periodically check for * cancellation with os_workgroup_testcancel and initiate cleanup if needed. * * Threads currently in the workgroup continue to be tracked together but no * new threads may join this workgroup - the only possible operation allowed is * to leave the workgroup. Other actions may have undefined behavior or * otherwise fail. * * This API is idempotent. Cancellation is local to the workgroup object * it is called on and does not affect other workgroups. * * @param wg * The workgroup that that the thread would like to cancel */ API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0), watchos(7.0)) OS_REFINED_FOR_SWIFT OS_WORKGROUP_EXPORT void os_workgroup_cancel(os_workgroup_t wg); /*! * @function os_workgroup_testcancel * * @abstract * Returns true if the workgroup object has been cancelled. See also * os_workgroup_cancel */ API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0), watchos(7.0)) OS_REFINED_FOR_SWIFT OS_WORKGROUP_EXPORT bool os_workgroup_testcancel(os_workgroup_t wg); /*! * @typedef os_workgroup_max_parallel_threads_attr_t * * @abstract * A pointer to a structure describing the set of properties of a workgroup to * override with the explicitly specified values in the structure. * * See also os_workgroup_max_parallel_threads. */ OS_REFINED_FOR_SWIFT typedef struct os_workgroup_max_parallel_threads_attr_s os_workgroup_mpt_attr_s; OS_REFINED_FOR_SWIFT typedef struct os_workgroup_max_parallel_threads_attr_s *os_workgroup_mpt_attr_t; /*! * @function os_workgroup_max_parallel_threads * * @abstract * Returns the system's recommendation for maximum number of threads the client * should make for a multi-threaded workload in a given workgroup. * * This API takes into consideration the current hardware the code is running on * and the attributes of the workgroup. It does not take into consideration the * current load of the system and therefore always provides the most optimal * recommendation for the workload. * * @param wg * The workgroup in which the multi-threaded workload will be performed in. The * threads performing the multi-threaded workload are expected to join this * workgroup. * * @param attr * This value is currently unused and should be NULL. */ API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0), watchos(7.0)) OS_REFINED_FOR_SWIFT OS_WORKGROUP_EXPORT int os_workgroup_max_parallel_threads(os_workgroup_t wg, os_workgroup_mpt_attr_t _Nullable attr); OS_WORKGROUP_ASSUME_NONNULL_END __END_DECLS #endif /* __OS_WORKGROUP_OBJECT__ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/os/workgroup_parallel.h ================================================ /* * Copyright (c) 2020 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 __OS_WORKGROUP_PARALLEL__ #define __OS_WORKGROUP_PARALLEL__ #ifndef __OS_WORKGROUP_INDIRECT__ #error "Please #include instead of this file directly." #include // For header doc #endif #include __BEGIN_DECLS OS_WORKGROUP_ASSUME_NONNULL_BEGIN /*! * @typedef os_workgroup_parallel_t * * @abstract * A subclass of an os_workgroup_t for tracking parallel work. */ OS_WORKGROUP_SUBCLASS_DECL_PROTO(os_workgroup_parallel, Parallelizable); OS_WORKGROUP_SUBCLASS_DECL(os_workgroup_parallel, os_workgroup, WorkGroupParallel); /*! * @function os_workgroup_parallel_create * * @abstract * Creates an os_workgroup_t which tracks a parallel workload. * A newly created os_workgroup_interval_t has no initial member threads - * in particular the creating thread does not join the os_workgroup_parallel_t * implicitly. * * See also os_workgroup_max_parallel_threads(). * * @param name * A client specified string for labelling the workgroup. This parameter is * optional and can be NULL. * * @param attr * The requested set of workgroup attributes. NULL is to be specified for the * default set of attributes. */ API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0), watchos(7.0)) OS_WORKGROUP_EXPORT OS_WORKGROUP_RETURNS_RETAINED OS_SWIFT_NAME(WorkGroupParallel.init(__name:attr:)) os_workgroup_parallel_t _Nullable os_workgroup_parallel_create(const char * _Nullable name, os_workgroup_attr_t _Nullable attr); OS_WORKGROUP_ASSUME_NONNULL_END __END_DECLS #endif /* __OS_WORKGROUP_PARALLEL__ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_endian.h ================================================ /* * Copyright (c) 2004, 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@ */ /* * Copyright (c) 1995 NeXT Computer, Inc. All rights reserved. * 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@ */ /* * 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. */ #ifndef _SYS__ENDIAN_H_ #define _SYS__ENDIAN_H_ #include /* * Macros for network/external number representation conversion. */ #if defined(lint) __BEGIN_DECLS __uint16_t ntohs(__uint16_t); __uint16_t htons(__uint16_t); __uint32_t ntohl(__uint32_t); __uint32_t htonl(__uint32_t); __END_DECLS #elif __DARWIN_BYTE_ORDER == __DARWIN_BIG_ENDIAN #define ntohl(x) ((__uint32_t)(x)) #define ntohs(x) ((__uint16_t)(x)) #define htonl(x) ((__uint32_t)(x)) #define htons(x) ((__uint16_t)(x)) #if defined(KERNEL) || (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) #define ntohll(x) ((__uint64_t)(x)) #define htonll(x) ((__uint64_t)(x)) #define NTOHL(x) (x) #define NTOHS(x) (x) #define NTOHLL(x) (x) #define HTONL(x) (x) #define HTONS(x) (x) #define HTONLL(x) (x) #endif /* defined(KERNEL) || (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) */ #else /* __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN */ #include #define ntohs(x) __DARWIN_OSSwapInt16(x) #define htons(x) __DARWIN_OSSwapInt16(x) #define ntohl(x) __DARWIN_OSSwapInt32(x) #define htonl(x) __DARWIN_OSSwapInt32(x) #if defined(KERNEL) || (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) #define ntohll(x) __DARWIN_OSSwapInt64(x) #define htonll(x) __DARWIN_OSSwapInt64(x) #define NTOHL(x) (x) = ntohl((__uint32_t)x) #define NTOHS(x) (x) = ntohs((__uint16_t)x) #define NTOHLL(x) (x) = ntohll((__uint64_t)x) #define HTONL(x) (x) = htonl((__uint32_t)x) #define HTONS(x) (x) = htons((__uint16_t)x) #define HTONLL(x) (x) = htonll((__uint64_t)x) #endif /* defined(KERNEL) || (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) */ #endif /* __DARWIN_BYTE_ORDER */ #endif /* !_SYS__ENDIAN_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_posix_availability.h ================================================ /* Copyright (c) 2010 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 _CDEFS_H_ # error "Never use directly. Use instead." #endif #if !defined(_DARWIN_C_SOURCE) && defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 198808L #define ___POSIX_C_DEPRECATED_STARTING_198808L __deprecated #else #define ___POSIX_C_DEPRECATED_STARTING_198808L #endif #if !defined(_DARWIN_C_SOURCE) && defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199009L #define ___POSIX_C_DEPRECATED_STARTING_199009L __deprecated #else #define ___POSIX_C_DEPRECATED_STARTING_199009L #endif #if !defined(_DARWIN_C_SOURCE) && defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199209L #define ___POSIX_C_DEPRECATED_STARTING_199209L __deprecated #else #define ___POSIX_C_DEPRECATED_STARTING_199209L #endif #if !defined(_DARWIN_C_SOURCE) && defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309L #define ___POSIX_C_DEPRECATED_STARTING_199309L __deprecated #else #define ___POSIX_C_DEPRECATED_STARTING_199309L #endif #if !defined(_DARWIN_C_SOURCE) && defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199506L #define ___POSIX_C_DEPRECATED_STARTING_199506L __deprecated #else #define ___POSIX_C_DEPRECATED_STARTING_199506L #endif #if !defined(_DARWIN_C_SOURCE) && defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L #define ___POSIX_C_DEPRECATED_STARTING_200112L __deprecated #else #define ___POSIX_C_DEPRECATED_STARTING_200112L #endif #if !defined(_DARWIN_C_SOURCE) && defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200809L #define ___POSIX_C_DEPRECATED_STARTING_200809L __deprecated #else #define ___POSIX_C_DEPRECATED_STARTING_200809L #endif ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_pthread/_pthread_attr_t.h ================================================ /* * 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 _PTHREAD_ATTR_T #define _PTHREAD_ATTR_T #include /* __darwin_pthread_attr_t */ typedef __darwin_pthread_attr_t pthread_attr_t; #endif /* _PTHREAD_ATTR_T */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_pthread/_pthread_cond_t.h ================================================ /* * 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 _PTHREAD_COND_T #define _PTHREAD_COND_T #include /* __darwin_pthread_cond_t */ typedef __darwin_pthread_cond_t pthread_cond_t; #endif /* _PTHREAD_COND_T */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_pthread/_pthread_condattr_t.h ================================================ /* * 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 _PTHREAD_CONDATTR_T #define _PTHREAD_CONDATTR_T #include /* __darwin_pthread_condattr_t */ typedef __darwin_pthread_condattr_t pthread_condattr_t; #endif /* _PTHREAD_CONDATTR_T */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_pthread/_pthread_key_t.h ================================================ /* * 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 _PTHREAD_KEY_T #define _PTHREAD_KEY_T #include /* __darwin_pthread_key_t */ typedef __darwin_pthread_key_t pthread_key_t; #endif /* _PTHREAD_KEY_T */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_pthread/_pthread_mutex_t.h ================================================ /* * 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 _PTHREAD_MUTEX_T #define _PTHREAD_MUTEX_T #include /* __darwin_pthread_mutex_t */ typedef __darwin_pthread_mutex_t pthread_mutex_t; #endif /*_PTHREAD_MUTEX_T */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_pthread/_pthread_mutexattr_t.h ================================================ /* * 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 _PTHREAD_MUTEXATTR_T #define _PTHREAD_MUTEXATTR_T #include /* __darwin_pthread_mutexattr_t */ typedef __darwin_pthread_mutexattr_t pthread_mutexattr_t; #endif /* _PTHREAD_MUTEXATTR_T */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_pthread/_pthread_once_t.h ================================================ /* * 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 _PTHREAD_ONCE_T #define _PTHREAD_ONCE_T #include /* __darwin_pthread_once_t */ typedef __darwin_pthread_once_t pthread_once_t; #endif /* _PTHREAD_ONCE_T */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_pthread/_pthread_rwlock_t.h ================================================ /* * 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 _PTHREAD_RWLOCK_T #define _PTHREAD_RWLOCK_T #include /* __darwin_pthread_rwlock_t */ typedef __darwin_pthread_rwlock_t pthread_rwlock_t; #endif /* _PTHREAD_RWLOCK_T */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_pthread/_pthread_rwlockattr_t.h ================================================ /* * 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 _PTHREAD_RWLOCKATTR_T #define _PTHREAD_RWLOCKATTR_T #include /* __darwin_pthread_rwlockattr_t */ typedef __darwin_pthread_rwlockattr_t pthread_rwlockattr_t; #endif /* _PTHREAD_RWLOCKATTR_T */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_pthread/_pthread_t.h ================================================ /* * 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 _PTHREAD_T #define _PTHREAD_T #include /* __darwin_pthread_t */ typedef __darwin_pthread_t pthread_t; #endif /* _PTHREAD_T */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_pthread/_pthread_types.h ================================================ /* * Copyright (c) 2003-2013 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 _SYS__PTHREAD_TYPES_H_ #define _SYS__PTHREAD_TYPES_H_ #include // pthread opaque structures #if defined(__LP64__) #define __PTHREAD_SIZE__ 8176 #define __PTHREAD_ATTR_SIZE__ 56 #define __PTHREAD_MUTEXATTR_SIZE__ 8 #define __PTHREAD_MUTEX_SIZE__ 56 #define __PTHREAD_CONDATTR_SIZE__ 8 #define __PTHREAD_COND_SIZE__ 40 #define __PTHREAD_ONCE_SIZE__ 8 #define __PTHREAD_RWLOCK_SIZE__ 192 #define __PTHREAD_RWLOCKATTR_SIZE__ 16 #else // !__LP64__ #define __PTHREAD_SIZE__ 4088 #define __PTHREAD_ATTR_SIZE__ 36 #define __PTHREAD_MUTEXATTR_SIZE__ 8 #define __PTHREAD_MUTEX_SIZE__ 40 #define __PTHREAD_CONDATTR_SIZE__ 4 #define __PTHREAD_COND_SIZE__ 24 #define __PTHREAD_ONCE_SIZE__ 4 #define __PTHREAD_RWLOCK_SIZE__ 124 #define __PTHREAD_RWLOCKATTR_SIZE__ 12 #endif // !__LP64__ struct __darwin_pthread_handler_rec { void (*__routine)(void *); // Routine to call void *__arg; // Argument to pass struct __darwin_pthread_handler_rec *__next; }; struct _opaque_pthread_attr_t { long __sig; char __opaque[__PTHREAD_ATTR_SIZE__]; }; struct _opaque_pthread_cond_t { long __sig; char __opaque[__PTHREAD_COND_SIZE__]; }; struct _opaque_pthread_condattr_t { long __sig; char __opaque[__PTHREAD_CONDATTR_SIZE__]; }; struct _opaque_pthread_mutex_t { long __sig; char __opaque[__PTHREAD_MUTEX_SIZE__]; }; struct _opaque_pthread_mutexattr_t { long __sig; char __opaque[__PTHREAD_MUTEXATTR_SIZE__]; }; struct _opaque_pthread_once_t { long __sig; char __opaque[__PTHREAD_ONCE_SIZE__]; }; struct _opaque_pthread_rwlock_t { long __sig; char __opaque[__PTHREAD_RWLOCK_SIZE__]; }; struct _opaque_pthread_rwlockattr_t { long __sig; char __opaque[__PTHREAD_RWLOCKATTR_SIZE__]; }; struct _opaque_pthread_t { long __sig; struct __darwin_pthread_handler_rec *__cleanup_stack; char __opaque[__PTHREAD_SIZE__]; }; typedef struct _opaque_pthread_attr_t __darwin_pthread_attr_t; typedef struct _opaque_pthread_cond_t __darwin_pthread_cond_t; typedef struct _opaque_pthread_condattr_t __darwin_pthread_condattr_t; typedef unsigned long __darwin_pthread_key_t; typedef struct _opaque_pthread_mutex_t __darwin_pthread_mutex_t; typedef struct _opaque_pthread_mutexattr_t __darwin_pthread_mutexattr_t; typedef struct _opaque_pthread_once_t __darwin_pthread_once_t; typedef struct _opaque_pthread_rwlock_t __darwin_pthread_rwlock_t; typedef struct _opaque_pthread_rwlockattr_t __darwin_pthread_rwlockattr_t; typedef struct _opaque_pthread_t *__darwin_pthread_t; #endif // _SYS__PTHREAD_TYPES_H_ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_select.h ================================================ /* * Copyright (c) 2005, 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@ */ /* * This is called from sys/select.h and sys/time.h for the common prototype * of select(). Setting _DARWIN_C_SOURCE or _DARWIN_UNLIMITED_SELECT uses * the version of select() that does not place a limit on the first argument * (nfds). In the UNIX conformance case, values of nfds greater than * FD_SETSIZE will return an error of EINVAL. */ #ifndef _SYS__SELECT_H_ #define _SYS__SELECT_H_ #include /* __DARWIN_EXTSN_C, __DARWIN_1050, __DARWIN_ALIAS_C */ #include /* fd_set */ #include /* struct timeval */ int select(int, fd_set * __restrict, fd_set * __restrict, fd_set * __restrict, struct timeval * __restrict) #if defined(_DARWIN_C_SOURCE) || defined(_DARWIN_UNLIMITED_SELECT) __DARWIN_EXTSN_C(select) #else /* !_DARWIN_C_SOURCE && !_DARWIN_UNLIMITED_SELECT */ # if defined(__LP64__) && !__DARWIN_NON_CANCELABLE __DARWIN_1050(select) # else /* !__LP64__ || __DARWIN_NON_CANCELABLE */ __DARWIN_ALIAS_C(select) # endif /* __LP64__ && !__DARWIN_NON_CANCELABLE */ #endif /* _DARWIN_C_SOURCE || _DARWIN_UNLIMITED_SELECT */ ; #endif /* !_SYS__SELECT_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_structs.h ================================================ /* * Copyright (c) 2004-2013 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@ */ #include #include ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_symbol_aliasing.h ================================================ /* Copyright (c) 2010 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 _CDEFS_H_ # error "Never use directly. Use instead." #endif #if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 20000 #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_2_0(x) x #else #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_2_0(x) #endif #if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 20100 #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_2_1(x) x #else #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_2_1(x) #endif #if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 20200 #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_2_2(x) x #else #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_2_2(x) #endif #if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 30000 #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_3_0(x) x #else #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_3_0(x) #endif #if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 30100 #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_3_1(x) x #else #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_3_1(x) #endif #if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 30200 #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_3_2(x) x #else #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_3_2(x) #endif #if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 40000 #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_4_0(x) x #else #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_4_0(x) #endif #if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 40100 #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_4_1(x) x #else #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_4_1(x) #endif #if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 40200 #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_4_2(x) x #else #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_4_2(x) #endif #if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 40300 #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_4_3(x) x #else #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_4_3(x) #endif #if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 50000 #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_5_0(x) x #else #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_5_0(x) #endif #if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 50100 #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_5_1(x) x #else #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_5_1(x) #endif #if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 60000 #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_6_0(x) x #else #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_6_0(x) #endif #if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 60100 #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_6_1(x) x #else #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_6_1(x) #endif #if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 70000 #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_7_0(x) x #else #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_7_0(x) #endif #if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 70100 #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_7_1(x) x #else #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_7_1(x) #endif #if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 80000 #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_8_0(x) x #else #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_8_0(x) #endif #if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 80100 #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_8_1(x) x #else #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_8_1(x) #endif #if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 80200 #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_8_2(x) x #else #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_8_2(x) #endif #if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 80300 #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_8_3(x) x #else #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_8_3(x) #endif #if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 80400 #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_8_4(x) x #else #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_8_4(x) #endif #if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 90000 #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_9_0(x) x #else #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_9_0(x) #endif #if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 90100 #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_9_1(x) x #else #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_9_1(x) #endif #if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 90200 #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_9_2(x) x #else #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_9_2(x) #endif #if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 90300 #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_9_3(x) x #else #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_9_3(x) #endif #if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 100000 #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_10_0(x) x #else #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_10_0(x) #endif #if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 100100 #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_10_1(x) x #else #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_10_1(x) #endif #if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 100200 #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_10_2(x) x #else #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_10_2(x) #endif #if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 100300 #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_10_3(x) x #else #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_10_3(x) #endif #if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 110000 #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_11_0(x) x #else #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_11_0(x) #endif #if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 110100 #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_11_1(x) x #else #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_11_1(x) #endif #if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 110200 #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_11_2(x) x #else #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_11_2(x) #endif #if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 110300 #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_11_3(x) x #else #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_11_3(x) #endif #if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 110400 #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_11_4(x) x #else #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_11_4(x) #endif #if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 120000 #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_12_0(x) x #else #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_12_0(x) #endif #if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 120100 #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_12_1(x) x #else #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_12_1(x) #endif #if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 120200 #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_12_2(x) x #else #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_12_2(x) #endif #if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 120300 #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_12_3(x) x #else #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_12_3(x) #endif #if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 120400 #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_12_4(x) x #else #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_12_4(x) #endif #if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 130000 #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_13_0(x) x #else #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_13_0(x) #endif #if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 130100 #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_13_1(x) x #else #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_13_1(x) #endif #if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 130200 #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_13_2(x) x #else #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_13_2(x) #endif #if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 130300 #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_13_3(x) x #else #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_13_3(x) #endif #if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 130400 #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_13_4(x) x #else #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_13_4(x) #endif #if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 130500 #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_13_5(x) x #else #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_13_5(x) #endif #if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 130600 #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_13_6(x) x #else #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_13_6(x) #endif #if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 130700 #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_13_7(x) x #else #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_13_7(x) #endif #if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 140000 #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_14_0(x) x #else #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_14_0(x) #endif #if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 140100 #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_14_1(x) x #else #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_14_1(x) #endif #if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 140200 #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_14_2(x) x #else #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_14_2(x) #endif #if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 140300 #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_14_3(x) x #else #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_14_3(x) #endif #if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 140500 #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_14_5(x) x #else #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_14_5(x) #endif #if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 150000 #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_15_0(x) x #else #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_15_0(x) #endif #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1000 #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_0(x) x #else #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_0(x) #endif #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1010 #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_1(x) x #else #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_1(x) #endif #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1020 #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_2(x) x #else #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_2(x) #endif #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1030 #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_3(x) x #else #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_3(x) #endif #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1040 #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_4(x) x #else #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_4(x) #endif #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1050 #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_5(x) x #else #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_5(x) #endif #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1060 #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_6(x) x #else #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_6(x) #endif #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1070 #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_7(x) x #else #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_7(x) #endif #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1080 #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_8(x) x #else #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_8(x) #endif #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1090 #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_9(x) x #else #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_9(x) #endif #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 101000 #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_10(x) x #else #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_10(x) #endif #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 101002 #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_10_2(x) x #else #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_10_2(x) #endif #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 101003 #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_10_3(x) x #else #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_10_3(x) #endif #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 101100 #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_11(x) x #else #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_11(x) #endif #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 101102 #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_11_2(x) x #else #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_11_2(x) #endif #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 101103 #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_11_3(x) x #else #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_11_3(x) #endif #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 101104 #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_11_4(x) x #else #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_11_4(x) #endif #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 101200 #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_12(x) x #else #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_12(x) #endif #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 101201 #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_12_1(x) x #else #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_12_1(x) #endif #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 101202 #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_12_2(x) x #else #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_12_2(x) #endif #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 101204 #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_12_4(x) x #else #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_12_4(x) #endif #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 101300 #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_13(x) x #else #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_13(x) #endif #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 101301 #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_13_1(x) x #else #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_13_1(x) #endif #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 101302 #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_13_2(x) x #else #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_13_2(x) #endif #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 101304 #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_13_4(x) x #else #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_13_4(x) #endif #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 101400 #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_14(x) x #else #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_14(x) #endif #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 101401 #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_14_1(x) x #else #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_14_1(x) #endif #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 101404 #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_14_4(x) x #else #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_14_4(x) #endif #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 101405 #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_14_5(x) x #else #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_14_5(x) #endif #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 101406 #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_14_6(x) x #else #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_14_6(x) #endif #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 101500 #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_15(x) x #else #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_15(x) #endif #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 101501 #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_15_1(x) x #else #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_15_1(x) #endif #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 101600 #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_16(x) x #else #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_16(x) #endif #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 110000 #define __DARWIN_ALIAS_STARTING_MAC___MAC_11_0(x) x #else #define __DARWIN_ALIAS_STARTING_MAC___MAC_11_0(x) #endif #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 110100 #define __DARWIN_ALIAS_STARTING_MAC___MAC_11_1(x) x #else #define __DARWIN_ALIAS_STARTING_MAC___MAC_11_1(x) #endif #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 110300 #define __DARWIN_ALIAS_STARTING_MAC___MAC_11_3(x) x #else #define __DARWIN_ALIAS_STARTING_MAC___MAC_11_3(x) #endif #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 120000 #define __DARWIN_ALIAS_STARTING_MAC___MAC_12_0(x) x #else #define __DARWIN_ALIAS_STARTING_MAC___MAC_12_0(x) #endif ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_blkcnt_t.h ================================================ /* * 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 _BLKCNT_T #define _BLKCNT_T #include /* __darwin_blkcnt_t */ typedef __darwin_blkcnt_t blkcnt_t; #endif /* _BLKCNT_T */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_blksize_t.h ================================================ /* * 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 _BLKSIZE_T #define _BLKSIZE_T #include /* __darwin_blksize_t */ typedef __darwin_blksize_t blksize_t; #endif /* _BLKSIZE_T */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_caddr_t.h ================================================ /* * 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 _CADDR_T #define _CADDR_T typedef char * caddr_t; #endif /* _CADDR_T */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_clock_t.h ================================================ /* * 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 _CLOCK_T #define _CLOCK_T #include /* __darwin_clock_t */ typedef __darwin_clock_t clock_t; #endif /* _CLOCK_T */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_ct_rune_t.h ================================================ /* * Copyright (c) 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 _CT_RUNE_T #define _CT_RUNE_T #include /* __darwin_ct_rune_t */ typedef __darwin_ct_rune_t ct_rune_t; #endif /* _CT_RUNE_T */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_dev_t.h ================================================ /* * 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 _DEV_T #define _DEV_T #include /* __darwin_dev_t */ typedef __darwin_dev_t dev_t; /* device number */ #endif /* _DEV_T */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_errno_t.h ================================================ /* * 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 _ERRNO_T #define _ERRNO_T typedef int errno_t; #endif /* _ERRNO_T */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_fd_clr.h ================================================ /* * 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 FD_CLR #define FD_CLR(n, p) __DARWIN_FD_CLR(n, p) #endif /* FD_CLR */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_fd_copy.h ================================================ /* * 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 FD_COPY #define FD_COPY(f, t) __DARWIN_FD_COPY(f, t) #endif /* FD_COPY */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_fd_def.h ================================================ /* * 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 _FD_SET #define _FD_SET #include /* __int32_t and uintptr_t */ #include /* * Select uses bit masks of file descriptors in longs. These macros * manipulate such bit fields (the filesystem macros use chars). The * extra protection here is to permit application redefinition above * the default size. */ #ifdef FD_SETSIZE #define __DARWIN_FD_SETSIZE FD_SETSIZE #else /* !FD_SETSIZE */ #define __DARWIN_FD_SETSIZE 1024 #endif /* FD_SETSIZE */ #define __DARWIN_NBBY 8 /* bits in a byte */ #define __DARWIN_NFDBITS (sizeof(__int32_t) * __DARWIN_NBBY) /* bits per mask */ #define __DARWIN_howmany(x, y) ((((x) % (y)) == 0) ? ((x) / (y)) : (((x) / (y)) + 1)) /* # y's == x bits? */ __BEGIN_DECLS typedef struct fd_set { __int32_t fds_bits[__DARWIN_howmany(__DARWIN_FD_SETSIZE, __DARWIN_NFDBITS)]; } fd_set; int __darwin_check_fd_set_overflow(int, const void *, int) __API_AVAILABLE(macosx(11.0), ios(14.0), tvos(14.0), watchos(7.0)); __END_DECLS __header_always_inline int __darwin_check_fd_set(int _a, const void *_b) { #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wunguarded-availability-new" #endif if ((uintptr_t)&__darwin_check_fd_set_overflow != (uintptr_t) 0) { #if defined(_DARWIN_UNLIMITED_SELECT) || defined(_DARWIN_C_SOURCE) return __darwin_check_fd_set_overflow(_a, _b, 1); #else return __darwin_check_fd_set_overflow(_a, _b, 0); #endif } else { return 1; } #ifdef __clang__ #pragma clang diagnostic pop #endif } /* This inline avoids argument side-effect issues with FD_ISSET() */ __header_always_inline int __darwin_fd_isset(int _fd, const struct fd_set *_p) { if (__darwin_check_fd_set(_fd, (const void *) _p)) { return _p->fds_bits[(unsigned long)_fd / __DARWIN_NFDBITS] & ((__int32_t)(((unsigned long)1) << ((unsigned long)_fd % __DARWIN_NFDBITS))); } return 0; } __header_always_inline void __darwin_fd_set(int _fd, struct fd_set *const _p) { if (__darwin_check_fd_set(_fd, (const void *) _p)) { (_p->fds_bits[(unsigned long)_fd / __DARWIN_NFDBITS] |= ((__int32_t)(((unsigned long)1) << ((unsigned long)_fd % __DARWIN_NFDBITS)))); } } __header_always_inline void __darwin_fd_clr(int _fd, struct fd_set *const _p) { if (__darwin_check_fd_set(_fd, (const void *) _p)) { (_p->fds_bits[(unsigned long)_fd / __DARWIN_NFDBITS] &= ~((__int32_t)(((unsigned long)1) << ((unsigned long)_fd % __DARWIN_NFDBITS)))); } } #define __DARWIN_FD_SET(n, p) __darwin_fd_set((n), (p)) #define __DARWIN_FD_CLR(n, p) __darwin_fd_clr((n), (p)) #define __DARWIN_FD_ISSET(n, p) __darwin_fd_isset((n), (p)) #if __GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ >= 3 /* * Use the built-in bzero function instead of the library version so that * we do not pollute the namespace or introduce prototype warnings. */ #define __DARWIN_FD_ZERO(p) __builtin_bzero(p, sizeof(*(p))) #else #define __DARWIN_FD_ZERO(p) bzero(p, sizeof(*(p))) #endif #define __DARWIN_FD_COPY(f, t) bcopy(f, t, sizeof(*(f))) #endif /* _FD_SET */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_fd_isset.h ================================================ /* * 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 FD_ISSET #define FD_ISSET(n, p) __DARWIN_FD_ISSET(n, p) #endif /* FD_ISSET */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_fd_set.h ================================================ /* * 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 FD_SET #define FD_SET(n, p) __DARWIN_FD_SET(n, p) #endif /* FD_SET */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_fd_setsize.h ================================================ /* * 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 FD_SETSIZE #define FD_SETSIZE __DARWIN_FD_SETSIZE #endif /* FD_SETSIZE */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_fd_zero.h ================================================ /* * 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 FD_ZERO #define FD_ZERO(p) __DARWIN_FD_ZERO(p) #endif /* FD_ZERO */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_filesec_t.h ================================================ /* * 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 _FILESEC_T #define _FILESEC_T struct _filesec; typedef struct _filesec *filesec_t; #endif /* _FILESEC_T */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_fsblkcnt_t.h ================================================ /* * 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 _FSBLKCNT_T #define _FSBLKCNT_T #include /* __darwin_fsblkcnt_t */ typedef __darwin_fsblkcnt_t fsblkcnt_t; #endif /* _FSBLKCNT_T */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_fsfilcnt_t.h ================================================ /* * 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 _FSFILCNT_T #define _FSFILCNT_T #include /* __darwin_fsfilcnt_t */ typedef __darwin_fsfilcnt_t fsfilcnt_t; #endif /* _FSFILCNT_T */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_fsid_t.h ================================================ /* * Copyright (c) 2014 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 _FSID_T #define _FSID_T #include /* int32_t */ typedef struct fsid { int32_t val[2]; } fsid_t; /* file system id type */ #endif /* _FSID_T */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_fsobj_id_t.h ================================================ /* * Copyright (c) 2016 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 _FSOBJ_ID_T #define _FSOBJ_ID_T #include /* u_int32_t */ typedef struct fsobj_id { u_int32_t fid_objno; u_int32_t fid_generation; } fsobj_id_t; #endif /* _FSOBJ_ID_T */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_gid_t.h ================================================ /* * 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 _GID_T #define _GID_T #include /* __darwin_gid_t */ typedef __darwin_gid_t gid_t; #endif ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_guid_t.h ================================================ /* * 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 _KAUTH_GUID #define _KAUTH_GUID /* Apple-style globally unique identifier */ typedef union { #define KAUTH_GUID_SIZE 16 /* 128-bit identifier */ unsigned char g_guid[KAUTH_GUID_SIZE]; unsigned int g_guid_asint[KAUTH_GUID_SIZE / sizeof(unsigned int)]; } guid_t; #define _GUID_T #endif /* _KAUTH_GUID */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_id_t.h ================================================ /* * 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 _ID_T #define _ID_T #include /* __darwin_id_t */ typedef __darwin_id_t id_t; /* can hold pid_t, gid_t, or uid_t */ #endif /* _ID_T */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_in_addr_t.h ================================================ /* * 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 _IN_ADDR_T #define _IN_ADDR_T #include /* __uint32_t */ typedef __uint32_t in_addr_t; /* base type for internet address */ #endif /* _IN_ADDR_T */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_in_port_t.h ================================================ /* * 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 _IN_PORT_T #define _IN_PORT_T #include /* __uint16_t */ typedef __uint16_t in_port_t; #endif /* _IN_PORT_T */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_ino64_t.h ================================================ /* * 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 _INO64_T #define _INO64_T #include /* __darwin_ino64_t */ typedef __darwin_ino64_t ino64_t; /* 64bit inode number */ #endif /* _INO64_T */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_ino_t.h ================================================ /* * 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 _INO_T #define _INO_T #include /* __darwin_ino_t */ typedef __darwin_ino_t ino_t; /* inode number */ #endif /* _INO_T */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_int16_t.h ================================================ /* * Copyright (c) 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 _INT16_T #define _INT16_T typedef short int16_t; #endif /* _INT16_T */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_int32_t.h ================================================ /* * Copyright (c) 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 _INT32_T #define _INT32_T typedef int int32_t; #endif /* _INT32_T */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_int64_t.h ================================================ /* * Copyright (c) 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 _INT64_T #define _INT64_T typedef long long int64_t; #endif /* _INT64_T */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_int8_t.h ================================================ /* * Copyright (c) 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 _INT8_T #define _INT8_T typedef signed char int8_t; #endif /* _INT8_T */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_intptr_t.h ================================================ /* * 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 _INTPTR_T #define _INTPTR_T #include /* __darwin_intptr_t */ typedef __darwin_intptr_t intptr_t; #endif /* _INTPTR_T */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_iovec_t.h ================================================ /* * 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 _STRUCT_IOVEC #define _STRUCT_IOVEC #include /* size_t */ struct iovec { void * iov_base; /* [XSI] Base address of I/O memory region */ size_t iov_len; /* [XSI] Size of region iov_base points to */ }; #endif /* _STRUCT_IOVEC */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_key_t.h ================================================ /* * 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 _KEY_T #define _KEY_T #include /* __int32_t */ typedef __int32_t key_t; /* IPC key (for Sys V IPC) */ #endif /* _KEY_T */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_mach_port_t.h ================================================ /* * 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@ */ /* * 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]. * * This definition of mach_port_t is only for user-space. * */ #ifndef _MACH_PORT_T #define _MACH_PORT_T #include /* __darwin_mach_port_t */ typedef __darwin_mach_port_t mach_port_t; #endif /* _MACH_PORT_T */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_mbstate_t.h ================================================ /* * Copyright (c) 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 _MBSTATE_T #define _MBSTATE_T #include /* __darwin_mbstate_t */ typedef __darwin_mbstate_t mbstate_t; #endif /* _MBSTATE_T */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_mode_t.h ================================================ /* * 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 _MODE_T #define _MODE_T #include /* __darwin_mode_t */ typedef __darwin_mode_t mode_t; #endif /* _MODE_T */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_nlink_t.h ================================================ /* * 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 _NLINK_T #define _NLINK_T #include /* __uint16_t */ typedef __uint16_t nlink_t; /* link count */ #endif /* _NLINK_T */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_null.h ================================================ /* * 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 NULL #include /* __DARWIN_NULL */ #define NULL __DARWIN_NULL #endif /* NULL */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_o_dsync.h ================================================ /* * 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 O_DSYNC #define O_DSYNC 0x400000 /* synch I/O data integrity */ #endif /* O_DSYNC */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_o_sync.h ================================================ /* * 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 O_SYNC #define O_SYNC 0x0080 /* synch I/O file integrity */ #endif /* O_SYNC */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_off_t.h ================================================ /* * 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 _OFF_T #define _OFF_T #include /* __darwin_off_t */ typedef __darwin_off_t off_t; #endif /* _OFF_T */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_offsetof.h ================================================ /* * 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 offsetof #define offsetof(type, field) __offsetof(type, field) #endif /* offsetof */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_os_inline.h ================================================ /* * 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(OS_INLINE) # if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L # define OS_INLINE static inline # else # define OS_INLINE static __inline__ # endif #endif /* OS_INLINE */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_pid_t.h ================================================ /* * 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 _PID_T #define _PID_T #include /* __darwin_pid_t */ typedef __darwin_pid_t pid_t; #endif /* _PID_T */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_posix_vdisable.h ================================================ /* * 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 _POSIX_VDISABLE #define _POSIX_VDISABLE ((unsigned char)'\377') #endif /* POSIX_VDISABLE */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_ptrdiff_t.h ================================================ /* * Copyright (c) 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 _PTRDIFF_T #define _PTRDIFF_T #include /* __darwin_ptrdiff_t */ typedef __darwin_ptrdiff_t ptrdiff_t; #endif /* _PTRDIFF_T */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_rsize_t.h ================================================ /* * 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 _RSIZE_T #define _RSIZE_T #include /* __darwin_size_t */ typedef __darwin_size_t rsize_t; #endif /* _RSIZE_T */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_rune_t.h ================================================ /* * Copyright (c) 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 _RUNE_T #define _RUNE_T #include /* __darwin_rune_t */ typedef __darwin_rune_t rune_t; #endif /* _RUNE_T */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_s_ifmt.h ================================================ /* * 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@ */ /* * [XSI] The symbolic names for file modes for use as values of mode_t * shall be defined as described in */ #ifndef S_IFMT /* File type */ #define S_IFMT 0170000 /* [XSI] type of file mask */ #define S_IFIFO 0010000 /* [XSI] named pipe (fifo) */ #define S_IFCHR 0020000 /* [XSI] character special */ #define S_IFDIR 0040000 /* [XSI] directory */ #define S_IFBLK 0060000 /* [XSI] block special */ #define S_IFREG 0100000 /* [XSI] regular */ #define S_IFLNK 0120000 /* [XSI] symbolic link */ #define S_IFSOCK 0140000 /* [XSI] socket */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define S_IFWHT 0160000 /* OBSOLETE: whiteout */ #endif /* File mode */ /* Read, write, execute/search by owner */ #define S_IRWXU 0000700 /* [XSI] RWX mask for owner */ #define S_IRUSR 0000400 /* [XSI] R for owner */ #define S_IWUSR 0000200 /* [XSI] W for owner */ #define S_IXUSR 0000100 /* [XSI] X for owner */ /* Read, write, execute/search by group */ #define S_IRWXG 0000070 /* [XSI] RWX mask for group */ #define S_IRGRP 0000040 /* [XSI] R for group */ #define S_IWGRP 0000020 /* [XSI] W for group */ #define S_IXGRP 0000010 /* [XSI] X for group */ /* Read, write, execute/search by others */ #define S_IRWXO 0000007 /* [XSI] RWX mask for other */ #define S_IROTH 0000004 /* [XSI] R for other */ #define S_IWOTH 0000002 /* [XSI] W for other */ #define S_IXOTH 0000001 /* [XSI] X for other */ #define S_ISUID 0004000 /* [XSI] set user id on execution */ #define S_ISGID 0002000 /* [XSI] set group id on execution */ #define S_ISVTX 0001000 /* [XSI] directory restrcted delete */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define S_ISTXT S_ISVTX /* sticky bit: not supported */ #define S_IREAD S_IRUSR /* backward compatability */ #define S_IWRITE S_IWUSR /* backward compatability */ #define S_IEXEC S_IXUSR /* backward compatability */ #endif #endif /* !S_IFMT */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_sa_family_t.h ================================================ /* * 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 _SA_FAMILY_T #define _SA_FAMILY_T #include /* __uint8_t */ typedef __uint8_t sa_family_t; #endif /* _SA_FAMILY_T */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_seek_set.h ================================================ /* * 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@ */ #include /* whence values for lseek(2) */ #ifndef SEEK_SET #define SEEK_SET 0 /* set file offset to offset */ #define SEEK_CUR 1 /* set file offset to current plus offset */ #define SEEK_END 2 /* set file offset to EOF plus offset */ #endif /* !SEEK_SET */ #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL #ifndef SEEK_HOLE #define SEEK_HOLE 3 /* set file offset to the start of the next hole greater than or equal to the supplied offset */ #endif #ifndef SEEK_DATA #define SEEK_DATA 4 /* set file offset to the start of the next non-hole file region greater than or equal to the supplied offset */ #endif #endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_sigaltstack.h ================================================ /* * 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@ */ /* Structure used in sigaltstack call. */ #ifndef _STRUCT_SIGALTSTACK #include /* __DARWIN_UNIX03 */ #if __DARWIN_UNIX03 #define _STRUCT_SIGALTSTACK struct __darwin_sigaltstack #else /* !__DARWIN_UNIX03 */ #define _STRUCT_SIGALTSTACK struct sigaltstack #endif /* __DARWIN_UNIX03 */ #include /* __darwin_size_t */ _STRUCT_SIGALTSTACK { void *ss_sp; /* signal stack base */ __darwin_size_t ss_size; /* signal stack length */ int ss_flags; /* SA_DISABLE and/or SA_ONSTACK */ }; typedef _STRUCT_SIGALTSTACK stack_t; /* [???] signal stack */ #endif /* _STRUCT_SIGALTSTACK */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_sigset_t.h ================================================ /* * 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 _SIGSET_T #define _SIGSET_T #include /* __darwin_sigset_t */ typedef __darwin_sigset_t sigset_t; #endif /* _SIGSET_T */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_size_t.h ================================================ /* * 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 _SIZE_T #define _SIZE_T #include /* __darwin_size_t */ typedef __darwin_size_t size_t; #endif /* _SIZE_T */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_socklen_t.h ================================================ /* * 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 _SOCKLEN_T #define _SOCKLEN_T #include /* __darwin_socklen_t */ typedef __darwin_socklen_t socklen_t; #endif ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_ssize_t.h ================================================ /* * 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 _SSIZE_T #define _SSIZE_T #include /* __darwin_ssize_t */ typedef __darwin_ssize_t ssize_t; #endif /* _SSIZE_T */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_suseconds_t.h ================================================ /* * 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 _SUSECONDS_T #define _SUSECONDS_T #include /* __darwin_suseconds_t */ typedef __darwin_suseconds_t suseconds_t; #endif /* _SUSECONDS_T */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_time_t.h ================================================ /* * 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 _TIME_T #define _TIME_T #include /* __darwin_time_t */ typedef __darwin_time_t time_t; #endif /* _TIME_T */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_timespec.h ================================================ /* * 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 _STRUCT_TIMESPEC #define _STRUCT_TIMESPEC struct timespec #include /* __darwin_time_t */ _STRUCT_TIMESPEC { __darwin_time_t tv_sec; long tv_nsec; }; #endif /* _STRUCT_TIMESPEC */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_timeval.h ================================================ /* * 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 _STRUCT_TIMEVAL #define _STRUCT_TIMEVAL struct timeval #include /* __darwin_time_t */ #include /* __darwin_suseconds_t */ _STRUCT_TIMEVAL { __darwin_time_t tv_sec; /* seconds */ __darwin_suseconds_t tv_usec; /* and microseconds */ }; #endif /* _STRUCT_TIMEVAL */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_timeval32.h ================================================ /* * 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 _STRUCT_TIMEVAL32 #define _STRUCT_TIMEVAL32 struct timeval32 #include /* __int32_t */ _STRUCT_TIMEVAL32 { __int32_t tv_sec; /* seconds */ __int32_t tv_usec; /* and microseconds */ }; #endif /* _STRUCT_TIMEVAL32 */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_timeval64.h ================================================ /* * Copyright (c) 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@ */ #ifndef _STRUCT_TIMEVAL64 #define _STRUCT_TIMEVAL64 #include /* __int64_t */ struct timeval64 { __int64_t tv_sec; /* seconds */ __int64_t tv_usec; /* and microseconds */ }; #endif /* _STRUCT_TIMEVAL32 */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_u_char.h ================================================ /* * 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 _U_CHAR #define _U_CHAR typedef unsigned char u_char; #endif /* _U_CHAR */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_u_int.h ================================================ /* * 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 _U_INT #define _U_INT typedef unsigned int u_int; #endif /* _U_INT */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_u_int16_t.h ================================================ /* * Copyright (c) 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 _U_INT16_T #define _U_INT16_T typedef unsigned short u_int16_t; #endif /* _U_INT16_T */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_u_int32_t.h ================================================ /* * Copyright (c) 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 _U_INT32_T #define _U_INT32_T typedef unsigned int u_int32_t; #endif /* _U_INT32_T */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_u_int64_t.h ================================================ /* * Copyright (c) 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 _U_INT64_T #define _U_INT64_T typedef unsigned long long u_int64_t; #endif /* _U_INT64_T */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_u_int8_t.h ================================================ /* * Copyright (c) 2016 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 _U_INT8_T #define _U_INT8_T typedef unsigned char u_int8_t; #endif /* _U_INT8_T */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_u_short.h ================================================ /* * 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 _U_SHORT #define _U_SHORT typedef unsigned short u_short; #endif /* _U_SHORT */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_ucontext.h ================================================ /* * 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 _STRUCT_UCONTEXT #include /* __DARWIN_UNIX03 */ #if __DARWIN_UNIX03 #define _STRUCT_UCONTEXT struct __darwin_ucontext #else /* !__DARWIN_UNIX03 */ #define _STRUCT_UCONTEXT struct ucontext #endif /* __DARWIN_UNIX03 */ #include /* __darwin_size_t */ #include /* _STRUCT_MCONTEXT */ #include /* __darwin_sigset_t */ #include /* _STRUCT_SIGALTSTACK */ _STRUCT_UCONTEXT { int uc_onstack; __darwin_sigset_t uc_sigmask; /* signal mask used by this context */ _STRUCT_SIGALTSTACK uc_stack; /* stack used by this context */ _STRUCT_UCONTEXT *uc_link; /* pointer to resuming context */ __darwin_size_t uc_mcsize; /* size of the machine context passed in */ _STRUCT_MCONTEXT *uc_mcontext; /* pointer to machine specific context */ #ifdef _XOPEN_SOURCE _STRUCT_MCONTEXT __mcontext_data; #endif /* _XOPEN_SOURCE */ }; /* user context */ typedef _STRUCT_UCONTEXT ucontext_t; /* [???] user context */ #endif /* _STRUCT_UCONTEXT */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_ucontext64.h ================================================ /* * 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 _STRUCT_UCONTEXT64 #include /* __DARWIN_UNIX03 */ #if __DARWIN_UNIX03 #define _STRUCT_UCONTEXT64 struct __darwin_ucontext64 #else /* !__DARWIN_UNIX03 */ #define _STRUCT_UCONTEXT64 struct ucontext64 #endif /* __DARWIN_UNIX03 */ #include /* __darwin_size_t */ #include /* _STRUCT_MCONTEXT */ #include /* __darwin_sigset_t */ #include /* _STRUCT_SIGALTSTACK */ _STRUCT_UCONTEXT64 { int uc_onstack; __darwin_sigset_t uc_sigmask; /* signal mask used by this context */ _STRUCT_SIGALTSTACK uc_stack; /* stack used by this context */ _STRUCT_UCONTEXT64 *uc_link; /* pointer to resuming context */ __darwin_size_t uc_mcsize; /* size of the machine context passed in */ _STRUCT_MCONTEXT64 *uc_mcontext64; /* pointer to machine specific context */ }; typedef _STRUCT_UCONTEXT64 ucontext64_t; /* [???] user context */ #endif /* _STRUCT_UCONTEXT64 */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_uid_t.h ================================================ /* * 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 _UID_T #define _UID_T #include /* __darwin_uid_t */ typedef __darwin_uid_t uid_t; #endif /* _UID_T */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_uintptr_t.h ================================================ /* * 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 _UINTPTR_T #define _UINTPTR_T #ifndef __has_attribute typedef unsigned long uintptr_t; #else typedef unsigned long uintptr_t; #endif /* __has_attribute */ #endif /* _UINTPTR_T */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_useconds_t.h ================================================ /* * 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 _USECONDS_T #define _USECONDS_T #include /* __darwin_useconds_t */ typedef __darwin_useconds_t useconds_t; #endif /* _USECONDS_T */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_uuid_t.h ================================================ /* * 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 _UUID_T #define _UUID_T #include /* __darwin_uuid_t */ typedef __darwin_uuid_t uuid_t; #endif /* _UUID_T */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_va_list.h ================================================ /* * Copyright (c) 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 _VA_LIST_T #define _VA_LIST_T #include /* __darwin_va_list */ typedef __darwin_va_list va_list; #endif /* _VA_LIST_T */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_wchar_t.h ================================================ /* * Copyright (c) 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@ */ /* wchar_t is a built-in type in C++ */ #ifndef __cplusplus #ifndef _WCHAR_T #define _WCHAR_T #include /* __darwin_wchar_t */ typedef __darwin_wchar_t wchar_t; #endif /* _WCHAR_T */ #endif /* __cplusplus */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types/_wint_t.h ================================================ /* * Copyright (c) 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 _WINT_T #define _WINT_T #include /* __darwin_wint_t */ typedef __darwin_wint_t wint_t; #endif /* _WINT_T */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/_types.h ================================================ /* * 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 _SYS__TYPES_H_ #define _SYS__TYPES_H_ #include #include /* * Type definitions; takes common type definitions that must be used * in multiple header files due to [XSI], removes them from the system * space, and puts them in the implementation space. */ #ifdef __cplusplus #ifdef __GNUG__ #define __DARWIN_NULL __null #else /* ! __GNUG__ */ #ifdef __LP64__ #define __DARWIN_NULL (0L) #else /* !__LP64__ */ #define __DARWIN_NULL 0 #endif /* __LP64__ */ #endif /* __GNUG__ */ #else /* ! __cplusplus */ #define __DARWIN_NULL ((void *)0) #endif /* __cplusplus */ typedef __int64_t __darwin_blkcnt_t; /* total blocks */ typedef __int32_t __darwin_blksize_t; /* preferred block size */ typedef __int32_t __darwin_dev_t; /* dev_t */ typedef unsigned int __darwin_fsblkcnt_t; /* Used by statvfs and fstatvfs */ typedef unsigned int __darwin_fsfilcnt_t; /* Used by statvfs and fstatvfs */ typedef __uint32_t __darwin_gid_t; /* [???] process and group IDs */ typedef __uint32_t __darwin_id_t; /* [XSI] pid_t, uid_t, or gid_t*/ typedef __uint64_t __darwin_ino64_t; /* [???] Used for 64 bit inodes */ #if __DARWIN_64_BIT_INO_T typedef __darwin_ino64_t __darwin_ino_t; /* [???] Used for inodes */ #else /* !__DARWIN_64_BIT_INO_T */ typedef __uint32_t __darwin_ino_t; /* [???] Used for inodes */ #endif /* __DARWIN_64_BIT_INO_T */ typedef __darwin_natural_t __darwin_mach_port_name_t; /* Used by mach */ typedef __darwin_mach_port_name_t __darwin_mach_port_t; /* Used by mach */ typedef __uint16_t __darwin_mode_t; /* [???] Some file attributes */ typedef __int64_t __darwin_off_t; /* [???] Used for file sizes */ typedef __int32_t __darwin_pid_t; /* [???] process and group IDs */ typedef __uint32_t __darwin_sigset_t; /* [???] signal set */ typedef __int32_t __darwin_suseconds_t; /* [???] microseconds */ typedef __uint32_t __darwin_uid_t; /* [???] user IDs */ typedef __uint32_t __darwin_useconds_t; /* [???] microseconds */ typedef unsigned char __darwin_uuid_t[16]; typedef char __darwin_uuid_string_t[37]; #include #if defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 5 || __GNUC__ > 3) #define __offsetof(type, field) __builtin_offsetof(type, field) #else /* !(gcc >= 3.5) */ #define __offsetof(type, field) ((size_t)(&((type *)0)->field)) #endif /* (gcc >= 3.5) */ #endif /* _SYS__TYPES_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/acct.h ================================================ /* * 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@ */ /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */ /*- * Copyright (c) 1990, 1993, 1994 * 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. * * @(#)acct.h 8.4 (Berkeley) 1/9/95 */ #ifndef _SYS_ACCT_H_ #define _SYS_ACCT_H_ #include #include #include /* u_int8_t */ #include /* u_int16_t */ #include /* u_int32_t */ #include /* uid_t */ #include /* gid_t */ #include /* dev_t */ /* * Accounting structures; these use a comp_t type which is a 3 bits base 8 * exponent, 13 bit fraction ``floating point'' number. Units are 1/AHZ * seconds. */ typedef u_int16_t comp_t; struct acct { char ac_comm[10]; /* command name */ comp_t ac_utime; /* user time */ comp_t ac_stime; /* system time */ comp_t ac_etime; /* elapsed time */ u_int32_t ac_btime; /* starting time */ uid_t ac_uid; /* user id */ gid_t ac_gid; /* group id */ u_int16_t ac_mem; /* average memory usage */ comp_t ac_io; /* count of IO blocks */ dev_t ac_tty; /* controlling tty */ #define AFORK 0x01 /* fork'd but not exec'd */ #define ASU 0x02 /* used super-user permissions */ #define ACOMPAT 0x04 /* used compatibility mode */ #define ACORE 0x08 /* dumped core */ #define AXSIG 0x10 /* killed by a signal */ u_int8_t ac_flag; /* accounting flags */ }; /* * 1/AHZ is the granularity of the data encoded in the comp_t fields. * This is not necessarily equal to hz. */ #define AHZ 64 #endif /* ! _SYS_ACCT_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/acl.h ================================================ /* * Copyright (c) 2004, 2010 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * * The contents of this file constitute Original Code as defined in and * are subject to the Apple Public Source License Version 1.1 (the * "License"). You may not use this file except in compliance with the * License. Please obtain a copy of the License at * http://www.apple.com/publicsource and read it before using this file. * * This 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 OR NON-INFRINGEMENT. Please see the * License for the specific language governing rights and limitations * under the License. * * @APPLE_LICENSE_HEADER_END@ */ #ifndef _SYS_ACL_H #define _SYS_ACL_H #include #include #include #define __DARWIN_ACL_READ_DATA (1<<1) #define __DARWIN_ACL_LIST_DIRECTORY __DARWIN_ACL_READ_DATA #define __DARWIN_ACL_WRITE_DATA (1<<2) #define __DARWIN_ACL_ADD_FILE __DARWIN_ACL_WRITE_DATA #define __DARWIN_ACL_EXECUTE (1<<3) #define __DARWIN_ACL_SEARCH __DARWIN_ACL_EXECUTE #define __DARWIN_ACL_DELETE (1<<4) #define __DARWIN_ACL_APPEND_DATA (1<<5) #define __DARWIN_ACL_ADD_SUBDIRECTORY __DARWIN_ACL_APPEND_DATA #define __DARWIN_ACL_DELETE_CHILD (1<<6) #define __DARWIN_ACL_READ_ATTRIBUTES (1<<7) #define __DARWIN_ACL_WRITE_ATTRIBUTES (1<<8) #define __DARWIN_ACL_READ_EXTATTRIBUTES (1<<9) #define __DARWIN_ACL_WRITE_EXTATTRIBUTES (1<<10) #define __DARWIN_ACL_READ_SECURITY (1<<11) #define __DARWIN_ACL_WRITE_SECURITY (1<<12) #define __DARWIN_ACL_CHANGE_OWNER (1<<13) #define __DARWIN_ACL_SYNCHRONIZE (1<<20) #define __DARWIN_ACL_EXTENDED_ALLOW 1 #define __DARWIN_ACL_EXTENDED_DENY 2 #define __DARWIN_ACL_ENTRY_INHERITED (1<<4) #define __DARWIN_ACL_ENTRY_FILE_INHERIT (1<<5) #define __DARWIN_ACL_ENTRY_DIRECTORY_INHERIT (1<<6) #define __DARWIN_ACL_ENTRY_LIMIT_INHERIT (1<<7) #define __DARWIN_ACL_ENTRY_ONLY_INHERIT (1<<8) #define __DARWIN_ACL_FLAG_NO_INHERIT (1<<17) /* * Implementation constants. * * The ACL_TYPE_EXTENDED binary format permits 169 entries plus * the ACL header in a page. Give ourselves some room to grow; * this limit is arbitrary. */ #define ACL_MAX_ENTRIES 128 /* 23.2.2 Individual object access permissions - nonstandard */ typedef enum { ACL_READ_DATA = __DARWIN_ACL_READ_DATA, ACL_LIST_DIRECTORY = __DARWIN_ACL_LIST_DIRECTORY, ACL_WRITE_DATA = __DARWIN_ACL_WRITE_DATA, ACL_ADD_FILE = __DARWIN_ACL_ADD_FILE, ACL_EXECUTE = __DARWIN_ACL_EXECUTE, ACL_SEARCH = __DARWIN_ACL_SEARCH, ACL_DELETE = __DARWIN_ACL_DELETE, ACL_APPEND_DATA = __DARWIN_ACL_APPEND_DATA, ACL_ADD_SUBDIRECTORY = __DARWIN_ACL_ADD_SUBDIRECTORY, ACL_DELETE_CHILD = __DARWIN_ACL_DELETE_CHILD, ACL_READ_ATTRIBUTES = __DARWIN_ACL_READ_ATTRIBUTES, ACL_WRITE_ATTRIBUTES = __DARWIN_ACL_WRITE_ATTRIBUTES, ACL_READ_EXTATTRIBUTES = __DARWIN_ACL_READ_EXTATTRIBUTES, ACL_WRITE_EXTATTRIBUTES = __DARWIN_ACL_WRITE_EXTATTRIBUTES, ACL_READ_SECURITY = __DARWIN_ACL_READ_SECURITY, ACL_WRITE_SECURITY = __DARWIN_ACL_WRITE_SECURITY, ACL_CHANGE_OWNER = __DARWIN_ACL_CHANGE_OWNER, ACL_SYNCHRONIZE = __DARWIN_ACL_SYNCHRONIZE, } acl_perm_t; /* 23.2.5 ACL entry tag type bits - nonstandard */ typedef enum { ACL_UNDEFINED_TAG = 0, ACL_EXTENDED_ALLOW = __DARWIN_ACL_EXTENDED_ALLOW, ACL_EXTENDED_DENY = __DARWIN_ACL_EXTENDED_DENY } acl_tag_t; /* 23.2.6 Individual ACL types */ typedef enum { ACL_TYPE_EXTENDED = 0x00000100, /* Posix 1003.1e types - not supported */ ACL_TYPE_ACCESS = 0x00000000, ACL_TYPE_DEFAULT = 0x00000001, /* The following types are defined on FreeBSD/Linux - not supported */ ACL_TYPE_AFS = 0x00000002, ACL_TYPE_CODA = 0x00000003, ACL_TYPE_NTFS = 0x00000004, ACL_TYPE_NWFS = 0x00000005 } acl_type_t; /* 23.2.7 ACL qualifier constants */ #define ACL_UNDEFINED_ID NULL /* XXX ? */ /* 23.2.8 ACL Entry Constants */ typedef enum { ACL_FIRST_ENTRY = 0, ACL_NEXT_ENTRY = -1, ACL_LAST_ENTRY = -2 } acl_entry_id_t; /* nonstandard ACL / entry flags */ typedef enum { ACL_FLAG_DEFER_INHERIT = (1 << 0), /* tentative */ ACL_FLAG_NO_INHERIT = __DARWIN_ACL_FLAG_NO_INHERIT, ACL_ENTRY_INHERITED = __DARWIN_ACL_ENTRY_INHERITED, ACL_ENTRY_FILE_INHERIT = __DARWIN_ACL_ENTRY_FILE_INHERIT, ACL_ENTRY_DIRECTORY_INHERIT = __DARWIN_ACL_ENTRY_DIRECTORY_INHERIT, ACL_ENTRY_LIMIT_INHERIT = __DARWIN_ACL_ENTRY_LIMIT_INHERIT, ACL_ENTRY_ONLY_INHERIT = __DARWIN_ACL_ENTRY_ONLY_INHERIT } acl_flag_t; /* "External" ACL types */ struct _acl; struct _acl_entry; struct _acl_permset; struct _acl_flagset; typedef struct _acl *acl_t; typedef struct _acl_entry *acl_entry_t; typedef struct _acl_permset *acl_permset_t; typedef struct _acl_flagset *acl_flagset_t; typedef u_int64_t acl_permset_mask_t; __BEGIN_DECLS /* 23.1.6.1 ACL Storage Management */ extern acl_t acl_dup(acl_t acl); extern int acl_free(void *obj_p); extern acl_t acl_init(int count); /* 23.1.6.2 (1) ACL Entry manipulation */ extern int acl_copy_entry(acl_entry_t dest_d, acl_entry_t src_d); extern int acl_create_entry(acl_t *acl_p, acl_entry_t *entry_p); extern int acl_create_entry_np(acl_t *acl_p, acl_entry_t *entry_p, int entry_index); extern int acl_delete_entry(acl_t acl, acl_entry_t entry_d); extern int acl_get_entry(acl_t acl, int entry_id, acl_entry_t *entry_p); extern int acl_valid(acl_t acl); extern int acl_valid_fd_np(int fd, acl_type_t type, acl_t acl); extern int acl_valid_file_np(const char *path, acl_type_t type, acl_t acl); extern int acl_valid_link_np(const char *path, acl_type_t type, acl_t acl); /* 23.1.6.2 (2) Manipulate permissions within an ACL entry */ extern int acl_add_perm(acl_permset_t permset_d, acl_perm_t perm); extern int acl_calc_mask(acl_t *acl_p); /* not supported */ extern int acl_clear_perms(acl_permset_t permset_d); extern int acl_delete_perm(acl_permset_t permset_d, acl_perm_t perm); extern int acl_get_perm_np(acl_permset_t permset_d, acl_perm_t perm); extern int acl_get_permset(acl_entry_t entry_d, acl_permset_t *permset_p); extern int acl_set_permset(acl_entry_t entry_d, acl_permset_t permset_d); /* nonstandard - manipulate permissions within an ACL entry using bitmasks */ extern int acl_maximal_permset_mask_np(acl_permset_mask_t * mask_p) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); extern int acl_get_permset_mask_np(acl_entry_t entry_d, acl_permset_mask_t * mask_p) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); extern int acl_set_permset_mask_np(acl_entry_t entry_d, acl_permset_mask_t mask) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); /* nonstandard - manipulate flags on ACLs and entries */ extern int acl_add_flag_np(acl_flagset_t flagset_d, acl_flag_t flag); extern int acl_clear_flags_np(acl_flagset_t flagset_d); extern int acl_delete_flag_np(acl_flagset_t flagset_d, acl_flag_t flag); extern int acl_get_flag_np(acl_flagset_t flagset_d, acl_flag_t flag); extern int acl_get_flagset_np(void *obj_p, acl_flagset_t *flagset_p); extern int acl_set_flagset_np(void *obj_p, acl_flagset_t flagset_d); /* 23.1.6.2 (3) Manipulate ACL entry tag type and qualifier */ extern void *acl_get_qualifier(acl_entry_t entry_d); extern int acl_get_tag_type(acl_entry_t entry_d, acl_tag_t *tag_type_p); extern int acl_set_qualifier(acl_entry_t entry_d, const void *tag_qualifier_p); extern int acl_set_tag_type(acl_entry_t entry_d, acl_tag_t tag_type); /* 23.1.6.3 ACL manipulation on an Object */ extern int acl_delete_def_file(const char *path_p); /* not supported */ extern acl_t acl_get_fd(int fd); extern acl_t acl_get_fd_np(int fd, acl_type_t type); extern acl_t acl_get_file(const char *path_p, acl_type_t type); extern acl_t acl_get_link_np(const char *path_p, acl_type_t type); extern int acl_set_fd(int fd, acl_t acl); extern int acl_set_fd_np(int fd, acl_t acl, acl_type_t acl_type); extern int acl_set_file(const char *path_p, acl_type_t type, acl_t acl); extern int acl_set_link_np(const char *path_p, acl_type_t type, acl_t acl); /* 23.1.6.4 ACL Format translation */ extern ssize_t acl_copy_ext(void *buf_p, acl_t acl, ssize_t size); extern ssize_t acl_copy_ext_native(void *buf_p, acl_t acl, ssize_t size); extern acl_t acl_copy_int(const void *buf_p); extern acl_t acl_copy_int_native(const void *buf_p); extern acl_t acl_from_text(const char *buf_p); extern ssize_t acl_size(acl_t acl); extern char *acl_to_text(acl_t acl, ssize_t *len_p); __END_DECLS #endif /* _SYS_ACL_H */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/aio.h ================================================ /* * Copyright (c) 2003-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@ */ /* * File: sys/aio.h * Author: Umesh Vaishampayan [umeshv@apple.com] * 05-Feb-2003 umeshv Created. * * Header file for POSIX Asynchronous IO APIs * */ #ifndef _SYS_AIO_H_ #define _SYS_AIO_H_ #include #include #include /* * [XSI] Inclusion of the header may make visible symbols defined * in the headers , , , and . * * In our case, this is limited to struct timespec, off_t and ssize_t. */ #include #include #include /* * A aio_fsync() options that the calling thread is to continue execution * while the lio_listio() operation is being performed, and no notification * is given when the operation is complete * * [XSI] from */ #include #include struct aiocb { int aio_fildes; /* File descriptor */ off_t aio_offset; /* File offset */ volatile void *aio_buf; /* Location of buffer */ size_t aio_nbytes; /* Length of transfer */ int aio_reqprio; /* Request priority offset */ struct sigevent aio_sigevent; /* Signal number and value */ int aio_lio_opcode; /* Operation to be performed */ }; /* * aio_cancel() return values */ /* * none of the requested operations could be canceled since they are * already complete. */ #define AIO_ALLDONE 0x1 /* all requested operations have been canceled */ #define AIO_CANCELED 0x2 /* * some of the requested operations could not be canceled since * they are in progress */ #define AIO_NOTCANCELED 0x4 /* * lio_listio operation options */ #define LIO_NOP 0x0 /* option indicating that no transfer is requested */ #define LIO_READ 0x1 /* option requesting a read */ #define LIO_WRITE 0x2 /* option requesting a write */ /* * lio_listio() modes */ /* * A lio_listio() synchronization operation indicating * that the calling thread is to continue execution while * the lio_listio() operation is being performed, and no * notification is given when the operation is complete */ #define LIO_NOWAIT 0x1 /* * A lio_listio() synchronization operation indicating * that the calling thread is to suspend until the * lio_listio() operation is complete. */ #define LIO_WAIT 0x2 /* * Maximum number of operations in single lio_listio call */ #define AIO_LISTIO_MAX 16 /* * Prototypes */ __BEGIN_DECLS /* * Attempt to cancel one or more asynchronous I/O requests currently outstanding * against file descriptor fd. The aiocbp argument points to the asynchronous I/O * control block for a particular request to be canceled. If aiocbp is NULL, then * all outstanding cancelable asynchronous I/O requests against fd shall be canceled. */ int aio_cancel( int fd, struct aiocb * aiocbp ); /* * Return the error status associated with the aiocb structure referenced by the * aiocbp argument. The error status for an asynchronous I/O operation is the errno * value that would be set by the corresponding read(), write(), or fsync() * operation. If the operation has not yet completed, then the error status shall * be equal to [EINPROGRESS]. */ int aio_error( const struct aiocb * aiocbp ); /* * Asynchronously force all I/O operations associated with the file indicated by * the file descriptor aio_fildes member of the aiocb structure referenced by the * aiocbp argument and queued at the time of the call to aio_fsync() to the * synchronized I/O completion state. The function call shall return when the * synchronization request has been initiated or queued. op O_SYNC is the only * supported opertation at this time. * The aiocbp argument refers to an asynchronous I/O control block. The aiocbp * value may be used as an argument to aio_error() and aio_return() in order to * determine the error status and return status, respectively, of the asynchronous * operation while it is proceeding. When the request is queued, the error status * for the operation is [EINPROGRESS]. When all data has been successfully * transferred, the error status shall be reset to reflect the success or failure * of the operation. */ int aio_fsync( int op, struct aiocb * aiocbp ); /* * Read aiocbp->aio_nbytes from the file associated with aiocbp->aio_fildes into * the buffer pointed to by aiocbp->aio_buf. The function call shall return when * the read request has been initiated or queued. * The aiocbp value may be used as an argument to aio_error() and aio_return() in * order to determine the error status and return status, respectively, of the * asynchronous operation while it is proceeding. If an error condition is * encountered during queuing, the function call shall return without having * initiated or queued the request. The requested operation takes place at the * absolute position in the file as given by aio_offset, as if lseek() were called * immediately prior to the operation with an offset equal to aio_offset and a * whence equal to SEEK_SET. After a successful call to enqueue an asynchronous * I/O operation, the value of the file offset for the file is unspecified. */ int aio_read( struct aiocb * aiocbp ); /* * Return the return status associated with the aiocb structure referenced by * the aiocbp argument. The return status for an asynchronous I/O operation is * the value that would be returned by the corresponding read(), write(), or * fsync() function call. If the error status for the operation is equal to * [EINPROGRESS], then the return status for the operation is undefined. The * aio_return() function may be called exactly once to retrieve the return status * of a given asynchronous operation; thereafter, if the same aiocb structure * is used in a call to aio_return() or aio_error(), an error may be returned. * When the aiocb structure referred to by aiocbp is used to submit another * asynchronous operation, then aio_return() may be successfully used to * retrieve the return status of that operation. */ ssize_t aio_return( struct aiocb * aiocbp ); /* * Suspend the calling thread until at least one of the asynchronous I/O * operations referenced by the aiocblist argument has completed, until a signal * interrupts the function, or, if timeout is not NULL, until the time * interval specified by timeout has passed. If any of the aiocb structures * in the aiocblist correspond to completed asynchronous I/O operations (that is, * the error status for the operation is not equal to [EINPROGRESS]) at the * time of the call, the function shall return without suspending the calling * thread. The aiocblist argument is an array of pointers to asynchronous I/O * control blocks. The nent argument indicates the number of elements in the * array. Each aiocb structure pointed to has been used in initiating an * asynchronous I/O request via aio_read(), aio_write(), or lio_listio(). This * array may contain NULL pointers, which are ignored. */ int aio_suspend( const struct aiocb *const aiocblist[], int nent, const struct timespec * timeoutp ) __DARWIN_ALIAS_C(aio_suspend); /* * Write aiocbp->aio_nbytes to the file associated with aiocbp->aio_fildes from * the buffer pointed to by aiocbp->aio_buf. The function shall return when the * write request has been initiated or, at a minimum, queued. * The aiocbp argument may be used as an argument to aio_error() and aio_return() * in order to determine the error status and return status, respectively, of the * asynchronous operation while it is proceeding. */ int aio_write( struct aiocb * aiocbp ); /* * Initiate a list of I/O requests with a single function call. The mode * argument takes one of the values LIO_WAIT or LIO_NOWAIT and determines whether * the function returns when the I/O operations have been completed, or as soon * as the operations have been queued. If the mode argument is LIO_WAIT, the * function shall wait until all I/O is complete and the sig argument shall be * ignored. * If the mode argument is LIO_NOWAIT, the function shall return immediately, and * asynchronous notification shall occur, according to the sig argument, when all * the I/O operations complete. If sig is NULL, then no asynchronous notification * shall occur. */ int lio_listio( int mode, struct aiocb *const aiocblist[], int nent, struct sigevent *sigp ); __END_DECLS #endif /* _SYS_AIO_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/appleapiopts.h ================================================ /* * Copyright (c) 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@ */ #ifndef __SYS_APPLEAPIOPTS_H__ #define __SYS_APPLEAPIOPTS_H__ #ifndef __APPLE_API_STANDARD #define __APPLE_API_STANDARD #endif /* __APPLE_API_STANDARD */ #ifndef __APPLE_API_STABLE #define __APPLE_API_STABLE #endif /* __APPLE_API_STABLE */ #ifndef __APPLE_API_STRICT_CONFORMANCE #ifndef __APPLE_API_EVOLVING #define __APPLE_API_EVOLVING #endif /* __APPLE_API_EVOLVING */ #ifndef __APPLE_API_UNSTABLE #define __APPLE_API_UNSTABLE #endif /* __APPLE_API_UNSTABLE */ #ifndef __APPLE_API_PRIVATE #define __APPLE_API_PRIVATE #endif /* __APPLE_API_PRIVATE */ #ifndef __APPLE_API_OBSOLETE #define __APPLE_API_OBSOLETE #endif /* __APPLE_API_OBSOLETE */ #endif /* __APPLE_API_STRICT_CONFORMANCE */ #endif /* __SYS_APPLEAPIOPTS_H__ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/attr.h ================================================ /* * Copyright (c) 2000-2018 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@ */ /* * attr.h - attribute data structures and interfaces * * Copyright (c) 1998, Apple Computer, Inc. All Rights Reserved. */ #ifndef _SYS_ATTR_H_ #define _SYS_ATTR_H_ #include #ifdef __APPLE_API_UNSTABLE #include #include #include #include #define FSOPT_NOFOLLOW 0x00000001 #define FSOPT_NOINMEMUPDATE 0x00000002 #define FSOPT_REPORT_FULLSIZE 0x00000004 /* The following option only valid when requesting ATTR_CMN_RETURNED_ATTRS */ #define FSOPT_PACK_INVAL_ATTRS 0x00000008 #define FSOPT_ATTR_CMN_EXTENDED 0x00000020 #define FSOPT_RETURN_REALDEV 0x00000200 /* we currently aren't anywhere near this amount for a valid * fssearchblock.sizeofsearchparams1 or fssearchblock.sizeofsearchparams2 * but we put a sanity check in to avoid abuse of the value passed in from * user land. */ #define SEARCHFS_MAX_SEARCHPARMS 4096 typedef u_int32_t text_encoding_t; typedef u_int32_t fsobj_type_t; typedef u_int32_t fsobj_tag_t; typedef u_int32_t fsfile_type_t; typedef u_int32_t fsvolid_t; #include /* file object id type */ typedef u_int32_t attrgroup_t; struct attrlist { u_short bitmapcount; /* number of attr. bit sets in list (should be 5) */ u_int16_t reserved; /* (to maintain 4-byte alignment) */ attrgroup_t commonattr; /* common attribute group */ attrgroup_t volattr; /* Volume attribute group */ attrgroup_t dirattr; /* directory attribute group */ attrgroup_t fileattr; /* file attribute group */ attrgroup_t forkattr; /* fork attribute group */ }; #define ATTR_BIT_MAP_COUNT 5 typedef struct attribute_set { attrgroup_t commonattr; /* common attribute group */ attrgroup_t volattr; /* Volume attribute group */ attrgroup_t dirattr; /* directory attribute group */ attrgroup_t fileattr; /* file attribute group */ attrgroup_t forkattr; /* fork attribute group */ } attribute_set_t; #define ATTRIBUTE_SET_INIT(a) do {(a)->commonattr = (a)->volattr = (a)->dirattr = (a)->fileattr = (a)->forkattr = 0; } while(0) typedef struct attrreference { int32_t attr_dataoffset; u_int32_t attr_length; } attrreference_t; /* XXX PPD This is derived from HFSVolumePriv.h and should perhaps be referenced from there? */ struct diskextent { u_int32_t startblock; /* first block allocated */ u_int32_t blockcount; /* number of blocks allocated */ }; typedef struct diskextent extentrecord[8]; typedef u_int32_t vol_capabilities_set_t[4]; #define VOL_CAPABILITIES_FORMAT 0 #define VOL_CAPABILITIES_INTERFACES 1 #define VOL_CAPABILITIES_RESERVED1 2 #define VOL_CAPABILITIES_RESERVED2 3 typedef struct vol_capabilities_attr { vol_capabilities_set_t capabilities; vol_capabilities_set_t valid; } vol_capabilities_attr_t; /* * XXX this value needs to be raised - 3893388 */ #define ATTR_MAX_BUFFER 8192 /* * VOL_CAP_FMT_PERSISTENTOBJECTIDS: When set, the volume has object IDs * that are persistent (retain their values even when the volume is * unmounted and remounted), and a file or directory can be looked up * by ID. Volumes that support VolFS and can support Carbon File ID * references should set this bit. * * VOL_CAP_FMT_SYMBOLICLINKS: When set, the volume supports symbolic * links. The symlink(), readlink(), and lstat() calls all use this * symbolic link. * * VOL_CAP_FMT_HARDLINKS: When set, the volume supports hard links. * The link() call creates hard links. * * VOL_CAP_FMT_JOURNAL: When set, the volume is capable of supporting * a journal used to speed recovery in case of unplanned shutdown * (such as a power outage or crash). This bit does not necessarily * mean the volume is actively using a journal for recovery. * * VOL_CAP_FMT_JOURNAL_ACTIVE: When set, the volume is currently using * a journal for use in speeding recovery after an unplanned shutdown. * This bit can be set only if VOL_CAP_FMT_JOURNAL is also set. * * VOL_CAP_FMT_NO_ROOT_TIMES: When set, the volume format does not * store reliable times for the root directory, so you should not * depend on them to detect changes, etc. * * VOL_CAP_FMT_SPARSE_FILES: When set, the volume supports sparse files. * That is, files which can have "holes" that have never been written * to, and are not allocated on disk. Sparse files may have an * allocated size that is less than the file's logical length. * * VOL_CAP_FMT_ZERO_RUNS: For security reasons, parts of a file (runs) * that have never been written to must appear to contain zeroes. When * this bit is set, the volume keeps track of allocated but unwritten * runs of a file so that it can substitute zeroes without actually * writing zeroes to the media. This provides performance similar to * sparse files, but not the space savings. * * VOL_CAP_FMT_CASE_SENSITIVE: When set, file and directory names are * case sensitive (upper and lower case are different). When clear, * an upper case character is equivalent to a lower case character, * and you can't have two names that differ solely in the case of * the characters. * * VOL_CAP_FMT_CASE_PRESERVING: When set, file and directory names * preserve the difference between upper and lower case. If clear, * the volume may change the case of some characters (typically * making them all upper or all lower case). A volume that sets * VOL_CAP_FMT_CASE_SENSITIVE should also set VOL_CAP_FMT_CASE_PRESERVING. * * VOL_CAP_FMT_FAST_STATFS: This bit is used as a hint to upper layers * (especially Carbon) that statfs() is fast enough that its results * need not be cached by those upper layers. A volume that caches * the statfs information in its in-memory structures should set this bit. * A volume that must always read from disk or always perform a network * transaction should not set this bit. * * VOL_CAP_FMT_2TB_FILESIZE: If this bit is set the volume format supports * file sizes larger than 4GB, and potentially up to 2TB; it does not * indicate whether the filesystem supports files larger than that. * * VOL_CAP_FMT_OPENDENYMODES: When set, the volume supports open deny * modes (e.g. "open for read write, deny write"; effectively, mandatory * file locking based on open modes). * * VOL_CAP_FMT_HIDDEN_FILES: When set, the volume supports the UF_HIDDEN * file flag, and the UF_HIDDEN flag is mapped to that volume's native * "hidden" or "invisible" bit (which may be the invisible bit from the * Finder Info extended attribute). * * VOL_CAP_FMT_PATH_FROM_ID: When set, the volume supports the ability * to derive a pathname to the root of the file system given only the * id of an object. This also implies that object ids on this file * system are persistent and not recycled. This is a very specialized * capability and it is assumed that most file systems will not support * it. Its use is for legacy non-posix APIs like ResolveFileIDRef. * * VOL_CAP_FMT_NO_VOLUME_SIZES: When set, the volume does not support * returning values for total data blocks, available blocks, or free blocks * (as in f_blocks, f_bavail, or f_bfree in "struct statfs"). Historically, * those values were set to 0xFFFFFFFF for volumes that did not support them. * * VOL_CAP_FMT_DECMPFS_COMPRESSION: When set, the volume supports transparent * decompression of compressed files using decmpfs. * * VOL_CAP_FMT_64BIT_OBJECT_IDS: When set, the volume uses object IDs that * are 64-bit. This means that ATTR_CMN_FILEID and ATTR_CMN_PARENTID are the * only legitimate attributes for obtaining object IDs from this volume and the * 32-bit fid_objno fields of the fsobj_id_t returned by ATTR_CMN_OBJID, * ATTR_CMN_OBJPERMID, and ATTR_CMN_PAROBJID are undefined. * * VOL_CAP_FMT_DIR_HARDLINKS: When set, the volume supports directory * hard links. * * VOL_CAP_FMT_DOCUMENT_ID: When set, the volume supports document IDs * (an ID which persists across object ID changes) for document revisions. * * VOL_CAP_FMT_WRITE_GENERATION_COUNT: When set, the volume supports write * generation counts (a count of how many times an object has been modified) * * VOL_CAP_FMT_NO_IMMUTABLE_FILES: When set, the volume does not support * setting the UF_IMMUTABLE flag. * * VOL_CAP_FMT_NO_PERMISSIONS: When set, the volume does not support setting * permissions. * * VOL_CAP_FMT_SHARED_SPACE: When set, the volume supports sharing space with * other filesystems i.e. multiple logical filesystems can exist in the same * "partition". An implication of this is that the filesystem which sets * this capability treats waitfor arguments to VFS_SYNC as bit flags. * * VOL_CAP_FMT_VOL_GROUPS: When set, this volume is part of a volume-group * that implies multiple volumes must be mounted in order to boot and root the * operating system. Typically, this means a read-only system volume and a * writable data volume. * * VOL_CAP_FMT_SEALED: When set, this volume is cryptographically sealed. * Any modifications to volume data or metadata will be detected and may * render the volume unusable. */ #define VOL_CAP_FMT_PERSISTENTOBJECTIDS 0x00000001 #define VOL_CAP_FMT_SYMBOLICLINKS 0x00000002 #define VOL_CAP_FMT_HARDLINKS 0x00000004 #define VOL_CAP_FMT_JOURNAL 0x00000008 #define VOL_CAP_FMT_JOURNAL_ACTIVE 0x00000010 #define VOL_CAP_FMT_NO_ROOT_TIMES 0x00000020 #define VOL_CAP_FMT_SPARSE_FILES 0x00000040 #define VOL_CAP_FMT_ZERO_RUNS 0x00000080 #define VOL_CAP_FMT_CASE_SENSITIVE 0x00000100 #define VOL_CAP_FMT_CASE_PRESERVING 0x00000200 #define VOL_CAP_FMT_FAST_STATFS 0x00000400 #define VOL_CAP_FMT_2TB_FILESIZE 0x00000800 #define VOL_CAP_FMT_OPENDENYMODES 0x00001000 #define VOL_CAP_FMT_HIDDEN_FILES 0x00002000 #define VOL_CAP_FMT_PATH_FROM_ID 0x00004000 #define VOL_CAP_FMT_NO_VOLUME_SIZES 0x00008000 #define VOL_CAP_FMT_DECMPFS_COMPRESSION 0x00010000 #define VOL_CAP_FMT_64BIT_OBJECT_IDS 0x00020000 #define VOL_CAP_FMT_DIR_HARDLINKS 0x00040000 #define VOL_CAP_FMT_DOCUMENT_ID 0x00080000 #define VOL_CAP_FMT_WRITE_GENERATION_COUNT 0x00100000 #define VOL_CAP_FMT_NO_IMMUTABLE_FILES 0x00200000 #define VOL_CAP_FMT_NO_PERMISSIONS 0x00400000 #define VOL_CAP_FMT_SHARED_SPACE 0x00800000 #define VOL_CAP_FMT_VOL_GROUPS 0x01000000 #define VOL_CAP_FMT_SEALED 0x02000000 /* * VOL_CAP_INT_SEARCHFS: When set, the volume implements the * searchfs() system call (the vnop_searchfs vnode operation). * * VOL_CAP_INT_ATTRLIST: When set, the volume implements the * getattrlist() and setattrlist() system calls (vnop_getattrlist * and vnop_setattrlist vnode operations) for the volume, files, * and directories. The volume may or may not implement the * readdirattr() system call. XXX Is there any minimum set * of attributes that should be supported? To determine the * set of supported attributes, get the ATTR_VOL_ATTRIBUTES * attribute of the volume. * * VOL_CAP_INT_NFSEXPORT: When set, the volume implements exporting * of NFS volumes. * * VOL_CAP_INT_READDIRATTR: When set, the volume implements the * readdirattr() system call (vnop_readdirattr vnode operation). * * VOL_CAP_INT_EXCHANGEDATA: When set, the volume implements the * exchangedata() system call (VNOP_EXCHANGE vnode operation). * * VOL_CAP_INT_COPYFILE: When set, the volume implements the * VOP_COPYFILE vnode operation. (XXX There should be a copyfile() * system call in .) * * VOL_CAP_INT_ALLOCATE: When set, the volume implements the * VNOP_ALLOCATE vnode operation, which means it implements the * F_PREALLOCATE selector of fcntl(2). * * VOL_CAP_INT_VOL_RENAME: When set, the volume implements the * ATTR_VOL_NAME attribute for both getattrlist() and setattrlist(). * The volume can be renamed by setting ATTR_VOL_NAME with setattrlist(). * * VOL_CAP_INT_ADVLOCK: When set, the volume implements POSIX style * byte range locks via vnop_advlock (accessible from fcntl(2)). * * VOL_CAP_INT_FLOCK: When set, the volume implements whole-file flock(2) * style locks via vnop_advlock. This includes the O_EXLOCK and O_SHLOCK * flags of the open(2) call. * * VOL_CAP_INT_EXTENDED_SECURITY: When set, the volume implements * extended security (ACLs). * * VOL_CAP_INT_USERACCESS: When set, the volume supports the * ATTR_CMN_USERACCESS attribute (used to get the user's access * mode to the file). * * VOL_CAP_INT_MANLOCK: When set, the volume supports AFP-style * mandatory byte range locks via an ioctl(). * * VOL_CAP_INT_EXTENDED_ATTR: When set, the volume implements * native extended attribues. * * VOL_CAP_INT_NAMEDSTREAMS: When set, the volume supports * native named streams. * * VOL_CAP_INT_CLONE: When set, the volume supports clones. * * VOL_CAP_INT_SNAPSHOT: When set, the volume supports snapshots. * * VOL_CAP_INT_RENAME_SWAP: When set, the volume supports swapping * file system objects. * * VOL_CAP_INT_RENAME_EXCL: When set, the volume supports an * exclusive rename operation. * * VOL_CAP_INT_RENAME_OPENFAIL: When set, the volume may fail rename * operations on files that are open. */ #define VOL_CAP_INT_SEARCHFS 0x00000001 #define VOL_CAP_INT_ATTRLIST 0x00000002 #define VOL_CAP_INT_NFSEXPORT 0x00000004 #define VOL_CAP_INT_READDIRATTR 0x00000008 #define VOL_CAP_INT_EXCHANGEDATA 0x00000010 #define VOL_CAP_INT_COPYFILE 0x00000020 #define VOL_CAP_INT_ALLOCATE 0x00000040 #define VOL_CAP_INT_VOL_RENAME 0x00000080 #define VOL_CAP_INT_ADVLOCK 0x00000100 #define VOL_CAP_INT_FLOCK 0x00000200 #define VOL_CAP_INT_EXTENDED_SECURITY 0x00000400 #define VOL_CAP_INT_USERACCESS 0x00000800 #define VOL_CAP_INT_MANLOCK 0x00001000 #define VOL_CAP_INT_NAMEDSTREAMS 0x00002000 #define VOL_CAP_INT_EXTENDED_ATTR 0x00004000 #define VOL_CAP_INT_CLONE 0x00010000 #define VOL_CAP_INT_SNAPSHOT 0x00020000 #define VOL_CAP_INT_RENAME_SWAP 0x00040000 #define VOL_CAP_INT_RENAME_EXCL 0x00080000 #define VOL_CAP_INT_RENAME_OPENFAIL 0x00100000 typedef struct vol_attributes_attr { attribute_set_t validattr; attribute_set_t nativeattr; } vol_attributes_attr_t; #define ATTR_CMN_NAME 0x00000001 #define ATTR_CMN_DEVID 0x00000002 #define ATTR_CMN_FSID 0x00000004 #define ATTR_CMN_OBJTYPE 0x00000008 #define ATTR_CMN_OBJTAG 0x00000010 #define ATTR_CMN_OBJID 0x00000020 #define ATTR_CMN_OBJPERMANENTID 0x00000040 #define ATTR_CMN_PAROBJID 0x00000080 #define ATTR_CMN_SCRIPT 0x00000100 #define ATTR_CMN_CRTIME 0x00000200 #define ATTR_CMN_MODTIME 0x00000400 #define ATTR_CMN_CHGTIME 0x00000800 #define ATTR_CMN_ACCTIME 0x00001000 #define ATTR_CMN_BKUPTIME 0x00002000 #define ATTR_CMN_FNDRINFO 0x00004000 #define ATTR_CMN_OWNERID 0x00008000 #define ATTR_CMN_GRPID 0x00010000 #define ATTR_CMN_ACCESSMASK 0x00020000 #define ATTR_CMN_FLAGS 0x00040000 /* The following were defined as: */ /* #define ATTR_CMN_NAMEDATTRCOUNT 0x00080000 */ /* #define ATTR_CMN_NAMEDATTRLIST 0x00100000 */ /* These bits have been salvaged for use as: */ /* #define ATTR_CMN_GEN_COUNT 0x00080000 */ /* #define ATTR_CMN_DOCUMENT_ID 0x00100000 */ /* They can only be used with the FSOPT_ATTR_CMN_EXTENDED */ /* option flag. */ #define ATTR_CMN_GEN_COUNT 0x00080000 #define ATTR_CMN_DOCUMENT_ID 0x00100000 #define ATTR_CMN_USERACCESS 0x00200000 #define ATTR_CMN_EXTENDED_SECURITY 0x00400000 #define ATTR_CMN_UUID 0x00800000 #define ATTR_CMN_GRPUUID 0x01000000 #define ATTR_CMN_FILEID 0x02000000 #define ATTR_CMN_PARENTID 0x04000000 #define ATTR_CMN_FULLPATH 0x08000000 #define ATTR_CMN_ADDEDTIME 0x10000000 #define ATTR_CMN_ERROR 0x20000000 #define ATTR_CMN_DATA_PROTECT_FLAGS 0x40000000 /* * ATTR_CMN_RETURNED_ATTRS is only valid with getattrlist(2) and * getattrlistbulk(2). It is always the first attribute in the return buffer. */ #define ATTR_CMN_RETURNED_ATTRS 0x80000000 #define ATTR_CMN_VALIDMASK 0xFFFFFFFF /* * The settable ATTR_CMN_* attributes include the following: * ATTR_CMN_SCRIPT * ATTR_CMN_CRTIME * ATTR_CMN_MODTIME * ATTR_CMN_CHGTIME * * ATTR_CMN_ACCTIME * ATTR_CMN_BKUPTIME * ATTR_CMN_FNDRINFO * ATTR_CMN_OWNERID * * ATTR_CMN_GRPID * ATTR_CMN_ACCESSMASK * ATTR_CMN_FLAGS * * ATTR_CMN_EXTENDED_SECURITY * ATTR_CMN_UUID * * ATTR_CMN_GRPUUID * * ATTR_CMN_DATA_PROTECT_FLAGS */ #define ATTR_CMN_SETMASK 0x51C7FF00 #define ATTR_CMN_VOLSETMASK 0x00006700 #define ATTR_VOL_FSTYPE 0x00000001 #define ATTR_VOL_SIGNATURE 0x00000002 #define ATTR_VOL_SIZE 0x00000004 #define ATTR_VOL_SPACEFREE 0x00000008 #define ATTR_VOL_SPACEAVAIL 0x00000010 #define ATTR_VOL_MINALLOCATION 0x00000020 #define ATTR_VOL_ALLOCATIONCLUMP 0x00000040 #define ATTR_VOL_IOBLOCKSIZE 0x00000080 #define ATTR_VOL_OBJCOUNT 0x00000100 #define ATTR_VOL_FILECOUNT 0x00000200 #define ATTR_VOL_DIRCOUNT 0x00000400 #define ATTR_VOL_MAXOBJCOUNT 0x00000800 #define ATTR_VOL_MOUNTPOINT 0x00001000 #define ATTR_VOL_NAME 0x00002000 #define ATTR_VOL_MOUNTFLAGS 0x00004000 #define ATTR_VOL_MOUNTEDDEVICE 0x00008000 #define ATTR_VOL_ENCODINGSUSED 0x00010000 #define ATTR_VOL_CAPABILITIES 0x00020000 #define ATTR_VOL_UUID 0x00040000 #define ATTR_VOL_SPACEUSED 0x00800000 #define ATTR_VOL_QUOTA_SIZE 0x10000000 #define ATTR_VOL_RESERVED_SIZE 0x20000000 #define ATTR_VOL_ATTRIBUTES 0x40000000 #define ATTR_VOL_INFO 0x80000000 #define ATTR_VOL_VALIDMASK 0xF087FFFF /* * The list of settable ATTR_VOL_* attributes include the following: * ATTR_VOL_NAME * ATTR_VOL_INFO */ #define ATTR_VOL_SETMASK 0x80002000 /* File/directory attributes: */ #define ATTR_DIR_LINKCOUNT 0x00000001 #define ATTR_DIR_ENTRYCOUNT 0x00000002 #define ATTR_DIR_MOUNTSTATUS 0x00000004 #define ATTR_DIR_ALLOCSIZE 0x00000008 #define ATTR_DIR_IOBLOCKSIZE 0x00000010 #define ATTR_DIR_DATALENGTH 0x00000020 /* ATTR_DIR_MOUNTSTATUS Flags: */ #define DIR_MNTSTATUS_MNTPOINT 0x00000001 #define DIR_MNTSTATUS_TRIGGER 0x00000002 #define ATTR_DIR_VALIDMASK 0x0000003f #define ATTR_DIR_SETMASK 0x00000000 #define ATTR_FILE_LINKCOUNT 0x00000001 #define ATTR_FILE_TOTALSIZE 0x00000002 #define ATTR_FILE_ALLOCSIZE 0x00000004 #define ATTR_FILE_IOBLOCKSIZE 0x00000008 #define ATTR_FILE_DEVTYPE 0x00000020 #define ATTR_FILE_FORKCOUNT 0x00000080 #define ATTR_FILE_FORKLIST 0x00000100 #define ATTR_FILE_DATALENGTH 0x00000200 #define ATTR_FILE_DATAALLOCSIZE 0x00000400 #define ATTR_FILE_RSRCLENGTH 0x00001000 #define ATTR_FILE_RSRCALLOCSIZE 0x00002000 #define ATTR_FILE_VALIDMASK 0x000037FF /* * Settable ATTR_FILE_* attributes include: * ATTR_FILE_DEVTYPE */ #define ATTR_FILE_SETMASK 0x00000020 /* CMNEXT attributes extend the common attributes, but in the forkattr field */ #define ATTR_CMNEXT_RELPATH 0x00000004 #define ATTR_CMNEXT_PRIVATESIZE 0x00000008 #define ATTR_CMNEXT_LINKID 0x00000010 #define ATTR_CMNEXT_NOFIRMLINKPATH 0x00000020 #define ATTR_CMNEXT_REALDEVID 0x00000040 #define ATTR_CMNEXT_REALFSID 0x00000080 #define ATTR_CMNEXT_CLONEID 0x00000100 #define ATTR_CMNEXT_EXT_FLAGS 0x00000200 #define ATTR_CMNEXT_RECURSIVE_GENCOUNT 0x00000400 #define ATTR_CMNEXT_VALIDMASK 0x000007fc #define ATTR_CMNEXT_SETMASK 0x00000000 /* Deprecated fork attributes */ #define ATTR_FORK_TOTALSIZE 0x00000001 #define ATTR_FORK_ALLOCSIZE 0x00000002 #define ATTR_FORK_RESERVED 0xffffffff #define ATTR_FORK_VALIDMASK 0x00000003 #define ATTR_FORK_SETMASK 0x00000000 /* Obsolete, implemented, not supported */ #define ATTR_CMN_NAMEDATTRCOUNT 0x00080000 #define ATTR_CMN_NAMEDATTRLIST 0x00100000 #define ATTR_FILE_CLUMPSIZE 0x00000010 /* obsolete */ #define ATTR_FILE_FILETYPE 0x00000040 /* always zero */ #define ATTR_FILE_DATAEXTENTS 0x00000800 /* obsolete, HFS-specific */ #define ATTR_FILE_RSRCEXTENTS 0x00004000 /* obsolete, HFS-specific */ /* Required attributes for getattrlistbulk(2) */ #define ATTR_BULK_REQUIRED (ATTR_CMN_NAME | ATTR_CMN_RETURNED_ATTRS) /* * Searchfs */ #define SRCHFS_START 0x00000001 #define SRCHFS_MATCHPARTIALNAMES 0x00000002 #define SRCHFS_MATCHDIRS 0x00000004 #define SRCHFS_MATCHFILES 0x00000008 #define SRCHFS_SKIPLINKS 0x00000010 #define SRCHFS_SKIPINVISIBLE 0x00000020 #define SRCHFS_SKIPPACKAGES 0x00000040 #define SRCHFS_SKIPINAPPROPRIATE 0x00000080 #define SRCHFS_NEGATEPARAMS 0x80000000 #define SRCHFS_VALIDOPTIONSMASK 0x800000FF struct fssearchblock { struct attrlist *returnattrs; void *returnbuffer; size_t returnbuffersize; u_long maxmatches; struct timeval timelimit; void *searchparams1; size_t sizeofsearchparams1; void *searchparams2; size_t sizeofsearchparams2; struct attrlist searchattrs; }; struct searchstate { uint32_t ss_union_flags; // for SRCHFS_START uint32_t ss_union_layer; // 0 = top u_char ss_fsstate[548]; // fs private } __attribute__((packed)); #define FST_EOF (-1) /* end-of-file offset */ #endif /* __APPLE_API_UNSTABLE */ #endif /* !_SYS_ATTR_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/buf.h ================================================ /* * Copyright (c) 2000-2016 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@ */ /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */ /* * Copyright (c) 1982, 1986, 1989, 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. * * @(#)buf.h 8.9 (Berkeley) 3/30/95 */ #ifndef _SYS_BUF_H_ #define _SYS_BUF_H_ #include #include #include #include #define B_WRITE 0x00000000 /* Write buffer (pseudo flag). */ #define B_READ 0x00000001 /* Read buffer. */ #define B_ASYNC 0x00000002 /* Start I/O, do not wait. */ #define B_NOCACHE 0x00000004 /* Do not cache block after use. */ #define B_DELWRI 0x00000008 /* Delay I/O until buffer reused. */ #define B_LOCKED 0x00000010 /* Locked in core (not reusable). */ #define B_PHYS 0x00000020 /* I/O to user memory. */ #define B_CLUSTER 0x00000040 /* UPL based I/O generated by cluster layer */ #define B_PAGEIO 0x00000080 /* Page in/out */ #define B_META 0x00000100 /* buffer contains meta-data. */ #define B_RAW 0x00000200 /* Set by physio for raw transfers. */ #define B_FUA 0x00000400 /* Write-through disk cache(if supported) */ #define B_PASSIVE 0x00000800 /* PASSIVE I/Os are ignored by THROTTLE I/O */ #define B_IOSTREAMING 0x00001000 /* sequential access pattern detected */ #define B_THROTTLED_IO 0x00002000 /* low priority I/O (deprecated) */ #define B_ENCRYPTED_IO 0x00004000 /* Encrypted I/O */ #define B_STATICCONTENT 0x00008000 /* Buffer is likely to remain unaltered */ /* * make sure to check when adding flags that * that the new flags don't overlap the definitions * in buf_internal.h */ __BEGIN_DECLS /*! * @function buf_markaged * @abstract Mark a buffer as "aged," i.e. as a good candidate to be discarded and reused after buf_brelse(). * @param bp Buffer to mark. */ void buf_markaged(buf_t bp); /*! * @function buf_markinvalid * @abstract Mark a buffer as not having valid data and being ready for immediate reuse after buf_brelse(). * @param bp Buffer to mark. */ void buf_markinvalid(buf_t bp); /*! * @function buf_markdelayed * @abstract Mark a buffer as a delayed write: mark it dirty without actually scheduling I/O. * @discussion Data will be flushed to disk at some later time, not with brelse(). A sync()/fsync() * or pressure necessitating reuse of the buffer will cause it to be written back to disk. * @param bp Buffer to mark. */ void buf_markdelayed(buf_t bp); void buf_markclean(buf_t); /*! * @function buf_markeintr * @abstract Mark a buffer as having been interrupted during I/O. * @discussion Waiters for I/O to complete (buf_biowait()) will return with EINTR when woken up. * buf_markeintr does not itself do a wakeup. * @param bp Buffer to mark. */ void buf_markeintr(buf_t bp); /*! * @function buf_markfua * @abstract Mark a buffer for write through disk cache, if disk supports it. * @param bp Buffer to mark. */ void buf_markfua(buf_t bp); /*! * @function buf_fua * @abstract Check if a buffer is marked for write through disk caches. * @param bp Buffer to test. * @return Nonzero if buffer is marked for write-through, 0 if not. */ int buf_fua(buf_t bp); /*! * @function buf_valid * @abstract Check if a buffer contains valid data. * @param bp Buffer to test. * @return Nonzero if buffer has valid data, 0 if not. */ int buf_valid(buf_t bp); /*! * @function buf_fromcache * @abstract Check if a buffer's data was found in core. * @discussion Will return truth after a buf_getblk that finds a valid buffer in the cache or the relevant * data in core (but not in a buffer). * @param bp Buffer to test. * @return Nonzero if we got this buffer's data without doing I/O, 0 if not. */ int buf_fromcache(buf_t bp); /*! * @function buf_upl * @abstract Get the upl (Universal Page List) associated with a buffer. * @discussion Buffers allocated with buf_alloc() are not returned with a upl, and * traditional buffers only have a upl while an I/O is in progress. * @param bp Buffer whose upl to grab. * @return Buffer's upl if it has one, else NULL. */ void * buf_upl(buf_t bp); /*! * @function buf_uploffset * @abstract Get the offset into a UPL at which this buffer begins. * @discussion This function should only be called on iobufs, i.e. buffers allocated with buf_alloc(). * @param bp Buffer whose uploffset to grab. * @return Buffer's uploffset--does not check whether that value makes sense for this buffer. */ uint32_t buf_uploffset(buf_t bp); /*! * @function buf_rcred * @abstract Get the credential associated with a buffer for reading. * @discussion No reference is taken; if the credential is to be held on to persistently, an additional * reference must be taken with kauth_cred_ref. * @param bp Buffer whose credential to grab. * @return Credential if it exists, else NULL. */ kauth_cred_t buf_rcred(buf_t bp); /*! * @function buf_wcred * @abstract Get the credential associated with a buffer for writing. * @discussion No reference is taken; if the credential is to be held on to persistently, an additional * reference must be taken with kauth_cred_ref. * @param bp Buffer whose credential to grab. * @return Credential if it exists, else NULL. */ kauth_cred_t buf_wcred(buf_t bp); /*! * @function buf_proc * @abstract Get the process associated with this buffer. * @discussion buf_proc() will generally return NULL; a process is currently only associated with * a buffer in the event of a physio() call. * @param bp Buffer whose associated process to find. * @return Associated process, possibly NULL. */ proc_t buf_proc(buf_t bp); /*! * @function buf_dirtyoff * @abstract Get the starting offset of the dirty region associated with a buffer. * @discussion The dirty offset is zero unless someone explicitly calls buf_setdirtyoff() (which the kernel does not). * @param bp Buffer whose dirty offset to get. * @return Dirty offset (0 if not explicitly changed). */ uint32_t buf_dirtyoff(buf_t bp); /*! * @function buf_dirtyend * @abstract Get the ending offset of the dirty region associated with a buffer. * @discussion If the buffer's data was found incore and dirty, the dirty end is the size of the block; otherwise, unless * someone outside of xnu explicitly changes it by calling buf_setdirtyend(), it will be zero. * @param bp Buffer whose dirty end to get. * @return 0 if buffer is found clean; size of buffer if found dirty. Can be set to any value by callers of buf_setdirtyend(). */ uint32_t buf_dirtyend(buf_t bp); /*! * @function buf_setdirtyoff * @abstract Set the starting offset of the dirty region associated with a buffer. * @discussion This value is zero unless someone set it explicitly. * @param bp Buffer whose dirty end to set. */ void buf_setdirtyoff(buf_t bp, uint32_t); /*! * @function buf_setdirtyend * @abstract Set the ending offset of the dirty region associated with a buffer. * @discussion If the buffer's data was found incore and dirty, the dirty end is the size of the block; otherwise, unless * someone outside of xnu explicitly changes it by calling buf_setdirtyend(), it will be zero. * @param bp Buffer whose dirty end to set. */ void buf_setdirtyend(buf_t bp, uint32_t); /*! * @function buf_error * @abstract Get the error value associated with a buffer. * @discussion Errors are set with buf_seterror(). * @param bp Buffer whose error value to retrieve. * @return Error value, directly. */ errno_t buf_error(buf_t bp); /*! * @function buf_seterror * @abstract Set an error value on a buffer. * @param bp Buffer whose error value to set. */ void buf_seterror(buf_t bp, errno_t); /*! * @function buf_setflags * @abstract Set flags on a buffer. * @discussion buffer_flags |= flags * @param bp Buffer whose flags to set. * @param flags Flags to add to buffer's mask. B_LOCKED/B_NOCACHE/B_ASYNC/B_READ/B_WRITE/B_PAGEIO/B_FUA */ void buf_setflags(buf_t bp, int32_t flags); /*! * @function buf_clearflags * @abstract Clear flags on a buffer. * @discussion buffer_flags &= ~flags * @param bp Buffer whose flags to clear. * @param flags Flags to remove from buffer's mask. B_LOCKED/B_NOCACHE/B_ASYNC/B_READ/B_WRITE/B_PAGEIO/B_FUA */ void buf_clearflags(buf_t bp, int32_t flags); /*! * @function buf_flags * @abstract Get flags set on a buffer. * @discussion Valid flags are B_LOCKED/B_NOCACHE/B_ASYNC/B_READ/B_WRITE/B_PAGEIO/B_FUA. * @param bp Buffer whose flags to grab. * @return flags. */ int32_t buf_flags(buf_t bp); /*! * @function buf_reset * @abstract Reset I/O flag state on a buffer. * @discussion Clears current flags on a buffer (internal and external) and allows some new flags to be set. * Used perhaps to prepare an iobuf for reuse. * @param bp Buffer whose flags to grab. * @param flags Flags to set on buffer: B_READ, B_WRITE, B_ASYNC, B_NOCACHE. */ void buf_reset(buf_t bp, int32_t flags); /*! * @function buf_map * @abstract Get virtual mappings for buffer data. * @discussion For buffers created through buf_getblk() (i.e. traditional buffer cache usage), * buf_map() just returns the address at which data was mapped by but_getblk(). For a B_CLUSTER buffer, i.e. an iobuf * whose upl state is managed manually, there are two possibilities. If the buffer was created * with an underlying "real" buffer through cluster_bp(), the mapping of the "real" buffer is returned. * Otherwise, the buffer was created with buf_alloc() and buf_setupl() was subsequently called; buf_map() * will call ubc_upl_map() to get a mapping for the buffer's upl and return the start of that mapping * plus the buffer's upl offset (set in buf_setupl()). In the last case, buf_unmap() must later be called * to tear down the mapping. NOTE: buf_map() does not set the buffer data pointer; this must be done with buf_setdataptr(). * @param bp Buffer whose mapping to find or create. * @param io_addr Destination for mapping address. * @return 0 for success, ENOMEM if unable to map the buffer. */ errno_t buf_map(buf_t bp, caddr_t *io_addr); /*! * @function buf_map_range * @abstract Get virtual mappings for buffer data. * @discussion Similar to buf_map but the focus is on a range * of the UPL. The b_uploffset and b_count control what part of the UPL will be mapped. * @param bp Buffer whose mapping to find or create. * @param io_addr Destination for mapping address. * @return 0 for success, ENOMEM if unable to map the buffer. */ errno_t buf_map_range(buf_t bp, caddr_t *io_addr); /*! * @function buf_unmap * @abstract Release mappings for buffer data. * @discussion For buffers created through buf_getblk() (i.e. traditional buffer cache usage), * buf_unmap() does nothing; buf_brelse() will take care of unmapping. For a B_CLUSTER buffer, i.e. an iobuf * whose upl state is managed manually, there are two possibilities. If the buffer was created * with an underlying "real" buffer through cluster_bp(), buf_unmap() does nothing; buf_brelse() on the * underlying buffer will tear down the mapping. Otherwise, the buffer was created with buf_alloc() and * buf_setupl() was subsequently called; buf_map() created the mapping. In this case, buf_unmap() will * unmap the buffer. * @param bp Buffer whose mapping to find or create. * @return 0 for success, EINVAL if unable to unmap buffer. */ errno_t buf_unmap(buf_t bp); /*! * @function buf_unmap_range * @abstract Release mappings for buffer data. * @discussion Similar to buf_unmap but the focus is on a range * of the UPL. The b_uploffset and b_count control what part of the UPL will be unmapped. * @param bp Buffer whose mapping to find or create. * @return 0 for success, EINVAL if unable to unmap buffer. */ errno_t buf_unmap_range(buf_t bp); /*! * @function buf_setdrvdata * @abstract Set driver-specific data on a buffer. * @param bp Buffer whose driver-data to set. * @param drvdata Opaque driver data. */ void buf_setdrvdata(buf_t bp, void *drvdata); /*! * @function buf_setdrvdata * @abstract Get driver-specific data from a buffer. * @param bp Buffer whose driver data to get. * @return Opaque driver data. */ void * buf_drvdata(buf_t bp); /*! * @function buf_setfsprivate * @abstract Set filesystem-specific data on a buffer. * @param bp Buffer whose filesystem data to set. * @param fsprivate Opaque filesystem data. */ void buf_setfsprivate(buf_t bp, void *fsprivate); /*! * @function buf_fsprivate * @abstract Get filesystem-specific data from a buffer. * @param bp Buffer whose filesystem data to get. * @return Opaque filesystem data. */ void * buf_fsprivate(buf_t bp); /*! * @function buf_blkno * @abstract Get physical block number associated with a buffer, in the sense of VNOP_BLOCKMAP. * @discussion When a buffer's physical block number is the same is its logical block number, then the physical * block number is considered uninitialized. A physical block number of -1 indicates that there is no valid * physical mapping (e.g. the logical block is invalid or corresponds to a sparse region in a file). Physical * block number is normally set by the cluster layer or by buf_getblk(). * @param bp Buffer whose physical block number to get. * @return Block number. */ daddr64_t buf_blkno(buf_t bp); /*! * @function buf_lblkno * @abstract Get logical block number associated with a buffer. * @discussion Logical block number is set on traditionally-used buffers by an argument passed to buf_getblk(), * for example by buf_bread(). * @param bp Buffer whose logical block number to get. * @return Block number. */ daddr64_t buf_lblkno(buf_t bp); /*! * @function buf_lblksize * @abstract Get the block size used to calculate the logical block number associated with a buffer. * @discussion Logical block number is set on traditionally-used buffers by an argument passed to buf_getblk(), * for example by buf_bread(). Block size is the block size used to calculate the file offset. * @param bp Buffer whose logical block size to get. * @return Block size. */ uint32_t buf_lblksize(buf_t bp); /*! * @function buf_setblkno * @abstract Set physical block number associated with a buffer. * @discussion Physical block number is generally set by the cluster layer or by buf_getblk(). * @param bp Buffer whose physical block number to set. * @param blkno Block number to set. */ void buf_setblkno(buf_t bp, daddr64_t blkno); /*! * @function buf_setlblkno * @abstract Set logical block number associated with a buffer. * @discussion Logical block number is set on traditionally-used buffers by an argument passed to buf_getblk(), * for example by buf_bread(). * @param bp Buffer whose logical block number to set. * @param lblkno Block number to set. */ void buf_setlblkno(buf_t bp, daddr64_t lblkno); /*! * @function buf_setlblksize * @abstract Set block size used to set the logical block number associated with a buffer. * @discussion Logical block number is set on traditionally-used buffers by an argument passed to buf_getblk(), * for example by buf_bread(). * @param bp Buffer whose logical block size to set. * @param lblksize Block size to set. */ void buf_setlblksize(buf_t bp, uint32_t lblksize); /*! * @function buf_count * @abstract Get count of valid bytes in a buffer. This may be less than the space allocated to the buffer. * @param bp Buffer whose byte count to get. * @return Byte count. */ uint32_t buf_count(buf_t bp); /*! * @function buf_size * @abstract Get size of data region allocated to a buffer. * @discussion May be larger than amount of valid data in buffer. * @param bp Buffer whose size to get. * @return Size. */ uint32_t buf_size(buf_t bp); /*! * @function buf_resid * @abstract Get a count of bytes which were not consumed by an I/O on a buffer. * @discussion Set when an I/O operations completes. * @param bp Buffer whose outstanding count to get. * @return Count of unwritten/unread bytes. */ uint32_t buf_resid(buf_t bp); /*! * @function buf_setcount * @abstract Set count of valid bytes in a buffer. This may be less than the space allocated to the buffer. * @param bp Buffer whose byte count to set. * @param bcount Count to set. */ void buf_setcount(buf_t bp, uint32_t bcount); /*! * @function buf_setsize * @abstract Set size of data region allocated to a buffer. * @discussion May be larger than amount of valid data in buffer. Should be used by * code which is manually providing storage for an iobuf, one allocated with buf_alloc(). * @param bp Buffer whose size to set. */ void buf_setsize(buf_t bp, uint32_t); /*! * @function buf_setresid * @abstract Set a count of bytes outstanding for I/O in a buffer. * @discussion Set when an I/O operations completes. Examples: called by IOStorageFamily when I/O * completes, often called on an "original" buffer when using a manipulated buffer to perform I/O * on behalf of the first. * @param bp Buffer whose outstanding count to set. */ void buf_setresid(buf_t bp, uint32_t resid); /*! * @function buf_setdataptr * @abstract Set the address at which a buffer's data will be stored. * @discussion In traditional buffer use, the data pointer will be set automatically. This routine is * useful with iobufs (allocated with buf_alloc()). * @param bp Buffer whose data pointer to set. * @param data Pointer to data region. */ void buf_setdataptr(buf_t bp, uintptr_t data); /*! * @function buf_dataptr * @abstract Get the address at which a buffer's data is stored; for iobufs, this must * be set with buf_setdataptr(). See buf_map(). * @param bp Buffer whose data pointer to retrieve. * @return Data pointer; NULL if unset. */ uintptr_t buf_dataptr(buf_t bp); /*! * @function buf_vnode * @abstract Get the vnode associated with a buffer. * @discussion Every buffer is associated with a file. Because there is an I/O in flight, * there is an iocount on this vnode; it is returned WITHOUT an extra iocount, and vnode_put() * need NOT be called. * @param bp Buffer whose vnode to retrieve. * @return Buffer's vnode. */ vnode_t buf_vnode(buf_t bp); /*! * @function buf_setvnode * @abstract Set the vnode associated with a buffer. * @discussion This call need not be used on traditional buffers; it is for use with iobufs. * @param bp Buffer whose vnode to set. * @param vp The vnode to attach to the buffer. */ void buf_setvnode(buf_t bp, vnode_t vp); /*! * @function buf_device * @abstract Get the device ID associated with a buffer. * @discussion In traditional buffer use, this value is NODEV until buf_strategy() is called unless * buf_getblk() was passed a device vnode. It is set on an iobuf if buf_alloc() is passed a device * vnode or if buf_setdevice() is called. * @param bp Buffer whose device ID to retrieve. * @return Device id. */ dev_t buf_device(buf_t bp); /*! * @function buf_setdevice * @abstract Set the device associated with a buffer. * @discussion A buffer's device is set in buf_strategy() (or in buf_getblk() if the file is a device). * It is also set on an iobuf if buf_alloc() is passed a device vnode. * @param bp Buffer whose device ID to set. * @param vp Device to set on the buffer. * @return 0 for success, EINVAL if vp is not a device file. */ errno_t buf_setdevice(buf_t bp, vnode_t vp); /*! * @function buf_strategy * @abstract Pass an I/O request for a buffer down to the device layer. * @discussion This is one of the most important routines in the buffer cache layer. For buffers obtained * through buf_getblk, it handles finding physical block numbers for the I/O (with VNOP_BLKTOOFF and * VNOP_BLOCKMAP), packaging the I/O into page-sized chunks, and initiating I/O on the disk by calling * the device's strategy routine. If a buffer's UPL has been set manually with buf_setupl(), it assumes * that the request is already correctly configured with a block number and a size divisible by page size * and will just call directly to the device. * @param devvp Device on which to perform I/O * @param ap vnop_strategy_args structure (most importantly, a buffer). * @return 0 for success, or errors from filesystem or device layers. */ errno_t buf_strategy(vnode_t devvp, void *ap); /* * Flags for buf_invalblkno() */ #define BUF_WAIT 0x01 /*! * @function buf_invalblkno * @abstract Invalidate a filesystem logical block in a file. * @discussion buf_invalblkno() tries to make the data for a given block in a file * invalid; if the buffer for that block is found in core and is not busy, we mark it * invalid and call buf_brelse() (see "flags" param for what happens if the buffer is busy). * buf_brelse(), noticing that it is invalid, will * will return the buffer to the empty-buffer list and tell the VM subsystem to abandon * the relevant pages. Data will not be written to backing store--it will be cast aside. * Note that this function will only work if the block in question has been * obtained with a buf_getblk(). If data has been read into core without using * traditional buffer cache routines, buf_invalblkno() will not be able to invalidate it--this * includes the use of iobufs. * @param vp vnode whose block to invalidate. * @param lblkno Logical block number. * @param flags BUF_WAIT: wait for busy buffers to become unbusy and invalidate them then. Otherwise, * just return EBUSY for busy blocks. * @return 0 for success, EINVAL if vp is not a device file. */ errno_t buf_invalblkno(vnode_t vp, daddr64_t lblkno, int flags); /*! * @function buf_callback * @abstract Get the function set to be called when I/O on a buffer completes. * @discussion A function returned by buf_callback was originally set with buf_setcallback(). * @param bp Buffer whose callback to get. * @return 0 for success, or errors from filesystem or device layers. */ void * buf_callback(buf_t bp); /*! * @function buf_setcallback * @abstract Set a function to be called once when I/O on a buffer completes. * @discussion A one-shot callout set with buf_setcallback() will be called from buf_biodone() * when I/O completes. It will be passed the "transaction" argument as well as the buffer. * buf_setcallback() also marks the buffer as B_ASYNC. * @param bp Buffer whose callback to set. * @param callback function to use as callback. * @param transaction Additional argument to callback function. * @return 0; always succeeds. */ errno_t buf_setcallback(buf_t bp, void (*callback)(buf_t, void *), void *transaction); /*! * @function buf_setupl * @abstract Set the UPL (Universal Page List), and offset therein, on a buffer. * @discussion buf_setupl() should only be called on buffers allocated with buf_alloc(). * A subsequent call to buf_map() will map the UPL and give back the address at which data * begins. After buf_setupl() is called, a buffer is marked B_CLUSTER; when this is the case, * buf_strategy() assumes that a buffer is correctly configured to be passed to the device * layer without modification. Passing a NULL upl will clear the upl and the B_CLUSTER flag on the * buffer. * @param bp Buffer whose upl to set. * @param upl UPL to set in the buffer. * @param offset Offset within upl at which relevant data begin. * @return 0 for success, EINVAL if the buffer was not allocated with buf_alloc(). */ errno_t buf_setupl(buf_t bp, upl_t upl, uint32_t offset); /*! * @function buf_clone * @abstract Clone a buffer with a restricted range and an optional callback. * @discussion Generates a buffer which is identical to its "bp" argument except that * it spans a subset of the data of the original. The buffer to be cloned should * have been allocated with buf_alloc(). Checks its arguments to make sure * that the data subset is coherent. Optionally, adds a callback function and argument to it * to be called when I/O completes (as with buf_setcallback(), but B_ASYNC is not set). If the original buffer had * a upl set through buf_setupl(), this upl is copied to the new buffer; otherwise, the original's * data pointer is used raw. The buffer must be released with buf_free(). * @param bp Buffer to clone. * @param io_offset Offset, relative to start of data in original buffer, at which new buffer's data will begin. * @param io_size Size of buffer region in new buffer, in the sense of buf_count(). * @param iodone Callback to be called from buf_biodone() when I/O completes, in the sense of buf_setcallback(). * @param arg Argument to pass to iodone() callback. * @return NULL if io_offset/io_size combination is invalid for the buffer to be cloned; otherwise, the new buffer. */ buf_t buf_clone(buf_t bp, int io_offset, int io_size, void (*iodone)(buf_t, void *), void *arg); /*! * @function buf_create_shadow * @abstract Create a shadow buffer with optional private storage and an optional callback. * @param bp Buffer to shadow. * @param force_copy If TRUE, do not link the shadaow to 'bp' and if 'external_storage' == NULL, * force a copy of the data associated with 'bp'. * @param external_storage If non-NULL, associate it with the new buffer as its storage instead of the * storage currently associated with 'bp'. * @param iodone Callback to be called from buf_biodone() when I/O completes, in the sense of buf_setcallback(). * @param arg Argument to pass to iodone() callback. * @return NULL if the buffer to be shadowed is not B_META or a primary buffer (i.e. not a shadow buffer); otherwise, the new buffer. */ buf_t buf_create_shadow(buf_t bp, boolean_t force_copy, uintptr_t external_storage, void (*iodone)(buf_t, void *), void *arg); /*! * @function buf_shadow * @abstract returns true if 'bp' is a shadow of another buffer. * @param bp Buffer to query. * @return 1 if 'bp' is a shadow, 0 otherwise. */ int buf_shadow(buf_t bp); /*! * @function buf_alloc * @abstract Allocate an uninitialized buffer. * @discussion A buffer returned by buf_alloc() is marked as busy and as an iobuf; it has no storage set up and must be * set up using buf_setdataptr() or buf_setupl()/buf_map(). * @param vp vnode to associate with the buffer: optionally NULL. If vp is a device file, then * the buffer's associated device will be set. If vp is NULL, it can be set later with buf_setvnode(). * @return New buffer. */ buf_t buf_alloc(vnode_t vp); /*! * @function buf_free * @abstract Free a buffer that was allocated with buf_alloc(). * @discussion The storage (UPL, data pointer) associated with an iobuf must be freed manually. * @param bp The buffer to free. */ void buf_free(buf_t bp); /* * flags for buf_invalidateblks */ #define BUF_WRITE_DATA 0x0001 /* write data blocks first */ #define BUF_SKIP_META 0x0002 /* skip over metadata blocks */ #define BUF_INVALIDATE_LOCKED 0x0004 /* force B_LOCKED blocks to be invalidated */ /*! * @function buf_invalidateblks * @abstract Invalidate all the blocks associated with a vnode. * @discussion This function does for all blocks associated with a vnode what buf_invalblkno does for one block. * Again, it will only be able to invalidate data which were populated with traditional buffer cache routines, * i.e. by buf_getblk() and callers thereof. Unlike buf_invalblkno(), it can be made to write dirty data to disk * rather than casting it aside. * @param vp The vnode whose data to invalidate. * @param flags BUF_WRITE_DATA: write dirty data to disk with VNOP_BWRITE() before kicking buffer cache entries out. * BUF_SKIP_META: do not invalidate metadata blocks. * @param slpflag Flags to pass to "msleep" while waiting to acquire busy buffers. * @param slptimeo Timeout in "hz" (1/100 second) to wait for a buffer to become unbusy before waking from sleep * and re-starting the scan. * @return 0 for success, error values from msleep(). */ int buf_invalidateblks(vnode_t vp, int flags, int slpflag, int slptimeo); /* * flags for buf_flushdirtyblks and buf_iterate */ #define BUF_SKIP_NONLOCKED 0x01 #define BUF_SKIP_LOCKED 0x02 #define BUF_SCAN_CLEAN 0x04 /* scan the clean buffers */ #define BUF_SCAN_DIRTY 0x08 /* scan the dirty buffers */ #define BUF_NOTIFY_BUSY 0x10 /* notify the caller about the busy pages during the scan */ #define BUF_RETURNED 0 #define BUF_RETURNED_DONE 1 #define BUF_CLAIMED 2 #define BUF_CLAIMED_DONE 3 /*! * @function buf_flushdirtyblks * @abstract Write dirty file blocks to disk. * @param vp The vnode whose blocks to flush. * @param wait Wait for writes to complete before returning. * @param flags Can pass zero, meaning "flush all dirty buffers." * BUF_SKIP_NONLOCKED: Skip buffers which are not busy when we encounter them. * BUF_SKIP_LOCKED: Skip buffers which are busy when we encounter them. * @param msg String to pass to msleep(). */ void buf_flushdirtyblks(vnode_t vp, int wait, int flags, const char *msg); /*! * @function buf_iterate * @abstract Perform some operation on all buffers associated with a vnode. * @param vp The vnode whose buffers to scan. * @param callout Function to call on each buffer. Should return one of: * BUF_RETURNED: buf_iterate() should call buf_brelse() on the buffer. * BUF_RETURNED_DONE: buf_iterate() should call buf_brelse() on the buffer and then stop iterating. * BUF_CLAIMED: buf_iterate() should continue iterating (and not call buf_brelse()). * BUF_CLAIMED_DONE: buf_iterate() should stop iterating (and not call buf_brelse()). * @param flags * BUF_SKIP_NONLOCKED: Skip buffers which are not busy when we encounter them. BUF_SKIP_LOCKED: Skip buffers which are busy when we encounter them. * BUF_SCAN_CLEAN: Call out on clean buffers. * BUF_SCAN_DIRTY: Call out on dirty buffers. * BUF_NOTIFY_BUSY: If a buffer cannot be acquired, pass a NULL buffer to callout; otherwise, * that buffer will be silently skipped. * @param arg Argument to pass to callout in addition to buffer. */ void buf_iterate(vnode_t vp, int (*callout)(buf_t, void *), int flags, void *arg); /*! * @function buf_clear * @abstract Zero out the storage associated with a buffer. * @discussion Calls buf_map() to get the buffer's data address; for a B_CLUSTER * buffer (one which has had buf_setupl() called on it), it tries to map the buffer's * UPL into memory; should only be called once during the life cycle of an iobuf (one allocated * with buf_alloc()). * @param bp The buffer to zero out. */ void buf_clear(buf_t bp); /*! * @function buf_bawrite * @abstract Start an asychronous write on a buffer. * @discussion Calls VNOP_BWRITE to start the process of propagating an asynchronous write down to the device layer. * Callers can wait for writes to complete at their discretion using buf_biowait(). When this function is called, * data should already have been written to the buffer's data region. * @param bp The buffer on which to initiate I/O. * @return EWOULDBLOCK if write count is high and "throttle" is zero; otherwise, errors from VNOP_BWRITE. */ errno_t buf_bawrite(buf_t bp); /*! * @function buf_bdwrite * @abstract Mark a buffer for delayed write. * @discussion Marks a buffer as waiting for delayed write and the current I/O as complete; data will be written to backing store * before the buffer is reused, but it will not be queued for I/O immediately. Note that for buffers allocated * with buf_alloc(), there are no such guarantees; you must take care of your own flushing to disk. If * the number of delayed writes pending on the system is greater than an internal limit and the caller has not * requested otherwise [see return_error] , buf_bdwrite() will unilaterally launch an asynchronous I/O with buf_bawrite() to keep the pile of * delayed writes from getting too large. * @param bp The buffer to mark for delayed write. * @return EAGAIN for return_error != 0 case, 0 for succeess, errors from buf_bawrite. */ errno_t buf_bdwrite(buf_t bp); /*! * @function buf_bwrite * @abstract Write a buffer's data to backing store. * @discussion Once the data in a buffer has been modified, buf_bwrite() starts sending it to disk by calling * VNOP_STRATEGY. Unless B_ASYNC has been set on the buffer (by buf_setflags() or otherwise), data will have * been written to disk when buf_bwrite() returns. See Bach (p 56). * @param bp The buffer to write to disk. * @return 0 for success; errors from buf_biowait(). */ errno_t buf_bwrite(buf_t bp); /*! * @function buf_biodone * @abstract Mark an I/O as completed. * @discussion buf_biodone() should be called by whosoever decides that an I/O on a buffer is complete; for example, * IOStorageFamily. It clears the dirty flag on a buffer and signals on the vnode that a write has completed * with vnode_writedone(). If a callout or filter has been set on the buffer, that function is called. In the case * of a callout, that function is expected to take care of cleaning up and freeing the buffer. * Otherwise, if the buffer is marked B_ASYNC (e.g. it was passed to buf_bawrite()), then buf_biodone() * considers itself justified in calling buf_brelse() to return it to free lists--no one is waiting for it. Finally, * waiters on the bp (e.g. in buf_biowait()) are woken up. * @param bp The buffer to mark as done with I/O. */ void buf_biodone(buf_t bp); /*! * @function buf_biowait * @abstract Wait for I/O on a buffer to complete. * @discussion Waits for I/O on a buffer to finish, as marked by a buf_biodone() call. * @param bp The buffer to wait on. * @return 0 for a successful wait; nonzero the buffer has been marked as EINTR or had an error set on it. */ errno_t buf_biowait(buf_t bp); /*! * @function buf_brelse * @abstract Release any claim to a buffer, sending it back to free lists. * @discussion buf_brelse() cleans up buffer state and releases a buffer to the free lists. If the buffer * is not marked invalid and its pages are dirty (e.g. a delayed write was made), its data will be commited * to backing store. If it is marked invalid, its data will be discarded completely. * A valid, cacheable buffer will be put on a list and kept in the buffer hash so it * can be found again; otherwise, it will be dissociated from its vnode and treated as empty. Which list a valid * buffer is placed on depends on the use of buf_markaged(), whether it is metadata, and the B_LOCKED flag. A * B_LOCKED buffer will not be available for reuse by other files, though its data may be paged out. * Note that buf_brelse() is intended for use with traditionally allocated buffers. * @param bp The buffer to release. */ void buf_brelse(buf_t bp); /*! * @function buf_bread * @abstract Synchronously read a block of a file. * @discussion buf_bread() is the traditional way to read a single logical block of a file through the buffer cache. * It tries to find the buffer and corresponding page(s) in core, calls VNOP_STRATEGY if necessary to bring the data * into memory, and waits for I/O to complete. It should not be used to read blocks of greater than 4K (one VM page) * in size; use cluster routines for large reads. Indeed, the cluster layer is a more efficient choice for reading DATA * unless you need some finely-tuned semantics that it cannot provide. * @param vp The file from which to read. * @param blkno The logical (filesystem) block number to read. * @param size Size of block; do not use for sizes > 4K. * @param cred Credential to store and use for reading from disk if data are not already in core. * @param bpp Destination pointer for buffer. * @return 0 for success, or an error from buf_biowait(). */ errno_t buf_bread(vnode_t vp, daddr64_t blkno, int size, kauth_cred_t cred, buf_t *bpp); /*! * @function buf_breadn * @abstract Read a block from a file with read-ahead. * @discussion buf_breadn() reads one block synchronously in the style of buf_bread() and fires * off a specified set of asynchronous reads to improve the likelihood of future cache hits. * It should not be used to read blocks of greater than 4K (one VM page) in size; use cluster * routines for large reads. Indeed, the cluster layer is a more efficient choice for reading DATA * unless you need some finely-tuned semantics that it cannot provide. * @param vp The file from which to read. * @param blkno The logical (filesystem) block number to read synchronously. * @param size Size of block; do not use for sizes > 4K. * @param rablks Array of logical block numbers for asynchronous read-aheads. * @param rasizes Array of block sizes for asynchronous read-aheads, each index corresponding to same index in "rablks." * @param nrablks Number of entries in read-ahead arrays. * @param cred Credential to store and use for reading from disk if data are not already in core. * @param bpp Destination pointer for buffer. * @return 0 for success, or an error from buf_biowait(). */ errno_t buf_breadn(vnode_t vp, daddr64_t blkno, int size, daddr64_t *rablks, int *rasizes, int nrablks, kauth_cred_t cred, buf_t *bpp); /*! * @function buf_meta_bread * @abstract Synchronously read a metadata block of a file. * @discussion buf_meta_bread() is the traditional way to read a single logical block of a file through the buffer cache. * It tries to find the buffer and corresponding page(s) in core, calls VNOP_STRATEGY if necessary to bring the data * into memory, and waits for I/O to complete. It should not be used to read blocks of greater than 4K (one VM page) * in size; use cluster routines for large reads. Reading meta-data through the traditional buffer cache, unlike * reading data, is efficient and encouraged, especially if the blocks being read are significantly smaller than page size. * @param vp The file from which to read. * @param blkno The logical (filesystem) block number to read. * @param size Size of block; do not use for sizes > 4K. * @param cred Credential to store and use for reading from disk if data are not already in core. * @param bpp Destination pointer for buffer. * @return 0 for success, or an error from buf_biowait(). */ errno_t buf_meta_bread(vnode_t vp, daddr64_t blkno, int size, kauth_cred_t cred, buf_t *bpp); /*! * @function buf_meta_breadn * @abstract Read a metadata block from a file with read-ahead. * @discussion buf_meta_breadn() reads one block synchronously in the style of buf_meta_bread() and fires * off a specified set of asynchronous reads to improve the likelihood of future cache hits. * It should not be used to read blocks of greater than 4K (one VM page) in size; use cluster * routines for large reads. * @param vp The file from which to read. * @param blkno The logical (filesystem) block number to read synchronously. * @param size Size of block; do not use for sizes > 4K. * @param rablks Array of logical block numbers for asynchronous read-aheads. * @param rasizes Array of block sizes for asynchronous read-aheads, each index corresponding to same index in "rablks." * @param nrablks Number of entries in read-ahead arrays. * @param cred Credential to store and use for reading from disk if data are not already in core. * @param bpp Destination pointer for buffer. * @return 0 for success, or an error from buf_biowait(). */ errno_t buf_meta_breadn(vnode_t vp, daddr64_t blkno, int size, daddr64_t *rablks, int *rasizes, int nrablks, kauth_cred_t cred, buf_t *bpp); /*! * @function minphys * @abstract Adjust a buffer's count to be no more than maximum physical I/O transfer size for the host architecture. * @discussion physio() takes as a parameter a function to bound transfer sizes for each VNOP_STRATEGY() call. minphys() * is a default implementation. It calls buf_setcount() to make the buffer's count the min() of its current count * and the max I/O size for the host architecture. * @param bp The buffer whose byte count to modify. * @return New byte count. */ u_int minphys(buf_t bp); /*! * @function physio * @abstract Perform I/O on a device to/from target memory described by a uio. * @discussion physio() allows I/O directly from a device to user-space memory. It waits * for all I/O to complete before returning. * @param f_strategy Strategy routine to call to initiate I/O. * @param bp Buffer to configure and pass to strategy routine; can be NULL. * @param dev Device on which to perform I/O. * @param flags B_READ or B_WRITE. * @param f_minphys Function which calls buf_setcount() to set a byte count which is suitably * small for the device in question. Returns byte count that has been set (or unchanged) on the buffer. * @param uio UIO describing the I/O operation. * @param blocksize Logical block size for this vnode. * @return 0 for success; EFAULT for an invalid uio; errors from buf_biowait(). */ int physio(void (*f_strategy)(buf_t), buf_t bp, dev_t dev, int flags, u_int (*f_minphys)(buf_t), struct uio *uio, int blocksize); /* * Flags for operation type in getblk() */ #define BLK_READ 0x01 /* buffer for read */ #define BLK_WRITE 0x02 /* buffer for write */ #define BLK_META 0x10 /* buffer for metadata */ /* * modifier for above flags... if set, getblk will only return * a bp that is already valid... i.e. found in the cache */ #define BLK_ONLYVALID 0x80000000 /*! * @function buf_getblk * @abstract Traditional buffer cache routine to get a buffer corresponding to a logical block in a file. * @discussion buf_getblk() gets a buffer, not necessarily containing valid data, representing a block in a file. * A metadata buffer will be returned with its own zone-allocated storage, managed by the traditional buffer-cache * layer, whereas data buffers will be returned hooked into backing by the UBC (which in fact controls the caching of data). * buf_getblk() first looks for the buffer header in cache; if the buffer is in-core but busy, buf_getblk() will wait for it to become * unbusy, depending on the slpflag and slptimeo parameters. If the buffer is found unbusy and is a metadata buffer, * it must already contain valid data and will be returned directly; data buffers will have a UPL configured to * prepare for interaction with the underlying UBC. If the buffer is found in core, it will be marked as such * and buf_fromcache() will return truth. A buffer is allocated and initialized (but not filled with data) * if none is found in core. buf_bread(), buf_breadn(), buf_meta_bread(), and buf_meta_breadn() all * return buffers obtained with buf_getblk(). * @param vp File for which to get block. * @param blkno Logical block number. * @param size Size of block. * @param slpflag Flag to pass to msleep() while waiting for buffer to become unbusy. * @param slptimeo Time, in milliseconds, to wait for buffer to become unbusy. 0 means to wait indefinitely. * @param operation BLK_READ: want a read buffer. BLK_WRITE: want a write buffer. BLK_META: want a metadata buffer. BLK_ONLYVALID: * only return buffers which are found in core (do not allocate anew), and do not change buffer size. The last remark means * that if a given logical block is found in core with a different size than what is requested, the buffer size will not be modified. * @return Buffer found in core or newly allocated, either containing valid data or ready for I/O. */ buf_t buf_getblk(vnode_t vp, daddr64_t blkno, int size, int slpflag, int slptimeo, int operation); /*! * @function buf_geteblk * @abstract Get a metadata buffer which is marked invalid and not associated with any vnode. * @discussion A buffer is returned with zone-allocated storage of the specified size, marked B_META and invalid. * It has no vnode and is not visible in the buffer hash. * @param size Size of buffer. * @return Always returns a new buffer. */ buf_t buf_geteblk(int size); /*! * @function buf_clear_redundancy_flags * @abstract Clear flags on a buffer. * @discussion buffer_redundancy_flags &= ~flags * @param bp Buffer whose flags to clear. * @param flags Flags to remove from buffer's mask */ void buf_clear_redundancy_flags(buf_t bp, uint32_t flags); /*! * @function buf_redundancyflags * @abstract Get redundancy flags set on a buffer. * @param bp Buffer whose redundancy flags to grab. * @return flags. */ uint32_t buf_redundancy_flags(buf_t bp); /*! * @function buf_setredundancyflags * @abstract Set redundancy flags on a buffer. * @discussion buffer_redundancy_flags |= flags * @param bp Buffer whose flags to set. * @param flags Flags to add to buffer's redundancy flags */ void buf_set_redundancy_flags(buf_t bp, uint32_t flags); /*! * @function buf_attr * @abstract Gets the attributes for this buf. * @param bp Buffer whose attributes to get. * @return bufattr_t. */ bufattr_t buf_attr(buf_t bp); /*! * @function buf_markstatic * @abstract Mark a buffer as being likely to contain static data. * @param bp Buffer to mark. */ void buf_markstatic(buf_t bp); /*! * @function buf_static * @abstract Check if a buffer contains static data. * @param bp Buffer to test. * @return Nonzero if buffer has static data, 0 otherwise. */ int buf_static(buf_t bp); /*! * @function bufattr_markiosched * @abstract Mark a buffer as belonging to an io scheduled mount point * @param bap Buffer attributes to mark. * @discussion Marks the buffer so that spec_strategy() will know that it belongs to an io scheduled mount point */ void bufattr_markioscheduled(bufattr_t bap); /*! * @function bufattr_iosched * @abstract Check if a buffer is marked as io scheduled * @param bap Buffer attributes to test. * @return Nonzero if the buffer is marked io scheduled, 0 otherwise. */ int bufattr_ioscheduled(bufattr_t bap); /*! * @function bufattr_markexpeditedmeta * @abstract Mark a metadata I/O buffer as expedited (i.e. requires a high I/O tier). * @param bap Buffer attributes to mark. * @discussion Marks the buffer so that spec_strategy() will know that it should be expedited */ void bufattr_markexpeditedmeta(bufattr_t bap); /*! * @function bufattr_expeditedmeta * @abstract Check if a buffer is marked as expedited metadata I/O. * @param bap Buffer attributes to test. * @return Nonzero if the buffer is marked expedited metadata I/O, 0 otherwise. */ int bufattr_expeditedmeta(bufattr_t bap); __END_DECLS /* Macros to clear/set/test flags. */ #define SET(t, f) (t) |= (f) #define CLR(t, f) (t) &= ~(f) #define ISSET(t, f) ((t) & (f)) #endif /* !_SYS_BUF_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/cdefs.h ================================================ /* * 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@ */ /* Copyright 1995 NeXT Computer, Inc. All rights reserved. */ /* * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Berkeley Software Design, 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. * * @(#)cdefs.h 8.8 (Berkeley) 1/9/95 */ #ifndef _CDEFS_H_ #define _CDEFS_H_ #if defined(__cplusplus) #define __BEGIN_DECLS extern "C" { #define __END_DECLS } #else #define __BEGIN_DECLS #define __END_DECLS #endif /* This SDK is designed to work with clang and specific versions of * gcc >= 4.0 with Apple's patch sets */ #if !defined(__GNUC__) || __GNUC__ < 4 #warning "Unsupported compiler detected" #endif /* * Compatibility with compilers and environments that don't support compiler * feature checking function-like macros. */ #ifndef __has_builtin #define __has_builtin(x) 0 #endif #ifndef __has_include #define __has_include(x) 0 #endif #ifndef __has_feature #define __has_feature(x) 0 #endif #ifndef __has_attribute #define __has_attribute(x) 0 #endif #ifndef __has_extension #define __has_extension(x) 0 #endif /* * The __CONCAT macro is used to concatenate parts of symbol names, e.g. * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo. * The __CONCAT macro is a bit tricky -- make sure you don't put spaces * in between its arguments. __CONCAT can also concatenate double-quoted * strings produced by the __STRING macro, but this only works with ANSI C. */ #if defined(__STDC__) || defined(__cplusplus) #define __P(protos) protos /* full-blown ANSI C */ #define __CONCAT(x, y) x ## y #define __STRING(x) #x #define __const const /* define reserved names to standard */ #define __signed signed #define __volatile volatile #if defined(__cplusplus) #define __inline inline /* convert to C++ keyword */ #else #ifndef __GNUC__ #define __inline /* delete GCC keyword */ #endif /* !__GNUC__ */ #endif /* !__cplusplus */ #else /* !(__STDC__ || __cplusplus) */ #define __P(protos) () /* traditional C preprocessor */ #define __CONCAT(x, y) x /**/ y #define __STRING(x) "x" #ifndef __GNUC__ #define __const /* delete pseudo-ANSI C keywords */ #define __inline #define __signed #define __volatile #endif /* !__GNUC__ */ /* * In non-ANSI C environments, new programs will want ANSI-only C keywords * deleted from the program and old programs will want them left alone. * When using a compiler other than gcc, programs using the ANSI C keywords * const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS. * When using "gcc -traditional", we assume that this is the intent; if * __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone. */ #ifndef NO_ANSI_KEYWORDS #define const __const /* convert ANSI C keywords */ #define inline __inline #define signed __signed #define volatile __volatile #endif /* !NO_ANSI_KEYWORDS */ #endif /* !(__STDC__ || __cplusplus) */ /* * __pure2 can be used for functions that are only a function of their scalar * arguments (meaning they can't dereference pointers). * * __stateful_pure can be used for functions that have no side effects, * but depend on the state of the memory. */ #define __dead2 __attribute__((__noreturn__)) #define __pure2 __attribute__((__const__)) #define __stateful_pure __attribute__((__pure__)) /* __unused denotes variables and functions that may not be used, preventing * the compiler from warning about it if not used. */ #define __unused __attribute__((__unused__)) /* __used forces variables and functions to be included even if it appears * to the compiler that they are not used (and would thust be discarded). */ #define __used __attribute__((__used__)) /* __cold marks code used for debugging or that is rarely taken * and tells the compiler to optimize for size and outline code. */ #if __has_attribute(cold) #define __cold __attribute__((__cold__)) #else #define __cold #endif /* __exported denotes symbols that should be exported even when symbols * are hidden by default. * __exported_push/_exported_pop are pragmas used to delimit a range of * symbols that should be exported even when symbols are hidden by default. */ #define __exported __attribute__((__visibility__("default"))) #define __exported_push _Pragma("GCC visibility push(default)") #define __exported_pop _Pragma("GCC visibility pop") /* __deprecated causes the compiler to produce a warning when encountering * code using the deprecated functionality. * __deprecated_msg() does the same, and compilers that support it will print * a message along with the deprecation warning. * This may require turning on such warning with the -Wdeprecated flag. * __deprecated_enum_msg() should be used on enums, and compilers that support * it will print the deprecation warning. * __kpi_deprecated() specifically indicates deprecation of kernel programming * interfaces in Kernel.framework used by KEXTs. */ #define __deprecated __attribute__((__deprecated__)) #if __has_extension(attribute_deprecated_with_message) || \ (defined(__GNUC__) && ((__GNUC__ >= 5) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)))) #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg))) #else #define __deprecated_msg(_msg) __attribute__((__deprecated__)) #endif #if __has_extension(enumerator_attributes) #define __deprecated_enum_msg(_msg) __deprecated_msg(_msg) #else #define __deprecated_enum_msg(_msg) #endif #define __kpi_deprecated(_msg) /* __unavailable causes the compiler to error out when encountering * code using the tagged function */ #if __has_attribute(unavailable) #define __unavailable __attribute__((__unavailable__)) #else #define __unavailable #endif #define __kpi_unavailable #define __kpi_deprecated_arm64_macos_unavailable /* Delete pseudo-keywords wherever they are not available or needed. */ #ifndef __dead #define __dead #define __pure #endif /* * We use `__restrict' as a way to define the `restrict' type qualifier * without disturbing older software that is unaware of C99 keywords. */ #if __STDC_VERSION__ < 199901 #define __restrict #else #define __restrict restrict #endif /* Compatibility with compilers and environments that don't support the * nullability feature. */ #if !__has_feature(nullability) #ifndef __nullable #define __nullable #endif #ifndef __nonnull #define __nonnull #endif #ifndef __null_unspecified #define __null_unspecified #endif #ifndef _Nullable #define _Nullable #endif #ifndef _Nonnull #define _Nonnull #endif #ifndef _Null_unspecified #define _Null_unspecified #endif #endif /* * __disable_tail_calls causes the compiler to not perform tail call * optimization inside the marked function. */ #if __has_attribute(disable_tail_calls) #define __disable_tail_calls __attribute__((__disable_tail_calls__)) #else #define __disable_tail_calls #endif /* * __not_tail_called causes the compiler to prevent tail call optimization * on statically bound calls to the function. It has no effect on indirect * calls. Virtual functions, objective-c methods, and functions marked as * "always_inline" cannot be marked as __not_tail_called. */ #if __has_attribute(not_tail_called) #define __not_tail_called __attribute__((__not_tail_called__)) #else #define __not_tail_called #endif /* * __result_use_check warns callers of a function that not using the function * return value is a bug, i.e. dismissing malloc() return value results in a * memory leak. */ #if __has_attribute(warn_unused_result) #define __result_use_check __attribute__((__warn_unused_result__)) #else #define __result_use_check #endif /* * __swift_unavailable causes the compiler to mark a symbol as specifically * unavailable in Swift, regardless of any other availability in C. */ #if __has_feature(attribute_availability_swift) #define __swift_unavailable(_msg) __attribute__((__availability__(swift, unavailable, message=_msg))) #else #define __swift_unavailable(_msg) #endif /* * __abortlike is the attribute to put on functions like abort() that are * typically used to mark assertions. These optimize the codegen * for outlining while still maintaining debugability. */ #ifndef __abortlike #define __abortlike __dead2 __cold __not_tail_called #endif /* Declaring inline functions within headers is error-prone due to differences * across various versions of the C language and extensions. __header_inline * can be used to declare inline functions within system headers. In cases * where you want to force inlining instead of letting the compiler make * the decision, you can use __header_always_inline. * * Be aware that using inline for functions which compilers may also provide * builtins can behave differently under various compilers. If you intend to * provide an inline version of such a function, you may want to use a macro * instead. * * The check for !__GNUC__ || __clang__ is because gcc doesn't correctly * support c99 inline in some cases: * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55965 */ #if defined(__cplusplus) || \ (__STDC_VERSION__ >= 199901L && \ !defined(__GNUC_GNU_INLINE__) && \ (!defined(__GNUC__) || defined(__clang__))) # define __header_inline inline #elif defined(__GNUC__) && defined(__GNUC_STDC_INLINE__) # define __header_inline extern __inline __attribute__((__gnu_inline__)) #elif defined(__GNUC__) # define __header_inline extern __inline #else /* If we land here, we've encountered an unsupported compiler, * so hopefully it understands static __inline as a fallback. */ # define __header_inline static __inline #endif #ifdef __GNUC__ # define __header_always_inline __header_inline __attribute__ ((__always_inline__)) #else /* Unfortunately, we're using a compiler that we don't know how to force to * inline. Oh well. */ # define __header_always_inline __header_inline #endif /* * Compiler-dependent macros that bracket portions of code where the * "-Wunreachable-code" warning should be ignored. Please use sparingly. */ #if defined(__clang__) # define __unreachable_ok_push \ _Pragma("clang diagnostic push") \ _Pragma("clang diagnostic ignored \"-Wunreachable-code\"") # define __unreachable_ok_pop \ _Pragma("clang diagnostic pop") #elif defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) # define __unreachable_ok_push \ _Pragma("GCC diagnostic push") \ _Pragma("GCC diagnostic ignored \"-Wunreachable-code\"") # define __unreachable_ok_pop \ _Pragma("GCC diagnostic pop") #else # define __unreachable_ok_push # define __unreachable_ok_pop #endif /* * Compiler-dependent macros to declare that functions take printf-like * or scanf-like arguments. They are null except for versions of gcc * that are known to support the features properly. Functions declared * with these attributes will cause compilation warnings if there is a * mismatch between the format string and subsequent function parameter * types. */ #define __printflike(fmtarg, firstvararg) \ __attribute__((__format__ (__printf__, fmtarg, firstvararg))) #define __printf0like(fmtarg, firstvararg) \ __attribute__((__format__ (__printf0__, fmtarg, firstvararg))) #define __scanflike(fmtarg, firstvararg) \ __attribute__((__format__ (__scanf__, fmtarg, firstvararg))) #define __IDSTRING(name, string) static const char name[] __used = string #ifndef __COPYRIGHT #define __COPYRIGHT(s) __IDSTRING(copyright,s) #endif #ifndef __RCSID #define __RCSID(s) __IDSTRING(rcsid,s) #endif #ifndef __SCCSID #define __SCCSID(s) __IDSTRING(sccsid,s) #endif #ifndef __PROJECT_VERSION #define __PROJECT_VERSION(s) __IDSTRING(project_version,s) #endif /* Source compatibility only, ID string not emitted in object file */ #ifndef __FBSDID #define __FBSDID(s) #endif #ifndef __DECONST #define __DECONST(type, var) __CAST_AWAY_QUALIFIER(var, const, type) #endif #ifndef __DEVOLATILE #define __DEVOLATILE(type, var) __CAST_AWAY_QUALIFIER(var, volatile, type) #endif #ifndef __DEQUALIFY #define __DEQUALIFY(type, var) __CAST_AWAY_QUALIFIER(var, const volatile, type) #endif /* * __alloc_size can be used to label function arguments that represent the * size of memory that the function allocates and returns. The one-argument * form labels a single argument that gives the allocation size (where the * arguments are numbered from 1): * * void *malloc(size_t __size) __alloc_size(1); * * The two-argument form handles the case where the size is calculated as the * product of two arguments: * * void *calloc(size_t __count, size_t __size) __alloc_size(1,2); */ #ifndef __alloc_size #if __has_attribute(alloc_size) #define __alloc_size(...) __attribute__((alloc_size(__VA_ARGS__))) #else #define __alloc_size(...) #endif #endif // __alloc_size /* * COMPILATION ENVIRONMENTS -- see compat(5) for additional detail * * DEFAULT By default newly complied code will get POSIX APIs plus * Apple API extensions in scope. * * Most users will use this compilation environment to avoid * behavioral differences between 32 and 64 bit code. * * LEGACY Defining _NONSTD_SOURCE will get pre-POSIX APIs plus Apple * API extensions in scope. * * This is generally equivalent to the Tiger release compilation * environment, except that it cannot be applied to 64 bit code; * its use is discouraged. * * We expect this environment to be deprecated in the future. * * STRICT Defining _POSIX_C_SOURCE or _XOPEN_SOURCE restricts the * available APIs to exactly the set of APIs defined by the * corresponding standard, based on the value defined. * * A correct, portable definition for _POSIX_C_SOURCE is 200112L. * A correct, portable definition for _XOPEN_SOURCE is 600L. * * Apple API extensions are not visible in this environment, * which can cause Apple specific code to fail to compile, * or behave incorrectly if prototypes are not in scope or * warnings about missing prototypes are not enabled or ignored. * * In any compilation environment, for correct symbol resolution to occur, * function prototypes must be in scope. It is recommended that all Apple * tools users add either the "-Wall" or "-Wimplicit-function-declaration" * compiler flags to their projects to be warned when a function is being * used without a prototype in scope. */ /* These settings are particular to each product. */ /* Platform: MacOSX */ #if defined(__i386__) #define __DARWIN_ONLY_64_BIT_INO_T 0 #define __DARWIN_ONLY_UNIX_CONFORMANCE 0 #define __DARWIN_ONLY_VERS_1050 0 #elif defined(__x86_64__) #define __DARWIN_ONLY_64_BIT_INO_T 0 #define __DARWIN_ONLY_UNIX_CONFORMANCE 1 #define __DARWIN_ONLY_VERS_1050 0 #else #define __DARWIN_ONLY_64_BIT_INO_T 1 #define __DARWIN_ONLY_UNIX_CONFORMANCE 1 #define __DARWIN_ONLY_VERS_1050 1 #endif /* * The __DARWIN_ALIAS macros are used to do symbol renaming; they allow * legacy code to use the old symbol, thus maintaining binary compatibility * while new code can use a standards compliant version of the same function. * * __DARWIN_ALIAS is used by itself if the function signature has not * changed, it is used along with a #ifdef check for __DARWIN_UNIX03 * if the signature has changed. Because the __LP64__ environment * only supports UNIX03 semantics it causes __DARWIN_UNIX03 to be * defined, but causes __DARWIN_ALIAS to do no symbol mangling. * * As a special case, when XCode is used to target a specific version of the * OS, the manifest constant __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ * will be defined by the compiler, with the digits representing major version * time 100 + minor version times 10 (e.g. 10.5 := 1050). If we are targeting * pre-10.5, and it is the default compilation environment, revert the * compilation environment to pre-__DARWIN_UNIX03. */ #if !defined(__DARWIN_UNIX03) # if __DARWIN_ONLY_UNIX_CONFORMANCE # if defined(_NONSTD_SOURCE) # error "Can't define _NONSTD_SOURCE when only UNIX conformance is available." # endif /* _NONSTD_SOURCE */ # define __DARWIN_UNIX03 1 # elif defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && ((__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ - 0) < 1040) # define __DARWIN_UNIX03 0 # elif defined(_DARWIN_C_SOURCE) || defined(_XOPEN_SOURCE) || defined(_POSIX_C_SOURCE) # if defined(_NONSTD_SOURCE) # error "Can't define both _NONSTD_SOURCE and any of _DARWIN_C_SOURCE, _XOPEN_SOURCE or _POSIX_C_SOURCE." # endif /* _NONSTD_SOURCE */ # define __DARWIN_UNIX03 1 # elif defined(_NONSTD_SOURCE) # define __DARWIN_UNIX03 0 # else /* default */ # if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && ((__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ - 0) < 1050) # define __DARWIN_UNIX03 0 # else /* __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1050 */ # define __DARWIN_UNIX03 1 # endif /* __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1050 */ # endif /* _DARWIN_C_SOURCE || _XOPEN_SOURCE || _POSIX_C_SOURCE || __LP64__ */ #endif /* !__DARWIN_UNIX03 */ #if !defined(__DARWIN_64_BIT_INO_T) # if defined(_DARWIN_USE_64_BIT_INODE) # if defined(_DARWIN_NO_64_BIT_INODE) # error "Can't define both _DARWIN_USE_64_BIT_INODE and _DARWIN_NO_64_BIT_INODE." # endif /* _DARWIN_NO_64_BIT_INODE */ # define __DARWIN_64_BIT_INO_T 1 # elif defined(_DARWIN_NO_64_BIT_INODE) # if __DARWIN_ONLY_64_BIT_INO_T # error "Can't define _DARWIN_NO_64_BIT_INODE when only 64-bit inodes are available." # endif /* __DARWIN_ONLY_64_BIT_INO_T */ # define __DARWIN_64_BIT_INO_T 0 # else /* default */ # if __DARWIN_ONLY_64_BIT_INO_T # define __DARWIN_64_BIT_INO_T 1 # elif defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && ((__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ - 0) < 1060) || __DARWIN_UNIX03 == 0 # define __DARWIN_64_BIT_INO_T 0 # else /* default */ # define __DARWIN_64_BIT_INO_T 1 # endif /* __DARWIN_ONLY_64_BIT_INO_T */ # endif #endif /* !__DARWIN_64_BIT_INO_T */ #if !defined(__DARWIN_VERS_1050) # if __DARWIN_ONLY_VERS_1050 # define __DARWIN_VERS_1050 1 # elif defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && ((__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ - 0) < 1050) || __DARWIN_UNIX03 == 0 # define __DARWIN_VERS_1050 0 # else /* default */ # define __DARWIN_VERS_1050 1 # endif #endif /* !__DARWIN_VERS_1050 */ #if !defined(__DARWIN_NON_CANCELABLE) # define __DARWIN_NON_CANCELABLE 0 #endif /* !__DARWIN_NON_CANCELABLE */ /* * symbol suffixes used for symbol versioning */ #if __DARWIN_UNIX03 # if __DARWIN_ONLY_UNIX_CONFORMANCE # define __DARWIN_SUF_UNIX03 /* nothing */ # else /* !__DARWIN_ONLY_UNIX_CONFORMANCE */ # define __DARWIN_SUF_UNIX03 "$UNIX2003" # endif /* __DARWIN_ONLY_UNIX_CONFORMANCE */ # if __DARWIN_64_BIT_INO_T # if __DARWIN_ONLY_64_BIT_INO_T # define __DARWIN_SUF_64_BIT_INO_T /* nothing */ # else /* !__DARWIN_ONLY_64_BIT_INO_T */ # define __DARWIN_SUF_64_BIT_INO_T "$INODE64" # endif /* __DARWIN_ONLY_64_BIT_INO_T */ # else /* !__DARWIN_64_BIT_INO_T */ # define __DARWIN_SUF_64_BIT_INO_T /* nothing */ # endif /* __DARWIN_64_BIT_INO_T */ # if __DARWIN_VERS_1050 # if __DARWIN_ONLY_VERS_1050 # define __DARWIN_SUF_1050 /* nothing */ # else /* !__DARWIN_ONLY_VERS_1050 */ # define __DARWIN_SUF_1050 "$1050" # endif /* __DARWIN_ONLY_VERS_1050 */ # else /* !__DARWIN_VERS_1050 */ # define __DARWIN_SUF_1050 /* nothing */ # endif /* __DARWIN_VERS_1050 */ # if __DARWIN_NON_CANCELABLE # define __DARWIN_SUF_NON_CANCELABLE "$NOCANCEL" # else /* !__DARWIN_NON_CANCELABLE */ # define __DARWIN_SUF_NON_CANCELABLE /* nothing */ # endif /* __DARWIN_NON_CANCELABLE */ #else /* !__DARWIN_UNIX03 */ # define __DARWIN_SUF_UNIX03 /* nothing */ # define __DARWIN_SUF_64_BIT_INO_T /* nothing */ # define __DARWIN_SUF_NON_CANCELABLE /* nothing */ # define __DARWIN_SUF_1050 /* nothing */ #endif /* __DARWIN_UNIX03 */ #define __DARWIN_SUF_EXTSN "$DARWIN_EXTSN" /* * symbol versioning macros */ #define __DARWIN_ALIAS(sym) __asm("_" __STRING(sym) __DARWIN_SUF_UNIX03) #define __DARWIN_ALIAS_C(sym) __asm("_" __STRING(sym) __DARWIN_SUF_NON_CANCELABLE __DARWIN_SUF_UNIX03) #define __DARWIN_ALIAS_I(sym) __asm("_" __STRING(sym) __DARWIN_SUF_64_BIT_INO_T __DARWIN_SUF_UNIX03) #define __DARWIN_NOCANCEL(sym) __asm("_" __STRING(sym) __DARWIN_SUF_NON_CANCELABLE) #define __DARWIN_INODE64(sym) __asm("_" __STRING(sym) __DARWIN_SUF_64_BIT_INO_T) #define __DARWIN_1050(sym) __asm("_" __STRING(sym) __DARWIN_SUF_1050) #define __DARWIN_1050ALIAS(sym) __asm("_" __STRING(sym) __DARWIN_SUF_1050 __DARWIN_SUF_UNIX03) #define __DARWIN_1050ALIAS_C(sym) __asm("_" __STRING(sym) __DARWIN_SUF_1050 __DARWIN_SUF_NON_CANCELABLE __DARWIN_SUF_UNIX03) #define __DARWIN_1050ALIAS_I(sym) __asm("_" __STRING(sym) __DARWIN_SUF_1050 __DARWIN_SUF_64_BIT_INO_T __DARWIN_SUF_UNIX03) #define __DARWIN_1050INODE64(sym) __asm("_" __STRING(sym) __DARWIN_SUF_1050 __DARWIN_SUF_64_BIT_INO_T) #define __DARWIN_EXTSN(sym) __asm("_" __STRING(sym) __DARWIN_SUF_EXTSN) #define __DARWIN_EXTSN_C(sym) __asm("_" __STRING(sym) __DARWIN_SUF_EXTSN __DARWIN_SUF_NON_CANCELABLE) /* * symbol release macros */ #include #if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) #define __DARWIN_ALIAS_STARTING(_mac, _iphone, x) __DARWIN_ALIAS_STARTING_IPHONE_##_iphone(x) #elif defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) #define __DARWIN_ALIAS_STARTING(_mac, _iphone, x) __DARWIN_ALIAS_STARTING_MAC_##_mac(x) #else #define __DARWIN_ALIAS_STARTING(_mac, _iphone, x) x #endif /* * POSIX.1 requires that the macros we test be defined before any standard * header file is included. This permits us to convert values for feature * testing, as necessary, using only _POSIX_C_SOURCE. * * Here's a quick run-down of the versions: * defined(_POSIX_SOURCE) 1003.1-1988 * _POSIX_C_SOURCE == 1L 1003.1-1990 * _POSIX_C_SOURCE == 2L 1003.2-1992 C Language Binding Option * _POSIX_C_SOURCE == 199309L 1003.1b-1993 * _POSIX_C_SOURCE == 199506L 1003.1c-1995, 1003.1i-1995, * and the omnibus ISO/IEC 9945-1: 1996 * _POSIX_C_SOURCE == 200112L 1003.1-2001 * _POSIX_C_SOURCE == 200809L 1003.1-2008 * * In addition, the X/Open Portability Guide, which is now the Single UNIX * Specification, defines a feature-test macro which indicates the version of * that specification, and which subsumes _POSIX_C_SOURCE. */ /* Deal with IEEE Std. 1003.1-1990, in which _POSIX_C_SOURCE == 1L. */ #if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE == 1L #undef _POSIX_C_SOURCE #define _POSIX_C_SOURCE 199009L #endif /* Deal with IEEE Std. 1003.2-1992, in which _POSIX_C_SOURCE == 2L. */ #if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE == 2L #undef _POSIX_C_SOURCE #define _POSIX_C_SOURCE 199209L #endif /* Deal with various X/Open Portability Guides and Single UNIX Spec. */ #ifdef _XOPEN_SOURCE #if _XOPEN_SOURCE - 0L >= 700L && (!defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE - 0L < 200809L) #undef _POSIX_C_SOURCE #define _POSIX_C_SOURCE 200809L #elif _XOPEN_SOURCE - 0L >= 600L && (!defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE - 0L < 200112L) #undef _POSIX_C_SOURCE #define _POSIX_C_SOURCE 200112L #elif _XOPEN_SOURCE - 0L >= 500L && (!defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE - 0L < 199506L) #undef _POSIX_C_SOURCE #define _POSIX_C_SOURCE 199506L #endif #endif /* * Deal with all versions of POSIX. The ordering relative to the tests above is * important. */ #if defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE) #define _POSIX_C_SOURCE 198808L #endif /* POSIX C deprecation macros */ #include #define __POSIX_C_DEPRECATED(ver) ___POSIX_C_DEPRECATED_STARTING_##ver /* * Set a single macro which will always be defined and can be used to determine * the appropriate namespace. For POSIX, these values will correspond to * _POSIX_C_SOURCE value. Currently there are two additional levels corresponding * to ANSI (_ANSI_SOURCE) and Darwin extensions (_DARWIN_C_SOURCE) */ #define __DARWIN_C_ANSI 010000L #define __DARWIN_C_FULL 900000L #if defined(_ANSI_SOURCE) #define __DARWIN_C_LEVEL __DARWIN_C_ANSI #elif defined(_POSIX_C_SOURCE) && !defined(_DARWIN_C_SOURCE) && !defined(_NONSTD_SOURCE) #define __DARWIN_C_LEVEL _POSIX_C_SOURCE #else #define __DARWIN_C_LEVEL __DARWIN_C_FULL #endif /* If the developer has neither requested a strict language mode nor a version * of POSIX, turn on functionality provided by __STDC_WANT_LIB_EXT1__ as part * of __DARWIN_C_FULL. */ #if !defined(__STDC_WANT_LIB_EXT1__) && !defined(__STRICT_ANSI__) && __DARWIN_C_LEVEL >= __DARWIN_C_FULL #define __STDC_WANT_LIB_EXT1__ 1 #endif /* * long long is not supported in c89 (__STRICT_ANSI__), but g++ -ansi and * c99 still want long longs. While not perfect, we allow long longs for * g++. */ #if (defined(__STRICT_ANSI__) && (__STDC_VERSION__ - 0 < 199901L) && !defined(__GNUG__)) #define __DARWIN_NO_LONG_LONG 1 #else #define __DARWIN_NO_LONG_LONG 0 #endif /***************************************** * Public darwin-specific feature macros *****************************************/ /* * _DARWIN_FEATURE_64_BIT_INODE indicates that the ino_t type is 64-bit, and * structures modified for 64-bit inodes (like struct stat) will be used. */ #if __DARWIN_64_BIT_INO_T #define _DARWIN_FEATURE_64_BIT_INODE 1 #endif /* * _DARWIN_FEATURE_64_ONLY_BIT_INODE indicates that the ino_t type may only * be 64-bit; there is no support for 32-bit ino_t when this macro is defined * (and non-zero). There is no struct stat64 either, as the regular * struct stat will already be the 64-bit version. */ #if __DARWIN_ONLY_64_BIT_INO_T #define _DARWIN_FEATURE_ONLY_64_BIT_INODE 1 #endif /* * _DARWIN_FEATURE_ONLY_VERS_1050 indicates that only those APIs updated * in 10.5 exists; no pre-10.5 variants are available. */ #if __DARWIN_ONLY_VERS_1050 #define _DARWIN_FEATURE_ONLY_VERS_1050 1 #endif /* * _DARWIN_FEATURE_ONLY_UNIX_CONFORMANCE indicates only UNIX conforming API * are available (the legacy BSD APIs are not available) */ #if __DARWIN_ONLY_UNIX_CONFORMANCE #define _DARWIN_FEATURE_ONLY_UNIX_CONFORMANCE 1 #endif /* * _DARWIN_FEATURE_UNIX_CONFORMANCE indicates whether UNIX conformance is on, * and specifies the conformance level (3 is SUSv3) */ #if __DARWIN_UNIX03 #define _DARWIN_FEATURE_UNIX_CONFORMANCE 3 #endif /* * This macro casts away the qualifier from the variable * * Note: use at your own risk, removing qualifiers can result in * catastrophic run-time failures. */ #ifndef __CAST_AWAY_QUALIFIER #define __CAST_AWAY_QUALIFIER(variable, qualifier, type) (type) (long)(variable) #endif /* * __XNU_PRIVATE_EXTERN is a linkage decoration indicating that a symbol can be * used from other compilation units, but not other libraries or executables. */ #ifndef __XNU_PRIVATE_EXTERN #define __XNU_PRIVATE_EXTERN __attribute__((visibility("hidden"))) #endif /* * Architecture validation for current SDK */ #if !defined(__sys_cdefs_arch_unknown__) && defined(__i386__) #elif !defined(__sys_cdefs_arch_unknown__) && defined(__x86_64__) #elif !defined(__sys_cdefs_arch_unknown__) && defined(__arm__) #elif !defined(__sys_cdefs_arch_unknown__) && defined(__arm64__) #else #error Unsupported architecture #endif #define __compiler_barrier() __asm__ __volatile__("" ::: "memory") #if __has_attribute(enum_extensibility) #define __enum_open __attribute__((__enum_extensibility__(open))) #define __enum_closed __attribute__((__enum_extensibility__(closed))) #else #define __enum_open #define __enum_closed #endif // __has_attribute(enum_extensibility) #if __has_attribute(flag_enum) #define __enum_options __attribute__((__flag_enum__)) #else #define __enum_options #endif /* * Similar to OS_ENUM/OS_CLOSED_ENUM/OS_OPTIONS/OS_CLOSED_OPTIONS * * This provides more advanced type checking on compilers supporting * the proper extensions, even in C. */ #if __has_feature(objc_fixed_enum) || __has_extension(cxx_fixed_enum) || \ __has_extension(cxx_strong_enums) #define __enum_decl(_name, _type, ...) \ typedef enum : _type __VA_ARGS__ __enum_open _name #define __enum_closed_decl(_name, _type, ...) \ typedef enum : _type __VA_ARGS__ __enum_closed _name #define __options_decl(_name, _type, ...) \ typedef enum : _type __VA_ARGS__ __enum_open __enum_options _name #define __options_closed_decl(_name, _type, ...) \ typedef enum : _type __VA_ARGS__ __enum_closed __enum_options _name #else #define __enum_decl(_name, _type, ...) \ typedef _type _name; enum __VA_ARGS__ __enum_open #define __enum_closed_decl(_name, _type, ...) \ typedef _type _name; enum __VA_ARGS__ __enum_closed #define __options_decl(_name, _type, ...) \ typedef _type _name; enum __VA_ARGS__ __enum_open __enum_options #define __options_closed_decl(_name, _type, ...) \ typedef _type _name; enum __VA_ARGS__ __enum_closed __enum_options #endif #define __kernel_ptr_semantics #define __kernel_data_semantics #define __kernel_dual_semantics #endif /* !_CDEFS_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/clonefile.h ================================================ /* * Copyright (c) 2015-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 _SYS_CLONEFILE_H_ #define _SYS_CLONEFILE_H_ /* Options for clonefile calls */ #define CLONE_NOFOLLOW 0x0001 /* Don't follow symbolic links */ #define CLONE_NOOWNERCOPY 0x0002 /* Don't copy ownership information from source */ #include #include #include <_types/_uint32_t.h> #include __BEGIN_DECLS int clonefileat(int, const char *, int, const char *, uint32_t) __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0); int fclonefileat(int, int, const char *, uint32_t) __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0); int clonefile(const char *, const char *, uint32_t) __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0); __END_DECLS #endif /* _SYS_CLONEFILE_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/commpage.h ================================================ /* * 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 _COMMPAGE_H #define _COMMPAGE_H #endif ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/conf.h ================================================ /* * Copyright (c) 2000-2012 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@ */ /* Copyright (c) 1995 NeXT Computer, 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. * * @(#)conf.h 8.5 (Berkeley) 1/9/95 */ #ifndef _SYS_CONF_H_ #define _SYS_CONF_H_ 1 #include #include #include #include /* * Definitions of device driver entry switches */ struct buf; struct proc; struct tty; struct uio; struct vnode; /* * Types for d_type. * These are returned by ioctl FIODTYPE */ #define D_TAPE 1 #define D_DISK 2 #define D_TTY 3 #endif /* _SYS_CONF_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/dir.h ================================================ /* * 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@ */ /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */ /* * Copyright (c) 1982, 1986, 1989, 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. * * @(#)dir.h 8.2 (Berkeley) 1/4/94 */ /* * The information in this file should be obtained from * and is provided solely (and temporarily) for backward compatibility. */ #ifndef _SYS_DIR_H_ #define _SYS_DIR_H_ #include #ifndef __OBJC__ /* * Backwards compatibility. */ #define direct dirent /* * The DIRSIZ macro gives the minimum record length which will hold * the directory entry. This requires the amount of space in struct direct * without the d_name field, plus enough space for the name with a terminating * null byte (dp->d_namlen+1), rounded up to a 4 byte boundary. */ #undef DIRSIZ #define DIRSIZ(dp) \ (((unsigned long)&((struct direct *)0)->d_name + (dp)->d_namlen+1 + 3) & ~3) #endif /* __OBJC__ */ #endif /* !_SYS_DIR_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/dirent.h ================================================ /* * Copyright (c) 2000-2008 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 (c) 1995 NeXT Computer, Inc. All Rights Reserved */ /*- * Copyright (c) 1989, 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. * * @(#)dirent.h 8.3 (Berkeley) 8/10/94 */ /* * The dirent structure defines the format of directory entries. * * A directory entry has a struct dirent at the front of it, containing its * inode number, the length of the entry, and the length of the name * contained in the entry. These are followed by the name padded to a 4 * byte boundary with null bytes. All names are guaranteed null terminated. * The maximum length of a name in a directory is MAXNAMLEN when 32-bit * ino_t is in effect; (MAXPATHLEN - 1) when 64-bit ino_t is in effect. */ #ifndef _SYS_DIRENT_H #define _SYS_DIRENT_H #include #include #include #define __DARWIN_MAXNAMLEN 255 #pragma pack(4) #if !__DARWIN_64_BIT_INO_T struct dirent { ino_t d_ino; /* file number of entry */ __uint16_t d_reclen; /* length of this record */ __uint8_t d_type; /* file type, see below */ __uint8_t d_namlen; /* length of string in d_name */ char d_name[__DARWIN_MAXNAMLEN + 1]; /* name must be no longer than this */ }; #endif /* !__DARWIN_64_BIT_INO_T */ #pragma pack() #define __DARWIN_MAXPATHLEN 1024 #define __DARWIN_STRUCT_DIRENTRY { \ __uint64_t d_ino; /* file number of entry */ \ __uint64_t d_seekoff; /* seek offset (optional, used by servers) */ \ __uint16_t d_reclen; /* length of this record */ \ __uint16_t d_namlen; /* length of string in d_name */ \ __uint8_t d_type; /* file type, see below */ \ char d_name[__DARWIN_MAXPATHLEN]; /* entry name (up to MAXPATHLEN bytes) */ \ } #if __DARWIN_64_BIT_INO_T struct dirent __DARWIN_STRUCT_DIRENTRY; #endif /* __DARWIN_64_BIT_INO_T */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define d_fileno d_ino /* backward compatibility */ #define MAXNAMLEN __DARWIN_MAXNAMLEN /* * File types */ #define DT_UNKNOWN 0 #define DT_FIFO 1 #define DT_CHR 2 #define DT_DIR 4 #define DT_BLK 6 #define DT_REG 8 #define DT_LNK 10 #define DT_SOCK 12 #define DT_WHT 14 /* * Convert between stat structure types and directory types. */ #define IFTODT(mode) (((mode) & 0170000) >> 12) #define DTTOIF(dirtype) ((dirtype) << 12) #endif #endif /* _SYS_DIRENT_H */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/disk.h ================================================ /* * Copyright (c) 1998-2014 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 _SYS_DISK_H_ #define _SYS_DISK_H_ #include #include /* * Definitions * * ioctl description * ------------------------------------- --------------------------------------- * DKIOCEJECT eject media * DKIOCSYNCHRONIZE flush media * * DKIOCFORMAT format media * DKIOCGETFORMATCAPACITIES get media's formattable capacities * * DKIOCGETBLOCKSIZE get media's block size * DKIOCGETBLOCKCOUNT get media's block count * DKIOCGETFIRMWAREPATH get media's firmware path * * DKIOCISFORMATTED is media formatted? * DKIOCISWRITABLE is media writable? * * DKIOCREQUESTIDLE idle media * DKIOCUNMAP delete unused data * * DKIOCGETLOCATION get device's physical location * * DKIOCGETMAXBLOCKCOUNTREAD get maximum block count for reads * DKIOCGETMAXBLOCKCOUNTWRITE get maximum block count for writes * DKIOCGETMAXBYTECOUNTREAD get maximum byte count for reads * DKIOCGETMAXBYTECOUNTWRITE get maximum byte count for writes * * DKIOCGETMAXSEGMENTCOUNTREAD get maximum segment count for reads * DKIOCGETMAXSEGMENTCOUNTWRITE get maximum segment count for writes * DKIOCGETMAXSEGMENTBYTECOUNTREAD get maximum segment byte count for reads * DKIOCGETMAXSEGMENTBYTECOUNTWRITE get maximum segment byte count for writes * * DKIOCGETMINSEGMENTALIGNMENTBYTECOUNT get minimum segment alignment in bytes * DKIOCGETMAXSEGMENTADDRESSABLEBITCOUNT get maximum segment width in bits * * DKIOCGETFEATURES get device's feature set * DKIOCGETPHYSICALBLOCKSIZE get device's block size * DKIOCGETCOMMANDPOOLSIZE get device's queue depth * * DKIOCGETPROVISIONSTATUS get device's block provision status * DKIOCGETIOMINSATURATIONBYTECOUNT get minimum byte count to saturate storage bandwidth * * DKIOCGETERRORDESCRIPTION get description of any drive error * * DKIOCGETMAXSWAPWRITE get maximum swap file write per day in bytes */ #define DK_FEATURE_BARRIER 0x00000002 #define DK_FEATURE_PRIORITY 0x00000004 #define DK_FEATURE_UNMAP 0x00000010 #define DK_SYNCHRONIZE_OPTION_BARRIER 0x00000002 typedef struct{ uint64_t offset; uint64_t length; } dk_extent_t; typedef struct{ char path[128]; } dk_firmware_path_t; typedef struct{ uint64_t blockCount; uint32_t blockSize; uint8_t reserved0096[4]; /* reserved, clear to zero */ } dk_format_capacity_t; typedef struct{ dk_format_capacity_t * capacities; uint32_t capacitiesCount; /* use zero to probe count */ #ifdef __LP64__ uint8_t reserved0096[4]; /* reserved, clear to zero */ #else /* !__LP64__ */ uint8_t reserved0064[8]; /* reserved, clear to zero */ #endif /* !__LP64__ */ } dk_format_capacities_t; typedef struct{ uint64_t offset; uint64_t length; uint32_t options; uint8_t reserved0160[4]; /* reserved, clear to zero */ } dk_synchronize_t; typedef struct{ dk_extent_t * extents; uint32_t extentsCount; uint32_t options; #ifndef __LP64__ uint8_t reserved0096[4]; /* reserved, clear to zero */ #endif /* !__LP64__ */ } dk_unmap_t; typedef struct{ uint64_t flags; uint64_t hotfile_size; /* in bytes */ uint64_t hibernate_minsize; uint64_t swapfile_pinning; uint64_t padding[4]; } dk_corestorage_info_t; #define DK_CORESTORAGE_PIN_YOUR_METADATA 0x00000001 #define DK_CORESTORAGE_ENABLE_HOTFILES 0x00000002 #define DK_CORESTORAGE_PIN_YOUR_SWAPFILE 0x00000004 #define DK_PROVISION_TYPE_MAPPED 0x00 #define DK_PROVISION_TYPE_DEALLOCATED 0x01 #define DK_PROVISION_TYPE_ANCHORED 0x02 typedef struct{ uint64_t offset; uint64_t length; uint8_t provisionType; uint8_t reserved[7]; } dk_provision_extent_t; typedef struct{ uint64_t offset; /* input: logical byte offset */ uint64_t length; /* input: byte length, 0 for whole length */ uint64_t options; /* reserved, clear to zero */ uint32_t reserved; /* not used */ uint32_t extentsCount; /* input/output: count for extents */ dk_provision_extent_t * extents; /* output: provision extents */ } dk_provision_status_t; typedef struct{ uint64_t options; /* reserved, clear to zero */ uint64_t reserved; /* reserved, clear to zero */ uint64_t description_size; char * description; } dk_error_description_t; #define DK_LOCATION_INTERNAL 0x00000000 #define DK_LOCATION_EXTERNAL 0x00000001 #define DKIOCEJECT _IO('d', 21) #define DKIOCSYNCHRONIZE _IOW('d', 22, dk_synchronize_t) #define DKIOCFORMAT _IOW('d', 26, dk_format_capacity_t) #define DKIOCGETFORMATCAPACITIES _IOWR('d', 26, dk_format_capacities_t) #define DKIOCGETBLOCKSIZE _IOR('d', 24, uint32_t) #define DKIOCGETBLOCKCOUNT _IOR('d', 25, uint64_t) #define DKIOCGETFIRMWAREPATH _IOR('d', 28, dk_firmware_path_t) #define DKIOCISFORMATTED _IOR('d', 23, uint32_t) #define DKIOCISWRITABLE _IOR('d', 29, uint32_t) #define DKIOCREQUESTIDLE _IO('d', 30) #define DKIOCUNMAP _IOW('d', 31, dk_unmap_t) #define DKIOCCORESTORAGE _IOR('d', 32, dk_corestorage_info_t) #define DKIOCGETLOCATION _IOR('d', 33, uint64_t) #define DKIOCGETMAXBLOCKCOUNTREAD _IOR('d', 64, uint64_t) #define DKIOCGETMAXBLOCKCOUNTWRITE _IOR('d', 65, uint64_t) #define DKIOCGETMAXBYTECOUNTREAD _IOR('d', 70, uint64_t) #define DKIOCGETMAXBYTECOUNTWRITE _IOR('d', 71, uint64_t) #define DKIOCGETMAXSEGMENTCOUNTREAD _IOR('d', 66, uint64_t) #define DKIOCGETMAXSEGMENTCOUNTWRITE _IOR('d', 67, uint64_t) #define DKIOCGETMAXSEGMENTBYTECOUNTREAD _IOR('d', 68, uint64_t) #define DKIOCGETMAXSEGMENTBYTECOUNTWRITE _IOR('d', 69, uint64_t) #define DKIOCGETMINSEGMENTALIGNMENTBYTECOUNT _IOR('d', 74, uint64_t) #define DKIOCGETMAXSEGMENTADDRESSABLEBITCOUNT _IOR('d', 75, uint64_t) #define DKIOCGETFEATURES _IOR('d', 76, uint32_t) #define DKIOCGETPHYSICALBLOCKSIZE _IOR('d', 77, uint32_t) #define DKIOCGETCOMMANDPOOLSIZE _IOR('d', 78, uint32_t) #define DKIOCGETPROVISIONSTATUS _IOWR('d', 79, dk_provision_status_t) #define DKIOCGETERRORDESCRIPTION _IOR('d', 80, dk_error_description_t) #define DKIOCSYNCHRONIZECACHE _IO('d', 22) #endif /* _SYS_DISK_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/dkstat.h ================================================ /* * 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@ */ /* Copyright (c) 1995 NeXT Computer, 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. * * @(#)dkstat.h 8.2 (Berkeley) 1/21/94 */ #ifndef _SYS_DKSTAT_H_ #define _SYS_DKSTAT_H_ #endif /* _SYS_DKSTAT_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/domain.h ================================================ /* * Copyright (c) 2000-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@ */ /* Copyright (c) 1998, 1999 Apple Computer, Inc. All Rights Reserved */ /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */ /* * Copyright (c) 1982, 1986, 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. * * @(#)domain.h 8.1 (Berkeley) 6/2/93 * $FreeBSD: src/sys/sys/domain.h,v 1.14 1999/12/29 04:24:40 peter Exp $ */ #ifndef _SYS_DOMAIN_H_ #define _SYS_DOMAIN_H_ #endif /* _SYS_DOMAIN_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/dtrace.h ================================================ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. * See the License for the specific language governing permissions * and limitations under the License. * * When distributing Covered Code, include this CDDL HEADER in each * file and include the License file at usr/src/OPENSOLARIS.LICENSE. * If applicable, add the following below this CDDL HEADER, with the * fields enclosed by brackets "[]" replaced with your own identifying * information: Portions Copyright [yyyy] [name of copyright owner] * * CDDL HEADER END */ /* * Portions copyright (c) 2013, Joyent, Inc. All rights reserved. * Portions Copyright (c) 2013 by Delphix. All rights reserved. */ /* * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * * Portions Copyright (c) 2012 by Delphix. All rights reserved. */ #ifndef _SYS_DTRACE_H #define _SYS_DTRACE_H #ifdef __cplusplus extern "C" { #endif /* * DTrace Dynamic Tracing Software: Kernel Interfaces * * Note: The contents of this file are private to the implementation of the * Solaris system and DTrace subsystem and are subject to change at any time * without notice. Applications and drivers using these interfaces will fail * to run on future releases. These interfaces should not be used for any * purpose except those expressly outlined in dtrace(7D) and libdtrace(3LIB). * Please refer to the "Solaris Dynamic Tracing Guide" for more information. */ #ifndef _ASM #if !defined(__APPLE__) #include #include #include #include #include #include #include #else /* is Apple Mac OS X */ #if defined(__LP64__) #if !defined(_LP64) #define _LP64 /* Solaris vs. Darwin */ #endif #else #if !defined(_ILP32) #define _ILP32 /* Solaris vs. Darwin */ #endif #endif #if defined(__BIG_ENDIAN__) #if !defined(_BIG_ENDIAN) #define _BIG_ENDIAN /* Solaris vs. Darwin */ #endif #elif defined(__LITTLE_ENDIAN__) #if !defined(_LITTLE_ENDIAN) #define _LITTLE_ENDIAN /* Solaris vs. Darwin */ #endif #else #error Unknown endian-ness #endif #include #include #include #ifndef NULL #define NULL ((void *)0) /* quiets many warnings */ #endif #define SEC 1 #define MILLISEC 1000 #define MICROSEC 1000000 #define NANOSEC 1000000000 #define S_ROUND(x, a) ((x) + (((a) ? (a) : 1) - 1) & ~(((a) ? (a) : 1) - 1)) #define P2ROUNDUP(x, align) (-(-(x) & -(align))) #define P2PHASEUP(x, align, phase) ((phase) - (((phase) - (x)) & -(align))) #define CTF_MODEL_ILP32 1 /* object data model is ILP32 */ #define CTF_MODEL_LP64 2 /* object data model is LP64 */ #ifdef __LP64__ #define CTF_MODEL_NATIVE CTF_MODEL_LP64 #else #define CTF_MODEL_NATIVE CTF_MODEL_ILP32 #endif typedef uint8_t uchar_t; typedef uint16_t ushort_t; typedef uint32_t uint_t; typedef unsigned long ulong_t; typedef uint64_t u_longlong_t; typedef int64_t longlong_t; typedef int64_t off64_t; typedef int processorid_t; typedef int64_t hrtime_t; typedef enum { B_FALSE = 0, B_TRUE = 1 } _dtrace_boolean; typedef uint8_t UUID[16]; /* For modctl use in dtrace.h */ struct modctl; /* In lieu of Solaris */ /* NOTHING */ /* In lieu of Solaris */ #include /* In lieu of Solaris */ /* In lieu of Solaris */ typedef struct ctf_file ctf_file_t; typedef long ctf_id_t; /* NOTHING */ /* In lieu of Solaris */ /* NOTHING */ /* In lieu of Solaris */ typedef uint32_t zoneid_t; #include #include typedef va_list __va_list; /* Solaris proc_t is the struct. Darwin's proc_t is a pointer to it. */ #define proc_t struct proc /* Steer clear of the Darwin typedef for proc_t */ #include #endif /* __APPLE__ */ /* * DTrace Universal Constants and Typedefs */ #define DTRACE_CPUALL -1 /* all CPUs */ #define DTRACE_IDNONE 0 /* invalid probe identifier */ #define DTRACE_EPIDNONE 0 /* invalid enabled probe identifier */ #define DTRACE_AGGIDNONE 0 /* invalid aggregation identifier */ #define DTRACE_AGGVARIDNONE 0 /* invalid aggregation variable ID */ #define DTRACE_CACHEIDNONE 0 /* invalid predicate cache */ #define DTRACE_PROVNONE 0 /* invalid provider identifier */ #define DTRACE_METAPROVNONE 0 /* invalid meta-provider identifier */ #define DTRACE_ARGNONE -1 /* invalid argument index */ #define DTRACE_PROVNAMELEN 64 #define DTRACE_MODNAMELEN 64 #define DTRACE_FUNCNAMELEN 128 #define DTRACE_NAMELEN 64 #define DTRACE_FULLNAMELEN (DTRACE_PROVNAMELEN + DTRACE_MODNAMELEN + \ DTRACE_FUNCNAMELEN + DTRACE_NAMELEN + 4) #define DTRACE_ARGTYPELEN 128 typedef uint32_t dtrace_id_t; /* probe identifier */ typedef uint32_t dtrace_epid_t; /* enabled probe identifier */ typedef uint32_t dtrace_aggid_t; /* aggregation identifier */ typedef int64_t dtrace_aggvarid_t; /* aggregation variable identifier */ typedef uint16_t dtrace_actkind_t; /* action kind */ typedef int64_t dtrace_optval_t; /* option value */ typedef uint32_t dtrace_cacheid_t; /* predicate cache identifier */ typedef enum dtrace_probespec { DTRACE_PROBESPEC_NONE = -1, DTRACE_PROBESPEC_PROVIDER = 0, DTRACE_PROBESPEC_MOD, DTRACE_PROBESPEC_FUNC, DTRACE_PROBESPEC_NAME } dtrace_probespec_t; /* * DTrace Intermediate Format (DIF) * * The following definitions describe the DTrace Intermediate Format (DIF), a * a RISC-like instruction set and program encoding used to represent * predicates and actions that can be bound to DTrace probes. The constants * below defining the number of available registers are suggested minimums; the * compiler should use DTRACEIOC_CONF to dynamically obtain the number of * registers provided by the current DTrace implementation. */ #define DIF_VERSION_1 1 /* DIF version 1: Solaris 10 Beta */ #define DIF_VERSION_2 2 /* DIF version 2: Solaris 10 FCS */ #define DIF_VERSION DIF_VERSION_2 /* latest DIF instruction set version */ #define DIF_DIR_NREGS 8 /* number of DIF integer registers */ #define DIF_DTR_NREGS 8 /* number of DIF tuple registers */ #define DIF_OP_OR 1 /* or r1, r2, rd */ #define DIF_OP_XOR 2 /* xor r1, r2, rd */ #define DIF_OP_AND 3 /* and r1, r2, rd */ #define DIF_OP_SLL 4 /* sll r1, r2, rd */ #define DIF_OP_SRL 5 /* srl r1, r2, rd */ #define DIF_OP_SUB 6 /* sub r1, r2, rd */ #define DIF_OP_ADD 7 /* add r1, r2, rd */ #define DIF_OP_MUL 8 /* mul r1, r2, rd */ #define DIF_OP_SDIV 9 /* sdiv r1, r2, rd */ #define DIF_OP_UDIV 10 /* udiv r1, r2, rd */ #define DIF_OP_SREM 11 /* srem r1, r2, rd */ #define DIF_OP_UREM 12 /* urem r1, r2, rd */ #define DIF_OP_NOT 13 /* not r1, rd */ #define DIF_OP_MOV 14 /* mov r1, rd */ #define DIF_OP_CMP 15 /* cmp r1, r2 */ #define DIF_OP_TST 16 /* tst r1 */ #define DIF_OP_BA 17 /* ba label */ #define DIF_OP_BE 18 /* be label */ #define DIF_OP_BNE 19 /* bne label */ #define DIF_OP_BG 20 /* bg label */ #define DIF_OP_BGU 21 /* bgu label */ #define DIF_OP_BGE 22 /* bge label */ #define DIF_OP_BGEU 23 /* bgeu label */ #define DIF_OP_BL 24 /* bl label */ #define DIF_OP_BLU 25 /* blu label */ #define DIF_OP_BLE 26 /* ble label */ #define DIF_OP_BLEU 27 /* bleu label */ #define DIF_OP_LDSB 28 /* ldsb [r1], rd */ #define DIF_OP_LDSH 29 /* ldsh [r1], rd */ #define DIF_OP_LDSW 30 /* ldsw [r1], rd */ #define DIF_OP_LDUB 31 /* ldub [r1], rd */ #define DIF_OP_LDUH 32 /* lduh [r1], rd */ #define DIF_OP_LDUW 33 /* lduw [r1], rd */ #define DIF_OP_LDX 34 /* ldx [r1], rd */ #define DIF_OP_RET 35 /* ret rd */ #define DIF_OP_NOP 36 /* nop */ #define DIF_OP_SETX 37 /* setx intindex, rd */ #define DIF_OP_SETS 38 /* sets strindex, rd */ #define DIF_OP_SCMP 39 /* scmp r1, r2 */ #define DIF_OP_LDGA 40 /* ldga var, ri, rd */ #define DIF_OP_LDGS 41 /* ldgs var, rd */ #define DIF_OP_STGS 42 /* stgs var, rs */ #define DIF_OP_LDTA 43 /* ldta var, ri, rd */ #define DIF_OP_LDTS 44 /* ldts var, rd */ #define DIF_OP_STTS 45 /* stts var, rs */ #define DIF_OP_SRA 46 /* sra r1, r2, rd */ #define DIF_OP_CALL 47 /* call subr, rd */ #define DIF_OP_PUSHTR 48 /* pushtr type, rs, rr */ #define DIF_OP_PUSHTV 49 /* pushtv type, rs, rv */ #define DIF_OP_POPTS 50 /* popts */ #define DIF_OP_FLUSHTS 51 /* flushts */ #define DIF_OP_LDGAA 52 /* ldgaa var, rd */ #define DIF_OP_LDTAA 53 /* ldtaa var, rd */ #define DIF_OP_STGAA 54 /* stgaa var, rs */ #define DIF_OP_STTAA 55 /* sttaa var, rs */ #define DIF_OP_LDLS 56 /* ldls var, rd */ #define DIF_OP_STLS 57 /* stls var, rs */ #define DIF_OP_ALLOCS 58 /* allocs r1, rd */ #define DIF_OP_COPYS 59 /* copys r1, r2, rd */ #define DIF_OP_STB 60 /* stb r1, [rd] */ #define DIF_OP_STH 61 /* sth r1, [rd] */ #define DIF_OP_STW 62 /* stw r1, [rd] */ #define DIF_OP_STX 63 /* stx r1, [rd] */ #define DIF_OP_ULDSB 64 /* uldsb [r1], rd */ #define DIF_OP_ULDSH 65 /* uldsh [r1], rd */ #define DIF_OP_ULDSW 66 /* uldsw [r1], rd */ #define DIF_OP_ULDUB 67 /* uldub [r1], rd */ #define DIF_OP_ULDUH 68 /* ulduh [r1], rd */ #define DIF_OP_ULDUW 69 /* ulduw [r1], rd */ #define DIF_OP_ULDX 70 /* uldx [r1], rd */ #define DIF_OP_RLDSB 71 /* rldsb [r1], rd */ #define DIF_OP_RLDSH 72 /* rldsh [r1], rd */ #define DIF_OP_RLDSW 73 /* rldsw [r1], rd */ #define DIF_OP_RLDUB 74 /* rldub [r1], rd */ #define DIF_OP_RLDUH 75 /* rlduh [r1], rd */ #define DIF_OP_RLDUW 76 /* rlduw [r1], rd */ #define DIF_OP_RLDX 77 /* rldx [r1], rd */ #define DIF_OP_XLATE 78 /* xlate xlrindex, rd */ #define DIF_OP_XLARG 79 /* xlarg xlrindex, rd */ #define DIF_OP_STRIP 80 /* strip r1, key, rd */ #define DIF_INTOFF_MAX 0xffff /* highest integer table offset */ #define DIF_STROFF_MAX 0xffff /* highest string table offset */ #define DIF_REGISTER_MAX 0xff /* highest register number */ #define DIF_VARIABLE_MAX 0xffff /* highest variable identifier */ #define DIF_SUBROUTINE_MAX 0xffff /* highest subroutine code */ #define DIF_VAR_ARRAY_MIN 0x0000 /* lowest numbered array variable */ #define DIF_VAR_ARRAY_UBASE 0x0080 /* lowest user-defined array */ #define DIF_VAR_ARRAY_MAX 0x00ff /* highest numbered array variable */ #define DIF_VAR_OTHER_MIN 0x0100 /* lowest numbered scalar or assc */ #define DIF_VAR_OTHER_UBASE 0x0500 /* lowest user-defined scalar or assc */ #define DIF_VAR_OTHER_MAX 0xffff /* highest numbered scalar or assc */ #define DIF_VAR_ARGS 0x0000 /* arguments array */ #define DIF_VAR_REGS 0x0001 /* registers array */ #define DIF_VAR_UREGS 0x0002 /* user registers array */ #define DIF_VAR_VMREGS 0x0003 /* virtual machine registers array */ #define DIF_VAR_CURTHREAD 0x0100 /* thread pointer */ #define DIF_VAR_TIMESTAMP 0x0101 /* timestamp */ #define DIF_VAR_VTIMESTAMP 0x0102 /* virtual timestamp */ #define DIF_VAR_IPL 0x0103 /* interrupt priority level */ #define DIF_VAR_EPID 0x0104 /* enabled probe ID */ #define DIF_VAR_ID 0x0105 /* probe ID */ #define DIF_VAR_ARG0 0x0106 /* first argument */ #define DIF_VAR_ARG1 0x0107 /* second argument */ #define DIF_VAR_ARG2 0x0108 /* third argument */ #define DIF_VAR_ARG3 0x0109 /* fourth argument */ #define DIF_VAR_ARG4 0x010a /* fifth argument */ #define DIF_VAR_ARG5 0x010b /* sixth argument */ #define DIF_VAR_ARG6 0x010c /* seventh argument */ #define DIF_VAR_ARG7 0x010d /* eighth argument */ #define DIF_VAR_ARG8 0x010e /* ninth argument */ #define DIF_VAR_ARG9 0x010f /* tenth argument */ #define DIF_VAR_STACKDEPTH 0x0110 /* stack depth */ #define DIF_VAR_CALLER 0x0111 /* caller */ #define DIF_VAR_PROBEPROV 0x0112 /* probe provider */ #define DIF_VAR_PROBEMOD 0x0113 /* probe module */ #define DIF_VAR_PROBEFUNC 0x0114 /* probe function */ #define DIF_VAR_PROBENAME 0x0115 /* probe name */ #define DIF_VAR_PID 0x0116 /* process ID */ #define DIF_VAR_TID 0x0117 /* (per-process) thread ID */ #define DIF_VAR_EXECNAME 0x0118 /* name of executable */ #define DIF_VAR_ZONENAME 0x0119 /* zone name associated with process */ #define DIF_VAR_WALLTIMESTAMP 0x011a /* wall-clock timestamp */ #define DIF_VAR_USTACKDEPTH 0x011b /* user-land stack depth */ #define DIF_VAR_UCALLER 0x011c /* user-level caller */ #define DIF_VAR_PPID 0x011d /* parent process ID */ #define DIF_VAR_UID 0x011e /* process user ID */ #define DIF_VAR_GID 0x011f /* process group ID */ #define DIF_VAR_ERRNO 0x0120 /* thread errno */ #if defined(__APPLE__) #define DIF_VAR_PTHREAD_SELF 0x0200 /* Apple specific PTHREAD_SELF (Not currently supported!) */ #define DIF_VAR_DISPATCHQADDR 0x0201 /* Apple specific dispatch queue addr */ #define DIF_VAR_MACHTIMESTAMP 0x0202 /* mach_absolute_time() */ #define DIF_VAR_CPU 0x0203 /* cpu number */ #define DIF_VAR_CPUINSTRS 0x0204 /* cpu instructions */ #define DIF_VAR_CPUCYCLES 0x0205 /* cpu cycles */ #define DIF_VAR_VINSTRS 0x0206 /* virtual instructions */ #define DIF_VAR_VCYCLES 0x0207 /* virtual cycles */ #define DIF_VAR_MACHCTIMESTAMP 0x0208 /* mach_continuous_time() */ #endif /* __APPLE __ */ #define DIF_SUBR_RAND 0 #define DIF_SUBR_MUTEX_OWNED 1 #define DIF_SUBR_MUTEX_OWNER 2 #define DIF_SUBR_MUTEX_TYPE_ADAPTIVE 3 #define DIF_SUBR_MUTEX_TYPE_SPIN 4 #define DIF_SUBR_RW_READ_HELD 5 #define DIF_SUBR_RW_WRITE_HELD 6 #define DIF_SUBR_RW_ISWRITER 7 #define DIF_SUBR_COPYIN 8 #define DIF_SUBR_COPYINSTR 9 #define DIF_SUBR_SPECULATION 10 #define DIF_SUBR_PROGENYOF 11 #define DIF_SUBR_STRLEN 12 #define DIF_SUBR_COPYOUT 13 #define DIF_SUBR_COPYOUTSTR 14 #define DIF_SUBR_ALLOCA 15 #define DIF_SUBR_BCOPY 16 #define DIF_SUBR_COPYINTO 17 #define DIF_SUBR_MSGDSIZE 18 #define DIF_SUBR_MSGSIZE 19 #define DIF_SUBR_GETMAJOR 20 #define DIF_SUBR_GETMINOR 21 #define DIF_SUBR_DDI_PATHNAME 22 #define DIF_SUBR_STRJOIN 23 #define DIF_SUBR_LLTOSTR 24 #define DIF_SUBR_BASENAME 25 #define DIF_SUBR_DIRNAME 26 #define DIF_SUBR_CLEANPATH 27 #define DIF_SUBR_STRCHR 28 #define DIF_SUBR_STRRCHR 29 #define DIF_SUBR_STRSTR 30 #define DIF_SUBR_STRTOK 31 #define DIF_SUBR_SUBSTR 32 #define DIF_SUBR_INDEX 33 #define DIF_SUBR_RINDEX 34 #define DIF_SUBR_HTONS 35 #define DIF_SUBR_HTONL 36 #define DIF_SUBR_HTONLL 37 #define DIF_SUBR_NTOHS 38 #define DIF_SUBR_NTOHL 39 #define DIF_SUBR_NTOHLL 40 #define DIF_SUBR_INET_NTOP 41 #define DIF_SUBR_INET_NTOA 42 #define DIF_SUBR_INET_NTOA6 43 #define DIF_SUBR_TOUPPER 44 #define DIF_SUBR_TOLOWER 45 #define DIF_SUBR_JSON 46 #define DIF_SUBR_STRTOLL 47 #define DIF_SUBR_STRIP 48 #define DIF_SUBR_MAX 48 /* max subroutine value */ /* Apple-specific subroutines */ #if defined(__APPLE__) #define DIF_SUBR_APPLE_MIN 200 /* min apple-specific subroutine value */ #define DIF_SUBR_VM_KERNEL_ADDRPERM 200 #define DIF_SUBR_KDEBUG_TRACE 201 #define DIF_SUBR_KDEBUG_TRACE_STRING 202 #define DIF_SUBR_MTONS 203 #define DIF_SUBR_PHYSMEM_READ 204 #define DIF_SUBR_PHYSMEM_WRITE 205 #define DIF_SUBR_KVTOPHYS 206 #define DIF_SUBR_LIVEDUMP 207 #define DIF_SUBR_APPLE_MAX 207 /* max apple-specific subroutine value */ #endif /* __APPLE__ */ typedef uint32_t dif_instr_t; #define DIF_INSTR_OP(i) (((i) >> 24) & 0xff) #define DIF_INSTR_R1(i) (((i) >> 16) & 0xff) #define DIF_INSTR_R2(i) (((i) >> 8) & 0xff) #define DIF_INSTR_RD(i) ((i) & 0xff) #define DIF_INSTR_RS(i) ((i) & 0xff) #define DIF_INSTR_IMM2(i) (((i) >> 8) & 0xff) #define DIF_INSTR_LABEL(i) ((i) & 0xffffff) #define DIF_INSTR_VAR(i) (((i) >> 8) & 0xffff) #define DIF_INSTR_INTEGER(i) (((i) >> 8) & 0xffff) #define DIF_INSTR_STRING(i) (((i) >> 8) & 0xffff) #define DIF_INSTR_SUBR(i) (((i) >> 8) & 0xffff) #define DIF_INSTR_TYPE(i) (((i) >> 16) & 0xff) #define DIF_INSTR_XLREF(i) (((i) >> 8) & 0xffff) #define DIF_INSTR_FMT(op, r1, r2, d) \ (((op) << 24) | ((r1) << 16) | ((r2) << 8) | (d)) #define DIF_INSTR_NOT(r1, d) (DIF_INSTR_FMT(DIF_OP_NOT, r1, 0, d)) #define DIF_INSTR_MOV(r1, d) (DIF_INSTR_FMT(DIF_OP_MOV, r1, 0, d)) #define DIF_INSTR_CMP(op, r1, r2) (DIF_INSTR_FMT(op, r1, r2, 0)) #define DIF_INSTR_TST(r1) (DIF_INSTR_FMT(DIF_OP_TST, r1, 0, 0)) #define DIF_INSTR_BRANCH(op, label) (((op) << 24) | (label)) #define DIF_INSTR_LOAD(op, r1, d) (DIF_INSTR_FMT(op, r1, 0, d)) #define DIF_INSTR_STORE(op, r1, d) (DIF_INSTR_FMT(op, r1, 0, d)) #define DIF_INSTR_SETX(i, d) ((DIF_OP_SETX << 24) | ((i) << 8) | (d)) #define DIF_INSTR_SETS(s, d) ((DIF_OP_SETS << 24) | ((s) << 8) | (d)) #define DIF_INSTR_RET(d) (DIF_INSTR_FMT(DIF_OP_RET, 0, 0, d)) #define DIF_INSTR_NOP (DIF_OP_NOP << 24) #define DIF_INSTR_LDA(op, v, r, d) (DIF_INSTR_FMT(op, v, r, d)) #define DIF_INSTR_LDV(op, v, d) (((op) << 24) | ((v) << 8) | (d)) #define DIF_INSTR_STV(op, v, rs) (((op) << 24) | ((v) << 8) | (rs)) #define DIF_INSTR_CALL(s, d) ((DIF_OP_CALL << 24) | ((s) << 8) | (d)) #define DIF_INSTR_PUSHTS(op, t, r2, rs) (DIF_INSTR_FMT(op, t, r2, rs)) #define DIF_INSTR_POPTS (DIF_OP_POPTS << 24) #define DIF_INSTR_FLUSHTS (DIF_OP_FLUSHTS << 24) #define DIF_INSTR_ALLOCS(r1, d) (DIF_INSTR_FMT(DIF_OP_ALLOCS, r1, 0, d)) #define DIF_INSTR_COPYS(r1, r2, d) (DIF_INSTR_FMT(DIF_OP_COPYS, r1, r2, d)) #define DIF_INSTR_XLATE(op, r, d) (((op) << 24) | ((r) << 8) | (d)) #define DIF_REG_R0 0 /* %r0 is always set to zero */ /* * A DTrace Intermediate Format Type (DIF Type) is used to represent the types * of variables, function and associative array arguments, and the return type * for each DIF object (shown below). It contains a description of the type, * its size in bytes, and a module identifier. */ typedef struct dtrace_diftype { uint8_t dtdt_kind; /* type kind (see below) */ uint8_t dtdt_ckind; /* type kind in CTF */ uint8_t dtdt_flags; /* type flags (see below) */ uint8_t dtdt_pad; /* reserved for future use */ uint32_t dtdt_size; /* type size in bytes (unless string) */ } dtrace_diftype_t; #define DIF_TYPE_CTF 0 /* type is a CTF type */ #define DIF_TYPE_STRING 1 /* type is a D string */ #define DIF_TF_BYREF 0x1 /* type is passed by reference */ #define DIF_TF_BYUREF 0x2 /* user type is passed by reference */ /* * A DTrace Intermediate Format variable record is used to describe each of the * variables referenced by a given DIF object. It contains an integer variable * identifier along with variable scope and properties, as shown below. The * size of this structure must be sizeof (int) aligned. */ typedef struct dtrace_difv { uint32_t dtdv_name; /* variable name index in dtdo_strtab */ uint32_t dtdv_id; /* variable reference identifier */ uint8_t dtdv_kind; /* variable kind (see below) */ uint8_t dtdv_scope; /* variable scope (see below) */ uint16_t dtdv_flags; /* variable flags (see below) */ dtrace_diftype_t dtdv_type; /* variable type (see above) */ } dtrace_difv_t; #define DIFV_KIND_ARRAY 0 /* variable is an array of quantities */ #define DIFV_KIND_SCALAR 1 /* variable is a scalar quantity */ #define DIFV_SCOPE_GLOBAL 0 /* variable has global scope */ #define DIFV_SCOPE_THREAD 1 /* variable has thread scope */ #define DIFV_SCOPE_LOCAL 2 /* variable has local scope */ #define DIFV_F_REF 0x1 /* variable is referenced by DIFO */ #define DIFV_F_MOD 0x2 /* variable is written by DIFO */ /* * DTrace Actions * * The upper byte determines the class of the action; the low bytes determines * the specific action within that class. The classes of actions are as * follows: * * [ no class ] <= May record process- or kernel-related data * DTRACEACT_PROC <= Only records process-related data * DTRACEACT_PROC_DESTRUCTIVE <= Potentially destructive to processes * DTRACEACT_KERNEL <= Only records kernel-related data * DTRACEACT_KERNEL_DESTRUCTIVE <= Potentially destructive to the kernel * DTRACEACT_SPECULATIVE <= Speculation-related action * DTRACEACT_AGGREGATION <= Aggregating action */ #define DTRACEACT_NONE 0 /* no action */ #define DTRACEACT_DIFEXPR 1 /* action is DIF expression */ #define DTRACEACT_EXIT 2 /* exit() action */ #define DTRACEACT_PRINTF 3 /* printf() action */ #define DTRACEACT_PRINTA 4 /* printa() action */ #define DTRACEACT_LIBACT 5 /* library-controlled action */ #define DTRACEACT_TRACEMEM 6 /* tracemem() action */ #define DTRACEACT_TRACEMEM_DYNSIZE 7 /* dynamic tracemem() size */ #if defined(__APPLE__) #define DTRACEACT_APPLEBINARY 50 /* Apple DT perf. tool action */ #endif /* __APPLE__ */ #define DTRACEACT_PROC 0x0100 #define DTRACEACT_USTACK (DTRACEACT_PROC + 1) #define DTRACEACT_JSTACK (DTRACEACT_PROC + 2) #define DTRACEACT_USYM (DTRACEACT_PROC + 3) #define DTRACEACT_UMOD (DTRACEACT_PROC + 4) #define DTRACEACT_UADDR (DTRACEACT_PROC + 5) #define DTRACEACT_PROC_DESTRUCTIVE 0x0200 #define DTRACEACT_STOP (DTRACEACT_PROC_DESTRUCTIVE + 1) #define DTRACEACT_RAISE (DTRACEACT_PROC_DESTRUCTIVE + 2) #define DTRACEACT_SYSTEM (DTRACEACT_PROC_DESTRUCTIVE + 3) #define DTRACEACT_FREOPEN (DTRACEACT_PROC_DESTRUCTIVE + 4) #if defined(__APPLE__) /* * Dtrace stop() will task_suspend the currently running process. * Dtrace pidresume(pid) will task_resume it. */ #define DTRACEACT_PIDRESUME (DTRACEACT_PROC_DESTRUCTIVE + 50) #endif /* __APPLE__ */ #define DTRACEACT_PROC_CONTROL 0x0300 #define DTRACEACT_KERNEL 0x0400 #define DTRACEACT_STACK (DTRACEACT_KERNEL + 1) #define DTRACEACT_SYM (DTRACEACT_KERNEL + 2) #define DTRACEACT_MOD (DTRACEACT_KERNEL + 3) #define DTRACEACT_KERNEL_DESTRUCTIVE 0x0500 #define DTRACEACT_BREAKPOINT (DTRACEACT_KERNEL_DESTRUCTIVE + 1) #define DTRACEACT_PANIC (DTRACEACT_KERNEL_DESTRUCTIVE + 2) #define DTRACEACT_CHILL (DTRACEACT_KERNEL_DESTRUCTIVE + 3) #define DTRACEACT_SPECULATIVE 0x0600 #define DTRACEACT_SPECULATE (DTRACEACT_SPECULATIVE + 1) #define DTRACEACT_COMMIT (DTRACEACT_SPECULATIVE + 2) #define DTRACEACT_DISCARD (DTRACEACT_SPECULATIVE + 3) #define DTRACEACT_CLASS(x) ((x) & 0xff00) #define DTRACEACT_ISDESTRUCTIVE(x) \ (DTRACEACT_CLASS(x) == DTRACEACT_PROC_DESTRUCTIVE || \ DTRACEACT_CLASS(x) == DTRACEACT_KERNEL_DESTRUCTIVE) #define DTRACEACT_ISSPECULATIVE(x) \ (DTRACEACT_CLASS(x) == DTRACEACT_SPECULATIVE) #define DTRACEACT_ISPRINTFLIKE(x) \ ((x) == DTRACEACT_PRINTF || (x) == DTRACEACT_PRINTA || \ (x) == DTRACEACT_SYSTEM || (x) == DTRACEACT_FREOPEN) /* * DTrace Aggregating Actions * * These are functions f(x) for which the following is true: * * f(f(x_0) U f(x_1) U ... U f(x_n)) = f(x_0 U x_1 U ... U x_n) * * where x_n is a set of arbitrary data. Aggregating actions are in their own * DTrace action class, DTTRACEACT_AGGREGATION. The macros provided here allow * for easier processing of the aggregation argument and data payload for a few * aggregating actions (notably: quantize(), lquantize(), and ustack()). */ #define DTRACEACT_AGGREGATION 0x0700 #define DTRACEAGG_COUNT (DTRACEACT_AGGREGATION + 1) #define DTRACEAGG_MIN (DTRACEACT_AGGREGATION + 2) #define DTRACEAGG_MAX (DTRACEACT_AGGREGATION + 3) #define DTRACEAGG_AVG (DTRACEACT_AGGREGATION + 4) #define DTRACEAGG_SUM (DTRACEACT_AGGREGATION + 5) #define DTRACEAGG_STDDEV (DTRACEACT_AGGREGATION + 6) #define DTRACEAGG_QUANTIZE (DTRACEACT_AGGREGATION + 7) #define DTRACEAGG_LQUANTIZE (DTRACEACT_AGGREGATION + 8) #define DTRACEAGG_LLQUANTIZE (DTRACEACT_AGGREGATION + 9) #define DTRACEACT_ISAGG(x) \ (DTRACEACT_CLASS(x) == DTRACEACT_AGGREGATION) #if !defined(__APPLE__) /* Quiet compiler warning. */ #define DTRACE_QUANTIZE_NBUCKETS \ (((sizeof (uint64_t) * NBBY) - 1) * 2 + 1) #define DTRACE_QUANTIZE_ZEROBUCKET ((sizeof (uint64_t) * NBBY) - 1) #else #define DTRACE_QUANTIZE_NBUCKETS \ (int)(((sizeof (uint64_t) * NBBY) - 1) * 2 + 1) #define DTRACE_QUANTIZE_ZEROBUCKET (int64_t)((sizeof (uint64_t) * NBBY) - 1) #endif /* __APPLE __*/ #define DTRACE_QUANTIZE_BUCKETVAL(buck) \ (int64_t)((buck) < DTRACE_QUANTIZE_ZEROBUCKET ? \ -(1LL << (DTRACE_QUANTIZE_ZEROBUCKET - 1 - (buck))) : \ (buck) == DTRACE_QUANTIZE_ZEROBUCKET ? 0 : \ 1LL << ((buck) - DTRACE_QUANTIZE_ZEROBUCKET - 1)) #define DTRACE_LQUANTIZE_STEPSHIFT 48 #define DTRACE_LQUANTIZE_STEPMASK ((uint64_t)UINT16_MAX << 48) #define DTRACE_LQUANTIZE_LEVELSHIFT 32 #define DTRACE_LQUANTIZE_LEVELMASK ((uint64_t)UINT16_MAX << 32) #define DTRACE_LQUANTIZE_BASESHIFT 0 #define DTRACE_LQUANTIZE_BASEMASK UINT32_MAX #define DTRACE_LQUANTIZE_STEP(x) \ (uint16_t)(((x) & DTRACE_LQUANTIZE_STEPMASK) >> \ DTRACE_LQUANTIZE_STEPSHIFT) #define DTRACE_LQUANTIZE_LEVELS(x) \ (uint16_t)(((x) & DTRACE_LQUANTIZE_LEVELMASK) >> \ DTRACE_LQUANTIZE_LEVELSHIFT) #define DTRACE_LQUANTIZE_BASE(x) \ (int32_t)(((x) & DTRACE_LQUANTIZE_BASEMASK) >> \ DTRACE_LQUANTIZE_BASESHIFT) #define DTRACE_LLQUANTIZE_FACTORSHIFT 48 #define DTRACE_LLQUANTIZE_FACTORMASK ((uint64_t)UINT16_MAX << 48) #define DTRACE_LLQUANTIZE_LOWSHIFT 32 #define DTRACE_LLQUANTIZE_LOWMASK ((uint64_t)UINT16_MAX << 32) #define DTRACE_LLQUANTIZE_HIGHSHIFT 16 #define DTRACE_LLQUANTIZE_HIGHMASK ((uint64_t)UINT16_MAX << 16) #define DTRACE_LLQUANTIZE_NSTEPSHIFT 0 #define DTRACE_LLQUANTIZE_NSTEPMASK UINT16_MAX #define DTRACE_LLQUANTIZE_FACTOR(x) \ (uint16_t)(((x) & DTRACE_LLQUANTIZE_FACTORMASK) >> \ DTRACE_LLQUANTIZE_FACTORSHIFT) #define DTRACE_LLQUANTIZE_LOW(x) \ (uint16_t)(((x) & DTRACE_LLQUANTIZE_LOWMASK) >> \ DTRACE_LLQUANTIZE_LOWSHIFT) #define DTRACE_LLQUANTIZE_HIGH(x) \ (uint16_t)(((x) & DTRACE_LLQUANTIZE_HIGHMASK) >> \ DTRACE_LLQUANTIZE_HIGHSHIFT) #define DTRACE_LLQUANTIZE_NSTEP(x) \ (uint16_t)(((x) & DTRACE_LLQUANTIZE_NSTEPMASK) >> \ DTRACE_LLQUANTIZE_NSTEPSHIFT) #define DTRACE_USTACK_NFRAMES(x) (uint32_t)((x) & UINT32_MAX) #define DTRACE_USTACK_STRSIZE(x) (uint32_t)((x) >> 32) #define DTRACE_USTACK_ARG(x, y) \ ((((uint64_t)(y)) << 32) | ((x) & UINT32_MAX)) #if !defined(__APPLE__) #ifndef _LP64 #ifndef _LITTLE_ENDIAN #define DTRACE_PTR(type, name) uint32_t name##pad; type *name #else #define DTRACE_PTR(type, name) type *name; uint32_t name##pad #endif #else #define DTRACE_PTR(type, name) type *name #endif #else #ifndef _LP64 #define DTRACE_PTR(type, name) user_addr_t name #else #define DTRACE_PTR(type, name) type *name #endif #endif /* __APPLE__ */ /* * DTrace Object Format (DOF) * * DTrace programs can be persistently encoded in the DOF format so that they * may be embedded in other programs (for example, in an ELF file) or in the * dtrace driver configuration file for use in anonymous tracing. The DOF * format is versioned and extensible so that it can be revised and so that * internal data structures can be modified or extended compatibly. All DOF * structures use fixed-size types, so the 32-bit and 64-bit representations * are identical and consumers can use either data model transparently. * * The file layout is structured as follows: * * +---------------+-------------------+----- ... ----+---- ... ------+ * | dof_hdr_t | dof_sec_t[ ... ] | loadable | non-loadable | * | (file header) | (section headers) | section data | section data | * +---------------+-------------------+----- ... ----+---- ... ------+ * |<------------ dof_hdr.dofh_loadsz --------------->| | * |<------------ dof_hdr.dofh_filesz ------------------------------->| * * The file header stores meta-data including a magic number, data model for * the instrumentation, data encoding, and properties of the DIF code within. * The header describes its own size and the size of the section headers. By * convention, an array of section headers follows the file header, and then * the data for all loadable sections and unloadable sections. This permits * consumer code to easily download the headers and all loadable data into the * DTrace driver in one contiguous chunk, omitting other extraneous sections. * * The section headers describe the size, offset, alignment, and section type * for each section. Sections are described using a set of #defines that tell * the consumer what kind of data is expected. Sections can contain links to * other sections by storing a dof_secidx_t, an index into the section header * array, inside of the section data structures. The section header includes * an entry size so that sections with data arrays can grow their structures. * * The DOF data itself can contain many snippets of DIF (i.e. >1 DIFOs), which * are represented themselves as a collection of related DOF sections. This * permits us to change the set of sections associated with a DIFO over time, * and also permits us to encode DIFOs that contain different sets of sections. * When a DOF section wants to refer to a DIFO, it stores the dof_secidx_t of a * section of type DOF_SECT_DIFOHDR. This section's data is then an array of * dof_secidx_t's which in turn denote the sections associated with this DIFO. * * This loose coupling of the file structure (header and sections) to the * structure of the DTrace program itself (ECB descriptions, action * descriptions, and DIFOs) permits activities such as relocation processing * to occur in a single pass without having to understand D program structure. * * Finally, strings are always stored in ELF-style string tables along with a * string table section index and string table offset. Therefore strings in * DOF are always arbitrary-length and not bound to the current implementation. */ #define DOF_ID_SIZE 16 /* total size of dofh_ident[] in bytes */ typedef struct dof_hdr { uint8_t dofh_ident[DOF_ID_SIZE]; /* identification bytes (see below) */ uint32_t dofh_flags; /* file attribute flags (if any) */ uint32_t dofh_hdrsize; /* size of file header in bytes */ uint32_t dofh_secsize; /* size of section header in bytes */ uint32_t dofh_secnum; /* number of section headers */ uint64_t dofh_secoff; /* file offset of section headers */ uint64_t dofh_loadsz; /* file size of loadable portion */ uint64_t dofh_filesz; /* file size of entire DOF file */ uint64_t dofh_pad; /* reserved for future use */ } dof_hdr_t; #define DOF_ID_MAG0 0 /* first byte of magic number */ #define DOF_ID_MAG1 1 /* second byte of magic number */ #define DOF_ID_MAG2 2 /* third byte of magic number */ #define DOF_ID_MAG3 3 /* fourth byte of magic number */ #define DOF_ID_MODEL 4 /* DOF data model (see below) */ #define DOF_ID_ENCODING 5 /* DOF data encoding (see below) */ #define DOF_ID_VERSION 6 /* DOF file format major version (see below) */ #define DOF_ID_DIFVERS 7 /* DIF instruction set version */ #define DOF_ID_DIFIREG 8 /* DIF integer registers used by compiler */ #define DOF_ID_DIFTREG 9 /* DIF tuple registers used by compiler */ #define DOF_ID_PAD 10 /* start of padding bytes (all zeroes) */ #define DOF_MAG_MAG0 0x7F /* DOF_ID_MAG[0-3] */ #define DOF_MAG_MAG1 'D' #define DOF_MAG_MAG2 'O' #define DOF_MAG_MAG3 'F' #define DOF_MAG_STRING "\177DOF" #define DOF_MAG_STRLEN 4 #define DOF_MODEL_NONE 0 /* DOF_ID_MODEL */ #define DOF_MODEL_ILP32 1 #define DOF_MODEL_LP64 2 #ifdef _LP64 #define DOF_MODEL_NATIVE DOF_MODEL_LP64 #else #define DOF_MODEL_NATIVE DOF_MODEL_ILP32 #endif #define DOF_ENCODE_NONE 0 /* DOF_ID_ENCODING */ #define DOF_ENCODE_LSB 1 #define DOF_ENCODE_MSB 2 #ifdef _BIG_ENDIAN #define DOF_ENCODE_NATIVE DOF_ENCODE_MSB #else #define DOF_ENCODE_NATIVE DOF_ENCODE_LSB #endif #define DOF_VERSION_1 1 /* DOF version 1: Solaris 10 FCS */ #define DOF_VERSION_2 2 /* DOF version 2: Solaris Express 6/06 */ #if !defined(__APPLE__) #define DOF_VERSION DOF_VERSION_2 /* Latest DOF version */ #else #define DOF_VERSION_3 3 /* DOF version 3: Minimum version for Leopard */ #define DOF_VERSION DOF_VERSION_3 /* Latest DOF version */ #endif /* __APPLE__ */ #define DOF_FL_VALID 0 /* mask of all valid dofh_flags bits */ typedef uint32_t dof_secidx_t; /* section header table index type */ typedef uint32_t dof_stridx_t; /* string table index type */ #define DOF_SECIDX_NONE (-1U) /* null value for section indices */ #define DOF_STRIDX_NONE (-1U) /* null value for string indices */ typedef struct dof_sec { uint32_t dofs_type; /* section type (see below) */ uint32_t dofs_align; /* section data memory alignment */ uint32_t dofs_flags; /* section flags (if any) */ uint32_t dofs_entsize; /* size of section entry (if table) */ uint64_t dofs_offset; /* offset of section data within file */ uint64_t dofs_size; /* size of section data in bytes */ } dof_sec_t; #define DOF_SECT_NONE 0 /* null section */ #define DOF_SECT_COMMENTS 1 /* compiler comments */ #define DOF_SECT_SOURCE 2 /* D program source code */ #define DOF_SECT_ECBDESC 3 /* dof_ecbdesc_t */ #define DOF_SECT_PROBEDESC 4 /* dof_probedesc_t */ #define DOF_SECT_ACTDESC 5 /* dof_actdesc_t array */ #define DOF_SECT_DIFOHDR 6 /* dof_difohdr_t (variable length) */ #define DOF_SECT_DIF 7 /* uint32_t array of byte code */ #define DOF_SECT_STRTAB 8 /* string table */ #define DOF_SECT_VARTAB 9 /* dtrace_difv_t array */ #define DOF_SECT_RELTAB 10 /* dof_relodesc_t array */ #define DOF_SECT_TYPTAB 11 /* dtrace_diftype_t array */ #define DOF_SECT_URELHDR 12 /* dof_relohdr_t (user relocations) */ #define DOF_SECT_KRELHDR 13 /* dof_relohdr_t (kernel relocations) */ #define DOF_SECT_OPTDESC 14 /* dof_optdesc_t array */ #define DOF_SECT_PROVIDER 15 /* dof_provider_t */ #define DOF_SECT_PROBES 16 /* dof_probe_t array */ #define DOF_SECT_PRARGS 17 /* uint8_t array (probe arg mappings) */ #define DOF_SECT_PROFFS 18 /* uint32_t array (probe arg offsets) */ #define DOF_SECT_INTTAB 19 /* uint64_t array */ #define DOF_SECT_UTSNAME 20 /* struct utsname */ #define DOF_SECT_XLTAB 21 /* dof_xlref_t array */ #define DOF_SECT_XLMEMBERS 22 /* dof_xlmember_t array */ #define DOF_SECT_XLIMPORT 23 /* dof_xlator_t */ #define DOF_SECT_XLEXPORT 24 /* dof_xlator_t */ #define DOF_SECT_PREXPORT 25 /* dof_secidx_t array (exported objs) */ #define DOF_SECT_PRENOFFS 26 /* uint32_t array (enabled offsets) */ #define DOF_SECF_LOAD 1 /* section should be loaded */ typedef struct dof_ecbdesc { dof_secidx_t dofe_probes; /* link to DOF_SECT_PROBEDESC */ dof_secidx_t dofe_pred; /* link to DOF_SECT_DIFOHDR */ dof_secidx_t dofe_actions; /* link to DOF_SECT_ACTDESC */ uint32_t dofe_pad; /* reserved for future use */ uint64_t dofe_uarg; /* user-supplied library argument */ } dof_ecbdesc_t; typedef struct dof_probedesc { dof_secidx_t dofp_strtab; /* link to DOF_SECT_STRTAB section */ dof_stridx_t dofp_provider; /* provider string */ dof_stridx_t dofp_mod; /* module string */ dof_stridx_t dofp_func; /* function string */ dof_stridx_t dofp_name; /* name string */ uint32_t dofp_id; /* probe identifier (or zero) */ } dof_probedesc_t; typedef struct dof_actdesc { dof_secidx_t dofa_difo; /* link to DOF_SECT_DIFOHDR */ dof_secidx_t dofa_strtab; /* link to DOF_SECT_STRTAB section */ uint32_t dofa_kind; /* action kind (DTRACEACT_* constant) */ uint32_t dofa_ntuple; /* number of subsequent tuple actions */ uint64_t dofa_arg; /* kind-specific argument */ uint64_t dofa_uarg; /* user-supplied argument */ } dof_actdesc_t; typedef struct dof_difohdr { dtrace_diftype_t dofd_rtype; /* return type for this fragment */ dof_secidx_t dofd_links[1]; /* variable length array of indices */ } dof_difohdr_t; typedef struct dof_relohdr { dof_secidx_t dofr_strtab; /* link to DOF_SECT_STRTAB for names */ dof_secidx_t dofr_relsec; /* link to DOF_SECT_RELTAB for relos */ dof_secidx_t dofr_tgtsec; /* link to section we are relocating */ } dof_relohdr_t; typedef struct dof_relodesc { dof_stridx_t dofr_name; /* string name of relocation symbol */ uint32_t dofr_type; /* relo type (DOF_RELO_* constant) */ uint64_t dofr_offset; /* byte offset for relocation */ uint64_t dofr_data; /* additional type-specific data */ } dof_relodesc_t; #define DOF_RELO_NONE 0 /* empty relocation entry */ #define DOF_RELO_SETX 1 /* relocate setx value */ typedef struct dof_optdesc { uint32_t dofo_option; /* option identifier */ dof_secidx_t dofo_strtab; /* string table, if string option */ uint64_t dofo_value; /* option value or string index */ } dof_optdesc_t; typedef uint32_t dof_attr_t; /* encoded stability attributes */ #define DOF_ATTR(n, d, c) (((n) << 24) | ((d) << 16) | ((c) << 8)) #define DOF_ATTR_NAME(a) (((a) >> 24) & 0xff) #define DOF_ATTR_DATA(a) (((a) >> 16) & 0xff) #define DOF_ATTR_CLASS(a) (((a) >> 8) & 0xff) typedef struct dof_provider { dof_secidx_t dofpv_strtab; /* link to DOF_SECT_STRTAB section */ dof_secidx_t dofpv_probes; /* link to DOF_SECT_PROBES section */ dof_secidx_t dofpv_prargs; /* link to DOF_SECT_PRARGS section */ dof_secidx_t dofpv_proffs; /* link to DOF_SECT_PROFFS section */ dof_stridx_t dofpv_name; /* provider name string */ dof_attr_t dofpv_provattr; /* provider attributes */ dof_attr_t dofpv_modattr; /* module attributes */ dof_attr_t dofpv_funcattr; /* function attributes */ dof_attr_t dofpv_nameattr; /* name attributes */ dof_attr_t dofpv_argsattr; /* args attributes */ dof_secidx_t dofpv_prenoffs; /* link to DOF_SECT_PRENOFFS section */ } dof_provider_t; typedef struct dof_probe { uint64_t dofpr_addr; /* probe base address or offset */ dof_stridx_t dofpr_func; /* probe function string */ dof_stridx_t dofpr_name; /* probe name string */ dof_stridx_t dofpr_nargv; /* native argument type strings */ dof_stridx_t dofpr_xargv; /* translated argument type strings */ uint32_t dofpr_argidx; /* index of first argument mapping */ uint32_t dofpr_offidx; /* index of first offset entry */ uint8_t dofpr_nargc; /* native argument count */ uint8_t dofpr_xargc; /* translated argument count */ uint16_t dofpr_noffs; /* number of offset entries for probe */ uint32_t dofpr_enoffidx; /* index of first is-enabled offset */ uint16_t dofpr_nenoffs; /* number of is-enabled offsets */ uint16_t dofpr_pad1; /* reserved for future use */ uint32_t dofpr_pad2; /* reserved for future use */ } dof_probe_t; typedef struct dof_xlator { dof_secidx_t dofxl_members; /* link to DOF_SECT_XLMEMBERS section */ dof_secidx_t dofxl_strtab; /* link to DOF_SECT_STRTAB section */ dof_stridx_t dofxl_argv; /* input parameter type strings */ uint32_t dofxl_argc; /* input parameter list length */ dof_stridx_t dofxl_type; /* output type string name */ dof_attr_t dofxl_attr; /* output stability attributes */ } dof_xlator_t; typedef struct dof_xlmember { dof_secidx_t dofxm_difo; /* member link to DOF_SECT_DIFOHDR */ dof_stridx_t dofxm_name; /* member name */ dtrace_diftype_t dofxm_type; /* member type */ } dof_xlmember_t; typedef struct dof_xlref { dof_secidx_t dofxr_xlator; /* link to DOF_SECT_XLATORS section */ uint32_t dofxr_member; /* index of referenced dof_xlmember */ uint32_t dofxr_argn; /* index of argument for DIF_OP_XLARG */ } dof_xlref_t; /* * DTrace Intermediate Format Object (DIFO) * * A DIFO is used to store the compiled DIF for a D expression, its return * type, and its string and variable tables. The string table is a single * buffer of character data into which sets instructions and variable * references can reference strings using a byte offset. The variable table * is an array of dtrace_difv_t structures that describe the name and type of * each variable and the id used in the DIF code. This structure is described * above in the DIF section of this header file. The DIFO is used at both * user-level (in the library) and in the kernel, but the structure is never * passed between the two: the DOF structures form the only interface. As a * result, the definition can change depending on the presence of _KERNEL. */ typedef struct dtrace_difo { dif_instr_t *dtdo_buf; /* instruction buffer */ uint64_t *dtdo_inttab; /* integer table (optional) */ char *dtdo_strtab; /* string table (optional) */ dtrace_difv_t *dtdo_vartab; /* variable table (optional) */ uint_t dtdo_len; /* length of instruction buffer */ uint_t dtdo_intlen; /* length of integer table */ uint_t dtdo_strlen; /* length of string table */ uint_t dtdo_varlen; /* length of variable table */ dtrace_diftype_t dtdo_rtype; /* return type */ uint_t dtdo_refcnt; /* owner reference count */ uint_t dtdo_destructive; /* invokes destructive subroutines */ #ifndef _KERNEL dof_relodesc_t *dtdo_kreltab; /* kernel relocations */ dof_relodesc_t *dtdo_ureltab; /* user relocations */ struct dt_node **dtdo_xlmtab; /* translator references */ uint_t dtdo_krelen; /* length of krelo table */ uint_t dtdo_urelen; /* length of urelo table */ uint_t dtdo_xlmlen; /* length of translator table */ #endif } dtrace_difo_t; /* * DTrace Enabling Description Structures * * When DTrace is tracking the description of a DTrace enabling entity (probe, * predicate, action, ECB, record, etc.), it does so in a description * structure. These structures all end in "desc", and are used at both * user-level and in the kernel -- but (with the exception of * dtrace_probedesc_t) they are never passed between them. Typically, * user-level will use the description structures when assembling an enabling. * It will then distill those description structures into a DOF object (see * above), and send it into the kernel. The kernel will again use the * description structures to create a description of the enabling as it reads * the DOF. When the description is complete, the enabling will be actually * created -- turning it into the structures that represent the enabling * instead of merely describing it. Not surprisingly, the description * structures bear a strong resemblance to the DOF structures that act as their * conduit. */ struct dtrace_predicate; typedef struct dtrace_probedesc { dtrace_id_t dtpd_id; /* probe identifier */ char dtpd_provider[DTRACE_PROVNAMELEN]; /* probe provider name */ char dtpd_mod[DTRACE_MODNAMELEN]; /* probe module name */ char dtpd_func[DTRACE_FUNCNAMELEN]; /* probe function name */ char dtpd_name[DTRACE_NAMELEN]; /* probe name */ } dtrace_probedesc_t; typedef struct dtrace_repldesc { dtrace_probedesc_t dtrpd_match; /* probe descr. to match */ dtrace_probedesc_t dtrpd_create; /* probe descr. to create */ } dtrace_repldesc_t; typedef struct dtrace_preddesc { dtrace_difo_t *dtpdd_difo; /* pointer to DIF object */ struct dtrace_predicate *dtpdd_predicate; /* pointer to predicate */ } dtrace_preddesc_t; typedef struct dtrace_actdesc { dtrace_difo_t *dtad_difo; /* pointer to DIF object */ struct dtrace_actdesc *dtad_next; /* next action */ dtrace_actkind_t dtad_kind; /* kind of action */ uint32_t dtad_ntuple; /* number in tuple */ uint64_t dtad_arg; /* action argument */ uint64_t dtad_uarg; /* user argument */ int dtad_refcnt; /* reference count */ } dtrace_actdesc_t; typedef struct dtrace_ecbdesc { dtrace_actdesc_t *dted_action; /* action description(s) */ dtrace_preddesc_t dted_pred; /* predicate description */ dtrace_probedesc_t dted_probe; /* probe description */ uint64_t dted_uarg; /* library argument */ int dted_refcnt; /* reference count */ uint64_t dted_probegen; /* matched probe generation */ } dtrace_ecbdesc_t; /* * APPLE NOTE: The kernel always rebuild dtrace_ecbdesc structures * coming from userspace, so there is no dted_probegen manipulation risk */ /* * DTrace Metadata Description Structures * * DTrace separates the trace data stream from the metadata stream. The only * metadata tokens placed in the data stream are the dtrace_rechdr_t (EPID + * timestamp) or (in the case of aggregations) aggregation identifiers. To * determine the structure of the data, DTrace consumers pass the token to the * kernel, and receive in return a corresponding description of the enabled * probe (via the dtrace_eprobedesc structure) or the aggregation (via the * dtrace_aggdesc structure). Both of these structures are expressed in terms * of record descriptions (via the dtrace_recdesc structure) that describe the * exact structure of the data. Some record descriptions may also contain a * format identifier; this additional bit of metadata can be retrieved from the * kernel, for which a format description is returned via the dtrace_fmtdesc * structure. Note that all four of these structures must be bitness-neutral * to allow for a 32-bit DTrace consumer on a 64-bit kernel. */ typedef struct dtrace_recdesc { dtrace_actkind_t dtrd_action; /* kind of action */ uint32_t dtrd_size; /* size of record */ uint32_t dtrd_offset; /* offset in ECB's data */ uint16_t dtrd_alignment; /* required alignment */ uint16_t dtrd_format; /* format, if any */ uint64_t dtrd_arg; /* action argument */ uint64_t dtrd_uarg; /* user argument */ } dtrace_recdesc_t; typedef struct dtrace_eprobedesc { dtrace_epid_t dtepd_epid; /* enabled probe ID */ dtrace_id_t dtepd_probeid; /* probe ID */ uint64_t dtepd_uarg; /* library argument */ uint32_t dtepd_size; /* total size */ int dtepd_nrecs; /* number of records */ dtrace_recdesc_t dtepd_rec[1]; /* records themselves */ } dtrace_eprobedesc_t; typedef struct dtrace_aggdesc { DTRACE_PTR(char, dtagd_name); /* not filled in by kernel */ dtrace_aggvarid_t dtagd_varid; /* not filled in by kernel */ int dtagd_flags; /* not filled in by kernel */ dtrace_aggid_t dtagd_id; /* aggregation ID */ dtrace_epid_t dtagd_epid; /* enabled probe ID */ uint32_t dtagd_size; /* size in bytes */ int dtagd_nrecs; /* number of records */ uint32_t dtagd_pad; /* explicit padding */ dtrace_recdesc_t dtagd_rec[1]; /* record descriptions */ } dtrace_aggdesc_t; typedef struct dtrace_fmtdesc { DTRACE_PTR(char, dtfd_string); /* format string */ int dtfd_length; /* length of format string */ uint16_t dtfd_format; /* format identifier */ } dtrace_fmtdesc_t; #define DTRACE_SIZEOF_EPROBEDESC(desc) \ (sizeof (dtrace_eprobedesc_t) + ((desc)->dtepd_nrecs ? \ (((desc)->dtepd_nrecs - 1) * sizeof (dtrace_recdesc_t)) : 0)) #define DTRACE_SIZEOF_AGGDESC(desc) \ (sizeof (dtrace_aggdesc_t) + ((desc)->dtagd_nrecs ? \ (((desc)->dtagd_nrecs - 1) * sizeof (dtrace_recdesc_t)) : 0)) /* * DTrace Option Interface * * Run-time DTrace options are set and retrieved via DOF_SECT_OPTDESC sections * in a DOF image. The dof_optdesc structure contains an option identifier and * an option value. The valid option identifiers are found below; the mapping * between option identifiers and option identifying strings is maintained at * user-level. Note that the value of DTRACEOPT_UNSET is such that all of the * following are potentially valid option values: all positive integers, zero * and negative one. Some options (notably "bufpolicy" and "bufresize") take * predefined tokens as their values; these are defined with * DTRACEOPT_{option}_{token}. */ #define DTRACEOPT_BUFSIZE 0 /* buffer size */ #define DTRACEOPT_BUFPOLICY 1 /* buffer policy */ #define DTRACEOPT_DYNVARSIZE 2 /* dynamic variable size */ #define DTRACEOPT_AGGSIZE 3 /* aggregation size */ #define DTRACEOPT_SPECSIZE 4 /* speculation size */ #define DTRACEOPT_NSPEC 5 /* number of speculations */ #define DTRACEOPT_STRSIZE 6 /* string size */ #define DTRACEOPT_CLEANRATE 7 /* dynvar cleaning rate */ #define DTRACEOPT_CPU 8 /* CPU to trace */ #define DTRACEOPT_BUFRESIZE 9 /* buffer resizing policy */ #define DTRACEOPT_GRABANON 10 /* grab anonymous state, if any */ #define DTRACEOPT_FLOWINDENT 11 /* indent function entry/return */ #define DTRACEOPT_QUIET 12 /* only output explicitly traced data */ #define DTRACEOPT_STACKFRAMES 13 /* number of stack frames */ #define DTRACEOPT_USTACKFRAMES 14 /* number of user stack frames */ #define DTRACEOPT_AGGRATE 15 /* aggregation snapshot rate */ #define DTRACEOPT_SWITCHRATE 16 /* buffer switching rate */ #define DTRACEOPT_STATUSRATE 17 /* status rate */ #define DTRACEOPT_DESTRUCTIVE 18 /* destructive actions allowed */ #define DTRACEOPT_STACKINDENT 19 /* output indent for stack traces */ #define DTRACEOPT_RAWBYTES 20 /* always print bytes in raw form */ #define DTRACEOPT_JSTACKFRAMES 21 /* number of jstack() frames */ #define DTRACEOPT_JSTACKSTRSIZE 22 /* size of jstack() string table */ #define DTRACEOPT_AGGSORTKEY 23 /* sort aggregations by key */ #define DTRACEOPT_AGGSORTREV 24 /* reverse-sort aggregations */ #define DTRACEOPT_AGGSORTPOS 25 /* agg. position to sort on */ #define DTRACEOPT_AGGSORTKEYPOS 26 /* agg. key position to sort on */ #define DTRACEOPT_AGGHIST 27 /* histogram aggregation output */ #define DTRACEOPT_AGGPACK 28 /* packed aggregation output */ #define DTRACEOPT_AGGZOOM 29 /* zoomed aggregation scaling */ #define DTRACEOPT_TEMPORAL 30 /* temporally ordered output */ #if !defined(__APPLE__) #define DTRACEOPT_MAX 31 /* number of options */ #else #define DTRACEOPT_STACKSYMBOLS 31 /* clear to prevent stack symbolication */ #define DTRACEOPT_BUFLIMIT 32 /* buffer signaling limit in % of the size */ #define DTRACEOPT_MAX 33 /* number of options */ #endif /* __APPLE__ */ #define DTRACEOPT_UNSET (dtrace_optval_t)-2 /* unset option */ #define DTRACEOPT_BUFPOLICY_RING 0 /* ring buffer */ #define DTRACEOPT_BUFPOLICY_FILL 1 /* fill buffer, then stop */ #define DTRACEOPT_BUFPOLICY_SWITCH 2 /* switch buffers */ #define DTRACEOPT_BUFRESIZE_AUTO 0 /* automatic resizing */ #define DTRACEOPT_BUFRESIZE_MANUAL 1 /* manual resizing */ /* * DTrace Buffer Interface * * In order to get a snapshot of the principal or aggregation buffer, * user-level passes a buffer description to the kernel with the dtrace_bufdesc * structure. This describes which CPU user-level is interested in, and * where user-level wishes the kernel to snapshot the buffer to (the * dtbd_data field). The kernel uses the same structure to pass back some * information regarding the buffer: the size of data actually copied out, the * number of drops, the number of errors, the offset of the oldest record, * and the time of the snapshot. * * If the buffer policy is a "switch" policy, taking a snapshot of the * principal buffer has the additional effect of switching the active and * inactive buffers. Taking a snapshot of the aggregation buffer _always_ has * the additional effect of switching the active and inactive buffers. */ typedef struct dtrace_bufdesc { uint64_t dtbd_size; /* size of buffer */ uint32_t dtbd_cpu; /* CPU or DTRACE_CPUALL */ uint32_t dtbd_errors; /* number of errors */ uint64_t dtbd_drops; /* number of drops */ DTRACE_PTR(char, dtbd_data); /* data */ uint64_t dtbd_oldest; /* offset of oldest record */ uint64_t dtbd_timestamp; /* hrtime of snapshot */ } dtrace_bufdesc_t; /* * Each record in the buffer (dtbd_data) begins with a header that includes * the epid and a timestamp. The timestamp is split into two 4-byte parts * so that we do not require 8-byte alignment. */ typedef struct dtrace_rechdr { dtrace_epid_t dtrh_epid; /* enabled probe id */ uint32_t dtrh_timestamp_hi; /* high bits of hrtime_t */ uint32_t dtrh_timestamp_lo; /* low bits of hrtime_t */ } dtrace_rechdr_t; #define DTRACE_RECORD_LOAD_TIMESTAMP(dtrh) \ ((dtrh)->dtrh_timestamp_lo + \ ((uint64_t)(dtrh)->dtrh_timestamp_hi << 32)) #define DTRACE_RECORD_STORE_TIMESTAMP(dtrh, hrtime) { \ (dtrh)->dtrh_timestamp_lo = (uint32_t)hrtime; \ (dtrh)->dtrh_timestamp_hi = hrtime >> 32; \ } /* * DTrace Status * * The status of DTrace is relayed via the dtrace_status structure. This * structure contains members to count drops other than the capacity drops * available via the buffer interface (see above). This consists of dynamic * drops (including capacity dynamic drops, rinsing drops and dirty drops), and * speculative drops (including capacity speculative drops, drops due to busy * speculative buffers and drops due to unavailable speculative buffers). * Additionally, the status structure contains a field to indicate the number * of "fill"-policy buffers have been filled and a boolean field to indicate * that exit() has been called. If the dtst_exiting field is non-zero, no * further data will be generated until tracing is stopped (at which time any * enablings of the END action will be processed); if user-level sees that * this field is non-zero, tracing should be stopped as soon as possible. */ typedef struct dtrace_status { uint64_t dtst_dyndrops; /* dynamic drops */ uint64_t dtst_dyndrops_rinsing; /* dyn drops due to rinsing */ uint64_t dtst_dyndrops_dirty; /* dyn drops due to dirty */ uint64_t dtst_specdrops; /* speculative drops */ uint64_t dtst_specdrops_busy; /* spec drops due to busy */ uint64_t dtst_specdrops_unavail; /* spec drops due to unavail */ uint64_t dtst_errors; /* total errors */ uint64_t dtst_filled; /* number of filled bufs */ uint64_t dtst_stkstroverflows; /* stack string tab overflows */ uint64_t dtst_dblerrors; /* errors in ERROR probes */ char dtst_killed; /* non-zero if killed */ char dtst_exiting; /* non-zero if exit() called */ char dtst_pad[6]; /* pad out to 64-bit align */ } dtrace_status_t; /* * DTrace Configuration * * User-level may need to understand some elements of the kernel DTrace * configuration in order to generate correct DIF. This information is * conveyed via the dtrace_conf structure. */ typedef struct dtrace_conf { uint_t dtc_difversion; /* supported DIF version */ uint_t dtc_difintregs; /* # of DIF integer registers */ uint_t dtc_diftupregs; /* # of DIF tuple registers */ uint_t dtc_ctfmodel; /* CTF data model */ uint_t dtc_pad[8]; /* reserved for future use */ } dtrace_conf_t; /* * DTrace Faults * * The constants below DTRACEFLT_LIBRARY indicate probe processing faults; * constants at or above DTRACEFLT_LIBRARY indicate faults in probe * postprocessing at user-level. Probe processing faults induce an ERROR * probe and are replicated in unistd.d to allow users' ERROR probes to decode * the error condition using thse symbolic labels. */ #define DTRACEFLT_UNKNOWN 0 /* Unknown fault */ #define DTRACEFLT_BADADDR 1 /* Bad address */ #define DTRACEFLT_BADALIGN 2 /* Bad alignment */ #define DTRACEFLT_ILLOP 3 /* Illegal operation */ #define DTRACEFLT_DIVZERO 4 /* Divide-by-zero */ #define DTRACEFLT_NOSCRATCH 5 /* Out of scratch space */ #define DTRACEFLT_KPRIV 6 /* Illegal kernel access */ #define DTRACEFLT_UPRIV 7 /* Illegal user access */ #define DTRACEFLT_TUPOFLOW 8 /* Tuple stack overflow */ #define DTRACEFLT_BADSTACK 9 /* Bad stack */ #define DTRACEFLT_LIBRARY 1000 /* Library-level fault */ /* * DTrace Argument Types * * Because it would waste both space and time, argument types do not reside * with the probe. In order to determine argument types for args[X] * variables, the D compiler queries for argument types on a probe-by-probe * basis. (This optimizes for the common case that arguments are either not * used or used in an untyped fashion.) Typed arguments are specified with a * string of the type name in the dtragd_native member of the argument * description structure. Typed arguments may be further translated to types * of greater stability; the provider indicates such a translated argument by * filling in the dtargd_xlate member with the string of the translated type. * Finally, the provider may indicate which argument value a given argument * maps to by setting the dtargd_mapping member -- allowing a single argument * to map to multiple args[X] variables. */ typedef struct dtrace_argdesc { dtrace_id_t dtargd_id; /* probe identifier */ int dtargd_ndx; /* arg number (-1 iff none) */ int dtargd_mapping; /* value mapping */ char dtargd_native[DTRACE_ARGTYPELEN]; /* native type name */ char dtargd_xlate[DTRACE_ARGTYPELEN]; /* translated type name */ } dtrace_argdesc_t; /* * DTrace Stability Attributes * * Each DTrace provider advertises the name and data stability of each of its * probe description components, as well as its architectural dependencies. * The D compiler can query the provider attributes (dtrace_pattr_t below) in * order to compute the properties of an input program and report them. */ typedef uint8_t dtrace_stability_t; /* stability code (see attributes(5)) */ typedef uint8_t dtrace_class_t; /* architectural dependency class */ #define DTRACE_STABILITY_INTERNAL 0 /* private to DTrace itself */ #define DTRACE_STABILITY_PRIVATE 1 /* private to Sun (see docs) */ #define DTRACE_STABILITY_OBSOLETE 2 /* scheduled for removal */ #define DTRACE_STABILITY_EXTERNAL 3 /* not controlled by Sun */ #define DTRACE_STABILITY_UNSTABLE 4 /* new or rapidly changing */ #define DTRACE_STABILITY_EVOLVING 5 /* less rapidly changing */ #define DTRACE_STABILITY_STABLE 6 /* mature interface from Sun */ #define DTRACE_STABILITY_STANDARD 7 /* industry standard */ #define DTRACE_STABILITY_MAX 7 /* maximum valid stability */ #define DTRACE_CLASS_UNKNOWN 0 /* unknown architectural dependency */ #define DTRACE_CLASS_CPU 1 /* CPU-module-specific */ #define DTRACE_CLASS_PLATFORM 2 /* platform-specific (uname -i) */ #define DTRACE_CLASS_GROUP 3 /* hardware-group-specific (uname -m) */ #define DTRACE_CLASS_ISA 4 /* ISA-specific (uname -p) */ #define DTRACE_CLASS_COMMON 5 /* common to all systems */ #define DTRACE_CLASS_MAX 5 /* maximum valid class */ #define DTRACE_PRIV_NONE 0x0000 #define DTRACE_PRIV_KERNEL 0x0001 #define DTRACE_PRIV_USER 0x0002 #define DTRACE_PRIV_PROC 0x0004 #define DTRACE_PRIV_OWNER 0x0008 #define DTRACE_PRIV_ZONEOWNER 0x0010 #define DTRACE_PRIV_ALL \ (DTRACE_PRIV_KERNEL | DTRACE_PRIV_USER | \ DTRACE_PRIV_PROC | DTRACE_PRIV_OWNER | DTRACE_PRIV_ZONEOWNER) typedef struct dtrace_ppriv { uint32_t dtpp_flags; /* privilege flags */ uid_t dtpp_uid; /* user ID */ zoneid_t dtpp_zoneid; /* zone ID */ } dtrace_ppriv_t; typedef struct dtrace_attribute { dtrace_stability_t dtat_name; /* entity name stability */ dtrace_stability_t dtat_data; /* entity data stability */ dtrace_class_t dtat_class; /* entity data dependency */ } dtrace_attribute_t; typedef struct dtrace_pattr { dtrace_attribute_t dtpa_provider; /* provider attributes */ dtrace_attribute_t dtpa_mod; /* module attributes */ dtrace_attribute_t dtpa_func; /* function attributes */ dtrace_attribute_t dtpa_name; /* name attributes */ dtrace_attribute_t dtpa_args; /* args[] attributes */ } dtrace_pattr_t; typedef struct dtrace_providerdesc { char dtvd_name[DTRACE_PROVNAMELEN]; /* provider name */ dtrace_pattr_t dtvd_attr; /* stability attributes */ dtrace_ppriv_t dtvd_priv; /* privileges required */ } dtrace_providerdesc_t; /* * DTrace Pseudodevice Interface * * DTrace is controlled through ioctl(2)'s to the in-kernel dtrace:dtrace * pseudodevice driver. These ioctls comprise the user-kernel interface to * DTrace. */ #if !defined(__APPLE__) #define DTRACEIOC (('d' << 24) | ('t' << 16) | ('r' << 8)) #define DTRACEIOC_PROVIDER (DTRACEIOC | 1) /* provider query */ #define DTRACEIOC_PROBES (DTRACEIOC | 2) /* probe query */ #define DTRACEIOC_BUFSNAP (DTRACEIOC | 4) /* snapshot buffer */ #define DTRACEIOC_PROBEMATCH (DTRACEIOC | 5) /* match probes */ #define DTRACEIOC_ENABLE (DTRACEIOC | 6) /* enable probes */ #define DTRACEIOC_AGGSNAP (DTRACEIOC | 7) /* snapshot agg. */ #define DTRACEIOC_EPROBE (DTRACEIOC | 8) /* get eprobe desc. */ #define DTRACEIOC_PROBEARG (DTRACEIOC | 9) /* get probe arg */ #define DTRACEIOC_CONF (DTRACEIOC | 10) /* get config. */ #define DTRACEIOC_STATUS (DTRACEIOC | 11) /* get status */ #define DTRACEIOC_GO (DTRACEIOC | 12) /* start tracing */ #define DTRACEIOC_STOP (DTRACEIOC | 13) /* stop tracing */ #define DTRACEIOC_AGGDESC (DTRACEIOC | 15) /* get agg. desc. */ #define DTRACEIOC_FORMAT (DTRACEIOC | 16) /* get format str */ #define DTRACEIOC_DOFGET (DTRACEIOC | 17) /* get DOF */ #define DTRACEIOC_REPLICATE (DTRACEIOC | 18) /* replicate enab */ #else /* coding this as IOC_VOID allows this driver to handle its own copyin/copuout */ #define DTRACEIOC _IO('d',0) #define DTRACEIOC_PROVIDER (DTRACEIOC | 1) /* provider query */ #define DTRACEIOC_PROBES (DTRACEIOC | 2) /* probe query */ #define DTRACEIOC_BUFSNAP (DTRACEIOC | 4) /* snapshot buffer */ #define DTRACEIOC_PROBEMATCH (DTRACEIOC | 5) /* match probes */ #define DTRACEIOC_ENABLE (DTRACEIOC | 6) /* enable probes */ #define DTRACEIOC_AGGSNAP (DTRACEIOC | 7) /* snapshot agg. */ #define DTRACEIOC_EPROBE (DTRACEIOC | 8) /* get eprobe desc. */ #define DTRACEIOC_PROBEARG (DTRACEIOC | 9) /* get probe arg */ #define DTRACEIOC_CONF (DTRACEIOC | 10) /* get config. */ #define DTRACEIOC_STATUS (DTRACEIOC | 11) /* get status */ #define DTRACEIOC_GO (DTRACEIOC | 12) /* start tracing */ #define DTRACEIOC_STOP (DTRACEIOC | 13) /* stop tracing */ #define DTRACEIOC_AGGDESC (DTRACEIOC | 15) /* get agg. desc. */ #define DTRACEIOC_FORMAT (DTRACEIOC | 16) /* get format str */ #define DTRACEIOC_DOFGET (DTRACEIOC | 17) /* get DOF */ #define DTRACEIOC_REPLICATE (DTRACEIOC | 18) /* replicate enab */ #define DTRACEIOC_MODUUIDSLIST (DTRACEIOC | 30) /* APPLE ONLY, query for modules with missing symbols */ #define DTRACEIOC_PROVMODSYMS (DTRACEIOC | 31) /* APPLE ONLY, provide missing symbols for a given module */ #define DTRACEIOC_PROCWAITFOR (DTRACEIOC | 32) /* APPLE ONLY, wait for process exec */ #define DTRACEIOC_SLEEP (DTRACEIOC | 33) /* APPLE ONLY, sleep */ #define DTRACEIOC_SIGNAL (DTRACEIOC | 34) /* APPLE ONLY, signal sleeping process */ /* * The following structs are used to provide symbol information to the kernel from userspace. */ typedef struct dtrace_symbol { uint64_t dtsym_addr; /* address of the symbol */ uint64_t dtsym_size; /* size of the symbol, must be uint64_t to maintain alignment when called by 64b uproc in i386 kernel */ char dtsym_name[DTRACE_FUNCNAMELEN]; /* symbol name */ } dtrace_symbol_t; typedef struct dtrace_module_symbols { UUID dtmodsyms_uuid; uint64_t dtmodsyms_count; dtrace_symbol_t dtmodsyms_symbols[1]; } dtrace_module_symbols_t; /* * Safely compute the size in bytes of space we need to copyin module's symbols from userspace. * Assumes that count has been checked to be at least 1. */ #define DTRACE_MODULE_SYMBOLS_SIZE(count) ({\ size_t _sym_count = (size_t)(count - 1); \ size_t _buf_size = 0; \ if (os_mul_and_add_overflow(_sym_count, \ sizeof(dtrace_symbol_t), \ sizeof(dtrace_module_symbols_t), \ &_buf_size)) { \ _buf_size = 0; \ } \ _buf_size; }) typedef struct dtrace_module_uuids_list { uint64_t dtmul_count; UUID dtmul_uuid[1]; } dtrace_module_uuids_list_t; #define DTRACE_MODULE_UUIDS_LIST_SIZE(count) (sizeof(dtrace_module_uuids_list_t) + ((count - 1) * sizeof(UUID))) typedef struct dtrace_procdesc { /* Must be specified by user-space */ char p_name[128]; /* Set or modified by the Kernel */ int p_name_length; pid_t p_pid; } dtrace_procdesc_t; /** * DTrace wake reasons. * This is used in userspace to determine what's the reason why it woke up, * to start aggregating / switching buffer right away if it is because a buffer * got over its limit */ #define DTRACE_WAKE_TIMEOUT 0 /* dtrace client woke up because of a timeout */ #define DTRACE_WAKE_BUF_LIMIT 1 /* dtrace client woke up because of a over limit buffer */ #endif /* __APPLE__ */ /* * DTrace Helpers * * In general, DTrace establishes probes in processes and takes actions on * processes without knowing their specific user-level structures. Instead of * existing in the framework, process-specific knowledge is contained by the * enabling D program -- which can apply process-specific knowledge by making * appropriate use of DTrace primitives like copyin() and copyinstr() to * operate on user-level data. However, there may exist some specific probes * of particular semantic relevance that the application developer may wish to * explicitly export. For example, an application may wish to export a probe * at the point that it begins and ends certain well-defined transactions. In * addition to providing probes, programs may wish to offer assistance for * certain actions. For example, in highly dynamic environments (e.g., Java), * it may be difficult to obtain a stack trace in terms of meaningful symbol * names (the translation from instruction addresses to corresponding symbol * names may only be possible in situ); these environments may wish to define * a series of actions to be applied in situ to obtain a meaningful stack * trace. * * These two mechanisms -- user-level statically defined tracing and assisting * DTrace actions -- are provided via DTrace _helpers_. Helpers are specified * via DOF, but unlike enabling DOF, helper DOF may contain definitions of * providers, probes and their arguments. If a helper wishes to provide * action assistance, probe descriptions and corresponding DIF actions may be * specified in the helper DOF. For such helper actions, however, the probe * description describes the specific helper: all DTrace helpers have the * provider name "dtrace" and the module name "helper", and the name of the * helper is contained in the function name (for example, the ustack() helper * is named "ustack"). Any helper-specific name may be contained in the name * (for example, if a helper were to have a constructor, it might be named * "dtrace:helper::init"). Helper actions are only called when the * action that they are helping is taken. Helper actions may only return DIF * expressions, and may only call the following subroutines: * * alloca() <= Allocates memory out of the consumer's scratch space * bcopy() <= Copies memory to scratch space * copyin() <= Copies memory from user-level into consumer's scratch * copyinto() <= Copies memory into a specific location in scratch * copyinstr() <= Copies a string into a specific location in scratch * * Helper actions may only access the following built-in variables: * * curthread <= Current kthread_t pointer * tid <= Current thread identifier * pid <= Current process identifier * ppid <= Parent process identifier * uid <= Current user ID * gid <= Current group ID * execname <= Current executable name * zonename <= Current zone name * * Helper actions may not manipulate or allocate dynamic variables, but they * may have clause-local and statically-allocated global variables. The * helper action variable state is specific to the helper action -- variables * used by the helper action may not be accessed outside of the helper * action, and the helper action may not access variables that like outside * of it. Helper actions may not load from kernel memory at-large; they are * restricting to loading current user state (via copyin() and variants) and * scratch space. As with probe enablings, helper actions are executed in * program order. The result of the helper action is the result of the last * executing helper expression. * * Helpers -- composed of either providers/probes or probes/actions (or both) * -- are added by opening the "helper" minor node, and issuing an ioctl(2) * (DTRACEHIOC_ADDDOF) that specifies the dof_helper_t structure. This * encapsulates the name and base address of the user-level library or * executable publishing the helpers and probes as well as the DOF that * contains the definitions of those helpers and probes. * * The DTRACEHIOC_ADD and DTRACEHIOC_REMOVE are left in place for legacy * helpers and should no longer be used. No other ioctls are valid on the * helper minor node. */ #if !defined(__APPLE__) #define DTRACEHIOC (('d' << 24) | ('t' << 16) | ('h' << 8)) #define DTRACEHIOC_ADD (DTRACEHIOC | 1) /* add helper */ #define DTRACEHIOC_REMOVE (DTRACEHIOC | 2) /* remove helper */ #define DTRACEHIOC_ADDDOF (DTRACEHIOC | 3) /* add helper DOF */ #else #define DTRACEHIOC_REMOVE _IO('h', 2) /* remove helper */ #define DTRACEHIOC_ADDDOF _IOW('h', 4, user_addr_t) /* add helper DOF */ #endif /* __APPLE__ */ typedef struct dof_helper { char dofhp_mod[DTRACE_MODNAMELEN]; /* executable or library name */ uint64_t dofhp_addr; /* base address of object */ uint64_t dofhp_dof; /* address of helper DOF */ } dof_helper_t; #if defined(__APPLE__) /* * This structure is used to register one or more dof_helper_t(s). * For counts greater than one, malloc the structure as if the * dofiod_helpers field was "count" sized. The kernel will copyin * data of size: * * sizeof(dof_ioctl_data_t) + ((count - 1) * sizeof(dof_helper_t)) */ typedef struct dof_ioctl_data { /* * This field must be 64 bits to keep the alignment the same * when 64 bit user procs are sending data to 32 bit xnu */ uint64_t dofiod_count; dof_helper_t dofiod_helpers[1]; } dof_ioctl_data_t; #define DOF_IOCTL_DATA_T_SIZE(count) (sizeof(dof_ioctl_data_t) + ((count - 1) * sizeof(dof_helper_t))) #endif #define DTRACEMNR_DTRACE "dtrace" /* node for DTrace ops */ #if !defined(__APPLE__) #define DTRACEMNR_HELPER "helper" /* node for helpers */ #else #define DTRACEMNR_HELPER "dtracehelper" /* node for helpers */ #endif /* __APPLE__ */ #define DTRACEMNRN_DTRACE 0 /* minor for DTrace ops */ #define DTRACEMNRN_HELPER 1 /* minor for helpers */ #define DTRACEMNRN_CLONE 2 /* first clone minor */ #ifdef _KERNEL /* * DTrace Provider API * * The following functions are implemented by the DTrace framework and are * used to implement separate in-kernel DTrace providers. Common functions * are provided in uts/common/os/dtrace.c. ISA-dependent subroutines are * defined in uts//dtrace/dtrace_asm.s or uts//dtrace/dtrace_isa.c. * * The provider API has two halves: the API that the providers consume from * DTrace, and the API that providers make available to DTrace. * * 1 Framework-to-Provider API * * 1.1 Overview * * The Framework-to-Provider API is represented by the dtrace_pops structure * that the provider passes to the framework when registering itself. This * structure consists of the following members: * * dtps_provide() <-- Provide all probes, all modules * dtps_provide_module() <-- Provide all probes in specified module * dtps_enable() <-- Enable specified probe * dtps_disable() <-- Disable specified probe * dtps_suspend() <-- Suspend specified probe * dtps_resume() <-- Resume specified probe * dtps_getargdesc() <-- Get the argument description for args[X] * dtps_getargval() <-- Get the value for an argX or args[X] variable * dtps_usermode() <-- Find out if the probe was fired in user mode * dtps_destroy() <-- Destroy all state associated with this probe * * 1.2 void dtps_provide(void *arg, const dtrace_probedesc_t *spec) * * 1.2.1 Overview * * Called to indicate that the provider should provide all probes. If the * specified description is non-NULL, dtps_provide() is being called because * no probe matched a specified probe -- if the provider has the ability to * create custom probes, it may wish to create a probe that matches the * specified description. * * 1.2.2 Arguments and notes * * The first argument is the cookie as passed to dtrace_register(). The * second argument is a pointer to a probe description that the provider may * wish to consider when creating custom probes. The provider is expected to * call back into the DTrace framework via dtrace_probe_create() to create * any necessary probes. dtps_provide() may be called even if the provider * has made available all probes; the provider should check the return value * of dtrace_probe_create() to handle this case. Note that the provider need * not implement both dtps_provide() and dtps_provide_module(); see * "Arguments and Notes" for dtrace_register(), below. * * 1.2.3 Return value * * None. * * 1.2.4 Caller's context * * dtps_provide() is typically called from open() or ioctl() context, but may * be called from other contexts as well. The DTrace framework is locked in * such a way that providers may not register or unregister. This means that * the provider may not call any DTrace API that affects its registration with * the framework, including dtrace_register(), dtrace_unregister(), * dtrace_invalidate(), and dtrace_condense(). However, the context is such * that the provider may (and indeed, is expected to) call probe-related * DTrace routines, including dtrace_probe_create(), dtrace_probe_lookup(), * and dtrace_probe_arg(). * * 1.3 void dtps_provide_module(void *arg, struct modctl *mp) * * 1.3.1 Overview * * Called to indicate that the provider should provide all probes in the * specified module. * * 1.3.2 Arguments and notes * * The first argument is the cookie as passed to dtrace_register(). The * second argument is a pointer to a modctl structure that indicates the * module for which probes should be created. * * 1.3.3 Return value * * None. * * 1.3.4 Caller's context * * dtps_provide_module() may be called from open() or ioctl() context, but * may also be called from a module loading context. mod_lock is held, and * the DTrace framework is locked in such a way that providers may not * register or unregister. This means that the provider may not call any * DTrace API that affects its registration with the framework, including * dtrace_register(), dtrace_unregister(), dtrace_invalidate(), and * dtrace_condense(). However, the context is such that the provider may (and * indeed, is expected to) call probe-related DTrace routines, including * dtrace_probe_create(), dtrace_probe_lookup(), and dtrace_probe_arg(). Note * that the provider need not implement both dtps_provide() and * dtps_provide_module(); see "Arguments and Notes" for dtrace_register(), * below. * * 1.4 int dtps_enable(void *arg, dtrace_id_t id, void *parg) * * 1.4.1 Overview * * Called to enable the specified probe. * * 1.4.2 Arguments and notes * * The first argument is the cookie as passed to dtrace_register(). The * second argument is the identifier of the probe to be enabled. The third * argument is the probe argument as passed to dtrace_probe_create(). * dtps_enable() will be called when a probe transitions from not being * enabled at all to having one or more ECB. The number of ECBs associated * with the probe may change without subsequent calls into the provider. * When the number of ECBs drops to zero, the provider will be explicitly * told to disable the probe via dtps_disable(). dtrace_probe() should never * be called for a probe identifier that hasn't been explicitly enabled via * dtps_enable(). * * 1.4.3 Return value * * On success, dtps_enable() should return 0. On failure, -1 should be * returned. * * 1.4.4 Caller's context * * The DTrace framework is locked in such a way that it may not be called * back into at all. cpu_lock is held. mod_lock is not held and may not * be acquired. * * 1.5 void dtps_disable(void *arg, dtrace_id_t id, void *parg) * * 1.5.1 Overview * * Called to disable the specified probe. * * 1.5.2 Arguments and notes * * The first argument is the cookie as passed to dtrace_register(). The * second argument is the identifier of the probe to be disabled. The third * argument is the probe argument as passed to dtrace_probe_create(). * dtps_disable() will be called when a probe transitions from being enabled * to having zero ECBs. dtrace_probe() should never be called for a probe * identifier that has been explicitly enabled via dtps_disable(). * * 1.5.3 Return value * * None. * * 1.5.4 Caller's context * * The DTrace framework is locked in such a way that it may not be called * back into at all. cpu_lock is held. mod_lock is not held and may not * be acquired. * * 1.6 void dtps_suspend(void *arg, dtrace_id_t id, void *parg) * * 1.6.1 Overview * * Called to suspend the specified enabled probe. This entry point is for * providers that may need to suspend some or all of their probes when CPUs * are being powered on or when the boot monitor is being entered for a * prolonged period of time. * * 1.6.2 Arguments and notes * * The first argument is the cookie as passed to dtrace_register(). The * second argument is the identifier of the probe to be suspended. The * third argument is the probe argument as passed to dtrace_probe_create(). * dtps_suspend will only be called on an enabled probe. Providers that * provide a dtps_suspend entry point will want to take roughly the action * that it takes for dtps_disable. * * 1.6.3 Return value * * None. * * 1.6.4 Caller's context * * Interrupts are disabled. The DTrace framework is in a state such that the * specified probe cannot be disabled or destroyed for the duration of * dtps_suspend(). As interrupts are disabled, the provider is afforded * little latitude; the provider is expected to do no more than a store to * memory. * * 1.7 void dtps_resume(void *arg, dtrace_id_t id, void *parg) * * 1.7.1 Overview * * Called to resume the specified enabled probe. This entry point is for * providers that may need to resume some or all of their probes after the * completion of an event that induced a call to dtps_suspend(). * * 1.7.2 Arguments and notes * * The first argument is the cookie as passed to dtrace_register(). The * second argument is the identifier of the probe to be resumed. The * third argument is the probe argument as passed to dtrace_probe_create(). * dtps_resume will only be called on an enabled probe. Providers that * provide a dtps_resume entry point will want to take roughly the action * that it takes for dtps_enable. * * 1.7.3 Return value * * None. * * 1.7.4 Caller's context * * Interrupts are disabled. The DTrace framework is in a state such that the * specified probe cannot be disabled or destroyed for the duration of * dtps_resume(). As interrupts are disabled, the provider is afforded * little latitude; the provider is expected to do no more than a store to * memory. * * 1.8 void dtps_getargdesc(void *arg, dtrace_id_t id, void *parg, * dtrace_argdesc_t *desc) * * 1.8.1 Overview * * Called to retrieve the argument description for an args[X] variable. * * 1.8.2 Arguments and notes * * The first argument is the cookie as passed to dtrace_register(). The * second argument is the identifier of the current probe. The third * argument is the probe argument as passed to dtrace_probe_create(). The * fourth argument is a pointer to the argument description. This * description is both an input and output parameter: it contains the * index of the desired argument in the dtargd_ndx field, and expects * the other fields to be filled in upon return. If there is no argument * corresponding to the specified index, the dtargd_ndx field should be set * to DTRACE_ARGNONE. * * 1.8.3 Return value * * None. The dtargd_ndx, dtargd_native, dtargd_xlate and dtargd_mapping * members of the dtrace_argdesc_t structure are all output values. * * 1.8.4 Caller's context * * dtps_getargdesc() is called from ioctl() context. mod_lock is held, and * the DTrace framework is locked in such a way that providers may not * register or unregister. This means that the provider may not call any * DTrace API that affects its registration with the framework, including * dtrace_register(), dtrace_unregister(), dtrace_invalidate(), and * dtrace_condense(). * * 1.9 uint64_t dtps_getargval(void *arg, dtrace_id_t id, void *parg, * int argno, int aframes) * * 1.9.1 Overview * * Called to retrieve a value for an argX or args[X] variable. * * 1.9.2 Arguments and notes * * The first argument is the cookie as passed to dtrace_register(). The * second argument is the identifier of the current probe. The third * argument is the probe argument as passed to dtrace_probe_create(). The * fourth argument is the number of the argument (the X in the example in * 1.9.1). The fifth argument is the number of stack frames that were used * to get from the actual place in the code that fired the probe to * dtrace_probe() itself, the so-called artificial frames. This argument may * be used to descend an appropriate number of frames to find the correct * values. If this entry point is left NULL, the dtrace_getarg() built-in * function is used. * * 1.9.3 Return value * * The value of the argument. * * 1.9.4 Caller's context * * This is called from within dtrace_probe() meaning that interrupts * are disabled. No locks should be taken within this entry point. * * 1.10 int dtps_usermode(void *arg, dtrace_id_t id, void *parg) * * 1.10.1 Overview * * Called to determine if the probe was fired in a user context. * * 1.10.2 Arguments and notes * * The first argument is the cookie as passed to dtrace_register(). The * second argument is the identifier of the current probe. The third * argument is the probe argument as passed to dtrace_probe_create(). This * entry point must not be left NULL for providers whose probes allow for * mixed mode tracing, that is to say those probes that can fire during * kernel- _or_ user-mode execution * * 1.10.3 Return value * * A boolean value. * * 1.10.4 Caller's context * * This is called from within dtrace_probe() meaning that interrupts * are disabled. No locks should be taken within this entry point. * * 1.11 void dtps_destroy(void *arg, dtrace_id_t id, void *parg) * * 1.11.1 Overview * * Called to destroy the specified probe. * * 1.11.2 Arguments and notes * * The first argument is the cookie as passed to dtrace_register(). The * second argument is the identifier of the probe to be destroyed. The third * argument is the probe argument as passed to dtrace_probe_create(). The * provider should free all state associated with the probe. The framework * guarantees that dtps_destroy() is only called for probes that have either * been disabled via dtps_disable() or were never enabled via dtps_enable(). * Once dtps_disable() has been called for a probe, no further call will be * made specifying the probe. * * 1.11.3 Return value * * None. * * 1.11.4 Caller's context * * The DTrace framework is locked in such a way that it may not be called * back into at all. mod_lock is held. cpu_lock is not held, and may not be * acquired. * * * 2 Provider-to-Framework API * * 2.1 Overview * * The Provider-to-Framework API provides the mechanism for the provider to * register itself with the DTrace framework, to create probes, to lookup * probes and (most importantly) to fire probes. The Provider-to-Framework * consists of: * * dtrace_register() <-- Register a provider with the DTrace framework * dtrace_unregister() <-- Remove a provider's DTrace registration * dtrace_invalidate() <-- Invalidate the specified provider * dtrace_condense() <-- Remove a provider's unenabled probes * dtrace_attached() <-- Indicates whether or not DTrace has attached * dtrace_probe_create() <-- Create a DTrace probe * dtrace_probe_lookup() <-- Lookup a DTrace probe based on its name * dtrace_probe_arg() <-- Return the probe argument for a specific probe * dtrace_probe() <-- Fire the specified probe * * 2.2 int dtrace_register(const char *name, const dtrace_pattr_t *pap, * uint32_t priv, cred_t *cr, const dtrace_pops_t *pops, void *arg, * dtrace_provider_id_t *idp) * * 2.2.1 Overview * * dtrace_register() registers the calling provider with the DTrace * framework. It should generally be called by DTrace providers in their * attach(9E) entry point. * * 2.2.2 Arguments and Notes * * The first argument is the name of the provider. The second argument is a * pointer to the stability attributes for the provider. The third argument * is the privilege flags for the provider, and must be some combination of: * * DTRACE_PRIV_NONE <= All users may enable probes from this provider * * DTRACE_PRIV_PROC <= Any user with privilege of PRIV_DTRACE_PROC may * enable probes from this provider * * DTRACE_PRIV_USER <= Any user with privilege of PRIV_DTRACE_USER may * enable probes from this provider * * DTRACE_PRIV_KERNEL <= Any user with privilege of PRIV_DTRACE_KERNEL * may enable probes from this provider * * DTRACE_PRIV_OWNER <= This flag places an additional constraint on * the privilege requirements above. These probes * require either (a) a user ID matching the user * ID of the cred passed in the fourth argument * or (b) the PRIV_PROC_OWNER privilege. * * DTRACE_PRIV_ZONEOWNER<= This flag places an additional constraint on * the privilege requirements above. These probes * require either (a) a zone ID matching the zone * ID of the cred passed in the fourth argument * or (b) the PRIV_PROC_ZONE privilege. * * Note that these flags designate the _visibility_ of the probes, not * the conditions under which they may or may not fire. * * The fourth argument is the credential that is associated with the * provider. This argument should be NULL if the privilege flags don't * include DTRACE_PRIV_OWNER or DTRACE_PRIV_ZONEOWNER. If non-NULL, the * framework stashes the uid and zoneid represented by this credential * for use at probe-time, in implicit predicates. These limit visibility * of the probes to users and/or zones which have sufficient privilege to * access them. * * The fifth argument is a DTrace provider operations vector, which provides * the implementation for the Framework-to-Provider API. (See Section 1, * above.) This must be non-NULL, and each member must be non-NULL. The * exceptions to this are (1) the dtps_provide() and dtps_provide_module() * members (if the provider so desires, _one_ of these members may be left * NULL -- denoting that the provider only implements the other) and (2) * the dtps_suspend() and dtps_resume() members, which must either both be * NULL or both be non-NULL. * * The sixth argument is a cookie to be specified as the first argument for * each function in the Framework-to-Provider API. This argument may have * any value. * * The final argument is a pointer to dtrace_provider_id_t. If * dtrace_register() successfully completes, the provider identifier will be * stored in the memory pointed to be this argument. This argument must be * non-NULL. * * 2.2.3 Return value * * On success, dtrace_register() returns 0 and stores the new provider's * identifier into the memory pointed to by the idp argument. On failure, * dtrace_register() returns an errno: * * EINVAL The arguments passed to dtrace_register() were somehow invalid. * This may because a parameter that must be non-NULL was NULL, * because the name was invalid (either empty or an illegal * provider name) or because the attributes were invalid. * * No other failure code is returned. * * 2.2.4 Caller's context * * dtrace_register() may induce calls to dtrace_provide(); the provider must * hold no locks across dtrace_register() that may also be acquired by * dtrace_provide(). cpu_lock and mod_lock must not be held. * * 2.3 int dtrace_unregister(dtrace_provider_t id) * * 2.3.1 Overview * * Unregisters the specified provider from the DTrace framework. It should * generally be called by DTrace providers in their detach(9E) entry point. * * 2.3.2 Arguments and Notes * * The only argument is the provider identifier, as returned from a * successful call to dtrace_register(). As a result of calling * dtrace_unregister(), the DTrace framework will call back into the provider * via the dtps_destroy() entry point. Once dtrace_unregister() successfully * completes, however, the DTrace framework will no longer make calls through * the Framework-to-Provider API. * * 2.3.3 Return value * * On success, dtrace_unregister returns 0. On failure, dtrace_unregister() * returns an errno: * * EBUSY There are currently processes that have the DTrace pseudodevice * open, or there exists an anonymous enabling that hasn't yet * been claimed. * * No other failure code is returned. * * 2.3.4 Caller's context * * Because a call to dtrace_unregister() may induce calls through the * Framework-to-Provider API, the caller may not hold any lock across * dtrace_register() that is also acquired in any of the Framework-to- * Provider API functions. Additionally, mod_lock may not be held. * * 2.4 void dtrace_invalidate(dtrace_provider_id_t id) * * 2.4.1 Overview * * Invalidates the specified provider. All subsequent probe lookups for the * specified provider will fail, but its probes will not be removed. * * 2.4.2 Arguments and note * * The only argument is the provider identifier, as returned from a * successful call to dtrace_register(). In general, a provider's probes * always remain valid; dtrace_invalidate() is a mechanism for invalidating * an entire provider, regardless of whether or not probes are enabled or * not. Note that dtrace_invalidate() will _not_ prevent already enabled * probes from firing -- it will merely prevent any new enablings of the * provider's probes. * * 2.5 int dtrace_condense(dtrace_provider_id_t id) * * 2.5.1 Overview * * Removes all the unenabled probes for the given provider. This function is * not unlike dtrace_unregister(), except that it doesn't remove the * provider just as many of its associated probes as it can. * * 2.5.2 Arguments and Notes * * As with dtrace_unregister(), the sole argument is the provider identifier * as returned from a successful call to dtrace_register(). As a result of * calling dtrace_condense(), the DTrace framework will call back into the * given provider's dtps_destroy() entry point for each of the provider's * unenabled probes. * * 2.5.3 Return value * * Currently, dtrace_condense() always returns 0. However, consumers of this * function should check the return value as appropriate; its behavior may * change in the future. * * 2.5.4 Caller's context * * As with dtrace_unregister(), the caller may not hold any lock across * dtrace_condense() that is also acquired in the provider's entry points. * Also, mod_lock may not be held. * * 2.6 int dtrace_attached() * * 2.6.1 Overview * * Indicates whether or not DTrace has attached. * * 2.6.2 Arguments and Notes * * For most providers, DTrace makes initial contact beyond registration. * That is, once a provider has registered with DTrace, it waits to hear * from DTrace to create probes. However, some providers may wish to * proactively create probes without first being told by DTrace to do so. * If providers wish to do this, they must first call dtrace_attached() to * determine if DTrace itself has attached. If dtrace_attached() returns 0, * the provider must not make any other Provider-to-Framework API call. * * 2.6.3 Return value * * dtrace_attached() returns 1 if DTrace has attached, 0 otherwise. * * 2.7 int dtrace_probe_create(dtrace_provider_t id, const char *mod, * const char *func, const char *name, int aframes, void *arg) * * 2.7.1 Overview * * Creates a probe with specified module name, function name, and name. * * 2.7.2 Arguments and Notes * * The first argument is the provider identifier, as returned from a * successful call to dtrace_register(). The second, third, and fourth * arguments are the module name, function name, and probe name, * respectively. Of these, module name and function name may both be NULL * (in which case the probe is considered to be unanchored), or they may both * be non-NULL. The name must be non-NULL, and must point to a non-empty * string. * * The fifth argument is the number of artificial stack frames that will be * found on the stack when dtrace_probe() is called for the new probe. These * artificial frames will be automatically be pruned should the stack() or * stackdepth() functions be called as part of one of the probe's ECBs. If * the parameter doesn't add an artificial frame, this parameter should be * zero. * * The final argument is a probe argument that will be passed back to the * provider when a probe-specific operation is called. (e.g., via * dtps_enable(), dtps_disable(), etc.) * * Note that it is up to the provider to be sure that the probe that it * creates does not already exist -- if the provider is unsure of the probe's * existence, it should assure its absence with dtrace_probe_lookup() before * calling dtrace_probe_create(). * * 2.7.3 Return value * * dtrace_probe_create() always succeeds, and always returns the identifier * of the newly-created probe. * * 2.7.4 Caller's context * * While dtrace_probe_create() is generally expected to be called from * dtps_provide() and/or dtps_provide_module(), it may be called from other * non-DTrace contexts. Neither cpu_lock nor mod_lock may be held. * * 2.8 dtrace_id_t dtrace_probe_lookup(dtrace_provider_t id, const char *mod, * const char *func, const char *name) * * 2.8.1 Overview * * Looks up a probe based on provdider and one or more of module name, * function name and probe name. * * 2.8.2 Arguments and Notes * * The first argument is the provider identifier, as returned from a * successful call to dtrace_register(). The second, third, and fourth * arguments are the module name, function name, and probe name, * respectively. Any of these may be NULL; dtrace_probe_lookup() will return * the identifier of the first probe that is provided by the specified * provider and matches all of the non-NULL matching criteria. * dtrace_probe_lookup() is generally used by a provider to be check the * existence of a probe before creating it with dtrace_probe_create(). * * 2.8.3 Return value * * If the probe exists, returns its identifier. If the probe does not exist, * return DTRACE_IDNONE. * * 2.8.4 Caller's context * * While dtrace_probe_lookup() is generally expected to be called from * dtps_provide() and/or dtps_provide_module(), it may also be called from * other non-DTrace contexts. Neither cpu_lock nor mod_lock may be held. * * 2.9 void *dtrace_probe_arg(dtrace_provider_t id, dtrace_id_t probe) * * 2.9.1 Overview * * Returns the probe argument associated with the specified probe. * * 2.9.2 Arguments and Notes * * The first argument is the provider identifier, as returned from a * successful call to dtrace_register(). The second argument is a probe * identifier, as returned from dtrace_probe_lookup() or * dtrace_probe_create(). This is useful if a probe has multiple * provider-specific components to it: the provider can create the probe * once with provider-specific state, and then add to the state by looking * up the probe based on probe identifier. * * 2.9.3 Return value * * Returns the argument associated with the specified probe. If the * specified probe does not exist, or if the specified probe is not provided * by the specified provider, NULL is returned. * * 2.9.4 Caller's context * * While dtrace_probe_arg() is generally expected to be called from * dtps_provide() and/or dtps_provide_module(), it may also be called from * other non-DTrace contexts. Neither cpu_lock nor mod_lock may be held. * * 2.10 void dtrace_probe(dtrace_id_t probe, uintptr_t arg0, uintptr_t arg1, * uintptr_t arg2, uintptr_t arg3, uintptr_t arg4) * * 2.10.1 Overview * * The epicenter of DTrace: fires the specified probes with the specified * arguments. * * 2.10.2 Arguments and Notes * * The first argument is a probe identifier as returned by * dtrace_probe_create() or dtrace_probe_lookup(). The second through sixth * arguments are the values to which the D variables "arg0" through "arg4" * will be mapped. * * dtrace_probe() should be called whenever the specified probe has fired -- * however the provider defines it. * * 2.10.3 Return value * * None. * * 2.10.4 Caller's context * * dtrace_probe() may be called in virtually any context: kernel, user, * interrupt, high-level interrupt, with arbitrary adaptive locks held, with * dispatcher locks held, with interrupts disabled, etc. The only latitude * that must be afforded to DTrace is the ability to make calls within * itself (and to its in-kernel subroutines) and the ability to access * arbitrary (but mapped) memory. On some platforms, this constrains * context. For example, on UltraSPARC, dtrace_probe() cannot be called * from any context in which TL is greater than zero. dtrace_probe() may * also not be called from any routine which may be called by dtrace_probe() * -- which includes functions in the DTrace framework and some in-kernel * DTrace subroutines. All such functions "dtrace_"; providers that * instrument the kernel arbitrarily should be sure to not instrument these * routines. */ typedef struct dtrace_pops { void (*dtps_provide)(void *arg, const dtrace_probedesc_t *spec); void (*dtps_provide_module)(void *arg, struct modctl *mp); int (*dtps_enable)(void *arg, dtrace_id_t id, void *parg); void (*dtps_disable)(void *arg, dtrace_id_t id, void *parg); void (*dtps_suspend)(void *arg, dtrace_id_t id, void *parg); void (*dtps_resume)(void *arg, dtrace_id_t id, void *parg); void (*dtps_getargdesc)(void *arg, dtrace_id_t id, void *parg, dtrace_argdesc_t *desc); uint64_t (*dtps_getargval)(void *arg, dtrace_id_t id, void *parg, int argno, int aframes); int (*dtps_usermode)(void *arg, dtrace_id_t id, void *parg); void (*dtps_destroy)(void *arg, dtrace_id_t id, void *parg); } dtrace_pops_t; typedef uintptr_t dtrace_provider_id_t; extern int dtrace_register(const char *, const dtrace_pattr_t *, uint32_t, cred_t *, const dtrace_pops_t *, void *, dtrace_provider_id_t *); extern int dtrace_unregister(dtrace_provider_id_t); extern int dtrace_condense(dtrace_provider_id_t); extern void dtrace_invalidate(dtrace_provider_id_t); extern dtrace_id_t dtrace_probe_lookup(dtrace_provider_id_t, const char *, const char *, const char *); extern dtrace_id_t dtrace_probe_create(dtrace_provider_id_t, const char *, const char *, const char *, int, void *); extern void *dtrace_probe_arg(dtrace_provider_id_t, dtrace_id_t); #if !defined(__APPLE__) extern void dtrace_probe(dtrace_id_t, uintptr_t arg0, uintptr_t arg1, uintptr_t arg2, uintptr_t arg3, uintptr_t arg4); #else extern void dtrace_probe(dtrace_id_t, uint64_t arg0, uint64_t arg1, uint64_t arg2, uint64_t arg3, uint64_t arg4); #endif /* __APPLE__ */ /* * DTrace Meta Provider API * * The following functions are implemented by the DTrace framework and are * used to implement meta providers. Meta providers plug into the DTrace * framework and are used to instantiate new providers on the fly. At * present, there is only one type of meta provider and only one meta * provider may be registered with the DTrace framework at a time. The * sole meta provider type provides user-land static tracing facilities * by taking meta probe descriptions and adding a corresponding provider * into the DTrace framework. * * 1 Framework-to-Provider * * 1.1 Overview * * The Framework-to-Provider API is represented by the dtrace_mops structure * that the meta provider passes to the framework when registering itself as * a meta provider. This structure consists of the following members: * * dtms_create_probe() <-- Add a new probe to a created provider * dtms_provide_proc() <-- Create a new provider for a given process * dtms_remove_proc() <-- Remove a previously created provider * * 1.2 void dtms_create_probe(void *arg, void *parg, * dtrace_helper_probedesc_t *probedesc); * * 1.2.1 Overview * * Called by the DTrace framework to create a new probe in a provider * created by this meta provider. * * 1.2.2 Arguments and notes * * The first argument is the cookie as passed to dtrace_meta_register(). * The second argument is the provider cookie for the associated provider; * this is obtained from the return value of dtms_provide_proc(). The third * argument is the helper probe description. * * 1.2.3 Return value * * None * * 1.2.4 Caller's context * * dtms_create_probe() is called from either ioctl() or module load context. * The DTrace framework is locked in such a way that meta providers may not * register or unregister. This means that the meta provider cannot call * dtrace_meta_register() or dtrace_meta_unregister(). However, the context is * such that the provider may (and is expected to) call provider-related * DTrace provider APIs including dtrace_probe_create(). * * 1.3 void *dtms_provide_proc(void *arg, dtrace_meta_provider_t *mprov, * proc_t *proc) * * 1.3.1 Overview * * Called by the DTrace framework to instantiate a new provider given the * description of the provider and probes in the mprov argument. The * meta provider should call dtrace_register() to insert the new provider * into the DTrace framework. * * 1.3.2 Arguments and notes * * The first argument is the cookie as passed to dtrace_meta_register(). * The second argument is a pointer to a structure describing the new * helper provider. The third argument is the process identifier for * process associated with this new provider. Note that the name of the * provider as passed to dtrace_register() should be the contatenation of * the dtmpb_provname member of the mprov argument and the processs * identifier as a string. * * 1.3.3 Return value * * The cookie for the provider that the meta provider creates. This is * the same value that it passed to dtrace_register(). * * 1.3.4 Caller's context * * dtms_provide_proc() is called from either ioctl() or module load context. * The DTrace framework is locked in such a way that meta providers may not * register or unregister. This means that the meta provider cannot call * dtrace_meta_register() or dtrace_meta_unregister(). However, the context * is such that the provider may -- and is expected to -- call * provider-related DTrace provider APIs including dtrace_register(). * * 1.4 void dtms_remove_proc(void *arg, dtrace_meta_provider_t *mprov, * proc_t proc) * * 1.4.1 Overview * * Called by the DTrace framework to remove a provider that had previously * been instantiated via the dtms_provide_pid() entry point. The meta * provider need not remove the provider immediately, but this entry * point indicates that the provider should be removed as soon as possible * using the dtrace_unregister() API. * * 1.4.2 Arguments and notes * * The first argument is the cookie as passed to dtrace_meta_register(). * The second argument is a pointer to a structure describing the helper * provider. The third argument is the process identifier for process * associated with this new provider. * * 1.4.3 Return value * * None * * 1.4.4 Caller's context * * dtms_remove_proc() is called from either ioctl() or exit() context. * The DTrace framework is locked in such a way that meta providers may not * register or unregister. This means that the meta provider cannot call * dtrace_meta_register() or dtrace_meta_unregister(). However, the context * is such that the provider may -- and is expected to -- call * provider-related DTrace provider APIs including dtrace_unregister(). */ typedef struct dtrace_helper_probedesc { char *dthpb_mod; /* probe module */ char *dthpb_func; /* probe function */ char *dthpb_name; /* probe name */ uint64_t dthpb_base; /* base address */ #if !defined(__APPLE__) uint32_t *dthpb_offs; /* offsets array */ uint32_t *dthpb_enoffs; /* is-enabled offsets array */ #else int32_t *dthpb_offs; /* (signed) offsets array */ int32_t *dthpb_enoffs; /* (signed) is-enabled offsets array */ #endif uint32_t dthpb_noffs; /* offsets count */ uint32_t dthpb_nenoffs; /* is-enabled offsets count */ uint8_t *dthpb_args; /* argument mapping array */ uint8_t dthpb_xargc; /* translated argument count */ uint8_t dthpb_nargc; /* native argument count */ char *dthpb_xtypes; /* translated types strings */ char *dthpb_ntypes; /* native types strings */ } dtrace_helper_probedesc_t; typedef struct dtrace_helper_provdesc { char *dthpv_provname; /* provider name */ dtrace_pattr_t dthpv_pattr; /* stability attributes */ } dtrace_helper_provdesc_t; /* * APPLE NOTE: dtms_provide_pid and dtms_remove_pid are replaced with * dtms_provide_proc on Darwin, and a proc reference need to be held * for the duration of the call. * * This is due to the fact that proc_find is not re-entrant on Darwin. */ typedef struct dtrace_mops { void (*dtms_create_probe)(void *, void *, dtrace_helper_probedesc_t *); void *(*dtms_provide_proc)(void *, dtrace_helper_provdesc_t *, proc_t*); void (*dtms_remove_proc)(void *, dtrace_helper_provdesc_t *, proc_t*); char* (*dtms_provider_name)(void *); } dtrace_mops_t; typedef uintptr_t dtrace_meta_provider_id_t; extern int dtrace_meta_register(const char *, const dtrace_mops_t *, void *, dtrace_meta_provider_id_t *); extern int dtrace_meta_unregister(dtrace_meta_provider_id_t); /* * DTrace Kernel Hooks * * The following functions are implemented by the base kernel and form a set of * hooks used by the DTrace framework. DTrace hooks are implemented in either * uts/common/os/dtrace_subr.c, an ISA-specific assembly file, or in a * uts//os/dtrace_subr.c corresponding to each hardware platform. */ typedef enum dtrace_vtime_state { DTRACE_VTIME_INACTIVE = 0, /* No DTrace, no TNF */ DTRACE_VTIME_ACTIVE, /* DTrace virtual time, no TNF */ DTRACE_VTIME_INACTIVE_TNF, /* No DTrace, TNF active */ DTRACE_VTIME_ACTIVE_TNF /* DTrace virtual time _and_ TNF */ } dtrace_vtime_state_t; extern dtrace_vtime_state_t dtrace_vtime_active; extern void dtrace_vtime_switch(kthread_t *next); extern void dtrace_vtime_enable_tnf(void); extern void dtrace_vtime_disable_tnf(void); extern void dtrace_vtime_enable(void); extern void dtrace_vtime_disable(void); #if !defined(__APPLE__) struct regs; extern int (*dtrace_pid_probe_ptr)(struct regs *); extern int (*dtrace_return_probe_ptr)(struct regs *); #else #if defined (__i386__) || defined(__x86_64__) extern int (*dtrace_pid_probe_ptr)(x86_saved_state_t *regs); extern int (*dtrace_return_probe_ptr)(x86_saved_state_t* regs); #elif defined (__arm__) || defined(__arm64__) extern int (*dtrace_pid_probe_ptr)(arm_saved_state_t *regs); extern int (*dtrace_return_probe_ptr)(arm_saved_state_t *regs); #else #error architecture not supported #endif #endif /* __APPLE__ */ extern void (*dtrace_fasttrap_fork_ptr)(proc_t *, proc_t *); extern void (*dtrace_fasttrap_exec_ptr)(proc_t *); extern void (*dtrace_fasttrap_exit_ptr)(proc_t *); extern void dtrace_fasttrap_fork(proc_t *, proc_t *); typedef uintptr_t dtrace_icookie_t; typedef void (*dtrace_xcall_t)(void *); extern dtrace_icookie_t dtrace_interrupt_disable(void); extern void dtrace_interrupt_enable(dtrace_icookie_t); extern void dtrace_membar_producer(void); extern void dtrace_membar_consumer(void); extern void (*dtrace_cpu_init)(processorid_t); #if !defined(__APPLE__) extern void (*dtrace_modload)(struct modctl *); extern void (*dtrace_modunload)(struct modctl *); #else extern int (*dtrace_modload)(struct kmod_info *, uint32_t); extern int (*dtrace_modunload)(struct kmod_info *); #endif /* __APPLE__ */ extern void (*dtrace_helpers_cleanup)(proc_t*); extern void (*dtrace_helpers_fork)(proc_t *parent, proc_t *child); extern void (*dtrace_cpustart_init)(void); extern void (*dtrace_cpustart_fini)(void); extern void (*dtrace_kreloc_init)(void); extern void (*dtrace_kreloc_fini)(void); extern void (*dtrace_debugger_init)(void); extern void (*dtrace_debugger_fini)(void); extern dtrace_cacheid_t dtrace_predcache_id; extern hrtime_t dtrace_gethrtime(void); extern void dtrace_sync(void); extern void dtrace_toxic_ranges(void (*)(uintptr_t, uintptr_t)); extern void dtrace_xcall(processorid_t, dtrace_xcall_t, void *); #if defined(__i386__) || defined(__x86_64__) extern int dtrace_instr_size(uchar_t *instr); extern int dtrace_instr_size_isa(uchar_t *, model_t, int *); extern void dtrace_invop_add(int (*)(uintptr_t, uintptr_t *, uintptr_t)); extern void dtrace_invop_remove(int (*)(uintptr_t, uintptr_t *, uintptr_t)); extern void *dtrace_invop_callsite_pre; extern void *dtrace_invop_callsite_post; #endif #if defined(__arm__) extern int dtrace_instr_size(uint32_t instr, int thumb_mode); #endif #if defined(__arm__) || defined(__arm64__) extern void dtrace_invop_add(int (*)(uintptr_t, uintptr_t *, uintptr_t)); extern void dtrace_invop_remove(int (*)(uintptr_t, uintptr_t *, uintptr_t)); extern void *dtrace_invop_callsite_pre; extern void *dtrace_invop_callsite_post; #endif #undef proc_t #define DTRACE_CPUFLAG_ISSET(flag) \ (cpu_core[CPU->cpu_id].cpuc_dtrace_flags & (flag)) #define DTRACE_CPUFLAG_SET(flag) \ (cpu_core[CPU->cpu_id].cpuc_dtrace_flags |= (flag)) #define DTRACE_CPUFLAG_CLEAR(flag) \ (cpu_core[CPU->cpu_id].cpuc_dtrace_flags &= ~(flag)) #endif /* _KERNEL */ #endif /* _ASM */ #if defined(__i386__) || defined(__x86_64__) #define DTRACE_INVOP_PUSHL_EBP 1 #define DTRACE_INVOP_POPL_EBP 2 #define DTRACE_INVOP_LEAVE 3 #define DTRACE_INVOP_NOP 4 #define DTRACE_INVOP_RET 5 #endif #if defined(__arm__) || defined(__arm64__) #define DTRACE_INVOP_NOP 4 #define DTRACE_INVOP_RET 5 #define DTRACE_INVOP_B 6 #endif #ifdef __cplusplus } #endif #endif /* _SYS_DTRACE_H */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/dtrace_glue.h ================================================ /* * Copyright (c) 2005-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 _DTRACE_GLUE_H #define _DTRACE_GLUE_H #ifdef KERNEL_BUILD #include #include #include #include #include #include #include #include #include #include #include #include #if defined(__i386__) || defined(__x86_64__) #include #endif /* * cmn_err */ #define CE_NOTE 1 /* notice */ #define CE_WARN 2 /* warning */ extern void cmn_err( int, const char *, ... ); /* * pid/proc */ /* Solaris proc_t is the struct. Darwin's proc_t is a pointer to it. */ #define proc_t struct proc /* Steer clear of the Darwin typedef for proc_t */ #define curproc ((struct proc *)current_proc()) /* Called from probe context, must blacklist */ proc_t* sprlock(pid_t pid); void sprunlock(proc_t *p); void dtrace_sprlock(proc_t *p); void dtrace_sprunlock(proc_t *p); /* * uread/uwrite */ int uread(proc_t *p, void *buf, user_size_t len, user_addr_t a); int uwrite(proc_t *p, void *buf, user_size_t len, user_addr_t a); /* * fuword / suword */ int fuword8(user_addr_t, uint8_t *); int fuword16(user_addr_t, uint16_t *); int fuword32(user_addr_t, uint32_t *); int fuword64(user_addr_t, uint64_t *); void fuword32_noerr(user_addr_t, uint32_t *); void fuword64_noerr(user_addr_t, uint64_t *); int suword64(user_addr_t, uint64_t value); int suword32(user_addr_t, uint32_t value); /* * cpuvar */ extern lck_mtx_t cpu_lock; extern lck_mtx_t cyc_lock; extern lck_mtx_t mod_lock; /* * wrap_timer_call: wrapper of timer_call for cyclic timers. */ struct wrap_timer_call; /* * Per-CPU data. */ typedef struct dtrace_cpu { processorid_t cpu_id; /* CPU number */ struct dtrace_cpu *cpu_next; /* next existing CPU */ lck_rw_t cpu_ft_lock; /* DTrace: fasttrap lock */ uintptr_t cpu_dtrace_caller; /* DTrace: caller, if any */ hrtime_t cpu_dtrace_chillmark; /* DTrace: chill mark time */ hrtime_t cpu_dtrace_chilled; /* DTrace: total chill time */ boolean_t cpu_dtrace_invop_underway; /* DTrace gaurds against invalid op re-entrancy */ /* Local cyclic timers on this CPU */ LIST_HEAD(cyc_list_head, wrap_timer_call) cpu_cyc_list; } dtrace_cpu_t; extern dtrace_cpu_t *cpu_list; /* * The cpu_core structure consists of per-CPU state available in any context. * On some architectures, this may mean that the page(s) containing the * NCPU-sized array of cpu_core structures must be locked in the TLB -- it * is up to the platform to assure that this is performed properly. Note that * the structure is sized to avoid false sharing. */ #define CPU_CACHE_COHERENCE_SIZE 64 typedef struct cpu_core { uint64_t cpuc_dtrace_illval; /* DTrace illegal value */ lck_mtx_t cpuc_pid_lock; /* DTrace pid provider lock */ uint16_t cpuc_dtrace_flags; /* DTrace flags */ uint64_t cpuc_missing_tos; /* Addr. of top most stack frame if missing */ uint8_t cpuc_pad[CPU_CACHE_COHERENCE_SIZE - sizeof(uint64_t) - sizeof(lck_mtx_t) - sizeof(uint16_t) - sizeof(uint64_t)]; /* padding */ } cpu_core_t; extern cpu_core_t *cpu_core; extern unsigned int dtrace_max_cpus; /* max number of enabled cpus */ #define NCPU dtrace_max_cpus #define CPU (&(cpu_list[cpu_number()])) /* Pointer to current CPU */ #define CPU_ON_INTR(cpup) ml_at_interrupt_context() /* always invoked on current cpu */ /* * Routines used to register interest in cpu's being added to or removed * from the system. */ typedef enum { CPU_INIT, CPU_CONFIG, CPU_UNCONFIG, CPU_ON, CPU_OFF, CPU_CPUPART_IN, CPU_CPUPART_OUT } cpu_setup_t; typedef int cpu_setup_func_t(cpu_setup_t, int, void *); extern void register_cpu_setup_func(cpu_setup_func_t *, void *); extern void unregister_cpu_setup_func(cpu_setup_func_t *, void *); /* * CPU_DTRACE */ /* * DTrace flags. */ #define CPU_DTRACE_NOFAULT 0x0001 /* Don't fault */ #define CPU_DTRACE_DROP 0x0002 /* Drop this ECB */ #define CPU_DTRACE_BADADDR 0x0004 /* DTrace fault: bad address */ #define CPU_DTRACE_BADALIGN 0x0008 /* DTrace fault: bad alignment */ #define CPU_DTRACE_DIVZERO 0x0010 /* DTrace fault: divide by zero */ #define CPU_DTRACE_ILLOP 0x0020 /* DTrace fault: illegal operation */ #define CPU_DTRACE_NOSCRATCH 0x0040 /* DTrace fault: out of scratch */ #define CPU_DTRACE_KPRIV 0x0080 /* DTrace fault: bad kernel access */ #define CPU_DTRACE_UPRIV 0x0100 /* DTrace fault: bad user access */ #define CPU_DTRACE_TUPOFLOW 0x0200 /* DTrace fault: tuple stack overflow */ #define CPU_DTRACE_USTACK_FP 0x0400 /* pid provider hint to ustack() */ #define CPU_DTRACE_ENTRY 0x0800 /* pid provider hint to ustack() */ #define CPU_DTRACE_BADSTACK 0x1000 /* DTrace fault: bad stack */ #define CPU_DTRACE_FAULT (CPU_DTRACE_BADADDR | CPU_DTRACE_BADALIGN | \ CPU_DTRACE_DIVZERO | CPU_DTRACE_ILLOP | \ CPU_DTRACE_NOSCRATCH | CPU_DTRACE_KPRIV | \ CPU_DTRACE_UPRIV | CPU_DTRACE_TUPOFLOW | \ CPU_DTRACE_BADSTACK) #define CPU_DTRACE_ERROR (CPU_DTRACE_FAULT | CPU_DTRACE_DROP) /* * Loadable Modules */ /* Keep the compiler happy */ struct dtrace_module_symbols; /* Solaris' modctl structure, greatly simplified, shadowing parts of xnu kmod structure. */ typedef struct modctl { struct modctl *mod_next; struct modctl *mod_stale; // stale module chain uint32_t mod_id; // the kext unique identifier char mod_modname[KMOD_MAX_NAME]; int mod_loadcnt; char mod_loaded; uint16_t mod_flags; // See flags below int mod_nenabled; // # of enabled DTrace probes in module vm_address_t mod_address; // starting address (of Mach-o header blob) vm_size_t mod_size; // total size (of blob) UUID mod_uuid; struct dtrace_module_symbols* mod_user_symbols; /* * SDT probe data are directly stored in modctl. That's fine for XNU as modctl serves * different purpose than on Solaris and is allocated/freed as required. */ int mod_sdtprobecnt; // Amount of provided SDT probes void *mod_sdtdesc; // Pointer to sdt_probedesc_t } modctl_t; /* Definitions for mod_flags */ #define MODCTL_IS_MACH_KERNEL 0x01 // This module represents /mach_kernel #define MODCTL_HAS_KERNEL_SYMBOLS 0x02 // Kernel symbols (nlist) are available #define MODCTL_FBT_PROBES_PROVIDED 0x04 // fbt probes have been provided #define MODCTL_FBT_INVALID 0x08 // Module is invalid for fbt probes #define MODCTL_SDT_PROBES_PROVIDED 0x10 // sdt probes have been provided #define MODCTL_SDT_INVALID 0x20 // Module is invalid for sdt probes #define MODCTL_HAS_UUID 0x40 // Module has UUID #define MODCTL_FBT_PROVIDE_BLACKLISTED_PROBES 0x200 // fbt provider must provide blacklisted probes #define MODCTL_FBT_BLACKLISTED_PROBES_PROVIDED 0x400 // fbt blacklisted probes have been provided #define MODCTL_IS_STATIC_KEXT 0x800 // module is a static kext /* Simple/singular mod_flags accessors */ #define MOD_IS_MACH_KERNEL(mod) (mod->mod_flags & MODCTL_IS_MACH_KERNEL) #define MOD_HAS_KERNEL_SYMBOLS(mod) (mod->mod_flags & MODCTL_HAS_KERNEL_SYMBOLS) #define MOD_HAS_USERSPACE_SYMBOLS(mod) (mod->mod_user_symbols) /* No point in duplicating state in the flags bits */ #define MOD_FBT_PROBES_PROVIDED(mod) (mod->mod_flags & MODCTL_FBT_PROBES_PROVIDED) #define MOD_FBT_INVALID(mod) (mod->mod_flags & MODCTL_FBT_INVALID) #define MOD_SDT_PROBES_PROVIDED(mod) (mod->mod_flags & MODCTL_SDT_PROBES_PROVIDED) #define MOD_SDT_INVALID(mod) (mod->mod_flags & MODCTL_SDT_INVALID) #define MOD_HAS_UUID(mod) (mod->mod_flags & MODCTL_HAS_UUID) #define MOD_FBT_BLACKLISTED_PROBES_PROVIDED(mod) (mod->mod_flags & MODCTL_FBT_BLACKLISTED_PROBES_PROVIDED) #define MOD_FBT_PROVIDE_BLACKLISTED_PROBES(mod) (mod->mod_flags & MODCTL_FBT_PROVIDE_BLACKLISTED_PROBES) #define MOD_IS_STATIC_KEXT(mod) (mod->mod_flags & MODCTL_IS_STATIC_KEXT) /* Compound accessors */ #define MOD_FBT_BLACKLISTED_PROBES_DONE(mod) (MOD_FBT_BLACKLISTED_PROBES_PROVIDED(mod) || !MOD_FBT_PROVIDE_BLACKLISTED_PROBES(mod)) #define MOD_FBT_DONE(mod) ((MOD_FBT_PROBES_PROVIDED(mod) && MOD_FBT_BLACKLISTED_PROBES_DONE(mod)) || MOD_FBT_INVALID(mod)) #define MOD_SDT_DONE(mod) (MOD_SDT_PROBES_PROVIDED(mod) || MOD_SDT_INVALID(mod)) #define MOD_SYMBOLS_DONE(mod) (MOD_FBT_DONE(mod) && MOD_SDT_DONE(mod)) extern modctl_t *dtrace_modctl_list; extern int dtrace_addr_in_module(void*, struct modctl*); /* * cred_t */ /* Privileges */ #define PRIV_DTRACE_KERNEL 3 #define PRIV_DTRACE_PROC 4 #define PRIV_DTRACE_USER 5 #define PRIV_PROC_OWNER 30 #define PRIV_PROC_ZONE 35 #define PRIV_ALL (-1) /* All privileges required */ /* Privilege sets */ #define PRIV_EFFECTIVE 0 typedef struct ucred cred_t; #define cr_suid cr_svuid #define cr_sgid cr_svgid extern cred_t *dtrace_CRED(void); /* Safe to call from probe context. */ #define CRED() kauth_cred_get() /* Can't be called from probe context! */ extern int PRIV_POLICY_CHOICE(void *, int, int); extern int PRIV_POLICY_ONLY(void *, int, int); extern uid_t crgetuid(const cred_t *); #define crgetzoneid(x) ((zoneid_t)0) /* * "cyclic" */ #define CY_LOW_LEVEL 0 #define CY_HIGH_LEVEL 2 #define CY_LEVELS 3 typedef uintptr_t cyclic_id_t; typedef cyclic_id_t *cyclic_id_list_t; typedef uint16_t cyc_level_t; typedef void (*cyc_func_t)(void *); #define CYCLIC_NONE ((cyclic_id_t)0) typedef struct cyc_time { hrtime_t cyt_when; hrtime_t cyt_interval; } cyc_time_t; typedef struct cyc_handler { cyc_func_t cyh_func; void *cyh_arg; cyc_level_t cyh_level; } cyc_handler_t; typedef struct cyc_omni_handler { void (*cyo_online)(void *, dtrace_cpu_t *, cyc_handler_t *, cyc_time_t *); void (*cyo_offline)(void *, dtrace_cpu_t *, void *); void *cyo_arg; } cyc_omni_handler_t; extern void dtrace_install_cpu_hooks(void); extern cyclic_id_t cyclic_add(cyc_handler_t *, cyc_time_t *); extern void cyclic_remove(cyclic_id_t); extern cyclic_id_list_t cyclic_add_omni(cyc_omni_handler_t *); extern void cyclic_remove_omni(cyclic_id_list_t); extern cyclic_id_t cyclic_timer_add(cyc_handler_t *, cyc_time_t *); extern void cyclic_timer_remove(cyclic_id_t); /* * ddi */ #define DDI_SUCCESS 0 #define DDI_FAILURE -1 #define DDI_PSEUDO "ddi_pseudo" typedef enum { DDI_DETACH = 0, DDI_SUSPEND = 1, DDI_PM_SUSPEND = 2, DDI_HOTPLUG_DETACH = 3 /* detach, don't try to auto-unconfig */ } ddi_detach_cmd_t; #define DDI_PROP_SUCCESS 0 #define DDI_PROP_DONTPASS 1 typedef uint_t major_t; typedef uint_t minor_t; typedef struct __dev_info *dev_info_t; extern int ddi_driver_major(dev_info_t *); extern int ddi_create_minor_node(dev_info_t *, const char *, int, minor_t, const char *, int); extern void ddi_remove_minor_node(dev_info_t *, char *); extern major_t getemajor(dev_t); extern minor_t getminor(dev_t); /* * Kernel Debug Interface */ extern void debug_enter(char *); /* * DTrace specific zone allocation */ /* * kmem */ #define KM_SLEEP 0x00000000 #define KM_NOSLEEP 0x00000001 typedef struct vmem vmem_t; typedef struct kmem_cache kmem_cache_t; #define kmem_free dt_kmem_free /* Avoid clash with Darwin's kmem_free */ #define kmem_free_aligned dt_kmem_free_aligned #define kmem_alloc(size, kmflag) \ ({ VM_ALLOC_SITE_STATIC(0, 0); \ dt_kmem_alloc_site(size, kmflag, &site); }) extern void *dt_kmem_alloc_site(size_t, int, vm_allocation_site_t*); extern void dt_kmem_free(void *, size_t); #define kmem_zalloc(size, kmflag) \ ({ VM_ALLOC_SITE_STATIC(0, 0); \ dt_kmem_zalloc_site(size, kmflag, &site); }) extern void *dt_kmem_zalloc_site(size_t, int, vm_allocation_site_t*); #define kmem_alloc_aligned(size, align, kmflag) \ ({ VM_ALLOC_SITE_STATIC(0, 0); \ dt_kmem_alloc_aligned_site(size, align, kmflag, &site); }) extern void *dt_kmem_alloc_aligned_site(size_t, size_t, int, vm_allocation_site_t*); #define kmem_zalloc_aligned(size, align, kmflag) \ ({ VM_ALLOC_SITE_STATIC(0, 0); \ dt_kmem_zalloc_aligned_site(size, align, kmflag, &site); }) extern void *dt_kmem_zalloc_aligned_site(size_t, size_t, int, vm_allocation_site_t*); extern void dt_kmem_free_aligned(void*, size_t); extern kmem_cache_t * kmem_cache_create(const char *, size_t, size_t, int (*)(void *, void *, int), void (*)(void *, void *), void (*)(void *), void *, vmem_t *, int); extern void *kmem_cache_alloc(kmem_cache_t *, int); extern void kmem_cache_free(kmem_cache_t *, void *); extern void kmem_cache_destroy(kmem_cache_t *); /* * kthread */ typedef struct _kthread kthread_t; /* For dtrace_vtime_switch(), dtrace_panicked and dtrace_errthread */ /* * proc */ #define DATAMODEL_ILP32 0x00100000 #define DATAMODEL_LP64 0x00200000 #define DATAMODEL_NONE 0 #if defined(__LP64__) #define DATAMODEL_NATIVE DATAMODEL_LP64 #else #define DATAMODEL_NATIVE DATAMODEL_ILP32 #endif /* __LP64__ */ typedef unsigned int model_t; /* For dtrace_instr_size_isa() prototype in */ /* * vmem */ #define VMC_IDENTIFIER 0x00040000 /* not backed by memory */ #define VM_SLEEP 0x00000000 /* same as KM_SLEEP */ #define VM_BESTFIT 0x00000100 extern void *vmem_alloc(vmem_t *, size_t, int); extern vmem_t *vmem_create(const char *, void *, size_t, size_t, void *, void *, vmem_t *, size_t, int); extern void vmem_destroy(vmem_t *); extern void vmem_free(vmem_t *vmp, void *vaddr, size_t size); /* * Miscellaneous */ typedef uintptr_t pc_t; typedef uintptr_t greg_t; /* For dtrace_impl.h prototype of dtrace_getfp() */ #if defined(__arm__) || defined(__arm64__) #define regs arm_saved_state #endif extern struct regs *find_user_regs( thread_t thread); extern vm_offset_t dtrace_get_cpu_int_stack_top(void); #define panic_quiesce (panic_active()) #define IS_P2ALIGNED(v, a) ((((uintptr_t)(v)) & ((uintptr_t)(a) - 1)) == 0) extern int vuprintf(const char *, va_list); extern hrtime_t dtrace_abs_to_nano(uint64_t); const void* bsearch(const void*, const void*, size_t, size_t, int (*compar)(const void *, const void *)); int dtrace_copy_maxsize(void); int dtrace_buffer_copyout(const void*, user_addr_t, vm_size_t); #define DTRACE_NCLIENTS 32 #undef proc_t /* * Safe counted string compare against a literal string. The sizeof() intentionally * counts the trailing NUL, and so ensures that all the characters in the literal * can participate in the comparison. */ #define LIT_STRNEQL(s1, lit_s2) (0 == strncmp( (s1), (lit_s2), sizeof((lit_s2)) )) #define KERNELBASE VM_MIN_KERNEL_ADDRESS #endif /* KERNEL_BUILD */ #endif /* _DTRACE_GLUE_H */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/dtrace_impl.h ================================================ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. * See the License for the specific language governing permissions * and limitations under the License. * * When distributing Covered Code, include this CDDL HEADER in each * file and include the License file at usr/src/OPENSOLARIS.LICENSE. * If applicable, add the following below this CDDL HEADER, with the * fields enclosed by brackets "[]" replaced with your own identifying * information: Portions Copyright [yyyy] [name of copyright owner] * * CDDL HEADER END */ /* * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * * Portions Copyright (c) 2012 by Delphix. All rights reserved. * Portions Copyright (c) 2016 by Joyent, Inc. */ #ifndef _SYS_DTRACE_IMPL_H #define _SYS_DTRACE_IMPL_H #ifdef __cplusplus extern "C" { #endif /* * DTrace Dynamic Tracing Software: Kernel Implementation Interfaces * * Note: The contents of this file are private to the implementation of the * Solaris system and DTrace subsystem and are subject to change at any time * without notice. Applications and drivers using these interfaces will fail * to run on future releases. These interfaces should not be used for any * purpose except those expressly outlined in dtrace(7D) and libdtrace(3LIB). * Please refer to the "Solaris Dynamic Tracing Guide" for more information. */ #include /* * DTrace Implementation Locks */ extern lck_attr_t dtrace_lck_attr; extern lck_grp_t dtrace_lck_grp; extern lck_mtx_t dtrace_procwaitfor_lock; /* * DTrace Implementation Constants and Typedefs */ #define DTRACE_MAXPROPLEN 128 #define DTRACE_DYNVAR_CHUNKSIZE 256 struct dtrace_probe; struct dtrace_ecb; struct dtrace_predicate; struct dtrace_action; struct dtrace_provider; struct dtrace_state; typedef struct dtrace_probe dtrace_probe_t; typedef struct dtrace_ecb dtrace_ecb_t; typedef struct dtrace_predicate dtrace_predicate_t; typedef struct dtrace_action dtrace_action_t; typedef struct dtrace_provider dtrace_provider_t; typedef struct dtrace_meta dtrace_meta_t; typedef struct dtrace_state dtrace_state_t; typedef uint32_t dtrace_optid_t; typedef uint32_t dtrace_specid_t; typedef uint64_t dtrace_genid_t; /* * DTrace Probes * * The probe is the fundamental unit of the DTrace architecture. Probes are * created by DTrace providers, and managed by the DTrace framework. A probe * is identified by a unique tuple, and has * a unique probe identifier assigned to it. (Some probes are not associated * with a specific point in text; these are called _unanchored probes_ and have * no module or function associated with them.) Probes are represented as a * dtrace_probe structure. To allow quick lookups based on each element of the * probe tuple, probes are hashed by each of provider, module, function and * name. (If a lookup is performed based on a regular expression, a * dtrace_probekey is prepared, and a linear search is performed.) Each probe * is additionally pointed to by a linear array indexed by its identifier. The * identifier is the provider's mechanism for indicating to the DTrace * framework that a probe has fired: the identifier is passed as the first * argument to dtrace_probe(), where it is then mapped into the corresponding * dtrace_probe structure. From the dtrace_probe structure, dtrace_probe() can * iterate over the probe's list of enabling control blocks; see "DTrace * Enabling Control Blocks", below.) */ struct dtrace_probe { dtrace_id_t dtpr_id; /* probe identifier */ dtrace_ecb_t *dtpr_ecb; /* ECB list; see below */ dtrace_ecb_t *dtpr_ecb_last; /* last ECB in list */ void *dtpr_arg; /* provider argument */ dtrace_cacheid_t dtpr_predcache; /* predicate cache ID */ int dtpr_aframes; /* artificial frames */ dtrace_provider_t *dtpr_provider; /* pointer to provider */ char *dtpr_mod; /* probe's module name */ char *dtpr_func; /* probe's function name */ char *dtpr_name; /* probe's name */ dtrace_probe_t *dtpr_nextprov; /* next in provider hash */ dtrace_probe_t *dtpr_prevprov; /* previous in provider hash */ dtrace_probe_t *dtpr_nextmod; /* next in module hash */ dtrace_probe_t *dtpr_prevmod; /* previous in module hash */ dtrace_probe_t *dtpr_nextfunc; /* next in function hash */ dtrace_probe_t *dtpr_prevfunc; /* previous in function hash */ dtrace_probe_t *dtpr_nextname; /* next in name hash */ dtrace_probe_t *dtpr_prevname; /* previous in name hash */ dtrace_genid_t dtpr_gen; /* probe generation ID */ }; typedef int dtrace_probekey_f(const char *, const char *, int); typedef struct dtrace_probekey { const char *dtpk_prov; /* provider name to match */ dtrace_probekey_f *dtpk_pmatch; /* provider matching function */ const char *dtpk_mod; /* module name to match */ dtrace_probekey_f *dtpk_mmatch; /* module matching function */ const char *dtpk_func; /* func name to match */ dtrace_probekey_f *dtpk_fmatch; /* func matching function */ const char *dtpk_name; /* name to match */ dtrace_probekey_f *dtpk_nmatch; /* name matching function */ dtrace_id_t dtpk_id; /* identifier to match */ } dtrace_probekey_t; typedef struct dtrace_hashbucket { struct dtrace_hashbucket *dthb_next; /* next on hash chain */ void *dthb_chain; /* chain of elements */ int dthb_len; /* number of probes here */ } dtrace_hashbucket_t; typedef const char* dtrace_strkey_f(void*, uintptr_t); typedef struct dtrace_hash { dtrace_hashbucket_t **dth_tab; /* hash table */ int dth_size; /* size of hash table */ int dth_mask; /* mask to index into table */ int dth_nbuckets; /* total number of buckets */ uintptr_t dth_nextoffs; /* offset of next in element */ uintptr_t dth_prevoffs; /* offset of prev in element */ dtrace_strkey_f *dth_getstr; /* func to retrieve str in element */ uintptr_t dth_stroffs; /* offset of str in element */ } dtrace_hash_t; /* * DTrace Enabling Control Blocks * * When a provider wishes to fire a probe, it calls into dtrace_probe(), * passing the probe identifier as the first argument. As described above, * dtrace_probe() maps the identifier into a pointer to a dtrace_probe_t * structure. This structure contains information about the probe, and a * pointer to the list of Enabling Control Blocks (ECBs). Each ECB points to * DTrace consumer state, and contains an optional predicate, and a list of * actions. (Shown schematically below.) The ECB abstraction allows a single * probe to be multiplexed across disjoint consumers, or across disjoint * enablings of a single probe within one consumer. * * Enabling Control Block * dtrace_ecb_t * +------------------------+ * | dtrace_epid_t ---------+--------------> Enabled Probe ID (EPID) * | dtrace_state_t * ------+--------------> State associated with this ECB * | dtrace_predicate_t * --+---------+ * | dtrace_action_t * -----+----+ | * | dtrace_ecb_t * ---+ | | | Predicate (if any) * +-------------------+----+ | | dtrace_predicate_t * | | +---> +--------------------+ * | | | dtrace_difo_t * ---+----> DIFO * | | +--------------------+ * | | * Next ECB | | Action * (if any) | | dtrace_action_t * : +--> +-------------------+ * : | dtrace_actkind_t -+------> kind * v | dtrace_difo_t * --+------> DIFO (if any) * | dtrace_recdesc_t -+------> record descr. * | dtrace_action_t * +------+ * +-------------------+ | * | Next action * +-------------------------------+ (if any) * | * | Action * | dtrace_action_t * +--> +-------------------+ * | dtrace_actkind_t -+------> kind * | dtrace_difo_t * --+------> DIFO (if any) * | dtrace_action_t * +------+ * +-------------------+ | * | Next action * +-------------------------------+ (if any) * | * : * v * * * dtrace_probe() iterates over the ECB list. If the ECB needs less space * than is available in the principal buffer, the ECB is processed: if the * predicate is non-NULL, the DIF object is executed. If the result is * non-zero, the action list is processed, with each action being executed * accordingly. When the action list has been completely executed, processing * advances to the next ECB. The ECB abstraction allows disjoint consumers * to multiplex on single probes. * * Execution of the ECB results in consuming dte_size bytes in the buffer * to record data. During execution, dte_needed bytes must be available in * the buffer. This space is used for both recorded data and tuple data. */ struct dtrace_ecb { dtrace_epid_t dte_epid; /* enabled probe ID */ uint32_t dte_alignment; /* required alignment */ size_t dte_needed; /* space needed for execution */ size_t dte_size; /* size of recorded payload */ dtrace_predicate_t *dte_predicate; /* predicate, if any */ dtrace_action_t *dte_action; /* actions, if any */ dtrace_ecb_t *dte_next; /* next ECB on probe */ dtrace_state_t *dte_state; /* pointer to state */ uint32_t dte_cond; /* security condition */ dtrace_probe_t *dte_probe; /* pointer to probe */ dtrace_action_t *dte_action_last; /* last action on ECB */ uint64_t dte_uarg; /* library argument */ }; struct dtrace_predicate { dtrace_difo_t *dtp_difo; /* DIF object */ dtrace_cacheid_t dtp_cacheid; /* cache identifier */ int dtp_refcnt; /* reference count */ }; struct dtrace_action { dtrace_actkind_t dta_kind; /* kind of action */ uint16_t dta_intuple; /* boolean: in aggregation */ uint32_t dta_refcnt; /* reference count */ dtrace_difo_t *dta_difo; /* pointer to DIFO */ dtrace_recdesc_t dta_rec; /* record description */ dtrace_action_t *dta_prev; /* previous action */ dtrace_action_t *dta_next; /* next action */ }; typedef struct dtrace_aggregation { dtrace_action_t dtag_action; /* action; must be first */ dtrace_aggid_t dtag_id; /* identifier */ dtrace_ecb_t *dtag_ecb; /* corresponding ECB */ dtrace_action_t *dtag_first; /* first action in tuple */ uint32_t dtag_base; /* base of aggregation */ uint8_t dtag_hasarg; /* boolean: has argument */ uint64_t dtag_initial; /* initial value */ void (*dtag_aggregate)(uint64_t *, uint64_t, uint64_t); } dtrace_aggregation_t; /* * DTrace Buffers * * Principal buffers, aggregation buffers, and speculative buffers are all * managed with the dtrace_buffer structure. By default, this structure * includes twin data buffers -- dtb_tomax and dtb_xamot -- that serve as the * active and passive buffers, respectively. For speculative buffers, * dtb_xamot will be NULL; for "ring" and "fill" buffers, dtb_xamot will point * to a scratch buffer. For all buffer types, the dtrace_buffer structure is * always allocated on a per-CPU basis; a single dtrace_buffer structure is * never shared among CPUs. (That is, there is never true sharing of the * dtrace_buffer structure; to prevent false sharing of the structure, it must * always be aligned to the coherence granularity -- generally 64 bytes.) * * One of the critical design decisions of DTrace is that a given ECB always * stores the same quantity and type of data. This is done to assure that the * only metadata required for an ECB's traced data is the EPID. That is, from * the EPID, the consumer can determine the data layout. (The data buffer * layout is shown schematically below.) By assuring that one can determine * data layout from the EPID, the metadata stream can be separated from the * data stream -- simplifying the data stream enormously. The ECB always * proceeds the recorded data as part of the dtrace_rechdr_t structure that * includes the EPID and a high-resolution timestamp used for output ordering * consistency. * * base of data buffer ---> +--------+--------------------+--------+ * | rechdr | data | rechdr | * +--------+------+--------+----+--------+ * | data | rechdr | data | * +---------------+--------+-------------+ * | data, cont. | * +--------+--------------------+--------+ * | rechdr | data | | * +--------+--------------------+ | * | || | * | || | * | \/ | * : : * . . * . . * . . * : : * | | * limit of data buffer ---> +--------------------------------------+ * * When evaluating an ECB, dtrace_probe() determines if the ECB's needs of the * principal buffer (both scratch and payload) exceed the available space. If * the ECB's needs exceed available space (and if the principal buffer policy * is the default "switch" policy), the ECB is dropped, the buffer's drop count * is incremented, and processing advances to the next ECB. If the ECB's needs * can be met with the available space, the ECB is processed, but the offset in * the principal buffer is only advanced if the ECB completes processing * without error. * * When a buffer is to be switched (either because the buffer is the principal * buffer with a "switch" policy or because it is an aggregation buffer), a * cross call is issued to the CPU associated with the buffer. In the cross * call context, interrupts are disabled, and the active and the inactive * buffers are atomically switched. This involves switching the data pointers, * copying the various state fields (offset, drops, errors, etc.) into their * inactive equivalents, and clearing the state fields. Because interrupts are * disabled during this procedure, the switch is guaranteed to appear atomic to * dtrace_probe(). * * DTrace Ring Buffering * * To process a ring buffer correctly, one must know the oldest valid record. * Processing starts at the oldest record in the buffer and continues until * the end of the buffer is reached. Processing then resumes starting with * the record stored at offset 0 in the buffer, and continues until the * youngest record is processed. If trace records are of a fixed-length, * determining the oldest record is trivial: * * - If the ring buffer has not wrapped, the oldest record is the record * stored at offset 0. * * - If the ring buffer has wrapped, the oldest record is the record stored * at the current offset. * * With variable length records, however, just knowing the current offset * doesn't suffice for determining the oldest valid record: assuming that one * allows for arbitrary data, one has no way of searching forward from the * current offset to find the oldest valid record. (That is, one has no way * of separating data from metadata.) It would be possible to simply refuse to * process any data in the ring buffer between the current offset and the * limit, but this leaves (potentially) an enormous amount of otherwise valid * data unprocessed. * * To effect ring buffering, we track two offsets in the buffer: the current * offset and the _wrapped_ offset. If a request is made to reserve some * amount of data, and the buffer has wrapped, the wrapped offset is * incremented until the wrapped offset minus the current offset is greater * than or equal to the reserve request. This is done by repeatedly looking * up the ECB corresponding to the EPID at the current wrapped offset, and * incrementing the wrapped offset by the size of the data payload * corresponding to that ECB. If this offset is greater than or equal to the * limit of the data buffer, the wrapped offset is set to 0. Thus, the * current offset effectively "chases" the wrapped offset around the buffer. * Schematically: * * base of data buffer ---> +------+--------------------+------+ * | EPID | data | EPID | * +------+--------+------+----+------+ * | data | EPID | data | * +---------------+------+-----------+ * | data, cont. | * +------+---------------------------+ * | EPID | data | * current offset ---> +------+---------------------------+ * | invalid data | * wrapped offset ---> +------+--------------------+------+ * | EPID | data | EPID | * +------+--------+------+----+------+ * | data | EPID | data | * +---------------+------+-----------+ * : : * . . * . ... valid data ... . * . . * : : * +------+-------------+------+------+ * | EPID | data | EPID | data | * +------+------------++------+------+ * | data, cont. | leftover | * limit of data buffer ---> +-------------------+--------------+ * * If the amount of requested buffer space exceeds the amount of space * available between the current offset and the end of the buffer: * * (1) all words in the data buffer between the current offset and the limit * of the data buffer (marked "leftover", above) are set to * DTRACE_EPIDNONE * * (2) the wrapped offset is set to zero * * (3) the iteration process described above occurs until the wrapped offset * is greater than the amount of desired space. * * The wrapped offset is implemented by (re-)using the inactive offset. * In a "switch" buffer policy, the inactive offset stores the offset in * the inactive buffer; in a "ring" buffer policy, it stores the wrapped * offset. * * DTrace Scratch Buffering * * Some ECBs may wish to allocate dynamically-sized temporary scratch memory. * To accommodate such requests easily, scratch memory may be allocated in * the buffer beyond the current offset plus the needed memory of the current * ECB. If there isn't sufficient room in the buffer for the requested amount * of scratch space, the allocation fails and an error is generated. Scratch * memory is tracked in the dtrace_mstate_t and is automatically freed when * the ECB ceases processing. Note that ring buffers cannot allocate their * scratch from the principal buffer -- lest they needlessly overwrite older, * valid data. Ring buffers therefore have their own dedicated scratch buffer * from which scratch is allocated. */ #define DTRACEBUF_RING 0x0001 /* bufpolicy set to "ring" */ #define DTRACEBUF_FILL 0x0002 /* bufpolicy set to "fill" */ #define DTRACEBUF_NOSWITCH 0x0004 /* do not switch buffer */ #define DTRACEBUF_WRAPPED 0x0008 /* ring buffer has wrapped */ #define DTRACEBUF_DROPPED 0x0010 /* drops occurred */ #define DTRACEBUF_ERROR 0x0020 /* errors occurred */ #define DTRACEBUF_FULL 0x0040 /* "fill" buffer is full */ #define DTRACEBUF_CONSUMED 0x0080 /* buffer has been consumed */ #define DTRACEBUF_INACTIVE 0x0100 /* buffer is not yet active */ typedef struct dtrace_buffer { uint64_t dtb_offset; /* current offset in buffer */ uint64_t dtb_cur_limit; /* current limit before signaling/dropping */ uint64_t dtb_limit; /* limit before signaling */ uint64_t dtb_size; /* size of buffer */ uint32_t dtb_flags; /* flags */ uint32_t dtb_drops; /* number of drops */ caddr_t dtb_tomax; /* active buffer */ caddr_t dtb_xamot; /* inactive buffer */ uint32_t dtb_xamot_flags; /* inactive flags */ uint32_t dtb_xamot_drops; /* drops in inactive buffer */ uint64_t dtb_xamot_offset; /* offset in inactive buffer */ uint32_t dtb_errors; /* number of errors */ uint32_t dtb_xamot_errors; /* errors in inactive buffer */ #ifndef _LP64 uint64_t dtb_pad1; #endif uint64_t dtb_switched; /* time of last switch */ uint64_t dtb_interval; /* observed switch interval */ uint64_t dtb_pad2[4]; /* pad to avoid false sharing */ } dtrace_buffer_t; /* * DTrace Aggregation Buffers * * Aggregation buffers use much of the same mechanism as described above * ("DTrace Buffers"). However, because an aggregation is fundamentally a * hash, there exists dynamic metadata associated with an aggregation buffer * that is not associated with other kinds of buffers. This aggregation * metadata is _only_ relevant for the in-kernel implementation of * aggregations; it is not actually relevant to user-level consumers. To do * this, we allocate dynamic aggregation data (hash keys and hash buckets) * starting below the _limit_ of the buffer, and we allocate data from the * _base_ of the buffer. When the aggregation buffer is copied out, _only_ the * data is copied out; the metadata is simply discarded. Schematically, * aggregation buffers look like: * * base of data buffer ---> +-------+------+-----------+-------+ * | aggid | key | value | aggid | * +-------+------+-----------+-------+ * | key | * +-------+-------+-----+------------+ * | value | aggid | key | value | * +-------+------++-----+------+-----+ * | aggid | key | value | | * +-------+------+-------------+ | * | || | * | || | * | \/ | * : : * . . * . . * . . * : : * | /\ | * | || +------------+ * | || | | * +---------------------+ | * | hash keys | * | (dtrace_aggkey structures) | * | | * +----------------------------------+ * | hash buckets | * | (dtrace_aggbuffer structure) | * | | * limit of data buffer ---> +----------------------------------+ * * * As implied above, just as we assure that ECBs always store a constant * amount of data, we assure that a given aggregation -- identified by its * aggregation ID -- always stores data of a constant quantity and type. * As with EPIDs, this allows the aggregation ID to serve as the metadata for a * given record. * * Note that the size of the dtrace_aggkey structure must be sizeof (uintptr_t) * aligned. (If this the structure changes such that this becomes false, an * assertion will fail in dtrace_aggregate().) */ typedef struct dtrace_aggkey { uint32_t dtak_hashval; /* hash value */ uint32_t dtak_action:4; /* action -- 4 bits */ uint32_t dtak_size:28; /* size -- 28 bits */ caddr_t dtak_data; /* data pointer */ struct dtrace_aggkey *dtak_next; /* next in hash chain */ } dtrace_aggkey_t; typedef struct dtrace_aggbuffer { uintptr_t dtagb_hashsize; /* number of buckets */ uintptr_t dtagb_free; /* free list of keys */ dtrace_aggkey_t **dtagb_hash; /* hash table */ } dtrace_aggbuffer_t; /* * DTrace Speculations * * Speculations have a per-CPU buffer and a global state. Once a speculation * buffer has been comitted or discarded, it cannot be reused until all CPUs * have taken the same action (commit or discard) on their respective * speculative buffer. However, because DTrace probes may execute in arbitrary * context, other CPUs cannot simply be cross-called at probe firing time to * perform the necessary commit or discard. The speculation states thus * optimize for the case that a speculative buffer is only active on one CPU at * the time of a commit() or discard() -- for if this is the case, other CPUs * need not take action, and the speculation is immediately available for * reuse. If the speculation is active on multiple CPUs, it must be * asynchronously cleaned -- potentially leading to a higher rate of dirty * speculative drops. The speculation states are as follows: * * DTRACESPEC_INACTIVE <= Initial state; inactive speculation * DTRACESPEC_ACTIVE <= Allocated, but not yet speculatively traced to * DTRACESPEC_ACTIVEONE <= Speculatively traced to on one CPU * DTRACESPEC_ACTIVEMANY <= Speculatively traced to on more than one CPU * DTRACESPEC_COMMITTING <= Currently being commited on one CPU * DTRACESPEC_COMMITTINGMANY <= Currently being commited on many CPUs * DTRACESPEC_DISCARDING <= Currently being discarded on many CPUs * * The state transition diagram is as follows: * * +----------------------------------------------------------+ * | | * | +------------+ | * | +-------------------| COMMITTING |<-----------------+ | * | | +------------+ | | * | | copied spec. ^ commit() on | | discard() on * | | into principal | active CPU | | active CPU * | | | commit() | | * V V | | | * +----------+ +--------+ +-----------+ * | INACTIVE |---------------->| ACTIVE |--------------->| ACTIVEONE | * +----------+ speculation() +--------+ speculate() +-----------+ * ^ ^ | | | * | | | discard() | | * | | asynchronously | discard() on | | speculate() * | | cleaned V inactive CPU | | on inactive * | | +------------+ | | CPU * | +-------------------| DISCARDING |<-----------------+ | * | +------------+ | * | asynchronously ^ | * | copied spec. | discard() | * | into principal +------------------------+ | * | | V * +----------------+ commit() +------------+ * | COMMITTINGMANY |<----------------------------------| ACTIVEMANY | * +----------------+ +------------+ */ typedef enum dtrace_speculation_state { DTRACESPEC_INACTIVE = 0, DTRACESPEC_ACTIVE, DTRACESPEC_ACTIVEONE, DTRACESPEC_ACTIVEMANY, DTRACESPEC_COMMITTING, DTRACESPEC_COMMITTINGMANY, DTRACESPEC_DISCARDING } dtrace_speculation_state_t; typedef struct dtrace_speculation { dtrace_speculation_state_t dtsp_state; /* current speculation state */ int dtsp_cleaning; /* non-zero if being cleaned */ dtrace_buffer_t *dtsp_buffer; /* speculative buffer */ } dtrace_speculation_t; /* * DTrace Dynamic Variables * * The dynamic variable problem is obviously decomposed into two subproblems: * allocating new dynamic storage, and freeing old dynamic storage. The * presence of the second problem makes the first much more complicated -- or * rather, the absence of the second renders the first trivial. This is the * case with aggregations, for which there is effectively no deallocation of * dynamic storage. (Or more accurately, all dynamic storage is deallocated * when a snapshot is taken of the aggregation.) As DTrace dynamic variables * allow for both dynamic allocation and dynamic deallocation, the * implementation of dynamic variables is quite a bit more complicated than * that of their aggregation kin. * * We observe that allocating new dynamic storage is tricky only because the * size can vary -- the allocation problem is much easier if allocation sizes * are uniform. We further observe that in D, the size of dynamic variables is * actually _not_ dynamic -- dynamic variable sizes may be determined by static * analysis of DIF text. (This is true even of putatively dynamically-sized * objects like strings and stacks, the sizes of which are dictated by the * "stringsize" and "stackframes" variables, respectively.) We exploit this by * performing this analysis on all DIF before enabling any probes. For each * dynamic load or store, we calculate the dynamically-allocated size plus the * size of the dtrace_dynvar structure plus the storage required to key the * data. For all DIF, we take the largest value and dub it the _chunksize_. * We then divide dynamic memory into two parts: a hash table that is wide * enough to have every chunk in its own bucket, and a larger region of equal * chunksize units. Whenever we wish to dynamically allocate a variable, we * always allocate a single chunk of memory. Depending on the uniformity of * allocation, this will waste some amount of memory -- but it eliminates the * non-determinism inherent in traditional heap fragmentation. * * Dynamic objects are allocated by storing a non-zero value to them; they are * deallocated by storing a zero value to them. Dynamic variables are * complicated enormously by being shared between CPUs. In particular, * consider the following scenario: * * CPU A CPU B * +---------------------------------+ +---------------------------------+ * | | | | * | allocates dynamic object a[123] | | | * | by storing the value 345 to it | | | * | ---------> | * | | | wishing to load from object | * | | | a[123], performs lookup in | * | | | dynamic variable space | * | <--------- | * | deallocates object a[123] by | | | * | storing 0 to it | | | * | | | | * | allocates dynamic object b[567] | | performs load from a[123] | * | by storing the value 789 to it | | | * : : : : * . . . . * * This is obviously a race in the D program, but there are nonetheless only * two valid values for CPU B's load from a[123]: 345 or 0. Most importantly, * CPU B may _not_ see the value 789 for a[123]. * * There are essentially two ways to deal with this: * * (1) Explicitly spin-lock variables. That is, if CPU B wishes to load * from a[123], it needs to lock a[123] and hold the lock for the * duration that it wishes to manipulate it. * * (2) Avoid reusing freed chunks until it is known that no CPU is referring * to them. * * The implementation of (1) is rife with complexity, because it requires the * user of a dynamic variable to explicitly decree when they are done using it. * Were all variables by value, this perhaps wouldn't be debilitating -- but * dynamic variables of non-scalar types are tracked by reference. That is, if * a dynamic variable is, say, a string, and that variable is to be traced to, * say, the principal buffer, the DIF emulation code returns to the main * dtrace_probe() loop a pointer to the underlying storage, not the contents of * the storage. Further, code calling on DIF emulation would have to be aware * that the DIF emulation has returned a reference to a dynamic variable that * has been potentially locked. The variable would have to be unlocked after * the main dtrace_probe() loop is finished with the variable, and the main * dtrace_probe() loop would have to be careful to not call any further DIF * emulation while the variable is locked to avoid deadlock. More generally, * if one were to implement (1), DIF emulation code dealing with dynamic * variables could only deal with one dynamic variable at a time (lest deadlock * result). To sum, (1) exports too much subtlety to the users of dynamic * variables -- increasing maintenance burden and imposing serious constraints * on future DTrace development. * * The implementation of (2) is also complex, but the complexity is more * manageable. We need to be sure that when a variable is deallocated, it is * not placed on a traditional free list, but rather on a _dirty_ list. Once a * variable is on a dirty list, it cannot be found by CPUs performing a * subsequent lookup of the variable -- but it may still be in use by other * CPUs. To assure that all CPUs that may be seeing the old variable have * cleared out of probe context, a dtrace_sync() can be issued. Once the * dtrace_sync() has completed, it can be known that all CPUs are done * manipulating the dynamic variable -- the dirty list can be atomically * appended to the free list. Unfortunately, there's a slight hiccup in this * mechanism: dtrace_sync() may not be issued from probe context. The * dtrace_sync() must be therefore issued asynchronously from non-probe * context. For this we rely on the DTrace cleaner, a cyclic that runs at the * "cleanrate" frequency. To ease this implementation, we define several chunk * lists: * * - Dirty. Deallocated chunks, not yet cleaned. Not available. * * - Rinsing. Formerly dirty chunks that are currently being asynchronously * cleaned. Not available, but will be shortly. Dynamic variable * allocation may not spin or block for availability, however. * * - Clean. Clean chunks, ready for allocation -- but not on the free list. * * - Free. Available for allocation. * * Moreover, to avoid absurd contention, _each_ of these lists is implemented * on a per-CPU basis. This is only for performance, not correctness; chunks * may be allocated from another CPU's free list. The algorithm for allocation * then is this: * * (1) Attempt to atomically allocate from current CPU's free list. If list * is non-empty and allocation is successful, allocation is complete. * * (2) If the clean list is non-empty, atomically move it to the free list, * and reattempt (1). * * (3) If the dynamic variable space is in the CLEAN state, look for free * and clean lists on other CPUs by setting the current CPU to the next * CPU, and reattempting (1). If the next CPU is the current CPU (that * is, if all CPUs have been checked), atomically switch the state of * the dynamic variable space based on the following: * * - If no free chunks were found and no dirty chunks were found, * atomically set the state to EMPTY. * * - If dirty chunks were found, atomically set the state to DIRTY. * * - If rinsing chunks were found, atomically set the state to RINSING. * * (4) Based on state of dynamic variable space state, increment appropriate * counter to indicate dynamic drops (if in EMPTY state) vs. dynamic * dirty drops (if in DIRTY state) vs. dynamic rinsing drops (if in * RINSING state). Fail the allocation. * * The cleaning cyclic operates with the following algorithm: for all CPUs * with a non-empty dirty list, atomically move the dirty list to the rinsing * list. Perform a dtrace_sync(). For all CPUs with a non-empty rinsing list, * atomically move the rinsing list to the clean list. Perform another * dtrace_sync(). By this point, all CPUs have seen the new clean list; the * state of the dynamic variable space can be restored to CLEAN. * * There exist two final races that merit explanation. The first is a simple * allocation race: * * CPU A CPU B * +---------------------------------+ +---------------------------------+ * | | | | * | allocates dynamic object a[123] | | allocates dynamic object a[123] | * | by storing the value 345 to it | | by storing the value 567 to it | * | | | | * : : : : * . . . . * * Again, this is a race in the D program. It can be resolved by having a[123] * hold the value 345 or a[123] hold the value 567 -- but it must be true that * a[123] have only _one_ of these values. (That is, the racing CPUs may not * put the same element twice on the same hash chain.) This is resolved * simply: before the allocation is undertaken, the start of the new chunk's * hash chain is noted. Later, after the allocation is complete, the hash * chain is atomically switched to point to the new element. If this fails * (because of either concurrent allocations or an allocation concurrent with a * deletion), the newly allocated chunk is deallocated to the dirty list, and * the whole process of looking up (and potentially allocating) the dynamic * variable is reattempted. * * The final race is a simple deallocation race: * * CPU A CPU B * +---------------------------------+ +---------------------------------+ * | | | | * | deallocates dynamic object | | deallocates dynamic object | * | a[123] by storing the value 0 | | a[123] by storing the value 0 | * | to it | | to it | * | | | | * : : : : * . . . . * * Once again, this is a race in the D program, but it is one that we must * handle without corrupting the underlying data structures. Because * deallocations require the deletion of a chunk from the middle of a hash * chain, we cannot use a single-word atomic operation to remove it. For this, * we add a spin lock to the hash buckets that is _only_ used for deallocations * (allocation races are handled as above). Further, this spin lock is _only_ * held for the duration of the delete; before control is returned to the DIF * emulation code, the hash bucket is unlocked. */ typedef struct dtrace_key { uint64_t dttk_value; /* data value or data pointer */ uint64_t dttk_size; /* 0 if by-val, >0 if by-ref */ } dtrace_key_t; typedef struct dtrace_tuple { uint32_t dtt_nkeys; /* number of keys in tuple */ uint32_t dtt_pad; /* padding */ dtrace_key_t dtt_key[1]; /* array of tuple keys */ } dtrace_tuple_t; typedef struct dtrace_dynvar { uint64_t dtdv_hashval; /* hash value -- 0 if free */ struct dtrace_dynvar *dtdv_next; /* next on list or hash chain */ void *dtdv_data; /* pointer to data */ dtrace_tuple_t dtdv_tuple; /* tuple key */ } dtrace_dynvar_t; typedef enum dtrace_dynvar_op { DTRACE_DYNVAR_ALLOC, DTRACE_DYNVAR_NOALLOC, DTRACE_DYNVAR_DEALLOC } dtrace_dynvar_op_t; typedef struct dtrace_dynhash { dtrace_dynvar_t *dtdh_chain; /* hash chain for this bucket */ uintptr_t dtdh_lock; /* deallocation lock */ #ifdef _LP64 uintptr_t dtdh_pad[6]; /* pad to avoid false sharing */ #else uintptr_t dtdh_pad[14]; /* pad to avoid false sharing */ #endif } dtrace_dynhash_t; typedef struct dtrace_dstate_percpu { dtrace_dynvar_t *dtdsc_free; /* free list for this CPU */ dtrace_dynvar_t *dtdsc_dirty; /* dirty list for this CPU */ dtrace_dynvar_t *dtdsc_rinsing; /* rinsing list for this CPU */ dtrace_dynvar_t *dtdsc_clean; /* clean list for this CPU */ uint64_t dtdsc_drops; /* number of capacity drops */ uint64_t dtdsc_dirty_drops; /* number of dirty drops */ uint64_t dtdsc_rinsing_drops; /* number of rinsing drops */ #ifdef _LP64 uint64_t dtdsc_pad; /* pad to avoid false sharing */ #else uint64_t dtdsc_pad[2]; /* pad to avoid false sharing */ #endif } dtrace_dstate_percpu_t; typedef enum dtrace_dstate_state { DTRACE_DSTATE_CLEAN = 0, DTRACE_DSTATE_EMPTY, DTRACE_DSTATE_DIRTY, DTRACE_DSTATE_RINSING } dtrace_dstate_state_t; typedef struct dtrace_dstate { void *dtds_base; /* base of dynamic var. space */ size_t dtds_size; /* size of dynamic var. space */ size_t dtds_hashsize; /* number of buckets in hash */ size_t dtds_chunksize; /* size of each chunk */ dtrace_dynhash_t *dtds_hash; /* pointer to hash table */ dtrace_dstate_state_t dtds_state; /* current dynamic var. state */ dtrace_dstate_percpu_t *dtds_percpu; /* per-CPU dyn. var. state */ } dtrace_dstate_t; /* * DTrace Variable State * * The DTrace variable state tracks user-defined variables in its dtrace_vstate * structure. Each DTrace consumer has exactly one dtrace_vstate structure, * but some dtrace_vstate structures may exist without a corresponding DTrace * consumer (see "DTrace Helpers", below). As described in , * user-defined variables can have one of three scopes: * * DIFV_SCOPE_GLOBAL => global scope * DIFV_SCOPE_THREAD => thread-local scope (i.e. "self->" variables) * DIFV_SCOPE_LOCAL => clause-local scope (i.e. "this->" variables) * * The variable state tracks variables by both their scope and their allocation * type: * * - The dtvs_globals and dtvs_locals members each point to an array of * dtrace_statvar structures. These structures contain both the variable * metadata (dtrace_difv structures) and the underlying storage for all * statically allocated variables, including statically allocated * DIFV_SCOPE_GLOBAL variables and all DIFV_SCOPE_LOCAL variables. * * - The dtvs_tlocals member points to an array of dtrace_difv structures for * DIFV_SCOPE_THREAD variables. As such, this array tracks _only_ the * variable metadata for DIFV_SCOPE_THREAD variables; the underlying storage * is allocated out of the dynamic variable space. * * - The dtvs_dynvars member is the dynamic variable state associated with the * variable state. The dynamic variable state (described in "DTrace Dynamic * Variables", above) tracks all DIFV_SCOPE_THREAD variables and all * dynamically-allocated DIFV_SCOPE_GLOBAL variables. */ typedef struct dtrace_statvar { uint64_t dtsv_data; /* data or pointer to it */ size_t dtsv_size; /* size of pointed-to data */ int dtsv_refcnt; /* reference count */ dtrace_difv_t dtsv_var; /* variable metadata */ } dtrace_statvar_t; typedef struct dtrace_vstate { dtrace_state_t *dtvs_state; /* back pointer to state */ dtrace_statvar_t **dtvs_globals; /* statically-allocated glbls */ int dtvs_nglobals; /* number of globals */ dtrace_difv_t *dtvs_tlocals; /* thread-local metadata */ int dtvs_ntlocals; /* number of thread-locals */ dtrace_statvar_t **dtvs_locals; /* clause-local data */ int dtvs_nlocals; /* number of clause-locals */ dtrace_dstate_t dtvs_dynvars; /* dynamic variable state */ } dtrace_vstate_t; /* * DTrace Machine State * * In the process of processing a fired probe, DTrace needs to track and/or * cache some per-CPU state associated with that particular firing. This is * state that is always discarded after the probe firing has completed, and * much of it is not specific to any DTrace consumer, remaining valid across * all ECBs. This state is tracked in the dtrace_mstate structure. */ #define DTRACE_MSTATE_ARGS 0x00000001 #define DTRACE_MSTATE_PROBE 0x00000002 #define DTRACE_MSTATE_EPID 0x00000004 #define DTRACE_MSTATE_TIMESTAMP 0x00000008 #define DTRACE_MSTATE_STACKDEPTH 0x00000010 #define DTRACE_MSTATE_CALLER 0x00000020 #define DTRACE_MSTATE_IPL 0x00000040 #define DTRACE_MSTATE_FLTOFFS 0x00000080 #define DTRACE_MSTATE_WALLTIMESTAMP 0x00000100 #define DTRACE_MSTATE_USTACKDEPTH 0x00000200 #define DTRACE_MSTATE_UCALLER 0x00000400 #define DTRACE_MSTATE_MACHTIMESTAMP 0x00000800 #define DTRACE_MSTATE_MACHCTIMESTAMP 0x00001000 typedef struct dtrace_mstate { uintptr_t dtms_scratch_base; /* base of scratch space */ uintptr_t dtms_scratch_ptr; /* current scratch pointer */ size_t dtms_scratch_size; /* scratch size */ uint32_t dtms_present; /* variables that are present */ uint64_t dtms_arg[5]; /* cached arguments */ dtrace_epid_t dtms_epid; /* current EPID */ uint64_t dtms_timestamp; /* cached timestamp */ hrtime_t dtms_walltimestamp; /* cached wall timestamp */ uint64_t dtms_machtimestamp; /* cached mach absolute timestamp */ uint64_t dtms_machctimestamp; /* cached mach continuous timestamp */ int dtms_stackdepth; /* cached stackdepth */ int dtms_ustackdepth; /* cached ustackdepth */ struct dtrace_probe *dtms_probe; /* current probe */ uintptr_t dtms_caller; /* cached caller */ uint64_t dtms_ucaller; /* cached user-level caller */ int dtms_ipl; /* cached interrupt pri lev */ int dtms_fltoffs; /* faulting DIFO offset */ uintptr_t dtms_strtok; /* saved strtok() pointer */ uintptr_t dtms_strtok_limit; /* upper bound of strtok ptr */ uint32_t dtms_access; /* memory access rights */ dtrace_difo_t *dtms_difo; /* current dif object */ } dtrace_mstate_t; #define DTRACE_COND_OWNER 0x1 #define DTRACE_COND_USERMODE 0x2 #define DTRACE_COND_ZONEOWNER 0x4 #define DTRACE_PROBEKEY_MAXDEPTH 8 /* max glob recursion depth */ /* * Access flag used by dtrace_mstate.dtms_access. */ #define DTRACE_ACCESS_KERNEL 0x1 /* the priv to read kmem */ /* * DTrace Activity * * Each DTrace consumer is in one of several states, which (for purposes of * avoiding yet-another overloading of the noun "state") we call the current * _activity_. The activity transitions on dtrace_go() (from DTRACIOCGO), on * dtrace_stop() (from DTRACIOCSTOP) and on the exit() action. Activities may * only transition in one direction; the activity transition diagram is a * directed acyclic graph. The activity transition diagram is as follows: * * * * +----------+ +--------+ +--------+ * | INACTIVE |------------------>| WARMUP |------------------>| ACTIVE | * +----------+ dtrace_go(), +--------+ dtrace_go(), +--------+ * before BEGIN | after BEGIN | | | * | | | | * exit() action | | | | * from BEGIN ECB | | | | * | | | | * v | | | * +----------+ exit() action | | | * +-----------------------------| DRAINING |<-------------------+ | | * | +----------+ | | * | | | | * | dtrace_stop(), | | | * | before END | | | * | | | | * | v | | * | +---------+ +----------+ | | * | | STOPPED |<----------------| COOLDOWN |<----------------------+ | * | +---------+ dtrace_stop(), +----------+ dtrace_stop(), | * | after END before END | * | | * | +--------+ | * +----------------------------->| KILLED |<--------------------------+ * deadman timeout or +--------+ deadman timeout or * killed consumer killed consumer * * Note that once a DTrace consumer has stopped tracing, there is no way to * restart it; if a DTrace consumer wishes to restart tracing, it must reopen * the DTrace pseudodevice. */ typedef enum dtrace_activity { DTRACE_ACTIVITY_INACTIVE = 0, /* not yet running */ DTRACE_ACTIVITY_WARMUP, /* while starting */ DTRACE_ACTIVITY_ACTIVE, /* running */ DTRACE_ACTIVITY_DRAINING, /* before stopping */ DTRACE_ACTIVITY_COOLDOWN, /* while stopping */ DTRACE_ACTIVITY_STOPPED, /* after stopping */ DTRACE_ACTIVITY_KILLED /* killed */ } dtrace_activity_t; /* * APPLE NOTE: DTrace dof modes implementation * * DTrace has four "dof modes". They are: * * DTRACE_DOF_MODE_NEVER Never load any dof, period. * DTRACE_DOF_MODE_LAZY_ON Defer loading dof until later * DTRACE_DOF_MODE_LAZY_OFF Load all deferred dof now, and any new dof * DTRACE_DOF_MODE_NON_LAZY Load all dof immediately. * * It is legal to transition between the two lazy modes. The NEVER and * NON_LAZY modes are permanent, and must not change once set. * * The current dof mode is kept in dtrace_dof_mode, which is protected by the * dtrace_dof_mode_lock. This is a RW lock, reads require shared access, writes * require exclusive access. Because NEVER and NON_LAZY are permanent states, * it is legal to test for those modes without holding the dof mode lock. * * Lock ordering is dof mode lock before any dtrace lock, and before the * process p_dtrace_sprlock. In general, other locks should not be held when * taking the dof mode lock. Acquiring the dof mode lock in exclusive mode * will block process fork, exec, and exit, so it should be held exclusive * for as short a time as possible. */ #define DTRACE_DOF_MODE_NEVER 0 #define DTRACE_DOF_MODE_LAZY_ON 1 #define DTRACE_DOF_MODE_LAZY_OFF 2 #define DTRACE_DOF_MODE_NON_LAZY 3 /* * dtrace kernel symbol modes are used to control when the kernel may dispose of * symbol information used by the fbt/sdt provider. The kernel itself, as well as * every kext, has symbol table/nlist info that has historically been preserved * for dtrace's use. This allowed dtrace to be lazy about allocating fbt/sdt probes, * at the expense of keeping the symbol info in the kernel permanently. * * Starting in 10.7+, fbt probes may be created from userspace, in the same * fashion as pid probes. The kernel allows dtrace "first right of refusal" * whenever symbol data becomes available (such as a kext load). If dtrace is * active, it will immediately read/copy the needed data, and then the kernel * may free it. If dtrace is not active, it returns immediately, having done * no work or allocations, and the symbol data is freed. Should dtrace need * this data later, it is expected that the userspace client will push the * data into the kernel via ioctl calls. * * The kernel symbol modes are used to control what dtrace does with symbol data: * * DTRACE_KERNEL_SYMBOLS_NEVER Effectively disables fbt/sdt * DTRACE_KERNEL_SYMBOLS_FROM_KERNEL Immediately read/copy symbol data * DTRACE_KERNEL_SYMBOLS_FROM_USERSPACE Wait for symbols from userspace * DTRACE_KERNEL_SYMBOLS_ALWAYS_FROM_KERNEL Immediately read/copy symbol data * * It is legal to transition between DTRACE_KERNEL_SYMBOLS_FROM_KERNEL and * DTRACE_KERNEL_SYMBOLS_FROM_USERSPACE. The DTRACE_KERNEL_SYMBOLS_NEVER and * DTRACE_KERNEL_SYMBOLS_ALWAYS_FROM_KERNEL are permanent modes, intended to * disable fbt probes entirely, or prevent any symbols being loaded from * userspace. * * The kernel symbol mode is kept in dtrace_kernel_symbol_mode, which is protected * by the dtrace_lock. */ #define DTRACE_KERNEL_SYMBOLS_NEVER 0 #define DTRACE_KERNEL_SYMBOLS_FROM_KERNEL 1 #define DTRACE_KERNEL_SYMBOLS_FROM_USERSPACE 2 #define DTRACE_KERNEL_SYMBOLS_ALWAYS_FROM_KERNEL 3 /* * DTrace Helper Implementation * * A description of the helper architecture may be found in . * Each process contains a pointer to its helpers in its p_dtrace_helpers * member. This is a pointer to a dtrace_helpers structure, which contains an * array of pointers to dtrace_helper structures, helper variable state (shared * among a process's helpers) and a generation count. (The generation count is * used to provide an identifier when a helper is added so that it may be * subsequently removed.) The dtrace_helper structure is self-explanatory, * containing pointers to the objects needed to execute the helper. Note that * helpers are _duplicated_ across fork(2), and destroyed on exec(2). No more * than dtrace_helpers_max are allowed per-process. */ #define DTRACE_HELPER_ACTION_USTACK 0 #define DTRACE_NHELPER_ACTIONS 1 typedef struct dtrace_helper_action { int dtha_generation; /* helper action generation */ int dtha_nactions; /* number of actions */ dtrace_difo_t *dtha_predicate; /* helper action predicate */ dtrace_difo_t **dtha_actions; /* array of actions */ struct dtrace_helper_action *dtha_next; /* next helper action */ } dtrace_helper_action_t; typedef struct dtrace_helper_provider { int dthp_generation; /* helper provider generation */ uint32_t dthp_ref; /* reference count */ dof_helper_t dthp_prov; /* DOF w/ provider and probes */ } dtrace_helper_provider_t; typedef struct dtrace_helpers { dtrace_helper_action_t **dthps_actions; /* array of helper actions */ dtrace_vstate_t dthps_vstate; /* helper action var. state */ dtrace_helper_provider_t **dthps_provs; /* array of providers */ uint_t dthps_nprovs; /* count of providers */ uint_t dthps_maxprovs; /* provider array size */ int dthps_generation; /* current generation */ pid_t dthps_pid; /* pid of associated proc */ int dthps_deferred; /* helper in deferred list */ struct dtrace_helpers *dthps_next; /* next pointer */ struct dtrace_helpers *dthps_prev; /* prev pointer */ } dtrace_helpers_t; /* * DTrace Helper Action Tracing * * Debugging helper actions can be arduous. To ease the development and * debugging of helpers, DTrace contains a tracing-framework-within-a-tracing- * framework: helper tracing. If dtrace_helptrace_enabled is non-zero (which * it is by default on DEBUG kernels), all helper activity will be traced to a * global, in-kernel ring buffer. Each entry includes a pointer to the specific * helper, the location within the helper, and a trace of all local variables. * The ring buffer may be displayed in a human-readable format with the * ::dtrace_helptrace mdb(1) dcmd. */ #define DTRACE_HELPTRACE_NEXT (-1) #define DTRACE_HELPTRACE_DONE (-2) #define DTRACE_HELPTRACE_ERR (-3) typedef struct dtrace_helptrace { dtrace_helper_action_t *dtht_helper; /* helper action */ int dtht_where; /* where in helper action */ int dtht_nlocals; /* number of locals */ int dtht_fault; /* type of fault (if any) */ int dtht_fltoffs; /* DIF offset */ uint64_t dtht_illval; /* faulting value */ uint64_t dtht_locals[1]; /* local variables */ } dtrace_helptrace_t; /* * DTrace Credentials * * In probe context, we have limited flexibility to examine the credentials * of the DTrace consumer that created a particular enabling. We use * the Least Privilege interfaces to cache the consumer's cred pointer and * some facts about that credential in a dtrace_cred_t structure. These * can limit the consumer's breadth of visibility and what actions the * consumer may take. */ #define DTRACE_CRV_ALLPROC 0x01 #define DTRACE_CRV_KERNEL 0x02 #define DTRACE_CRV_ALLZONE 0x04 #define DTRACE_CRV_ALL (DTRACE_CRV_ALLPROC | DTRACE_CRV_KERNEL | \ DTRACE_CRV_ALLZONE) #define DTRACE_CRA_PROC 0x0001 #define DTRACE_CRA_PROC_CONTROL 0x0002 #define DTRACE_CRA_PROC_DESTRUCTIVE_ALLUSER 0x0004 #define DTRACE_CRA_PROC_DESTRUCTIVE_ALLZONE 0x0008 #define DTRACE_CRA_PROC_DESTRUCTIVE_CREDCHG 0x0010 #define DTRACE_CRA_KERNEL 0x0020 #define DTRACE_CRA_KERNEL_DESTRUCTIVE 0x0040 #define DTRACE_CRA_ALL (DTRACE_CRA_PROC | \ DTRACE_CRA_PROC_CONTROL | \ DTRACE_CRA_PROC_DESTRUCTIVE_ALLUSER | \ DTRACE_CRA_PROC_DESTRUCTIVE_ALLZONE | \ DTRACE_CRA_PROC_DESTRUCTIVE_CREDCHG | \ DTRACE_CRA_KERNEL | \ DTRACE_CRA_KERNEL_DESTRUCTIVE) typedef struct dtrace_cred { cred_t *dcr_cred; uint8_t dcr_destructive; uint8_t dcr_visible; uint16_t dcr_action; } dtrace_cred_t; typedef struct dtrace_format { uint64_t dtf_refcount; char dtf_str[]; } dtrace_format_t; #define DTRACE_FORMAT_SIZE(fmt) (strlen(fmt->dtf_str) + 1 + sizeof(dtrace_format_t)) /* * DTrace Consumer State * * Each DTrace consumer has an associated dtrace_state structure that contains * its in-kernel DTrace state -- including options, credentials, statistics and * pointers to ECBs, buffers, speculations and formats. A dtrace_state * structure is also allocated for anonymous enablings. When anonymous state * is grabbed, the grabbing consumers dts_anon pointer is set to the grabbed * dtrace_state structure. */ struct dtrace_state { dev_t dts_dev; /* device */ int dts_necbs; /* total number of ECBs */ dtrace_ecb_t **dts_ecbs; /* array of ECBs */ dtrace_epid_t dts_epid; /* next EPID to allocate */ size_t dts_needed; /* greatest needed space */ struct dtrace_state *dts_anon; /* anon. state, if grabbed */ dtrace_activity_t dts_activity; /* current activity */ dtrace_vstate_t dts_vstate; /* variable state */ dtrace_buffer_t *dts_buffer; /* principal buffer */ dtrace_buffer_t *dts_aggbuffer; /* aggregation buffer */ dtrace_speculation_t *dts_speculations; /* speculation array */ int dts_nspeculations; /* number of speculations */ int dts_naggregations; /* number of aggregations */ dtrace_aggregation_t **dts_aggregations; /* aggregation array */ vmem_t *dts_aggid_arena; /* arena for aggregation IDs */ uint64_t dts_errors; /* total number of errors */ uint32_t dts_speculations_busy; /* number of spec. busy */ uint32_t dts_speculations_unavail; /* number of spec unavail */ uint32_t dts_stkstroverflows; /* stack string tab overflows */ uint32_t dts_dblerrors; /* errors in ERROR probes */ uint32_t dts_reserve; /* space reserved for END */ hrtime_t dts_laststatus; /* time of last status */ cyclic_id_t dts_cleaner; /* cleaning cyclic */ cyclic_id_t dts_deadman; /* deadman cyclic */ hrtime_t dts_alive; /* time last alive */ char dts_speculates; /* boolean: has speculations */ char dts_destructive; /* boolean: has dest. actions */ int dts_nformats; /* number of formats */ dtrace_format_t **dts_formats; /* format string array */ dtrace_optval_t dts_options[DTRACEOPT_MAX]; /* options */ dtrace_cred_t dts_cred; /* credentials */ size_t dts_nretained; /* number of retained enabs */ uint64_t dts_arg_error_illval; uint32_t dts_buf_over_limit; /* number of bufs over dtb_limit */ uint64_t **dts_rstate; /* per-CPU random state */ }; struct dtrace_provider { dtrace_pattr_t dtpv_attr; /* provider attributes */ dtrace_ppriv_t dtpv_priv; /* provider privileges */ dtrace_pops_t dtpv_pops; /* provider operations */ char *dtpv_name; /* provider name */ void *dtpv_arg; /* provider argument */ uint_t dtpv_defunct; /* boolean: defunct provider */ struct dtrace_provider *dtpv_next; /* next provider */ uint64_t dtpv_probe_count; /* number of associated probes */ uint64_t dtpv_ecb_count; /* number of associated enabled ECBs */ }; struct dtrace_meta { dtrace_mops_t dtm_mops; /* meta provider operations */ char *dtm_name; /* meta provider name */ void *dtm_arg; /* meta provider user arg */ uint64_t dtm_count; /* number of associated providers */ }; /* * DTrace Enablings * * A dtrace_enabling structure is used to track a collection of ECB * descriptions -- before they have been turned into actual ECBs. This is * created as a result of DOF processing, and is generally used to generate * ECBs immediately thereafter. However, enablings are also generally * retained should the probes they describe be created at a later time; as * each new module or provider registers with the framework, the retained * enablings are reevaluated, with any new match resulting in new ECBs. To * prevent probes from being matched more than once, the enabling tracks the * last probe generation matched, and only matches probes from subsequent * generations. */ typedef struct dtrace_enabling { dtrace_ecbdesc_t **dten_desc; /* all ECB descriptions */ int dten_ndesc; /* number of ECB descriptions */ int dten_maxdesc; /* size of ECB array */ dtrace_vstate_t *dten_vstate; /* associated variable state */ dtrace_genid_t dten_probegen; /* matched probe generation */ dtrace_ecbdesc_t *dten_current; /* current ECB description */ int dten_error; /* current error value */ int dten_primed; /* boolean: set if primed */ struct dtrace_enabling *dten_prev; /* previous enabling */ struct dtrace_enabling *dten_next; /* next enabling */ } dtrace_enabling_t; /* * DTrace Anonymous Enablings * * Anonymous enablings are DTrace enablings that are not associated with a * controlling process, but rather derive their enabling from DOF stored as * properties in the dtrace.conf file. If there is an anonymous enabling, a * DTrace consumer state and enabling are created on attach. The state may be * subsequently grabbed by the first consumer specifying the "grabanon" * option. As long as an anonymous DTrace enabling exists, dtrace(7D) will * refuse to unload. */ typedef struct dtrace_anon { dtrace_state_t *dta_state; /* DTrace consumer state */ dtrace_enabling_t *dta_enabling; /* pointer to enabling */ processorid_t dta_beganon; /* which CPU BEGIN ran on */ } dtrace_anon_t; /* * DTrace Error Debugging */ #if DEBUG #define DTRACE_ERRDEBUG #endif #ifdef DTRACE_ERRDEBUG typedef struct dtrace_errhash { const char *dter_msg; /* error message */ int dter_count; /* number of times seen */ } dtrace_errhash_t; #define DTRACE_ERRHASHSZ 256 /* must be > number of err msgs */ #endif /* DTRACE_ERRDEBUG */ typedef struct dtrace_string dtrace_string_t; typedef struct dtrace_string { dtrace_string_t *dtst_next; dtrace_string_t *dtst_prev; uint32_t dtst_refcount; char dtst_str[]; } dtrace_string_t; /** * DTrace Matching pre-conditions * * Used when matching new probes to discard matching of enablings that * doesn't match the condition tested by dmc_func */ typedef struct dtrace_match_cond { int (*dmc_func)(dtrace_probedesc_t*, void*); void *dmc_data; } dtrace_match_cond_t; /* * DTrace Toxic Ranges * * DTrace supports safe loads from probe context; if the address turns out to * be invalid, a bit will be set by the kernel indicating that DTrace * encountered a memory error, and DTrace will propagate the error to the user * accordingly. However, there may exist some regions of memory in which an * arbitrary load can change system state, and from which it is impossible to * recover from such a load after it has been attempted. Examples of this may * include memory in which programmable I/O registers are mapped (for which a * read may have some implications for the device) or (in the specific case of * UltraSPARC-I and -II) the virtual address hole. The platform is required * to make DTrace aware of these toxic ranges; DTrace will then check that * target addresses are not in a toxic range before attempting to issue a * safe load. */ typedef struct dtrace_toxrange { uintptr_t dtt_base; /* base of toxic range */ uintptr_t dtt_limit; /* limit of toxic range */ } dtrace_toxrange_t; extern uint64_t dtrace_getarg(int, int, dtrace_mstate_t*, dtrace_vstate_t*); extern int dtrace_getipl(void); extern uintptr_t dtrace_caller(int); extern uint32_t dtrace_cas32(uint32_t *, uint32_t, uint32_t); extern void *dtrace_casptr(void *, void *, void *); extern void dtrace_copyin(user_addr_t, uintptr_t, size_t, volatile uint16_t *); extern void dtrace_copyinstr(user_addr_t, uintptr_t, size_t, volatile uint16_t *); extern void dtrace_copyout(uintptr_t, user_addr_t, size_t, volatile uint16_t *); extern void dtrace_copyoutstr(uintptr_t, user_addr_t, size_t, volatile uint16_t *); extern void dtrace_getpcstack(pc_t *, int, int, uint32_t *); extern uint64_t dtrace_load64(uintptr_t); extern int dtrace_canload(uint64_t, size_t, dtrace_mstate_t*, dtrace_vstate_t*); extern uint64_t dtrace_getreg(struct regs *, uint_t); extern uint64_t dtrace_getvmreg(uint_t); extern int dtrace_getstackdepth(int); extern void dtrace_getupcstack(uint64_t *, int); extern void dtrace_getufpstack(uint64_t *, uint64_t *, int); extern int dtrace_getustackdepth(void); extern uintptr_t dtrace_fulword(void *); extern uint8_t dtrace_fuword8(user_addr_t); extern uint16_t dtrace_fuword16(user_addr_t); extern uint32_t dtrace_fuword32(user_addr_t); extern uint64_t dtrace_fuword64(user_addr_t); extern int dtrace_proc_waitfor(dtrace_procdesc_t*); extern void dtrace_probe_error(dtrace_state_t *, dtrace_epid_t, int, int, int, uint64_t); extern int dtrace_assfail(const char *, const char *, int); extern int dtrace_attached(void); extern hrtime_t dtrace_gethrestime(void); extern void dtrace_flush_caches(void); extern void dtrace_copy(uintptr_t, uintptr_t, size_t); extern void dtrace_copystr(uintptr_t, uintptr_t, size_t, volatile uint16_t *); extern void* dtrace_ptrauth_strip(void*, uint64_t); extern int dtrace_is_valid_ptrauth_key(uint64_t); extern uint64_t dtrace_physmem_read(uint64_t, size_t); extern void dtrace_physmem_write(uint64_t, uint64_t, size_t); extern void dtrace_livedump(char *, size_t); /* * DTrace state handling */ extern minor_t dtrace_state_reserve(void); extern dtrace_state_t* dtrace_state_allocate(minor_t minor); extern dtrace_state_t* dtrace_state_get(minor_t minor); extern void dtrace_state_free(minor_t minor); /* * DTrace restriction checks */ extern void dtrace_restriction_policy_load(void); extern boolean_t dtrace_is_restricted(void); extern boolean_t dtrace_are_restrictions_relaxed(void); extern boolean_t dtrace_fbt_probes_restricted(void); extern boolean_t dtrace_sdt_probes_restricted(void); extern boolean_t dtrace_can_attach_to_proc(proc_t); /* * DTrace Assertions * * DTrace calls ASSERT and VERIFY from probe context. To assure that a failed * ASSERT or VERIFYdoes not induce a markedly more catastrophic failure (e.g., * one from which a dump cannot be gleaned), DTrace must define its own ASSERT * and VERIFY macros to be ones that may safely be called from probe context. * This header file must thus be included by any DTrace component that calls * ASSERT and/or VERIFY from probe context, and _only_ by those components. * (The only exception to this is kernel debugging infrastructure at user-level * that doesn't depend on calling ASSERT.) */ #undef ASSERT #undef VERIFY #define VERIFY(EX) ((void)((EX) || \ dtrace_assfail(#EX, __FILE__, __LINE__))) #if DEBUG #define ASSERT(EX) ((void)((EX) || \ dtrace_assfail(#EX, __FILE__, __LINE__))) #else #define ASSERT(X) ((void)0) #endif #ifdef __cplusplus } #endif #endif /* _SYS_DTRACE_IMPL_H */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/errno.h ================================================ /* * Copyright (c) 2000-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@ */ /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */ /* * Copyright (c) 1982, 1986, 1989, 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. * * @(#)errno.h 8.5 (Berkeley) 1/21/94 */ #ifndef _SYS_ERRNO_H_ #define _SYS_ERRNO_H_ #include #if defined(__STDC_WANT_LIB_EXT1__) && __STDC_WANT_LIB_EXT1__ >= 1 #include #endif __BEGIN_DECLS extern int * __error(void); #define errno (*__error()) __END_DECLS /* * Error codes */ #define EPERM 1 /* Operation not permitted */ #define ENOENT 2 /* No such file or directory */ #define ESRCH 3 /* No such process */ #define EINTR 4 /* Interrupted system call */ #define EIO 5 /* Input/output error */ #define ENXIO 6 /* Device not configured */ #define E2BIG 7 /* Argument list too long */ #define ENOEXEC 8 /* Exec format error */ #define EBADF 9 /* Bad file descriptor */ #define ECHILD 10 /* No child processes */ #define EDEADLK 11 /* Resource deadlock avoided */ /* 11 was EAGAIN */ #define ENOMEM 12 /* Cannot allocate memory */ #define EACCES 13 /* Permission denied */ #define EFAULT 14 /* Bad address */ #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL #define ENOTBLK 15 /* Block device required */ #endif #define EBUSY 16 /* Device / Resource busy */ #define EEXIST 17 /* File exists */ #define EXDEV 18 /* Cross-device link */ #define ENODEV 19 /* Operation not supported by device */ #define ENOTDIR 20 /* Not a directory */ #define EISDIR 21 /* Is a directory */ #define EINVAL 22 /* Invalid argument */ #define ENFILE 23 /* Too many open files in system */ #define EMFILE 24 /* Too many open files */ #define ENOTTY 25 /* Inappropriate ioctl for device */ #define ETXTBSY 26 /* Text file busy */ #define EFBIG 27 /* File too large */ #define ENOSPC 28 /* No space left on device */ #define ESPIPE 29 /* Illegal seek */ #define EROFS 30 /* Read-only file system */ #define EMLINK 31 /* Too many links */ #define EPIPE 32 /* Broken pipe */ /* math software */ #define EDOM 33 /* Numerical argument out of domain */ #define ERANGE 34 /* Result too large */ /* non-blocking and interrupt i/o */ #define EAGAIN 35 /* Resource temporarily unavailable */ #define EWOULDBLOCK EAGAIN /* Operation would block */ #define EINPROGRESS 36 /* Operation now in progress */ #define EALREADY 37 /* Operation already in progress */ /* ipc/network software -- argument errors */ #define ENOTSOCK 38 /* Socket operation on non-socket */ #define EDESTADDRREQ 39 /* Destination address required */ #define EMSGSIZE 40 /* Message too long */ #define EPROTOTYPE 41 /* Protocol wrong type for socket */ #define ENOPROTOOPT 42 /* Protocol not available */ #define EPROTONOSUPPORT 43 /* Protocol not supported */ #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL #define ESOCKTNOSUPPORT 44 /* Socket type not supported */ #endif #define ENOTSUP 45 /* Operation not supported */ #if !__DARWIN_UNIX03 && !defined(KERNEL) /* * This is the same for binary and source copmpatability, unless compiling * the kernel itself, or compiling __DARWIN_UNIX03; if compiling for the * kernel, the correct value will be returned. If compiling non-POSIX * source, the kernel return value will be converted by a stub in libc, and * if compiling source with __DARWIN_UNIX03, the conversion in libc is not * done, and the caller gets the expected (discrete) value. */ #define EOPNOTSUPP ENOTSUP /* Operation not supported on socket */ #endif /* !__DARWIN_UNIX03 && !KERNEL */ #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL #define EPFNOSUPPORT 46 /* Protocol family not supported */ #endif #define EAFNOSUPPORT 47 /* Address family not supported by protocol family */ #define EADDRINUSE 48 /* Address already in use */ #define EADDRNOTAVAIL 49 /* Can't assign requested address */ /* ipc/network software -- operational errors */ #define ENETDOWN 50 /* Network is down */ #define ENETUNREACH 51 /* Network is unreachable */ #define ENETRESET 52 /* Network dropped connection on reset */ #define ECONNABORTED 53 /* Software caused connection abort */ #define ECONNRESET 54 /* Connection reset by peer */ #define ENOBUFS 55 /* No buffer space available */ #define EISCONN 56 /* Socket is already connected */ #define ENOTCONN 57 /* Socket is not connected */ #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL #define ESHUTDOWN 58 /* Can't send after socket shutdown */ #define ETOOMANYREFS 59 /* Too many references: can't splice */ #endif #define ETIMEDOUT 60 /* Operation timed out */ #define ECONNREFUSED 61 /* Connection refused */ #define ELOOP 62 /* Too many levels of symbolic links */ #define ENAMETOOLONG 63 /* File name too long */ /* should be rearranged */ #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL #define EHOSTDOWN 64 /* Host is down */ #endif #define EHOSTUNREACH 65 /* No route to host */ #define ENOTEMPTY 66 /* Directory not empty */ /* quotas & mush */ #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL #define EPROCLIM 67 /* Too many processes */ #define EUSERS 68 /* Too many users */ #endif #define EDQUOT 69 /* Disc quota exceeded */ /* Network File System */ #define ESTALE 70 /* Stale NFS file handle */ #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL #define EREMOTE 71 /* Too many levels of remote in path */ #define EBADRPC 72 /* RPC struct is bad */ #define ERPCMISMATCH 73 /* RPC version wrong */ #define EPROGUNAVAIL 74 /* RPC prog. not avail */ #define EPROGMISMATCH 75 /* Program version wrong */ #define EPROCUNAVAIL 76 /* Bad procedure for program */ #endif #define ENOLCK 77 /* No locks available */ #define ENOSYS 78 /* Function not implemented */ #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL #define EFTYPE 79 /* Inappropriate file type or format */ #define EAUTH 80 /* Authentication error */ #define ENEEDAUTH 81 /* Need authenticator */ /* Intelligent device errors */ #define EPWROFF 82 /* Device power is off */ #define EDEVERR 83 /* Device error, e.g. paper out */ #endif #define EOVERFLOW 84 /* Value too large to be stored in data type */ /* Program loading errors */ #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL #define EBADEXEC 85 /* Bad executable */ #define EBADARCH 86 /* Bad CPU type in executable */ #define ESHLIBVERS 87 /* Shared library version mismatch */ #define EBADMACHO 88 /* Malformed Macho file */ #endif #define ECANCELED 89 /* Operation canceled */ #define EIDRM 90 /* Identifier removed */ #define ENOMSG 91 /* No message of desired type */ #define EILSEQ 92 /* Illegal byte sequence */ #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL #define ENOATTR 93 /* Attribute not found */ #endif #define EBADMSG 94 /* Bad message */ #define EMULTIHOP 95 /* Reserved */ #define ENODATA 96 /* No message available on STREAM */ #define ENOLINK 97 /* Reserved */ #define ENOSR 98 /* No STREAM resources */ #define ENOSTR 99 /* Not a STREAM */ #define EPROTO 100 /* Protocol error */ #define ETIME 101 /* STREAM ioctl timeout */ #if __DARWIN_UNIX03 || defined(KERNEL) /* This value is only discrete when compiling __DARWIN_UNIX03, or KERNEL */ #define EOPNOTSUPP 102 /* Operation not supported on socket */ #endif /* __DARWIN_UNIX03 || KERNEL */ #define ENOPOLICY 103 /* No such policy registered */ #if __DARWIN_C_LEVEL >= 200809L #define ENOTRECOVERABLE 104 /* State not recoverable */ #define EOWNERDEAD 105 /* Previous owner died */ #endif #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL #define EQFULL 106 /* Interface output queue is full */ #define ELAST 106 /* Must be equal largest errno */ #endif #endif /* _SYS_ERRNO_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/ev.h ================================================ /* * 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 (c) 1998 Apple Computer, Inc. All rights reserved */ #ifndef _SYS_EV_H_ #define _SYS_EV_H_ #include #include #include struct eventreq { int er_type; #define EV_FD 1 // file descriptor int er_handle; void *er_data; int er_rcnt; int er_wcnt; int er_ecnt; int er_eventbits; #define EV_RE 1 #define EV_WR 2 #define EV_EX 4 #define EV_RM 8 #define EV_MASK 0xf }; typedef struct eventreq *er_t; #define EV_RBYTES 0x100 #define EV_WBYTES 0x200 #define EV_RWBYTES (EV_RBYTES|EV_WBYTES) #define EV_RCLOSED 0x400 #define EV_RCONN 0x800 #define EV_WCLOSED 0x1000 #define EV_WCONN 0x2000 #define EV_OOB 0x4000 #define EV_FIN 0x8000 #define EV_RESET 0x10000 #define EV_TIMEOUT 0x20000 #define EV_DMASK 0xffffff00 __BEGIN_DECLS int modwatch(er_t, int); int watchevent(er_t, int); int waitevent(er_t, struct timeval *); __END_DECLS #endif /* _SYS_EV_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/event.h ================================================ /* * Copyright (c) 2003-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@ */ /*- * Copyright (c) 1999,2000,2001 Jonathan Lemon * 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. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. * * $FreeBSD: src/sys/sys/event.h,v 1.5.2.5 2001/12/14 19:21:22 jlemon Exp $ */ #ifndef _SYS_EVENT_H_ #define _SYS_EVENT_H_ #include #include #include #include #include /* * Filter types */ #define EVFILT_READ (-1) #define EVFILT_WRITE (-2) #define EVFILT_AIO (-3) /* attached to aio requests */ #define EVFILT_VNODE (-4) /* attached to vnodes */ #define EVFILT_PROC (-5) /* attached to struct proc */ #define EVFILT_SIGNAL (-6) /* attached to struct proc */ #define EVFILT_TIMER (-7) /* timers */ #define EVFILT_MACHPORT (-8) /* Mach portsets */ #define EVFILT_FS (-9) /* Filesystem events */ #define EVFILT_USER (-10) /* User events */ #define EVFILT_VM (-12) /* Virtual memory events */ #define EVFILT_EXCEPT (-15) /* Exception events */ #define EVFILT_SYSCOUNT 17 #define EVFILT_THREADMARKER EVFILT_SYSCOUNT /* Internal use only */ #pragma pack(4) struct kevent { uintptr_t ident; /* identifier for this event */ int16_t filter; /* filter for event */ uint16_t flags; /* general flags */ uint32_t fflags; /* filter-specific flags */ intptr_t data; /* filter-specific data */ void *udata; /* opaque user data identifier */ }; #pragma pack() struct kevent64_s { uint64_t ident; /* identifier for this event */ int16_t filter; /* filter for event */ uint16_t flags; /* general flags */ uint32_t fflags; /* filter-specific flags */ int64_t data; /* filter-specific data */ uint64_t udata; /* opaque user data identifier */ uint64_t ext[2]; /* filter-specific extensions */ }; #define EV_SET(kevp, a, b, c, d, e, f) do { \ struct kevent *__kevp__ = (kevp); \ __kevp__->ident = (a); \ __kevp__->filter = (b); \ __kevp__->flags = (c); \ __kevp__->fflags = (d); \ __kevp__->data = (e); \ __kevp__->udata = (f); \ } while(0) #define EV_SET64(kevp, a, b, c, d, e, f, g, h) do { \ struct kevent64_s *__kevp__ = (kevp); \ __kevp__->ident = (a); \ __kevp__->filter = (b); \ __kevp__->flags = (c); \ __kevp__->fflags = (d); \ __kevp__->data = (e); \ __kevp__->udata = (f); \ __kevp__->ext[0] = (g); \ __kevp__->ext[1] = (h); \ } while(0) /* kevent system call flags */ #define KEVENT_FLAG_NONE 0x000000 /* no flag value */ #define KEVENT_FLAG_IMMEDIATE 0x000001 /* immediate timeout */ #define KEVENT_FLAG_ERROR_EVENTS 0x000002 /* output events only include change errors */ /* actions */ #define EV_ADD 0x0001 /* add event to kq (implies enable) */ #define EV_DELETE 0x0002 /* delete event from kq */ #define EV_ENABLE 0x0004 /* enable event */ #define EV_DISABLE 0x0008 /* disable event (not reported) */ /* flags */ #define EV_ONESHOT 0x0010 /* only report one occurrence */ #define EV_CLEAR 0x0020 /* clear event state after reporting */ #define EV_RECEIPT 0x0040 /* force immediate event output */ /* ... with or without EV_ERROR */ /* ... use KEVENT_FLAG_ERROR_EVENTS */ /* on syscalls supporting flags */ #define EV_DISPATCH 0x0080 /* disable event after reporting */ #define EV_UDATA_SPECIFIC 0x0100 /* unique kevent per udata value */ #define EV_DISPATCH2 (EV_DISPATCH | EV_UDATA_SPECIFIC) /* ... in combination with EV_DELETE */ /* will defer delete until udata-specific */ /* event enabled. EINPROGRESS will be */ /* returned to indicate the deferral */ #define EV_VANISHED 0x0200 /* report that source has vanished */ /* ... only valid with EV_DISPATCH2 */ #define EV_SYSFLAGS 0xF000 /* reserved by system */ #define EV_FLAG0 0x1000 /* filter-specific flag */ #define EV_FLAG1 0x2000 /* filter-specific flag */ /* returned values */ #define EV_EOF 0x8000 /* EOF detected */ #define EV_ERROR 0x4000 /* error, data contains errno */ /* * Filter specific flags for EVFILT_READ * * The default behavior for EVFILT_READ is to make the "read" determination * relative to the current file descriptor read pointer. * * The EV_POLL flag indicates the determination should be made via poll(2) * semantics. These semantics dictate always returning true for regular files, * regardless of the amount of unread data in the file. * * On input, EV_OOBAND specifies that filter should actively return in the * presence of OOB on the descriptor. It implies that filter will return * if there is OOB data available to read OR when any other condition * for the read are met (for example number of bytes regular data becomes >= * low-watermark). * If EV_OOBAND is not set on input, it implies that the filter should not actively * return for out of band data on the descriptor. The filter will then only return * when some other condition for read is met (ex: when number of regular data bytes * >=low-watermark OR when socket can't receive more data (SS_CANTRCVMORE)). * * On output, EV_OOBAND indicates the presence of OOB data on the descriptor. * If it was not specified as an input parameter, then the data count is the * number of bytes before the current OOB marker, else data count is the number * of bytes beyond OOB marker. */ #define EV_POLL EV_FLAG0 #define EV_OOBAND EV_FLAG1 /* * data/hint fflags for EVFILT_USER, shared with userspace */ /* * On input, NOTE_TRIGGER causes the event to be triggered for output. */ #define NOTE_TRIGGER 0x01000000 /* * On input, the top two bits of fflags specifies how the lower twenty four * bits should be applied to the stored value of fflags. * * On output, the top two bits will always be set to NOTE_FFNOP and the * remaining twenty four bits will contain the stored fflags value. */ #define NOTE_FFNOP 0x00000000 /* ignore input fflags */ #define NOTE_FFAND 0x40000000 /* and fflags */ #define NOTE_FFOR 0x80000000 /* or fflags */ #define NOTE_FFCOPY 0xc0000000 /* copy fflags */ #define NOTE_FFCTRLMASK 0xc0000000 /* mask for operations */ #define NOTE_FFLAGSMASK 0x00ffffff /* * data/hint fflags for EVFILT_{READ|WRITE}, shared with userspace * * The default behavior for EVFILT_READ is to make the determination * realtive to the current file descriptor read pointer. */ #define NOTE_LOWAT 0x00000001 /* low water mark */ /* data/hint flags for EVFILT_EXCEPT, shared with userspace */ #define NOTE_OOB 0x00000002 /* OOB data */ /* * data/hint fflags for EVFILT_VNODE, shared with userspace */ #define NOTE_DELETE 0x00000001 /* vnode was removed */ #define NOTE_WRITE 0x00000002 /* data contents changed */ #define NOTE_EXTEND 0x00000004 /* size increased */ #define NOTE_ATTRIB 0x00000008 /* attributes changed */ #define NOTE_LINK 0x00000010 /* link count changed */ #define NOTE_RENAME 0x00000020 /* vnode was renamed */ #define NOTE_REVOKE 0x00000040 /* vnode access was revoked */ #define NOTE_NONE 0x00000080 /* No specific vnode event: to test for EVFILT_READ activation*/ #define NOTE_FUNLOCK 0x00000100 /* vnode was unlocked by flock(2) */ /* * data/hint fflags for EVFILT_PROC, shared with userspace * * Please note that EVFILT_PROC and EVFILT_SIGNAL share the same knote list * that hangs off the proc structure. They also both play games with the hint * passed to KNOTE(). If NOTE_SIGNAL is passed as a hint, then the lower bits * of the hint contain the signal. IF NOTE_FORK is passed, then the lower bits * contain the PID of the child (but the pid does not get passed through in * the actual kevent). */ enum { eNoteReapDeprecated __deprecated_enum_msg("This kqueue(2) EVFILT_PROC flag is deprecated") = 0x10000000 }; #define NOTE_EXIT 0x80000000 /* process exited */ #define NOTE_FORK 0x40000000 /* process forked */ #define NOTE_EXEC 0x20000000 /* process exec'd */ #define NOTE_REAP ((unsigned int)eNoteReapDeprecated /* 0x10000000 */ ) /* process reaped */ #define NOTE_SIGNAL 0x08000000 /* shared with EVFILT_SIGNAL */ #define NOTE_EXITSTATUS 0x04000000 /* exit status to be returned, valid for child process or when allowed to signal target pid */ #define NOTE_EXIT_DETAIL 0x02000000 /* provide details on reasons for exit */ #define NOTE_PDATAMASK 0x000fffff /* mask for signal & exit status */ #define NOTE_PCTRLMASK (~NOTE_PDATAMASK) /* * If NOTE_EXITSTATUS is present, provide additional info about exiting process. */ enum { eNoteExitReparentedDeprecated __deprecated_enum_msg("This kqueue(2) EVFILT_PROC flag is no longer sent") = 0x00080000 }; #define NOTE_EXIT_REPARENTED ((unsigned int)eNoteExitReparentedDeprecated) /* exited while reparented */ /* * If NOTE_EXIT_DETAIL is present, these bits indicate specific reasons for exiting. */ #define NOTE_EXIT_DETAIL_MASK 0x00070000 #define NOTE_EXIT_DECRYPTFAIL 0x00010000 #define NOTE_EXIT_MEMORY 0x00020000 #define NOTE_EXIT_CSERROR 0x00040000 /* * data/hint fflags for EVFILT_VM, shared with userspace. */ #define NOTE_VM_PRESSURE 0x80000000 /* will react on memory pressure */ #define NOTE_VM_PRESSURE_TERMINATE 0x40000000 /* will quit on memory pressure, possibly after cleaning up dirty state */ #define NOTE_VM_PRESSURE_SUDDEN_TERMINATE 0x20000000 /* will quit immediately on memory pressure */ #define NOTE_VM_ERROR 0x10000000 /* there was an error */ /* * data/hint fflags for EVFILT_TIMER, shared with userspace. * The default is a (repeating) interval timer with the data * specifying the timeout interval in milliseconds. * * All timeouts are implicitly EV_CLEAR events. */ #define NOTE_SECONDS 0x00000001 /* data is seconds */ #define NOTE_USECONDS 0x00000002 /* data is microseconds */ #define NOTE_NSECONDS 0x00000004 /* data is nanoseconds */ #define NOTE_ABSOLUTE 0x00000008 /* absolute timeout */ /* ... implicit EV_ONESHOT, timeout uses the gettimeofday epoch */ #define NOTE_LEEWAY 0x00000010 /* ext[1] holds leeway for power aware timers */ #define NOTE_CRITICAL 0x00000020 /* system does minimal timer coalescing */ #define NOTE_BACKGROUND 0x00000040 /* system does maximum timer coalescing */ #define NOTE_MACH_CONTINUOUS_TIME 0x00000080 /* * NOTE_MACH_CONTINUOUS_TIME: * with NOTE_ABSOLUTE: causes the timer to continue to tick across sleep, * still uses gettimeofday epoch * with NOTE_MACHTIME and NOTE_ABSOLUTE: uses mach continuous time epoch * without NOTE_ABSOLUTE (interval timer mode): continues to tick across sleep */ #define NOTE_MACHTIME 0x00000100 /* data is mach absolute time units */ /* timeout uses the mach absolute time epoch */ /* * data/hint fflags for EVFILT_MACHPORT, shared with userspace. * * Only portsets are supported at this time. * * The fflags field can optionally contain the MACH_RCV_MSG, MACH_RCV_LARGE, * and related trailer receive options as defined in . * The presence of these flags directs the kevent64() call to attempt to receive * the message during kevent delivery, rather than just indicate that a message exists. * On setup, The ext[0] field contains the receive buffer pointer and ext[1] contains * the receive buffer length. Upon event delivery, the actual received message size * is returned in ext[1]. As with mach_msg(), the buffer must be large enough to * receive the message and the requested (or default) message trailers. In addition, * the fflags field contains the return code normally returned by mach_msg(). * * If MACH_RCV_MSG is specified, and the ext[1] field specifies a zero length, the * system call argument specifying an ouput area (kevent_qos) will be consulted. If * the system call specified an output data area, the user-space address * of the received message is carved from that provided output data area (if enough * space remains there). The address and length of each received message is * returned in the ext[0] and ext[1] fields (respectively) of the corresponding kevent. * * IF_MACH_RCV_VOUCHER_CONTENT is specified, the contents of the message voucher is * extracted (as specified in the xflags field) and stored in ext[2] up to ext[3] * length. If the input length is zero, and the system call provided a data area, * the space for the voucher content is carved from the provided space and its * address and length is returned in ext[2] and ext[3] respectively. * * If no message receipt options were provided in the fflags field on setup, no * message is received by this call. Instead, on output, the data field simply * contains the name of the actual port detected with a message waiting. */ /* * DEPRECATED!!!!!!!!! * NOTE_TRACK, NOTE_TRACKERR, and NOTE_CHILD are no longer supported as of 10.5 */ /* additional flags for EVFILT_PROC */ #define NOTE_TRACK 0x00000001 /* follow across forks */ #define NOTE_TRACKERR 0x00000002 /* could not track child */ #define NOTE_CHILD 0x00000004 /* am a child process */ /* Temporay solution for BootX to use inode.h till kqueue moves to vfs layer */ struct knote; SLIST_HEAD(klist, knote); struct timespec; __BEGIN_DECLS int kqueue(void); int kevent(int kq, const struct kevent *changelist, int nchanges, struct kevent *eventlist, int nevents, const struct timespec *timeout); int kevent64(int kq, const struct kevent64_s *changelist, int nchanges, struct kevent64_s *eventlist, int nevents, unsigned int flags, const struct timespec *timeout); __END_DECLS #endif /* !_SYS_EVENT_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/fasttrap.h ================================================ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. * See the License for the specific language governing permissions * and limitations under the License. * * When distributing Covered Code, include this CDDL HEADER in each * file and include the License file at usr/src/OPENSOLARIS.LICENSE. * If applicable, add the following below this CDDL HEADER, with the * fields enclosed by brackets "[]" replaced with your own identifying * information: Portions Copyright [yyyy] [name of copyright owner] * * CDDL HEADER END */ /* * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _SYS_FASTTRAP_H #define _SYS_FASTTRAP_H #include #include #include #ifdef __cplusplus extern "C" { #endif #if !defined(__APPLE__) #define FASTTRAPIOC (('m' << 24) | ('r' << 16) | ('f' << 8)) #else #define FASTTRAPIOC _IO('d', 0) #endif /* __APPLE__ */ #define FASTTRAPIOC_MAKEPROBE (FASTTRAPIOC | 1) #define FASTTRAPIOC_GETINSTR (FASTTRAPIOC | 2) typedef enum fasttrap_probe_type { DTFTP_NONE = 0, DTFTP_ENTRY, DTFTP_RETURN, DTFTP_OFFSETS, DTFTP_POST_OFFSETS, DTFTP_IS_ENABLED } fasttrap_probe_type_t; #if defined(__APPLE__) typedef enum fasttrap_provider_type { DTFTP_PROVIDER_NONE = 0, DTFTP_PROVIDER_USDT, DTFTP_PROVIDER_PID, DTFTP_PROVIDER_OBJC, DTFTP_PROVIDER_ONESHOT } fasttrap_provider_type_t; /* Moved from fasttrap.c */ #define FASTTRAP_PID_NAME "pid" #define FASTTRAP_OBJC_NAME "objc" #define FASTTRAP_ONESHOT_NAME "oneshot" #endif typedef struct fasttrap_probe_spec { pid_t ftps_pid; #if defined(__APPLE__) fasttrap_provider_type_t ftps_provider_type; fasttrap_probe_type_t ftps_probe_type; #if defined(__arm__) || defined(__arm64__) uint32_t ftps_arch_subinfo; // For any additional per probe architecture specific data #endif #endif char ftps_func[DTRACE_FUNCNAMELEN]; char ftps_mod[DTRACE_MODNAMELEN]; #if defined(__APPLE__) #if defined(__arm__) || defined(__arm64__) // We already have 'padding' from the ftps_arch_subinfo above #else #if !defined(__LP64__) uint32_t pad; /* Explicit pad to keep ILP32 and LP64 lined up. */ #endif #endif #endif uint64_t ftps_pc; uint64_t ftps_size; uint64_t ftps_noffs; uint64_t ftps_offs[1]; } fasttrap_probe_spec_t; typedef struct fasttrap_instr_query { uint64_t ftiq_pc; pid_t ftiq_pid; fasttrap_instr_t ftiq_instr; } fasttrap_instr_query_t; /* * To support the fasttrap provider from very early in a process's life, * the run-time linker, ld.so.1, has a program header of type PT_SUNWDTRACE * which points to a data object which must be PT_SUNWDTRACE_SIZE bytes. * This structure mimics the fasttrap provider section of the ulwp_t structure. * When the fasttrap provider is changed to require new or different * instructions, the data object in ld.so.1 and the thread initializers in libc * (libc_init() and _thrp_create()) need to be updated to include the new * instructions, and PT_SUNWDTRACE needs to be changed to a new unique number * (while the old value gets assigned something like PT_SUNWDTRACE_1). Since the * linker must be backward compatible with old Solaris releases, it must have * program headers for each of the PT_SUNWDTRACE versions. The kernel's * elfexec() function only has to look for the latest version of the * PT_SUNWDTRACE program header. */ #define PT_SUNWDTRACE_SIZE FASTTRAP_SUNWDTRACE_SIZE #ifdef __cplusplus } #endif #endif /* _SYS_FASTTRAP_H */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/fasttrap_isa.h ================================================ /* * 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@ */ /* * Mach Operating System * Copyright (c) 1989 Carnegie-Mellon University * Copyright (c) 1988 Carnegie-Mellon University * All rights reserved. The CMU software License Agreement specifies * the terms and conditions for use and redistribution. */ /* * HISTORY */ #ifndef _SYS_FASTTRAP_ISA_H_ #define _SYS_FASTTRAP_ISA_H_ /* * Machine dependent constants */ #include #endif /* _SYS_FASTTRAP_ISA_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/fcntl.h ================================================ /* * Copyright (c) 2000-2013 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 (c) 1995 NeXT Computer, Inc. All Rights Reserved */ /*- * Copyright (c) 1983, 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. * * @(#)fcntl.h 8.3 (Berkeley) 1/21/94 */ #ifndef _SYS_FCNTL_H_ #define _SYS_FCNTL_H_ /* * This file includes the definitions for open and fcntl * described by POSIX for ; it also includes * related kernel definitions. */ #include #include #include /* We should not be exporting size_t here. Temporary for gcc bootstrapping. */ #include #include #include #include /* * File status flags: these are used by open(2), fcntl(2). * They are also used (indirectly) in the kernel file structure f_flags, * which is a superset of the open/fcntl flags. Open flags and f_flags * are inter-convertible using OFLAGS(fflags) and FFLAGS(oflags). * Open/fcntl flags begin with O_; kernel-internal flags begin with F. */ /* open-only flags */ #define O_RDONLY 0x0000 /* open for reading only */ #define O_WRONLY 0x0001 /* open for writing only */ #define O_RDWR 0x0002 /* open for reading and writing */ #define O_ACCMODE 0x0003 /* mask for above modes */ /* * Kernel encoding of open mode; separate read and write bits that are * independently testable: 1 greater than the above. * * XXX * FREAD and FWRITE are excluded from the #ifdef KERNEL so that TIOCFLUSH, * which was documented to use FREAD/FWRITE, continues to work. */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define FREAD 0x00000001 #define FWRITE 0x00000002 #endif #define O_NONBLOCK 0x00000004 /* no delay */ #define O_APPEND 0x00000008 /* set append mode */ #include #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define O_SHLOCK 0x00000010 /* open with shared file lock */ #define O_EXLOCK 0x00000020 /* open with exclusive file lock */ #define O_ASYNC 0x00000040 /* signal pgrp when data ready */ #define O_FSYNC O_SYNC /* source compatibility: do not use */ #define O_NOFOLLOW 0x00000100 /* don't follow symlinks */ #endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */ #define O_CREAT 0x00000200 /* create if nonexistant */ #define O_TRUNC 0x00000400 /* truncate to zero length */ #define O_EXCL 0x00000800 /* error if already exists */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define O_EVTONLY 0x00008000 /* descriptor requested for event notifications only */ #endif #define O_NOCTTY 0x00020000 /* don't assign controlling terminal */ #if __DARWIN_C_LEVEL >= 200809L #define O_DIRECTORY 0x00100000 #endif #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define O_SYMLINK 0x00200000 /* allow open of a symlink */ #endif // O_DSYNC 0x00400000 /* synch I/O data integrity */ #include #if __DARWIN_C_LEVEL >= 200809L #define O_CLOEXEC 0x01000000 /* implicitly set FD_CLOEXEC */ #endif #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL #define O_NOFOLLOW_ANY 0x20000000 /* no symlinks allowed in path */ #endif #if __DARWIN_C_LEVEL >= 200809L /* * Descriptor value for the current working directory */ #define AT_FDCWD -2 /* * Flags for the at functions */ #define AT_EACCESS 0x0010 /* Use effective ids in access check */ #define AT_SYMLINK_NOFOLLOW 0x0020 /* Act on the symlink itself not the target */ #define AT_SYMLINK_FOLLOW 0x0040 /* Act on target of symlink */ #define AT_REMOVEDIR 0x0080 /* Path refers to directory */ #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL #define AT_REALDEV 0x0200 /* Return real device inodes resides on for fstatat(2) */ #define AT_FDONLY 0x0400 /* Use only the fd and Ignore the path for fstatat(2) */ #endif #endif /* Data Protection Flags */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define O_DP_GETRAWENCRYPTED 0x0001 #define O_DP_GETRAWUNENCRYPTED 0x0002 #endif /* * The O_* flags used to have only F* names, which were used in the kernel * and by fcntl. We retain the F* names for the kernel f_flags field * and for backward compatibility for fcntl. */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define FAPPEND O_APPEND /* kernel/compat */ #define FASYNC O_ASYNC /* kernel/compat */ #define FFSYNC O_FSYNC /* kernel */ #define FFDSYNC O_DSYNC /* kernel */ #define FNONBLOCK O_NONBLOCK /* kernel */ #define FNDELAY O_NONBLOCK /* compat */ #define O_NDELAY O_NONBLOCK /* compat */ #endif /* * Flags used for copyfile(2) */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define CPF_OVERWRITE 0x0001 #define CPF_IGNORE_MODE 0x0002 #define CPF_MASK (CPF_OVERWRITE|CPF_IGNORE_MODE) #endif /* * Constants used for fcntl(2) */ /* command values */ #define F_DUPFD 0 /* duplicate file descriptor */ #define F_GETFD 1 /* get file descriptor flags */ #define F_SETFD 2 /* set file descriptor flags */ #define F_GETFL 3 /* get file status flags */ #define F_SETFL 4 /* set file status flags */ #define F_GETOWN 5 /* get SIGIO/SIGURG proc/pgrp */ #define F_SETOWN 6 /* set SIGIO/SIGURG proc/pgrp */ #define F_GETLK 7 /* get record locking information */ #define F_SETLK 8 /* set record locking information */ #define F_SETLKW 9 /* F_SETLK; wait if blocked */ #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL #define F_SETLKWTIMEOUT 10 /* F_SETLK; wait if blocked, return on timeout */ #endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define F_FLUSH_DATA 40 #define F_CHKCLEAN 41 /* Used for regression test */ #define F_PREALLOCATE 42 /* Preallocate storage */ #define F_SETSIZE 43 /* Truncate a file. Equivalent to calling truncate(2) */ #define F_RDADVISE 44 /* Issue an advisory read async with no copy to user */ #define F_RDAHEAD 45 /* turn read ahead off/on for this fd */ /* * 46,47 used to be F_READBOOTSTRAP and F_WRITEBOOTSTRAP */ #define F_NOCACHE 48 /* turn data caching off/on for this fd */ #define F_LOG2PHYS 49 /* file offset to device offset */ #define F_GETPATH 50 /* return the full path of the fd */ #define F_FULLFSYNC 51 /* fsync + ask the drive to flush to the media */ #define F_PATHPKG_CHECK 52 /* find which component (if any) is a package */ #define F_FREEZE_FS 53 /* "freeze" all fs operations */ #define F_THAW_FS 54 /* "thaw" all fs operations */ #define F_GLOBAL_NOCACHE 55 /* turn data caching off/on (globally) for this file */ #define F_ADDSIGS 59 /* add detached signatures */ #define F_ADDFILESIGS 61 /* add signature from same file (used by dyld for shared libs) */ #define F_NODIRECT 62 /* used in conjunction with F_NOCACHE to indicate that DIRECT, synchonous writes */ /* should not be used (i.e. its ok to temporaily create cached pages) */ #define F_GETPROTECTIONCLASS 63 /* Get the protection class of a file from the EA, returns int */ #define F_SETPROTECTIONCLASS 64 /* Set the protection class of a file for the EA, requires int */ #define F_LOG2PHYS_EXT 65 /* file offset to device offset, extended */ #define F_GETLKPID 66 /* See man fcntl(2) F_GETLK * Similar to F_GETLK but in addition l_pid is treated as an input parameter * which is used as a matching value when searching locks on the file * so that only locks owned by the process with pid l_pid are returned. * However, any flock(2) type lock will also be found with the returned value * of l_pid set to -1 (as with F_GETLK). */ /* See F_DUPFD_CLOEXEC below for 67 */ #define F_SETBACKINGSTORE 70 /* Mark the file as being the backing store for another filesystem */ #define F_GETPATH_MTMINFO 71 /* return the full path of the FD, but error in specific mtmd circumstances */ #define F_GETCODEDIR 72 /* Returns the code directory, with associated hashes, to the caller */ #define F_SETNOSIGPIPE 73 /* No SIGPIPE generated on EPIPE */ #define F_GETNOSIGPIPE 74 /* Status of SIGPIPE for this fd */ #define F_TRANSCODEKEY 75 /* For some cases, we need to rewrap the key for AKS/MKB */ #define F_SINGLE_WRITER 76 /* file being written to a by single writer... if throttling enabled, writes */ /* may be broken into smaller chunks with throttling in between */ #define F_GETPROTECTIONLEVEL 77 /* Get the protection version number for this filesystem */ #define F_FINDSIGS 78 /* Add detached code signatures (used by dyld for shared libs) */ #define F_ADDFILESIGS_FOR_DYLD_SIM 83 /* Add signature from same file, only if it is signed by Apple (used by dyld for simulator) */ #define F_BARRIERFSYNC 85 /* fsync + issue barrier to drive */ #define F_ADDFILESIGS_RETURN 97 /* Add signature from same file, return end offset in structure on success */ #define F_CHECK_LV 98 /* Check if Library Validation allows this Mach-O file to be mapped into the calling process */ #define F_PUNCHHOLE 99 /* Deallocate a range of the file */ #define F_TRIM_ACTIVE_FILE 100 /* Trim an active file */ #define F_SPECULATIVE_READ 101 /* Synchronous advisory read fcntl for regular and compressed file */ #define F_GETPATH_NOFIRMLINK 102 /* return the full path without firmlinks of the fd */ #define F_ADDFILESIGS_INFO 103 /* Add signature from same file, return information */ #define F_ADDFILESUPPL 104 /* Add supplemental signature from same file with fd reference to original */ #define F_GETSIGSINFO 105 /* Look up code signature information attached to a file or slice */ // FS-specific fcntl()'s numbers begin at 0x00010000 and go up #define FCNTL_FS_SPECIFIC_BASE 0x00010000 #endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */ #if __DARWIN_C_LEVEL >= 200809L #define F_DUPFD_CLOEXEC 67 /* mark the dup with FD_CLOEXEC */ #endif /* file descriptor flags (F_GETFD, F_SETFD) */ #define FD_CLOEXEC 1 /* close-on-exec flag */ /* record locking flags (F_GETLK, F_SETLK, F_SETLKW) */ #define F_RDLCK 1 /* shared or read lock */ #define F_UNLCK 2 /* unlock */ #define F_WRLCK 3 /* exclusive or write lock */ /* * [XSI] The values used for l_whence shall be defined as described * in */ #include /* * [XSI] The symbolic names for file modes for use as values of mode_t * shall be defined as described in */ #include #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) /* allocate flags (F_PREALLOCATE) */ #define F_ALLOCATECONTIG 0x00000002 /* allocate contigious space */ #define F_ALLOCATEALL 0x00000004 /* allocate all requested space or no space at all */ /* Position Modes (fst_posmode) for F_PREALLOCATE */ #define F_PEOFPOSMODE 3 /* Make it past all of the SEEK pos modes so that */ /* we can keep them in sync should we desire */ #define F_VOLPOSMODE 4 /* specify volume starting postion */ #endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */ /* * Advisory file segment locking data type - * information passed to system by user */ struct flock { off_t l_start; /* starting offset */ off_t l_len; /* len = 0 means until end of file */ pid_t l_pid; /* lock owner */ short l_type; /* lock type: read/write, etc. */ short l_whence; /* type of l_start */ }; #include #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL /* * Advisory file segment locking with time out - * Information passed to system by user for F_SETLKWTIMEOUT */ struct flocktimeout { struct flock fl; /* flock passed for file locking */ struct timespec timeout; /* timespec struct for timeout */ }; #endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) /* * advisory file read data type - * information passed by user to system */ struct radvisory { off_t ra_offset; int ra_count; }; /* * detached code signatures data type - * information passed by user to system used by F_ADDSIGS and F_ADDFILESIGS. * F_ADDFILESIGS is a shortcut for files that contain their own signature and * doesn't require mapping of the file in order to load the signature. */ #define USER_FSIGNATURES_CDHASH_LEN 20 typedef struct fsignatures { off_t fs_file_start; void *fs_blob_start; size_t fs_blob_size; /* The following fields are only applicable to F_ADDFILESIGS_INFO (64bit only). */ /* Prior to F_ADDFILESIGS_INFO, this struct ended after fs_blob_size. */ size_t fs_fsignatures_size;// input: size of this struct (for compatibility) char fs_cdhash[USER_FSIGNATURES_CDHASH_LEN]; // output: cdhash int fs_hash_type;// output: hash algorithm type for cdhash } fsignatures_t; typedef struct fsupplement { off_t fs_file_start; /* offset of Mach-O image in FAT file */ off_t fs_blob_start; /* offset of signature in Mach-O image */ size_t fs_blob_size; /* signature blob size */ int fs_orig_fd; /* address of original image */ } fsupplement_t; /* * DYLD needs to check if the object is allowed to be combined * into the main binary. This is done between the code signature * is loaded and dyld is doing all the work to process the LOAD commands. * * While this could be done in F_ADDFILESIGS.* family the hook into * the MAC module doesn't say no when LV isn't enabled and then that * is cached on the vnode, and the MAC module never gets change once * a process that library validation enabled. */ typedef struct fchecklv { off_t lv_file_start; size_t lv_error_message_size; void *lv_error_message; } fchecklv_t; /* At this time F_GETSIGSINFO can only indicate platformness. * As additional requestable information is defined, new keys will be added and the * fgetsigsinfo_t structure will be lengthened to add space for the additional information */ #define GETSIGSINFO_PLATFORM_BINARY 1 /* fgetsigsinfo_t used by F_GETSIGSINFO command */ typedef struct fgetsigsinfo { off_t fg_file_start; /* IN: Offset in the file to look for a signature, -1 for any signature */ int fg_info_request; /* IN: Key indicating the info requested */ int fg_sig_is_platform; /* OUT: 1 if the signature is a plat form binary, 0 if not */ } fgetsigsinfo_t; /* lock operations for flock(2) */ #define LOCK_SH 0x01 /* shared file lock */ #define LOCK_EX 0x02 /* exclusive file lock */ #define LOCK_NB 0x04 /* don't block when locking */ #define LOCK_UN 0x08 /* unlock file */ /* fstore_t type used by F_PREALLOCATE command */ typedef struct fstore { unsigned int fst_flags; /* IN: flags word */ int fst_posmode; /* IN: indicates use of offset field */ off_t fst_offset; /* IN: start of the region */ off_t fst_length; /* IN: size of the region */ off_t fst_bytesalloc; /* OUT: number of bytes allocated */ } fstore_t; /* fpunchhole_t used by F_PUNCHHOLE */ typedef struct fpunchhole { unsigned int fp_flags; /* unused */ unsigned int reserved; /* (to maintain 8-byte alignment) */ off_t fp_offset; /* IN: start of the region */ off_t fp_length; /* IN: size of the region */ } fpunchhole_t; /* factive_file_trim_t used by F_TRIM_ACTIVE_FILE */ typedef struct ftrimactivefile { off_t fta_offset; /* IN: start of the region */ off_t fta_length; /* IN: size of the region */ } ftrimactivefile_t; /* fspecread_t used by F_SPECULATIVE_READ */ typedef struct fspecread { unsigned int fsr_flags; /* IN: flags word */ unsigned int reserved; /* to maintain 8-byte alignment */ off_t fsr_offset; /* IN: start of the region */ off_t fsr_length; /* IN: size of the region */ } fspecread_t; /* fbootstraptransfer_t used by F_READBOOTSTRAP and F_WRITEBOOTSTRAP commands */ typedef struct fbootstraptransfer { off_t fbt_offset; /* IN: offset to start read/write */ size_t fbt_length; /* IN: number of bytes to transfer */ void *fbt_buffer; /* IN: buffer to be read/written */ } fbootstraptransfer_t; /* * For F_LOG2PHYS this information is passed back to user * Currently only devoffset is returned - that is the VOP_BMAP * result - the disk device address corresponding to the * current file offset (likely set with an lseek). * * The flags could hold an indication of whether the # of * contiguous bytes reflects the true extent length on disk, * or is an advisory value that indicates there is at least that * many bytes contiguous. For some filesystems it might be too * inefficient to provide anything beyond the advisory value. * Flags and contiguous bytes return values are not yet implemented. * For them the fcntl will nedd to switch from using BMAP to CMAP * and a per filesystem type flag will be needed to interpret the * contiguous bytes count result from CMAP. * * F_LOG2PHYS_EXT is a variant of F_LOG2PHYS that uses a passed in * file offset and length instead of the current file offset. * F_LOG2PHYS_EXT operates on the same structure as F_LOG2PHYS, but * treats it as an in/out. */ #pragma pack(4) struct log2phys { unsigned int l2p_flags; /* unused so far */ off_t l2p_contigbytes; /* F_LOG2PHYS: unused so far */ /* F_LOG2PHYS_EXT: IN: number of bytes to be queried */ /* OUT: number of contiguous bytes at this position */ off_t l2p_devoffset; /* F_LOG2PHYS: OUT: bytes into device */ /* F_LOG2PHYS_EXT: IN: bytes into file */ /* OUT: bytes into device */ }; #pragma pack() #define O_POPUP 0x80000000 /* force window to popup on open */ #define O_ALERT 0x20000000 /* small, clean popup window */ #endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #include typedef enum { FILESEC_OWNER = 1, FILESEC_GROUP = 2, FILESEC_UUID = 3, FILESEC_MODE = 4, FILESEC_ACL = 5, FILESEC_GRPUUID = 6, /* XXX these are private to the implementation */ FILESEC_ACL_RAW = 100, FILESEC_ACL_ALLOCSIZE = 101 } filesec_property_t; /* XXX backwards compatibility */ #define FILESEC_GUID FILESEC_UUID #endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */ __BEGIN_DECLS int open(const char *, int, ...) __DARWIN_ALIAS_C(open); #if __DARWIN_C_LEVEL >= 200809L int openat(int, const char *, int, ...) __DARWIN_NOCANCEL(openat) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0); #endif int creat(const char *, mode_t) __DARWIN_ALIAS_C(creat); int fcntl(int, int, ...) __DARWIN_ALIAS_C(fcntl); #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) int openx_np(const char *, int, filesec_t); /* * data-protected non-portable open(2) : * int open_dprotected_np(user_addr_t path, int flags, int class, int dpflags, int mode) */ int open_dprotected_np( const char *, int, int, int, ...); int flock(int, int); filesec_t filesec_init(void); filesec_t filesec_dup(filesec_t); void filesec_free(filesec_t); int filesec_get_property(filesec_t, filesec_property_t, void *); int filesec_query_property(filesec_t, filesec_property_t, int *); int filesec_set_property(filesec_t, filesec_property_t, const void *); int filesec_unset_property(filesec_t, filesec_property_t) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2); #define _FILESEC_UNSET_PROPERTY ((void *)0) #define _FILESEC_REMOVE_ACL ((void *)1) #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ __END_DECLS #endif /* !_SYS_FCNTL_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/file.h ================================================ /* * Copyright (c) 2000-2008 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@ */ /* Copyright (c) 1995, 1997 Apple Computer, Inc. All Rights Reserved */ /* * Copyright (c) 1982, 1986, 1989, 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. * * @(#)file.h 8.3 (Berkeley) 1/9/95 */ #ifndef _SYS_FILE_H_ #define _SYS_FILE_H_ #include #include #include #include #include #include #ifndef _KAUTH_CRED_T #define _KAUTH_CRED_T struct ucred; typedef struct ucred *kauth_cred_t; struct posix_cred; typedef struct posix_cred *posix_cred_t; #endif /* !_KAUTH_CRED_T */ __BEGIN_DECLS __END_DECLS #endif /* !_SYS_FILE_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/filedesc.h ================================================ /* * Copyright (c) 2000-2012 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@ */ /* Copyright (c) 1995, 1997 Apple 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. * * @(#)filedesc.h 8.1 (Berkeley) 6/2/93 */ #ifndef _SYS_FILEDESC_H_ #define _SYS_FILEDESC_H_ #include /* * This structure is used for the management of descriptors. It may be * shared by multiple processes. * * A process is initially started out with NDFILE descriptors [XXXstored within * this structureXXX], selected to be enough for typical applications based on * the historical limit of 20 open files (and the usage of descriptors by * shells). If these descriptors are exhausted, a larger descriptor table * may be allocated, up to a process' resource limit; [XXXthe internal arrays * are then unusedXXX]. The initial expansion is set to NDEXTENT; each time * it runs out, it is doubled until the resource limit is reached. NDEXTENT * should be selected to be the biggest multiple of OFILESIZE (see below) * that will fit in a power-of-two sized piece of memory. */ #define NDFILE 25 /* 125 bytes */ #define NDEXTENT 50 /* 250 bytes in 256-byte alloc. */ #endif /* !_SYS_FILEDESC_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/filio.h ================================================ /* * 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@ */ /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */ /*- * Copyright (c) 1982, 1986, 1990, 1993, 1994 * 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. * * @(#)filio.h 8.1 (Berkeley) 3/28/94 */ #ifndef _SYS_FILIO_H_ #define _SYS_FILIO_H_ #include /* Generic file-descriptor ioctl's. */ #define FIOCLEX _IO('f', 1) /* set close on exec on fd */ #define FIONCLEX _IO('f', 2) /* remove close on exec */ #define FIONREAD _IOR('f', 127, int) /* get # bytes to read */ #define FIONBIO _IOW('f', 126, int) /* set/clear non-blocking i/o */ #define FIOASYNC _IOW('f', 125, int) /* set/clear async i/o */ #define FIOSETOWN _IOW('f', 124, int) /* set owner */ #define FIOGETOWN _IOR('f', 123, int) /* get owner */ #define FIODTYPE _IOR('f', 122, int) /* get d_type */ #endif /* !_SYS_FILIO_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/fsgetpath.h ================================================ /* * Copyright (c) 2008-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 _FSGETPATH_H_ #define _FSGETPATH_H_ #include #include #include #include #include <_types/_uint64_t.h> #include __BEGIN_DECLS /* * Obtain the full pathname of a file system object by id. */ ssize_t fsgetpath(char *, size_t, fsid_t *, uint64_t) __OSX_AVAILABLE(10.13) __IOS_AVAILABLE(11.0) __TVOS_AVAILABLE(11.0) __WATCHOS_AVAILABLE(4.0); __END_DECLS #endif /* !_FSGETPATH_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/gmon.h ================================================ /* * 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@ */ /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */ /*- * Copyright (c) 1982, 1986, 1992, 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. * * @(#)gmon.h 8.2 (Berkeley) 1/4/94 */ #ifndef _SYS_GMON_H_ #define _SYS_GMON_H_ #include #include /* * Structure prepended to gmon.out profiling data file. */ struct gmonhdr { uint32_t lpc; /* base pc address of sample buffer */ uint32_t hpc; /* max pc address of sampled buffer */ uint32_t ncnt; /* size of sample buffer (plus this header) */ int32_t version; /* version number */ int32_t profrate; /* profiling clock rate */ int32_t spare[3]; /* reserved */ }; #define GMONVERSION 0x00051879 struct gmonhdr_64 { uint64_t lpc; /* base pc address of sample buffer */ uint64_t hpc; /* max pc address of sampled buffer */ uint32_t ncnt; /* size of sample buffer (plus this header) */ int32_t version; /* version number */ int32_t profrate; /* profiling clock rate */ int32_t spare[3]; /* reserved */ }; typedef struct #ifndef __LP64__ gmonhdr #else gmonhdr_64 #endif gmonhdr_t; /* * histogram counters are unsigned shorts (according to the kernel). */ #define HISTCOUNTER unsigned short /* * fraction of text space to allocate for histogram counters here, 1/2 */ #define HISTFRACTION 2 /* * Fraction of text space to allocate for from hash buckets. * The value of HASHFRACTION is based on the minimum number of bytes * of separation between two subroutine call points in the object code. * Given MIN_SUBR_SEPARATION bytes of separation the value of * HASHFRACTION is calculated as: * * HASHFRACTION = MIN_SUBR_SEPARATION / (2 * sizeof(short) - 1); * * For example, on the VAX, the shortest two call sequence is: * * calls $0,(r0) * calls $0,(r0) * * which is separated by only three bytes, thus HASHFRACTION is * calculated as: * * HASHFRACTION = 3 / (2 * 2 - 1) = 1 * * Note that the division above rounds down, thus if MIN_SUBR_FRACTION * is less than three, this algorithm will not work! * * In practice, however, call instructions are rarely at a minimal * distance. Hence, we will define HASHFRACTION to be 2 across all * architectures. This saves a reasonable amount of space for * profiling data structures without (in practice) sacrificing * any granularity. */ #define HASHFRACTION 2 /* * percent of text space to allocate for tostructs with a minimum. */ #define ARCDENSITY 2 #define MINARCS 50 #define MAXARCS ((1 << (8 * sizeof(HISTCOUNTER))) - 2) struct tostruct { uint32_t selfpc; int32_t count; uint16_t link; uint16_t order; }; struct tostruct_64 { uint64_t selfpc; int32_t count; uint16_t link; uint16_t order; }; typedef struct #ifndef __LP64__ tostruct #else tostruct_64 #endif tostruct_t; /* * a raw arc, with pointers to the calling site and * the called site and a count. */ struct rawarc { uint32_t raw_frompc; uint32_t raw_selfpc; int32_t raw_count; }; struct rawarc_64 { uint64_t raw_frompc; uint64_t raw_selfpc; int32_t raw_count; }; typedef struct #ifndef __LP64__ rawarc #else rawarc_64 #endif rawarc_t; /* * general rounding functions. */ #define ROUNDDOWN(x, y) (((x)/(y))*(y)) #define ROUNDUP(x, y) ((((x)+(y)-1)/(y))*(y)) /* * The profiling data structures are housed in this structure. */ struct gmonparam { int state; u_short *kcount; u_long kcountsize; u_short *froms; u_long fromssize; tostruct_t *tos; u_long tossize; long tolimit; u_long lowpc; u_long highpc; u_long textsize; u_long hashfraction; }; extern struct gmonparam _gmonparam; /* * Possible states of profiling. */ #define GMON_PROF_ON 0 #define GMON_PROF_BUSY 1 #define GMON_PROF_ERROR 2 #define GMON_PROF_OFF 3 /* * In order to support more information than in the original mon.out and * gmon.out files there is an alternate gmon.out file format. The alternate * gmon.out file format starts with a magic number then separates the * information with gmon_data_t's. */ #define GMON_MAGIC 0xbeefbabe #define GMON_MAGIC_64 0xbeefbabf typedef struct gmon_data { uint32_t type; /* constant for type of data following this struct */ uint32_t size; /* size in bytes of the data following this struct */ } gmon_data_t; /* * The GMONTYPE_SAMPLES gmon_data.type is for the histogram counters described * above and has a gmonhdr_t followed by the counters. */ #define GMONTYPE_SAMPLES 1 /* * The GMONTYPE_RAWARCS gmon_data.type is for the raw arcs described above. */ #define GMONTYPE_RAWARCS 2 /* * The GMONTYPE_ARCS_ORDERS gmon_data.type is for the raw arcs with a call * order field. The order is the order is a sequence number for the order each * call site was executed. Raw_order values start at 1 not zero. Other than * the raw_order field this is the same information as in the rawarc_t. */ #define GMONTYPE_ARCS_ORDERS 3 struct rawarc_order { uint32_t raw_frompc; uint32_t raw_selfpc; uint32_t raw_count; uint32_t raw_order; }; struct rawarc_order_64 { uint64_t raw_frompc; uint64_t raw_selfpc; uint32_t raw_count; uint32_t raw_order; }; typedef struct #ifndef __LP64__ rawarc_order #else rawarc_order_64 #endif rawarc_order_t; /* * The GMONTYPE_DYLD_STATE gmon_data.type is for the dynamic link editor state * of the program. * The informations starts with an uint32_t with the count of states: * image_count * Then each state follows in the file. The state is made up of * vmaddr_slide (the amount dyld slid this image from it's vmaddress) * name (the file name dyld loaded this image from) * The vmaddr_slide is a 32-bit value for 32-bit programs and 64-bit value for * 64-bit programs. */ #define GMONTYPE_DYLD_STATE 4 /* * The GMONTYPE_DYLD2_STATE gmon_data.type is for the dynamic link editor state * of the program. * The informations starts with an uint32_t with the count of states: * image_count * Then each state follows in the file. The state is made up of * image_header (the address where dyld loaded this image) * name (the file name dyld loaded this image from) * The image_header is a 32-bit value for 32-bit programs and 64-bit value for * 64-bit programs. */ #define GMONTYPE_DYLD2_STATE 5 #endif /* !_SYS_GMON_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/ioccom.h ================================================ /* * 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@ */ /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */ /*- * Copyright (c) 1982, 1986, 1990, 1993, 1994 * 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. * * @(#)ioccom.h 8.2 (Berkeley) 3/28/94 */ #ifndef _SYS_IOCCOM_H_ #define _SYS_IOCCOM_H_ #include /* * Ioctl's have the command encoded in the lower word, and the size of * any in or out parameters in the upper word. The high 3 bits of the * upper word are used to encode the in/out status of the parameter. */ #define IOCPARM_MASK 0x1fff /* parameter length, at most 13 bits */ #define IOCPARM_LEN(x) (((x) >> 16) & IOCPARM_MASK) #define IOCBASECMD(x) ((x) & ~(IOCPARM_MASK << 16)) #define IOCGROUP(x) (((x) >> 8) & 0xff) #define IOCPARM_MAX (IOCPARM_MASK + 1) /* max size of ioctl args */ /* no parameters */ #define IOC_VOID (__uint32_t)0x20000000 /* copy parameters out */ #define IOC_OUT (__uint32_t)0x40000000 /* copy parameters in */ #define IOC_IN (__uint32_t)0x80000000 /* copy parameters in and out */ #define IOC_INOUT (IOC_IN|IOC_OUT) /* mask for IN/OUT/VOID */ #define IOC_DIRMASK (__uint32_t)0xe0000000 #define _IOC(inout, group, num, len) \ (inout | ((len & IOCPARM_MASK) << 16) | ((group) << 8) | (num)) #define _IO(g, n) _IOC(IOC_VOID, (g), (n), 0) #define _IOR(g, n, t) _IOC(IOC_OUT, (g), (n), sizeof(t)) #define _IOW(g, n, t) _IOC(IOC_IN, (g), (n), sizeof(t)) /* this should be _IORW, but stdio got there first */ #define _IOWR(g, n, t) _IOC(IOC_INOUT, (g), (n), sizeof(t)) #endif /* !_SYS_IOCCOM_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/ioctl.h ================================================ /* * 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@ */ /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */ /*- * Copyright (c) 1982, 1986, 1990, 1993, 1994 * 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. * * @(#)ioctl.h 8.6 (Berkeley) 3/28/94 */ #ifndef _SYS_IOCTL_H_ #define _SYS_IOCTL_H_ #include /* * Pun for SunOS prior to 3.2. SunOS 3.2 and later support TIOCGWINSZ * and TIOCSWINSZ (yes, even 3.2-3.5, the fact that it wasn't documented * nonwithstanding). */ struct ttysize { unsigned short ts_lines; unsigned short ts_cols; unsigned short ts_xxx; unsigned short ts_yyy; }; #define TIOCGSIZE TIOCGWINSZ #define TIOCSSIZE TIOCSWINSZ #include #include #include #include __BEGIN_DECLS int ioctl(int, unsigned long, ...); __END_DECLS #endif /* !_SYS_IOCTL_H_ */ /* * Keep outside _SYS_IOCTL_H_ * Compatability with old terminal driver * * Source level -> #define USE_OLD_TTY * Kernel level -> always on */ #if defined(USE_OLD_TTY) || defined(BSD_KERNEL_PRIVATE) #include #endif /* defined(USE_OLD_TTY) || defined(BSD_KERNEL_PRIVATE) */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/ioctl_compat.h ================================================ /* * 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@ */ /* Copyright (c) 1995 NeXT Computer, 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. * * @(#)ioctl_compat.h 8.4 (Berkeley) 1/21/94 */ #ifndef _SYS_IOCTL_COMPAT_H_ #define _SYS_IOCTL_COMPAT_H_ #include #include struct tchars { char t_intrc; /* interrupt */ char t_quitc; /* quit */ char t_startc; /* start output */ char t_stopc; /* stop output */ char t_eofc; /* end-of-file */ char t_brkc; /* input delimiter (like nl) */ }; struct ltchars { char t_suspc; /* stop process signal */ char t_dsuspc; /* delayed stop process signal */ char t_rprntc; /* reprint line */ char t_flushc; /* flush output (toggles) */ char t_werasc; /* word erase */ char t_lnextc; /* literal next character */ }; /* * Structure for TIOCGETP and TIOCSETP ioctls. */ #ifndef _SGTTYB_ #define _SGTTYB_ struct sgttyb { char sg_ispeed; /* input speed */ char sg_ospeed; /* output speed */ char sg_erase; /* erase character */ char sg_kill; /* kill character */ short sg_flags; /* mode flags */ }; #endif #ifdef USE_OLD_TTY # undef TIOCGETD # define TIOCGETD _IOR('t', 0, int) /* get line discipline */ # undef TIOCSETD # define TIOCSETD _IOW('t', 1, int) /* set line discipline */ #else # define OTIOCGETD _IOR('t', 0, int) /* get line discipline */ # define OTIOCSETD _IOW('t', 1, int) /* set line discipline */ #endif #define TIOCHPCL _IO('t', 2) /* hang up on last close */ #define TIOCGETP _IOR('t', 8,struct sgttyb)/* get parameters -- gtty */ #define TIOCSETP _IOW('t', 9,struct sgttyb)/* set parameters -- stty */ #define TIOCSETN _IOW('t',10,struct sgttyb)/* as above, but no flushtty*/ #define TIOCSETC _IOW('t',17,struct tchars)/* set special characters */ #define TIOCGETC _IOR('t',18,struct tchars)/* get special characters */ #define TANDEM 0x00000001 /* send stopc on out q full */ #define CBREAK 0x00000002 /* half-cooked mode */ #define LCASE 0x00000004 /* simulate lower case */ #define ECHO 0x00000008 /* echo input */ #define CRMOD 0x00000010 /* map \r to \r\n on output */ #define RAW 0x00000020 /* no i/o processing */ #define ODDP 0x00000040 /* get/send odd parity */ #define EVENP 0x00000080 /* get/send even parity */ #define ANYP 0x000000c0 /* get any parity/send none */ #define NLDELAY 0x00000300 /* \n delay */ #define TBDELAY 0x00000c00 /* horizontal tab delay */ #define XTABS 0x00000c00 /* expand tabs on output */ #define CRDELAY 0x00003000 /* \r delay */ #define VTDELAY 0x00004000 /* vertical tab delay */ #define BSDELAY 0x00008000 /* \b delay */ #ifndef _SYS_TERMIOS_H_ /* * These manifest constants have the same names as those in , * so you are not permitted to have both definitions in scope simultaneously * in the same compilation unit. */ #define NL0 0x00000000 #define NL1 0x00000100 /* tty 37 */ #define NL2 0x00000200 /* vt05 */ #define NL3 0x00000300 #define TAB0 0x00000000 #define TAB1 0x00000400 /* tty 37 */ #define TAB2 0x00000800 #define CR0 0x00000000 #define CR1 0x00001000 /* tn 300 */ #define CR2 0x00002000 /* tty 37 */ #define CR3 0x00003000 /* concept 100 */ #define FF0 0x00000000 #define FF1 0x00004000 /* tty 37 */ #define BS0 0x00000000 #define BS1 0x00008000 #endif /* !_SYS_TERMIOS_H_ */ #define ALLDELAY (NLDELAY|TBDELAY|CRDELAY|VTDELAY|BSDELAY) #define CRTBS 0x00010000 /* do backspacing for crt */ #define PRTERA 0x00020000 /* \ ... / erase */ #define CRTERA 0x00040000 /* " \b " to wipe out char */ #define TILDE 0x00080000 /* hazeltine tilde kludge */ #define MDMBUF 0x00100000 /*start/stop output on carrier*/ #define LITOUT 0x00200000 /* literal output */ #define TOSTOP 0x00400000 /*SIGSTOP on background output*/ #define FLUSHO 0x00800000 /* flush output to terminal */ #define NOHANG 0x01000000 /* (no-op) was no SIGHUP on carrier drop */ #define L001000 0x02000000 #define CRTKIL 0x04000000 /* kill line with " \b " */ #define PASS8 0x08000000 #define CTLECH 0x10000000 /* echo control chars as ^X */ #define PENDIN 0x20000000 /* tp->t_rawq needs reread */ #define DECCTQ 0x40000000 /* only ^Q starts after ^S */ #define NOFLSH 0x80000000 /* no output flush on signal */ #define TIOCLBIS _IOW('t', 127, int) /* bis local mode bits */ #define TIOCLBIC _IOW('t', 126, int) /* bic local mode bits */ #define TIOCLSET _IOW('t', 125, int) /* set entire local mode word */ #define TIOCLGET _IOR('t', 124, int) /* get local modes */ #define LCRTBS (CRTBS>>16) #define LPRTERA (PRTERA>>16) #define LCRTERA (CRTERA>>16) #define LTILDE (TILDE>>16) #define LMDMBUF (MDMBUF>>16) #define LLITOUT (LITOUT>>16) #define LTOSTOP (TOSTOP>>16) #define LFLUSHO (FLUSHO>>16) #define LNOHANG (NOHANG>>16) #define LCRTKIL (CRTKIL>>16) #define LPASS8 (PASS8>>16) #define LCTLECH (CTLECH>>16) #define LPENDIN (PENDIN>>16) #define LDECCTQ (DECCTQ>>16) #define LNOFLSH (NOFLSH>>16) #define TIOCSLTC _IOW('t',117,struct ltchars)/* set local special chars*/ #define TIOCGLTC _IOR('t',116,struct ltchars)/* get local special chars*/ #define OTIOCCONS _IO('t', 98) /* for hp300 -- sans int arg */ #define OTTYDISC 0 #define NETLDISC 1 #define NTTYDISC 2 #define TIOCGSID _IOR('t', 99, int) /* For svr4 -- get session id */ #endif /* !_SYS_IOCTL_COMPAT_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/ipc.h ================================================ /* * 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@ */ /* * Copyright (c) 1988 University of Utah. * 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. * * This code is derived from software contributed to Berkeley by * the Systems Programming Group of the University of Utah Computer * Science Department. * * 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. * * @(#)ipc.h 8.4 (Berkeley) 2/19/95 */ /* * SVID compatible ipc.h file */ #ifndef _SYS_IPC_H_ #define _SYS_IPC_H_ #include #include #include /* * [XSI] The uid_t, gid_t, mode_t, and key_t types SHALL be defined as * described in . */ #include #include #include #include #pragma pack(4) /* * Technically, we should force all code references to the new structure * definition, not in just the standards conformance case, and leave the * legacy interface there for binary compatibility only. Currently, we * are only forcing this for programs requesting standards conformance. */ #if __DARWIN_UNIX03 || defined(KERNEL) /* * [XSI] Information used in determining permission to perform an IPC * operation */ struct ipc_perm { uid_t uid; /* [XSI] Owner's user ID */ gid_t gid; /* [XSI] Owner's group ID */ uid_t cuid; /* [XSI] Creator's user ID */ gid_t cgid; /* [XSI] Creator's group ID */ mode_t mode; /* [XSI] Read/write permission */ unsigned short _seq; /* Reserved for internal use */ key_t _key; /* Reserved for internal use */ }; #define __ipc_perm_new ipc_perm #else /* !__DARWIN_UNIX03 */ #define ipc_perm __ipc_perm_old #endif /* !__DARWIN_UNIX03 */ #if !__DARWIN_UNIX03 /* * Legacy structure; this structure is maintained for binary backward * compatability with previous versions of the interface. New code * should not use this interface, since ID values may be truncated. */ struct __ipc_perm_old { __uint16_t cuid; /* Creator's user ID */ __uint16_t cgid; /* Creator's group ID */ __uint16_t uid; /* Owner's user ID */ __uint16_t gid; /* Owner's group ID */ mode_t mode; /* Read/Write permission */ __uint16_t seq; /* Reserved for internal use */ key_t key; /* Reserved for internal use */ }; #endif /* !__DARWIN_UNIX03 */ #pragma pack() /* * [XSI] Definitions shall be provided for the following constants: */ /* Mode bits */ #define IPC_CREAT 001000 /* Create entry if key does not exist */ #define IPC_EXCL 002000 /* Fail if key exists */ #define IPC_NOWAIT 004000 /* Error if request must wait */ /* Keys */ #define IPC_PRIVATE ((key_t)0) /* Private key */ /* Control commands */ #define IPC_RMID 0 /* Remove identifier */ #define IPC_SET 1 /* Set options */ #define IPC_STAT 2 /* Get options */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) /* common mode bits */ #define IPC_R 000400 /* Read permission */ #define IPC_W 000200 /* Write/alter permission */ #define IPC_M 010000 /* Modify control info permission */ #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ __BEGIN_DECLS /* [XSI] */ key_t ftok(const char *, int); __END_DECLS #endif /* !_SYS_IPC_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/kauth.h ================================================ /* * Copyright (c) 2004-2010 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@ */ /* * 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. */ #ifndef _SYS_KAUTH_H #define _SYS_KAUTH_H #include #include #include #include /* u_int8_t, etc. */ #include /* __offsetof() */ #include /* uid_t */ #include /* gid_t */ #include /* NGROUPS_MAX */ #ifdef __APPLE_API_EVOLVING /* * Identities. */ #define KAUTH_UID_NONE (~(uid_t)0 - 100) /* not a valid UID */ #define KAUTH_GID_NONE (~(gid_t)0 - 100) /* not a valid GID */ #include /* NT Security Identifier, structure as defined by Microsoft */ #pragma pack(1) /* push packing of 1 byte */ typedef struct { u_int8_t sid_kind; u_int8_t sid_authcount; u_int8_t sid_authority[6]; #define KAUTH_NTSID_MAX_AUTHORITIES 16 u_int32_t sid_authorities[KAUTH_NTSID_MAX_AUTHORITIES]; } ntsid_t; #pragma pack() /* pop packing to previous packing level */ #define _NTSID_T /* valid byte count inside a SID structure */ #define KAUTH_NTSID_HDRSIZE (8) #define KAUTH_NTSID_SIZE(_s) (KAUTH_NTSID_HDRSIZE + ((_s)->sid_authcount * sizeof(u_int32_t))) /* * External lookup message payload; this structure is shared between the * kernel group membership resolver, and the user space group membership * resolver daemon, and is use to communicate resolution requests from the * kernel to user space, and the result of that request from user space to * the kernel. */ struct kauth_identity_extlookup { u_int32_t el_seqno; /* request sequence number */ u_int32_t el_result; /* lookup result */ #define KAUTH_EXTLOOKUP_SUCCESS 0 /* results here are good */ #define KAUTH_EXTLOOKUP_BADRQ 1 /* request badly formatted */ #define KAUTH_EXTLOOKUP_FAILURE 2 /* transient failure during lookup */ #define KAUTH_EXTLOOKUP_FATAL 3 /* permanent failure during lookup */ #define KAUTH_EXTLOOKUP_INPROG 100 /* request in progress */ u_int32_t el_flags; #define KAUTH_EXTLOOKUP_VALID_UID (1<<0) #define KAUTH_EXTLOOKUP_VALID_UGUID (1<<1) #define KAUTH_EXTLOOKUP_VALID_USID (1<<2) #define KAUTH_EXTLOOKUP_VALID_GID (1<<3) #define KAUTH_EXTLOOKUP_VALID_GGUID (1<<4) #define KAUTH_EXTLOOKUP_VALID_GSID (1<<5) #define KAUTH_EXTLOOKUP_WANT_UID (1<<6) #define KAUTH_EXTLOOKUP_WANT_UGUID (1<<7) #define KAUTH_EXTLOOKUP_WANT_USID (1<<8) #define KAUTH_EXTLOOKUP_WANT_GID (1<<9) #define KAUTH_EXTLOOKUP_WANT_GGUID (1<<10) #define KAUTH_EXTLOOKUP_WANT_GSID (1<<11) #define KAUTH_EXTLOOKUP_WANT_MEMBERSHIP (1<<12) #define KAUTH_EXTLOOKUP_VALID_MEMBERSHIP (1<<13) #define KAUTH_EXTLOOKUP_ISMEMBER (1<<14) #define KAUTH_EXTLOOKUP_VALID_PWNAM (1<<15) #define KAUTH_EXTLOOKUP_WANT_PWNAM (1<<16) #define KAUTH_EXTLOOKUP_VALID_GRNAM (1<<17) #define KAUTH_EXTLOOKUP_WANT_GRNAM (1<<18) #define KAUTH_EXTLOOKUP_VALID_SUPGRPS (1<<19) #define KAUTH_EXTLOOKUP_WANT_SUPGRPS (1<<20) __darwin_pid_t el_info_pid; /* request on behalf of PID */ u_int64_t el_extend; /* extension field */ u_int32_t el_info_reserved_1; /* reserved (APPLE) */ uid_t el_uid; /* user ID */ guid_t el_uguid; /* user GUID */ u_int32_t el_uguid_valid; /* TTL on translation result (seconds) */ ntsid_t el_usid; /* user NT SID */ u_int32_t el_usid_valid; /* TTL on translation result (seconds) */ gid_t el_gid; /* group ID */ guid_t el_gguid; /* group GUID */ u_int32_t el_gguid_valid; /* TTL on translation result (seconds) */ ntsid_t el_gsid; /* group SID */ u_int32_t el_gsid_valid; /* TTL on translation result (seconds) */ u_int32_t el_member_valid; /* TTL on group lookup result */ u_int32_t el_sup_grp_cnt; /* count of supplemental groups up to NGROUPS */ gid_t el_sup_groups[NGROUPS_MAX]; /* supplemental group list */ }; struct kauth_cache_sizes { u_int32_t kcs_group_size; u_int32_t kcs_id_size; }; #define KAUTH_EXTLOOKUP_REGISTER (0) #define KAUTH_EXTLOOKUP_RESULT (1<<0) #define KAUTH_EXTLOOKUP_WORKER (1<<1) #define KAUTH_EXTLOOKUP_DEREGISTER (1<<2) #define KAUTH_GET_CACHE_SIZES (1<<3) #define KAUTH_SET_CACHE_SIZES (1<<4) #define KAUTH_CLEAR_CACHES (1<<5) #define IDENTITYSVC_ENTITLEMENT "com.apple.private.identitysvc" /* * Generic Access Control Lists. */ #if defined(KERNEL) || defined (_SYS_ACL_H) typedef u_int32_t kauth_ace_rights_t; /* Access Control List Entry (ACE) */ struct kauth_ace { guid_t ace_applicable; u_int32_t ace_flags; #define KAUTH_ACE_KINDMASK 0xf #define KAUTH_ACE_PERMIT 1 #define KAUTH_ACE_DENY 2 #define KAUTH_ACE_AUDIT 3 /* not implemented */ #define KAUTH_ACE_ALARM 4 /* not implemented */ #define KAUTH_ACE_INHERITED (1<<4) #define KAUTH_ACE_FILE_INHERIT (1<<5) #define KAUTH_ACE_DIRECTORY_INHERIT (1<<6) #define KAUTH_ACE_LIMIT_INHERIT (1<<7) #define KAUTH_ACE_ONLY_INHERIT (1<<8) #define KAUTH_ACE_SUCCESS (1<<9) /* not implemented (AUDIT/ALARM) */ #define KAUTH_ACE_FAILURE (1<<10) /* not implemented (AUDIT/ALARM) */ /* All flag bits controlling ACE inheritance */ #define KAUTH_ACE_INHERIT_CONTROL_FLAGS \ (KAUTH_ACE_FILE_INHERIT | \ KAUTH_ACE_DIRECTORY_INHERIT | \ KAUTH_ACE_LIMIT_INHERIT | \ KAUTH_ACE_ONLY_INHERIT) kauth_ace_rights_t ace_rights; /* scope specific */ /* These rights are never tested, but may be present in an ACL */ #define KAUTH_ACE_GENERIC_ALL (1<<21) #define KAUTH_ACE_GENERIC_EXECUTE (1<<22) #define KAUTH_ACE_GENERIC_WRITE (1<<23) #define KAUTH_ACE_GENERIC_READ (1<<24) }; #ifndef _KAUTH_ACE #define _KAUTH_ACE typedef struct kauth_ace *kauth_ace_t; #endif /* Access Control List */ struct kauth_acl { u_int32_t acl_entrycount; u_int32_t acl_flags; struct kauth_ace acl_ace[1]; }; /* * XXX this value needs to be raised - 3893388 */ #define KAUTH_ACL_MAX_ENTRIES 128 /* * The low 16 bits of the flags field are reserved for filesystem * internal use and must be preserved by all APIs. This includes * round-tripping flags through user-space interfaces. */ #define KAUTH_ACL_FLAGS_PRIVATE (0xffff) /* * The high 16 bits of the flags are used to store attributes and * to request specific handling of the ACL. */ /* inheritance will be deferred until the first rename operation */ #define KAUTH_ACL_DEFER_INHERIT (1<<16) /* this ACL must not be overwritten as part of an inheritance operation */ #define KAUTH_ACL_NO_INHERIT (1<<17) /* acl_entrycount that tells us the ACL is not valid */ #define KAUTH_FILESEC_NOACL ((u_int32_t)(-1)) /* * If the acl_entrycount field is KAUTH_FILESEC_NOACL, then the size is the * same as a kauth_acl structure; the intent is to put an actual entrycount of * KAUTH_FILESEC_NOACL on disk to distinguish a kauth_filesec_t with an empty * entry (Windows treats this as "deny all") from one that merely indicates a * file group and/or owner guid values. */ #define KAUTH_ACL_SIZE(c) (__offsetof(struct kauth_acl, acl_ace) + ((u_int32_t)(c) != KAUTH_FILESEC_NOACL ? ((c) * sizeof(struct kauth_ace)) : 0)) #define KAUTH_ACL_COPYSIZE(p) KAUTH_ACL_SIZE((p)->acl_entrycount) #ifndef _KAUTH_ACL #define _KAUTH_ACL typedef struct kauth_acl *kauth_acl_t; #endif /* * Extended File Security. */ /* File Security information */ struct kauth_filesec { u_int32_t fsec_magic; #define KAUTH_FILESEC_MAGIC 0x012cc16d guid_t fsec_owner; guid_t fsec_group; struct kauth_acl fsec_acl; }; /* backwards compatibility */ #define fsec_entrycount fsec_acl.acl_entrycount #define fsec_flags fsec_acl.acl_flags #define fsec_ace fsec_acl.acl_ace #define KAUTH_FILESEC_FLAGS_PRIVATE KAUTH_ACL_FLAGS_PRIVATE #define KAUTH_FILESEC_DEFER_INHERIT KAUTH_ACL_DEFER_INHERIT #define KAUTH_FILESEC_NO_INHERIT KAUTH_ACL_NO_INHERIT #define KAUTH_FILESEC_NONE ((kauth_filesec_t)0) #define KAUTH_FILESEC_WANTED ((kauth_filesec_t)1) #ifndef _KAUTH_FILESEC #define _KAUTH_FILESEC typedef struct kauth_filesec *kauth_filesec_t; #endif #define KAUTH_FILESEC_SIZE(c) (__offsetof(struct kauth_filesec, fsec_acl) + __offsetof(struct kauth_acl, acl_ace) + (c) * sizeof(struct kauth_ace)) #define KAUTH_FILESEC_COPYSIZE(p) KAUTH_FILESEC_SIZE(((p)->fsec_entrycount == KAUTH_FILESEC_NOACL) ? 0 : (p)->fsec_entrycount) #define KAUTH_FILESEC_COUNT(s) (((s) - KAUTH_FILESEC_SIZE(0)) / sizeof(struct kauth_ace)) #define KAUTH_FILESEC_VALID(s) ((s) >= KAUTH_FILESEC_SIZE(0) && (((s) - KAUTH_FILESEC_SIZE(0)) % sizeof(struct kauth_ace)) == 0) #define KAUTH_FILESEC_XATTR "com.apple.system.Security" /* Allowable first arguments to kauth_filesec_acl_setendian() */ #define KAUTH_ENDIAN_HOST 0x00000001 /* set host endianness */ #define KAUTH_ENDIAN_DISK 0x00000002 /* set disk endianness */ #endif /* KERNEL || */ /* Actions, also rights bits in an ACE */ #if defined(KERNEL) || defined (_SYS_ACL_H) #define KAUTH_VNODE_READ_DATA (1U<<1) #define KAUTH_VNODE_LIST_DIRECTORY KAUTH_VNODE_READ_DATA #define KAUTH_VNODE_WRITE_DATA (1U<<2) #define KAUTH_VNODE_ADD_FILE KAUTH_VNODE_WRITE_DATA #define KAUTH_VNODE_EXECUTE (1U<<3) #define KAUTH_VNODE_SEARCH KAUTH_VNODE_EXECUTE #define KAUTH_VNODE_DELETE (1U<<4) #define KAUTH_VNODE_APPEND_DATA (1U<<5) #define KAUTH_VNODE_ADD_SUBDIRECTORY KAUTH_VNODE_APPEND_DATA #define KAUTH_VNODE_DELETE_CHILD (1U<<6) #define KAUTH_VNODE_READ_ATTRIBUTES (1U<<7) #define KAUTH_VNODE_WRITE_ATTRIBUTES (1U<<8) #define KAUTH_VNODE_READ_EXTATTRIBUTES (1U<<9) #define KAUTH_VNODE_WRITE_EXTATTRIBUTES (1U<<10) #define KAUTH_VNODE_READ_SECURITY (1U<<11) #define KAUTH_VNODE_WRITE_SECURITY (1U<<12) #define KAUTH_VNODE_TAKE_OWNERSHIP (1U<<13) /* backwards compatibility only */ #define KAUTH_VNODE_CHANGE_OWNER KAUTH_VNODE_TAKE_OWNERSHIP /* For Windows interoperability only */ #define KAUTH_VNODE_SYNCHRONIZE (1U<<20) /* (1<<21) - (1<<24) are reserved for generic rights bits */ /* Actions not expressed as rights bits */ /* * Authorizes the vnode as the target of a hard link. */ #define KAUTH_VNODE_LINKTARGET (1U<<25) /* * Indicates that other steps have been taken to authorise the action, * but authorisation should be denied for immutable objects. */ #define KAUTH_VNODE_CHECKIMMUTABLE (1U<<26) /* Action modifiers */ /* * The KAUTH_VNODE_ACCESS bit is passed to the callback if the authorisation * request in progress is advisory, rather than authoritative. Listeners * performing consequential work (i.e. not strictly checking authorisation) * may test this flag to avoid performing unnecessary work. * * This bit will never be present in an ACE. */ #define KAUTH_VNODE_ACCESS (1U<<31) /* * The KAUTH_VNODE_NOIMMUTABLE bit is passed to the callback along with the * KAUTH_VNODE_WRITE_SECURITY bit (and no others) to indicate that the * caller wishes to change one or more of the immutable flags, and the * state of these flags should not be considered when authorizing the request. * The system immutable flags are only ignored when the system securelevel * is low enough to allow their removal. */ #define KAUTH_VNODE_NOIMMUTABLE (1U<<30) /* * fake right that is composed by the following... * vnode must have search for owner, group and world allowed * plus there must be no deny modes present for SEARCH... this fake * right is used by the fast lookup path to avoid checking * for an exact match on the last credential to lookup * the component being acted on */ #define KAUTH_VNODE_SEARCHBYANYONE (1U<<29) /* * when passed as an 'action' to "vnode_uncache_authorized_actions" * it indicates that all of the cached authorizations for that * vnode should be invalidated */ #define KAUTH_INVALIDATE_CACHED_RIGHTS ((kauth_action_t)~0) /* The expansions of the GENERIC bits at evaluation time */ #define KAUTH_VNODE_GENERIC_READ_BITS (KAUTH_VNODE_READ_DATA | \ KAUTH_VNODE_READ_ATTRIBUTES | \ KAUTH_VNODE_READ_EXTATTRIBUTES | \ KAUTH_VNODE_READ_SECURITY) #define KAUTH_VNODE_GENERIC_WRITE_BITS (KAUTH_VNODE_WRITE_DATA | \ KAUTH_VNODE_APPEND_DATA | \ KAUTH_VNODE_DELETE | \ KAUTH_VNODE_DELETE_CHILD | \ KAUTH_VNODE_WRITE_ATTRIBUTES | \ KAUTH_VNODE_WRITE_EXTATTRIBUTES | \ KAUTH_VNODE_WRITE_SECURITY) #define KAUTH_VNODE_GENERIC_EXECUTE_BITS (KAUTH_VNODE_EXECUTE) #define KAUTH_VNODE_GENERIC_ALL_BITS (KAUTH_VNODE_GENERIC_READ_BITS | \ KAUTH_VNODE_GENERIC_WRITE_BITS | \ KAUTH_VNODE_GENERIC_EXECUTE_BITS) /* * Some sets of bits, defined here for convenience. */ #define KAUTH_VNODE_WRITE_RIGHTS (KAUTH_VNODE_ADD_FILE | \ KAUTH_VNODE_ADD_SUBDIRECTORY | \ KAUTH_VNODE_DELETE_CHILD | \ KAUTH_VNODE_WRITE_DATA | \ KAUTH_VNODE_APPEND_DATA | \ KAUTH_VNODE_DELETE | \ KAUTH_VNODE_WRITE_ATTRIBUTES | \ KAUTH_VNODE_WRITE_EXTATTRIBUTES | \ KAUTH_VNODE_WRITE_SECURITY | \ KAUTH_VNODE_TAKE_OWNERSHIP | \ KAUTH_VNODE_LINKTARGET | \ KAUTH_VNODE_CHECKIMMUTABLE) #endif /* KERNEL || */ #endif /* __APPLE_API_EVOLVING */ #endif /* _SYS_KAUTH_H */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/kdebug.h ================================================ /* * 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@ */ #ifndef BSD_SYS_KDEBUG_H #define BSD_SYS_KDEBUG_H #include #include __BEGIN_DECLS #ifdef __APPLE_API_UNSTABLE /* * Kdebug is a kernel facility for tracing events occurring on a system. User * space processes should prefer os_signpost, instead. * * This header defines reserved debugids, which are 32-bit values that describe * each event: * * +----------------+----------------+----------------------------+----+ * | Class (8) | Subclass (8) | Code (14) |Func| * | | | |(2) | * +----------------+----------------+----------------------------+----+ * \_________________________________/ * ClassSubclass (CSC) * \________________________________________________________________00_/ * Eventid * \___________________________________________________________________/ * Debugid * * The eventid is a hierarchical ID, indicating which components an event is * referring to. The debugid includes an eventid and two function qualifier * bits, to determine the structural significance of an event (whether it * starts or ends an interval). */ #define KDBG_CLASS_MASK (0xff000000) #define KDBG_CLASS_OFFSET (24) #define KDBG_CLASS_MAX (0xff) #define KDBG_SUBCLASS_MASK (0x00ff0000) #define KDBG_SUBCLASS_OFFSET (16) #define KDBG_SUBCLASS_MAX (0xff) /* class and subclass mask */ #define KDBG_CSC_MASK (0xffff0000) #define KDBG_CSC_OFFSET (KDBG_SUBCLASS_OFFSET) #define KDBG_CSC_MAX (0xffff) #define KDBG_CODE_MASK (0x0000fffc) #define KDBG_CODE_OFFSET (2) #define KDBG_CODE_MAX (0x3fff) #define KDBG_EVENTID_MASK (0xfffffffc) #define KDBG_FUNC_MASK (0x00000003) /* Generate an eventid corresponding to Class, SubClass, and Code. */ #define KDBG_EVENTID(Class, SubClass, Code) \ (((unsigned)((Class) & 0xff) << KDBG_CLASS_OFFSET) | \ ((unsigned)((SubClass) & 0xff) << KDBG_SUBCLASS_OFFSET) | \ ((unsigned)((Code) & 0x3fff) << KDBG_CODE_OFFSET)) /* Deprecated macro using old naming convention. */ #define KDBG_CODE(Class, SubClass, Code) \ KDBG_EVENTID(Class, SubClass, Code) /* Extract pieces of the debug code. */ #define KDBG_EXTRACT_CLASS(Debugid) \ ((uint8_t)(((Debugid) & KDBG_CLASS_MASK) >> KDBG_CLASS_OFFSET)) #define KDBG_EXTRACT_SUBCLASS(Debugid) \ ((uint8_t)(((Debugid) & KDBG_SUBCLASS_MASK) >> KDBG_SUBCLASS_OFFSET)) #define KDBG_EXTRACT_CSC(Debugid) \ ((uint16_t)(((Debugid) & KDBG_CSC_MASK) >> KDBG_CSC_OFFSET)) #define KDBG_EXTRACT_CODE(Debugid) \ ((uint16_t)(((Debugid) & KDBG_CODE_MASK) >> KDBG_CODE_OFFSET)) #define KDBG_CLASS_ENCODE(Class, SubClass) KDBG_EVENTID(Class, SubClass, 0) #define KDBG_CLASS_DECODE(Debugid) (Debugid & KDBG_CSC_MASK) /* function qualifiers */ #define DBG_FUNC_START 1U #define DBG_FUNC_END 2U #define DBG_FUNC_NONE 0U /* The Kernel Debug Classes */ #define DBG_MACH 1 #define DBG_NETWORK 2 #define DBG_FSYSTEM 3 #define DBG_BSD 4 #define DBG_IOKIT 5 #define DBG_DRIVERS 6 #define DBG_TRACE 7 #define DBG_DLIL 8 #define DBG_PTHREAD 9 #define DBG_CORESTORAGE 10 #define DBG_CG 11 #define DBG_MONOTONIC 12 #define DBG_MISC 20 #define DBG_SECURITY 30 #define DBG_DYLD 31 #define DBG_QT 32 #define DBG_APPS 33 #define DBG_LAUNCHD 34 #define DBG_SILICON 35 #define DBG_PERF 37 #define DBG_IMPORTANCE 38 #define DBG_BANK 40 #define DBG_XPC 41 #define DBG_ATM 42 #define DBG_ARIADNE 43 #define DBG_DAEMON 44 #define DBG_ENERGYTRACE 45 #define DBG_DISPATCH 46 #define DBG_IMG 49 #define DBG_UMALLOC 51 #define DBG_TURNSTILE 53 #define DBG_AUDIO 54 #define DBG_MIG 255 /* **** The Kernel Debug Sub Classes for Mach (DBG_MACH) **** */ #define DBG_MACH_EXCP_KTRAP_x86 0x02 /* Kernel Traps on x86 */ #define DBG_MACH_EXCP_DFLT 0x03 /* deprecated name */ #define DBG_MACH_EXCP_SYNC_ARM 0x03 /* arm/arm64 synchronous exception */ #define DBG_MACH_EXCP_IFLT 0x04 /* deprecated name */ #define DBG_MACH_EXCP_SERR_ARM 0x04 /* arm/arm64 SError (async) exception */ #define DBG_MACH_EXCP_INTR 0x05 /* Interrupts */ #define DBG_MACH_EXCP_ALNG 0x06 /* Alignment Exception */ #define DBG_MACH_EXCP_UTRAP_x86 0x07 /* User Traps on x86 */ #define DBG_MACH_EXCP_FP 0x08 /* FP Unavail */ #define DBG_MACH_EXCP_DECI 0x09 /* Decrementer Interrupt */ #define DBG_MACH_CHUD 0x0A /* deprecated name */ #define DBG_MACH_SIGNPOST 0x0A /* kernel signposts */ #define DBG_MACH_EXCP_SC 0x0C /* System Calls */ #define DBG_MACH_EXCP_TRACE 0x0D /* Trace exception */ #define DBG_MACH_EXCP_EMUL 0x0E /* Instruction emulated */ #define DBG_MACH_IHDLR 0x10 /* Interrupt Handlers */ #define DBG_MACH_IPC 0x20 /* Inter Process Comm */ #define DBG_MACH_RESOURCE 0x25 /* tracing limits, etc */ #define DBG_MACH_VM 0x30 /* Virtual Memory */ #define DBG_MACH_LEAKS 0x31 /* alloc/free */ #define DBG_MACH_WORKINGSET 0x32 /* private subclass for working set related debugging */ #define DBG_MACH_SCHED 0x40 /* Scheduler */ #define DBG_MACH_MSGID_INVALID 0x50 /* Messages - invalid */ #define DBG_MACH_LOCKS 0x60 /* new lock APIs */ #define DBG_MACH_PMAP 0x70 /* pmap */ #define DBG_MACH_CLOCK 0x80 /* clock */ #define DBG_MACH_MP 0x90 /* MP related */ #define DBG_MACH_VM_PRESSURE 0xA0 /* Memory Pressure Events */ #define DBG_MACH_STACKSHOT 0xA1 /* Stackshot/Microstackshot subsystem */ #define DBG_MACH_SFI 0xA2 /* Selective Forced Idle (SFI) */ #define DBG_MACH_ENERGY_PERF 0xA3 /* Energy/performance resource stats */ #define DBG_MACH_SYSDIAGNOSE 0xA4 /* sysdiagnose */ #define DBG_MACH_ZALLOC 0xA5 /* Zone allocator */ #define DBG_MACH_THREAD_GROUP 0xA6 /* Thread groups */ #define DBG_MACH_COALITION 0xA7 /* Coalitions */ #define DBG_MACH_SHAREDREGION 0xA8 /* Shared region */ #define DBG_MACH_SCHED_CLUTCH 0xA9 /* Clutch scheduler */ #define DBG_MACH_IO 0xAA /* I/O */ #define DBG_MACH_WORKGROUP 0xAB /* Workgroup subsystem */ #define DBG_MACH_HV 0xAC /* Hypervisor subsystem */ #define DBG_MACH_KCOV 0xAD /* Kernel coverage sanitizer */ #define DBG_MACH_MACHDEP_EXCP_SC_x86 0xAE /* Machine Dependent System Calls on x86 */ #define DBG_MACH_MACHDEP_EXCP_SC_ARM 0xAF /* Machine Dependent System Calls on arm */ /* Codes for DBG_MACH_IO */ #define DBC_MACH_IO_MMIO_READ 0x1 #define DBC_MACH_IO_MMIO_WRITE 0x2 #define DBC_MACH_IO_PHYS_READ 0x3 #define DBC_MACH_IO_PHYS_WRITE 0x4 #define DBC_MACH_IO_PORTIO_READ 0x5 #define DBC_MACH_IO_PORTIO_WRITE 0x6 /* Interrupt type bits for DBG_MACH_EXCP_INTR */ #define DBG_INTR_TYPE_UNKNOWN 0x0 /* default/unknown interrupt */ #define DBG_INTR_TYPE_IPI 0x1 /* interprocessor interrupt */ #define DBG_INTR_TYPE_TIMER 0x2 /* timer interrupt */ #define DBG_INTR_TYPE_OTHER 0x3 /* other (usually external) interrupt */ #define DBG_INTR_TYPE_PMI 0x4 /* performance monitor interrupt */ /* Codes for Scheduler (DBG_MACH_SCHED) */ #define MACH_SCHED 0x0 /* Scheduler */ #define MACH_STACK_ATTACH 0x1 /* stack_attach() */ #define MACH_STACK_HANDOFF 0x2 /* stack_handoff() */ #define MACH_CALL_CONT 0x3 /* call_continuation() */ #define MACH_CALLOUT 0x4 /* callouts */ #define MACH_STACK_DETACH 0x5 #define MACH_MAKE_RUNNABLE 0x6 /* make thread runnable */ #define MACH_PROMOTE 0x7 /* promoted due to resource (replaced by MACH_PROMOTED) */ #define MACH_DEMOTE 0x8 /* promotion undone (replaced by MACH_UNPROMOTED) */ #define MACH_IDLE 0x9 /* processor idling */ #define MACH_STACK_DEPTH 0xa /* stack depth at switch */ #define MACH_MOVED 0xb /* did not use original scheduling decision */ #define MACH_PSET_LOAD_AVERAGE 0xc #define MACH_AMP_DEBUG 0xd #define MACH_FAILSAFE 0xe /* tripped fixed-pri/RT failsafe */ #define MACH_BLOCK 0xf /* thread block */ #define MACH_WAIT 0x10 /* thread wait assertion */ #define MACH_GET_URGENCY 0x14 /* Urgency queried by platform */ #define MACH_URGENCY 0x15 /* Urgency (RT/BG/NORMAL) communicated * to platform */ #define MACH_REDISPATCH 0x16 /* "next thread" thread redispatched */ #define MACH_REMOTE_AST 0x17 /* AST signal issued to remote processor */ #define MACH_SCHED_CHOOSE_PROCESSOR 0x18 /* Result of choose_processor */ #define MACH_DEEP_IDLE 0x19 /* deep idle on master processor */ /* unused 0x1a was MACH_SCHED_DECAY_PRIORITY */ #define MACH_CPU_THROTTLE_DISABLE 0x1b /* Global CPU Throttle Disable */ #define MACH_RW_PROMOTE 0x1c /* promoted due to RW lock promotion */ #define MACH_RW_DEMOTE 0x1d /* promotion due to RW lock undone */ #define MACH_SCHED_MAINTENANCE 0x1f /* periodic maintenance thread */ #define MACH_DISPATCH 0x20 /* context switch completed */ #define MACH_QUANTUM_HANDOFF 0x21 /* quantum handoff occurred */ #define MACH_MULTIQ_DEQUEUE 0x22 /* Result of multiq dequeue */ #define MACH_SCHED_THREAD_SWITCH 0x23 /* attempt direct context switch to hinted thread */ #define MACH_SCHED_SMT_BALANCE 0x24 /* SMT load balancing ASTs */ #define MACH_REMOTE_DEFERRED_AST 0x25 /* Deferred AST started against remote processor */ #define MACH_REMOTE_CANCEL_AST 0x26 /* Canceled deferred AST for remote processor */ #define MACH_SCHED_CHANGE_PRIORITY 0x27 /* thread sched priority changed */ #define MACH_SCHED_UPDATE_REC_CORES 0x28 /* Change to recommended processor bitmask */ #define MACH_STACK_WAIT 0x29 /* Thread could not be switched-to because of kernel stack shortage */ #define MACH_THREAD_BIND 0x2a /* Thread was bound (or unbound) to a processor */ #define MACH_WAITQ_PROMOTE 0x2b /* Thread promoted by waitq boost */ #define MACH_WAITQ_DEMOTE 0x2c /* Thread demoted from waitq boost */ #define MACH_SCHED_LOAD 0x2d /* load update */ #define MACH_REC_CORES_FAILSAFE 0x2e /* recommended processor failsafe kicked in */ #define MACH_SCHED_QUANTUM_EXPIRED 0x2f /* thread quantum expired */ #define MACH_EXEC_PROMOTE 0x30 /* Thread promoted by exec boost */ #define MACH_EXEC_DEMOTE 0x31 /* Thread demoted from exec boost */ #define MACH_AMP_SIGNAL_SPILL 0x32 /* AMP spill signal sent to cpuid */ #define MACH_AMP_STEAL 0x33 /* AMP thread stolen or spilled */ #define MACH_SCHED_LOAD_EFFECTIVE 0x34 /* Effective scheduler load */ /* unused MACH_PROMOTED 0x35 was: thread promoted due to mutex priority promotion */ /* unused MACH_UNPROMOTED 0x36 was: thread unpromoted due to mutex priority promotion */ /* unused MACH_PROMOTED_UPDATE 0x37 was: thread already promoted, but promotion priority changed */ #define MACH_QUIESCENT_COUNTER 0x38 /* quiescent counter tick */ #define MACH_TURNSTILE_USER_CHANGE 0x39 /* base priority change because of turnstile */ #define MACH_AMP_RECOMMENDATION_CHANGE 0x3a /* Thread group recommendation change */ #define MACH_AMP_PERFCTL_POLICY_CHANGE 0x3b /* AMP policy for perfctl cluster recommendation */ #define MACH_TURNSTILE_KERNEL_CHANGE 0x40 /* sched priority change because of turnstile */ #define MACH_SCHED_WI_AUTO_JOIN 0x41 /* work interval auto join events */ #define MACH_SCHED_WI_DEFERRED_FINISH 0x42 /* work interval pending finish events for auto-join thread groups */ #define MACH_SET_RT_DEADLINE 0x43 /* set thread->realtime.deadline */ #define MACH_CANCEL_RT_DEADLINE 0x44 /* cancel thread->realtime.deadline */ #define MACH_RT_SIGNAL_SPILL 0x45 /* RT spill signal sent to cpuid */ #define MACH_RT_STEAL 0x46 /* RT thread stolen or spilled */ #define MACH_PENDING_AST_URGENT 0x47 /* CPU pending_AST_URGENT set/cleared */ #define MACH_SCHED_THREAD_SELECT 0x48 /* Result of thread_select */ #define MACH_SCHED_NEXT_PROCESSOR 0x49 /* Result of choose_next_rt_processor_for_IPI */ #define MACH_PSET_AVG_EXEC_TIME 0x50 #define MACH_SUSPEND_USERSPACE 0x51 /* userspace threads are suspended */ #define MACH_PREEMPTION_EXPIRED 0x52 /* preemption disable threshold crossed */ #define MACH_FLOOR_PROMOTE 0x53 /* promoted upon request */ #define MACH_FLOOR_DEMOTE 0x54 /* unpromoted upon request */ #define MACH_INT_MASKED_EXPIRED 0x55 /* interrupt masked threshold crossed */ #define MACH_INT_HANDLED_EXPIRED 0x56 /* interrupt handling threshold crossed */ /* Codes for Clutch/Edge Scheduler (DBG_MACH_SCHED_CLUTCH) */ #define MACH_SCHED_CLUTCH_ROOT_BUCKET_STATE 0x0 /* __unused */ #define MACH_SCHED_CLUTCH_TG_BUCKET_STATE 0x1 /* __unused */ #define MACH_SCHED_CLUTCH_THREAD_SELECT 0x2 /* Thread selection events for Clutch scheduler */ #define MACH_SCHED_CLUTCH_THREAD_STATE 0x3 /* __unused */ #define MACH_SCHED_CLUTCH_TG_BUCKET_PRI 0x4 /* Clutch bucket priority update event */ /* Edge Scheduler Tracepoints */ #define MACH_SCHED_EDGE_CLUSTER_OVERLOAD 0x5 /* Cluster experienced overload; migrating threads to other clusters */ #define MACH_SCHED_EDGE_STEAL 0x6 /* Per-cluster avg. thread execution time */ #define MACH_SCHED_EDGE_REBAL_RUNNABLE 0x7 /* Rebalance runnable threads on a foreign cluster */ #define MACH_SCHED_EDGE_REBAL_RUNNING 0x8 /* Rebalance running threads on a foreign cluster */ #define MACH_SCHED_EDGE_SHOULD_YIELD 0x9 /* Edge decisions for thread yield */ #define MACH_SCHED_CLUTCH_THR_COUNT 0xa /* Clutch scheduler runnable thread counts */ #define MACH_SCHED_EDGE_LOAD_AVG 0xb /* Per-cluster load average */ #define MACH_SCHED_EDGE_CLUSTER_SHARED_LOAD 0xc /* Per-cluster shared resource load */ #define MACH_SCHED_EDGE_RSRC_HEAVY_THREAD 0xd /* Resource heavy thread state */ #define MACH_SCHED_EDGE_SHARED_RSRC_MIGRATE 0xe /* Migrating a shared resource thread due to cluster load imbalance */ /* Codes for workgroup interval subsystem (DBG_MACH_WORKGROUP) */ #define WORKGROUP_INTERVAL_CREATE 0x0 /* work interval creation */ #define WORKGROUP_INTERVAL_DESTROY 0x1 /* work interval destruction */ #define WORKGROUP_INTERVAL_CHANGE 0x2 /* thread work interval change */ #define WORKGROUP_INTERVAL_START 0x3 /* work interval start call */ #define WORKGROUP_INTERVAL_UPDATE 0x4 /* work interval update call */ #define WORKGROUP_INTERVAL_FINISH 0x5 /* work interval finish call */ /* Codes for coverage sanitizer */ #define KCOV_STKSZ_THRESHOLD_ABOVE 0x0 /* thread stack is above threshold */ #define KCOV_STKSZ_THRESHOLD_BELOW 0x1 /* thread stack is below threshold */ #define KCOV_STKSZ_DELTA 0X2 /* thread stack change is larger than delta. */ /* Variants for MACH_MULTIQ_DEQUEUE */ #define MACH_MULTIQ_BOUND 1 #define MACH_MULTIQ_GROUP 2 #define MACH_MULTIQ_GLOBAL 3 /* Arguments for vm_fault (DBG_MACH_VM) */ #define DBG_ZERO_FILL_FAULT 1 #define DBG_PAGEIN_FAULT 2 #define DBG_COW_FAULT 3 #define DBG_CACHE_HIT_FAULT 4 #define DBG_NZF_PAGE_FAULT 5 #define DBG_GUARD_FAULT 6 #define DBG_PAGEINV_FAULT 7 #define DBG_PAGEIND_FAULT 8 #define DBG_COMPRESSOR_FAULT 9 #define DBG_COMPRESSOR_SWAPIN_FAULT 10 #define DBG_COR_FAULT 11 /* Codes for IPC (DBG_MACH_IPC) */ #define MACH_TASK_SUSPEND 0x0 /* Suspended a task */ #define MACH_TASK_RESUME 0x1 /* Resumed a task */ #define MACH_THREAD_SET_VOUCHER 0x2 #define MACH_IPC_MSG_SEND 0x3 /* mach msg send, uniq msg info */ #define MACH_IPC_MSG_RECV 0x4 /* mach_msg receive */ #define MACH_IPC_MSG_RECV_VOUCHER_REFUSED 0x5 /* mach_msg receive, voucher refused */ #define MACH_IPC_KMSG_FREE 0x6 /* kernel free of kmsg data */ #define MACH_IPC_VOUCHER_CREATE 0x7 /* Voucher added to global voucher hashtable */ #define MACH_IPC_VOUCHER_CREATE_ATTR_DATA 0x8 /* Attr data for newly created voucher */ #define MACH_IPC_VOUCHER_DESTROY 0x9 /* Voucher removed from global voucher hashtable */ #define MACH_IPC_KMSG_INFO 0xa /* Send/Receive info for a kmsg */ #define MACH_IPC_KMSG_LINK 0xb /* link a kernel kmsg pointer to user mach_msg_header_t */ #define MACH_IPC_PORT_ENTRY_MODIFY 0xc /* A port space gained or lost a port right (reference) */ #define MACH_IPC_DESTROY_GUARDED_DESC 0xd /* Unable to receive a guarded descriptor */ /* Codes for thread groups (DBG_MACH_THREAD_GROUP) */ #define MACH_THREAD_GROUP_NEW 0x0 #define MACH_THREAD_GROUP_FREE 0x1 #define MACH_THREAD_GROUP_SET 0x2 #define MACH_THREAD_GROUP_NAME 0x3 #define MACH_THREAD_GROUP_NAME_FREE 0x4 #define MACH_THREAD_GROUP_FLAGS 0x5 #define MACH_THREAD_GROUP_BLOCK 0x6 #define MACH_THREAD_GROUP_PREADOPT 0x7 #define MACH_THREAD_GROUP_PREADOPT_NEXTTIME 0x8 #define MACH_THREAD_GROUP_PREADOPT_CLEAR 0x9 #define MACH_THREAD_GROUP_PREADOPT_NA 0xa /* Codes for coalitions (DBG_MACH_COALITION) */ #define MACH_COALITION_NEW 0x0 #define MACH_COALITION_FREE 0x1 #define MACH_COALITION_ADOPT 0x2 #define MACH_COALITION_REMOVE 0x3 #define MACH_COALITION_THREAD_GROUP_SET 0x4 /* Codes for pmap (DBG_MACH_PMAP) */ #define PMAP__CREATE 0x0 #define PMAP__DESTROY 0x1 #define PMAP__PROTECT 0x2 #define PMAP__PAGE_PROTECT 0x3 #define PMAP__ENTER 0x4 #define PMAP__REMOVE 0x5 #define PMAP__NEST 0x6 #define PMAP__UNNEST 0x7 #define PMAP__FLUSH_TLBS 0x8 #define PMAP__UPDATE_INTERRUPT 0x9 #define PMAP__ATTRIBUTE_CLEAR 0xa #define PMAP__REUSABLE 0xb /* This appears to be unused */ #define PMAP__QUERY_RESIDENT 0xc #define PMAP__FLUSH_KERN_TLBS 0xd #define PMAP__FLUSH_DELAYED_TLBS 0xe #define PMAP__FLUSH_TLBS_TO 0xf #define PMAP__FLUSH_EPT 0x10 #define PMAP__FAST_FAULT 0x11 #define PMAP__SWITCH 0x12 #define PMAP__TTE 0x13 #define PMAP__SWITCH_USER_TTB 0x14 #define PMAP__UPDATE_CACHING 0x15 #define PMAP__ATTRIBUTE_CLEAR_RANGE 0x16 #define PMAP__CLEAR_USER_TTB 0x17 #define PMAP__IOMMU_INIT 0x18 #define PMAP__IOMMU_IOVMALLOC 0x19 #define PMAP__IOMMU_IOVMFREE 0x1a #define PMAP__IOMMU_MAP 0x1b #define PMAP__IOMMU_UNMAP 0x1c #define PMAP__IOMMU_IOCTL 0x1d #define PMAP__IOMMU_GRANT_PAGE 0x1e /* Codes for clock (DBG_MACH_CLOCK) */ #define MACH_EPOCH_CHANGE 0x0 /* wake epoch change */ #define MACH_BRIDGE_RCV_TS 0x1 /* receive timestamp pair from interrupt handler */ #define MACH_BRIDGE_REMOTE_TIME 0x2 /* calculate remote timestamp */ #define MACH_BRIDGE_RESET_TS 0x3 /* reset timestamp conversion parameters */ #define MACH_BRIDGE_TS_PARAMS 0x4 /* recompute timestamp conversion parameters */ #define MACH_BRIDGE_SKIP_TS 0x5 /* skip timestamp */ #define MACH_BRIDGE_TS_MISMATCH 0x6 /* mismatch between predicted and received remote timestamp */ #define MACH_BRIDGE_OBSV_RATE 0x7 /* out of range observed rates */ /* Codes for Stackshot/Microstackshot (DBG_MACH_STACKSHOT) */ #define MICROSTACKSHOT_RECORD 0x0 #define MICROSTACKSHOT_GATHER 0x1 #define STACKSHOT_RECORD 0x2 /* START/END, syscall stackshot */ #define STACKSHOT_RECORD_SHORT 0x3 /* ran out of space inside stackshot, growing buffer */ #define STACKSHOT_KERN_RECORD 0x4 /* START/END, internal stackshot */ /* Codes for sysdiagnose (DBG_MACH_SYSDIAGNOSE) */ #define SYSDIAGNOSE_NOTIFY_USER 0x0 #define SYSDIAGNOSE_FULL 0x1 #define SYSDIAGNOSE_STACKSHOT 0x2 #define SYSDIAGNOSE_TAILSPIN 0x3 /* Codes for Selective Forced Idle (DBG_MACH_SFI) */ #define SFI_SET_WINDOW 0x0 #define SFI_CANCEL_WINDOW 0x1 #define SFI_SET_CLASS_OFFTIME 0x2 #define SFI_CANCEL_CLASS_OFFTIME 0x3 #define SFI_THREAD_DEFER 0x4 #define SFI_OFF_TIMER 0x5 #define SFI_ON_TIMER 0x6 #define SFI_WAIT_CANCELED 0x7 #define SFI_PID_SET_MANAGED 0x8 #define SFI_PID_CLEAR_MANAGED 0x9 #define SFI_GLOBAL_DEFER 0xa /* Codes for Zone Allocator (DBG_MACH_ZALLOC) */ #define ZALLOC_ZCRAM 0x0 /* Codes for Mach resource management (DBG_MACH_RESOURCE) */ /* _K32A/B codes start at double the low nibble */ #define RMON_ENABLE_CPUUSAGE_MONITOR 0x001 #define RMON_CPUUSAGE_VIOLATED 0x002 #define RMON_CPUUSAGE_SUSPENDED 0x003 #define RMON_CPUUSAGE_VIOLATED_K32A 0x004 #define RMON_CPUUSAGE_VIOLATED_K32B 0x005 #define RMON_CPUUSAGE_RESUMED 0x006 #define RMON_DISABLE_CPUUSAGE_MONITOR 0x00f #define RMON_ENABLE_CPUWAKES_MONITOR 0x011 #define RMON_CPUWAKES_VIOLATED 0x012 #define RMON_CPUWAKES_VIOLATED_K32A 0x014 #define RMON_CPUWAKES_VIOLATED_K32B 0x015 #define RMON_DISABLE_CPUWAKES_MONITOR 0x01f #define RMON_ENABLE_IO_MONITOR 0x021 #define RMON_LOGWRITES_VIOLATED 0x022 #define RMON_PHYSWRITES_VIOLATED 0x023 #define RMON_LOGWRITES_VIOLATED_K32A 0x024 #define RMON_LOGWRITES_VIOLATED_K32B 0x025 #define RMON_DISABLE_IO_MONITOR 0x02f /* Codes for x86 Hypervisor (DBG_MACH_HV) */ #define HV_X86_ENTER 0x00 #define HV_X86_ENTER_ERROR 0x01 #define HV_X86_TRAP_TASK 0x02 #define HV_X86_TRAP_THREAD 0x03 #define HV_X86_INTERRUPT_INJECT 0x04 #define HV_X86_INTERRUPT_RECV 0x05 #define HV_X86_INTERRUPT_SEND 0x06 #define HV_X86_IPI_SEND 0x07 #define HV_X86_NMI_INJECT 0x08 #define HV_X86_NMI_SEND 0x09 #define HV_X86_LSC_HIT 0x0a #define HV_X86_LSC_INSERT 0x0b #define HV_X86_LSC_INSERT_IMM32 0x0c #define HV_X86_LSC_INVALID 0x0d #define HV_X86_LSC_INVALIDATE 0x0e #define HV_X86_LSC_MISS 0x0f #define HV_X86_TIMER_CANCEL 0x10 #define HV_X86_TIMER_FIRE 0x11 #define HV_X86_TIMER_SCHEDULE 0x12 #define HV_X86_APIC_ACCESS_EXIT 0x13 #define HV_X86_APIC_WRITE_EXIT 0x14 #define HV_X86_EPT_VIOLATION_EXIT 0x15 #define HV_X86_EXC_NMI_EXIT 0x16 #define HV_X86_HLT_EXIT 0x17 #define HV_X86_IO_EXIT 0x18 #define HV_X86_IRQ_EXIT 0x19 #define HV_X86_IRQ_WND_EXIT 0x1a #define HV_X86_MOV_DR_EXIT 0x1b #define HV_X86_NMI_WND_EXIT 0x1c #define HV_X86_RDMSR_EXIT 0x1d #define HV_X86_RDPMC_EXIT 0x1e #define HV_X86_TPR_THRESHOLD_EXIT 0x1f #define HV_X86_VMX_TIMER_EXPIRED_EXIT 0x20 #define HV_X86_WRMSR_EXIT 0x21 #define HV_X86_VCPU_READ_APIC_TRAP 0x22 #define HV_X86_VCPU_READ_VMCS_TRAP 0x23 #define HV_X86_VCPU_RUN_TRAP 0x24 #define HV_X86_VCPU_RUN_UNTIL_TRAP 0x25 #define HV_X86_VCPU_WRITE_APIC_TRAP 0x26 #define HV_X86_VM_ADDRSPACE_CREATE_TRAP 0x27 #define HV_X86_VM_ADDRSPACE_DESTROY_TRAP 0x28 #define HV_X86_VM_INTR_MSI_TRAP 0x29 #define HV_X86_VM_MAP_TRAP 0x2a #define HV_X86_VM_PROTECT_TRAP 0x2b #define HV_X86_VM_UNMAP_TRAP 0x2c #define HV_X86_TSC_OFFSET_SET 0x2d /* **** The Kernel Debug Sub Classes for Network (DBG_NETWORK) **** */ #define DBG_NETIP 1 /* Internet Protocol */ #define DBG_NETARP 2 /* Address Resolution Protocol */ #define DBG_NETUDP 3 /* User Datagram Protocol */ #define DBG_NETTCP 4 /* Transmission Control Protocol */ #define DBG_NETICMP 5 /* Internet Control Message Protocol */ #define DBG_NETIGMP 6 /* Internet Group Management Protocol */ #define DBG_NETRIP 7 /* Routing Information Protocol */ #define DBG_NETOSPF 8 /* Open Shortest Path First */ #define DBG_NETISIS 9 /* Intermediate System to Intermediate System */ #define DBG_NETSNMP 10 /* Simple Network Management Protocol */ #define DBG_NETSOCK 11 /* Socket Layer */ /* For Apple talk */ #define DBG_NETAARP 100 /* Apple ARP */ #define DBG_NETDDP 101 /* Datagram Delivery Protocol */ #define DBG_NETNBP 102 /* Name Binding Protocol */ #define DBG_NETZIP 103 /* Zone Information Protocol */ #define DBG_NETADSP 104 /* Name Binding Protocol */ #define DBG_NETATP 105 /* Apple Transaction Protocol */ #define DBG_NETASP 106 /* Apple Session Protocol */ #define DBG_NETAFP 107 /* Apple Filing Protocol */ #define DBG_NETRTMP 108 /* Routing Table Maintenance Protocol */ #define DBG_NETAURP 109 /* Apple Update Routing Protocol */ #define DBG_NETIPSEC 128 /* IPsec Protocol */ #define DBG_NETVMNET 129 /* VMNet */ /* **** The Kernel Debug Sub Classes for IOKIT (DBG_IOKIT) **** */ #define DBG_IOINTC 0 /* Interrupt controller */ #define DBG_IOWORKLOOP 1 /* Work from work loop */ #define DBG_IOINTES 2 /* Interrupt event source */ #define DBG_IOCLKES 3 /* Clock event source */ #define DBG_IOCMDQ 4 /* Command queue latencies */ #define DBG_IOMCURS 5 /* Memory Cursor */ #define DBG_IOMDESC 6 /* Memory Descriptors */ #define DBG_IOPOWER 7 /* Power Managerment */ #define DBG_IOSERVICE 8 /* Matching etc. */ #define DBG_IOREGISTRY 9 /* Registry */ /* **** 9-32 reserved for internal IOKit usage **** */ #define DBG_IOSTORAGE 32 /* Storage layers */ #define DBG_IONETWORK 33 /* Network layers */ #define DBG_IOKEYBOARD 34 /* Keyboard */ #define DBG_IOHID 35 /* HID Devices */ #define DBG_IOAUDIO 36 /* Audio */ #define DBG_IOSERIAL 37 /* Serial */ #define DBG_IOTTY 38 /* TTY layers */ #define DBG_IOSAM 39 /* SCSI Architecture Model layers */ #define DBG_IOPARALLELATA 40 /* Parallel ATA */ #define DBG_IOPARALLELSCSI 41 /* Parallel SCSI */ #define DBG_IOSATA 42 /* Serial-ATA */ #define DBG_IOSAS 43 /* SAS */ #define DBG_IOFIBRECHANNEL 44 /* FiberChannel */ #define DBG_IOUSB 45 /* USB */ #define DBG_IOBLUETOOTH 46 /* Bluetooth */ #define DBG_IOFIREWIRE 47 /* FireWire */ #define DBG_IOINFINIBAND 48 /* Infiniband */ #define DBG_IOCPUPM 49 /* CPU Power Management */ #define DBG_IOGRAPHICS 50 /* Graphics */ #define DBG_HIBERNATE 51 /* hibernation related events */ #define DBG_IOTHUNDERBOLT 52 /* Thunderbolt */ #define DBG_BOOTER 53 /* booter related events */ #define DBG_IOAUDIO2 54 /* Audio (extended) */ #define DBG_IOSURFACEPA 64 /* IOSurface page mappings */ #define DBG_IOMDPA 65 /* IOMemoryDescriptor page mappings */ #define DBG_IODARTPA 66 /* DART page mappings */ /* **** 67-79 reserved for physical address mapping information **** */ /* Backwards compatibility */ #define DBG_IOPOINTING DBG_IOHID /* OBSOLETE: Use DBG_IOHID instead */ #define DBG_IODISK DBG_IOSTORAGE /* OBSOLETE: Use DBG_IOSTORAGE instead */ /* **** The Kernel Debug Sub Classes for Device Drivers (DBG_DRIVERS) **** */ #define DBG_DRVSTORAGE 1 /* Storage layers */ #define DBG_DRVNETWORK 2 /* Network layers */ #define DBG_DRVKEYBOARD 3 /* Keyboard */ #define DBG_DRVHID 4 /* HID Devices */ #define DBG_DRVAUDIO 5 /* Audio */ #define DBG_DRVSERIAL 7 /* Serial */ #define DBG_DRVSAM 8 /* SCSI Architecture Model layers */ #define DBG_DRVPARALLELATA 9 /* Parallel ATA */ #define DBG_DRVPARALLELSCSI 10 /* Parallel SCSI */ #define DBG_DRVSATA 11 /* Serial ATA */ #define DBG_DRVSAS 12 /* SAS */ #define DBG_DRVFIBRECHANNEL 13 /* FiberChannel */ #define DBG_DRVUSB 14 /* USB */ #define DBG_DRVBLUETOOTH 15 /* Bluetooth */ #define DBG_DRVFIREWIRE 16 /* FireWire */ #define DBG_DRVINFINIBAND 17 /* Infiniband */ #define DBG_DRVGRAPHICS 18 /* Graphics */ #define DBG_DRVSD 19 /* Secure Digital */ #define DBG_DRVNAND 20 /* NAND drivers and layers */ #define DBG_SSD 21 /* SSD */ #define DBG_DRVSPI 22 /* SPI */ #define DBG_DRVWLAN_802_11 23 /* WLAN 802.11 */ #define DBG_DRVSSM 24 /* System State Manager(AppleSSM) */ #define DBG_DRVSMC 25 /* System Management Controller */ #define DBG_DRVMACEFIMANAGER 26 /* Mac EFI Manager */ #define DBG_DRVANE 27 /* ANE */ #define DBG_DRVETHERNET 28 /* Ethernet */ #define DBG_DRVMCC 29 /* Memory Cache Controller */ #define DBG_DRVACCESSORY 30 /* Accessories */ #define DBG_SOCDIAGS 31 /* SoC Diagnostics */ /* Backwards compatibility */ #define DBG_DRVPOINTING DBG_DRVHID /* OBSOLETE: Use DBG_DRVHID instead */ #define DBG_DRVDISK DBG_DRVSTORAGE /* OBSOLETE: Use DBG_DRVSTORAGE instead */ /* **** The Kernel Debug Sub Classes for the DLIL Layer (DBG_DLIL) **** */ #define DBG_DLIL_STATIC 1 /* Static DLIL code */ #define DBG_DLIL_PR_MOD 2 /* DLIL Protocol Module */ #define DBG_DLIL_IF_MOD 3 /* DLIL Interface Module */ #define DBG_DLIL_PR_FLT 4 /* DLIL Protocol Filter */ #define DBG_DLIL_IF_FLT 5 /* DLIL Interface FIlter */ /* The Kernel Debug Sub Classes for File System (DBG_FSYSTEM) */ #define DBG_FSRW 0x1 /* reads and writes to the filesystem */ #define DBG_DKRW 0x2 /* reads and writes to the disk */ #define DBG_FSVN 0x3 /* vnode operations (inc. locking/unlocking) */ #define DBG_FSLOOOKUP 0x4 /* namei and other lookup-related operations */ #define DBG_JOURNAL 0x5 /* journaling operations */ #define DBG_IOCTL 0x6 /* ioctl to the disk */ #define DBG_BOOTCACHE 0x7 /* bootcache operations */ #define DBG_HFS 0x8 /* HFS-specific events; see the hfs project */ #define DBG_APFS 0x9 /* APFS-specific events; see the apfs project */ #define DBG_SMB 0xA /* SMB-specific events; see the smb project */ #define DBG_MOUNT 0xB /* Mounting/unmounting operations */ #define DBG_EXFAT 0xE /* ExFAT-specific events; see the exfat project */ #define DBG_MSDOS 0xF /* FAT-specific events; see the msdosfs project */ #define DBG_ACFS 0x10 /* Xsan-specific events; see the XsanFS project */ #define DBG_THROTTLE 0x11 /* I/O Throttling events */ #define DBG_DECMP 0x12 /* Decmpfs-specific events */ #define DBG_VFS 0x13 /* VFS layer events */ #define DBG_LIVEFS 0x14 /* LiveFS events; see the UserFS project */ #define DBG_CONTENT_PROT 0xCF /* Content Protection Events: see bsd/sys/cprotect.h */ /* * For Kernel Debug Sub Class DBG_HFS, state bits for hfs_update event */ #define DBG_HFS_UPDATE_ACCTIME 0x01 #define DBG_HFS_UPDATE_MODTIME 0x02 #define DBG_HFS_UPDATE_CHGTIME 0x04 #define DBG_HFS_UPDATE_MODIFIED 0x08 #define DBG_HFS_UPDATE_FORCE 0x10 #define DBG_HFS_UPDATE_DATEADDED 0x20 #define DBG_HFS_UPDATE_MINOR 0x40 #define DBG_HFS_UPDATE_SKIPPED 0x80 /* * Codes for Kernel Debug Sub Class DBG_VFS */ #define DBG_VFS_IO_COMPRESSION_STATS 0x1000 /* The Kernel Debug Sub Classes for BSD */ #define DBG_BSD_PROC 0x01 /* process/signals related */ #define DBG_BSD_MEMSTAT 0x02 /* memorystatus / jetsam operations */ #define DBG_BSD_KEVENT 0x03 /* kqueue / kevent related */ #define DBG_BSD_EXCP_SC 0x0C /* System Calls */ #define DBG_BSD_AIO 0x0D /* aio (POSIX async IO) */ #define DBG_BSD_SC_EXTENDED_INFO 0x0E /* System Calls, extended info */ #define DBG_BSD_SC_EXTENDED_INFO2 0x0F /* System Calls, extended info */ #define DBG_BSD_KDEBUG_TEST 0xFF /* for testing kdebug */ /* The Codes for BSD subcode class DBG_BSD_PROC */ #define BSD_PROC_EXIT 1 /* process exit */ #define BSD_PROC_FRCEXIT 2 /* Kernel force termination */ #define BSD_PROC_EXEC 3 /* process spawn / exec */ #define BSD_PROC_EXITREASON_CREATE 4 /* exit reason creation */ #define BSD_PROC_EXITREASON_COMMIT 5 /* exit reason commited to a proc */ /* Codes for BSD subcode class DBG_BSD_MEMSTAT */ #define BSD_MEMSTAT_SCAN 1 /* memorystatus thread awake */ #define BSD_MEMSTAT_JETSAM 2 /* LRU jetsam */ #define BSD_MEMSTAT_JETSAM_HIWAT 3 /* highwater jetsam */ #define BSD_MEMSTAT_FREEZE 4 /* freeze process */ #define BSD_MEMSTAT_FREEZE_SCAN 5 /* select a process to freeze and freeze it */ #define BSD_MEMSTAT_UPDATE 6 /* priority update */ #define BSD_MEMSTAT_IDLE_DEMOTE 7 /* idle demotion fired */ #define BSD_MEMSTAT_CLEAR_ERRORS 8 /* reset termination error state */ #define BSD_MEMSTAT_DIRTY_TRACK 9 /* track the process state */ #define BSD_MEMSTAT_DIRTY_SET 10 /* set the process state */ #define BSD_MEMSTAT_DIRTY_CLEAR 11 /* clear the process state */ #define BSD_MEMSTAT_FAST_JETSAM 15 /* Aggressive jetsam ("clear-the-deck") */ #define BSD_MEMSTAT_COMPACTOR_RUN 16 /* run VM compactor after process kill */ #define BSD_MEMSTAT_FREEZE_DISABLE 17 /* disable freeze and kill frozen processes */ #define BSD_MEMSTAT_RELAUNCH_FLAGS 18 /* flags representing jetsam behavior; based on launchd data */ /* Codes for BSD subcode class DBG_BSD_KEVENT */ #define BSD_KEVENT_KQ_PROCESS_BEGIN 1 #define BSD_KEVENT_KQ_PROCESS_END 2 #define BSD_KEVENT_KQWQ_PROCESS_BEGIN 3 #define BSD_KEVENT_KQWQ_PROCESS_END 4 #define BSD_KEVENT_KQWQ_BIND 5 #define BSD_KEVENT_KQWQ_UNBIND 6 #define BSD_KEVENT_KQWQ_THREQUEST 7 #define BSD_KEVENT_KQWL_PROCESS_BEGIN 8 #define BSD_KEVENT_KQWL_PROCESS_END 9 #define BSD_KEVENT_KQWL_THREQUEST 10 #define BSD_KEVENT_KQWL_THADJUST 11 #define BSD_KEVENT_KQ_REGISTER 12 #define BSD_KEVENT_KQWQ_REGISTER 13 #define BSD_KEVENT_KQWL_REGISTER 14 #define BSD_KEVENT_KNOTE_ACTIVATE 15 #define BSD_KEVENT_KQ_PROCESS 16 #define BSD_KEVENT_KQWQ_PROCESS 17 #define BSD_KEVENT_KQWL_PROCESS 18 #define BSD_KEVENT_KQWL_BIND 19 #define BSD_KEVENT_KQWL_UNBIND 20 #define BSD_KEVENT_KNOTE_ENABLE 21 #define BSD_KEVENT_KNOTE_VANISHED 22 /* The Kernel Debug Sub Classes for DBG_TRACE */ #define DBG_TRACE_DATA 0 #define DBG_TRACE_STRING 1 #define DBG_TRACE_INFO 2 /* The Kernel Debug events: */ #define TRACE_DATA_NEWTHREAD (TRACEDBG_CODE(DBG_TRACE_DATA, 1)) #define TRACE_DATA_EXEC (TRACEDBG_CODE(DBG_TRACE_DATA, 2)) #define TRACE_DATA_THREAD_TERMINATE (TRACEDBG_CODE(DBG_TRACE_DATA, 3)) #define TRACE_DATA_THREAD_TERMINATE_PID (TRACEDBG_CODE(DBG_TRACE_DATA, 4)) #define TRACE_STRING_GLOBAL (TRACEDBG_CODE(DBG_TRACE_STRING, 0)) #define TRACE_STRING_NEWTHREAD (TRACEDBG_CODE(DBG_TRACE_STRING, 1)) #define TRACE_STRING_EXEC (TRACEDBG_CODE(DBG_TRACE_STRING, 2)) #define TRACE_STRING_PROC_EXIT (TRACEDBG_CODE(DBG_TRACE_STRING, 3)) #define TRACE_STRING_THREADNAME (TRACEDBG_CODE(DBG_TRACE_STRING, 4)) #define TRACE_STRING_THREADNAME_PREV (TRACEDBG_CODE(DBG_TRACE_STRING, 5)) #define TRACE_PANIC (TRACEDBG_CODE(DBG_TRACE_INFO, 0)) #define TRACE_TIMESTAMPS (TRACEDBG_CODE(DBG_TRACE_INFO, 1)) #define TRACE_LOST_EVENTS (TRACEDBG_CODE(DBG_TRACE_INFO, 2)) #define TRACE_WRITING_EVENTS (TRACEDBG_CODE(DBG_TRACE_INFO, 3)) #define TRACE_INFO_STRING (TRACEDBG_CODE(DBG_TRACE_INFO, 4)) #define TRACE_RETROGRADE_EVENTS (TRACEDBG_CODE(DBG_TRACE_INFO, 5)) /* The Kernel Debug Sub Classes for DBG_CORESTORAGE */ #define DBG_CS_IO 0 /* The Kernel Debug Sub Classes for DBG_SECURITY */ #define DBG_SEC_KERNEL 0 /* raw entropy collected by the kernel */ #define DBG_SEC_SANDBOX 1 /* Sub-class codes for CoreGraphics (DBG_CG) are defined in its component. */ /* The Kernel Debug Sub Classes for DBG_MONOTONIC */ #define DBG_MT_INSTRS_CYCLES 1 #define DBG_MT_DEBUG 2 #define DBG_MT_RESOURCES_PROC_EXIT 3 #define DBG_MT_RESOURCES_THR_EXIT 4 #define DBG_MT_TMPTH 0xfe #define DBG_MT_TMPCPU 0xff /* Kernel Debug events for the DBG_MT_RESOURCES_PROC_EXIT subclass */ #define DBG_MT_INSTRS_CYCLES_PROC_EXIT MTDBG_RESOURCES_ON_PROC_EXIT(0) /* Kernel Debug events for the DBG_MT_RESOURCES_THR_EXIT subclass */ #define DBG_MT_INSTRS_CYCLES_THR_EXIT MTDBG_RESOURCES_ON_THR_EXIT(0) /* The Kernel Debug Sub Classes for DBG_MISC */ #define DBG_MISC_COREBRIGHTNESS 0x01 #define DBG_MISC_VIDEOENG 0x02 #define DBG_EVENT 0x10 #define DBG_MISC_INSTRUMENTS 0x11 #define DBG_MISC_INSTRUMENTSBT 0x12 #define DBG_MISC_LAYOUT 0x1a #define DBG_BUFFER 0x20 /* The Kernel Debug Sub Classes for DBG_DYLD */ #define DBG_DYLD_UUID (5) /* Kernel Debug codes for the DBG_DYLD_UUID subclass */ #define DBG_DYLD_UUID_MAP_A (0) #define DBG_DYLD_UUID_MAP_B (1) #define DBG_DYLD_UUID_MAP_32_A (2) #define DBG_DYLD_UUID_MAP_32_B (3) #define DBG_DYLD_UUID_MAP_32_C (4) #define DBG_DYLD_UUID_UNMAP_A (5) #define DBG_DYLD_UUID_UNMAP_B (6) #define DBG_DYLD_UUID_UNMAP_32_A (7) #define DBG_DYLD_UUID_UNMAP_32_B (8) #define DBG_DYLD_UUID_UNMAP_32_C (9) #define DBG_DYLD_UUID_SHARED_CACHE_A (10) #define DBG_DYLD_UUID_SHARED_CACHE_B (11) #define DBG_DYLD_UUID_SHARED_CACHE_32_A (12) #define DBG_DYLD_UUID_SHARED_CACHE_32_B (13) #define DBG_DYLD_UUID_SHARED_CACHE_32_C (14) #define DBG_DYLD_AOT_UUID_MAP_A (15) #define DBG_DYLD_AOT_UUID_MAP_B (16) /* The Kernel Debug modifiers for the DBG_DKRW sub class */ #define DKIO_DONE 0x01 #define DKIO_READ 0x02 #define DKIO_ASYNC 0x04 #define DKIO_META 0x08 #define DKIO_PAGING 0x10 #define DKIO_THROTTLE 0x20 /* Deprecated, still provided so fs_usage doesn't break */ #define DKIO_PASSIVE 0x40 #define DKIO_NOCACHE 0x80 #define DKIO_TIER_MASK 0xF00 #define DKIO_TIER_SHIFT 8 #define DKIO_TIER_UPGRADE 0x1000 /* Kernel Debug Sub Classes for Applications (DBG_APPS) */ #define DBG_APP_LOGINWINDOW 0x03 #define DBG_APP_AUDIO 0x04 #define DBG_APP_SYSTEMUI 0x05 #define DBG_APP_SIGNPOST 0x0A #define DBG_APP_APPKIT 0x0C #define DBG_APP_UIKIT 0x0D #define DBG_APP_DFR 0x0E #define DBG_APP_LAYOUT 0x0F #define DBG_APP_COREDATA 0x10 #define DBG_APP_SAMBA 0x80 #define DBG_APP_EOSSUPPORT 0x81 #define DBG_APP_MACEFIMANAGER 0x82 /* Kernel Debug codes for Throttling (DBG_THROTTLE) */ #define OPEN_THROTTLE_WINDOW 0x1 #define PROCESS_THROTTLED 0x2 #define IO_THROTTLE_DISABLE 0x3 #define IO_TIER_UPL_MISMATCH 0x4 /* Subclasses for MACH Importance Policies (DBG_IMPORTANCE) */ /* TODO: Split up boost and task policy? */ #define IMP_ASSERTION 0x10 /* Task takes/drops a boost assertion */ #define IMP_BOOST 0x11 /* Task boost level changed */ #define IMP_MSG 0x12 /* boosting message sent by donating task on donating port */ #define IMP_WATCHPORT 0x13 /* port marked as watchport, and boost was transferred to the watched task */ #define IMP_TASK_SUPPRESSION 0x17 /* Task changed suppression behaviors */ #define IMP_TASK_APPTYPE 0x18 /* Task launched with apptype */ #define IMP_UPDATE 0x19 /* Requested -> effective calculation */ #define IMP_USYNCH_QOS_OVERRIDE 0x1A /* Userspace synchronization applied QoS override to resource owning thread */ #define IMP_DONOR_CHANGE 0x1B /* The iit_donor bit changed */ #define IMP_MAIN_THREAD_QOS 0x1C /* The task's main thread QoS was set */ #define IMP_SYNC_IPC_QOS 0x1D /* Sync IPC QOS override */ /* DBG_IMPORTANCE subclasses 0x20 - 0x3F are reserved for task policy flavors */ /* thread and task attributes */ #define IMP_TASK_POLICY_DARWIN_BG 0x21 #define IMP_TASK_POLICY_IOPOL 0x22 #define IMP_TASK_POLICY_IO 0x23 #define IMP_TASK_POLICY_PASSIVE_IO 0x24 /* task only attributes */ #define IMP_TASK_POLICY_DARWIN_BG_IOPOL 0x27 /* unused, was IMP_TASK_POLICY_TAL 0x28 */ #define IMP_TASK_POLICY_BOOST 0x29 #define IMP_TASK_POLICY_ROLE 0x2A /* unused 0x2B */ #define IMP_TASK_POLICY_TERMINATED 0x2C #define IMP_TASK_POLICY_NEW_SOCKETS_BG 0x2D #define IMP_TASK_POLICY_SUP_ACTIVE 0x2E #define IMP_TASK_POLICY_LATENCY_QOS 0x2F #define IMP_TASK_POLICY_THROUGH_QOS 0x30 #define IMP_TASK_POLICY_WATCHERS_BG 0x31 #define IMP_TASK_POLICY_SFI_MANAGED 0x34 #define IMP_TASK_POLICY_ALL_SOCKETS_BG 0x37 #define IMP_TASK_POLICY_BASE_LATENCY_AND_THROUGHPUT_QOS 0x39 /* latency as value1, throughput as value2 */ #define IMP_TASK_POLICY_OVERRIDE_LATENCY_AND_THROUGHPUT_QOS 0x3A /* latency as value1, throughput as value2 */ /* thread only attributes */ #define IMP_TASK_POLICY_PIDBIND_BG 0x32 /* unused 0x33 */ /* reserved 0x35 */ #define IMP_TASK_POLICY_QOS_OVERRIDE 0x36 #define IMP_TASK_POLICY_QOS_AND_RELPRIO 0x38 /* QoS as value1, relative priority as value2 */ #define IMP_TASK_POLICY_QOS_WORKQ_OVERRIDE 0x3B #define IMP_TASK_POLICY_QOS_PROMOTE 0x3C #define IMP_TASK_POLICY_QOS_KEVENT_OVERRIDE 0x3D #define IMP_TASK_POLICY_QOS_IPC_OVERRIDE IMP_TASK_POLICY_QOS_KEVENT_OVERRIDE /* legacy name */ #define IMP_TASK_POLICY_QOS_SERVICER_OVERRIDE 0x3E /* Codes for IMP_ASSERTION */ #define IMP_HOLD 0x2 /* Task holds a boost assertion */ #define IMP_DROP 0x4 /* Task drops a boost assertion */ #define IMP_EXTERN 0x8 /* boost assertion moved from kernel to userspace responsibility (externalized) */ /* Codes for IMP_BOOST */ #define IMP_BOOSTED 0x1 #define IMP_UNBOOSTED 0x2 /* Task drops a boost assertion */ /* Codes for IMP_MSG */ #define IMP_MSG_SEND 0x1 /* boosting message sent by donating task on donating port */ #define IMP_MSG_DELV 0x2 /* boosting message delivered to task */ /* Codes for IMP_UPDATE */ #define IMP_UPDATE_TASK_CREATE 0x1 /* Codes for IMP_USYNCH_QOS_OVERRIDE */ #define IMP_USYNCH_ADD_OVERRIDE 0x0 /* add override for a contended resource */ #define IMP_USYNCH_REMOVE_OVERRIDE 0x1 /* remove override for a contended resource */ /* Codes for IMP_DONOR_CHANGE */ #define IMP_DONOR_UPDATE_LIVE_DONOR_STATE 0x0 #define IMP_DONOR_INIT_DONOR_STATE 0x1 /* Code for IMP_SYNC_IPC_QOS */ #define IMP_SYNC_IPC_QOS_APPLIED 0x0 #define IMP_SYNC_IPC_QOS_REMOVED 0x1 #define IMP_SYNC_IPC_QOS_OVERFLOW 0x2 #define IMP_SYNC_IPC_QOS_UNDERFLOW 0x3 /* Subclasses for Turnstiles (DBG_TURNSTILE) */ #define TURNSTILE_HEAP_OPERATIONS 0x10 #define TURNSTILE_PRIORITY_OPERATIONS 0x20 #define TURNSTILE_FREELIST_OPERATIONS 0x30 /* Codes for TURNSTILE_HEAP_OPERATIONS */ #define THREAD_ADDED_TO_TURNSTILE_WAITQ 0x1 #define THREAD_REMOVED_FROM_TURNSTILE_WAITQ 0x2 #define THREAD_MOVED_IN_TURNSTILE_WAITQ 0x3 #define TURNSTILE_ADDED_TO_TURNSTILE_HEAP 0x4 #define TURNSTILE_REMOVED_FROM_TURNSTILE_HEAP 0x5 #define TURNSTILE_MOVED_IN_TURNSTILE_HEAP 0x6 #define TURNSTILE_ADDED_TO_THREAD_HEAP 0x7 #define TURNSTILE_REMOVED_FROM_THREAD_HEAP 0x8 #define TURNSTILE_MOVED_IN_THREAD_HEAP 0x9 #define TURNSTILE_UPDATE_STOPPED_BY_LIMIT 0xa #define THREAD_NOT_WAITING_ON_TURNSTILE 0xb /* Codes for TURNSTILE_PRIORITY_OPERATIONS */ #define TURNSTILE_PRIORITY_CHANGE 0x1 #define THREAD_USER_PROMOTION_CHANGE 0x2 /* Codes for TURNSTILE_FREELIST_OPERATIONS */ #define TURNSTILE_PREPARE 0x1 #define TURNSTILE_COMPLETE 0x2 /* Subclasses for MACH Bank Voucher Attribute Manager (DBG_BANK) */ #define BANK_ACCOUNT_INFO 0x10 /* Trace points related to bank account struct */ #define BANK_TASK_INFO 0x11 /* Trace points related to bank task struct */ /* Subclasses for MACH ATM Voucher Attribute Manager (ATM) */ #define ATM_SUBAID_INFO 0x10 #define ATM_GETVALUE_INFO 0x20 #define ATM_UNREGISTER_INFO 0x30 /* Codes for BANK_ACCOUNT_INFO */ #define BANK_SETTLE_CPU_TIME 0x1 /* Bank ledger(chit) rolled up to tasks. */ #define BANK_SECURE_ORIGINATOR_CHANGED 0x2 /* Secure Originator changed. */ #define BANK_SETTLE_ENERGY 0x3 /* Bank ledger(energy field) rolled up to tasks. */ /* Codes for ATM_SUBAID_INFO */ #define ATM_MIN_CALLED 0x1 #define ATM_LINK_LIST_TRIM 0x2 /* Codes for ATM_GETVALUE_INFO */ #define ATM_VALUE_REPLACED 0x1 #define ATM_VALUE_ADDED 0x2 /* Codes for ATM_UNREGISTER_INFO */ #define ATM_VALUE_UNREGISTERED 0x1 #define ATM_VALUE_DIFF_MAILBOX 0x2 /* Kernel Debug Sub Classes for daemons (DBG_DAEMON) */ #define DBG_DAEMON_COREDUET 0x1 #define DBG_DAEMON_POWERD 0x2 /* Subclasses for the user space allocator */ #define DBG_UMALLOC_EXTERNAL 0x1 #define DBG_UMALLOC_INTERNAL 0x2 /**********************************************************************/ #define KDBG_MIGCODE(msgid) (((unsigned)DBG_MIG << KDBG_CLASS_OFFSET) | \ ((unsigned)((msgid) & 0x3fffff) << KDBG_CODE_OFFSET)) #define MACHDBG_CODE(SubClass, code) KDBG_CODE(DBG_MACH, SubClass, code) #define NETDBG_CODE(SubClass, code) KDBG_CODE(DBG_NETWORK, SubClass, code) #define FSDBG_CODE(SubClass, code) KDBG_CODE(DBG_FSYSTEM, SubClass, code) #define BSDDBG_CODE(SubClass, code) KDBG_CODE(DBG_BSD, SubClass, code) #define IOKDBG_CODE(SubClass, code) KDBG_CODE(DBG_IOKIT, SubClass, code) #define DRVDBG_CODE(SubClass, code) KDBG_CODE(DBG_DRIVERS, SubClass, code) #define TRACEDBG_CODE(SubClass, code) KDBG_CODE(DBG_TRACE, SubClass, code) #define SILICONDBG_CODE(SubClass, code) KDBG_CODE(DBG_SILICON, SubClass, code) #define MISCDBG_CODE(SubClass, code) KDBG_CODE(DBG_MISC, SubClass, code) #define DLILDBG_CODE(SubClass, code) KDBG_CODE(DBG_DLIL, SubClass, code) #define SECURITYDBG_CODE(SubClass, code) KDBG_CODE(DBG_SECURITY, SubClass, code) #define DYLDDBG_CODE(SubClass, code) KDBG_CODE(DBG_DYLD, SubClass, code) #define QTDBG_CODE(SubClass, code) KDBG_CODE(DBG_QT, SubClass, code) #define APPSDBG_CODE(SubClass, code) KDBG_CODE(DBG_APPS, SubClass, code) #define ARIADNEDBG_CODE(SubClass, code) KDBG_CODE(DBG_ARIADNE, SubClass, code) #define DAEMONDBG_CODE(SubClass, code) KDBG_CODE(DBG_DAEMON, SubClass, code) #define CPUPM_CODE(code) IOKDBG_CODE(DBG_IOCPUPM, code) #define MTDBG_CODE(SubClass, code) KDBG_CODE(DBG_MONOTONIC, SubClass, code) #define MTDBG_RESOURCES_ON_PROC_EXIT(code) MTDBG_CODE(DBG_MT_RESOURCES_PROC_EXIT, code) #define MTDBG_RESOURCES_ON_THR_EXIT(code) MTDBG_CODE(DBG_MT_RESOURCES_THR_EXIT, code) #define KMEM_ALLOC_CODE MACHDBG_CODE(DBG_MACH_LEAKS, 0) #define KMEM_ALLOC_CODE_2 MACHDBG_CODE(DBG_MACH_LEAKS, 1) #define KMEM_FREE_CODE MACHDBG_CODE(DBG_MACH_LEAKS, 2) #define KMEM_FREE_CODE_2 MACHDBG_CODE(DBG_MACH_LEAKS, 3) #define ZALLOC_CODE MACHDBG_CODE(DBG_MACH_LEAKS, 4) #define ZALLOC_CODE_2 MACHDBG_CODE(DBG_MACH_LEAKS, 5) #define ZFREE_CODE MACHDBG_CODE(DBG_MACH_LEAKS, 6) #define ZFREE_CODE_2 MACHDBG_CODE(DBG_MACH_LEAKS, 7) #define PMAP_CODE(code) MACHDBG_CODE(DBG_MACH_PMAP, code) #define IMPORTANCE_CODE(SubClass, code) KDBG_CODE(DBG_IMPORTANCE, (SubClass), (code)) #define BANK_CODE(SubClass, code) KDBG_CODE(DBG_BANK, (SubClass), (code)) #define ATM_CODE(SubClass, code) KDBG_CODE(DBG_ATM, (SubClass), (code)) #define TURNSTILE_CODE(SubClass, code) KDBG_CODE(DBG_TURNSTILE, (SubClass), (code)) /* Kernel Debug Macros for specific daemons */ #define COREDUETDBG_CODE(code) DAEMONDBG_CODE(DBG_DAEMON_COREDUET, code) #define POWERDDBG_CODE(code) DAEMONDBG_CODE(DBG_DAEMON_POWERD, code) /* VFS lookup events for serial traces */ #define VFS_LOOKUP (FSDBG_CODE(DBG_FSRW,36)) #define VFS_LOOKUP_DONE (FSDBG_CODE(DBG_FSRW,39)) #endif /* __APPLE_API_UNSTABLE */ __END_DECLS #endif /* !defined(BSD_SYS_KDEBUG_H) */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/kdebug_signpost.h ================================================ /* * Copyright (c) 2016-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@ */ #ifndef BSD_SYS_KDEBUG_SIGNPOST_H #define BSD_SYS_KDEBUG_SIGNPOST_H #include #include #include __BEGIN_DECLS /* * kdebug_signpost(2) is deprecated. Use the os_signpost(3) family of tracing * functions, instead. */ int kdebug_signpost(uint32_t code, uintptr_t arg1, uintptr_t arg2, uintptr_t arg3, uintptr_t arg4) __API_DEPRECATED_WITH_REPLACEMENT("os_signpost_event_emit", macos(10.12, 10.15), ios(10.0, 13.0), watchos(3.0, 6.0), tvos(10.0, 13.0)); int kdebug_signpost_start(uint32_t code, uintptr_t arg1, uintptr_t arg2, uintptr_t arg3, uintptr_t arg4) __API_DEPRECATED_WITH_REPLACEMENT("os_signpost_interval_begin", macos(10.12, 10.15), ios(10.0, 13.0), watchos(3.0, 6.0), tvos(10.0, 13.0)); int kdebug_signpost_end(uint32_t code, uintptr_t arg1, uintptr_t arg2, uintptr_t arg3, uintptr_t arg4) __API_DEPRECATED_WITH_REPLACEMENT("os_signpost_interval_end", macos(10.12, 10.15), ios(10.0, 13.0), watchos(3.0, 6.0), tvos(10.0, 13.0)); __END_DECLS #endif /* !BSD_SYS_KDEBUG_SIGNPOST_H */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/kern_control.h ================================================ /* * Copyright (c) 2000-2004, 2012-2016 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@ */ /*! * @header kern_control.h * This header defines an API to communicate between a kernel * extension and a process outside of the kernel. */ #ifndef KPI_KERN_CONTROL_H #define KPI_KERN_CONTROL_H #include #include #include #include /* * Define Controller event subclass, and associated events. * Subclass of KEV_SYSTEM_CLASS */ /*! * @defined KEV_CTL_SUBCLASS * @discussion The kernel event subclass for kernel control events. */ #define KEV_CTL_SUBCLASS 2 /*! * @defined KEV_CTL_REGISTERED * @discussion The event code indicating a new controller was * registered. The data portion will contain a ctl_event_data. */ #define KEV_CTL_REGISTERED 1 /* a new controller appears */ /*! * @defined KEV_CTL_DEREGISTERED * @discussion The event code indicating a controller was unregistered. * The data portion will contain a ctl_event_data. */ #define KEV_CTL_DEREGISTERED 2 /* a controller disappears */ /*! * @struct ctl_event_data * @discussion This structure is used for KEV_CTL_SUBCLASS kernel * events. * @field ctl_id The kernel control id. * @field ctl_unit The kernel control unit. */ struct ctl_event_data { u_int32_t ctl_id; /* Kernel Controller ID */ u_int32_t ctl_unit; }; /* * Controls destined to the Controller Manager. */ /*! * @defined CTLIOCGCOUNT * @discussion The CTLIOCGCOUNT ioctl can be used to determine the * number of kernel controllers registered. */ #define CTLIOCGCOUNT _IOR('N', 2, int) /* get number of control structures registered */ /*! * @defined CTLIOCGINFO * @discussion The CTLIOCGINFO ioctl can be used to convert a kernel * control name to a kernel control id. */ #define CTLIOCGINFO _IOWR('N', 3, struct ctl_info) /* get id from name */ /*! * @defined MAX_KCTL_NAME * @discussion Kernel control names must be no longer than * MAX_KCTL_NAME. */ #define MAX_KCTL_NAME 96 /* * Controls destined to the Controller Manager. */ /*! * @struct ctl_info * @discussion This structure is used with the CTLIOCGINFO ioctl to * translate from a kernel control name to a control id. * @field ctl_id The kernel control id, filled out upon return. * @field ctl_name The kernel control name to find. */ struct ctl_info { u_int32_t ctl_id; /* Kernel Controller ID */ char ctl_name[MAX_KCTL_NAME]; /* Kernel Controller Name (a C string) */ }; /*! * @struct sockaddr_ctl * @discussion The controller address structure is used to establish * contact between a user client and a kernel controller. The * sc_id/sc_unit uniquely identify each controller. sc_id is a * unique identifier assigned to the controller. The identifier can * be assigned by the system at registration time or be a 32-bit * creator code obtained from Apple Computer. sc_unit is a unit * number for this sc_id, and is privately used by the kernel * controller to identify several instances of the controller. * @field sc_len The length of the structure. * @field sc_family AF_SYSTEM. * @field ss_sysaddr AF_SYS_KERNCONTROL. * @field sc_id Controller unique identifier. * @field sc_unit Kernel controller private unit number. * @field sc_reserved Reserved, must be set to zero. */ struct sockaddr_ctl { u_char sc_len; /* depends on size of bundle ID string */ u_char sc_family; /* AF_SYSTEM */ u_int16_t ss_sysaddr; /* AF_SYS_KERNCONTROL */ u_int32_t sc_id; /* Controller unique identifier */ u_int32_t sc_unit; /* Developer private unit number */ u_int32_t sc_reserved[5]; }; #endif /* KPI_KERN_CONTROL_H */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/kern_event.h ================================================ /* * Copyright (c) 2000-2021 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 (c) 1998, 1999 Apple Computer, Inc. All Rights Reserved */ /*! * @header kern_event.h * This header defines in-kernel functions for generating kernel events as * well as functions for receiving kernel events using a kernel event * socket. */ #ifndef SYS_KERN_EVENT_H #define SYS_KERN_EVENT_H #include #include #include #define KEV_SNDSPACE (4 * 1024) #define KEV_RECVSPACE (32 * 1024) #define KEV_ANY_VENDOR 0 #define KEV_ANY_CLASS 0 #define KEV_ANY_SUBCLASS 0 /* * Vendor Code */ /*! * @defined KEV_VENDOR_APPLE * @discussion Apple generated kernel events use the hard coded vendor code * value of 1. Third party kernel events use a dynamically allocated vendor * code. The vendor code can be found using the SIOCGKEVVENDOR ioctl. */ #define KEV_VENDOR_APPLE 1 /* * Definition of top-level classifications for KEV_VENDOR_APPLE */ /*! * @defined KEV_NETWORK_CLASS * @discussion Network kernel event class. */ #define KEV_NETWORK_CLASS 1 /*! * @defined KEV_IOKIT_CLASS * @discussion IOKit kernel event class. */ #define KEV_IOKIT_CLASS 2 /*! * @defined KEV_SYSTEM_CLASS * @discussion System kernel event class. */ #define KEV_SYSTEM_CLASS 3 /*! * @defined KEV_APPLESHARE_CLASS * @discussion AppleShare kernel event class. */ #define KEV_APPLESHARE_CLASS 4 /*! * @defined KEV_FIREWALL_CLASS * @discussion Firewall kernel event class. */ #define KEV_FIREWALL_CLASS 5 /*! * @defined KEV_IEEE80211_CLASS * @discussion IEEE 802.11 kernel event class. */ #define KEV_IEEE80211_CLASS 6 /*! * @defined KEV_NKE_CLASS * @discussion NKE kernel event class. */ #define KEV_NKE_CLASS 7 #define KEV_NKE_ALF_SUBCLASS 1 #define KEV_NKE_ALF_STATE_CHANGED 1 /* * The following struct is KPI, but it was originally defined with a trailing * array member of size one, intended to be used as a Variable-Length Array. * That's problematic because the compiler doesn't know that the array is * accessed out-of-bounds and can assume it isn't. This makes * -Warray-bounds-pointer-arithmetic sad. We can't just change the code because * it requires users to also change their uses of the class, at a minimum * because kern_event_msg's size changes when making the last member a VLA. This * macro allows users of this KPI to opt-in to the new behavior. */ #if defined(XNU_KERN_EVENT_DATA_IS_VLA) #define XNU_KERN_EVENT_DATA_SIZE /* nothing, it's a VLA */ #else #define XNU_KERN_EVENT_DATA_SIZE 1 #endif /*! * @struct kern_event_msg * @discussion This structure is prepended to all kernel events. This * structure is used to determine the format of the remainder of * the kernel event. This structure will appear on all messages * received on a kernel event socket. To post a kernel event, a * slightly different structure is used. * @field total_size Total size of the kernel event message including the * header. * @field vendor_code The vendor code indicates which vendor generated the * kernel event. This gives every vendor a unique set of classes * and subclasses to use. Use the SIOCGKEVVENDOR ioctl to look up * vendor codes for vendors other than Apple. Apple uses * KEV_VENDOR_APPLE. * @field kev_class The class of the kernel event. * @field kev_subclass The subclass of the kernel event. * @field id Monotonically increasing value. * @field event_code The event code. * @field event_data Any additional data about this event. Format will * depend on the vendor_code, kev_class, kev_subclass, and * event_code. The length of the event_data can be determined * using total_size - KEV_MSG_HEADER_SIZE. */ struct kern_event_msg { u_int32_t total_size; /* Size of entire event msg */ u_int32_t vendor_code; /* For non-Apple extensibility */ u_int32_t kev_class; /* Layer of event source */ u_int32_t kev_subclass; /* Component within layer */ u_int32_t id; /* Monotonically increasing value */ u_int32_t event_code; /* unique code */ u_int32_t event_data[XNU_KERN_EVENT_DATA_SIZE]; /* One or more data words */ }; /*! * @defined KEV_MSG_HEADER_SIZE * @discussion Size of the header portion of the kern_event_msg structure. * This accounts for everything right up to event_data. The size * of the data can be found by subtracting KEV_MSG_HEADER_SIZE * from the total size from the kern_event_msg. */ #define KEV_MSG_HEADER_SIZE (offsetof(struct kern_event_msg, event_data[0])) /*! * @struct kev_request * @discussion This structure is used with the SIOCSKEVFILT and * SIOCGKEVFILT to set and get the control filter setting for a * kernel control socket. * @field total_size Total size of the kernel event message including the * header. * @field vendor_code All kernel events that don't match this vendor code * will be ignored. KEV_ANY_VENDOR can be used to receive kernel * events with any vendor code. * @field kev_class All kernel events that don't match this class will be * ignored. KEV_ANY_CLASS can be used to receive kernel events with * any class. * @field kev_subclass All kernel events that don't match this subclass * will be ignored. KEV_ANY_SUBCLASS can be used to receive kernel * events with any subclass. */ struct kev_request { u_int32_t vendor_code; u_int32_t kev_class; u_int32_t kev_subclass; }; /*! * @defined KEV_VENDOR_CODE_MAX_STR_LEN * @discussion This define sets the maximum length of a string that can be * used to identify a vendor or kext when looking up a vendor code. */ #define KEV_VENDOR_CODE_MAX_STR_LEN 200 /*! * @struct kev_vendor_code * @discussion This structure is used with the SIOCGKEVVENDOR ioctl to * convert from a string identifying a kext or vendor, in the * form of a bundle identifier, to a vendor code. * @field vendor_code After making the SIOCGKEVVENDOR ioctl call, this will * be filled in with the vendor code if there is one. * @field vendor_string A bundle style identifier. */ #pragma pack(4) struct kev_vendor_code { u_int32_t vendor_code; char vendor_string[KEV_VENDOR_CODE_MAX_STR_LEN]; }; #pragma pack() /*! * @defined SIOCGKEVID * @discussion Retrieve the current event id. Each event generated will * have a new id. The next event to be generated will have an id * of id+1. */ #define SIOCGKEVID _IOR('e', 1, u_int32_t) /*! * @defined SIOCSKEVFILT * @discussion Set the kernel event filter for this socket. Kernel events * not matching this filter will not be received on this socket. */ #define SIOCSKEVFILT _IOW('e', 2, struct kev_request) /*! * @defined SIOCGKEVFILT * @discussion Retrieve the kernel event filter for this socket. Kernel * events not matching this filter will not be received on this * socket. */ #define SIOCGKEVFILT _IOR('e', 3, struct kev_request) /*! * @defined SIOCGKEVVENDOR * @discussion Lookup the vendor code for the specified vendor. ENOENT will * be returned if a vendor code for that vendor string does not * exist. */ #define SIOCGKEVVENDOR _IOWR('e', 4, struct kev_vendor_code) #endif /* SYS_KERN_EVENT_H */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/kernel.h ================================================ /* * 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@ */ /* Copyright (c) 1995 NeXT Computer, 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. * * @(#)kernel.h 8.3 (Berkeley) 1/21/94 */ #ifndef _SYS_KERNEL_H_ #define _SYS_KERNEL_H_ #include #endif /* !_SYS_KERNEL_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/kernel_types.h ================================================ /* * Copyright (c) 2004-2010 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 _KERN_SYS_KERNELTYPES_H_ #define _KERN_SYS_KERNELTYPES_H_ #include #include #include #ifdef BSD_BUILD /* Macros(?) to clear/set/test flags. */ #define SET(t, f) (t) |= (f) #define CLR(t, f) (t) &= ~(f) #define ISSET(t, f) ((t) & (f)) #endif typedef int64_t daddr64_t; #ifndef BSD_BUILD struct buf; typedef struct buf * buf_t; struct file; typedef struct file * file_t; #ifndef __LP64__ struct ucred; typedef struct ucred * ucred_t; #endif #if defined(KERNEL) || !defined(_SYS_MOUNT_H_) /* also defined in mount.h */ struct mount; typedef struct mount * mount_t; struct vnode; typedef struct vnode * vnode_t; #endif struct proc; typedef struct proc * proc_t; struct proc_ident; typedef struct proc_ident * proc_ident_t; struct uio; typedef struct uio * uio_t; struct vfs_context; typedef struct vfs_context * vfs_context_t; struct vfstable; typedef struct vfstable * vfstable_t; struct __ifnet; struct __mbuf; struct __pkthdr; struct __socket; struct __sockopt; struct __ifaddr; struct __ifmultiaddr; struct __ifnet_filter; struct __rtentry; struct __if_clone; struct __bufattr; typedef struct __ifnet* ifnet_t; typedef struct __mbuf* mbuf_t; typedef struct __pkthdr* pkthdr_t; typedef struct __socket* socket_t; typedef struct __sockopt* sockopt_t; typedef struct __ifaddr* ifaddr_t; typedef struct __ifmultiaddr* ifmultiaddr_t; typedef struct __ifnet_filter* interface_filter_t; typedef struct __rtentry* route_t; typedef struct __if_clone* if_clone_t; typedef struct __bufattr* bufattr_t; #else /* BSD_BUILD */ typedef struct buf * buf_t; typedef struct file * file_t; #ifndef __LP64__ typedef struct ucred * ucred_t; #endif #if defined(KERNEL) || !defined(_SYS_MOUNT_H_) /* also defined in mount.h */ typedef struct mount * mount_t; typedef struct vnode * vnode_t; #endif typedef struct proc * proc_t; typedef struct proc_ident * proc_ident_t; typedef struct uio * uio_t; typedef struct user_iovec * user_iovec_t; typedef struct vfs_context * vfs_context_t; typedef struct vfstable * vfstable_t; #endif /* !BSD_BUILD */ #include #ifndef _KAUTH_ACE #define _KAUTH_ACE struct kauth_ace; typedef struct kauth_ace * kauth_ace_t; #endif #ifndef _KAUTH_ACL #define _KAUTH_ACL struct kauth_acl; typedef struct kauth_acl * kauth_acl_t; #endif #ifndef _KAUTH_FILESEC #define _KAUTH_FILESEC struct kauth_filesec; typedef struct kauth_filesec * kauth_filesec_t; #endif #ifndef _KAUTH_ACTION_T #define _KAUTH_ACTION_T typedef int kauth_action_t; #endif #endif /* !_KERN_SYS_KERNELTYPES_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/lctx.h ================================================ /* * TODO: remove this file */ #ifndef _SYS_LCTX_H_ #define _SYS_LCTX_H_ #include /* errno, ENOSYS */ #include /* pid_t */ static __inline pid_t getlcid(pid_t pid) { errno = ENOSYS; return -1; } static __inline int setlcid(pid_t pid, pid_t lcid) { errno = ENOSYS; return -1; } #define LCID_PROC_SELF (0) #define LCID_REMOVE (-1) #define LCID_CREATE (0) #endif /* !_SYS_LCTX_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/loadable_fs.h ================================================ /* * 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@ */ /* @(#)loadable_fs.h 2.0 26/06/90 (c) 1990 NeXT */ /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX * * W I L L D R A S T I C A L L Y C H A N G E S O O N * U S E A T Y O U R O W N R I S K * * XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ /* * loadable_fs.h - message struct for loading and initializing loadable * file systems. */ #ifndef _SYS_LOADABLE_FS_ #define _SYS_LOADABLE_FS_ /* * Constants for Loadable FS Utilities (in "/System/Library/Filesystems") * * Example of a /usr/filesystems directory * * /usr/filesystems/dos.fs/dos.util utility with which WSM * communicates * /usr/filesystems/dos.fs/dos.name "DOS Floppy" * /usr/filesystems/dos.fs/dos_reloc actual loadable filesystem * /usr/filesystems/dos.fs/dos.openfs.tiff "open folder" icon * /usr/filesystems/dos.fs/dos.fs.tiff "closed folder" icon */ #define FS_DIR_LOCATION "/System/Library/Filesystems" #define FS_DIR_SUFFIX ".fs" #define FS_UTIL_SUFFIX ".util" /* * .util program commands - all sent in the form "-p" or "-m" ... as argv[1]. */ #define FSUC_PROBE 'p' /* probe FS for mount or init */ /* example usage: foo.util -p fd0 removable writable */ #define FSUC_PROBEFORINIT 'P' /* probe FS for init only */ /* example usage: foo.util -P fd0 removable */ #define FSUC_MOUNT 'm' /* mount FS */ /* example usage: foo.util -m fd0 /bar removable writable */ #define FSUC_REPAIR 'r' /* repair ('fsck') FS */ /* example usage: foo.util -r fd0 removable */ #define FSUC_UNMOUNT 'u' /* unmount FS */ /* example usage: foo.util -u fd0 /bar */ /* The following is not used by Workspace Manager */ #define FSUC_MOUNT_FORCE 'M' /* like FSUC_MOUNT, but proceed even on * error. */ /* * Return codes from .util program */ #define FSUR_RECOGNIZED (-1) /* response to FSUC_PROBE; implies that * a mount is possible */ #define FSUR_UNRECOGNIZED (-2) /* negative response to FSUC_PROBE */ #define FSUR_IO_SUCCESS (-3) /* mount, unmount, repair succeeded */ #define FSUR_IO_FAIL (-4) /* unrecoverable I/O error */ #define FSUR_IO_UNCLEAN (-5) /* mount failed, file system not clean */ #define FSUR_INVAL (-6) /* invalid argument */ #define FSUR_LOADERR (-7) /* kern_loader error */ #define FSUR_INITRECOGNIZED (-8) /* response to FSUC_PROBE or * FSUC_PROBEFORINIT, implies that * initialization is possible */ /* * mount parameters passed from WSM to the .util program. */ #define DEVICE_READONLY "readonly" #define DEVICE_WRITABLE "writable" #define DEVICE_REMOVABLE "removable" #define DEVICE_FIXED "fixed" #endif /* _SYS_LOADABLE_FS_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/lock.h ================================================ /* * 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@ */ /* Copyright (c) 1995, 1997 Apple Computer, Inc. All Rights Reserved */ /* * Copyright (c) 1995 * The Regents of the University of California. All rights reserved. * * This code contains ideas from software contributed to Berkeley by * Avadis Tevanian, Jr., Michael Wayne Young, and the Mach Operating * System project at Carnegie-Mellon University. * * 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. * * @(#)lock.h 8.12 (Berkeley) 5/19/95 */ #ifndef _SYS_LOCK_H_ #define _SYS_LOCK_H_ #include #include #include #endif /* _SYS_LOCK_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/lockf.h ================================================ /* * Copyright (c) 2004-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@ */ /* * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Scooter Morris at Genentech 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. * 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. * * @(#)lockf.h 8.1 (Berkeley) 6/11/93 * $FreeBSD: src/sys/sys/lockf.h,v 1.16 2004/04/07 04:19:49 imp Exp $ */ #ifndef _SYS_LOCKF_H_ #define _SYS_LOCKF_H_ #include #include #include struct vnop_advlock_args; struct vnode; #if IMPORTANCE_INHERITANCE #define LF_NOT_BOOSTED 0 #define LF_BOOSTED 1 #endif /* IMPORTANCE_INHERITANCE */ /* * The lockf structure is a kernel structure which contains the information * associated with a byte range lock. The lockf structures are linked into * the vnode structure. Locks are sorted by the starting byte of the lock for * efficiency after they have been committed; uncommitted locks are on the list * head so they may quickly be accessed, and are both short lived and transient. */ TAILQ_HEAD(locklist, lockf); struct lockf { short lf_flags; /* Semantics: F_POSIX, F_FLOCK, F_WAIT */ short lf_type; /* Lock type: F_RDLCK, F_WRLCK */ #if IMPORTANCE_INHERITANCE int lf_boosted; /* Is the owner of the lock boosted */ #endif off_t lf_start; /* Byte # of the start of the lock */ off_t lf_end; /* Byte # of the end of the lock (-1=EOF) */ caddr_t lf_id; /* Id of the resource holding the lock */ struct lockf **lf_head; /* Back pointer to the head of the locf list */ struct vnode *lf_vnode; /* Back pointer to the inode */ struct lockf *lf_next; /* Pointer to the next lock on this inode */ struct locklist lf_blkhd; /* List of requests blocked on this lock */ TAILQ_ENTRY(lockf) lf_block;/* A request waiting for a lock */ struct proc *lf_owner; /* The proc that did the SETLK, if known */ }; __BEGIN_DECLS __END_DECLS #endif /* !_SYS_LOCKF_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/lockstat.h ================================================ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License, Version 1.0 only * (the "License"). You may not use this file except in compliance * with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. * See the License for the specific language governing permissions * and limitations under the License. * * When distributing Covered Code, include this CDDL HEADER in each * file and include the License file at usr/src/OPENSOLARIS.LICENSE. * If applicable, add the following below this CDDL HEADER, with the * fields enclosed by brackets "[]" replaced with your own identifying * information: Portions Copyright [yyyy] [name of copyright owner] * * CDDL HEADER END */ /* * Copyright 1997-2003 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _SYS_LOCKSTAT_H #define _SYS_LOCKSTAT_H #ifdef __cplusplus extern "C" { #endif /* * Name the various locking functions... */ #define LS_LCK_MTX_LOCK "lck_mtx_lock" #define LS_LCK_MTX_SPIN_LOCK "lck_mtx_spin_lock" #define LS_LCK_MTX_UNLOCK "lck_mtx_unlock" #define LS_LCK_MTX_TRY_LOCK "lck_mtx_try_lock" #define LS_LCK_MTX_TRY_SPIN_LOCK "lck_mtx_try_spin_lock" #define LS_LCK_MTX_EXT_LOCK "lck_mtx_ext_lock" #define LS_LCK_MTX_EXT_UNLOCK "lck_mtx_ext_unlock" #define LS_LCK_MTX_LOCK_SPIN_LOCK "lck_mtx_lock_spin" #define LS_LCK_SPIN_LOCK "lck_spin_lock" #define LS_LCK_SPIN_TRY_LOCK "lck_spin_try_lock" #define LS_LCK_SPIN_UNLOCK "lck_spin_unlock" #define LS_LCK_RW_LOCK_SHARED "lck_rw_lock_shared" #define LS_LCK_RW_LOCK_EXCL "lck_rw_lock_exclusive" #define LS_LCK_RW_DONE "lck_rw_done" #define LS_LCK_RW_TRY_LOCK_EXCL "lck_rw_try_lock_exclusive" #define LS_LCK_RW_TRY_LOCK_SHARED "lck_rw_try_lock_shared" #define LS_LCK_RW_LOCK_SHARED_TO_EXCL "lck_rw_lock_shared_to_exclusive" #define LS_LCK_RW_LOCK_EXCL_TO_SHARED "lck_rw_lock_exclusive_to_shared" #define LS_LCK_TICKET_LOCK "lck_ticket_lock" #define LS_LCK_TICKET_UNLOCK "lck_ticket_unlock" #define LS_ACQUIRE "acquire" #define LS_RELEASE "release" #define LS_SPIN "spin" #define LS_BLOCK "block" #define LS_UPGRADE "upgrade" #define LS_DOWNGRADE "downgrade" #define LS_TYPE_ADAPTIVE "adaptive" #define LS_TYPE_SPIN "spin" #define LS_TYPE_RW "rw" #define LS_TYPE_TICKET "ticket" #define LSA_ACQUIRE (LS_TYPE_ADAPTIVE "-" LS_ACQUIRE) #define LSA_RELEASE (LS_TYPE_ADAPTIVE "-" LS_RELEASE) #define LSA_SPIN (LS_TYPE_ADAPTIVE "-" LS_SPIN) #define LSA_BLOCK (LS_TYPE_ADAPTIVE "-" LS_BLOCK) #define LSS_ACQUIRE (LS_TYPE_SPIN "-" LS_ACQUIRE) #define LSS_RELEASE (LS_TYPE_SPIN "-" LS_RELEASE) #define LSS_SPIN (LS_TYPE_SPIN "-" LS_SPIN) #define LSR_ACQUIRE (LS_TYPE_RW "-" LS_ACQUIRE) #define LSR_RELEASE (LS_TYPE_RW "-" LS_RELEASE) #define LSR_BLOCK (LS_TYPE_RW "-" LS_BLOCK) #define LSR_SPIN (LS_TYPE_RW "-" LS_SPIN) #define LSR_UPGRADE (LS_TYPE_RW "-" LS_UPGRADE) #define LSR_DOWNGRADE (LS_TYPE_RW "-" LS_DOWNGRADE) #define LST_ACQUIRE (LS_TYPE_TICKET "-" LS_ACQUIRE) #define LST_RELEASE (LS_TYPE_TICKET "-" LS_RELEASE) #define LST_SPIN (LS_TYPE_TICKET "-" LS_SPIN) #ifdef __cplusplus } #endif #endif /* _SYS_LOCKSTAT_H */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/log_data.h ================================================ /* * Copyright (c) 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@ */ /* */ #ifndef _DATA_LOG_H_ #define _DATA_LOG_H_ /* * rdar://problem/48252465 * This header should be exported only to dexts. */ int log_data_as_kernel(unsigned int tag, unsigned int flags, void *buffer, unsigned int size); #endif /* _DATA_LOG_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/malloc.h ================================================ /* * Copyright (c) 2000-2013 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 (c) 1998, 1999 Apple Computer, Inc. All Rights Reserved */ /* Copyright (c) 1995, 1997 Apple Computer, Inc. All Rights Reserved */ /* * Copyright (c) 1987, 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. * * @(#)malloc.h 8.5 (Berkeley) 5/3/95 */ /* * 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. */ #ifndef _SYS_MALLOC_H_ #define _SYS_MALLOC_H_ #include #endif /* _SYS_MALLOC_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/mbuf.h ================================================ /* * Copyright (c) 1999-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@ */ /* Copyright (c) 1998, 1999 Apple Computer, Inc. All Rights Reserved */ /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */ /* * Mach Operating System * Copyright (c) 1987 Carnegie-Mellon University * All rights reserved. The CMU software License Agreement specifies * the terms and conditions for use and redistribution. */ /* * Copyright (c) 1994 NeXT Computer, Inc. All rights reserved. * * Copyright (c) 1982, 1986, 1988 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. * * @(#)mbuf.h 8.3 (Berkeley) 1/21/94 */ /* * 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. */ #ifndef _SYS_MBUF_H_ #define _SYS_MBUF_H_ #include #include #include /* u_int32_t */ #include /* u_int64_t */ #include /* u_short */ /* mbuf types */ #define MT_FREE 0 /* should be on free list */ #define MT_DATA 1 /* dynamic (data) allocation */ #define MT_HEADER 2 /* packet header */ #define MT_SOCKET 3 /* socket structure */ #define MT_PCB 4 /* protocol control block */ #define MT_RTABLE 5 /* routing tables */ #define MT_HTABLE 6 /* IMP host tables */ #define MT_ATABLE 7 /* address resolution tables */ #define MT_SONAME 8 /* socket name */ #define MT_SOOPTS 10 /* socket options */ #define MT_FTABLE 11 /* fragment reassembly header */ #define MT_RIGHTS 12 /* access rights */ #define MT_IFADDR 13 /* interface address */ #define MT_CONTROL 14 /* extra-data protocol message */ #define MT_OOBDATA 15 /* expedited data */ #define MT_TAG 16 /* volatile metadata associated to pkts */ #define MT_MAX 32 /* enough? */ /* * Mbuf statistics (legacy). */ struct mbstat { u_int32_t m_mbufs; /* mbufs obtained from page pool */ u_int32_t m_clusters; /* clusters obtained from page pool */ u_int32_t m_spare; /* spare field */ u_int32_t m_clfree; /* free clusters */ u_int32_t m_drops; /* times failed to find space */ u_int32_t m_wait; /* times waited for space */ u_int32_t m_drain; /* times drained protocols for space */ u_short m_mtypes[256]; /* type specific mbuf allocations */ u_int32_t m_mcfail; /* times m_copym failed */ u_int32_t m_mpfail; /* times m_pullup failed */ u_int32_t m_msize; /* length of an mbuf */ u_int32_t m_mclbytes; /* length of an mbuf cluster */ u_int32_t m_minclsize; /* min length of data to allocate a cluster */ u_int32_t m_mlen; /* length of data in an mbuf */ u_int32_t m_mhlen; /* length of data in a header mbuf */ u_int32_t m_bigclusters; /* clusters obtained from page pool */ u_int32_t m_bigclfree; /* free clusters */ u_int32_t m_bigmclbytes; /* length of an mbuf cluster */ u_int32_t m_forcedefunct; /* times we force defunct'ed an app's sockets */ }; /* Compatibillity with 10.3 */ struct ombstat { u_int32_t m_mbufs; /* mbufs obtained from page pool */ u_int32_t m_clusters; /* clusters obtained from page pool */ u_int32_t m_spare; /* spare field */ u_int32_t m_clfree; /* free clusters */ u_int32_t m_drops; /* times failed to find space */ u_int32_t m_wait; /* times waited for space */ u_int32_t m_drain; /* times drained protocols for space */ u_short m_mtypes[256]; /* type specific mbuf allocations */ u_int32_t m_mcfail; /* times m_copym failed */ u_int32_t m_mpfail; /* times m_pullup failed */ u_int32_t m_msize; /* length of an mbuf */ u_int32_t m_mclbytes; /* length of an mbuf cluster */ u_int32_t m_minclsize; /* min length of data to allocate a cluster */ u_int32_t m_mlen; /* length of data in an mbuf */ u_int32_t m_mhlen; /* length of data in a header mbuf */ }; /* * mbuf class statistics. */ #define MAX_MBUF_CNAME 15 typedef struct mb_class_stat { char mbcl_cname[MAX_MBUF_CNAME + 1]; /* class name */ u_int32_t mbcl_size; /* buffer size */ u_int32_t mbcl_total; /* # of buffers created */ u_int32_t mbcl_active; /* # of active buffers */ u_int32_t mbcl_infree; /* # of available buffers */ u_int32_t mbcl_slab_cnt; /* # of available slabs */ #if defined(KERNEL) || defined(__LP64__) u_int32_t mbcl_pad; /* padding */ #endif /* KERNEL || __LP64__ */ u_int64_t mbcl_alloc_cnt; /* # of times alloc is called */ u_int64_t mbcl_free_cnt; /* # of times free is called */ u_int64_t mbcl_notified; /* # of notified wakeups */ u_int64_t mbcl_purge_cnt; /* # of purges so far */ u_int64_t mbcl_fail_cnt; /* # of allocation failures */ u_int32_t mbcl_ctotal; /* total only for this class */ u_int32_t mbcl_release_cnt; /* amount of memory returned */ /* * Cache layer statistics */ u_int32_t mbcl_mc_state; /* cache state (see below) */ u_int32_t mbcl_mc_cached; /* # of cached buffers */ u_int32_t mbcl_mc_waiter_cnt; /* # waiters on the cache */ u_int32_t mbcl_mc_wretry_cnt; /* # of wait retries */ u_int32_t mbcl_mc_nwretry_cnt; /* # of no-wait retry attempts */ u_int32_t mbcl_peak_reported; /* last usage peak reported */ u_int32_t mbcl_reserved[7]; /* for future use */ } mb_class_stat_t; #define MCS_DISABLED 0 /* cache is permanently disabled */ #define MCS_ONLINE 1 /* cache is online */ #define MCS_PURGING 2 /* cache is being purged */ #define MCS_OFFLINE 3 /* cache is offline (resizing) */ typedef struct mb_stat { u_int32_t mbs_cnt; /* number of classes */ #if defined(KERNEL) || defined(__LP64__) u_int32_t mbs_pad; /* padding */ #endif /* KERNEL || __LP64__ */ mb_class_stat_t mbs_class[1]; /* class array */ } mb_stat_t; #endif /* !_SYS_MBUF_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/mman.h ================================================ /* * Copyright (c) 2000-2020 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@ */ /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */ /*- * Copyright (c) 1982, 1986, 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. * * @(#)mman.h 8.1 (Berkeley) 6/2/93 */ /* * Currently unsupported: * * [TYM] POSIX_TYPED_MEM_ALLOCATE * [TYM] POSIX_TYPED_MEM_ALLOCATE_CONTIG * [TYM] POSIX_TYPED_MEM_MAP_ALLOCATABLE * [TYM] struct posix_typed_mem_info * [TYM] posix_mem_offset() * [TYM] posix_typed_mem_get_info() * [TYM] posix_typed_mem_open() */ #ifndef _SYS_MMAN_H_ #define _SYS_MMAN_H_ #include #include #include /* * [various] The mode_t, off_t, and size_t types shall be defined as * described in */ #include #include #include #if __DARWIN_C_LEVEL >= 200809L #include #endif /* __DARWIN_C_LEVEL */ /* * Protections are chosen from these bits, or-ed together */ #define PROT_NONE 0x00 /* [MC2] no permissions */ #define PROT_READ 0x01 /* [MC2] pages can be read */ #define PROT_WRITE 0x02 /* [MC2] pages can be written */ #define PROT_EXEC 0x04 /* [MC2] pages can be executed */ /* * Flags contain sharing type and options. * Sharing types; choose one. */ #define MAP_SHARED 0x0001 /* [MF|SHM] share changes */ #define MAP_PRIVATE 0x0002 /* [MF|SHM] changes are private */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define MAP_COPY MAP_PRIVATE /* Obsolete */ #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ /* * Other flags */ #define MAP_FIXED 0x0010 /* [MF|SHM] interpret addr exactly */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define MAP_RENAME 0x0020 /* Sun: rename private pages to file */ #define MAP_NORESERVE 0x0040 /* Sun: don't reserve needed swap area */ #define MAP_RESERVED0080 0x0080 /* previously unimplemented MAP_INHERIT */ #define MAP_NOEXTEND 0x0100 /* for MAP_FILE, don't change file size */ #define MAP_HASSEMAPHORE 0x0200 /* region may contain semaphores */ #define MAP_NOCACHE 0x0400 /* don't cache pages for this mapping */ #define MAP_JIT 0x0800 /* Allocate a region that will be used for JIT purposes */ /* * Mapping type */ #define MAP_FILE 0x0000 /* map from file (default) */ #define MAP_ANON 0x1000 /* allocated from memory, swap space */ #define MAP_ANONYMOUS MAP_ANON /* * The MAP_RESILIENT_* flags can be used when the caller wants to map some * possibly unreliable memory and be able to access it safely, possibly * getting the wrong contents rather than raising any exception. * For safety reasons, such mappings have to be read-only (PROT_READ access * only). * * MAP_RESILIENT_CODESIGN: * accessing this mapping will not generate code-signing violations, * even if the contents are tainted. * MAP_RESILIENT_MEDIA: * accessing this mapping will not generate an exception if the contents * are not available (unreachable removable or remote media, access beyond * end-of-file, ...). Missing contents will be replaced with zeroes. */ #define MAP_RESILIENT_CODESIGN 0x2000 /* no code-signing failures */ #define MAP_RESILIENT_MEDIA 0x4000 /* no backing-store failures */ #if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101500 #define MAP_32BIT 0x8000 /* Return virtual addresses <4G only */ #endif /* defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101500 */ /* * Flags used to support translated processes. */ #define MAP_TRANSLATED_ALLOW_EXECUTE 0x20000 /* allow execute in translated processes */ #define MAP_UNIX03 0x40000 /* UNIX03 compliance */ #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ /* * Process memory locking */ #define MCL_CURRENT 0x0001 /* [ML] Lock only current memory */ #define MCL_FUTURE 0x0002 /* [ML] Lock all future memory as well */ /* * Error return from mmap() */ #define MAP_FAILED ((void *)-1) /* [MF|SHM] mmap failed */ /* * msync() flags */ #define MS_ASYNC 0x0001 /* [MF|SIO] return immediately */ #define MS_INVALIDATE 0x0002 /* [MF|SIO] invalidate all cached data */ #define MS_SYNC 0x0010 /* [MF|SIO] msync synchronously */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define MS_KILLPAGES 0x0004 /* invalidate pages, leave mapped */ #define MS_DEACTIVATE 0x0008 /* deactivate pages, leave mapped */ #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ /* * Advice to madvise */ #define POSIX_MADV_NORMAL 0 /* [MC1] no further special treatment */ #define POSIX_MADV_RANDOM 1 /* [MC1] expect random page refs */ #define POSIX_MADV_SEQUENTIAL 2 /* [MC1] expect sequential page refs */ #define POSIX_MADV_WILLNEED 3 /* [MC1] will need these pages */ #define POSIX_MADV_DONTNEED 4 /* [MC1] dont need these pages */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define MADV_NORMAL POSIX_MADV_NORMAL #define MADV_RANDOM POSIX_MADV_RANDOM #define MADV_SEQUENTIAL POSIX_MADV_SEQUENTIAL #define MADV_WILLNEED POSIX_MADV_WILLNEED #define MADV_DONTNEED POSIX_MADV_DONTNEED #define MADV_FREE 5 /* pages unneeded, discard contents */ #define MADV_ZERO_WIRED_PAGES 6 /* zero the wired pages that have not been unwired before the entry is deleted */ #define MADV_FREE_REUSABLE 7 /* pages can be reused (by anyone) */ #define MADV_FREE_REUSE 8 /* caller wants to reuse those pages */ #define MADV_CAN_REUSE 9 #define MADV_PAGEOUT 10 /* page out now (internal only) */ /* * Return bits from mincore */ #define MINCORE_INCORE 0x1 /* Page is incore */ #define MINCORE_REFERENCED 0x2 /* Page has been referenced by us */ #define MINCORE_MODIFIED 0x4 /* Page has been modified by us */ #define MINCORE_REFERENCED_OTHER 0x8 /* Page has been referenced */ #define MINCORE_MODIFIED_OTHER 0x10 /* Page has been modified */ #define MINCORE_PAGED_OUT 0x20 /* Page has been paged out */ #define MINCORE_COPIED 0x40 /* Page has been copied */ #define MINCORE_ANONYMOUS 0x80 /* Page belongs to an anonymous object */ #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ __BEGIN_DECLS /* [ML] */ int mlockall(int); int munlockall(void); /* [MR] */ int mlock(const void *, size_t); #ifndef _MMAP #define _MMAP /* [MC3]*/ void * mmap(void *, size_t, int, int, int, off_t) __DARWIN_ALIAS(mmap); #endif /* [MPR] */ int mprotect(void *, size_t, int) __DARWIN_ALIAS(mprotect); /* [MF|SIO] */ int msync(void *, size_t, int) __DARWIN_ALIAS_C(msync); /* [MR] */ int munlock(const void *, size_t); /* [MC3]*/ int munmap(void *, size_t) __DARWIN_ALIAS(munmap); /* [SHM] */ int shm_open(const char *, int, ...); int shm_unlink(const char *); /* [ADV] */ int posix_madvise(void *, size_t, int); #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) int madvise(void *, size_t, int); int mincore(const void *, size_t, char *); int minherit(void *, size_t, int); #endif __END_DECLS #endif /* !_SYS_MMAN_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/mount.h ================================================ /* * 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@ */ /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */ /* * Copyright (c) 1989, 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. * * @(#)mount.h 8.21 (Berkeley) 5/20/95 */ /* * 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. */ #ifndef _SYS_MOUNT_H_ #define _SYS_MOUNT_H_ #include #include #include /* needed for vol_capabilities_attr_t */ #include #include #include #include /* XXX needed for user builds */ #include #include /* file system id type */ /* * file system statistics */ #define MFSNAMELEN 15 /* length of fs type name, not inc. null */ #define MFSTYPENAMELEN 16 /* length of fs type name including null */ #if __DARWIN_64_BIT_INO_T #define MNAMELEN MAXPATHLEN /* length of buffer for returned name */ #else /* ! __DARWIN_64_BIT_INO_T */ #define MNAMELEN 90 /* length of buffer for returned name */ #endif /* __DARWIN_64_BIT_INO_T */ #define MNT_EXT_ROOT_DATA_VOL 0x00000001 /* Data volume of root volume group */ #define __DARWIN_STRUCT_STATFS64 { \ uint32_t f_bsize; /* fundamental file system block size */ \ int32_t f_iosize; /* optimal transfer block size */ \ uint64_t f_blocks; /* total data blocks in file system */ \ uint64_t f_bfree; /* free blocks in fs */ \ uint64_t f_bavail; /* free blocks avail to non-superuser */ \ uint64_t f_files; /* total file nodes in file system */ \ uint64_t f_ffree; /* free file nodes in fs */ \ fsid_t f_fsid; /* file system id */ \ uid_t f_owner; /* user that mounted the filesystem */ \ uint32_t f_type; /* type of filesystem */ \ uint32_t f_flags; /* copy of mount exported flags */ \ uint32_t f_fssubtype; /* fs sub-type (flavor) */ \ char f_fstypename[MFSTYPENAMELEN]; /* fs type name */ \ char f_mntonname[MAXPATHLEN]; /* directory on which mounted */ \ char f_mntfromname[MAXPATHLEN]; /* mounted filesystem */ \ uint32_t f_flags_ext; /* extended flags */ \ uint32_t f_reserved[7]; /* For future use */ \ } #if !__DARWIN_ONLY_64_BIT_INO_T struct statfs64 __DARWIN_STRUCT_STATFS64; #endif /* !__DARWIN_ONLY_64_BIT_INO_T */ #if __DARWIN_64_BIT_INO_T struct statfs __DARWIN_STRUCT_STATFS64; #else /* !__DARWIN_64_BIT_INO_T */ /* * LP64 - WARNING - must be kept in sync with struct user_statfs in mount_internal.h. */ struct statfs { short f_otype; /* TEMPORARY SHADOW COPY OF f_type */ short f_oflags; /* TEMPORARY SHADOW COPY OF f_flags */ long f_bsize; /* fundamental file system block size */ long f_iosize; /* optimal transfer block size */ long f_blocks; /* total data blocks in file system */ long f_bfree; /* free blocks in fs */ long f_bavail; /* free blocks avail to non-superuser */ long f_files; /* total file nodes in file system */ long f_ffree; /* free file nodes in fs */ fsid_t f_fsid; /* file system id */ uid_t f_owner; /* user that mounted the filesystem */ short f_reserved1; /* spare for later */ short f_type; /* type of filesystem */ long f_flags; /* copy of mount exported flags */ long f_reserved2[2]; /* reserved for future use */ char f_fstypename[MFSNAMELEN]; /* fs type name */ char f_mntonname[MNAMELEN]; /* directory on which mounted */ char f_mntfromname[MNAMELEN];/* mounted filesystem */ char f_reserved3; /* For alignment */ long f_reserved4[4]; /* For future use */ }; #endif /* __DARWIN_64_BIT_INO_T */ #pragma pack(4) struct vfsstatfs { uint32_t f_bsize; /* fundamental file system block size */ size_t f_iosize; /* optimal transfer block size */ uint64_t f_blocks; /* total data blocks in file system */ uint64_t f_bfree; /* free blocks in fs */ uint64_t f_bavail; /* free blocks avail to non-superuser */ uint64_t f_bused; /* free blocks avail to non-superuser */ uint64_t f_files; /* total file nodes in file system */ uint64_t f_ffree; /* free file nodes in fs */ fsid_t f_fsid; /* file system id */ uid_t f_owner; /* user that mounted the filesystem */ uint64_t f_flags; /* copy of mount exported flags */ char f_fstypename[MFSTYPENAMELEN];/* fs type name inclus */ char f_mntonname[MAXPATHLEN];/* directory on which mounted */ char f_mntfromname[MAXPATHLEN];/* mounted filesystem */ uint32_t f_fssubtype; /* fs sub-type (flavor) */ void *f_reserved[2]; /* For future use == 0 */ }; #pragma pack() /* * User specifiable flags. * * Unmount uses MNT_FORCE flag. */ #define MNT_RDONLY 0x00000001 /* read only filesystem */ #define MNT_SYNCHRONOUS 0x00000002 /* file system written synchronously */ #define MNT_NOEXEC 0x00000004 /* can't exec from filesystem */ #define MNT_NOSUID 0x00000008 /* don't honor setuid bits on fs */ #define MNT_NODEV 0x00000010 /* don't interpret special files */ #define MNT_UNION 0x00000020 /* union with underlying filesystem */ #define MNT_ASYNC 0x00000040 /* file system written asynchronously */ #define MNT_CPROTECT 0x00000080 /* file system supports content protection */ /* * NFS export related mount flags. */ #define MNT_EXPORTED 0x00000100 /* file system is exported */ /* * Denotes storage which can be removed from the system by the user. */ #define MNT_REMOVABLE 0x00000200 /* * MAC labeled / "quarantined" flag */ #define MNT_QUARANTINE 0x00000400 /* file system is quarantined */ /* * Flags set by internal operations. */ #define MNT_LOCAL 0x00001000 /* filesystem is stored locally */ #define MNT_QUOTA 0x00002000 /* quotas are enabled on filesystem */ #define MNT_ROOTFS 0x00004000 /* identifies the root filesystem */ #define MNT_DOVOLFS 0x00008000 /* FS supports volfs (deprecated flag in Mac OS X 10.5) */ #define MNT_DONTBROWSE 0x00100000 /* file system is not appropriate path to user data */ #define MNT_IGNORE_OWNERSHIP 0x00200000 /* VFS will ignore ownership information on filesystem objects */ #define MNT_AUTOMOUNTED 0x00400000 /* filesystem was mounted by automounter */ #define MNT_JOURNALED 0x00800000 /* filesystem is journaled */ #define MNT_NOUSERXATTR 0x01000000 /* Don't allow user extended attributes */ #define MNT_DEFWRITE 0x02000000 /* filesystem should defer writes */ #define MNT_MULTILABEL 0x04000000 /* MAC support for individual labels */ #define MNT_NOATIME 0x10000000 /* disable update of file access time */ #define MNT_SNAPSHOT 0x40000000 /* The mount is a snapshot */ #define MNT_STRICTATIME 0x80000000 /* enable strict update of file access time */ /* backwards compatibility only */ #define MNT_UNKNOWNPERMISSIONS MNT_IGNORE_OWNERSHIP /* * XXX I think that this could now become (~(MNT_CMDFLAGS)) * but the 'mount' program may need changing to handle this. */ #define MNT_VISFLAGMASK (MNT_RDONLY | MNT_SYNCHRONOUS | MNT_NOEXEC | \ MNT_NOSUID | MNT_NODEV | MNT_UNION | \ MNT_ASYNC | MNT_EXPORTED | MNT_QUARANTINE | \ MNT_LOCAL | MNT_QUOTA | MNT_REMOVABLE | \ MNT_ROOTFS | MNT_DOVOLFS | MNT_DONTBROWSE | \ MNT_IGNORE_OWNERSHIP | MNT_AUTOMOUNTED | MNT_JOURNALED | \ MNT_NOUSERXATTR | MNT_DEFWRITE | MNT_MULTILABEL | \ MNT_NOATIME | MNT_STRICTATIME | MNT_SNAPSHOT | MNT_CPROTECT) /* * External filesystem command modifier flags. * Unmount can use the MNT_FORCE flag. * XXX These are not STATES and really should be somewhere else. * External filesystem control flags. */ #define MNT_UPDATE 0x00010000 /* not a real mount, just an update */ #define MNT_NOBLOCK 0x00020000 /* don't block unmount if not responding */ #define MNT_RELOAD 0x00040000 /* reload filesystem data */ #define MNT_FORCE 0x00080000 /* force unmount or readonly change */ #define MNT_CMDFLAGS (MNT_UPDATE|MNT_NOBLOCK|MNT_RELOAD|MNT_FORCE) /* * Sysctl CTL_VFS definitions. * * Second level identifier specifies which filesystem. Second level * identifier VFS_GENERIC returns information about all filesystems. */ #define VFS_GENERIC 0 /* generic filesystem information */ #define VFS_NUMMNTOPS 1 /* int: total num of vfs mount/unmount operations */ /* * Third level identifiers for VFS_GENERIC are given below; third * level identifiers for specific filesystems are given in their * mount specific header files. */ #define VFS_MAXTYPENUM 1 /* int: highest defined filesystem type */ #define VFS_CONF 2 /* struct: vfsconf for filesystem given * as next argument */ /* * Flags for various system call interfaces. * * waitfor flags to vfs_sync() and getfsstat() */ #define MNT_WAIT 1 /* synchronized I/O file integrity completion */ #define MNT_NOWAIT 2 /* start all I/O, but do not wait for it */ #define MNT_DWAIT 4 /* synchronized I/O data integrity completion */ #if !defined(KERNEL) && !defined(_KERN_SYS_KERNELTYPES_H_) /* also defined in kernel_types.h */ struct mount; typedef struct mount * mount_t; struct vnode; typedef struct vnode * vnode_t; #endif /* Reserved fields preserve binary compatibility */ struct vfsconf { uint32_t vfc_reserved1; /* opaque */ char vfc_name[MFSNAMELEN]; /* filesystem type name */ int vfc_typenum; /* historic filesystem type number */ int vfc_refcount; /* number mounted of this type */ int vfc_flags; /* permanent flags */ uint32_t vfc_reserved2; /* opaque */ uint32_t vfc_reserved3; /* opaque */ }; struct vfsidctl { int vc_vers; /* should be VFSIDCTL_VERS1 (below) */ fsid_t vc_fsid; /* fsid to operate on. */ void *vc_ptr; /* pointer to data structure. */ size_t vc_len; /* sizeof said structure. */ u_int32_t vc_spare[12]; /* spare (must be zero). */ }; /* vfsidctl API version. */ #define VFS_CTL_VERS1 0x01 /* * New style VFS sysctls, do not reuse/conflict with the namespace for * private sysctls. */ #define VFS_CTL_OSTATFS 0x00010001 /* old legacy statfs */ #define VFS_CTL_UMOUNT 0x00010002 /* unmount */ #define VFS_CTL_QUERY 0x00010003 /* anything wrong? (vfsquery) */ #define VFS_CTL_NEWADDR 0x00010004 /* reconnect to new address */ #define VFS_CTL_TIMEO 0x00010005 /* set timeout for vfs notification */ #define VFS_CTL_NOLOCKS 0x00010006 /* disable file locking */ #define VFS_CTL_SADDR 0x00010007 /* get server address */ #define VFS_CTL_DISC 0x00010008 /* server disconnected */ #define VFS_CTL_SERVERINFO 0x00010009 /* information about fs server */ #define VFS_CTL_NSTATUS 0x0001000A /* netfs mount status */ #define VFS_CTL_STATFS64 0x0001000B /* statfs64 */ /* * Automatically select the correct VFS_CTL_*STATFS* flavor based * on what "struct statfs" layout the client will use. */ #if __DARWIN_64_BIT_INO_T #define VFS_CTL_STATFS VFS_CTL_STATFS64 #else #define VFS_CTL_STATFS VFS_CTL_OSTATFS #endif struct vfsquery { u_int32_t vq_flags; u_int32_t vq_spare[31]; }; struct vfs_server { int32_t vs_minutes; /* minutes until server goes down. */ u_int8_t vs_server_name[MAXHOSTNAMELEN * 3]; /* UTF8 server name to display (null terminated) */ }; /* * NetFS mount status - returned by VFS_CTL_NSTATUS */ struct netfs_status { u_int32_t ns_status; // Current status of mount (vfsquery flags) char ns_mountopts[512]; // Significant mount options uint32_t ns_waittime; // Time waiting for reply (sec) uint32_t ns_threadcount; // Number of threads blocked on network calls uint64_t ns_threadids[0]; // Thread IDs of those blocked threads }; /* vfsquery flags */ #define VQ_NOTRESP 0x0001 /* server down */ #define VQ_NEEDAUTH 0x0002 /* server bad auth */ #define VQ_LOWDISK 0x0004 /* we're low on space */ #define VQ_MOUNT 0x0008 /* new filesystem arrived */ #define VQ_UNMOUNT 0x0010 /* filesystem has left */ #define VQ_DEAD 0x0020 /* filesystem is dead, needs force unmount */ #define VQ_ASSIST 0x0040 /* filesystem needs assistance from external program */ #define VQ_NOTRESPLOCK 0x0080 /* server lockd down */ #define VQ_UPDATE 0x0100 /* filesystem information has changed */ #define VQ_VERYLOWDISK 0x0200 /* file system has *very* little disk space left */ #define VQ_SYNCEVENT 0x0400 /* a sync just happened (not set by kernel starting Mac OS X 10.9) */ #define VQ_SERVEREVENT 0x0800 /* server issued notification/warning */ #define VQ_QUOTA 0x1000 /* a user quota has been hit */ #define VQ_NEARLOWDISK 0x2000 /* Above lowdisk and below desired disk space */ #define VQ_DESIRED_DISK 0x4000 /* the desired disk space */ #define VQ_FREE_SPACE_CHANGE 0x8000 /* free disk space has significantly changed */ #define VQ_FLAG10000 0x10000 /* placeholder */ /* * Generic file handle */ #define NFS_MAX_FH_SIZE NFSV4_MAX_FH_SIZE #define NFSV4_MAX_FH_SIZE 128 #define NFSV3_MAX_FH_SIZE 64 #define NFSV2_MAX_FH_SIZE 32 struct fhandle { unsigned int fh_len; /* length of file handle */ unsigned char fh_data[NFS_MAX_FH_SIZE]; /* file handle value */ }; typedef struct fhandle fhandle_t; __BEGIN_DECLS int fhopen(const struct fhandle *, int); int fstatfs(int, struct statfs *) __DARWIN_INODE64(fstatfs); #if !__DARWIN_ONLY_64_BIT_INO_T int fstatfs64(int, struct statfs64 *) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_6, __IPHONE_NA, __IPHONE_NA); #endif /* !__DARWIN_ONLY_64_BIT_INO_T */ int getfh(const char *, fhandle_t *); int getfsstat(struct statfs *, int, int) __DARWIN_INODE64(getfsstat); #if !__DARWIN_ONLY_64_BIT_INO_T int getfsstat64(struct statfs64 *, int, int) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_6, __IPHONE_NA, __IPHONE_NA); #endif /* !__DARWIN_ONLY_64_BIT_INO_T */ int getmntinfo(struct statfs **, int) __DARWIN_INODE64(getmntinfo); int getmntinfo_r_np(struct statfs **, int) __DARWIN_INODE64(getmntinfo_r_np) __OSX_AVAILABLE(10.13) __IOS_AVAILABLE(11.0) __TVOS_AVAILABLE(11.0) __WATCHOS_AVAILABLE(4.0); #if !__DARWIN_ONLY_64_BIT_INO_T int getmntinfo64(struct statfs64 **, int) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_6, __IPHONE_NA, __IPHONE_NA); #endif /* !__DARWIN_ONLY_64_BIT_INO_T */ int mount(const char *, const char *, int, void *); int fmount(const char *, int, int, void *) __OSX_AVAILABLE(10.13) __IOS_AVAILABLE(11.0) __TVOS_AVAILABLE(11.0) __WATCHOS_AVAILABLE(4.0); int statfs(const char *, struct statfs *) __DARWIN_INODE64(statfs); #if !__DARWIN_ONLY_64_BIT_INO_T int statfs64(const char *, struct statfs64 *) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_6, __IPHONE_NA, __IPHONE_NA); #endif /* !__DARWIN_ONLY_64_BIT_INO_T */ int unmount(const char *, int); int getvfsbyname(const char *, struct vfsconf *); __END_DECLS #endif /* !_SYS_MOUNT_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/msg.h ================================================ /* * 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@ */ /* $NetBSD: msg.h,v 1.4 1994/06/29 06:44:43 cgd Exp $ */ /* * SVID compatible msg.h file * * Author: Daniel Boulet * * Copyright 1993 Daniel Boulet and RTMX Inc. * * This system call was implemented by Daniel Boulet under contract from RTMX. * * Redistribution and use in source forms, with and without modification, * are permitted provided that this entire comment appears intact. * * Redistribution in binary form may occur without any restrictions. * Obviously, it would be nice if you gave credit where credit is due * but requiring it would be too onerous. * * This software is provided ``AS IS'' without any warranties of any kind. */ /* * 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. */ #ifndef _SYS_MSG_H_ #define _SYS_MSG_H_ #include #include #include /* * [XSI] All of the symbols from SHALL be defined when this * header is included */ #include /* * [XSI] The pid_t, time_t, key_t, size_t, and ssize_t types shall be * defined as described in . * * NOTE: The definition of the key_t type is implicit from the * inclusion of */ #include #include #include #include /* [XSI] Used for the number of messages in the message queue */ typedef unsigned long msgqnum_t; /* [XSI] Used for the number of bytes allowed in a message queue */ typedef unsigned long msglen_t; /* * Possible values for the fifth parameter to msgrcv(), in addition to the * IPC_NOWAIT flag, which is permitted. */ #define MSG_NOERROR 010000 /* [XSI] No error if big message */ /* * Technically, we should force all code references to the new structure * definition, not in just the standards conformance case, and leave the * legacy interface there for binary compatibility only. Currently, we * are only forcing this for programs requesting standards conformance. */ #if __DARWIN_UNIX03 || defined(KERNEL) #pragma pack(4) /* * Structure used internally. * * Structure whose address is passed as the third parameter to msgctl() * when the second parameter is IPC_SET or IPC_STAT. In the case of the * IPC_SET command, only the msg_perm.{uid|gid|perm} and msg_qbytes are * honored. In the case of IPC_STAT, only the fields indicated as [XSI] * mandated fields are guaranteed to meaningful: DO NOT depend on the * contents of the other fields. * * NOTES: Reserved fields are not preserved across IPC_SET/IPC_STAT. */ #if (defined(_POSIX_C_SOURCE) && !defined(_DARWIN_C_SOURCE)) struct msqid_ds #else #define msqid_ds __msqid_ds_new struct __msqid_ds_new #endif { struct __ipc_perm_new msg_perm; /* [XSI] msg queue permissions */ __int32_t msg_first; /* RESERVED: kernel use only */ __int32_t msg_last; /* RESERVED: kernel use only */ msglen_t msg_cbytes; /* # of bytes on the queue */ msgqnum_t msg_qnum; /* [XSI] number of msgs on the queue */ msglen_t msg_qbytes; /* [XSI] max bytes on the queue */ pid_t msg_lspid; /* [XSI] pid of last msgsnd() */ pid_t msg_lrpid; /* [XSI] pid of last msgrcv() */ time_t msg_stime; /* [XSI] time of last msgsnd() */ __int32_t msg_pad1; /* RESERVED: DO NOT USE */ time_t msg_rtime; /* [XSI] time of last msgrcv() */ __int32_t msg_pad2; /* RESERVED: DO NOT USE */ time_t msg_ctime; /* [XSI] time of last msgctl() */ __int32_t msg_pad3; /* RESERVED: DO NOT USE */ __int32_t msg_pad4[4]; /* RESERVED: DO NOT USE */ }; #pragma pack() #else /* !__DARWIN_UNIX03 */ #define msqid_ds __msqid_ds_old #endif /* !__DARWIN_UNIX03 */ #if !__DARWIN_UNIX03 struct __msqid_ds_old { struct __ipc_perm_old msg_perm; /* [XSI] msg queue permissions */ __int32_t msg_first; /* RESERVED: kernel use only */ __int32_t msg_last; /* RESERVED: kernel use only */ msglen_t msg_cbytes; /* # of bytes on the queue */ msgqnum_t msg_qnum; /* [XSI] number of msgs on the queue */ msglen_t msg_qbytes; /* [XSI] max bytes on the queue */ pid_t msg_lspid; /* [XSI] pid of last msgsnd() */ pid_t msg_lrpid; /* [XSI] pid of last msgrcv() */ time_t msg_stime; /* [XSI] time of last msgsnd() */ __int32_t msg_pad1; /* RESERVED: DO NOT USE */ time_t msg_rtime; /* [XSI] time of last msgrcv() */ __int32_t msg_pad2; /* RESERVED: DO NOT USE */ time_t msg_ctime; /* [XSI] time of last msgctl() */ __int32_t msg_pad3; /* RESERVED: DO NOT USE */ __int32_t msg_pad4[4]; /* RESERVED: DO NOT USE */ }; #endif /* !__DARWIN_UNIX03 */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #ifdef __APPLE_API_UNSTABLE /* XXX kernel only; protect with macro later */ struct msg { struct msg *msg_next; /* next msg in the chain */ long msg_type; /* type of this message */ /* >0 -> type of this message */ /* 0 -> free header */ unsigned short msg_ts; /* size of this message */ short msg_spot; /* location of msg start in buffer */ struct label *label; /* MAC label */ }; /* * Example structure describing a message whose address is to be passed as * the second argument to the functions msgrcv() and msgsnd(). The only * actual hard requirement is that the first field be of type long, and * contain the message type. The user is encouraged to define their own * application specific structure; this definition is included solely for * backward compatability with existing source code. */ struct mymsg { long mtype; /* message type (+ve integer) */ char mtext[1]; /* message body */ }; /* * Based on the configuration parameters described in an SVR2 (yes, two) * config(1m) man page. * * Each message is broken up and stored in segments that are msgssz bytes * long. For efficiency reasons, this should be a power of two. Also, * it doesn't make sense if it is less than 8 or greater than about 256. * Consequently, msginit in kern/sysv_msg.c checks that msgssz is a power of * two between 8 and 1024 inclusive (and panic's if it isn't). */ struct msginfo { int msgmax, /* max chars in a message */ msgmni, /* max message queue identifiers */ msgmnb, /* max chars in a queue */ msgtql, /* max messages in system */ msgssz, /* size of a message segment (see notes above) */ msgseg; /* number of message segments */ }; #endif /* __APPLE_API_UNSTABLE */ #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ __BEGIN_DECLS #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) int msgsys(int, ...); #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ int msgctl(int, int, struct msqid_ds *) __DARWIN_ALIAS(msgctl); int msgget(key_t, int); ssize_t msgrcv(int, void *, size_t, long, int) __DARWIN_ALIAS_C(msgrcv); int msgsnd(int, const void *, size_t, int) __DARWIN_ALIAS_C(msgsnd); __END_DECLS #endif /* !_SYS_MSG_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/msgbuf.h ================================================ /* * Copyright (c) 2000-2010 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 (c) 1995 NeXT Computer, Inc. All Rights Reserved */ /* * Copyright (c) 1981, 1984, 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. * * @(#)msgbuf.h 8.1 (Berkeley) 6/2/93 */ #ifndef _SYS_MSGBUF_H_ #define _SYS_MSGBUF_H_ #include #define MAX_MSG_BSIZE (1*1024*1024) struct msgbuf { #define MSG_MAGIC 0x063061 int msg_magic; int msg_size; int msg_bufx; /* write pointer */ int msg_bufr; /* read pointer */ char *msg_bufc; /* buffer */ }; #endif /* !_SYS_MSGBUF_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/netport.h ================================================ /* * 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@ */ /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */ /* * Copyright (c) 1987,1988,1989 Carnegie-Mellon University All rights reserved. */ #ifndef _SYS_NETPORT_H_ #define _SYS_NETPORT_H_ #include <_types/_uint32_t.h> /* uint32_t */ typedef uint32_t netaddr_t; /* * Network Port structure. */ typedef struct { long np_uid_high; long np_uid_low; } np_uid_t; typedef struct { netaddr_t np_receiver; netaddr_t np_owner; np_uid_t np_puid; np_uid_t np_sid; } network_port_t; #endif /* !_SYS_NETPORT_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/param.h ================================================ /* * 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@ */ /* Copyright (c) 1995, 1997 Apple Computer, Inc. All Rights Reserved */ /*- * Copyright (c) 1982, 1986, 1989, 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.3 (Berkeley) 4/4/95 */ #ifndef _SYS_PARAM_H_ #define _SYS_PARAM_H_ #define BSD 199506 /* System version (year & month). */ #define BSD4_3 1 #define BSD4_4 1 #define NeXTBSD 1995064 /* NeXTBSD version (year, month, release) */ #define NeXTBSD4_0 0 /* NeXTBSD 4.0 */ #include #include #ifndef LOCORE #include #endif /* * Machine-independent constants (some used in following include files). * Redefined constants are from POSIX 1003.1 limits file. * * MAXCOMLEN should be >= sizeof(ac_comm) (see ) * MAXLOGNAME should be >= UT_NAMESIZE (see ) */ #include #define MAXCOMLEN 16 /* max command name remembered */ #define MAXINTERP 64 /* max interpreter file name length */ #define MAXLOGNAME 255 /* max login name length */ #define MAXUPRC CHILD_MAX /* max simultaneous processes */ #define NCARGS ARG_MAX /* max bytes for an exec function */ #define NGROUPS NGROUPS_MAX /* max number groups */ #define NOFILE 256 /* default max open files per process */ #define NOGROUP 65535 /* marker for empty group set member */ #define MAXHOSTNAMELEN 256 /* max hostname size */ #define MAXDOMNAMELEN 256 /* maximum domain name length */ /* Machine type dependent parameters. */ #include /* More types and definitions used throughout the kernel. */ #include /* Signals. */ #include /* * Priorities. Note that with 32 run queues, differences less than 4 are * insignificant. */ #define PSWP 0 #define PVM 4 #define PINOD 8 #define PRIBIO 16 #define PVFS 20 #define PZERO 22 /* No longer magic, shouldn't be here. XXX */ #define PSOCK 24 #define PWAIT 32 #define PLOCK 36 #define PPAUSE 40 #define PUSER 50 #define MAXPRI 127 /* Priorities range from 0 through MAXPRI. */ #define PRIMASK 0x0ff #define PCATCH 0x100 /* OR'd with pri for tsleep to check signals */ #define PTTYBLOCK 0x200 /* for tty SIGTTOU and SIGTTIN blocking */ #define PDROP 0x400 /* OR'd with pri to stop re-aquistion of mutex upon wakeup */ #define PSPIN 0x800 /* OR'd with pri to require mutex in spin mode upon wakeup */ #define NBPW sizeof(int) /* number of bytes per word (integer) */ #define CMASK 022 /* default file mask: S_IWGRP|S_IWOTH */ #define NODEV (dev_t)(-1) /* non-existent device */ /* * Clustering of hardware pages on machines with ridiculously small * page sizes is done here. The paging subsystem deals with units of * CLSIZE pte's describing NBPG (from machine/param.h) pages each. */ #define CLBYTES (CLSIZE*NBPG) #define CLOFSET (CLSIZE*NBPG-1) /* for clusters, like PGOFSET */ #define claligned(x) ((((int)(x))&CLOFSET)==0) #define CLOFF CLOFSET #define CLSHIFT (PGSHIFT+CLSIZELOG2) #if CLSIZE == 1 #define clbase(i) (i) #define clrnd(i) (i) #else /* Give the base virtual address (first of CLSIZE). */ #define clbase(i) ((i) &~ (CLSIZE-1)) /* Round a number of clicks up to a whole cluster. */ #define clrnd(i) (((i) + (CLSIZE-1)) &~ (CLSIZE-1)) #endif #define CBLOCK 64 /* Clist block size, must be a power of 2. */ #define CBQSIZE (CBLOCK/NBBY) /* Quote bytes/cblock - can do better. */ /* Data chars/clist. */ #define CBSIZE (CBLOCK - sizeof(struct cblock *) - CBQSIZE) #define CROUND (CBLOCK - 1) /* Clist rounding. */ /* * File system parameters and macros. * * The file system is made out of blocks of at most MAXPHYS units, with * smaller units (fragments) only in the last direct block. MAXBSIZE * primarily determines the size of buffers in the buffer pool. It may be * made larger than MAXPHYS without any effect on existing file systems; * however making it smaller may make some file systems unmountable. * We set this to track the value of MAX_UPL_TRANSFER_BYTES from * osfmk/mach/memory_object_types.h to bound it at the maximum UPL size. */ #define MAXBSIZE (256 * 4096) #define MAXPHYSIO MAXPHYS #define MAXFRAG 8 #define MAXPHYSIO_WIRED (16 * 1024 * 1024) /* * MAXPATHLEN defines the longest permissable path length after expanding * symbolic links. It is used to allocate a temporary buffer from the buffer * pool in which to do the name expansion, hence should be a power of two, * and must be less than or equal to MAXBSIZE. MAXSYMLINKS defines the * maximum number of symbolic links that may be expanded in a path name. * It should be set high enough to allow all legitimate uses, but halt * infinite loops reasonably quickly. */ #define MAXPATHLEN PATH_MAX #define MAXSYMLINKS 32 /* Bit map related macros. */ #define setbit(a, i) (((unsigned char *)(a))[(i)/NBBY] |= 1u<<((i)%NBBY)) #define clrbit(a, i) (((unsigned char *)(a))[(i)/NBBY] &= ~(1u<<((i)%NBBY))) #define isset(a, i) (((unsigned char *)(a))[(i)/NBBY] & (1u<<((i)%NBBY))) #define isclr(a, i) ((((unsigned char *)(a))[(i)/NBBY] & (1u<<((i)%NBBY))) == 0) /* Macros for counting and rounding. */ #ifndef howmany #define howmany(x, y) ((((x) % (y)) == 0) ? ((x) / (y)) : (((x) / (y)) + 1)) #endif #define roundup(x, y) ((((x) % (y)) == 0) ? \ (x) : ((x) + ((y) - ((x) % (y))))) #define powerof2(x) ((((x)-1)&(x))==0) /* Macros for min/max. */ #ifndef MIN #define MIN(a, b) (((a)<(b))?(a):(b)) #endif /* MIN */ #ifndef MAX #define MAX(a, b) (((a)>(b))?(a):(b)) #endif /* MAX */ /* * Scale factor for scaled integers used to count %cpu time and load avgs. * * The number of CPU `tick's that map to a unique `%age' can be expressed * by the formula (1 / (2 ^ (FSHIFT - 11))). The maximum load average that * can be calculated (assuming 32 bits) can be closely approximated using * the formula (2 ^ (2 * (16 - FSHIFT))) for (FSHIFT < 15). * * For the scheduler to maintain a 1:1 mapping of CPU `tick' to `%age', * FSHIFT must be at least 11; this gives us a maximum load avg of ~1024. */ #define FSHIFT 11 /* bits to right of fixed binary point */ #define FSCALE (1< #ifdef __APPLE_API_PRIVATE /* Provides support for system wide forks */ #define _PATH_FORKSPECIFIER "/..namedfork/" #define _PATH_DATANAME "data" #define _PATH_RSRCNAME "rsrc" #define _PATH_RSRCFORKSPEC "/..namedfork/rsrc" #endif /* __APPLE_API_PRIVATE */ #endif /* !_SYS_PATHS_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/pipe.h ================================================ /* * Copyright (c) 2004-2020 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@ */ /* * Copyright (c) 1996 John S. Dyson * 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 immediately at the beginning of the file, without modification, * 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. Absolutely no warranty of function or purpose is made by the author * John S. Dyson. * 4. This work was done expressly for inclusion into FreeBSD. Other use * is allowed if this notation is included. * 5. Modifications may be freely made to this file if the above conditions * are met. * * $FreeBSD: src/sys/sys/pipe.h,v 1.24 2003/08/13 20:01:38 alc Exp $ */ /* * NOTICE: This file was modified by SPARTA, Inc. in 2006 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. */ #ifndef _SYS_PIPE_H_ #define _SYS_PIPE_H_ #include /* for TAILQ macros */ #include #include #include #include /* * Pipe buffer size, keep moderate in value, pipes take kva space. */ #ifndef PIPE_SIZE #define PIPE_SIZE 16384 #endif #define PIPE_KVAMAX (1024 * 1024 * 16) #ifndef BIG_PIPE_SIZE #define BIG_PIPE_SIZE (64*1024) #endif #ifndef SMALL_PIPE_SIZE #define SMALL_PIPE_SIZE PAGE_SIZE #endif /* * PIPE_MINDIRECT MUST be smaller than PIPE_SIZE and MUST be bigger * than PIPE_BUF. */ #ifndef PIPE_MINDIRECT #define PIPE_MINDIRECT 8192 #endif #define PIPENPAGES (BIG_PIPE_SIZE / PAGE_SIZE + 1) /* * Pipe buffer information. * Separate in, out, cnt are used to simplify calculations. * Buffered write is active when the buffer.cnt field is set. */ struct pipebuf { u_int cnt; /* number of chars currently in buffer */ u_int in; /* in pointer */ u_int out; /* out pointer */ u_int size; /* size of buffer */ caddr_t buffer; /* kva of buffer */ }; #ifdef PIPE_DIRECT /* * Information to support direct transfers between processes for pipes. */ struct pipemapping { vm_offset_t kva; /* kernel virtual address */ vm_size_t cnt; /* number of chars in buffer */ vm_size_t pos; /* current position of transfer */ int npages; /* number of pages */ vm_page_t ms[PIPENPAGES]; /* pages in source process */ }; #endif /* * Bits in pipe_state. */ #define PIPE_ASYNC 0x004 /* Async? I/O. */ #define PIPE_WANTR 0x008 /* Reader wants some characters. */ #define PIPE_WANTW 0x010 /* Writer wants space to put characters. */ #define PIPE_WANT 0x020 /* Pipe is wanted to be run-down. */ // was PIPE_SEL 0x040 /* Pipe has a select active. */ #define PIPE_EOF 0x080 /* Pipe is in EOF condition. */ #define PIPE_LOCKFL 0x100 /* Process has exclusive access to pointers/data. */ #define PIPE_LWANT 0x200 /* Process wants exclusive access to pointers/data. */ #define PIPE_DIRECTW 0x400 /* Pipe direct write active. */ #define PIPE_DIRECTOK 0x800 /* Direct mode ok. */ // was PIPE_KNOTE 0x1000 #define PIPE_DRAIN 0x2000 /* Waiting for I/O to drop for a close. Treated like EOF; * only separate for easier debugging. */ #define PIPE_WSELECT 0x4000 /* Some thread has done an FWRITE select on the pipe */ #define PIPE_DEAD 0x8000 /* Pipe is dead and needs garbage collection */ #endif /* !_SYS_PIPE_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/poll.h ================================================ /* * Copyright (c) 2000-2004 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@ */ /*- * Copyright (c) 1997 Peter Wemm * 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. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. * */ #ifndef _SYS_POLL_H_ #define _SYS_POLL_H_ /* * This file is intended to be compatible with the traditional poll.h. */ /* * Requestable events. If poll(2) finds any of these set, they are * copied to revents on return. */ #define POLLIN 0x0001 /* any readable data available */ #define POLLPRI 0x0002 /* OOB/Urgent readable data */ #define POLLOUT 0x0004 /* file descriptor is writeable */ #define POLLRDNORM 0x0040 /* non-OOB/URG data available */ #define POLLWRNORM POLLOUT /* no write type differentiation */ #define POLLRDBAND 0x0080 /* OOB/Urgent readable data */ #define POLLWRBAND 0x0100 /* OOB/Urgent data can be written */ /* * FreeBSD extensions: polling on a regular file might return one * of these events (currently only supported on local filesystems). */ #define POLLEXTEND 0x0200 /* file may have been extended */ #define POLLATTRIB 0x0400 /* file attributes may have changed */ #define POLLNLINK 0x0800 /* (un)link/rename may have happened */ #define POLLWRITE 0x1000 /* file's contents may have changed */ /* * These events are set if they occur regardless of whether they were * requested. */ #define POLLERR 0x0008 /* some poll error occurred */ #define POLLHUP 0x0010 /* file descriptor was "hung up" */ #define POLLNVAL 0x0020 /* requested events "invalid" */ #define POLLSTANDARD (POLLIN|POLLPRI|POLLOUT|POLLRDNORM|POLLRDBAND|\ POLLWRBAND|POLLERR|POLLHUP|POLLNVAL) struct pollfd { int fd; short events; short revents; }; typedef unsigned int nfds_t; #include __BEGIN_DECLS /* * This is defined here (instead of ) because this is where * traditional SVR4 code will look to find it. */ extern int poll(struct pollfd *, nfds_t, int) __DARWIN_ALIAS_C(poll); __END_DECLS #endif /* !_SYS_POLL_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/posix_sem.h ================================================ /* * Copyright (c) 1999-2003 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@ */ /* * Copyright (c) 1990, 1996-1998 Apple Computer, Inc. * All Rights Reserved. */ /* * posix_shm.c : Support for POSIX semaphore APIs * * File: posix_sem.c * Author: Ananthakrishna Ramesh * * HISTORY * 2-Sep-1999 A.Ramesh * Created for MacOSX * */ #ifndef _SYS_POSIX_SEM_H_ #define _SYS_POSIX_SEM_H_ #include #include #include struct label; #define PSEMNAMLEN 31 /* maximum name segment length we bother with */ struct pseminfo { unsigned int psem_flags; unsigned int psem_usecount; mode_t psem_mode; uid_t psem_uid; gid_t psem_gid; char psem_name[PSEMNAMLEN + 1]; /* segment name */ void * psem_semobject; struct label * psem_label; pid_t psem_creator_pid; uint64_t psem_creator_uniqueid; }; #define PSEMINFO_NULL (struct pseminfo *)0 #define PSEM_NONE 1 #define PSEM_DEFINED 2 #define PSEM_ALLOCATED 4 #define PSEM_MAPPED 8 #define PSEM_INUSE 0x10 #define PSEM_REMOVED 0x20 #define PSEM_INCREATE 0x40 #define PSEM_INDELETE 0x80 #endif ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/posix_shm.h ================================================ /* * Copyright (c) 1999-2003 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@ */ /* * Copyright (c) 1990, 1996-1998 Apple Computer, Inc. * All Rights Reserved. */ /* * posix_shm.c : Support for POSIX shared memory APIs * * File: posix_shm.c * Author: Ananthakrishna Ramesh * * HISTORY * 2-Sep-1999 A.Ramesh * Created for MacOSX * */ #ifndef _SYS_POSIX_SHM_H_ #define _SYS_POSIX_SHM_H_ #include #include #include struct label; #define PSHMNAMLEN 31 /* maximum name segment length we bother with */ struct pshminfo { unsigned int pshm_flags; unsigned int pshm_usecount; off_t pshm_length; mode_t pshm_mode; uid_t pshm_uid; gid_t pshm_gid; char pshm_name[PSHMNAMLEN + 1]; void *pshm_memobject; struct label *pshm_label; }; #endif ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/proc.h ================================================ /* * 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@ */ /* Copyright (c) 1995, 1997 Apple Computer, Inc. All Rights Reserved */ /*- * Copyright (c) 1986, 1989, 1991, 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. * * @(#)proc.h 8.15 (Berkeley) 5/19/95 */ #ifndef _SYS_PROC_H_ #define _SYS_PROC_H_ #include #include #include /* For struct selinfo. */ #include #include #include #include #include #include #include struct session; struct pgrp; struct proc; struct proc_ident; /* Exported fields for kern sysctls */ struct extern_proc { union { struct { struct proc *__p_forw; /* Doubly-linked run/sleep queue. */ struct proc *__p_back; } p_st1; struct timeval __p_starttime; /* process start time */ } p_un; #define p_forw p_un.p_st1.__p_forw #define p_back p_un.p_st1.__p_back #define p_starttime p_un.__p_starttime struct vmspace *p_vmspace; /* Address space. */ struct sigacts *p_sigacts; /* Signal actions, state (PROC ONLY). */ int p_flag; /* P_* flags. */ char p_stat; /* S* process status. */ pid_t p_pid; /* Process identifier. */ pid_t p_oppid; /* Save parent pid during ptrace. XXX */ int p_dupfd; /* Sideways return value from fdopen. XXX */ /* Mach related */ caddr_t user_stack; /* where user stack was allocated */ void *exit_thread; /* XXX Which thread is exiting? */ int p_debugger; /* allow to debug */ boolean_t sigwait; /* indication to suspend */ /* scheduling */ u_int p_estcpu; /* Time averaged value of p_cpticks. */ int p_cpticks; /* Ticks of cpu time. */ fixpt_t p_pctcpu; /* %cpu for this process during p_swtime */ void *p_wchan; /* Sleep address. */ char *p_wmesg; /* Reason for sleep. */ u_int p_swtime; /* Time swapped in or out. */ u_int p_slptime; /* Time since last blocked. */ struct itimerval p_realtimer; /* Alarm timer. */ struct timeval p_rtime; /* Real time. */ u_quad_t p_uticks; /* Statclock hits in user mode. */ u_quad_t p_sticks; /* Statclock hits in system mode. */ u_quad_t p_iticks; /* Statclock hits processing intr. */ int p_traceflag; /* Kernel trace points. */ struct vnode *p_tracep; /* Trace to vnode. */ int p_siglist; /* DEPRECATED. */ struct vnode *p_textvp; /* Vnode of executable. */ int p_holdcnt; /* If non-zero, don't swap. */ sigset_t p_sigmask; /* DEPRECATED. */ sigset_t p_sigignore; /* Signals being ignored. */ sigset_t p_sigcatch; /* Signals being caught by user. */ u_char p_priority; /* Process priority. */ u_char p_usrpri; /* User-priority based on p_cpu and p_nice. */ char p_nice; /* Process "nice" value. */ char p_comm[MAXCOMLEN + 1]; struct pgrp *p_pgrp; /* Pointer to process group. */ struct user *p_addr; /* Kernel virtual addr of u-area (PROC ONLY). */ u_short p_xstat; /* Exit status for wait; also stop signal. */ u_short p_acflag; /* Accounting flags. */ struct rusage *p_ru; /* Exit information. XXX */ }; /* Status values. */ #define SIDL 1 /* Process being created by fork. */ #define SRUN 2 /* Currently runnable. */ #define SSLEEP 3 /* Sleeping on an address. */ #define SSTOP 4 /* Process debugging or suspension. */ #define SZOMB 5 /* Awaiting collection by parent. */ /* These flags are kept in extern_proc.p_flag. */ #define P_ADVLOCK 0x00000001 /* Process may hold POSIX adv. lock */ #define P_CONTROLT 0x00000002 /* Has a controlling terminal */ #define P_LP64 0x00000004 /* Process is LP64 */ #define P_NOCLDSTOP 0x00000008 /* No SIGCHLD when children stop */ #define P_PPWAIT 0x00000010 /* Parent waiting for chld exec/exit */ #define P_PROFIL 0x00000020 /* Has started profiling */ #define P_SELECT 0x00000040 /* Selecting; wakeup/waiting danger */ #define P_CONTINUED 0x00000080 /* Process was stopped and continued */ #define P_SUGID 0x00000100 /* Has set privileges since last exec */ #define P_SYSTEM 0x00000200 /* Sys proc: no sigs, stats or swap */ #define P_TIMEOUT 0x00000400 /* Timing out during sleep */ #define P_TRACED 0x00000800 /* Debugged process being traced */ #define P_DISABLE_ASLR 0x00001000 /* Disable address space layout randomization */ #define P_WEXIT 0x00002000 /* Working on exiting */ #define P_EXEC 0x00004000 /* Process called exec. */ /* Should be moved to machine-dependent areas. */ #define P_OWEUPC 0x00008000 /* Owe process an addupc() call at next ast. */ #define P_AFFINITY 0x00010000 /* xxx */ #define P_TRANSLATED 0x00020000 /* xxx */ #define P_CLASSIC P_TRANSLATED /* xxx */ #define P_DELAYIDLESLEEP 0x00040000 /* Process is marked to delay idle sleep on disk IO */ #define P_CHECKOPENEVT 0x00080000 /* check if a vnode has the OPENEVT flag set on open */ #define P_DEPENDENCY_CAPABLE 0x00100000 /* process is ok to call vfs_markdependency() */ #define P_REBOOT 0x00200000 /* Process called reboot() */ #define P_RESV6 0x00400000 /* used to be P_TBE */ #define P_RESV7 0x00800000 /* (P_SIGEXC)signal exceptions */ #define P_THCWD 0x01000000 /* process has thread cwd */ #define P_RESV9 0x02000000 /* (P_VFORK)process has vfork children */ #define P_ADOPTPERSONA 0x04000000 /* process adopted a persona (used to be P_NOATTACH) */ #define P_RESV11 0x08000000 /* (P_INVFORK) proc in vfork */ #define P_NOSHLIB 0x10000000 /* no shared libs are in use for proc */ /* flag set on exec */ #define P_FORCEQUOTA 0x20000000 /* Force quota for root */ #define P_NOCLDWAIT 0x40000000 /* No zombies when chil procs exit */ #define P_NOREMOTEHANG 0x80000000 /* Don't hang on remote FS ops */ #define P_INMEM 0 /* Obsolete: retained for compilation */ #define P_NOSWAP 0 /* Obsolete: retained for compilation */ #define P_PHYSIO 0 /* Obsolete: retained for compilation */ #define P_FSTRACE 0 /* Obsolete: retained for compilation */ #define P_SSTEP 0 /* Obsolete: retained for compilation */ #define P_DIRTY_TRACK 0x00000001 /* track dirty state */ #define P_DIRTY_ALLOW_IDLE_EXIT 0x00000002 /* process can be idle-exited when clean */ #define P_DIRTY_DEFER 0x00000004 /* defer initial opt-in to idle-exit */ #define P_DIRTY 0x00000008 /* process is dirty */ #define P_DIRTY_SHUTDOWN 0x00000010 /* process is dirty during shutdown */ #define P_DIRTY_TERMINATED 0x00000020 /* process has been marked for termination */ #define P_DIRTY_BUSY 0x00000040 /* serialization flag */ #define P_DIRTY_MARKED 0x00000080 /* marked dirty previously */ #define P_DIRTY_AGING_IN_PROGRESS 0x00000100 /* aging in one of the 'aging bands' */ #define P_DIRTY_LAUNCH_IN_PROGRESS 0x00000200 /* launch is in progress */ #define P_DIRTY_DEFER_ALWAYS 0x00000400 /* defer going to idle-exit after every dirty->clean transition. * For legacy jetsam policy only. This is the default with the other policies.*/ #define P_DIRTY_IS_DIRTY (P_DIRTY | P_DIRTY_SHUTDOWN) #define P_DIRTY_IDLE_EXIT_ENABLED (P_DIRTY_TRACK|P_DIRTY_ALLOW_IDLE_EXIT) #endif /* !_SYS_PROC_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/proc_info.h ================================================ /* * Copyright (c) 2005-2020 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 _SYS_PROC_INFO_H #define _SYS_PROC_INFO_H #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include __BEGIN_DECLS #define PROC_ALL_PIDS 1 #define PROC_PGRP_ONLY 2 #define PROC_TTY_ONLY 3 #define PROC_UID_ONLY 4 #define PROC_RUID_ONLY 5 #define PROC_PPID_ONLY 6 #define PROC_KDBG_ONLY 7 struct proc_bsdinfo { uint32_t pbi_flags; /* 64bit; emulated etc */ uint32_t pbi_status; uint32_t pbi_xstatus; uint32_t pbi_pid; uint32_t pbi_ppid; uid_t pbi_uid; gid_t pbi_gid; uid_t pbi_ruid; gid_t pbi_rgid; uid_t pbi_svuid; gid_t pbi_svgid; uint32_t rfu_1; /* reserved */ char pbi_comm[MAXCOMLEN]; char pbi_name[2 * MAXCOMLEN]; /* empty if no name is registered */ uint32_t pbi_nfiles; uint32_t pbi_pgid; uint32_t pbi_pjobc; uint32_t e_tdev; /* controlling tty dev */ uint32_t e_tpgid; /* tty process group id */ int32_t pbi_nice; uint64_t pbi_start_tvsec; uint64_t pbi_start_tvusec; }; struct proc_bsdshortinfo { uint32_t pbsi_pid; /* process id */ uint32_t pbsi_ppid; /* process parent id */ uint32_t pbsi_pgid; /* process perp id */ uint32_t pbsi_status; /* p_stat value, SZOMB, SRUN, etc */ char pbsi_comm[MAXCOMLEN]; /* upto 16 characters of process name */ uint32_t pbsi_flags; /* 64bit; emulated etc */ uid_t pbsi_uid; /* current uid on process */ gid_t pbsi_gid; /* current gid on process */ uid_t pbsi_ruid; /* current ruid on process */ gid_t pbsi_rgid; /* current tgid on process */ uid_t pbsi_svuid; /* current svuid on process */ gid_t pbsi_svgid; /* current svgid on process */ uint32_t pbsi_rfu; /* reserved for future use*/ }; /* pbi_flags values */ #define PROC_FLAG_SYSTEM 1 /* System process */ #define PROC_FLAG_TRACED 2 /* process currently being traced, possibly by gdb */ #define PROC_FLAG_INEXIT 4 /* process is working its way in exit() */ #define PROC_FLAG_PPWAIT 8 #define PROC_FLAG_LP64 0x10 /* 64bit process */ #define PROC_FLAG_SLEADER 0x20 /* The process is the session leader */ #define PROC_FLAG_CTTY 0x40 /* process has a control tty */ #define PROC_FLAG_CONTROLT 0x80 /* Has a controlling terminal */ #define PROC_FLAG_THCWD 0x100 /* process has a thread with cwd */ /* process control bits for resource starvation */ #define PROC_FLAG_PC_THROTTLE 0x200 /* In resource starvation situations, this process is to be throttled */ #define PROC_FLAG_PC_SUSP 0x400 /* In resource starvation situations, this process is to be suspended */ #define PROC_FLAG_PC_KILL 0x600 /* In resource starvation situations, this process is to be terminated */ #define PROC_FLAG_PC_MASK 0x600 /* process action bits for resource starvation */ #define PROC_FLAG_PA_THROTTLE 0x800 /* The process is currently throttled due to resource starvation */ #define PROC_FLAG_PA_SUSP 0x1000 /* The process is currently suspended due to resource starvation */ #define PROC_FLAG_PSUGID 0x2000 /* process has set privileges since last exec */ #define PROC_FLAG_EXEC 0x4000 /* process has called exec */ struct proc_taskinfo { uint64_t pti_virtual_size; /* virtual memory size (bytes) */ uint64_t pti_resident_size; /* resident memory size (bytes) */ uint64_t pti_total_user; /* total time */ uint64_t pti_total_system; uint64_t pti_threads_user; /* existing threads only */ uint64_t pti_threads_system; int32_t pti_policy; /* default policy for new threads */ int32_t pti_faults; /* number of page faults */ int32_t pti_pageins; /* number of actual pageins */ int32_t pti_cow_faults; /* number of copy-on-write faults */ int32_t pti_messages_sent; /* number of messages sent */ int32_t pti_messages_received; /* number of messages received */ int32_t pti_syscalls_mach; /* number of mach system calls */ int32_t pti_syscalls_unix; /* number of unix system calls */ int32_t pti_csw; /* number of context switches */ int32_t pti_threadnum; /* number of threads in the task */ int32_t pti_numrunning; /* number of running threads */ int32_t pti_priority; /* task priority*/ }; struct proc_taskallinfo { struct proc_bsdinfo pbsd; struct proc_taskinfo ptinfo; }; #define MAXTHREADNAMESIZE 64 struct proc_threadinfo { uint64_t pth_user_time; /* user run time */ uint64_t pth_system_time; /* system run time */ int32_t pth_cpu_usage; /* scaled cpu usage percentage */ int32_t pth_policy; /* scheduling policy in effect */ int32_t pth_run_state; /* run state (see below) */ int32_t pth_flags; /* various flags (see below) */ int32_t pth_sleep_time; /* number of seconds that thread */ int32_t pth_curpri; /* cur priority*/ int32_t pth_priority; /* priority*/ int32_t pth_maxpriority; /* max priority*/ char pth_name[MAXTHREADNAMESIZE]; /* thread name, if any */ }; struct proc_regioninfo { uint32_t pri_protection; uint32_t pri_max_protection; uint32_t pri_inheritance; uint32_t pri_flags; /* shared, external pager, is submap */ uint64_t pri_offset; uint32_t pri_behavior; uint32_t pri_user_wired_count; uint32_t pri_user_tag; uint32_t pri_pages_resident; uint32_t pri_pages_shared_now_private; uint32_t pri_pages_swapped_out; uint32_t pri_pages_dirtied; uint32_t pri_ref_count; uint32_t pri_shadow_depth; uint32_t pri_share_mode; uint32_t pri_private_pages_resident; uint32_t pri_shared_pages_resident; uint32_t pri_obj_id; uint32_t pri_depth; uint64_t pri_address; uint64_t pri_size; }; #define PROC_REGION_SUBMAP 1 #define PROC_REGION_SHARED 2 #define SM_COW 1 #define SM_PRIVATE 2 #define SM_EMPTY 3 #define SM_SHARED 4 #define SM_TRUESHARED 5 #define SM_PRIVATE_ALIASED 6 #define SM_SHARED_ALIASED 7 #define SM_LARGE_PAGE 8 /* * Thread run states (state field). */ #define TH_STATE_RUNNING 1 /* thread is running normally */ #define TH_STATE_STOPPED 2 /* thread is stopped */ #define TH_STATE_WAITING 3 /* thread is waiting normally */ #define TH_STATE_UNINTERRUPTIBLE 4 /* thread is in an uninterruptible * wait */ #define TH_STATE_HALTED 5 /* thread is halted at a * clean point */ /* * Thread flags (flags field). */ #define TH_FLAGS_SWAPPED 0x1 /* thread is swapped out */ #define TH_FLAGS_IDLE 0x2 /* thread is an idle thread */ struct proc_workqueueinfo { uint32_t pwq_nthreads; /* total number of workqueue threads */ uint32_t pwq_runthreads; /* total number of running workqueue threads */ uint32_t pwq_blockedthreads; /* total number of blocked workqueue threads */ uint32_t pwq_state; }; /* * workqueue state (pwq_state field) */ #define WQ_EXCEEDED_CONSTRAINED_THREAD_LIMIT 0x1 #define WQ_EXCEEDED_TOTAL_THREAD_LIMIT 0x2 #define WQ_FLAGS_AVAILABLE 0x4 struct proc_fileinfo { uint32_t fi_openflags; uint32_t fi_status; off_t fi_offset; int32_t fi_type; uint32_t fi_guardflags; }; /* stats flags in proc_fileinfo */ #define PROC_FP_SHARED 1 /* shared by more than one fd */ #define PROC_FP_CLEXEC 2 /* close on exec */ #define PROC_FP_GUARDED 4 /* guarded fd */ #define PROC_FP_CLFORK 8 /* close on fork */ #define PROC_FI_GUARD_CLOSE (1u << 0) #define PROC_FI_GUARD_DUP (1u << 1) #define PROC_FI_GUARD_SOCKET_IPC (1u << 2) #define PROC_FI_GUARD_FILEPORT (1u << 3) struct proc_exitreasonbasicinfo { uint32_t beri_namespace; uint64_t beri_code; uint64_t beri_flags; uint32_t beri_reason_buf_size; } __attribute__((packed)); struct proc_exitreasoninfo { uint32_t eri_namespace; uint64_t eri_code; uint64_t eri_flags; uint32_t eri_reason_buf_size; uint64_t eri_kcd_buf; } __attribute__((packed)); /* * A copy of stat64 with static sized fields. */ struct vinfo_stat { uint32_t vst_dev; /* [XSI] ID of device containing file */ uint16_t vst_mode; /* [XSI] Mode of file (see below) */ uint16_t vst_nlink; /* [XSI] Number of hard links */ uint64_t vst_ino; /* [XSI] File serial number */ uid_t vst_uid; /* [XSI] User ID of the file */ gid_t vst_gid; /* [XSI] Group ID of the file */ int64_t vst_atime; /* [XSI] Time of last access */ int64_t vst_atimensec; /* nsec of last access */ int64_t vst_mtime; /* [XSI] Last data modification time */ int64_t vst_mtimensec; /* last data modification nsec */ int64_t vst_ctime; /* [XSI] Time of last status change */ int64_t vst_ctimensec; /* nsec of last status change */ int64_t vst_birthtime; /* File creation time(birth) */ int64_t vst_birthtimensec; /* nsec of File creation time */ off_t vst_size; /* [XSI] file size, in bytes */ int64_t vst_blocks; /* [XSI] blocks allocated for file */ int32_t vst_blksize; /* [XSI] optimal blocksize for I/O */ uint32_t vst_flags; /* user defined flags for file */ uint32_t vst_gen; /* file generation number */ uint32_t vst_rdev; /* [XSI] Device ID */ int64_t vst_qspare[2]; /* RESERVED: DO NOT USE! */ }; struct vnode_info { struct vinfo_stat vi_stat; int vi_type; int vi_pad; fsid_t vi_fsid; }; struct vnode_info_path { struct vnode_info vip_vi; char vip_path[MAXPATHLEN]; /* tail end of it */ }; struct vnode_fdinfo { struct proc_fileinfo pfi; struct vnode_info pvi; }; struct vnode_fdinfowithpath { struct proc_fileinfo pfi; struct vnode_info_path pvip; }; struct proc_regionwithpathinfo { struct proc_regioninfo prp_prinfo; struct vnode_info_path prp_vip; }; struct proc_regionpath { uint64_t prpo_addr; uint64_t prpo_regionlength; char prpo_path[MAXPATHLEN]; }; struct proc_vnodepathinfo { struct vnode_info_path pvi_cdir; struct vnode_info_path pvi_rdir; }; struct proc_threadwithpathinfo { struct proc_threadinfo pt; struct vnode_info_path pvip; }; /* * Socket */ /* * IPv4 and IPv6 Sockets */ #define INI_IPV4 0x1 #define INI_IPV6 0x2 struct in4in6_addr { u_int32_t i46a_pad32[3]; struct in_addr i46a_addr4; }; struct in_sockinfo { int insi_fport; /* foreign port */ int insi_lport; /* local port */ uint64_t insi_gencnt; /* generation count of this instance */ uint32_t insi_flags; /* generic IP/datagram flags */ uint32_t insi_flow; uint8_t insi_vflag; /* ini_IPV4 or ini_IPV6 */ uint8_t insi_ip_ttl; /* time to live proto */ uint32_t rfu_1; /* reserved */ /* protocol dependent part */ union { struct in4in6_addr ina_46; struct in6_addr ina_6; } insi_faddr; /* foreign host table entry */ union { struct in4in6_addr ina_46; struct in6_addr ina_6; } insi_laddr; /* local host table entry */ struct { u_char in4_tos; /* type of service */ } insi_v4; struct { uint8_t in6_hlim; int in6_cksum; u_short in6_ifindex; short in6_hops; } insi_v6; }; /* * TCP Sockets */ #define TSI_T_REXMT 0 /* retransmit */ #define TSI_T_PERSIST 1 /* retransmit persistence */ #define TSI_T_KEEP 2 /* keep alive */ #define TSI_T_2MSL 3 /* 2*msl quiet time timer */ #define TSI_T_NTIMERS 4 #define TSI_S_CLOSED 0 /* closed */ #define TSI_S_LISTEN 1 /* listening for connection */ #define TSI_S_SYN_SENT 2 /* active, have sent syn */ #define TSI_S_SYN_RECEIVED 3 /* have send and received syn */ #define TSI_S_ESTABLISHED 4 /* established */ #define TSI_S__CLOSE_WAIT 5 /* rcvd fin, waiting for close */ #define TSI_S_FIN_WAIT_1 6 /* have closed, sent fin */ #define TSI_S_CLOSING 7 /* closed xchd FIN; await FIN ACK */ #define TSI_S_LAST_ACK 8 /* had fin and close; await FIN ACK */ #define TSI_S_FIN_WAIT_2 9 /* have closed, fin is acked */ #define TSI_S_TIME_WAIT 10 /* in 2*msl quiet wait after close */ #define TSI_S_RESERVED 11 /* pseudo state: reserved */ struct tcp_sockinfo { struct in_sockinfo tcpsi_ini; int tcpsi_state; int tcpsi_timer[TSI_T_NTIMERS]; int tcpsi_mss; uint32_t tcpsi_flags; uint32_t rfu_1; /* reserved */ uint64_t tcpsi_tp; /* opaque handle of TCP protocol control block */ }; /* * Unix Domain Sockets */ struct un_sockinfo { uint64_t unsi_conn_so; /* opaque handle of connected socket */ uint64_t unsi_conn_pcb; /* opaque handle of connected protocol control block */ union { struct sockaddr_un ua_sun; char ua_dummy[SOCK_MAXADDRLEN]; } unsi_addr; /* bound address */ union { struct sockaddr_un ua_sun; char ua_dummy[SOCK_MAXADDRLEN]; } unsi_caddr; /* address of socket connected to */ }; /* * PF_NDRV Sockets */ struct ndrv_info { uint32_t ndrvsi_if_family; uint32_t ndrvsi_if_unit; char ndrvsi_if_name[IF_NAMESIZE]; }; /* * Kernel Event Sockets */ struct kern_event_info { uint32_t kesi_vendor_code_filter; uint32_t kesi_class_filter; uint32_t kesi_subclass_filter; }; /* * Kernel Control Sockets */ struct kern_ctl_info { uint32_t kcsi_id; uint32_t kcsi_reg_unit; uint32_t kcsi_flags; /* support flags */ uint32_t kcsi_recvbufsize; /* request more than the default buffer size */ uint32_t kcsi_sendbufsize; /* request more than the default buffer size */ uint32_t kcsi_unit; char kcsi_name[MAX_KCTL_NAME]; /* unique nke identifier, provided by DTS */ }; /* * VSock Sockets */ struct vsock_sockinfo { uint32_t local_cid; uint32_t local_port; uint32_t remote_cid; uint32_t remote_port; }; /* soi_state */ #define SOI_S_NOFDREF 0x0001 /* no file table ref any more */ #define SOI_S_ISCONNECTED 0x0002 /* socket connected to a peer */ #define SOI_S_ISCONNECTING 0x0004 /* in process of connecting to peer */ #define SOI_S_ISDISCONNECTING 0x0008 /* in process of disconnecting */ #define SOI_S_CANTSENDMORE 0x0010 /* can't send more data to peer */ #define SOI_S_CANTRCVMORE 0x0020 /* can't receive more data from peer */ #define SOI_S_RCVATMARK 0x0040 /* at mark on input */ #define SOI_S_PRIV 0x0080 /* privileged for broadcast, raw... */ #define SOI_S_NBIO 0x0100 /* non-blocking ops */ #define SOI_S_ASYNC 0x0200 /* async i/o notify */ #define SOI_S_INCOMP 0x0800 /* Unaccepted, incomplete connection */ #define SOI_S_COMP 0x1000 /* unaccepted, complete connection */ #define SOI_S_ISDISCONNECTED 0x2000 /* socket disconnected from peer */ #define SOI_S_DRAINING 0x4000 /* close waiting for blocked system calls to drain */ struct sockbuf_info { uint32_t sbi_cc; uint32_t sbi_hiwat; /* SO_RCVBUF, SO_SNDBUF */ uint32_t sbi_mbcnt; uint32_t sbi_mbmax; uint32_t sbi_lowat; short sbi_flags; short sbi_timeo; }; enum { SOCKINFO_GENERIC = 0, SOCKINFO_IN = 1, SOCKINFO_TCP = 2, SOCKINFO_UN = 3, SOCKINFO_NDRV = 4, SOCKINFO_KERN_EVENT = 5, SOCKINFO_KERN_CTL = 6, SOCKINFO_VSOCK = 7, }; struct socket_info { struct vinfo_stat soi_stat; uint64_t soi_so; /* opaque handle of socket */ uint64_t soi_pcb; /* opaque handle of protocol control block */ int soi_type; int soi_protocol; int soi_family; short soi_options; short soi_linger; short soi_state; short soi_qlen; short soi_incqlen; short soi_qlimit; short soi_timeo; u_short soi_error; uint32_t soi_oobmark; struct sockbuf_info soi_rcv; struct sockbuf_info soi_snd; int soi_kind; uint32_t rfu_1; /* reserved */ union { struct in_sockinfo pri_in; /* SOCKINFO_IN */ struct tcp_sockinfo pri_tcp; /* SOCKINFO_TCP */ struct un_sockinfo pri_un; /* SOCKINFO_UN */ struct ndrv_info pri_ndrv; /* SOCKINFO_NDRV */ struct kern_event_info pri_kern_event; /* SOCKINFO_KERN_EVENT */ struct kern_ctl_info pri_kern_ctl; /* SOCKINFO_KERN_CTL */ struct vsock_sockinfo pri_vsock; /* SOCKINFO_VSOCK */ } soi_proto; }; struct socket_fdinfo { struct proc_fileinfo pfi; struct socket_info psi; }; struct psem_info { struct vinfo_stat psem_stat; char psem_name[MAXPATHLEN]; }; struct psem_fdinfo { struct proc_fileinfo pfi; struct psem_info pseminfo; }; struct pshm_info { struct vinfo_stat pshm_stat; uint64_t pshm_mappaddr; char pshm_name[MAXPATHLEN]; }; struct pshm_fdinfo { struct proc_fileinfo pfi; struct pshm_info pshminfo; }; struct pipe_info { struct vinfo_stat pipe_stat; uint64_t pipe_handle; uint64_t pipe_peerhandle; int pipe_status; int rfu_1; /* reserved */ }; struct pipe_fdinfo { struct proc_fileinfo pfi; struct pipe_info pipeinfo; }; struct kqueue_info { struct vinfo_stat kq_stat; uint32_t kq_state; uint32_t rfu_1; /* reserved */ }; struct kqueue_dyninfo { struct kqueue_info kqdi_info; uint64_t kqdi_servicer; uint64_t kqdi_owner; uint32_t kqdi_sync_waiters; uint8_t kqdi_sync_waiter_qos; uint8_t kqdi_async_qos; uint16_t kqdi_request_state; uint8_t kqdi_events_qos; uint8_t kqdi_pri; uint8_t kqdi_pol; uint8_t kqdi_cpupercent; uint8_t _kqdi_reserved0[4]; uint64_t _kqdi_reserved1[4]; }; /* keep in sync with KQ_* in sys/eventvar.h */ #define PROC_KQUEUE_SELECT 0x0001 #define PROC_KQUEUE_SLEEP 0x0002 #define PROC_KQUEUE_32 0x0008 #define PROC_KQUEUE_64 0x0010 #define PROC_KQUEUE_QOS 0x0020 struct kqueue_fdinfo { struct proc_fileinfo pfi; struct kqueue_info kqueueinfo; }; struct appletalk_info { struct vinfo_stat atalk_stat; }; struct appletalk_fdinfo { struct proc_fileinfo pfi; struct appletalk_info appletalkinfo; }; typedef uint64_t proc_info_udata_t; /* defns of process file desc type */ #define PROX_FDTYPE_ATALK 0 #define PROX_FDTYPE_VNODE 1 #define PROX_FDTYPE_SOCKET 2 #define PROX_FDTYPE_PSHM 3 #define PROX_FDTYPE_PSEM 4 #define PROX_FDTYPE_KQUEUE 5 #define PROX_FDTYPE_PIPE 6 #define PROX_FDTYPE_FSEVENTS 7 #define PROX_FDTYPE_NETPOLICY 9 struct proc_fdinfo { int32_t proc_fd; uint32_t proc_fdtype; }; struct proc_fileportinfo { uint32_t proc_fileport; uint32_t proc_fdtype; }; /* Flavors for proc_pidinfo() */ #define PROC_PIDLISTFDS 1 #define PROC_PIDLISTFD_SIZE (sizeof(struct proc_fdinfo)) #define PROC_PIDTASKALLINFO 2 #define PROC_PIDTASKALLINFO_SIZE (sizeof(struct proc_taskallinfo)) #define PROC_PIDTBSDINFO 3 #define PROC_PIDTBSDINFO_SIZE (sizeof(struct proc_bsdinfo)) #define PROC_PIDTASKINFO 4 #define PROC_PIDTASKINFO_SIZE (sizeof(struct proc_taskinfo)) #define PROC_PIDTHREADINFO 5 #define PROC_PIDTHREADINFO_SIZE (sizeof(struct proc_threadinfo)) #define PROC_PIDLISTTHREADS 6 #define PROC_PIDLISTTHREADS_SIZE (2* sizeof(uint32_t)) #define PROC_PIDREGIONINFO 7 #define PROC_PIDREGIONINFO_SIZE (sizeof(struct proc_regioninfo)) #define PROC_PIDREGIONPATHINFO 8 #define PROC_PIDREGIONPATHINFO_SIZE (sizeof(struct proc_regionwithpathinfo)) #define PROC_PIDVNODEPATHINFO 9 #define PROC_PIDVNODEPATHINFO_SIZE (sizeof(struct proc_vnodepathinfo)) #define PROC_PIDTHREADPATHINFO 10 #define PROC_PIDTHREADPATHINFO_SIZE (sizeof(struct proc_threadwithpathinfo)) #define PROC_PIDPATHINFO 11 #define PROC_PIDPATHINFO_SIZE (MAXPATHLEN) #define PROC_PIDPATHINFO_MAXSIZE (4*MAXPATHLEN) #define PROC_PIDWORKQUEUEINFO 12 #define PROC_PIDWORKQUEUEINFO_SIZE (sizeof(struct proc_workqueueinfo)) #define PROC_PIDT_SHORTBSDINFO 13 #define PROC_PIDT_SHORTBSDINFO_SIZE (sizeof(struct proc_bsdshortinfo)) #define PROC_PIDLISTFILEPORTS 14 #define PROC_PIDLISTFILEPORTS_SIZE (sizeof(struct proc_fileportinfo)) #define PROC_PIDTHREADID64INFO 15 #define PROC_PIDTHREADID64INFO_SIZE (sizeof(struct proc_threadinfo)) #define PROC_PID_RUSAGE 16 #define PROC_PID_RUSAGE_SIZE 0 /* Flavors for proc_pidfdinfo */ #define PROC_PIDFDVNODEINFO 1 #define PROC_PIDFDVNODEINFO_SIZE (sizeof(struct vnode_fdinfo)) #define PROC_PIDFDVNODEPATHINFO 2 #define PROC_PIDFDVNODEPATHINFO_SIZE (sizeof(struct vnode_fdinfowithpath)) #define PROC_PIDFDSOCKETINFO 3 #define PROC_PIDFDSOCKETINFO_SIZE (sizeof(struct socket_fdinfo)) #define PROC_PIDFDPSEMINFO 4 #define PROC_PIDFDPSEMINFO_SIZE (sizeof(struct psem_fdinfo)) #define PROC_PIDFDPSHMINFO 5 #define PROC_PIDFDPSHMINFO_SIZE (sizeof(struct pshm_fdinfo)) #define PROC_PIDFDPIPEINFO 6 #define PROC_PIDFDPIPEINFO_SIZE (sizeof(struct pipe_fdinfo)) #define PROC_PIDFDKQUEUEINFO 7 #define PROC_PIDFDKQUEUEINFO_SIZE (sizeof(struct kqueue_fdinfo)) #define PROC_PIDFDATALKINFO 8 #define PROC_PIDFDATALKINFO_SIZE (sizeof(struct appletalk_fdinfo)) /* Flavors for proc_pidfileportinfo */ #define PROC_PIDFILEPORTVNODEPATHINFO 2 /* out: vnode_fdinfowithpath */ #define PROC_PIDFILEPORTVNODEPATHINFO_SIZE \ PROC_PIDFDVNODEPATHINFO_SIZE #define PROC_PIDFILEPORTSOCKETINFO 3 /* out: socket_fdinfo */ #define PROC_PIDFILEPORTSOCKETINFO_SIZE PROC_PIDFDSOCKETINFO_SIZE #define PROC_PIDFILEPORTPSHMINFO 5 /* out: pshm_fdinfo */ #define PROC_PIDFILEPORTPSHMINFO_SIZE PROC_PIDFDPSHMINFO_SIZE #define PROC_PIDFILEPORTPIPEINFO 6 /* out: pipe_fdinfo */ #define PROC_PIDFILEPORTPIPEINFO_SIZE PROC_PIDFDPIPEINFO_SIZE /* used for proc_setcontrol */ #define PROC_SELFSET_PCONTROL 1 #define PROC_SELFSET_THREADNAME 2 #define PROC_SELFSET_THREADNAME_SIZE (MAXTHREADNAMESIZE -1) #define PROC_SELFSET_VMRSRCOWNER 3 #define PROC_SELFSET_DELAYIDLESLEEP 4 /* used for proc_dirtycontrol */ #define PROC_DIRTYCONTROL_TRACK 1 #define PROC_DIRTYCONTROL_SET 2 #define PROC_DIRTYCONTROL_GET 3 #define PROC_DIRTYCONTROL_CLEAR 4 /* proc_track_dirty() flags */ #define PROC_DIRTY_TRACK 0x1 #define PROC_DIRTY_ALLOW_IDLE_EXIT 0x2 #define PROC_DIRTY_DEFER 0x4 #define PROC_DIRTY_LAUNCH_IN_PROGRESS 0x8 #define PROC_DIRTY_DEFER_ALWAYS 0x10 /* proc_get_dirty() flags */ #define PROC_DIRTY_TRACKED 0x1 #define PROC_DIRTY_ALLOWS_IDLE_EXIT 0x2 #define PROC_DIRTY_IS_DIRTY 0x4 #define PROC_DIRTY_LAUNCH_IS_IN_PROGRESS 0x8 /* Flavors for proc_udata_info */ #define PROC_UDATA_INFO_GET 1 #define PROC_UDATA_INFO_SET 2 __END_DECLS #endif /*_SYS_PROC_INFO_H */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/protosw.h ================================================ /* * 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@ */ /* Copyright (c) 1998, 1999 Apple Computer, Inc. All Rights Reserved */ /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */ /* * Copyright (c) 1982, 1986, 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. * * @(#)protosw.h 8.1 (Berkeley) 6/2/93 * $FreeBSD: src/sys/sys/protosw.h,v 1.28.2.2 2001/07/03 11:02:01 ume Exp $ */ #ifndef _SYS_PROTOSW_H_ #define _SYS_PROTOSW_H_ #include #include /* XXX: this will go away */ #define PR_SLOWHZ 2 /* 2 slow timeouts per second */ /* * The arguments to the ctlinput routine are * (*protosw[].pr_ctlinput)(cmd, sa, arg); * where cmd is one of the commands below, sa is a pointer to a sockaddr, * and arg is a `void *' argument used within a protocol family. */ #define PRC_IFDOWN 0 /* interface transition */ #define PRC_ROUTEDEAD 1 /* select new route if possible ??? */ #define PRC_IFUP 2 /* interface has come back up */ #define PRC_QUENCH2 3 /* DEC congestion bit says slow down */ #define PRC_QUENCH 4 /* some one said to slow down */ #define PRC_MSGSIZE 5 /* message size forced drop */ #define PRC_HOSTDEAD 6 /* host appears to be down */ #define PRC_HOSTUNREACH 7 /* deprecated (use PRC_UNREACH_HOST) */ #define PRC_UNREACH_NET 8 /* no route to network */ #define PRC_UNREACH_HOST 9 /* no route to host */ #define PRC_UNREACH_PROTOCOL 10 /* dst says bad protocol */ #define PRC_UNREACH_PORT 11 /* bad port # */ /* was PRC_UNREACH_NEEDFRAG 12 (use PRC_MSGSIZE) */ #define PRC_UNREACH_SRCFAIL 13 /* source route failed */ #define PRC_REDIRECT_NET 14 /* net routing redirect */ #define PRC_REDIRECT_HOST 15 /* host routing redirect */ #define PRC_REDIRECT_TOSNET 16 /* redirect for type of service & net */ #define PRC_REDIRECT_TOSHOST 17 /* redirect for tos & host */ #define PRC_TIMXCEED_INTRANS 18 /* packet lifetime expired in transit */ #define PRC_TIMXCEED_REASS 19 /* lifetime expired on reass q */ #define PRC_PARAMPROB 20 /* header incorrect */ #define PRC_UNREACH_ADMIN_PROHIB 21 /* packet administrativly prohibited */ #define PRC_NCMDS 22 #define PRC_IS_REDIRECT(cmd) \ ((cmd) >= PRC_REDIRECT_NET && (cmd) <= PRC_REDIRECT_TOSHOST) #endif /* !_SYS_PROTOSW_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/ptrace.h ================================================ /* * 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@ */ /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */ /*- * Copyright (c) 1984, 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. * * @(#)ptrace.h 8.2 (Berkeley) 1/4/94 */ #ifndef _SYS_PTRACE_H_ #define _SYS_PTRACE_H_ #include #include #include enum { ePtAttachDeprecated __deprecated_enum_msg("PT_ATTACH is deprecated. See PT_ATTACHEXC") = 10 }; #define PT_TRACE_ME 0 /* child declares it's being traced */ #define PT_READ_I 1 /* read word in child's I space */ #define PT_READ_D 2 /* read word in child's D space */ #define PT_READ_U 3 /* read word in child's user structure */ #define PT_WRITE_I 4 /* write word in child's I space */ #define PT_WRITE_D 5 /* write word in child's D space */ #define PT_WRITE_U 6 /* write word in child's user structure */ #define PT_CONTINUE 7 /* continue the child */ #define PT_KILL 8 /* kill the child process */ #define PT_STEP 9 /* single step the child */ #define PT_ATTACH ePtAttachDeprecated /* trace some running process */ #define PT_DETACH 11 /* stop tracing a process */ #define PT_SIGEXC 12 /* signals as exceptions for current_proc */ #define PT_THUPDATE 13 /* signal for thread# */ #define PT_ATTACHEXC 14 /* attach to running process with signal exception */ #define PT_FORCEQUOTA 30 /* Enforce quota for root */ #define PT_DENY_ATTACH 31 #define PT_FIRSTMACH 32 /* for machine-specific requests */ __BEGIN_DECLS int ptrace(int _request, pid_t _pid, caddr_t _addr, int _data); __END_DECLS #endif /* !_SYS_PTRACE_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/qos.h ================================================ /* * Copyright (c) 2013-2014 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 _SYS_QOS_H #define _SYS_QOS_H #include #include /*! * @typedef qos_class_t * * @abstract * An abstract thread quality of service (QOS) classification. * * @discussion * Thread quality of service (QOS) classes are ordered abstract representations * of the nature of work that is expected to be performed by a pthread, dispatch * queue, or NSOperation. Each class specifies a maximum thread scheduling * priority for that band (which may be used in combination with a relative * priority offset within the band), as well as quality of service * characteristics for timer latency, CPU throughput, I/O throughput, network * socket traffic management behavior and more. * * A best effort is made to allocate available system resources to every QOS * class. Quality of service degredation only occurs during system resource * contention, proportionally to the QOS class. That said, QOS classes * representing user-initiated work attempt to achieve peak throughput while * QOS classes for other work attempt to achieve peak energy and thermal * efficiency, even in the absence of contention. Finally, the use of QOS * classes does not allow threads to supersede any limits that may be applied * to the overall process. */ /*! * @constant QOS_CLASS_USER_INTERACTIVE * @abstract A QOS class which indicates work performed by this thread * is interactive with the user. * @discussion Such work is requested to run at high priority relative to other * work on the system. Specifying this QOS class is a request to run with * nearly all available system CPU and I/O bandwidth even under contention. * This is not an energy-efficient QOS class to use for large tasks. The use of * this QOS class should be limited to critical interaction with the user such * as handling events on the main event loop, view drawing, animation, etc. * * @constant QOS_CLASS_USER_INITIATED * @abstract A QOS class which indicates work performed by this thread * was initiated by the user and that the user is likely waiting for the * results. * @discussion Such work is requested to run at a priority below critical user- * interactive work, but relatively higher than other work on the system. This * is not an energy-efficient QOS class to use for large tasks. Its use * should be limited to operations of short enough duration that the user is * unlikely to switch tasks while waiting for the results. Typical * user-initiated work will have progress indicated by the display of * placeholder content or modal user interface. * * @constant QOS_CLASS_DEFAULT * @abstract A default QOS class used by the system in cases where more specific * QOS class information is not available. * @discussion Such work is requested to run at a priority below critical user- * interactive and user-initiated work, but relatively higher than utility and * background tasks. Threads created by pthread_create() without an attribute * specifying a QOS class will default to QOS_CLASS_DEFAULT. This QOS class * value is not intended to be used as a work classification, it should only be * set when propagating or restoring QOS class values provided by the system. * * @constant QOS_CLASS_UTILITY * @abstract A QOS class which indicates work performed by this thread * may or may not be initiated by the user and that the user is unlikely to be * immediately waiting for the results. * @discussion Such work is requested to run at a priority below critical user- * interactive and user-initiated work, but relatively higher than low-level * system maintenance tasks. The use of this QOS class indicates the work * should be run in an energy and thermally-efficient manner. The progress of * utility work may or may not be indicated to the user, but the effect of such * work is user-visible. * * @constant QOS_CLASS_BACKGROUND * @abstract A QOS class which indicates work performed by this thread was not * initiated by the user and that the user may be unaware of the results. * @discussion Such work is requested to run at a priority below other work. * The use of this QOS class indicates the work should be run in the most energy * and thermally-efficient manner. * * @constant QOS_CLASS_UNSPECIFIED * @abstract A QOS class value which indicates the absence or removal of QOS * class information. * @discussion As an API return value, may indicate that threads or pthread * attributes were configured with legacy API incompatible or in conflict with * the QOS class system. */ #define __QOS_ENUM(name, type, ...) enum { __VA_ARGS__ }; typedef type name##_t #define __QOS_CLASS_AVAILABLE(...) #if defined(__cplusplus) || defined(__OBJC__) || __LP64__ #if defined(__has_feature) && defined(__has_extension) #if __has_feature(objc_fixed_enum) || __has_extension(cxx_strong_enums) #undef __QOS_ENUM #define __QOS_ENUM(name, type, ...) typedef enum : type { __VA_ARGS__ } name##_t #endif #endif #if __has_feature(enumerator_attributes) #undef __QOS_CLASS_AVAILABLE #define __QOS_CLASS_AVAILABLE __API_AVAILABLE #endif #endif __QOS_ENUM(qos_class, unsigned int, QOS_CLASS_USER_INTERACTIVE __QOS_CLASS_AVAILABLE(macos(10.10), ios(8.0)) = 0x21, QOS_CLASS_USER_INITIATED __QOS_CLASS_AVAILABLE(macos(10.10), ios(8.0)) = 0x19, QOS_CLASS_DEFAULT __QOS_CLASS_AVAILABLE(macos(10.10), ios(8.0)) = 0x15, QOS_CLASS_UTILITY __QOS_CLASS_AVAILABLE(macos(10.10), ios(8.0)) = 0x11, QOS_CLASS_BACKGROUND __QOS_CLASS_AVAILABLE(macos(10.10), ios(8.0)) = 0x09, QOS_CLASS_UNSPECIFIED __QOS_CLASS_AVAILABLE(macos(10.10), ios(8.0)) = 0x00, ); #undef __QOS_ENUM /*! * @constant QOS_MIN_RELATIVE_PRIORITY * @abstract The minimum relative priority that may be specified within a * QOS class. These priorities are relative only within a given QOS class * and meaningful only for the current process. */ #define QOS_MIN_RELATIVE_PRIORITY (-15) /* Userspace (only) definitions */ #ifndef KERNEL __BEGIN_DECLS /*! * @function qos_class_self * * @abstract * Returns the requested QOS class of the current thread. * * @return * One of the QOS class values in qos_class_t. */ __API_AVAILABLE(macos(10.10), ios(8.0)) qos_class_t qos_class_self(void); /*! * @function qos_class_main * * @abstract * Returns the initial requested QOS class of the main thread. * * @discussion * The QOS class that the main thread of a process is created with depends on * the type of process (e.g. application or daemon) and on how it has been * launched. * * This function returns that initial requested QOS class value chosen by the * system to enable propagation of that classification to matching work not * executing on the main thread. * * @return * One of the QOS class values in qos_class_t. */ __API_AVAILABLE(macos(10.10), ios(8.0)) qos_class_t qos_class_main(void); __END_DECLS #endif // KERNEL #endif // _SYS_QOS_H ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/queue.h ================================================ /* * 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@ */ /*- * Copyright (c) 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. * 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. * * @(#)queue.h 8.5 (Berkeley) 8/20/94 */ #ifndef _SYS_QUEUE_H_ #define _SYS_QUEUE_H_ #ifndef __improbable #define __improbable(x) (x) /* noop in userspace */ #endif /* __improbable */ /* * This file defines five types of data structures: singly-linked lists, * singly-linked tail queues, lists, tail queues, and circular queues. * * A singly-linked list is headed by a single forward pointer. The elements * are singly linked for minimum space and pointer manipulation overhead at * the expense of O(n) removal for arbitrary elements. New elements can be * added to the list after an existing element or at the head of the list. * Elements being removed from the head of the list should use the explicit * macro for this purpose for optimum efficiency. A singly-linked list may * only be traversed in the forward direction. Singly-linked lists are ideal * for applications with large datasets and few or no removals or for * implementing a LIFO queue. * * A singly-linked tail queue is headed by a pair of pointers, one to the * head of the list and the other to the tail of the list. The elements are * singly linked for minimum space and pointer manipulation overhead at the * expense of O(n) removal for arbitrary elements. New elements can be added * to the list after an existing element, at the head of the list, or at the * end of the list. Elements being removed from the head of the tail queue * should use the explicit macro for this purpose for optimum efficiency. * A singly-linked tail queue may only be traversed in the forward direction. * Singly-linked tail queues are ideal for applications with large datasets * and few or no removals or for implementing a FIFO queue. * * A list is headed by a single forward pointer (or an array of forward * pointers for a hash table header). The elements are doubly linked * so that an arbitrary element can be removed without a need to * traverse the list. New elements can be added to the list before * or after an existing element or at the head of the list. A list * may only be traversed in the forward direction. * * A tail queue is headed by a pair of pointers, one to the head of the * list and the other to the tail of the list. The elements are doubly * linked so that an arbitrary element can be removed without a need to * traverse the list. New elements can be added to the list before or * after an existing element, at the head of the list, or at the end of * the list. A tail queue may be traversed in either direction. * * A circle queue is headed by a pair of pointers, one to the head of the * list and the other to the tail of the list. The elements are doubly * linked so that an arbitrary element can be removed without a need to * traverse the list. New elements can be added to the list before or after * an existing element, at the head of the list, or at the end of the list. * A circle queue may be traversed in either direction, but has a more * complex end of list detection. * Note that circle queues are deprecated, because, as the removal log * in FreeBSD states, "CIRCLEQs are a disgrace to everything Knuth taught * us in Volume 1 Chapter 2. [...] Use TAILQ instead, it provides the same * functionality." Code using them will continue to compile, but they * are no longer documented on the man page. * * For details on the use of these macros, see the queue(3) manual page. * * * SLIST LIST STAILQ TAILQ CIRCLEQ * _HEAD + + + + + * _HEAD_INITIALIZER + + + + - * _ENTRY + + + + + * _INIT + + + + + * _EMPTY + + + + + * _FIRST + + + + + * _NEXT + + + + + * _PREV - - - + + * _LAST - - + + + * _FOREACH + + + + + * _FOREACH_SAFE + + + + - * _FOREACH_REVERSE - - - + - * _FOREACH_REVERSE_SAFE - - - + - * _INSERT_HEAD + + + + + * _INSERT_BEFORE - + - + + * _INSERT_AFTER + + + + + * _INSERT_TAIL - - + + + * _CONCAT - - + + - * _REMOVE_AFTER + - + - - * _REMOVE_HEAD + - + - - * _REMOVE_HEAD_UNTIL - - + - - * _REMOVE + + + + + * _SWAP - + + + - * */ #ifdef QUEUE_MACRO_DEBUG /* Store the last 2 places the queue element or head was altered */ struct qm_trace { char * lastfile; int lastline; char * prevfile; int prevline; }; #define TRACEBUF struct qm_trace trace; #define TRASHIT(x) do {(x) = (void *)-1;} while (0) #define QMD_TRACE_HEAD(head) do { \ (head)->trace.prevline = (head)->trace.lastline; \ (head)->trace.prevfile = (head)->trace.lastfile; \ (head)->trace.lastline = __LINE__; \ (head)->trace.lastfile = __FILE__; \ } while (0) #define QMD_TRACE_ELEM(elem) do { \ (elem)->trace.prevline = (elem)->trace.lastline; \ (elem)->trace.prevfile = (elem)->trace.lastfile; \ (elem)->trace.lastline = __LINE__; \ (elem)->trace.lastfile = __FILE__; \ } while (0) #else #define QMD_TRACE_ELEM(elem) #define QMD_TRACE_HEAD(head) #define TRACEBUF #define TRASHIT(x) #endif /* QUEUE_MACRO_DEBUG */ /* * Horrible macros to enable use of code that was meant to be C-specific * (and which push struct onto type) in C++; without these, C++ code * that uses these macros in the context of a class will blow up * due to "struct" being preprended to "type" by the macros, causing * inconsistent use of tags. * * This approach is necessary because these are macros; we have to use * these on a per-macro basis (because the queues are implemented as * macros, disabling this warning in the scope of the header file is * insufficient), whuch means we can't use #pragma, and have to use * _Pragma. We only need to use these for the queue macros that * prepend "struct" to "type" and will cause C++ to blow up. */ #if defined(__clang__) && defined(__cplusplus) #define __MISMATCH_TAGS_PUSH \ _Pragma("clang diagnostic push") \ _Pragma("clang diagnostic ignored \"-Wmismatched-tags\"") #define __MISMATCH_TAGS_POP \ _Pragma("clang diagnostic pop") #else #define __MISMATCH_TAGS_PUSH #define __MISMATCH_TAGS_POP #endif /*! * Ensures that these macros can safely be used in structs when compiling with * clang. The macros do not allow for nullability attributes to be specified due * to how they are expanded. For example: * * SLIST_HEAD(, foo _Nullable) bar; * * expands to * * struct { * struct foo _Nullable *slh_first; * } * * which is not valid because the nullability specifier has to apply to the * pointer. So just ignore nullability completeness in all the places where this * is an issue. */ #if defined(__clang__) #define __NULLABILITY_COMPLETENESS_PUSH \ _Pragma("clang diagnostic push") \ _Pragma("clang diagnostic ignored \"-Wnullability-completeness\"") #define __NULLABILITY_COMPLETENESS_POP \ _Pragma("clang diagnostic pop") #else #define __NULLABILITY_COMPLETENESS_PUSH #define __NULLABILITY_COMPLETENESS_POP #endif /* * Singly-linked List declarations. */ #define SLIST_HEAD(name, type) \ __MISMATCH_TAGS_PUSH \ __NULLABILITY_COMPLETENESS_PUSH \ struct name { \ struct type *slh_first; /* first element */ \ } \ __NULLABILITY_COMPLETENESS_POP \ __MISMATCH_TAGS_POP #define SLIST_HEAD_INITIALIZER(head) \ { NULL } #define SLIST_ENTRY(type) \ __MISMATCH_TAGS_PUSH \ __NULLABILITY_COMPLETENESS_PUSH \ struct { \ struct type *sle_next; /* next element */ \ } \ __NULLABILITY_COMPLETENESS_POP \ __MISMATCH_TAGS_POP /* * Singly-linked List functions. */ #define SLIST_EMPTY(head) ((head)->slh_first == NULL) #define SLIST_FIRST(head) ((head)->slh_first) #define SLIST_FOREACH(var, head, field) \ for ((var) = SLIST_FIRST((head)); \ (var); \ (var) = SLIST_NEXT((var), field)) #define SLIST_FOREACH_SAFE(var, head, field, tvar) \ for ((var) = SLIST_FIRST((head)); \ (var) && ((tvar) = SLIST_NEXT((var), field), 1); \ (var) = (tvar)) #define SLIST_FOREACH_PREVPTR(var, varp, head, field) \ for ((varp) = &SLIST_FIRST((head)); \ ((var) = *(varp)) != NULL; \ (varp) = &SLIST_NEXT((var), field)) #define SLIST_INIT(head) do { \ SLIST_FIRST((head)) = NULL; \ } while (0) #define SLIST_INSERT_AFTER(slistelm, elm, field) do { \ SLIST_NEXT((elm), field) = SLIST_NEXT((slistelm), field); \ SLIST_NEXT((slistelm), field) = (elm); \ } while (0) #define SLIST_INSERT_HEAD(head, elm, field) do { \ SLIST_NEXT((elm), field) = SLIST_FIRST((head)); \ SLIST_FIRST((head)) = (elm); \ } while (0) #define SLIST_NEXT(elm, field) ((elm)->field.sle_next) #define SLIST_REMOVE(head, elm, type, field) \ __MISMATCH_TAGS_PUSH \ __NULLABILITY_COMPLETENESS_PUSH \ do { \ if (SLIST_FIRST((head)) == (elm)) { \ SLIST_REMOVE_HEAD((head), field); \ } \ else { \ struct type *curelm = SLIST_FIRST((head)); \ while (SLIST_NEXT(curelm, field) != (elm)) \ curelm = SLIST_NEXT(curelm, field); \ SLIST_REMOVE_AFTER(curelm, field); \ } \ TRASHIT((elm)->field.sle_next); \ } while (0) \ __NULLABILITY_COMPLETENESS_POP \ __MISMATCH_TAGS_POP #define SLIST_REMOVE_AFTER(elm, field) do { \ SLIST_NEXT(elm, field) = \ SLIST_NEXT(SLIST_NEXT(elm, field), field); \ } while (0) #define SLIST_REMOVE_HEAD(head, field) do { \ SLIST_FIRST((head)) = SLIST_NEXT(SLIST_FIRST((head)), field); \ } while (0) /* * Singly-linked Tail queue declarations. */ #define STAILQ_HEAD(name, type) \ __MISMATCH_TAGS_PUSH \ __NULLABILITY_COMPLETENESS_PUSH \ struct name { \ struct type *stqh_first;/* first element */ \ struct type **stqh_last;/* addr of last next element */ \ } \ __NULLABILITY_COMPLETENESS_POP \ __MISMATCH_TAGS_POP #define STAILQ_HEAD_INITIALIZER(head) \ { NULL, &(head).stqh_first } #define STAILQ_ENTRY(type) \ __MISMATCH_TAGS_PUSH \ __NULLABILITY_COMPLETENESS_PUSH \ struct { \ struct type *stqe_next; /* next element */ \ } \ __NULLABILITY_COMPLETENESS_POP \ __MISMATCH_TAGS_POP /* * Singly-linked Tail queue functions. */ #define STAILQ_CONCAT(head1, head2) do { \ if (!STAILQ_EMPTY((head2))) { \ *(head1)->stqh_last = (head2)->stqh_first; \ (head1)->stqh_last = (head2)->stqh_last; \ STAILQ_INIT((head2)); \ } \ } while (0) #define STAILQ_EMPTY(head) ((head)->stqh_first == NULL) #define STAILQ_FIRST(head) ((head)->stqh_first) #define STAILQ_FOREACH(var, head, field) \ for((var) = STAILQ_FIRST((head)); \ (var); \ (var) = STAILQ_NEXT((var), field)) #define STAILQ_FOREACH_SAFE(var, head, field, tvar) \ for ((var) = STAILQ_FIRST((head)); \ (var) && ((tvar) = STAILQ_NEXT((var), field), 1); \ (var) = (tvar)) #define STAILQ_INIT(head) do { \ STAILQ_FIRST((head)) = NULL; \ (head)->stqh_last = &STAILQ_FIRST((head)); \ } while (0) #define STAILQ_INSERT_AFTER(head, tqelm, elm, field) do { \ if ((STAILQ_NEXT((elm), field) = STAILQ_NEXT((tqelm), field)) == NULL)\ (head)->stqh_last = &STAILQ_NEXT((elm), field); \ STAILQ_NEXT((tqelm), field) = (elm); \ } while (0) #define STAILQ_INSERT_HEAD(head, elm, field) do { \ if ((STAILQ_NEXT((elm), field) = STAILQ_FIRST((head))) == NULL) \ (head)->stqh_last = &STAILQ_NEXT((elm), field); \ STAILQ_FIRST((head)) = (elm); \ } while (0) #define STAILQ_INSERT_TAIL(head, elm, field) do { \ STAILQ_NEXT((elm), field) = NULL; \ *(head)->stqh_last = (elm); \ (head)->stqh_last = &STAILQ_NEXT((elm), field); \ } while (0) #define STAILQ_LAST(head, type, field) \ __MISMATCH_TAGS_PUSH \ __NULLABILITY_COMPLETENESS_PUSH \ (STAILQ_EMPTY((head)) ? \ NULL : \ ((struct type *)(void *) \ ((char *)((head)->stqh_last) - __offsetof(struct type, field))))\ __NULLABILITY_COMPLETENESS_POP \ __MISMATCH_TAGS_POP #define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next) #define STAILQ_REMOVE(head, elm, type, field) \ __MISMATCH_TAGS_PUSH \ __NULLABILITY_COMPLETENESS_PUSH \ do { \ if (STAILQ_FIRST((head)) == (elm)) { \ STAILQ_REMOVE_HEAD((head), field); \ } \ else { \ struct type *curelm = STAILQ_FIRST((head)); \ while (STAILQ_NEXT(curelm, field) != (elm)) \ curelm = STAILQ_NEXT(curelm, field); \ STAILQ_REMOVE_AFTER(head, curelm, field); \ } \ TRASHIT((elm)->field.stqe_next); \ } while (0) \ __NULLABILITY_COMPLETENESS_POP \ __MISMATCH_TAGS_POP #define STAILQ_REMOVE_HEAD(head, field) do { \ if ((STAILQ_FIRST((head)) = \ STAILQ_NEXT(STAILQ_FIRST((head)), field)) == NULL) \ (head)->stqh_last = &STAILQ_FIRST((head)); \ } while (0) #define STAILQ_REMOVE_HEAD_UNTIL(head, elm, field) do { \ if ((STAILQ_FIRST((head)) = STAILQ_NEXT((elm), field)) == NULL) \ (head)->stqh_last = &STAILQ_FIRST((head)); \ } while (0) #define STAILQ_REMOVE_AFTER(head, elm, field) do { \ if ((STAILQ_NEXT(elm, field) = \ STAILQ_NEXT(STAILQ_NEXT(elm, field), field)) == NULL) \ (head)->stqh_last = &STAILQ_NEXT((elm), field); \ } while (0) #define STAILQ_SWAP(head1, head2, type) \ __MISMATCH_TAGS_PUSH \ __NULLABILITY_COMPLETENESS_PUSH \ do { \ struct type *swap_first = STAILQ_FIRST(head1); \ struct type **swap_last = (head1)->stqh_last; \ STAILQ_FIRST(head1) = STAILQ_FIRST(head2); \ (head1)->stqh_last = (head2)->stqh_last; \ STAILQ_FIRST(head2) = swap_first; \ (head2)->stqh_last = swap_last; \ if (STAILQ_EMPTY(head1)) \ (head1)->stqh_last = &STAILQ_FIRST(head1); \ if (STAILQ_EMPTY(head2)) \ (head2)->stqh_last = &STAILQ_FIRST(head2); \ } while (0) \ __NULLABILITY_COMPLETENESS_POP \ __MISMATCH_TAGS_POP /* * List declarations. */ #define LIST_HEAD(name, type) \ __MISMATCH_TAGS_PUSH \ __NULLABILITY_COMPLETENESS_PUSH \ struct name { \ struct type *lh_first; /* first element */ \ } \ __NULLABILITY_COMPLETENESS_POP \ __MISMATCH_TAGS_POP #define LIST_HEAD_INITIALIZER(head) \ { NULL } #define LIST_ENTRY(type) \ __MISMATCH_TAGS_PUSH \ __NULLABILITY_COMPLETENESS_PUSH \ struct { \ struct type *le_next; /* next element */ \ struct type **le_prev; /* address of previous next element */ \ } \ __NULLABILITY_COMPLETENESS_POP \ __MISMATCH_TAGS_POP /* * List functions. */ #define LIST_CHECK_HEAD(head, field) #define LIST_CHECK_NEXT(elm, field) #define LIST_CHECK_PREV(elm, field) #define LIST_EMPTY(head) ((head)->lh_first == NULL) #define LIST_FIRST(head) ((head)->lh_first) #define LIST_FOREACH(var, head, field) \ for ((var) = LIST_FIRST((head)); \ (var); \ (var) = LIST_NEXT((var), field)) #define LIST_FOREACH_SAFE(var, head, field, tvar) \ for ((var) = LIST_FIRST((head)); \ (var) && ((tvar) = LIST_NEXT((var), field), 1); \ (var) = (tvar)) #define LIST_INIT(head) do { \ LIST_FIRST((head)) = NULL; \ } while (0) #define LIST_INSERT_AFTER(listelm, elm, field) do { \ LIST_CHECK_NEXT(listelm, field); \ if ((LIST_NEXT((elm), field) = LIST_NEXT((listelm), field)) != NULL)\ LIST_NEXT((listelm), field)->field.le_prev = \ &LIST_NEXT((elm), field); \ LIST_NEXT((listelm), field) = (elm); \ (elm)->field.le_prev = &LIST_NEXT((listelm), field); \ } while (0) #define LIST_INSERT_BEFORE(listelm, elm, field) do { \ LIST_CHECK_PREV(listelm, field); \ (elm)->field.le_prev = (listelm)->field.le_prev; \ LIST_NEXT((elm), field) = (listelm); \ *(listelm)->field.le_prev = (elm); \ (listelm)->field.le_prev = &LIST_NEXT((elm), field); \ } while (0) #define LIST_INSERT_HEAD(head, elm, field) do { \ LIST_CHECK_HEAD((head), field); \ if ((LIST_NEXT((elm), field) = LIST_FIRST((head))) != NULL) \ LIST_FIRST((head))->field.le_prev = &LIST_NEXT((elm), field);\ LIST_FIRST((head)) = (elm); \ (elm)->field.le_prev = &LIST_FIRST((head)); \ } while (0) #define LIST_NEXT(elm, field) ((elm)->field.le_next) #define LIST_REMOVE(elm, field) do { \ LIST_CHECK_NEXT(elm, field); \ LIST_CHECK_PREV(elm, field); \ if (LIST_NEXT((elm), field) != NULL) \ LIST_NEXT((elm), field)->field.le_prev = \ (elm)->field.le_prev; \ *(elm)->field.le_prev = LIST_NEXT((elm), field); \ TRASHIT((elm)->field.le_next); \ TRASHIT((elm)->field.le_prev); \ } while (0) #define LIST_SWAP(head1, head2, type, field) \ __MISMATCH_TAGS_PUSH \ __NULLABILITY_COMPLETENESS_PUSH \ do { \ struct type *swap_tmp = LIST_FIRST((head1)); \ LIST_FIRST((head1)) = LIST_FIRST((head2)); \ LIST_FIRST((head2)) = swap_tmp; \ if ((swap_tmp = LIST_FIRST((head1))) != NULL) \ swap_tmp->field.le_prev = &LIST_FIRST((head1)); \ if ((swap_tmp = LIST_FIRST((head2))) != NULL) \ swap_tmp->field.le_prev = &LIST_FIRST((head2)); \ } while (0) \ __NULLABILITY_COMPLETENESS_POP \ __MISMATCH_TAGS_POP /* * Tail queue declarations. */ #define TAILQ_HEAD(name, type) \ __MISMATCH_TAGS_PUSH \ __NULLABILITY_COMPLETENESS_PUSH \ struct name { \ struct type *tqh_first; /* first element */ \ struct type **tqh_last; /* addr of last next element */ \ TRACEBUF \ } \ __NULLABILITY_COMPLETENESS_POP \ __MISMATCH_TAGS_POP #define TAILQ_HEAD_INITIALIZER(head) \ { NULL, &(head).tqh_first } #define TAILQ_ENTRY(type) \ __MISMATCH_TAGS_PUSH \ __NULLABILITY_COMPLETENESS_PUSH \ struct { \ struct type *tqe_next; /* next element */ \ struct type **tqe_prev; /* address of previous next element */ \ TRACEBUF \ } \ __NULLABILITY_COMPLETENESS_POP \ __MISMATCH_TAGS_POP /* * Tail queue functions. */ #define TAILQ_CHECK_HEAD(head, field) #define TAILQ_CHECK_NEXT(elm, field) #define TAILQ_CHECK_PREV(elm, field) #define TAILQ_CONCAT(head1, head2, field) do { \ if (!TAILQ_EMPTY(head2)) { \ *(head1)->tqh_last = (head2)->tqh_first; \ (head2)->tqh_first->field.tqe_prev = (head1)->tqh_last; \ (head1)->tqh_last = (head2)->tqh_last; \ TAILQ_INIT((head2)); \ QMD_TRACE_HEAD(head1); \ QMD_TRACE_HEAD(head2); \ } \ } while (0) #define TAILQ_EMPTY(head) ((head)->tqh_first == NULL) #define TAILQ_FIRST(head) ((head)->tqh_first) #define TAILQ_FOREACH(var, head, field) \ for ((var) = TAILQ_FIRST((head)); \ (var); \ (var) = TAILQ_NEXT((var), field)) #define TAILQ_FOREACH_SAFE(var, head, field, tvar) \ for ((var) = TAILQ_FIRST((head)); \ (var) && ((tvar) = TAILQ_NEXT((var), field), 1); \ (var) = (tvar)) #define TAILQ_FOREACH_REVERSE(var, head, headname, field) \ for ((var) = TAILQ_LAST((head), headname); \ (var); \ (var) = TAILQ_PREV((var), headname, field)) #define TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar) \ for ((var) = TAILQ_LAST((head), headname); \ (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1); \ (var) = (tvar)) #define TAILQ_INIT(head) do { \ TAILQ_FIRST((head)) = NULL; \ (head)->tqh_last = &TAILQ_FIRST((head)); \ QMD_TRACE_HEAD(head); \ } while (0) #define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ TAILQ_CHECK_NEXT(listelm, field); \ if ((TAILQ_NEXT((elm), field) = TAILQ_NEXT((listelm), field)) != NULL)\ TAILQ_NEXT((elm), field)->field.tqe_prev = \ &TAILQ_NEXT((elm), field); \ else { \ (head)->tqh_last = &TAILQ_NEXT((elm), field); \ QMD_TRACE_HEAD(head); \ } \ TAILQ_NEXT((listelm), field) = (elm); \ (elm)->field.tqe_prev = &TAILQ_NEXT((listelm), field); \ QMD_TRACE_ELEM(&(elm)->field); \ QMD_TRACE_ELEM(&listelm->field); \ } while (0) #define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \ TAILQ_CHECK_PREV(listelm, field); \ (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \ TAILQ_NEXT((elm), field) = (listelm); \ *(listelm)->field.tqe_prev = (elm); \ (listelm)->field.tqe_prev = &TAILQ_NEXT((elm), field); \ QMD_TRACE_ELEM(&(elm)->field); \ QMD_TRACE_ELEM(&listelm->field); \ } while (0) #define TAILQ_INSERT_HEAD(head, elm, field) do { \ TAILQ_CHECK_HEAD(head, field); \ if ((TAILQ_NEXT((elm), field) = TAILQ_FIRST((head))) != NULL) \ TAILQ_FIRST((head))->field.tqe_prev = \ &TAILQ_NEXT((elm), field); \ else \ (head)->tqh_last = &TAILQ_NEXT((elm), field); \ TAILQ_FIRST((head)) = (elm); \ (elm)->field.tqe_prev = &TAILQ_FIRST((head)); \ QMD_TRACE_HEAD(head); \ QMD_TRACE_ELEM(&(elm)->field); \ } while (0) #define TAILQ_INSERT_TAIL(head, elm, field) do { \ TAILQ_NEXT((elm), field) = NULL; \ (elm)->field.tqe_prev = (head)->tqh_last; \ *(head)->tqh_last = (elm); \ (head)->tqh_last = &TAILQ_NEXT((elm), field); \ QMD_TRACE_HEAD(head); \ QMD_TRACE_ELEM(&(elm)->field); \ } while (0) #define TAILQ_LAST(head, headname) \ __MISMATCH_TAGS_PUSH \ __NULLABILITY_COMPLETENESS_PUSH \ (*(((struct headname *)((head)->tqh_last))->tqh_last)) \ __NULLABILITY_COMPLETENESS_POP \ __MISMATCH_TAGS_POP #define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next) #define TAILQ_PREV(elm, headname, field) \ __MISMATCH_TAGS_PUSH \ __NULLABILITY_COMPLETENESS_PUSH \ (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last)) \ __NULLABILITY_COMPLETENESS_POP \ __MISMATCH_TAGS_POP #define TAILQ_REMOVE(head, elm, field) do { \ TAILQ_CHECK_NEXT(elm, field); \ TAILQ_CHECK_PREV(elm, field); \ if ((TAILQ_NEXT((elm), field)) != NULL) \ TAILQ_NEXT((elm), field)->field.tqe_prev = \ (elm)->field.tqe_prev; \ else { \ (head)->tqh_last = (elm)->field.tqe_prev; \ QMD_TRACE_HEAD(head); \ } \ *(elm)->field.tqe_prev = TAILQ_NEXT((elm), field); \ TRASHIT((elm)->field.tqe_next); \ TRASHIT((elm)->field.tqe_prev); \ QMD_TRACE_ELEM(&(elm)->field); \ } while (0) /* * Why did they switch to spaces for this one macro? */ #define TAILQ_SWAP(head1, head2, type, field) \ __MISMATCH_TAGS_PUSH \ __NULLABILITY_COMPLETENESS_PUSH \ do { \ struct type *swap_first = (head1)->tqh_first; \ struct type **swap_last = (head1)->tqh_last; \ (head1)->tqh_first = (head2)->tqh_first; \ (head1)->tqh_last = (head2)->tqh_last; \ (head2)->tqh_first = swap_first; \ (head2)->tqh_last = swap_last; \ if ((swap_first = (head1)->tqh_first) != NULL) \ swap_first->field.tqe_prev = &(head1)->tqh_first; \ else \ (head1)->tqh_last = &(head1)->tqh_first; \ if ((swap_first = (head2)->tqh_first) != NULL) \ swap_first->field.tqe_prev = &(head2)->tqh_first; \ else \ (head2)->tqh_last = &(head2)->tqh_first; \ } while (0) \ __NULLABILITY_COMPLETENESS_POP \ __MISMATCH_TAGS_POP /* * Circular queue definitions. */ #define CIRCLEQ_HEAD(name, type) \ __MISMATCH_TAGS_PUSH \ __NULLABILITY_COMPLETENESS_PUSH \ struct name { \ struct type *cqh_first; /* first element */ \ struct type *cqh_last; /* last element */ \ } \ __NULLABILITY_COMPLETENESS_POP \ __MISMATCH_TAGS_POP #define CIRCLEQ_ENTRY(type) \ __MISMATCH_TAGS_PUSH \ __NULLABILITY_COMPLETENESS_PUSH \ struct { \ struct type *cqe_next; /* next element */ \ struct type *cqe_prev; /* previous element */ \ } \ __NULLABILITY_COMPLETENESS_POP \ __MISMATCH_TAGS_POP /* * Circular queue functions. */ #define CIRCLEQ_CHECK_HEAD(head, field) #define CIRCLEQ_CHECK_NEXT(head, elm, field) #define CIRCLEQ_CHECK_PREV(head, elm, field) #define CIRCLEQ_EMPTY(head) ((head)->cqh_first == (void *)(head)) #define CIRCLEQ_FIRST(head) ((head)->cqh_first) #define CIRCLEQ_FOREACH(var, head, field) \ for((var) = (head)->cqh_first; \ (var) != (void *)(head); \ (var) = (var)->field.cqe_next) #define CIRCLEQ_INIT(head) do { \ (head)->cqh_first = (void *)(head); \ (head)->cqh_last = (void *)(head); \ } while (0) #define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ CIRCLEQ_CHECK_NEXT(head, listelm, field); \ (elm)->field.cqe_next = (listelm)->field.cqe_next; \ (elm)->field.cqe_prev = (listelm); \ if ((listelm)->field.cqe_next == (void *)(head)) \ (head)->cqh_last = (elm); \ else \ (listelm)->field.cqe_next->field.cqe_prev = (elm); \ (listelm)->field.cqe_next = (elm); \ } while (0) #define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \ CIRCLEQ_CHECK_PREV(head, listelm, field); \ (elm)->field.cqe_next = (listelm); \ (elm)->field.cqe_prev = (listelm)->field.cqe_prev; \ if ((listelm)->field.cqe_prev == (void *)(head)) \ (head)->cqh_first = (elm); \ else \ (listelm)->field.cqe_prev->field.cqe_next = (elm); \ (listelm)->field.cqe_prev = (elm); \ } while (0) #define CIRCLEQ_INSERT_HEAD(head, elm, field) do { \ CIRCLEQ_CHECK_HEAD(head, field); \ (elm)->field.cqe_next = (head)->cqh_first; \ (elm)->field.cqe_prev = (void *)(head); \ if ((head)->cqh_last == (void *)(head)) \ (head)->cqh_last = (elm); \ else \ (head)->cqh_first->field.cqe_prev = (elm); \ (head)->cqh_first = (elm); \ } while (0) #define CIRCLEQ_INSERT_TAIL(head, elm, field) do { \ (elm)->field.cqe_next = (void *)(head); \ (elm)->field.cqe_prev = (head)->cqh_last; \ if ((head)->cqh_first == (void *)(head)) \ (head)->cqh_first = (elm); \ else \ (head)->cqh_last->field.cqe_next = (elm); \ (head)->cqh_last = (elm); \ } while (0) #define CIRCLEQ_LAST(head) ((head)->cqh_last) #define CIRCLEQ_NEXT(elm, field) ((elm)->field.cqe_next) #define CIRCLEQ_PREV(elm, field) ((elm)->field.cqe_prev) #define CIRCLEQ_REMOVE(head, elm, field) do { \ CIRCLEQ_CHECK_NEXT(head, elm, field); \ CIRCLEQ_CHECK_PREV(head, elm, field); \ if ((elm)->field.cqe_next == (void *)(head)) \ (head)->cqh_last = (elm)->field.cqe_prev; \ else \ (elm)->field.cqe_next->field.cqe_prev = \ (elm)->field.cqe_prev; \ if ((elm)->field.cqe_prev == (void *)(head)) \ (head)->cqh_first = (elm)->field.cqe_next; \ else \ (elm)->field.cqe_prev->field.cqe_next = \ (elm)->field.cqe_next; \ } while (0) #ifdef _KERNEL #if NOTFB31 /* * XXX insque() and remque() are an old way of handling certain queues. * They bogusly assumes that all queue heads look alike. */ struct quehead { struct quehead *qh_link; struct quehead *qh_rlink; }; #ifdef __GNUC__ #define chkquenext(a) #define chkqueprev(a) static __inline void insque(void *a, void *b) { struct quehead *element = (struct quehead *)a, *head = (struct quehead *)b; chkquenext(head); element->qh_link = head->qh_link; element->qh_rlink = head; head->qh_link = element; element->qh_link->qh_rlink = element; } static __inline void remque(void *a) { struct quehead *element = (struct quehead *)a; chkquenext(element); chkqueprev(element); element->qh_link->qh_rlink = element->qh_rlink; element->qh_rlink->qh_link = element->qh_link; element->qh_rlink = 0; } #else /* !__GNUC__ */ void insque(void *a, void *b); void remque(void *a); #endif /* __GNUC__ */ #endif /* NOTFB31 */ #endif /* _KERNEL */ #endif /* !_SYS_QUEUE_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/quota.h ================================================ /* * 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@ */ /* * Copyright (c) 1982, 1986, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Robert Elz at The University of Melbourne. * * 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. * * @(#)quota.h * derived from @(#)ufs/ufs/quota.h 8.3 (Berkeley) 8/19/94 */ #ifndef _SYS_QUOTA_H #define _SYS_QUOTA_H #include #include #include /* u_int32_t */ #include #ifdef __APPLE_API_UNSTABLE /* * Definitions for disk quotas imposed on the average user * (big brother finally hits UNIX). * * The following constants define the amount of time given a user before the * soft limits are treated as hard limits (usually resulting in an allocation * failure). The timer is started when the user crosses their soft limit, it * is reset when they go below their soft limit. */ #define MAX_IQ_TIME (7*24*60*60) /* seconds in 1 week */ #define MAX_DQ_TIME (7*24*60*60) /* seconds in 1 week */ /* * The following constants define the usage of the quota file array in the * file system mount structure and dquot array in the inode structure. The semantics * of the elements of these arrays are defined in the routine getinoquota; * the remainder of the quota code treats them generically and need not be * inspected when changing the size of the array. */ #define MAXQUOTAS 2 #define USRQUOTA 0 /* element used for user quotas */ #define GRPQUOTA 1 /* element used for group quotas */ /* * Definitions for the default names of the quotas files. */ #define INITQFNAMES { \ "user", /* USRQUOTA */ \ "group", /* GRPQUOTA */ \ "undefined", \ }; #define QUOTAFILENAME ".quota" #define QUOTAOPSNAME ".quota.ops" #define QUOTAGROUP "operator" /* * Command definitions for the 'quotactl' system call. The commands are * broken into a main command defined below and a subcommand that is used * to convey the type of quota that is being manipulated (see above). */ #define SUBCMDMASK 0x00ff #define SUBCMDSHIFT 8 #define QCMD(cmd, type) (((cmd) << SUBCMDSHIFT) | ((type) & SUBCMDMASK)) #define Q_QUOTAON 0x0100 /* enable quotas */ #define Q_QUOTAOFF 0x0200 /* disable quotas */ #define Q_GETQUOTA 0x0300 /* get limits and usage */ #define Q_SETQUOTA 0x0400 /* set limits and usage */ #define Q_SETUSE 0x0500 /* set usage */ #define Q_SYNC 0x0600 /* sync disk copy of a filesystems quotas */ #define Q_QUOTASTAT 0x0700 /* get quota on/off status */ /* * The following two structures define the format of the disk * quota file (as it appears on disk) - the file contains a * header followed by a hash table of dqblk entries. To find * a particular entry, the user or group number (id) is first * converted to an index into this table by means of the hash * function dqhash1. If there is a collision at that index * location then a second hash value is computed which using * dqhash2. This second hash value is then used as an offset * to the next location to probe. ID = 0 is used to indicate * an empty (unused) entry. So there can never be an entry in * the quota file for user 0 or group 0 (which is OK since disk * quotas are never enforced for user 0). * * The setquota system call establishes the vnode for each quota * file (a pointer is retained in the filesystem mount structure). */ struct dqfilehdr { u_int32_t dqh_magic; u_int32_t dqh_version; /* == QF_VERSION */ u_int32_t dqh_maxentries; /* must be a power of 2 */ u_int32_t dqh_entrycnt; /* count of active entries */ u_int32_t dqh_flags; /* reserved for now (0) */ u_int32_t dqh_chktime; /* time of last quota check */ u_int32_t dqh_btime; /* time limit for excessive disk use */ u_int32_t dqh_itime; /* time limit for excessive files */ char dqh_string[16]; /* tag string */ u_int32_t dqh_spare[4]; /* pad struct to power of 2 */ }; struct dqblk { u_int64_t dqb_bhardlimit; /* absolute limit on disk bytes alloc */ u_int64_t dqb_bsoftlimit; /* preferred limit on disk bytes */ u_int64_t dqb_curbytes; /* current byte count */ u_int32_t dqb_ihardlimit; /* maximum # allocated inodes + 1 */ u_int32_t dqb_isoftlimit; /* preferred inode limit */ u_int32_t dqb_curinodes; /* current # allocated inodes */ u_int32_t dqb_btime; /* time limit for excessive disk use */ u_int32_t dqb_itime; /* time limit for excessive files */ u_int32_t dqb_id; /* identifier (0 for empty entries) */ u_int32_t dqb_spare[4]; /* pad struct to power of 2 */ }; #define INITQMAGICS { \ 0xff31ff35, /* USRQUOTA */ \ 0xff31ff27, /* GRPQUOTA */ \ } #define QF_VERSION 1 #define QF_STRING_TAG "QUOTA HASH FILE" #define QF_USERS_PER_GB 256 #define QF_MIN_USERS 2048 #define QF_MAX_USERS (2048*1024) #define QF_GROUPS_PER_GB 32 #define QF_MIN_GROUPS 2048 #define QF_MAX_GROUPS (256*1024) /* * The primary and secondary multiplicative hash functions are * derived from Knuth (vol. 3). They use a prime that is in * golden ratio to the machine's word size. */ #define dqhash1(id, shift, mask) \ ((((id) * 2654435761U) >> (shift)) & (mask)) #define dqhash2(id, mask) \ (dqhash1((id), 11, (mask)>>1) | 1) /* * Compute a disk offset into a quota file. */ #define dqoffset(index) \ (sizeof (struct dqfilehdr) + ((index) * sizeof (struct dqblk))) /* * Compute the hash shift value. * It is the word size, in bits, minus the hash table size, in bits. */ static __inline int dqhashshift(u_int32_t); static __inline int dqhashshift(u_int32_t size) { int shift; for (shift = 32; size > 1; size >>= 1, --shift) { continue; } return shift; } __BEGIN_DECLS int quotactl(const char *, int, int, caddr_t); __END_DECLS #endif /* __APPLE_API_UNSTABLE */ #endif /* !_SYS_QUOTA_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/random.h ================================================ /* * Copyright (c) 1999, 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 __SYS_RANDOM_H__ #define __SYS_RANDOM_H__ #include #include #include #include __BEGIN_DECLS int getentropy(void* buffer, size_t size) __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0); __END_DECLS #endif /* __SYS_RANDOM_H__ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/rbtree.h ================================================ /* $NetBSD: rbtree.h,v 1.2 2012/02/17 08:20:55 yamt Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. * All rights reserved. * * Portions Copyright (c) 2012 Apple Inc. All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation * by Matt Thomas . * * 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. * * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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. */ #ifndef _SYS_RBTREE_H_ #define _SYS_RBTREE_H_ #include #include #include #include #include __BEGIN_DECLS #define RB_DIR_LEFT 0 #define RB_DIR_RIGHT 1 #define RB_TREE_MIN(T) rb_tree_iterate((T), NULL, RB_DIR_RIGHT) #define RB_TREE_MAX(T) rb_tree_iterate((T), NULL, RB_DIR_LEFT) #define RB_TREE_FOREACH(N, T) \ for ((N) = RB_TREE_MIN(T); (N); \ (N) = rb_tree_iterate((T), (N), RB_DIR_RIGHT)) #define RB_TREE_FOREACH_SAFE(N, T, TVAR) \ for ((N) = RB_TREE_MIN(T); (N) && ((TVAR) = rb_tree_iterate((T), (N), RB_DIR_RIGHT), 1); \ (N) = (TVAR)) #define RB_TREE_FOREACH_REVERSE(N, T) \ for ((N) = RB_TREE_MAX(T); (N); \ (N) = rb_tree_iterate((T), (N), RB_DIR_LEFT)) #define RB_TREE_FOREACH_REVERSE_SAFE(N, T, TVAR) \ for ((N) = RB_TREE_MAX(T); (N) && ((TVAR) = rb_tree_iterate((T), (N), RB_DIR_LEFT), 1); \ (N) = (TVAR)) /* * rbto_compare_nodes_fn: * return a positive value if the first node > the second node. * return a negative value if the first node < the second node. * return 0 if they are considered same. * * rbto_compare_key_fn: * return a positive value if the node > the key. * return a negative value if the node < the key. * return 0 if they are considered same. */ typedef signed int (*rbto_compare_nodes_fn)(void *, const void *, const void *); typedef signed int (*rbto_compare_key_fn)(void *, const void *, const void *); typedef struct { rbto_compare_nodes_fn rbto_compare_nodes; rbto_compare_key_fn rbto_compare_key; size_t rbto_node_offset; void *rbto_context; } rb_tree_ops_t; typedef struct rb_node { void * opaque[3]; } rb_node_t; typedef struct rb_tree { void *opaque[8]; } rb_tree_t; #define _rb_availability __OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0); void rb_tree_init(rb_tree_t *, const rb_tree_ops_t *) _rb_availability; void * rb_tree_insert_node(rb_tree_t *, void *) _rb_availability; void * rb_tree_find_node(rb_tree_t *, const void *) _rb_availability; void * rb_tree_find_node_geq(rb_tree_t *, const void *) _rb_availability; void * rb_tree_find_node_leq(rb_tree_t *, const void *) _rb_availability; void rb_tree_remove_node(rb_tree_t *, void *) _rb_availability; void * rb_tree_iterate(rb_tree_t *, void *, const unsigned int) _rb_availability; size_t rb_tree_count(rb_tree_t *) _rb_availability; #undef _rb_availability __END_DECLS #endif /* _SYS_RBTREE_H_*/ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/reboot.h ================================================ /* * 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@ */ /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */ /* * Copyright (c) 1982, 1986, 1988, 1993, 1994 * 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. * * @(#)reboot.h 8.3 (Berkeley) 12/13/94 */ #ifndef _SYS_REBOOT_H_ #define _SYS_REBOOT_H_ #include #include #include /* * Arguments to reboot system call. */ #ifdef __APPLE_API_PRIVATE #define RB_AUTOBOOT 0 /* flags for system auto-booting itself */ #define RB_ASKNAME 0x01 /* ask for file name to reboot from */ #define RB_SINGLE 0x02 /* reboot to single user only */ #define RB_NOSYNC 0x04 /* dont sync before reboot */ #define RB_HALT 0x08 /* don't reboot, just halt */ #define RB_INITNAME 0x10 /* name given for /etc/init */ #define RB_DFLTROOT 0x20 /* use compiled-in rootdev */ #define RB_ALTBOOT 0x40 /* use /boot.old vs /boot */ #define RB_UNIPROC 0x80 /* don't start slaves */ #define RB_SAFEBOOT 0x100 /* booting safe */ #define RB_UPSDELAY 0x200 /* Delays restart by 5 minutes */ #define RB_QUICK 0x400 /* quick and ungraceful reboot with file system caches flushed*/ #define RB_PANIC 0x800 /* panic the kernel */ #define RB_PANIC_ZPRINT 0x1000 /* add zprint info to panic string */ __BEGIN_DECLS /* userspace reboot control */ int usrctl(uint32_t flags); /* The normal reboot syscall. */ int reboot(int howto); /* Used with RB_PANIC to panic the kernel from userspace with a message. * Requires an entitlement on Release. */ int reboot_np(int howto, const char *message); __END_DECLS #endif /* __APPLE_API_PRIVATE */ #ifdef __APPLE_API_OBSOLETE /* * Constants for converting boot-style device number to type, * adaptor (uba, mba, etc), unit number and partition number. * Type (== major device number) is in the low byte * for backward compatibility. Except for that of the "magic * number", each mask applies to the shifted value. * Format: * (4) (4) (4) (4) (8) (8) * -------------------------------- * |MA | AD| CT| UN| PART | TYPE | * -------------------------------- */ #define B_ADAPTORSHIFT 24 #define B_ADAPTORMASK 0x0f #define B_ADAPTOR(val) (((val) >> B_ADAPTORSHIFT) & B_ADAPTORMASK) #define B_CONTROLLERSHIFT 20 #define B_CONTROLLERMASK 0xf #define B_CONTROLLER(val) (((val)>>B_CONTROLLERSHIFT) & B_CONTROLLERMASK) #define B_UNITSHIFT 16 #define B_UNITMASK 0xff #define B_UNIT(val) (((val) >> B_UNITSHIFT) & B_UNITMASK) #define B_PARTITIONSHIFT 8 #define B_PARTITIONMASK 0xff #define B_PARTITION(val) (((val) >> B_PARTITIONSHIFT) & B_PARTITIONMASK) #define B_TYPESHIFT 0 #define B_TYPEMASK 0xff #define B_TYPE(val) (((val) >> B_TYPESHIFT) & B_TYPEMASK) #define B_MAGICMASK 0xf0000000 #define B_DEVMAGIC 0xa0000000 #define MAKEBOOTDEV(type, adaptor, controller, unit, partition) \ (((type) << B_TYPESHIFT) | ((adaptor) << B_ADAPTORSHIFT) | \ ((controller) << B_CONTROLLERSHIFT) | ((unit) << B_UNITSHIFT) | \ ((partition) << B_PARTITIONSHIFT) | B_DEVMAGIC) #endif /* __APPLE_API_OBSOLETE */ #endif /* _SYS_REBOOT_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/resource.h ================================================ /* * 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@ */ /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */ /* * Copyright (c) 1982, 1986, 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. * * @(#)resource.h 8.2 (Berkeley) 1/4/94 */ #ifndef _SYS_RESOURCE_H_ #define _SYS_RESOURCE_H_ #include #include #include #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL #include #endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */ #include /* [XSI] The timeval structure shall be defined as described in * */ #include /* The id_t type shall be defined as described in */ #include /* * Resource limit type (low 63 bits, excluding the sign bit) */ typedef __uint64_t rlim_t; /***** * PRIORITY */ /* * Possible values of the first parameter to getpriority()/setpriority(), * used to indicate the type of the second parameter. */ #define PRIO_PROCESS 0 /* Second argument is a PID */ #define PRIO_PGRP 1 /* Second argument is a GID */ #define PRIO_USER 2 /* Second argument is a UID */ #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL #define PRIO_DARWIN_THREAD 3 /* Second argument is always 0 (current thread) */ #define PRIO_DARWIN_PROCESS 4 /* Second argument is a PID */ /* * Range limitations for the value of the third parameter to setpriority(). */ #define PRIO_MIN -20 #define PRIO_MAX 20 /* * use PRIO_DARWIN_BG to set the current thread into "background" state * which lowers CPU, disk IO, and networking priorites until thread terminates * or "background" state is revoked */ #define PRIO_DARWIN_BG 0x1000 /* * use PRIO_DARWIN_NONUI to restrict a process's ability to make calls to * the GPU. (deprecated) */ #define PRIO_DARWIN_NONUI 0x1001 #endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */ /***** * RESOURCE USAGE */ /* * Possible values of the first parameter to getrusage(), used to indicate * the scope of the information to be returned. */ #define RUSAGE_SELF 0 /* Current process information */ #define RUSAGE_CHILDREN -1 /* Current process' children */ /* * A structure representing an accounting of resource utilization. The * address of an instance of this structure is the second parameter to * getrusage(). * * Note: All values other than ru_utime and ru_stime are implementaiton * defined and subject to change in a future release. Their use * is discouraged for standards compliant programs. */ struct rusage { struct timeval ru_utime; /* user time used (PL) */ struct timeval ru_stime; /* system time used (PL) */ #if __DARWIN_C_LEVEL < __DARWIN_C_FULL long ru_opaque[14]; /* implementation defined */ #else /* * Informational aliases for source compatibility with programs * that need more information than that provided by standards, * and which do not mind being OS-dependent. */ long ru_maxrss; /* max resident set size (PL) */ #define ru_first ru_ixrss /* internal: ruadd() range start */ long ru_ixrss; /* integral shared memory size (NU) */ long ru_idrss; /* integral unshared data (NU) */ long ru_isrss; /* integral unshared stack (NU) */ long ru_minflt; /* page reclaims (NU) */ long ru_majflt; /* page faults (NU) */ long ru_nswap; /* swaps (NU) */ long ru_inblock; /* block input operations (atomic) */ long ru_oublock; /* block output operations (atomic) */ long ru_msgsnd; /* messages sent (atomic) */ long ru_msgrcv; /* messages received (atomic) */ long ru_nsignals; /* signals received (atomic) */ long ru_nvcsw; /* voluntary context switches (atomic) */ long ru_nivcsw; /* involuntary " */ #define ru_last ru_nivcsw /* internal: ruadd() range end */ #endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */ }; #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL /* * Flavors for proc_pid_rusage(). */ #define RUSAGE_INFO_V0 0 #define RUSAGE_INFO_V1 1 #define RUSAGE_INFO_V2 2 #define RUSAGE_INFO_V3 3 #define RUSAGE_INFO_V4 4 #define RUSAGE_INFO_V5 5 #define RUSAGE_INFO_CURRENT RUSAGE_INFO_V5 /* * Flags for RUSAGE_INFO_V5 */ #define RU_PROC_RUNS_RESLIDE 0x00000001 /* proc has reslid shared cache */ typedef void *rusage_info_t; struct rusage_info_v0 { uint8_t ri_uuid[16]; uint64_t ri_user_time; uint64_t ri_system_time; uint64_t ri_pkg_idle_wkups; uint64_t ri_interrupt_wkups; uint64_t ri_pageins; uint64_t ri_wired_size; uint64_t ri_resident_size; uint64_t ri_phys_footprint; uint64_t ri_proc_start_abstime; uint64_t ri_proc_exit_abstime; }; struct rusage_info_v1 { uint8_t ri_uuid[16]; uint64_t ri_user_time; uint64_t ri_system_time; uint64_t ri_pkg_idle_wkups; uint64_t ri_interrupt_wkups; uint64_t ri_pageins; uint64_t ri_wired_size; uint64_t ri_resident_size; uint64_t ri_phys_footprint; uint64_t ri_proc_start_abstime; uint64_t ri_proc_exit_abstime; uint64_t ri_child_user_time; uint64_t ri_child_system_time; uint64_t ri_child_pkg_idle_wkups; uint64_t ri_child_interrupt_wkups; uint64_t ri_child_pageins; uint64_t ri_child_elapsed_abstime; }; struct rusage_info_v2 { uint8_t ri_uuid[16]; uint64_t ri_user_time; uint64_t ri_system_time; uint64_t ri_pkg_idle_wkups; uint64_t ri_interrupt_wkups; uint64_t ri_pageins; uint64_t ri_wired_size; uint64_t ri_resident_size; uint64_t ri_phys_footprint; uint64_t ri_proc_start_abstime; uint64_t ri_proc_exit_abstime; uint64_t ri_child_user_time; uint64_t ri_child_system_time; uint64_t ri_child_pkg_idle_wkups; uint64_t ri_child_interrupt_wkups; uint64_t ri_child_pageins; uint64_t ri_child_elapsed_abstime; uint64_t ri_diskio_bytesread; uint64_t ri_diskio_byteswritten; }; struct rusage_info_v3 { uint8_t ri_uuid[16]; uint64_t ri_user_time; uint64_t ri_system_time; uint64_t ri_pkg_idle_wkups; uint64_t ri_interrupt_wkups; uint64_t ri_pageins; uint64_t ri_wired_size; uint64_t ri_resident_size; uint64_t ri_phys_footprint; uint64_t ri_proc_start_abstime; uint64_t ri_proc_exit_abstime; uint64_t ri_child_user_time; uint64_t ri_child_system_time; uint64_t ri_child_pkg_idle_wkups; uint64_t ri_child_interrupt_wkups; uint64_t ri_child_pageins; uint64_t ri_child_elapsed_abstime; uint64_t ri_diskio_bytesread; uint64_t ri_diskio_byteswritten; uint64_t ri_cpu_time_qos_default; uint64_t ri_cpu_time_qos_maintenance; uint64_t ri_cpu_time_qos_background; uint64_t ri_cpu_time_qos_utility; uint64_t ri_cpu_time_qos_legacy; uint64_t ri_cpu_time_qos_user_initiated; uint64_t ri_cpu_time_qos_user_interactive; uint64_t ri_billed_system_time; uint64_t ri_serviced_system_time; }; struct rusage_info_v4 { uint8_t ri_uuid[16]; uint64_t ri_user_time; uint64_t ri_system_time; uint64_t ri_pkg_idle_wkups; uint64_t ri_interrupt_wkups; uint64_t ri_pageins; uint64_t ri_wired_size; uint64_t ri_resident_size; uint64_t ri_phys_footprint; uint64_t ri_proc_start_abstime; uint64_t ri_proc_exit_abstime; uint64_t ri_child_user_time; uint64_t ri_child_system_time; uint64_t ri_child_pkg_idle_wkups; uint64_t ri_child_interrupt_wkups; uint64_t ri_child_pageins; uint64_t ri_child_elapsed_abstime; uint64_t ri_diskio_bytesread; uint64_t ri_diskio_byteswritten; uint64_t ri_cpu_time_qos_default; uint64_t ri_cpu_time_qos_maintenance; uint64_t ri_cpu_time_qos_background; uint64_t ri_cpu_time_qos_utility; uint64_t ri_cpu_time_qos_legacy; uint64_t ri_cpu_time_qos_user_initiated; uint64_t ri_cpu_time_qos_user_interactive; uint64_t ri_billed_system_time; uint64_t ri_serviced_system_time; uint64_t ri_logical_writes; uint64_t ri_lifetime_max_phys_footprint; uint64_t ri_instructions; uint64_t ri_cycles; uint64_t ri_billed_energy; uint64_t ri_serviced_energy; uint64_t ri_interval_max_phys_footprint; uint64_t ri_runnable_time; }; struct rusage_info_v5 { uint8_t ri_uuid[16]; uint64_t ri_user_time; uint64_t ri_system_time; uint64_t ri_pkg_idle_wkups; uint64_t ri_interrupt_wkups; uint64_t ri_pageins; uint64_t ri_wired_size; uint64_t ri_resident_size; uint64_t ri_phys_footprint; uint64_t ri_proc_start_abstime; uint64_t ri_proc_exit_abstime; uint64_t ri_child_user_time; uint64_t ri_child_system_time; uint64_t ri_child_pkg_idle_wkups; uint64_t ri_child_interrupt_wkups; uint64_t ri_child_pageins; uint64_t ri_child_elapsed_abstime; uint64_t ri_diskio_bytesread; uint64_t ri_diskio_byteswritten; uint64_t ri_cpu_time_qos_default; uint64_t ri_cpu_time_qos_maintenance; uint64_t ri_cpu_time_qos_background; uint64_t ri_cpu_time_qos_utility; uint64_t ri_cpu_time_qos_legacy; uint64_t ri_cpu_time_qos_user_initiated; uint64_t ri_cpu_time_qos_user_interactive; uint64_t ri_billed_system_time; uint64_t ri_serviced_system_time; uint64_t ri_logical_writes; uint64_t ri_lifetime_max_phys_footprint; uint64_t ri_instructions; uint64_t ri_cycles; uint64_t ri_billed_energy; uint64_t ri_serviced_energy; uint64_t ri_interval_max_phys_footprint; uint64_t ri_runnable_time; uint64_t ri_flags; }; typedef struct rusage_info_v5 rusage_info_current; #endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */ /***** * RESOURCE LIMITS */ /* * Symbolic constants for resource limits; since all limits are representable * as a type rlim_t, we are permitted to define RLIM_SAVED_* in terms of * RLIM_INFINITY. */ #define RLIM_INFINITY (((__uint64_t)1 << 63) - 1) /* no limit */ #define RLIM_SAVED_MAX RLIM_INFINITY /* Unrepresentable hard limit */ #define RLIM_SAVED_CUR RLIM_INFINITY /* Unrepresentable soft limit */ /* * Possible values of the first parameter to getrlimit()/setrlimit(), to * indicate for which resource the operation is being performed. */ #define RLIMIT_CPU 0 /* cpu time per process */ #define RLIMIT_FSIZE 1 /* file size */ #define RLIMIT_DATA 2 /* data segment size */ #define RLIMIT_STACK 3 /* stack size */ #define RLIMIT_CORE 4 /* core file size */ #define RLIMIT_AS 5 /* address space (resident set size) */ #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL #define RLIMIT_RSS RLIMIT_AS /* source compatibility alias */ #define RLIMIT_MEMLOCK 6 /* locked-in-memory address space */ #define RLIMIT_NPROC 7 /* number of processes */ #endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */ #define RLIMIT_NOFILE 8 /* number of open files */ #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL #define RLIM_NLIMITS 9 /* total number of resource limits */ #endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */ #define _RLIMIT_POSIX_FLAG 0x1000 /* Set bit for strict POSIX */ /* * A structure representing a resource limit. The address of an instance * of this structure is the second parameter to getrlimit()/setrlimit(). */ struct rlimit { rlim_t rlim_cur; /* current (soft) limit */ rlim_t rlim_max; /* maximum value for rlim_cur */ }; #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL /* * proc_rlimit_control() * * Resource limit flavors */ #define RLIMIT_WAKEUPS_MONITOR 0x1 /* Configure the wakeups monitor. */ #define RLIMIT_CPU_USAGE_MONITOR 0x2 /* Configure the CPU usage monitor. */ #define RLIMIT_THREAD_CPULIMITS 0x3 /* Configure a blocking, per-thread, CPU limits. */ #define RLIMIT_FOOTPRINT_INTERVAL 0x4 /* Configure memory footprint interval tracking */ /* * Flags for wakeups monitor control. */ #define WAKEMON_ENABLE 0x01 #define WAKEMON_DISABLE 0x02 #define WAKEMON_GET_PARAMS 0x04 #define WAKEMON_SET_DEFAULTS 0x08 #define WAKEMON_MAKE_FATAL 0x10 /* Configure the task so that violations are fatal. */ /* * Flags for CPU usage monitor control. */ #define CPUMON_MAKE_FATAL 0x1000 /* * Flags for memory footprint interval tracking. */ #define FOOTPRINT_INTERVAL_RESET 0x1 /* Reset the footprint interval counter to zero */ struct proc_rlimit_control_wakeupmon { uint32_t wm_flags; int32_t wm_rate; }; /* I/O type */ #define IOPOL_TYPE_DISK 0 #define IOPOL_TYPE_VFS_ATIME_UPDATES 2 #define IOPOL_TYPE_VFS_MATERIALIZE_DATALESS_FILES 3 #define IOPOL_TYPE_VFS_STATFS_NO_DATA_VOLUME 4 #define IOPOL_TYPE_VFS_TRIGGER_RESOLVE 5 #define IOPOL_TYPE_VFS_IGNORE_CONTENT_PROTECTION 6 #define IOPOL_TYPE_VFS_IGNORE_PERMISSIONS 7 #define IOPOL_TYPE_VFS_SKIP_MTIME_UPDATE 8 #define IOPOL_TYPE_VFS_ALLOW_LOW_SPACE_WRITES 9 /* scope */ #define IOPOL_SCOPE_PROCESS 0 #define IOPOL_SCOPE_THREAD 1 #define IOPOL_SCOPE_DARWIN_BG 2 /* I/O Priority */ #define IOPOL_DEFAULT 0 #define IOPOL_IMPORTANT 1 #define IOPOL_PASSIVE 2 #define IOPOL_THROTTLE 3 #define IOPOL_UTILITY 4 #define IOPOL_STANDARD 5 /* compatibility with older names */ #define IOPOL_APPLICATION IOPOL_STANDARD #define IOPOL_NORMAL IOPOL_IMPORTANT #define IOPOL_ATIME_UPDATES_DEFAULT 0 #define IOPOL_ATIME_UPDATES_OFF 1 #define IOPOL_MATERIALIZE_DATALESS_FILES_DEFAULT 0 #define IOPOL_MATERIALIZE_DATALESS_FILES_OFF 1 #define IOPOL_MATERIALIZE_DATALESS_FILES_ON 2 #define IOPOL_VFS_STATFS_NO_DATA_VOLUME_DEFAULT 0 #define IOPOL_VFS_STATFS_FORCE_NO_DATA_VOLUME 1 #define IOPOL_VFS_TRIGGER_RESOLVE_DEFAULT 0 #define IOPOL_VFS_TRIGGER_RESOLVE_OFF 1 #define IOPOL_VFS_CONTENT_PROTECTION_DEFAULT 0 #define IOPOL_VFS_CONTENT_PROTECTION_IGNORE 1 #define IOPOL_VFS_IGNORE_PERMISSIONS_OFF 0 #define IOPOL_VFS_IGNORE_PERMISSIONS_ON 1 #define IOPOL_VFS_SKIP_MTIME_UPDATE_OFF 0 #define IOPOL_VFS_SKIP_MTIME_UPDATE_ON 1 #define IOPOL_VFS_ALLOW_LOW_SPACE_WRITES_OFF 0 #define IOPOL_VFS_ALLOW_LOW_SPACE_WRITES_ON 1 #endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */ __BEGIN_DECLS int getpriority(int, id_t); #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL int getiopolicy_np(int, int) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0); #endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */ int getrlimit(int, struct rlimit *) __DARWIN_ALIAS(getrlimit); int getrusage(int, struct rusage *); int setpriority(int, id_t, int); #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL int setiopolicy_np(int, int, int) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0); #endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */ int setrlimit(int, const struct rlimit *) __DARWIN_ALIAS(setrlimit); __END_DECLS #endif /* !_SYS_RESOURCE_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/resourcevar.h ================================================ /* * 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@ */ /* Copyright (c) 1995, 1997 Apple Computer, Inc. All Rights Reserved */ /* * Copyright (c) 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. * * @(#)resourcevar.h 8.4 (Berkeley) 1/9/95 */ #ifndef _SYS_RESOURCEVAR_H_ #define _SYS_RESOURCEVAR_H_ #include #include #include /* * Kernel per-process accounting / statistics * (not necessarily resident except when running). */ struct pstats { struct rusage p_ru; /* stats for this proc */ struct rusage p_cru; /* (PL) sum of stats for reaped children */ struct uprof { /* profile arguments */ struct uprof *pr_next; /* multiple prof buffers allowed */ caddr_t pr_base; /* buffer base */ u_int32_t pr_size; /* buffer size */ u_int32_t pr_off; /* pc offset */ u_int32_t pr_scale; /* pc scaling */ u_int32_t pr_addr; /* temp storage for addr until AST */ u_int32_t pr_ticks; /* temp storage for ticks until AST */ } p_prof; uint64_t ps_start; /* starting time ; compat only */ }; #endif /* !_SYS_RESOURCEVAR_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/sbuf.h ================================================ /*- * Copyright (c) 2000 Poul-Henning Kamp and Dag-Erling Coïdan Smørgrav * 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 * in this position and unchanged. * 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. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. * * $FreeBSD: /repoman/r/ncvs/src/sys/sys/sbuf.h,v 1.14 2004/07/09 11:35:30 des Exp $ */ #ifndef _SYS_SBUF_H_ #define _SYS_SBUF_H_ #include #include #include /* * Structure definition */ struct sbuf { char *s_buf; /* storage buffer */ void *s_unused; /* binary compatibility. */ int s_size; /* size of storage buffer */ int s_len; /* current length of string */ #define SBUF_FIXEDLEN 0x00000000 /* fixed length buffer (default) */ #define SBUF_AUTOEXTEND 0x00000001 /* automatically extend buffer */ #define SBUF_USRFLAGMSK 0x0000ffff /* mask of flags the user may specify */ #define SBUF_DYNAMIC 0x00010000 /* s_buf must be freed */ #define SBUF_FINISHED 0x00020000 /* set by sbuf_finish() */ #define SBUF_OVERFLOWED 0x00040000 /* sbuf overflowed */ #define SBUF_DYNSTRUCT 0x00080000 /* sbuf must be freed */ int s_flags; /* flags */ }; __BEGIN_DECLS __END_DECLS #endif ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/sdt.h ================================================ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License, Version 1.0 only * (the "License"). You may not use this file except in compliance * with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. * See the License for the specific language governing permissions * and limitations under the License. * * When distributing Covered Code, include this CDDL HEADER in each * file and include the License file at usr/src/OPENSOLARIS.LICENSE. * If applicable, add the following below this CDDL HEADER, with the * fields enclosed by brackets "[]" replaced with your own identifying * information: Portions Copyright [yyyy] [name of copyright owner] * * CDDL HEADER END */ /* * Copyright 2004 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _SYS_SDT_H #define _SYS_SDT_H /* * This is a wrapper header that wraps the mach visible sdt.h header so that * the header file ends up visible where software expects it to be. We also * do the C/C++ symbol wrapping here, since Mach headers are technically C * interfaces. * * Note: The process of adding USDT probes to code is slightly different * than documented in the "Solaris Dynamic Tracing Guide". * The DTRACE_PROBE*() macros are not supported on Mac OS X -- instead see * "BUILDING CODE CONTAINING USDT PROBES" in the dtrace(1) manpage * */ #include __BEGIN_DECLS #include __END_DECLS #endif /* _SYS_SDT_H */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/select.h ================================================ /* * 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@ */ /* * Copyright (c) 1992, 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. * * @(#)select.h 8.2 (Berkeley) 1/4/94 */ #ifndef _SYS_SELECT_H_ #define _SYS_SELECT_H_ #include #include #include /* * [XSI] The header shall define the fd_set type as a structure. * The timespec structure shall be defined as described in * The header shall define the timeval structure. */ #include #include #include /* * The time_t and suseconds_t types shall be defined as described in * * The sigset_t type shall be defined as described in */ #include #include #include /* * [XSI] FD_CLR, FD_ISSET, FD_SET, FD_ZERO may be declared as a function, or * defined as a macro, or both * [XSI] FD_SETSIZE shall be defined as a macro */ /* * Select uses bit masks of file descriptors in longs. These macros * manipulate such bit fields (the filesystem macros use chars). The * extra protection here is to permit application redefinition above * the default size. */ #include #include #include #include #include #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #include #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ __BEGIN_DECLS #ifndef __MWERKS__ int pselect(int, fd_set * __restrict, fd_set * __restrict, fd_set * __restrict, const struct timespec * __restrict, const sigset_t * __restrict) #if defined(_DARWIN_C_SOURCE) || defined(_DARWIN_UNLIMITED_SELECT) __DARWIN_EXTSN_C(pselect) #else /* !_DARWIN_C_SOURCE && !_DARWIN_UNLIMITED_SELECT */ # if defined(__LP64__) && !__DARWIN_NON_CANCELABLE __DARWIN_1050(pselect) # else /* !__LP64__ || __DARWIN_NON_CANCELABLE */ __DARWIN_ALIAS_C(pselect) # endif /* __LP64__ && !__DARWIN_NON_CANCELABLE */ #endif /* _DARWIN_C_SOURCE || _DARWIN_UNLIMITED_SELECT */ ; #endif /* __MWERKS__ */ #include /* select() prototype */ __END_DECLS #endif /* !_SYS_SELECT_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/sem.h ================================================ /* * 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@ */ /* $NetBSD: sem.h,v 1.5 1994/06/29 06:45:15 cgd Exp $ */ /* * SVID compatible sem.h file * * Author: Daniel Boulet * John Bellardo modified the implementation for Darwin. 12/2000 */ #ifndef _SYS_SEM_H_ #define _SYS_SEM_H_ #include #include #include /* __int32_t */ /* * [XSI] All of the symbols from SHALL be defined * when this header is included */ #include /* * [XSI] The pid_t, time_t, key_t, and size_t types shall be defined as * described in . * * NOTE: The definition of the key_t type is implicit from the * inclusion of */ #include #include #include /* * Technically, we should force all code references to the new structure * definition, not in just the standards conformance case, and leave the * legacy interface there for binary compatibility only. Currently, we * are only forcing this for programs requesting standards conformance. */ #if __DARWIN_UNIX03 || defined(KERNEL) #pragma pack(4) /* * Structure used internally. * * This structure is exposed because standards dictate that it is used as * the semun union member 'buf' as the fourth argment to semctl() when the * third argument is IPC_STAT or IPC_SET. * * Note: only the fields sem_perm, sem_nsems, sem_otime, and sem_ctime * are meaningful in user space. */ #if (defined(_POSIX_C_SOURCE) && !defined(_DARWIN_C_SOURCE)) struct semid_ds #else #define semid_ds __semid_ds_new struct __semid_ds_new #endif { struct __ipc_perm_new sem_perm; /* [XSI] operation permission struct */ __int32_t sem_base; /* 32 bit base ptr for semaphore set */ unsigned short sem_nsems; /* [XSI] number of sems in set */ time_t sem_otime; /* [XSI] last operation time */ __int32_t sem_pad1; /* RESERVED: DO NOT USE! */ time_t sem_ctime; /* [XSI] last change time */ /* Times measured in secs since */ /* 00:00:00 GMT, Jan. 1, 1970 */ __int32_t sem_pad2; /* RESERVED: DO NOT USE! */ __int32_t sem_pad3[4]; /* RESERVED: DO NOT USE! */ }; #pragma pack() #else /* !__DARWIN_UNIX03 */ #define semid_ds __semid_ds_old #endif /* __DARWIN_UNIX03 */ #if !__DARWIN_UNIX03 struct __semid_ds_old { struct __ipc_perm_old sem_perm; /* [XSI] operation permission struct */ __int32_t sem_base; /* 32 bit base ptr for semaphore set */ unsigned short sem_nsems; /* [XSI] number of sems in set */ time_t sem_otime; /* [XSI] last operation time */ __int32_t sem_pad1; /* RESERVED: DO NOT USE! */ time_t sem_ctime; /* [XSI] last change time */ /* Times measured in secs since */ /* 00:00:00 GMT, Jan. 1, 1970 */ __int32_t sem_pad2; /* RESERVED: DO NOT USE! */ __int32_t sem_pad3[4]; /* RESERVED: DO NOT USE! */ }; #endif /* !__DARWIN_UNIX03 */ /* * Possible values for the third argument to semctl() */ #define GETNCNT 3 /* [XSI] Return the value of semncnt {READ} */ #define GETPID 4 /* [XSI] Return the value of sempid {READ} */ #define GETVAL 5 /* [XSI] Return the value of semval {READ} */ #define GETALL 6 /* [XSI] Return semvals into arg.array {READ} */ #define GETZCNT 7 /* [XSI] Return the value of semzcnt {READ} */ #define SETVAL 8 /* [XSI] Set the value of semval to arg.val {ALTER} */ #define SETALL 9 /* [XSI] Set semvals from arg.array {ALTER} */ /* A semaphore; this is an anonymous structure, not for external use */ struct sem { unsigned short semval; /* semaphore value */ pid_t sempid; /* pid of last operation */ unsigned short semncnt; /* # awaiting semval > cval */ unsigned short semzcnt; /* # awaiting semval == 0 */ }; /* * Structure of array element for second argument to semop() */ struct sembuf { unsigned short sem_num; /* [XSI] semaphore # */ short sem_op; /* [XSI] semaphore operation */ short sem_flg; /* [XSI] operation flags */ }; /* * Possible flag values for sem_flg */ #define SEM_UNDO 010000 /* [XSI] Set up adjust on exit entry */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) /* * Union used as the fourth argment to semctl() in all cases. Specific * member values are used for different values of the third parameter: * * Command Member * ------------------------------------------- ------ * GETALL, SETALL array * SETVAL val * IPC_STAT, IPC_SET buf * * The union definition is intended to be defined by the user application * in conforming applications; it is provided here for two reasons: * * 1) Historical source compatability for non-conforming applications * expecting this header to declare the union type on their behalf * * 2) Documentation; specifically, 64 bit applications that do not pass * this structure for 'val', or, alternately, a 64 bit type, will * not function correctly */ union semun { int val; /* value for SETVAL */ struct semid_ds *buf; /* buffer for IPC_STAT & IPC_SET */ unsigned short *array; /* array for GETALL & SETALL */ }; typedef union semun semun_t; /* * Permissions */ #define SEM_A 0200 /* alter permission */ #define SEM_R 0400 /* read permission */ #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ __BEGIN_DECLS #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) int semsys(int, ...); #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ int semctl(int, int, int, ...) __DARWIN_ALIAS(semctl); int semget(key_t, int, int); int semop(int, struct sembuf *, size_t); __END_DECLS #endif /* !_SEM_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/semaphore.h ================================================ /* * 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@ */ /* @(#)semaphore.h 1.0 2/29/00 */ /* * semaphore.h - POSIX semaphores * * HISTORY * 29-Feb-00 A.Ramesh at Apple * Created for Mac OS X */ #ifndef _SYS_SEMAPHORE_H_ #define _SYS_SEMAPHORE_H_ typedef int sem_t; /* this should go in limits.h> */ #define SEM_VALUE_MAX 32767 #define SEM_FAILED ((sem_t *)-1) #include __BEGIN_DECLS int sem_close(sem_t *); int sem_destroy(sem_t *) __deprecated; int sem_getvalue(sem_t * __restrict, int * __restrict) __deprecated; int sem_init(sem_t *, int, unsigned int) __deprecated; sem_t * sem_open(const char *, int, ...); int sem_post(sem_t *); int sem_trywait(sem_t *); int sem_unlink(const char *); int sem_wait(sem_t *) __DARWIN_ALIAS_C(sem_wait); __END_DECLS #endif /* _SYS_SEMAPHORE_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/shm.h ================================================ /* * 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@ */ /* $NetBSD: shm.h,v 1.15 1994/06/29 06:45:17 cgd Exp $ */ /* * Copyright (c) 1994 Adam Glass * 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 Adam Glass. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. */ /* * As defined+described in "X/Open System Interfaces and Headers" * Issue 4, p. XXX */ #ifndef _SYS_SHM_H_ #define _SYS_SHM_H_ #include #include /* * [XSI] All of the symbols from SHALL be defined * when this header is included */ #include /* * [XSI] The pid_t, time_t, key_t, and size_t types shall be defined as * described in . * * NOTE: The definition of the key_t type is implicit from the * inclusion of */ #include #include #include /* * [XSI] The unsigned integer type used for the number of current attaches * that MUST be able to store values at least as large as a type unsigned * short. */ typedef unsigned short shmatt_t; /* * Possible flag values which may be OR'ed into the third argument to * shmat() */ #define SHM_RDONLY 010000 /* [XSI] Attach read-only (else read-write) */ #define SHM_RND 020000 /* [XSI] Round attach address to SHMLBA */ /* * This value is symbolic, and generally not expected to be sed by user * programs directly, although such ise is permitted by the standard. Its * value in our implementation is equal to the number of bytes per page. * * NOTE: We DO NOT obtain this value from the appropriate system * headers at this time, to avoid the resulting namespace * pollution, which is why we discourages its use. */ #if __arm64__ #define SHMLBA (16*1024) /* [XSI] Segment low boundary address multiple*/ #else /* __arm64__ */ #define SHMLBA 4096 /* [XSI] Segment low boundary address multiple*/ #endif /* __arm64__ */ /* "official" access mode definitions; somewhat braindead since you have * to specify (SHM_* >> 3) for group and (SHM_* >> 6) for world permissions */ #define SHM_R (IPC_R) #define SHM_W (IPC_W) #pragma pack(4) /* * Technically, we should force all code references to the new structure * definition, not in just the standards conformance case, and leave the * legacy interface there for binary compatibility only. Currently, we * are only forcing this for programs requesting standards conformance. */ #if __DARWIN_UNIX03 || defined(KERNEL) /* * Structure used internally. * * This structure is exposed because standards dictate that it is used as * the third argment to shmctl(). * * NOTE: The field shm_internal is not meaningful in user space, * and must not be used there. */ #if (defined(_POSIX_C_SOURCE) && !defined(_DARWIN_C_SOURCE)) struct shmid_ds #else #define shmid_ds __shmid_ds_new struct __shmid_ds_new #endif { struct __ipc_perm_new shm_perm; /* [XSI] Operation permission value */ size_t shm_segsz; /* [XSI] Size of segment in bytes */ pid_t shm_lpid; /* [XSI] PID of last shared memory op */ pid_t shm_cpid; /* [XSI] PID of creator */ shmatt_t shm_nattch; /* [XSI] Number of current attaches */ time_t shm_atime; /* [XSI] Time of last shmat() */ time_t shm_dtime; /* [XSI] Time of last shmdt() */ time_t shm_ctime; /* [XSI] Time of last shmctl() change */ void *shm_internal; /* reserved for kernel use */ }; #else /* !__DARWIN_UNIX03 */ #define shmid_ds __shmid_ds_old #endif /* !__DARWIN_UNIX03 */ #if !__DARWIN_UNIX03 struct __shmid_ds_old { struct __ipc_perm_old shm_perm; /* [XSI] Operation permission value */ size_t shm_segsz; /* [XSI] Size of segment in bytes */ pid_t shm_lpid; /* [XSI] PID of last shared memory op */ pid_t shm_cpid; /* [XSI] PID of creator */ shmatt_t shm_nattch; /* [XSI] Number of current attaches */ time_t shm_atime; /* [XSI] Time of last shmat() */ time_t shm_dtime; /* [XSI] Time of last shmdt() */ time_t shm_ctime; /* [XSI] Time of last shmctl() change */ void *shm_internal; /* reserved for kernel use */ }; #endif /* !__DARWIN_UNIX03 */ #pragma pack() __BEGIN_DECLS #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) int shmsys(int, ...); #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ void *shmat(int, const void *, int); int shmctl(int, int, struct shmid_ds *) __DARWIN_ALIAS(shmctl); int shmdt(const void *); int shmget(key_t, size_t, int); __END_DECLS #endif /* !_SYS_SHM_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/signal.h ================================================ /* * 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@ */ /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */ /* * Copyright (c) 1982, 1986, 1989, 1991, 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. * * @(#)signal.h 8.2 (Berkeley) 1/21/94 */ #ifndef _SYS_SIGNAL_H_ #define _SYS_SIGNAL_H_ #include #include #include #define __DARWIN_NSIG 32 /* counting 0; could be 33 (mask is 1-32) */ #if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) #define NSIG __DARWIN_NSIG #endif #include /* sigcontext; codes for SIGILL, SIGFPE */ #define SIGHUP 1 /* hangup */ #define SIGINT 2 /* interrupt */ #define SIGQUIT 3 /* quit */ #define SIGILL 4 /* illegal instruction (not reset when caught) */ #define SIGTRAP 5 /* trace trap (not reset when caught) */ #define SIGABRT 6 /* abort() */ #if (defined(_POSIX_C_SOURCE) && !defined(_DARWIN_C_SOURCE)) #define SIGPOLL 7 /* pollable event ([XSR] generated, not supported) */ #else /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ #define SIGIOT SIGABRT /* compatibility */ #define SIGEMT 7 /* EMT instruction */ #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ #define SIGFPE 8 /* floating point exception */ #define SIGKILL 9 /* kill (cannot be caught or ignored) */ #define SIGBUS 10 /* bus error */ #define SIGSEGV 11 /* segmentation violation */ #define SIGSYS 12 /* bad argument to system call */ #define SIGPIPE 13 /* write on a pipe with no one to read it */ #define SIGALRM 14 /* alarm clock */ #define SIGTERM 15 /* software termination signal from kill */ #define SIGURG 16 /* urgent condition on IO channel */ #define SIGSTOP 17 /* sendable stop signal not from tty */ #define SIGTSTP 18 /* stop signal from tty */ #define SIGCONT 19 /* continue a stopped process */ #define SIGCHLD 20 /* to parent on child stop or exit */ #define SIGTTIN 21 /* to readers pgrp upon background tty read */ #define SIGTTOU 22 /* like TTIN for output if (tp->t_local<OSTOP) */ #if (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) #define SIGIO 23 /* input/output possible signal */ #endif #define SIGXCPU 24 /* exceeded CPU time limit */ #define SIGXFSZ 25 /* exceeded file size limit */ #define SIGVTALRM 26 /* virtual time alarm */ #define SIGPROF 27 /* profiling time alarm */ #if (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) #define SIGWINCH 28 /* window size changes */ #define SIGINFO 29 /* information request */ #endif #define SIGUSR1 30 /* user defined signal 1 */ #define SIGUSR2 31 /* user defined signal 2 */ #if defined(_ANSI_SOURCE) || __DARWIN_UNIX03 || defined(__cplusplus) /* * Language spec sez we must list exactly one parameter, even though we * actually supply three. Ugh! * SIG_HOLD is chosen to avoid KERN_SIG_* values in */ #define SIG_DFL (void (*)(int))0 #define SIG_IGN (void (*)(int))1 #define SIG_HOLD (void (*)(int))5 #define SIG_ERR ((void (*)(int))-1) #else /* DO NOT REMOVE THE COMMENTED OUT int: fixincludes needs to see them */ #define SIG_DFL (void (*)( /*int*/ ))0 #define SIG_IGN (void (*)( /*int*/ ))1 #define SIG_HOLD (void (*)( /*int*/ ))5 #define SIG_ERR ((void (*)( /*int*/ ))-1) #endif #ifndef _ANSI_SOURCE #include #include #include #include #include #include #include #include #include union sigval { /* Members as suggested by Annex C of POSIX 1003.1b. */ int sival_int; void *sival_ptr; }; #define SIGEV_NONE 0 /* No async notification */ #define SIGEV_SIGNAL 1 /* aio - completion notification */ #define SIGEV_THREAD 3 /* [NOTIMP] [RTS] call notification function */ struct sigevent { int sigev_notify; /* Notification type */ int sigev_signo; /* Signal number */ union sigval sigev_value; /* Signal value */ void (*sigev_notify_function)(union sigval); /* Notification function */ pthread_attr_t *sigev_notify_attributes; /* Notification attributes */ }; typedef struct __siginfo { int si_signo; /* signal number */ int si_errno; /* errno association */ int si_code; /* signal code */ pid_t si_pid; /* sending process */ uid_t si_uid; /* sender's ruid */ int si_status; /* exit value */ void *si_addr; /* faulting instruction */ union sigval si_value; /* signal value */ long si_band; /* band event for SIGPOLL */ unsigned long __pad[7]; /* Reserved for Future Use */ } siginfo_t; /* * When the signal is SIGILL or SIGFPE, si_addr contains the address of * the faulting instruction. * When the signal is SIGSEGV or SIGBUS, si_addr contains the address of * the faulting memory reference. Although for x86 there are cases of SIGSEGV * for which si_addr cannot be determined and is NULL. * If the signal is SIGCHLD, the si_pid field will contain the child process ID, * si_status contains the exit value or signal and * si_uid contains the real user ID of the process that sent the signal. */ /* Values for si_code */ /* Codes for SIGILL */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define ILL_NOOP 0 /* if only I knew... */ #endif #define ILL_ILLOPC 1 /* [XSI] illegal opcode */ #define ILL_ILLTRP 2 /* [XSI] illegal trap */ #define ILL_PRVOPC 3 /* [XSI] privileged opcode */ #define ILL_ILLOPN 4 /* [XSI] illegal operand -NOTIMP */ #define ILL_ILLADR 5 /* [XSI] illegal addressing mode -NOTIMP */ #define ILL_PRVREG 6 /* [XSI] privileged register -NOTIMP */ #define ILL_COPROC 7 /* [XSI] coprocessor error -NOTIMP */ #define ILL_BADSTK 8 /* [XSI] internal stack error -NOTIMP */ /* Codes for SIGFPE */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define FPE_NOOP 0 /* if only I knew... */ #endif #define FPE_FLTDIV 1 /* [XSI] floating point divide by zero */ #define FPE_FLTOVF 2 /* [XSI] floating point overflow */ #define FPE_FLTUND 3 /* [XSI] floating point underflow */ #define FPE_FLTRES 4 /* [XSI] floating point inexact result */ #define FPE_FLTINV 5 /* [XSI] invalid floating point operation */ #define FPE_FLTSUB 6 /* [XSI] subscript out of range -NOTIMP */ #define FPE_INTDIV 7 /* [XSI] integer divide by zero */ #define FPE_INTOVF 8 /* [XSI] integer overflow */ /* Codes for SIGSEGV */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define SEGV_NOOP 0 /* if only I knew... */ #endif #define SEGV_MAPERR 1 /* [XSI] address not mapped to object */ #define SEGV_ACCERR 2 /* [XSI] invalid permission for mapped object */ /* Codes for SIGBUS */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define BUS_NOOP 0 /* if only I knew... */ #endif #define BUS_ADRALN 1 /* [XSI] Invalid address alignment */ #define BUS_ADRERR 2 /* [XSI] Nonexistent physical address -NOTIMP */ #define BUS_OBJERR 3 /* [XSI] Object-specific HW error - NOTIMP */ /* Codes for SIGTRAP */ #define TRAP_BRKPT 1 /* [XSI] Process breakpoint -NOTIMP */ #define TRAP_TRACE 2 /* [XSI] Process trace trap -NOTIMP */ /* Codes for SIGCHLD */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define CLD_NOOP 0 /* if only I knew... */ #endif #define CLD_EXITED 1 /* [XSI] child has exited */ #define CLD_KILLED 2 /* [XSI] terminated abnormally, no core file */ #define CLD_DUMPED 3 /* [XSI] terminated abnormally, core file */ #define CLD_TRAPPED 4 /* [XSI] traced child has trapped */ #define CLD_STOPPED 5 /* [XSI] child has stopped */ #define CLD_CONTINUED 6 /* [XSI] stopped child has continued */ /* Codes for SIGPOLL */ #define POLL_IN 1 /* [XSR] Data input available */ #define POLL_OUT 2 /* [XSR] Output buffers available */ #define POLL_MSG 3 /* [XSR] Input message available */ #define POLL_ERR 4 /* [XSR] I/O error */ #define POLL_PRI 5 /* [XSR] High priority input available */ #define POLL_HUP 6 /* [XSR] Device disconnected */ /* union for signal handlers */ union __sigaction_u { void (*__sa_handler)(int); void (*__sa_sigaction)(int, struct __siginfo *, void *); }; /* Signal vector template for Kernel user boundary */ struct __sigaction { union __sigaction_u __sigaction_u; /* signal handler */ void (*sa_tramp)(void *, int, int, siginfo_t *, void *); sigset_t sa_mask; /* signal mask to apply */ int sa_flags; /* see signal options below */ }; /* * Signal vector "template" used in sigaction call. */ struct sigaction { union __sigaction_u __sigaction_u; /* signal handler */ sigset_t sa_mask; /* signal mask to apply */ int sa_flags; /* see signal options below */ }; /* if SA_SIGINFO is set, sa_sigaction is to be used instead of sa_handler. */ #define sa_handler __sigaction_u.__sa_handler #define sa_sigaction __sigaction_u.__sa_sigaction #define SA_ONSTACK 0x0001 /* take signal on signal stack */ #define SA_RESTART 0x0002 /* restart system on signal return */ #define SA_RESETHAND 0x0004 /* reset to SIG_DFL when taking signal */ #define SA_NOCLDSTOP 0x0008 /* do not generate SIGCHLD on child stop */ #define SA_NODEFER 0x0010 /* don't mask the signal we're delivering */ #define SA_NOCLDWAIT 0x0020 /* don't keep zombies around */ #define SA_SIGINFO 0x0040 /* signal handler with SA_SIGINFO args */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define SA_USERTRAMP 0x0100 /* do not bounce off kernel's sigtramp */ /* This will provide 64bit register set in a 32bit user address space */ #define SA_64REGSET 0x0200 /* signal handler with SA_SIGINFO args with 64bit regs information */ #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ /* the following are the only bits we support from user space, the * rest are for kernel use only. */ #define SA_USERSPACE_MASK (SA_ONSTACK | SA_RESTART | SA_RESETHAND | SA_NOCLDSTOP | SA_NODEFER | SA_NOCLDWAIT | SA_SIGINFO) /* * Flags for sigprocmask: */ #define SIG_BLOCK 1 /* block specified signal set */ #define SIG_UNBLOCK 2 /* unblock specified signal set */ #define SIG_SETMASK 3 /* set specified signal set */ /* POSIX 1003.1b required values. */ #define SI_USER 0x10001 /* [CX] signal from kill() */ #define SI_QUEUE 0x10002 /* [CX] signal from sigqueue() */ #define SI_TIMER 0x10003 /* [CX] timer expiration */ #define SI_ASYNCIO 0x10004 /* [CX] aio request completion */ #define SI_MESGQ 0x10005 /* [CX] from message arrival on empty queue */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) typedef void (*sig_t)(int); /* type of signal function */ #endif /* * Structure used in sigaltstack call. */ #define SS_ONSTACK 0x0001 /* take signal on signal stack */ #define SS_DISABLE 0x0004 /* disable taking signals on alternate stack */ #define MINSIGSTKSZ 32768 /* (32K)minimum allowable stack */ #define SIGSTKSZ 131072 /* (128K)recommended stack size */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) /* * 4.3 compatibility: * Signal vector "template" used in sigvec call. */ struct sigvec { void (*sv_handler)(int); /* signal handler */ int sv_mask; /* signal mask to apply */ int sv_flags; /* see signal options below */ }; #define SV_ONSTACK SA_ONSTACK #define SV_INTERRUPT SA_RESTART /* same bit, opposite sense */ #define SV_RESETHAND SA_RESETHAND #define SV_NODEFER SA_NODEFER #define SV_NOCLDSTOP SA_NOCLDSTOP #define SV_SIGINFO SA_SIGINFO #define sv_onstack sv_flags /* isn't compatibility wonderful! */ #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ /* * Structure used in sigstack call. */ struct sigstack { char *ss_sp; /* signal stack pointer */ int ss_onstack; /* current status */ }; #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) /* * Macro for converting signal number to a mask suitable for * sigblock(). */ #define sigmask(m) (1 << ((m)-1)) #define BADSIG SIG_ERR #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ #endif /* !_ANSI_SOURCE */ /* * For historical reasons; programs expect signal's return value to be * defined by . */ __BEGIN_DECLS void(*signal(int, void (*)(int)))(int); __END_DECLS #endif /* !_SYS_SIGNAL_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/signalvar.h ================================================ /* * 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@ */ /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */ /* * Copyright (c) 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. * * @(#)signalvar.h 8.3 (Berkeley) 1/4/94 */ #ifndef _SYS_SIGNALVAR_H_ /* tmp for user.h */ #define _SYS_SIGNALVAR_H_ #include #endif /* !_SYS_SIGNALVAR_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/snapshot.h ================================================ /* * Copyright (c) 2016 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 _SYS_SNAPSHOT_H_ #define _SYS_SNAPSHOT_H_ #include #include #include #include <_types/_uint32_t.h> #include #include __BEGIN_DECLS int fs_snapshot_create(int, const char *, uint32_t) __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0); int fs_snapshot_list(int, struct attrlist *, void *, size_t, uint32_t) __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0); int fs_snapshot_delete(int, const char *, uint32_t) __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0); int fs_snapshot_rename(int, const char *, const char *, uint32_t) __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0); int fs_snapshot_mount(int, const char *, const char *, uint32_t) __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0); int fs_snapshot_revert(int, const char *, uint32_t) __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0); __END_DECLS #endif /* !_SYS_SNAPSHOT_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/socket.h ================================================ /* * 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@ */ /* Copyright (c) 1998, 1999 Apple Computer, Inc. All Rights Reserved */ /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */ /* * Copyright (c) 1982, 1985, 1986, 1988, 1993, 1994 * 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. * * @(#)socket.h 8.4 (Berkeley) 2/21/94 * $FreeBSD: src/sys/sys/socket.h,v 1.39.2.7 2001/07/03 11:02:01 ume Exp $ */ /* * 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. */ #ifndef _SYS_SOCKET_H_ #define _SYS_SOCKET_H_ #include #include #include #include #include /* * Definitions related to sockets: types, address families, options. */ /* * Data types. */ #include #include #include #include #include /* XXX Not explicitly defined by POSIX, but function return types are */ #include /* XXX Not explicitly defined by POSIX, but function return types are */ #include /* * [XSI] The iovec structure shall be defined as described in . */ #include /* * Types */ #define SOCK_STREAM 1 /* stream socket */ #define SOCK_DGRAM 2 /* datagram socket */ #define SOCK_RAW 3 /* raw-protocol interface */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define SOCK_RDM 4 /* reliably-delivered message */ #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ #define SOCK_SEQPACKET 5 /* sequenced packet stream */ /* * Option flags per-socket. */ #define SO_DEBUG 0x0001 /* turn on debugging info recording */ #define SO_ACCEPTCONN 0x0002 /* socket has had listen() */ #define SO_REUSEADDR 0x0004 /* allow local address reuse */ #define SO_KEEPALIVE 0x0008 /* keep connections alive */ #define SO_DONTROUTE 0x0010 /* just use interface addresses */ #define SO_BROADCAST 0x0020 /* permit sending of broadcast msgs */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define SO_USELOOPBACK 0x0040 /* bypass hardware when possible */ #define SO_LINGER 0x0080 /* linger on close if data present (in ticks) */ #else #define SO_LINGER 0x1080 /* linger on close if data present (in seconds) */ #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ #define SO_OOBINLINE 0x0100 /* leave received OOB data in line */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define SO_REUSEPORT 0x0200 /* allow local address & port reuse */ #define SO_TIMESTAMP 0x0400 /* timestamp received dgram traffic */ #define SO_TIMESTAMP_MONOTONIC 0x0800 /* Monotonically increasing timestamp on rcvd dgram */ #ifndef __APPLE__ #define SO_ACCEPTFILTER 0x1000 /* there is an accept filter */ #else #define SO_DONTTRUNC 0x2000 /* APPLE: Retain unread data */ /* (ATOMIC proto) */ #define SO_WANTMORE 0x4000 /* APPLE: Give hint when more data ready */ #define SO_WANTOOBFLAG 0x8000 /* APPLE: Want OOB in MSG_FLAG on receive */ #endif /* (!__APPLE__) */ #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ /* * Additional options, not kept in so_options. */ #define SO_SNDBUF 0x1001 /* send buffer size */ #define SO_RCVBUF 0x1002 /* receive buffer size */ #define SO_SNDLOWAT 0x1003 /* send low-water mark */ #define SO_RCVLOWAT 0x1004 /* receive low-water mark */ #define SO_SNDTIMEO 0x1005 /* send timeout */ #define SO_RCVTIMEO 0x1006 /* receive timeout */ #define SO_ERROR 0x1007 /* get error status and clear */ #define SO_TYPE 0x1008 /* get socket type */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define SO_LABEL 0x1010 /* deprecated */ #define SO_PEERLABEL 0x1011 /* deprecated */ #ifdef __APPLE__ #define SO_NREAD 0x1020 /* APPLE: get 1st-packet byte count */ #define SO_NKE 0x1021 /* APPLE: Install socket-level NKE */ #define SO_NOSIGPIPE 0x1022 /* APPLE: No SIGPIPE on EPIPE */ #define SO_NOADDRERR 0x1023 /* APPLE: Returns EADDRNOTAVAIL when src is not available anymore */ #define SO_NWRITE 0x1024 /* APPLE: Get number of bytes currently in send socket buffer */ #define SO_REUSESHAREUID 0x1025 /* APPLE: Allow reuse of port/socket by different userids */ #ifdef __APPLE_API_PRIVATE #define SO_NOTIFYCONFLICT 0x1026 /* APPLE: send notification if there is a bind on a port which is already in use */ #define SO_UPCALLCLOSEWAIT 0x1027 /* APPLE: block on close until an upcall returns */ #endif #define SO_LINGER_SEC 0x1080 /* linger on close if data present (in seconds) */ #define SO_RANDOMPORT 0x1082 /* APPLE: request local port randomization */ #define SO_NP_EXTENSIONS 0x1083 /* To turn off some POSIX behavior */ #endif #define SO_NUMRCVPKT 0x1112 /* number of datagrams in receive socket buffer */ #define SO_NET_SERVICE_TYPE 0x1116 /* Network service type */ #define SO_NETSVC_MARKING_LEVEL 0x1119 /* Get QoS marking in effect for socket */ /* When adding new socket-options, you need to make sure MPTCP supports these as well! */ /* * Network Service Type for option SO_NET_SERVICE_TYPE * * The vast majority of sockets should use Best Effort that is the default * Network Service Type. Other Network Service Types have to be used only if * the traffic actually matches the description of the Network Service Type. * * Network Service Types do not represent priorities but rather describe * different categories of delay, jitter and loss parameters. * Those parameters may influence protocols from layer 4 protocols like TCP * to layer 2 protocols like Wi-Fi. The Network Service Type can determine * how the traffic is queued and scheduled by the host networking stack and * by other entities on the network like switches and routers. For example * for Wi-Fi, the Network Service Type can select the marking of the * layer 2 packet with the appropriate WMM Access Category. * * There is no point in attempting to game the system and use * a Network Service Type that does not correspond to the actual * traffic characteristic but one that seems to have a higher precedence. * The reason is that for service classes that have lower tolerance * for delay and jitter, the queues size is lower than for service * classes that are more tolerant to delay and jitter. * * For example using a voice service type for bulk data transfer will lead * to disastrous results as soon as congestion happens because the voice * queue overflows and packets get dropped. This is not only bad for the bulk * data transfer but it is also bad for VoIP apps that legitimately are using * the voice service type. * * The characteristics of the Network Service Types are based on the service * classes defined in RFC 4594 "Configuration Guidelines for DiffServ Service * Classes" * * When system detects the outgoing interface belongs to a DiffServ domain * that follows the recommendation of the IETF draft "Guidelines for DiffServ to * IEEE 802.11 Mapping", the packet will marked at layer 3 with a DSCP value * that corresponds to Network Service Type. * * NET_SERVICE_TYPE_BE * "Best Effort", unclassified/standard. This is the default service * class and cover the majority of the traffic. * * NET_SERVICE_TYPE_BK * "Background", high delay tolerant, loss tolerant. elastic flow, * variable size & long-lived. E.g: non-interactive network bulk transfer * like synching or backup. * * NET_SERVICE_TYPE_RD * "Responsive Data", a notch higher than "Best Effort", medium delay * tolerant, elastic & inelastic flow, bursty, long-lived. E.g. email, * instant messaging, for which there is a sense of interactivity and * urgency (user waiting for output). * * NET_SERVICE_TYPE_OAM * "Operations, Administration, and Management", medium delay tolerant, * low-medium loss tolerant, elastic & inelastic flows, variable size. * E.g. VPN tunnels. * * NET_SERVICE_TYPE_AV * "Multimedia Audio/Video Streaming", medium delay tolerant, low-medium * loss tolerant, elastic flow, constant packet interval, variable rate * and size. E.g. video and audio playback with buffering. * * NET_SERVICE_TYPE_RV * "Responsive Multimedia Audio/Video", low delay tolerant, low-medium * loss tolerant, elastic flow, variable packet interval, rate and size. * E.g. screen sharing. * * NET_SERVICE_TYPE_VI * "Interactive Video", low delay tolerant, low-medium loss tolerant, * elastic flow, constant packet interval, variable rate & size. E.g. * video telephony. * * NET_SERVICE_TYPE_SIG * "Signaling", low delay tolerant, low loss tolerant, inelastic flow, * jitter tolerant, rate is bursty but short, variable size. E.g. SIP. * * NET_SERVICE_TYPE_VO * "Interactive Voice", very low delay tolerant, very low loss tolerant, * inelastic flow, constant packet rate, somewhat fixed size. * E.g. VoIP. */ #define NET_SERVICE_TYPE_BE 0 /* Best effort */ #define NET_SERVICE_TYPE_BK 1 /* Background system initiated */ #define NET_SERVICE_TYPE_SIG 2 /* Signaling */ #define NET_SERVICE_TYPE_VI 3 /* Interactive Video */ #define NET_SERVICE_TYPE_VO 4 /* Interactive Voice */ #define NET_SERVICE_TYPE_RV 5 /* Responsive Multimedia Audio/Video */ #define NET_SERVICE_TYPE_AV 6 /* Multimedia Audio/Video Streaming */ #define NET_SERVICE_TYPE_OAM 7 /* Operations, Administration, and Management */ #define NET_SERVICE_TYPE_RD 8 /* Responsive Data */ /* These are supported values for SO_NETSVC_MARKING_LEVEL */ #define NETSVC_MRKNG_UNKNOWN 0 /* The outgoing network interface is not known */ #define NETSVC_MRKNG_LVL_L2 1 /* Default marking at layer 2 (for example Wi-Fi WMM) */ #define NETSVC_MRKNG_LVL_L3L2_ALL 2 /* Layer 3 DSCP marking and layer 2 marking for all Network Service Types */ #define NETSVC_MRKNG_LVL_L3L2_BK 3 /* The system policy limits layer 3 DSCP marking and layer 2 marking * to background Network Service Types */ typedef __uint32_t sae_associd_t; #define SAE_ASSOCID_ANY 0 #define SAE_ASSOCID_ALL ((sae_associd_t)(-1ULL)) typedef __uint32_t sae_connid_t; #define SAE_CONNID_ANY 0 #define SAE_CONNID_ALL ((sae_connid_t)(-1ULL)) /* connectx() flag parameters */ #define CONNECT_RESUME_ON_READ_WRITE 0x1 /* resume connect() on read/write */ #define CONNECT_DATA_IDEMPOTENT 0x2 /* data is idempotent */ #define CONNECT_DATA_AUTHENTICATED 0x4 /* data includes security that replaces the TFO-cookie */ /* sockaddr endpoints */ typedef struct sa_endpoints { unsigned int sae_srcif; /* optional source interface */ const struct sockaddr *sae_srcaddr; /* optional source address */ socklen_t sae_srcaddrlen; /* size of source address */ const struct sockaddr *sae_dstaddr; /* destination address */ socklen_t sae_dstaddrlen; /* size of destination address */ } sa_endpoints_t; #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ /* * Structure used for manipulating linger option. */ struct linger { int l_onoff; /* option on/off */ int l_linger; /* linger time */ }; #ifndef __APPLE__ struct accept_filter_arg { char af_name[16]; char af_arg[256 - 16]; }; #endif #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #ifdef __APPLE__ /* * Structure to control non-portable Sockets extension to POSIX */ struct so_np_extensions { u_int32_t npx_flags; u_int32_t npx_mask; }; #define SONPX_SETOPTSHUT 0x000000001 /* flag for allowing setsockopt after shutdown */ #endif #endif /* * Level number for (get/set)sockopt() to apply to socket itself. */ #define SOL_SOCKET 0xffff /* options for socket level */ /* * Address families. */ #define AF_UNSPEC 0 /* unspecified */ #define AF_UNIX 1 /* local to host (pipes) */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define AF_LOCAL AF_UNIX /* backward compatibility */ #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ #define AF_INET 2 /* internetwork: UDP, TCP, etc. */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define AF_IMPLINK 3 /* arpanet imp addresses */ #define AF_PUP 4 /* pup protocols: e.g. BSP */ #define AF_CHAOS 5 /* mit CHAOS protocols */ #define AF_NS 6 /* XEROX NS protocols */ #define AF_ISO 7 /* ISO protocols */ #define AF_OSI AF_ISO #define AF_ECMA 8 /* European computer manufacturers */ #define AF_DATAKIT 9 /* datakit protocols */ #define AF_CCITT 10 /* CCITT protocols, X.25 etc */ #define AF_SNA 11 /* IBM SNA */ #define AF_DECnet 12 /* DECnet */ #define AF_DLI 13 /* DEC Direct data link interface */ #define AF_LAT 14 /* LAT */ #define AF_HYLINK 15 /* NSC Hyperchannel */ #define AF_APPLETALK 16 /* Apple Talk */ #define AF_ROUTE 17 /* Internal Routing Protocol */ #define AF_LINK 18 /* Link layer interface */ #define pseudo_AF_XTP 19 /* eXpress Transfer Protocol (no AF) */ #define AF_COIP 20 /* connection-oriented IP, aka ST II */ #define AF_CNT 21 /* Computer Network Technology */ #define pseudo_AF_RTIP 22 /* Help Identify RTIP packets */ #define AF_IPX 23 /* Novell Internet Protocol */ #define AF_SIP 24 /* Simple Internet Protocol */ #define pseudo_AF_PIP 25 /* Help Identify PIP packets */ #define AF_NDRV 27 /* Network Driver 'raw' access */ #define AF_ISDN 28 /* Integrated Services Digital Network */ #define AF_E164 AF_ISDN /* CCITT E.164 recommendation */ #define pseudo_AF_KEY 29 /* Internal key-management function */ #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ #define AF_INET6 30 /* IPv6 */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define AF_NATM 31 /* native ATM access */ #define AF_SYSTEM 32 /* Kernel event messages */ #define AF_NETBIOS 33 /* NetBIOS */ #define AF_PPP 34 /* PPP communication protocol */ #define pseudo_AF_HDRCMPLT 35 /* Used by BPF to not rewrite headers * in interface output routine */ #define AF_RESERVED_36 36 /* Reserved for internal usage */ #define AF_IEEE80211 37 /* IEEE 802.11 protocol */ #define AF_UTUN 38 #define AF_VSOCK 40 /* VM Sockets */ #define AF_MAX 41 #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ /* * [XSI] Structure used by kernel to store most addresses. */ struct sockaddr { __uint8_t sa_len; /* total length */ sa_family_t sa_family; /* [XSI] address family */ char sa_data[14]; /* [XSI] addr value (actually larger) */ }; #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define SOCK_MAXADDRLEN 255 /* longest possible addresses */ /* * Structure used by kernel to pass protocol * information in raw sockets. */ struct sockproto { __uint16_t sp_family; /* address family */ __uint16_t sp_protocol; /* protocol */ }; #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ /* * RFC 2553: protocol-independent placeholder for socket addresses */ #define _SS_MAXSIZE 128 #define _SS_ALIGNSIZE (sizeof(__int64_t)) #define _SS_PAD1SIZE \ (_SS_ALIGNSIZE - sizeof(__uint8_t) - sizeof(sa_family_t)) #define _SS_PAD2SIZE \ (_SS_MAXSIZE - sizeof(__uint8_t) - sizeof(sa_family_t) - \ _SS_PAD1SIZE - _SS_ALIGNSIZE) /* * [XSI] sockaddr_storage */ struct sockaddr_storage { __uint8_t ss_len; /* address length */ sa_family_t ss_family; /* [XSI] address family */ char __ss_pad1[_SS_PAD1SIZE]; __int64_t __ss_align; /* force structure storage alignment */ char __ss_pad2[_SS_PAD2SIZE]; }; /* * Protocol families, same as address families for now. */ #define PF_UNSPEC AF_UNSPEC #define PF_LOCAL AF_LOCAL #define PF_UNIX PF_LOCAL /* backward compatibility */ #define PF_INET AF_INET #define PF_IMPLINK AF_IMPLINK #define PF_PUP AF_PUP #define PF_CHAOS AF_CHAOS #define PF_NS AF_NS #define PF_ISO AF_ISO #define PF_OSI AF_ISO #define PF_ECMA AF_ECMA #define PF_DATAKIT AF_DATAKIT #define PF_CCITT AF_CCITT #define PF_SNA AF_SNA #define PF_DECnet AF_DECnet #define PF_DLI AF_DLI #define PF_LAT AF_LAT #define PF_HYLINK AF_HYLINK #define PF_APPLETALK AF_APPLETALK #define PF_ROUTE AF_ROUTE #define PF_LINK AF_LINK #define PF_XTP pseudo_AF_XTP /* really just proto family, no AF */ #define PF_COIP AF_COIP #define PF_CNT AF_CNT #define PF_SIP AF_SIP #define PF_IPX AF_IPX /* same format as AF_NS */ #define PF_RTIP pseudo_AF_RTIP /* same format as AF_INET */ #define PF_PIP pseudo_AF_PIP #define PF_NDRV AF_NDRV #define PF_ISDN AF_ISDN #define PF_KEY pseudo_AF_KEY #define PF_INET6 AF_INET6 #define PF_NATM AF_NATM #define PF_SYSTEM AF_SYSTEM #define PF_NETBIOS AF_NETBIOS #define PF_PPP AF_PPP #define PF_RESERVED_36 AF_RESERVED_36 #define PF_UTUN AF_UTUN #define PF_VSOCK AF_VSOCK #define PF_MAX AF_MAX /* * These do not have socket-layer support: */ #define PF_VLAN ((uint32_t)0x766c616e) /* 'vlan' */ #define PF_BOND ((uint32_t)0x626f6e64) /* 'bond' */ /* * Definitions for network related sysctl, CTL_NET. * * Second level is protocol family. * Third level is protocol number. * * Further levels are defined by the individual families below. */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define NET_MAXID AF_MAX #endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) /* * PF_ROUTE - Routing table * * Three additional levels are defined: * Fourth: address family, 0 is wildcard * Fifth: type of info, defined below * Sixth: flag(s) to mask with for NET_RT_FLAGS */ #define NET_RT_DUMP 1 /* dump; may limit to a.f. */ #define NET_RT_FLAGS 2 /* by flags, e.g. RESOLVING */ #define NET_RT_IFLIST 3 /* survey interface list */ #define NET_RT_STAT 4 /* routing statistics */ #define NET_RT_TRASH 5 /* routes not in table but not freed */ #define NET_RT_IFLIST2 6 /* interface list with addresses */ #define NET_RT_DUMP2 7 /* dump; may limit to a.f. */ /* * Allows read access non-local host's MAC address * if the process has neighbor cache entitlement. */ #define NET_RT_FLAGS_PRIV 10 #define NET_RT_MAXID 11 #endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */ /* * Maximum queue length specifiable by listen. */ #define SOMAXCONN 128 /* * [XSI] Message header for recvmsg and sendmsg calls. * Used value-result for recvmsg, value only for sendmsg. */ struct msghdr { void *msg_name; /* [XSI] optional address */ socklen_t msg_namelen; /* [XSI] size of address */ struct iovec *msg_iov; /* [XSI] scatter/gather array */ int msg_iovlen; /* [XSI] # elements in msg_iov */ void *msg_control; /* [XSI] ancillary data, see below */ socklen_t msg_controllen; /* [XSI] ancillary data buffer len */ int msg_flags; /* [XSI] flags on received message */ }; #define MSG_OOB 0x1 /* process out-of-band data */ #define MSG_PEEK 0x2 /* peek at incoming message */ #define MSG_DONTROUTE 0x4 /* send without using routing tables */ #define MSG_EOR 0x8 /* data completes record */ #define MSG_TRUNC 0x10 /* data discarded before delivery */ #define MSG_CTRUNC 0x20 /* control data lost before delivery */ #define MSG_WAITALL 0x40 /* wait for full request or error */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define MSG_DONTWAIT 0x80 /* this message should be nonblocking */ #define MSG_EOF 0x100 /* data completes connection */ #ifdef __APPLE__ #ifdef __APPLE_API_OBSOLETE #define MSG_WAITSTREAM 0x200 /* wait up to full request.. may return partial */ #endif #define MSG_FLUSH 0x400 /* Start of 'hold' seq; dump so_temp, deprecated */ #define MSG_HOLD 0x800 /* Hold frag in so_temp, deprecated */ #define MSG_SEND 0x1000 /* Send the packet in so_temp, deprecated */ #define MSG_HAVEMORE 0x2000 /* Data ready to be read */ #define MSG_RCVMORE 0x4000 /* Data remains in current pkt */ #endif #define MSG_NEEDSA 0x10000 /* Fail receive if socket address cannot be allocated */ #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ #if __DARWIN_C_LEVEL >= 200809L #define MSG_NOSIGNAL 0x80000 /* do not generate SIGPIPE on EOF */ #endif /* __DARWIN_C_LEVEL */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ /* * Header for ancillary data objects in msg_control buffer. * Used for additional information with/about a datagram * not expressible by flags. The format is a sequence * of message elements headed by cmsghdr structures. */ struct cmsghdr { socklen_t cmsg_len; /* [XSI] data byte count, including hdr */ int cmsg_level; /* [XSI] originating protocol */ int cmsg_type; /* [XSI] protocol-specific type */ /* followed by unsigned char cmsg_data[]; */ }; #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #ifndef __APPLE__ /* * While we may have more groups than this, the cmsgcred struct must * be able to fit in an mbuf, and NGROUPS_MAX is too large to allow * this. */ #define CMGROUP_MAX 16 /* * Credentials structure, used to verify the identity of a peer * process that has sent us a message. This is allocated by the * peer process but filled in by the kernel. This prevents the * peer from lying about its identity. (Note that cmcred_groups[0] * is the effective GID.) */ struct cmsgcred { pid_t cmcred_pid; /* PID of sending process */ uid_t cmcred_uid; /* real UID of sending process */ uid_t cmcred_euid; /* effective UID of sending process */ gid_t cmcred_gid; /* real GID of sending process */ short cmcred_ngroups; /* number or groups */ gid_t cmcred_groups[CMGROUP_MAX]; /* groups */ }; #endif #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ /* given pointer to struct cmsghdr, return pointer to data */ #define CMSG_DATA(cmsg) ((unsigned char *)(cmsg) + \ __DARWIN_ALIGN32(sizeof(struct cmsghdr))) /* * RFC 2292 requires to check msg_controllen, in case that the kernel returns * an empty list for some reasons. */ #define CMSG_FIRSTHDR(mhdr) \ ((mhdr)->msg_controllen >= sizeof(struct cmsghdr) ? \ (struct cmsghdr *)(mhdr)->msg_control : \ (struct cmsghdr *)0L) /* * Given pointer to struct cmsghdr, return pointer to next cmsghdr * RFC 2292 says that CMSG_NXTHDR(mhdr, NULL) is equivalent to CMSG_FIRSTHDR(mhdr) */ #define CMSG_NXTHDR(mhdr, cmsg) \ ((char *)(cmsg) == (char *)0L ? CMSG_FIRSTHDR(mhdr) : \ ((((unsigned char *)(cmsg) + \ __DARWIN_ALIGN32((__uint32_t)(cmsg)->cmsg_len) + \ __DARWIN_ALIGN32(sizeof(struct cmsghdr))) > \ ((unsigned char *)(mhdr)->msg_control + \ (mhdr)->msg_controllen)) ? \ (struct cmsghdr *)0L /* NULL */ : \ (struct cmsghdr *)(void *)((unsigned char *)(cmsg) + \ __DARWIN_ALIGN32((__uint32_t)(cmsg)->cmsg_len)))) #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) /* RFC 2292 additions */ #define CMSG_SPACE(l) (__DARWIN_ALIGN32(sizeof(struct cmsghdr)) + __DARWIN_ALIGN32(l)) #define CMSG_LEN(l) (__DARWIN_ALIGN32(sizeof(struct cmsghdr)) + (l)) #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ /* "Socket"-level control message types: */ #define SCM_RIGHTS 0x01 /* access rights (array of int) */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define SCM_TIMESTAMP 0x02 /* timestamp (struct timeval) */ #define SCM_CREDS 0x03 /* process creds (struct cmsgcred) */ #define SCM_TIMESTAMP_MONOTONIC 0x04 /* timestamp (uint64_t) */ #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ /* * howto arguments for shutdown(2), specified by Posix.1g. */ #define SHUT_RD 0 /* shut down the reading side */ #define SHUT_WR 1 /* shut down the writing side */ #define SHUT_RDWR 2 /* shut down both sides */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) /* * sendfile(2) header/trailer struct */ struct sf_hdtr { struct iovec *headers; /* pointer to an array of header struct iovec's */ int hdr_cnt; /* number of header iovec's */ struct iovec *trailers; /* pointer to an array of trailer struct iovec's */ int trl_cnt; /* number of trailer iovec's */ }; #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ __BEGIN_DECLS int accept(int, struct sockaddr * __restrict, socklen_t * __restrict) __DARWIN_ALIAS_C(accept); int bind(int, const struct sockaddr *, socklen_t) __DARWIN_ALIAS(bind); int connect(int, const struct sockaddr *, socklen_t) __DARWIN_ALIAS_C(connect); int getpeername(int, struct sockaddr * __restrict, socklen_t * __restrict) __DARWIN_ALIAS(getpeername); int getsockname(int, struct sockaddr * __restrict, socklen_t * __restrict) __DARWIN_ALIAS(getsockname); int getsockopt(int, int, int, void * __restrict, socklen_t * __restrict); int listen(int, int) __DARWIN_ALIAS(listen); ssize_t recv(int, void *, size_t, int) __DARWIN_ALIAS_C(recv); ssize_t recvfrom(int, void *, size_t, int, struct sockaddr * __restrict, socklen_t * __restrict) __DARWIN_ALIAS_C(recvfrom); ssize_t recvmsg(int, struct msghdr *, int) __DARWIN_ALIAS_C(recvmsg); ssize_t send(int, const void *, size_t, int) __DARWIN_ALIAS_C(send); ssize_t sendmsg(int, const struct msghdr *, int) __DARWIN_ALIAS_C(sendmsg); ssize_t sendto(int, const void *, size_t, int, const struct sockaddr *, socklen_t) __DARWIN_ALIAS_C(sendto); int setsockopt(int, int, int, const void *, socklen_t); int shutdown(int, int); int sockatmark(int) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0); int socket(int, int, int); int socketpair(int, int, int, int *) __DARWIN_ALIAS(socketpair); #if !defined(_POSIX_C_SOURCE) int sendfile(int, int, off_t, off_t *, struct sf_hdtr *, int); #endif /* !_POSIX_C_SOURCE */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) void pfctlinput(int, struct sockaddr *); __API_AVAILABLE(macosx(10.11), ios(9.0), tvos(9.0), watchos(2.0)) int connectx(int, const sa_endpoints_t *, sae_associd_t, unsigned int, const struct iovec *, unsigned int, size_t *, sae_connid_t *); __API_AVAILABLE(macosx(10.11), ios(9.0), tvos(9.0), watchos(2.0)) int disconnectx(int, sae_associd_t, sae_connid_t); #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ __END_DECLS #endif /* !_SYS_SOCKET_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/socketvar.h ================================================ /* * 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@ */ /* Copyright (c) 1998, 1999 Apple Computer, Inc. All Rights Reserved */ /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */ /* * Copyright (c) 1982, 1986, 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. * * @(#)socketvar.h 8.3 (Berkeley) 2/19/95 * $FreeBSD: src/sys/sys/socketvar.h,v 1.46.2.6 2001/08/31 13:45:49 jlemon Exp $ */ /* * 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. */ #ifndef _SYS_SOCKETVAR_H_ #define _SYS_SOCKETVAR_H_ #include #include #include /* u_quad_t */ #include #include typedef u_quad_t so_gen_t; #if defined(__LP64__) #define _XSOCKET_PTR(x) u_int32_t #else #define _XSOCKET_PTR(x) x #endif #pragma pack(4) struct xsockbuf { u_int32_t sb_cc; u_int32_t sb_hiwat; u_int32_t sb_mbcnt; u_int32_t sb_mbmax; int32_t sb_lowat; short sb_flags; short sb_timeo; }; /* * Externalized form of struct socket used by the sysctl(3) interface. */ struct xsocket { u_int32_t xso_len; /* length of this structure */ _XSOCKET_PTR(struct socket *) xso_so; /* makes a convenient handle */ short so_type; short so_options; short so_linger; short so_state; _XSOCKET_PTR(caddr_t) so_pcb; /* another convenient handle */ int xso_protocol; int xso_family; short so_qlen; short so_incqlen; short so_qlimit; short so_timeo; u_short so_error; pid_t so_pgid; u_int32_t so_oobmark; struct xsockbuf so_rcv; struct xsockbuf so_snd; uid_t so_uid; /* XXX */ }; #if XNU_TARGET_OS_OSX || KERNEL || !(TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR) struct xsocket64 { u_int32_t xso_len; /* length of this structure */ u_int64_t xso_so; /* makes a convenient handle */ short so_type; short so_options; short so_linger; short so_state; u_int64_t so_pcb; /* another convenient handle */ int xso_protocol; int xso_family; short so_qlen; short so_incqlen; short so_qlimit; short so_timeo; u_short so_error; pid_t so_pgid; u_int32_t so_oobmark; struct xsockbuf so_rcv; struct xsockbuf so_snd; uid_t so_uid; /* XXX */ }; #endif /* XNU_TARGET_OS_OSX || KERNEL || !(TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR) */ #pragma pack() // Tracker actions enum so_tracker_action { SO_TRACKER_ACTION_INVALID = 0, SO_TRACKER_ACTION_ADD = 1, SO_TRACKER_ACTION_DUMP_BY_APP = 2, SO_TRACKER_ACTION_DUMP_ALL = 3, SO_TRACKER_ACTION_DUMP_MAX, }; // Tracker TLV attributes enum so_tracker_attribute { SO_TRACKER_ATTRIBUTE_INVALID = 0, SO_TRACKER_ATTRIBUTE_ADDRESS_FAMILY = 1, SO_TRACKER_ATTRIBUTE_ADDRESS = 2, SO_TRACKER_ATTRIBUTE_APP_UUID = 3, SO_TRACKER_ATTRIBUTE_DOMAIN = 4, SO_TRACKER_ATTRIBUTE_DOMAIN_OWNER = 5, SO_TRACKER_ATTRIBUTE_FLAGS = 6, SO_TRACKER_ATTRIBUTE_DUMP_ENTRY = 7, SO_TRACKER_ATTRIBUTE_MEMORY_USED = 8, SO_TRACKER_ATTRIBUTE_MAX, }; // Tracker flags #define SO_TRACKER_ATTRIBUTE_FLAGS_APP_APPROVED 0x00000001 #define SO_TRACKER_ATTRIBUTE_FLAGS_TRACKER 0x00000002 #define SO_TRACKER_ATTRIBUTE_FLAGS_DOMAIN_SHORT 0x00000004 #define SO_TRACKER_TRANSPARENCY_VERSION 3 extern int tracker_action(int action, char *buffer, size_t buffer_size); #endif /* !_SYS_SOCKETVAR_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/sockio.h ================================================ /* * Copyright (c) 2000-2021 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 (c) 1995 NeXT Computer, Inc. All Rights Reserved */ /*- * Copyright (c) 1982, 1986, 1990, 1993, 1994 * 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. * * @(#)sockio.h 8.1 (Berkeley) 3/28/94 */ #ifndef _SYS_SOCKIO_H_ #define _SYS_SOCKIO_H_ #include #include /* Socket ioctl's. */ #define SIOCSHIWAT _IOW('s', 0, int) /* set high watermark */ #define SIOCGHIWAT _IOR('s', 1, int) /* get high watermark */ #define SIOCSLOWAT _IOW('s', 2, int) /* set low watermark */ #define SIOCGLOWAT _IOR('s', 3, int) /* get low watermark */ #define SIOCATMARK _IOR('s', 7, int) /* at oob mark? */ #define SIOCSPGRP _IOW('s', 8, int) /* set process group */ #define SIOCGPGRP _IOR('s', 9, int) /* get process group */ /* * OSIOCGIF* ioctls are deprecated; they are kept for binary compatibility. */ #define SIOCSIFADDR _IOW('i', 12, struct ifreq) /* set ifnet address */ #define SIOCSIFDSTADDR _IOW('i', 14, struct ifreq) /* set p-p address */ #define SIOCSIFFLAGS _IOW('i', 16, struct ifreq) /* set ifnet flags */ #define SIOCGIFFLAGS _IOWR('i', 17, struct ifreq) /* get ifnet flags */ #define SIOCSIFBRDADDR _IOW('i', 19, struct ifreq) /* set broadcast addr */ #define SIOCSIFNETMASK _IOW('i', 22, struct ifreq) /* set net addr mask */ #define SIOCGIFMETRIC _IOWR('i', 23, struct ifreq) /* get IF metric */ #define SIOCSIFMETRIC _IOW('i', 24, struct ifreq) /* set IF metric */ #define SIOCDIFADDR _IOW('i', 25, struct ifreq) /* delete IF addr */ #define SIOCAIFADDR _IOW('i', 26, struct ifaliasreq)/* add/chg IF alias */ #define SIOCGIFADDR _IOWR('i', 33, struct ifreq) /* get ifnet address */ #define SIOCGIFDSTADDR _IOWR('i', 34, struct ifreq) /* get p-p address */ #define SIOCGIFBRDADDR _IOWR('i', 35, struct ifreq) /* get broadcast addr */ #define SIOCGIFCONF _IOWR('i', 36, struct ifconf) /* get ifnet list */ #define SIOCGIFNETMASK _IOWR('i', 37, struct ifreq) /* get net addr mask */ #define SIOCAUTOADDR _IOWR('i', 38, struct ifreq) /* autoconf address */ #define SIOCAUTONETMASK _IOW('i', 39, struct ifreq) /* autoconf netmask */ #define SIOCARPIPLL _IOWR('i', 40, struct ifreq) /* arp for IPv4LL address */ #define SIOCADDMULTI _IOW('i', 49, struct ifreq) /* add m'cast addr */ #define SIOCDELMULTI _IOW('i', 50, struct ifreq) /* del m'cast addr */ #define SIOCGIFMTU _IOWR('i', 51, struct ifreq) /* get IF mtu */ #define SIOCSIFMTU _IOW('i', 52, struct ifreq) /* set IF mtu */ #define SIOCGIFPHYS _IOWR('i', 53, struct ifreq) /* get IF wire */ #define SIOCSIFPHYS _IOW('i', 54, struct ifreq) /* set IF wire */ #define SIOCSIFMEDIA _IOWR('i', 55, struct ifreq) /* set net media */ /* * The command SIOCGIFMEDIA does not allow a process to access the extended * media subtype and extended subtype values are returned as IFM_OTHER. */ #define SIOCGIFMEDIA _IOWR('i', 56, struct ifmediareq) /* get compatible net media */ #define SIOCSIFGENERIC _IOW('i', 57, struct ifreq) /* generic IF set op */ #define SIOCGIFGENERIC _IOWR('i', 58, struct ifreq) /* generic IF get op */ #define SIOCRSLVMULTI _IOWR('i', 59, struct rslvmulti_req) #define SIOCSIFLLADDR _IOW('i', 60, struct ifreq) /* set link level addr */ #define SIOCGIFSTATUS _IOWR('i', 61, struct ifstat) /* get IF status */ #define SIOCSIFPHYADDR _IOW('i', 62, struct ifaliasreq) /* set gif addres */ #define SIOCGIFPSRCADDR _IOWR('i', 63, struct ifreq) /* get gif psrc addr */ #define SIOCGIFPDSTADDR _IOWR('i', 64, struct ifreq) /* get gif pdst addr */ #define SIOCDIFPHYADDR _IOW('i', 65, struct ifreq) /* delete gif addrs */ #define SIOCGIFDEVMTU _IOWR('i', 68, struct ifreq) /* get if ifdevmtu */ #define SIOCSIFALTMTU _IOW('i', 69, struct ifreq) /* set if alternate mtu */ #define SIOCGIFALTMTU _IOWR('i', 72, struct ifreq) /* get if alternate mtu */ #define SIOCSIFBOND _IOW('i', 70, struct ifreq) /* set bond if config */ #define SIOCGIFBOND _IOWR('i', 71, struct ifreq) /* get bond if config */ /* * The command SIOCGIFXMEDIA is meant to be used by processes only to be able * to access the extended media subtypes with the extended IFM_TMASK. * * An ifnet must not implement SIOCGIFXMEDIA as it gets the extended * media subtypes by simply compiling with */ #define SIOCGIFXMEDIA _IOWR('i', 72, struct ifmediareq) /* get net extended media */ #define SIOCSIFCAP _IOW('i', 90, struct ifreq) /* set IF features */ #define SIOCGIFCAP _IOWR('i', 91, struct ifreq) /* get IF features */ #define SIOCIFCREATE _IOWR('i', 120, struct ifreq) /* create clone if */ #define SIOCIFDESTROY _IOW('i', 121, struct ifreq) /* destroy clone if */ #define SIOCIFCREATE2 _IOWR('i', 122, struct ifreq) /* create clone if with data */ #define SIOCSDRVSPEC _IOW('i', 123, struct ifdrv) /* set driver-specific * parameters */ #define SIOCGDRVSPEC _IOWR('i', 123, struct ifdrv) /* get driver-specific * parameters */ #define SIOCSIFVLAN _IOW('i', 126, struct ifreq) /* set VLAN config */ #define SIOCGIFVLAN _IOWR('i', 127, struct ifreq) /* get VLAN config */ #define SIOCSETVLAN SIOCSIFVLAN #define SIOCGETVLAN SIOCGIFVLAN #define SIOCIFGCLONERS _IOWR('i', 129, struct if_clonereq) /* get cloners */ #define SIOCGIFASYNCMAP _IOWR('i', 124, struct ifreq) /* get ppp asyncmap */ #define SIOCSIFASYNCMAP _IOW('i', 125, struct ifreq) /* set ppp asyncmap */ #define SIOCGIFMAC _IOWR('i', 130, struct ifreq) /* deprecated */ #define SIOCSIFMAC _IOW('i', 131, struct ifreq) /* deprecated */ #define SIOCSIFKPI _IOW('i', 134, struct ifreq) /* set interface kext param - root only */ #define SIOCGIFKPI _IOWR('i', 135, struct ifreq) /* get interface kext param */ #define SIOCGIFWAKEFLAGS _IOWR('i', 136, struct ifreq) /* get interface wake property flags */ #define SIOCGIFFUNCTIONALTYPE _IOWR('i', 173, struct ifreq) /* get interface functional type */ #define SIOCSIF6LOWPAN _IOW('i', 196, struct ifreq) /* set 6LOWPAN config */ #define SIOCGIF6LOWPAN _IOWR('i', 197, struct ifreq) /* get 6LOWPAN config */ #endif /* !_SYS_SOCKIO_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/spawn.h ================================================ /* * Copyright (c) 2006-2020 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@ */ /* * [SPN] Support for _POSIX_SPAWN * * This header contains information that is shared between the user space * and kernel versions of the posix_spawn() code. Shared elements are all * manifest constants, at the current time. */ #ifndef _SYS_SPAWN_H_ #define _SYS_SPAWN_H_ /* * Possible bit values which may be OR'ed together and provided as the second * parameter to posix_spawnattr_setflags() or implicit returned in the value of * the second parameter to posix_spawnattr_getflags(). */ #define POSIX_SPAWN_RESETIDS 0x0001 /* [SPN] R[UG]ID not E[UG]ID */ #define POSIX_SPAWN_SETPGROUP 0x0002 /* [SPN] set non-parent PGID */ #define POSIX_SPAWN_SETSIGDEF 0x0004 /* [SPN] reset sigset default */ #define POSIX_SPAWN_SETSIGMASK 0x0008 /* [SPN] set signal mask */ #if 0 /* _POSIX_PRIORITY_SCHEDULING [PS] : not supported */ #define POSIX_SPAWN_SETSCHEDPARAM 0x0010 #define POSIX_SPAWN_SETSCHEDULER 0x0020 #endif /* 0 */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) /* * Darwin-specific flags */ #define POSIX_SPAWN_SETEXEC 0x0040 #define POSIX_SPAWN_START_SUSPENDED 0x0080 #define POSIX_SPAWN_SETSID 0x0400 #define POSIX_SPAWN_CLOEXEC_DEFAULT 0x4000 #define _POSIX_SPAWN_RESLIDE 0x0800 /* * Possible values to be set for the process control actions on resource starvation. * POSIX_SPAWN_PCONTROL_THROTTLE indicates that the process is to be throttled on starvation. * POSIX_SPAWN_PCONTROL_SUSPEND indicates that the process is to be suspended on starvation. * POSIX_SPAWN_PCONTROL_KILL indicates that the process is to be terminated on starvation. */ #define POSIX_SPAWN_PCONTROL_NONE 0x0000 #define POSIX_SPAWN_PCONTROL_THROTTLE 0x0001 #define POSIX_SPAWN_PCONTROL_SUSPEND 0x0002 #define POSIX_SPAWN_PCONTROL_KILL 0x0003 #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ #endif /* _SYS_SPAWN_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/stat.h ================================================ /* * Copyright (c) 2000-2014 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 (c) 1995 NeXT Computer, Inc. All Rights Reserved */ /*- * Copyright (c) 1982, 1986, 1989, 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. * * @(#)stat.h 8.9 (Berkeley) 8/17/94 */ #ifndef _SYS_STAT_H_ #define _SYS_STAT_H_ #include #include #include /* [XSI] The timespec structure may be defined as described in */ #include /* * [XSI] The blkcnt_t, blksize_t, dev_t, ino_t, mode_t, nlink_t, uid_t, * gid_t, off_t, and time_t types shall be defined as described in * . */ #include #include #include /* device number */ #include #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #include #endif /* !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) */ #include #include #include #include #include #include #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) /* * XXX So deprecated, it would make your head spin * * The old stat structure. In fact, this is not used by the kernel at all, * and should not be used by user space, and should be removed from this * header file entirely (along with the unused cvtstat() prototype in * vnode_internal.h). */ struct ostat { __uint16_t st_dev; /* inode's device */ ino_t st_ino; /* inode's number */ mode_t st_mode; /* inode protection mode */ nlink_t st_nlink; /* number of hard links */ __uint16_t st_uid; /* user ID of the file's owner */ __uint16_t st_gid; /* group ID of the file's group */ __uint16_t st_rdev; /* device type */ __int32_t st_size; /* file size, in bytes */ struct timespec st_atimespec; /* time of last access */ struct timespec st_mtimespec; /* time of last data modification */ struct timespec st_ctimespec; /* time of last file status change */ __int32_t st_blksize; /* optimal blocksize for I/O */ __int32_t st_blocks; /* blocks allocated for file */ __uint32_t st_flags; /* user defined flags for file */ __uint32_t st_gen; /* file generation number */ }; #define __DARWIN_STRUCT_STAT64_TIMES \ struct timespec st_atimespec; /* time of last access */ \ struct timespec st_mtimespec; /* time of last data modification */ \ struct timespec st_ctimespec; /* time of last status change */ \ struct timespec st_birthtimespec; /* time of file creation(birth) */ #else /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */ #define __DARWIN_STRUCT_STAT64_TIMES \ time_t st_atime; /* [XSI] Time of last access */ \ long st_atimensec; /* nsec of last access */ \ time_t st_mtime; /* [XSI] Last data modification time */ \ long st_mtimensec; /* last data modification nsec */ \ time_t st_ctime; /* [XSI] Time of last status change */ \ long st_ctimensec; /* nsec of last status change */ \ time_t st_birthtime; /* File creation time(birth) */ \ long st_birthtimensec; /* nsec of File creation time */ #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ /* * This structure is used as the second parameter to the fstat64(), * lstat64(), and stat64() functions, and for struct stat when * __DARWIN_64_BIT_INO_T is set. __DARWIN_STRUCT_STAT64 is defined * above, depending on whether we use struct timespec or the direct * components. * * This is simillar to stat except for 64bit inode number * number instead of 32bit ino_t and the addition of create(birth) time. */ #define __DARWIN_STRUCT_STAT64 { \ dev_t st_dev; /* [XSI] ID of device containing file */ \ mode_t st_mode; /* [XSI] Mode of file (see below) */ \ nlink_t st_nlink; /* [XSI] Number of hard links */ \ __darwin_ino64_t st_ino; /* [XSI] File serial number */ \ uid_t st_uid; /* [XSI] User ID of the file */ \ gid_t st_gid; /* [XSI] Group ID of the file */ \ dev_t st_rdev; /* [XSI] Device ID */ \ __DARWIN_STRUCT_STAT64_TIMES \ off_t st_size; /* [XSI] file size, in bytes */ \ blkcnt_t st_blocks; /* [XSI] blocks allocated for file */ \ blksize_t st_blksize; /* [XSI] optimal blocksize for I/O */ \ __uint32_t st_flags; /* user defined flags for file */ \ __uint32_t st_gen; /* file generation number */ \ __int32_t st_lspare; /* RESERVED: DO NOT USE! */ \ __int64_t st_qspare[2]; /* RESERVED: DO NOT USE! */ \ } /* * [XSI] This structure is used as the second parameter to the fstat(), * lstat(), and stat() functions. */ #if __DARWIN_64_BIT_INO_T struct stat __DARWIN_STRUCT_STAT64; #else /* !__DARWIN_64_BIT_INO_T */ struct stat { dev_t st_dev; /* [XSI] ID of device containing file */ ino_t st_ino; /* [XSI] File serial number */ mode_t st_mode; /* [XSI] Mode of file (see below) */ nlink_t st_nlink; /* [XSI] Number of hard links */ uid_t st_uid; /* [XSI] User ID of the file */ gid_t st_gid; /* [XSI] Group ID of the file */ dev_t st_rdev; /* [XSI] Device ID */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) struct timespec st_atimespec; /* time of last access */ struct timespec st_mtimespec; /* time of last data modification */ struct timespec st_ctimespec; /* time of last status change */ #else time_t st_atime; /* [XSI] Time of last access */ long st_atimensec; /* nsec of last access */ time_t st_mtime; /* [XSI] Last data modification time */ long st_mtimensec; /* last data modification nsec */ time_t st_ctime; /* [XSI] Time of last status change */ long st_ctimensec; /* nsec of last status change */ #endif off_t st_size; /* [XSI] file size, in bytes */ blkcnt_t st_blocks; /* [XSI] blocks allocated for file */ blksize_t st_blksize; /* [XSI] optimal blocksize for I/O */ __uint32_t st_flags; /* user defined flags for file */ __uint32_t st_gen; /* file generation number */ __int32_t st_lspare; /* RESERVED: DO NOT USE! */ __int64_t st_qspare[2]; /* RESERVED: DO NOT USE! */ }; #endif /* __DARWIN_64_BIT_INO_T */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #if !__DARWIN_ONLY_64_BIT_INO_T struct stat64 __DARWIN_STRUCT_STAT64; #endif /* !__DARWIN_ONLY_64_BIT_INO_T */ #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define st_atime st_atimespec.tv_sec #define st_mtime st_mtimespec.tv_sec #define st_ctime st_ctimespec.tv_sec #define st_birthtime st_birthtimespec.tv_sec #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ /* * [XSI] The following are symbolic names for the values of type mode_t. They * are bitmap values. */ #include /* * [XSI] The following macros shall be provided to test whether a file is * of the specified type. The value m supplied to the macros is the value * of st_mode from a stat structure. The macro shall evaluate to a non-zero * value if the test is true; 0 if the test is false. */ #define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) /* block special */ #define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) /* char special */ #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) /* directory */ #define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) /* fifo or socket */ #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) /* regular file */ #define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) /* symbolic link */ #define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) /* socket */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define S_ISWHT(m) (((m) & S_IFMT) == S_IFWHT) /* OBSOLETE: whiteout */ #endif /* * [XSI] The implementation may implement message queues, semaphores, or * shared memory objects as distinct file types. The following macros * shall be provided to test whether a file is of the specified type. * The value of the buf argument supplied to the macros is a pointer to * a stat structure. The macro shall evaluate to a non-zero value if * the specified object is implemented as a distinct file type and the * specified file type is contained in the stat structure referenced by * buf. Otherwise, the macro shall evaluate to zero. * * NOTE: The current implementation does not do this, although * this may change in future revisions, and co currently only * provides these macros to ensure source compatability with * implementations which do. */ #define S_TYPEISMQ(buf) (0) /* Test for a message queue */ #define S_TYPEISSEM(buf) (0) /* Test for a semaphore */ #define S_TYPEISSHM(buf) (0) /* Test for a shared memory object */ /* * [TYM] The implementation may implement typed memory objects as distinct * file types, and the following macro shall test whether a file is of the * specified type. The value of the buf argument supplied to the macros is * a pointer to a stat structure. The macro shall evaluate to a non-zero * value if the specified object is implemented as a distinct file type and * the specified file type is contained in the stat structure referenced by * buf. Otherwise, the macro shall evaluate to zero. * * NOTE: The current implementation does not do this, although * this may change in future revisions, and co currently only * provides this macro to ensure source compatability with * implementations which do. */ #define S_TYPEISTMO(buf) (0) /* Test for a typed memory object */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO) /* 0777 */ /* 7777 */ #define ALLPERMS (S_ISUID|S_ISGID|S_ISTXT|S_IRWXU|S_IRWXG|S_IRWXO) /* 0666 */ #define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH) #define S_BLKSIZE 512 /* block size used in the stat struct */ /* * Definitions of flags stored in file flags word. * * Super-user and owner changeable flags. */ #define UF_SETTABLE 0x0000ffff /* mask of owner changeable flags */ #define UF_NODUMP 0x00000001 /* do not dump file */ #define UF_IMMUTABLE 0x00000002 /* file may not be changed */ #define UF_APPEND 0x00000004 /* writes to file may only append */ #define UF_OPAQUE 0x00000008 /* directory is opaque wrt. union */ /* * The following bit is reserved for FreeBSD. It is not implemented * in Mac OS X. */ /* #define UF_NOUNLINK 0x00000010 */ /* file may not be removed or renamed */ #define UF_COMPRESSED 0x00000020 /* file is compressed (some file-systems) */ /* UF_TRACKED is used for dealing with document IDs. We no longer issue * notifications for deletes or renames for files which have UF_TRACKED set. */ #define UF_TRACKED 0x00000040 #define UF_DATAVAULT 0x00000080 /* entitlement required for reading */ /* and writing */ /* Bits 0x0100 through 0x4000 are currently undefined. */ #define UF_HIDDEN 0x00008000 /* hint that this item should not be */ /* displayed in a GUI */ /* * Super-user changeable flags. */ #define SF_SUPPORTED 0x009f0000 /* mask of superuser supported flags */ #define SF_SETTABLE 0x3fff0000 /* mask of superuser changeable flags */ #define SF_SYNTHETIC 0xc0000000 /* mask of system read-only synthetic flags */ #define SF_ARCHIVED 0x00010000 /* file is archived */ #define SF_IMMUTABLE 0x00020000 /* file may not be changed */ #define SF_APPEND 0x00040000 /* writes to file may only append */ #define SF_RESTRICTED 0x00080000 /* entitlement required for writing */ #define SF_NOUNLINK 0x00100000 /* Item may not be removed, renamed or mounted on */ /* * The following two bits are reserved for FreeBSD. They are not * implemented in Mac OS X. */ /* #define SF_SNAPSHOT 0x00200000 */ /* snapshot inode */ /* NOTE: There is no SF_HIDDEN bit. */ #define SF_FIRMLINK 0x00800000 /* file is a firmlink */ /* * Synthetic flags. * * These are read-only. We keep them out of SF_SUPPORTED so that * attempts to set them will fail. */ #define SF_DATALESS 0x40000000 /* file is dataless object */ #endif #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL /* * Extended flags ("EF") returned by ATTR_CMNEXT_EXT_FLAGS from getattrlist/getattrlistbulk */ #define EF_MAY_SHARE_BLOCKS 0x00000001 /* file may share blocks with another file */ #define EF_NO_XATTRS 0x00000002 /* file has no xattrs at all */ #define EF_IS_SYNC_ROOT 0x00000004 /* file is a sync root for iCloud */ #define EF_IS_PURGEABLE 0x00000008 /* file is purgeable */ #define EF_IS_SPARSE 0x00000010 /* file has at least one sparse region */ #define EF_IS_SYNTHETIC 0x00000020 /* a synthetic directory/symlink */ #endif __BEGIN_DECLS /* [XSI] */ int chmod(const char *, mode_t) __DARWIN_ALIAS(chmod); int fchmod(int, mode_t) __DARWIN_ALIAS(fchmod); int fstat(int, struct stat *) __DARWIN_INODE64(fstat); int lstat(const char *, struct stat *) __DARWIN_INODE64(lstat); int mkdir(const char *, mode_t); int mkfifo(const char *, mode_t); int stat(const char *, struct stat *) __DARWIN_INODE64(stat); int mknod(const char *, mode_t, dev_t); mode_t umask(mode_t); #if __DARWIN_C_LEVEL >= 200809L int fchmodat(int, const char *, mode_t, int) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0); int fstatat(int, const char *, struct stat *, int) __DARWIN_INODE64(fstatat) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0); int mkdirat(int, const char *, mode_t) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0); #define UTIME_NOW -1 #define UTIME_OMIT -2 int futimens(int __fd, const struct timespec __times[2]) __API_AVAILABLE(macosx(10.13), ios(11.0), tvos(11.0), watchos(4.0)); int utimensat(int __fd, const char *__path, const struct timespec __times[2], int __flag) __API_AVAILABLE(macosx(10.13), ios(11.0), tvos(11.0), watchos(4.0)); #endif #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #include int chflags(const char *, __uint32_t); int chmodx_np(const char *, filesec_t); int fchflags(int, __uint32_t); int fchmodx_np(int, filesec_t); int fstatx_np(int, struct stat *, filesec_t) __DARWIN_INODE64(fstatx_np); int lchflags(const char *, __uint32_t) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0); int lchmod(const char *, mode_t) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0); int lstatx_np(const char *, struct stat *, filesec_t) __DARWIN_INODE64(lstatx_np); int mkdirx_np(const char *, filesec_t); int mkfifox_np(const char *, filesec_t); int statx_np(const char *, struct stat *, filesec_t) __DARWIN_INODE64(statx_np); int umaskx_np(filesec_t) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_6, __IPHONE_NA, __IPHONE_NA); #if !__DARWIN_ONLY_64_BIT_INO_T /* The following deprecated routines are simillar to stat and friends except provide struct stat64 instead of struct stat */ int fstatx64_np(int, struct stat64 *, filesec_t) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_6, __IPHONE_NA, __IPHONE_NA); int lstatx64_np(const char *, struct stat64 *, filesec_t) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_6, __IPHONE_NA, __IPHONE_NA); int statx64_np(const char *, struct stat64 *, filesec_t) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_6, __IPHONE_NA, __IPHONE_NA); int fstat64(int, struct stat64 *) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_6, __IPHONE_NA, __IPHONE_NA); int lstat64(const char *, struct stat64 *) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_6, __IPHONE_NA, __IPHONE_NA); int stat64(const char *, struct stat64 *) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_6, __IPHONE_NA, __IPHONE_NA); #endif /* !__DARWIN_ONLY_64_BIT_INO_T */ #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ __END_DECLS #endif /* !_SYS_STAT_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/statvfs.h ================================================ /* * Copyright (c) 2000 Apple Computer, 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@ */ /* * sys/statvfs.h */ #ifndef _SYS_STATVFS_H_ #define _SYS_STATVFS_H_ #include #include #include #include /* Following structure is used as a statvfs/fstatvfs function parameter */ struct statvfs { unsigned long f_bsize; /* File system block size */ unsigned long f_frsize; /* Fundamental file system block size */ fsblkcnt_t f_blocks; /* Blocks on FS in units of f_frsize */ fsblkcnt_t f_bfree; /* Free blocks */ fsblkcnt_t f_bavail; /* Blocks available to non-root */ fsfilcnt_t f_files; /* Total inodes */ fsfilcnt_t f_ffree; /* Free inodes */ fsfilcnt_t f_favail; /* Free inodes for non-root */ unsigned long f_fsid; /* Filesystem ID */ unsigned long f_flag; /* Bit mask of values */ unsigned long f_namemax; /* Max file name length */ }; /* Defined bits for f_flag field value */ #define ST_RDONLY 0x00000001 /* Read-only file system */ #define ST_NOSUID 0x00000002 /* Does not honor setuid/setgid */ __BEGIN_DECLS int fstatvfs(int, struct statvfs *); int statvfs(const char * __restrict, struct statvfs * __restrict); __END_DECLS #endif /* _SYS_STATVFS_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/stdio.h ================================================ /* * Copyright (c) 2013 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 _SYS_STDIO_H_ #define _SYS_STDIO_H_ #include #if __DARWIN_C_LEVEL >= 200809L #include __BEGIN_DECLS int renameat(int, const char *, int, const char *) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0); #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL #define RENAME_SECLUDE 0x00000001 #define RENAME_SWAP 0x00000002 #define RENAME_EXCL 0x00000004 int renamex_np(const char *, const char *, unsigned int) __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0); int renameatx_np(int, const char *, int, const char *, unsigned int) __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0); #endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */ __END_DECLS #endif /* __DARWIN_C_LEVEL >= 200809L */ #endif /* _SYS_STDIO_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/sys_domain.h ================================================ /* * Copyright (c) 2000-2005, 2012, 2014 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 _SYSTEM_DOMAIN_H_ #define _SYSTEM_DOMAIN_H_ #include #include #include /* Kernel Events Protocol */ #define SYSPROTO_EVENT 1 /* kernel events protocol */ /* Kernel Control Protocol */ #define SYSPROTO_CONTROL 2 /* kernel control protocol */ #define AF_SYS_CONTROL 2 /* corresponding sub address type */ /* System family socket address */ struct sockaddr_sys { u_char ss_len; /* sizeof(struct sockaddr_sys) */ u_char ss_family; /* AF_SYSTEM */ u_int16_t ss_sysaddr; /* protocol address in AF_SYSTEM */ u_int32_t ss_reserved[7]; /* reserved to the protocol use */ }; #endif /* _SYSTEM_DOMAIN_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/syscall.h ================================================ /* * Copyright (c) 2004-2008 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@ * * * System call switch table. * * DO NOT EDIT-- this file is automatically generated. * created from /bsd.syscalls.master */ #ifndef _SYS_SYSCALL_H_ #define _SYS_SYSCALL_H_ #include #ifdef __APPLE_API_PRIVATE #define SYS_syscall 0 #define SYS_exit 1 #define SYS_fork 2 #define SYS_read 3 #define SYS_write 4 #define SYS_open 5 #define SYS_close 6 #define SYS_wait4 7 /* 8 old creat */ #define SYS_link 9 #define SYS_unlink 10 /* 11 old execv */ #define SYS_chdir 12 #define SYS_fchdir 13 #define SYS_mknod 14 #define SYS_chmod 15 #define SYS_chown 16 /* 17 old break */ #define SYS_getfsstat 18 /* 19 old lseek */ #define SYS_getpid 20 /* 21 old mount */ /* 22 old umount */ #define SYS_setuid 23 #define SYS_getuid 24 #define SYS_geteuid 25 #define SYS_ptrace 26 #define SYS_recvmsg 27 #define SYS_sendmsg 28 #define SYS_recvfrom 29 #define SYS_accept 30 #define SYS_getpeername 31 #define SYS_getsockname 32 #define SYS_access 33 #define SYS_chflags 34 #define SYS_fchflags 35 #define SYS_sync 36 #define SYS_kill 37 /* 38 old stat */ #define SYS_getppid 39 /* 40 old lstat */ #define SYS_dup 41 #define SYS_pipe 42 #define SYS_getegid 43 /* 44 old profil */ /* 45 old ktrace */ #define SYS_sigaction 46 #define SYS_getgid 47 #define SYS_sigprocmask 48 #define SYS_getlogin 49 #define SYS_setlogin 50 #define SYS_acct 51 #define SYS_sigpending 52 #define SYS_sigaltstack 53 #define SYS_ioctl 54 #define SYS_reboot 55 #define SYS_revoke 56 #define SYS_symlink 57 #define SYS_readlink 58 #define SYS_execve 59 #define SYS_umask 60 #define SYS_chroot 61 /* 62 old fstat */ /* 63 used internally and reserved */ /* 64 old getpagesize */ #define SYS_msync 65 #define SYS_vfork 66 /* 67 old vread */ /* 68 old vwrite */ /* 69 old sbrk */ /* 70 old sstk */ /* 71 old mmap */ /* 72 old vadvise */ #define SYS_munmap 73 #define SYS_mprotect 74 #define SYS_madvise 75 /* 76 old vhangup */ /* 77 old vlimit */ #define SYS_mincore 78 #define SYS_getgroups 79 #define SYS_setgroups 80 #define SYS_getpgrp 81 #define SYS_setpgid 82 #define SYS_setitimer 83 /* 84 old wait */ #define SYS_swapon 85 #define SYS_getitimer 86 /* 87 old gethostname */ /* 88 old sethostname */ #define SYS_getdtablesize 89 #define SYS_dup2 90 /* 91 old getdopt */ #define SYS_fcntl 92 #define SYS_select 93 /* 94 old setdopt */ #define SYS_fsync 95 #define SYS_setpriority 96 #define SYS_socket 97 #define SYS_connect 98 /* 99 old accept */ #define SYS_getpriority 100 /* 101 old send */ /* 102 old recv */ /* 103 old sigreturn */ #define SYS_bind 104 #define SYS_setsockopt 105 #define SYS_listen 106 /* 107 old vtimes */ /* 108 old sigvec */ /* 109 old sigblock */ /* 110 old sigsetmask */ #define SYS_sigsuspend 111 /* 112 old sigstack */ /* 113 old recvmsg */ /* 114 old sendmsg */ /* 115 old vtrace */ #define SYS_gettimeofday 116 #define SYS_getrusage 117 #define SYS_getsockopt 118 /* 119 old resuba */ #define SYS_readv 120 #define SYS_writev 121 #define SYS_settimeofday 122 #define SYS_fchown 123 #define SYS_fchmod 124 /* 125 old recvfrom */ #define SYS_setreuid 126 #define SYS_setregid 127 #define SYS_rename 128 /* 129 old truncate */ /* 130 old ftruncate */ #define SYS_flock 131 #define SYS_mkfifo 132 #define SYS_sendto 133 #define SYS_shutdown 134 #define SYS_socketpair 135 #define SYS_mkdir 136 #define SYS_rmdir 137 #define SYS_utimes 138 #define SYS_futimes 139 #define SYS_adjtime 140 /* 141 old getpeername */ #define SYS_gethostuuid 142 /* 143 old sethostid */ /* 144 old getrlimit */ /* 145 old setrlimit */ /* 146 old killpg */ #define SYS_setsid 147 /* 148 old setquota */ /* 149 old qquota */ /* 150 old getsockname */ #define SYS_getpgid 151 #define SYS_setprivexec 152 #define SYS_pread 153 #define SYS_pwrite 154 #define SYS_nfssvc 155 /* 156 old getdirentries */ #define SYS_statfs 157 #define SYS_fstatfs 158 #define SYS_unmount 159 /* 160 old async_daemon */ #define SYS_getfh 161 /* 162 old getdomainname */ /* 163 old setdomainname */ /* 164 */ #define SYS_quotactl 165 /* 166 old exportfs */ #define SYS_mount 167 /* 168 old ustat */ #define SYS_csops 169 #define SYS_csops_audittoken 170 /* 171 old wait3 */ /* 172 old rpause */ #define SYS_waitid 173 /* 174 old getdents */ /* 175 old gc_control */ /* 176 old add_profil */ #define SYS_kdebug_typefilter 177 #define SYS_kdebug_trace_string 178 #define SYS_kdebug_trace64 179 #define SYS_kdebug_trace 180 #define SYS_setgid 181 #define SYS_setegid 182 #define SYS_seteuid 183 #define SYS_sigreturn 184 /* 185 old chud */ #define SYS_thread_selfcounts 186 #define SYS_fdatasync 187 #define SYS_stat 188 #define SYS_fstat 189 #define SYS_lstat 190 #define SYS_pathconf 191 #define SYS_fpathconf 192 /* 193 old getfsstat */ #define SYS_getrlimit 194 #define SYS_setrlimit 195 #define SYS_getdirentries 196 #define SYS_mmap 197 /* 198 old __syscall */ #define SYS_lseek 199 #define SYS_truncate 200 #define SYS_ftruncate 201 #define SYS_sysctl 202 #define SYS_mlock 203 #define SYS_munlock 204 #define SYS_undelete 205 /* 206 old ATsocket */ /* 207 old ATgetmsg */ /* 208 old ATputmsg */ /* 209 old ATsndreq */ /* 210 old ATsndrsp */ /* 211 old ATgetreq */ /* 212 old ATgetrsp */ /* 213 Reserved for AppleTalk */ /* 214 */ /* 215 */ #define SYS_open_dprotected_np 216 #define SYS_fsgetpath_ext 217 /* 218 old lstatv */ /* 219 old fstatv */ #define SYS_getattrlist 220 #define SYS_setattrlist 221 #define SYS_getdirentriesattr 222 #define SYS_exchangedata 223 /* 224 old checkuseraccess or fsgetpath */ #define SYS_searchfs 225 #define SYS_delete 226 #define SYS_copyfile 227 #define SYS_fgetattrlist 228 #define SYS_fsetattrlist 229 #define SYS_poll 230 /* 231 old watchevent */ /* 232 old waitevent */ /* 233 old modwatch */ #define SYS_getxattr 234 #define SYS_fgetxattr 235 #define SYS_setxattr 236 #define SYS_fsetxattr 237 #define SYS_removexattr 238 #define SYS_fremovexattr 239 #define SYS_listxattr 240 #define SYS_flistxattr 241 #define SYS_fsctl 242 #define SYS_initgroups 243 #define SYS_posix_spawn 244 #define SYS_ffsctl 245 /* 246 */ #define SYS_nfsclnt 247 #define SYS_fhopen 248 /* 249 */ #define SYS_minherit 250 #define SYS_semsys 251 #define SYS_msgsys 252 #define SYS_shmsys 253 #define SYS_semctl 254 #define SYS_semget 255 #define SYS_semop 256 /* 257 old semconfig */ #define SYS_msgctl 258 #define SYS_msgget 259 #define SYS_msgsnd 260 #define SYS_msgrcv 261 #define SYS_shmat 262 #define SYS_shmctl 263 #define SYS_shmdt 264 #define SYS_shmget 265 #define SYS_shm_open 266 #define SYS_shm_unlink 267 #define SYS_sem_open 268 #define SYS_sem_close 269 #define SYS_sem_unlink 270 #define SYS_sem_wait 271 #define SYS_sem_trywait 272 #define SYS_sem_post 273 #define SYS_sysctlbyname 274 /* 275 old sem_init */ /* 276 old sem_destroy */ #define SYS_open_extended 277 #define SYS_umask_extended 278 #define SYS_stat_extended 279 #define SYS_lstat_extended 280 #define SYS_fstat_extended 281 #define SYS_chmod_extended 282 #define SYS_fchmod_extended 283 #define SYS_access_extended 284 #define SYS_settid 285 #define SYS_gettid 286 #define SYS_setsgroups 287 #define SYS_getsgroups 288 #define SYS_setwgroups 289 #define SYS_getwgroups 290 #define SYS_mkfifo_extended 291 #define SYS_mkdir_extended 292 #define SYS_identitysvc 293 #define SYS_shared_region_check_np 294 /* 295 old shared_region_map_np */ #define SYS_vm_pressure_monitor 296 #define SYS_psynch_rw_longrdlock 297 #define SYS_psynch_rw_yieldwrlock 298 #define SYS_psynch_rw_downgrade 299 #define SYS_psynch_rw_upgrade 300 #define SYS_psynch_mutexwait 301 #define SYS_psynch_mutexdrop 302 #define SYS_psynch_cvbroad 303 #define SYS_psynch_cvsignal 304 #define SYS_psynch_cvwait 305 #define SYS_psynch_rw_rdlock 306 #define SYS_psynch_rw_wrlock 307 #define SYS_psynch_rw_unlock 308 #define SYS_psynch_rw_unlock2 309 #define SYS_getsid 310 #define SYS_settid_with_pid 311 #define SYS_psynch_cvclrprepost 312 #define SYS_aio_fsync 313 #define SYS_aio_return 314 #define SYS_aio_suspend 315 #define SYS_aio_cancel 316 #define SYS_aio_error 317 #define SYS_aio_read 318 #define SYS_aio_write 319 #define SYS_lio_listio 320 /* 321 old __pthread_cond_wait */ #define SYS_iopolicysys 322 #define SYS_process_policy 323 #define SYS_mlockall 324 #define SYS_munlockall 325 /* 326 */ #define SYS_issetugid 327 #define SYS___pthread_kill 328 #define SYS___pthread_sigmask 329 #define SYS___sigwait 330 #define SYS___disable_threadsignal 331 #define SYS___pthread_markcancel 332 #define SYS___pthread_canceled 333 #define SYS___semwait_signal 334 /* 335 old utrace */ #define SYS_proc_info 336 #define SYS_sendfile 337 #define SYS_stat64 338 #define SYS_fstat64 339 #define SYS_lstat64 340 #define SYS_stat64_extended 341 #define SYS_lstat64_extended 342 #define SYS_fstat64_extended 343 #define SYS_getdirentries64 344 #define SYS_statfs64 345 #define SYS_fstatfs64 346 #define SYS_getfsstat64 347 #define SYS___pthread_chdir 348 #define SYS___pthread_fchdir 349 #define SYS_audit 350 #define SYS_auditon 351 /* 352 */ #define SYS_getauid 353 #define SYS_setauid 354 /* 355 old getaudit */ /* 356 old setaudit */ #define SYS_getaudit_addr 357 #define SYS_setaudit_addr 358 #define SYS_auditctl 359 #define SYS_bsdthread_create 360 #define SYS_bsdthread_terminate 361 #define SYS_kqueue 362 #define SYS_kevent 363 #define SYS_lchown 364 /* 365 old stack_snapshot */ #define SYS_bsdthread_register 366 #define SYS_workq_open 367 #define SYS_workq_kernreturn 368 #define SYS_kevent64 369 #define SYS___old_semwait_signal 370 #define SYS___old_semwait_signal_nocancel 371 #define SYS_thread_selfid 372 #define SYS_ledger 373 #define SYS_kevent_qos 374 #define SYS_kevent_id 375 /* 376 */ /* 377 */ /* 378 */ /* 379 */ #define SYS___mac_execve 380 #define SYS___mac_syscall 381 #define SYS___mac_get_file 382 #define SYS___mac_set_file 383 #define SYS___mac_get_link 384 #define SYS___mac_set_link 385 #define SYS___mac_get_proc 386 #define SYS___mac_set_proc 387 #define SYS___mac_get_fd 388 #define SYS___mac_set_fd 389 #define SYS___mac_get_pid 390 /* 391 */ /* 392 */ /* 393 */ #define SYS_pselect 394 #define SYS_pselect_nocancel 395 #define SYS_read_nocancel 396 #define SYS_write_nocancel 397 #define SYS_open_nocancel 398 #define SYS_close_nocancel 399 #define SYS_wait4_nocancel 400 #define SYS_recvmsg_nocancel 401 #define SYS_sendmsg_nocancel 402 #define SYS_recvfrom_nocancel 403 #define SYS_accept_nocancel 404 #define SYS_msync_nocancel 405 #define SYS_fcntl_nocancel 406 #define SYS_select_nocancel 407 #define SYS_fsync_nocancel 408 #define SYS_connect_nocancel 409 #define SYS_sigsuspend_nocancel 410 #define SYS_readv_nocancel 411 #define SYS_writev_nocancel 412 #define SYS_sendto_nocancel 413 #define SYS_pread_nocancel 414 #define SYS_pwrite_nocancel 415 #define SYS_waitid_nocancel 416 #define SYS_poll_nocancel 417 #define SYS_msgsnd_nocancel 418 #define SYS_msgrcv_nocancel 419 #define SYS_sem_wait_nocancel 420 #define SYS_aio_suspend_nocancel 421 #define SYS___sigwait_nocancel 422 #define SYS___semwait_signal_nocancel 423 #define SYS___mac_mount 424 #define SYS___mac_get_mount 425 #define SYS___mac_getfsstat 426 #define SYS_fsgetpath 427 #define SYS_audit_session_self 428 #define SYS_audit_session_join 429 #define SYS_fileport_makeport 430 #define SYS_fileport_makefd 431 #define SYS_audit_session_port 432 #define SYS_pid_suspend 433 #define SYS_pid_resume 434 #define SYS_pid_hibernate 435 #define SYS_pid_shutdown_sockets 436 /* 437 old shared_region_slide_np */ #define SYS_shared_region_map_and_slide_np 438 #define SYS_kas_info 439 #define SYS_memorystatus_control 440 #define SYS_guarded_open_np 441 #define SYS_guarded_close_np 442 #define SYS_guarded_kqueue_np 443 #define SYS_change_fdguard_np 444 #define SYS_usrctl 445 #define SYS_proc_rlimit_control 446 #define SYS_connectx 447 #define SYS_disconnectx 448 #define SYS_peeloff 449 #define SYS_socket_delegate 450 #define SYS_telemetry 451 #define SYS_proc_uuid_policy 452 #define SYS_memorystatus_get_level 453 #define SYS_system_override 454 #define SYS_vfs_purge 455 #define SYS_sfi_ctl 456 #define SYS_sfi_pidctl 457 #define SYS_coalition 458 #define SYS_coalition_info 459 #define SYS_necp_match_policy 460 #define SYS_getattrlistbulk 461 #define SYS_clonefileat 462 #define SYS_openat 463 #define SYS_openat_nocancel 464 #define SYS_renameat 465 #define SYS_faccessat 466 #define SYS_fchmodat 467 #define SYS_fchownat 468 #define SYS_fstatat 469 #define SYS_fstatat64 470 #define SYS_linkat 471 #define SYS_unlinkat 472 #define SYS_readlinkat 473 #define SYS_symlinkat 474 #define SYS_mkdirat 475 #define SYS_getattrlistat 476 #define SYS_proc_trace_log 477 #define SYS_bsdthread_ctl 478 #define SYS_openbyid_np 479 #define SYS_recvmsg_x 480 #define SYS_sendmsg_x 481 #define SYS_thread_selfusage 482 #define SYS_csrctl 483 #define SYS_guarded_open_dprotected_np 484 #define SYS_guarded_write_np 485 #define SYS_guarded_pwrite_np 486 #define SYS_guarded_writev_np 487 #define SYS_renameatx_np 488 #define SYS_mremap_encrypted 489 #define SYS_netagent_trigger 490 #define SYS_stack_snapshot_with_config 491 #define SYS_microstackshot 492 #define SYS_grab_pgo_data 493 #define SYS_persona 494 /* 495 */ #define SYS_mach_eventlink_signal 496 #define SYS_mach_eventlink_wait_until 497 #define SYS_mach_eventlink_signal_wait_until 498 #define SYS_work_interval_ctl 499 #define SYS_getentropy 500 #define SYS_necp_open 501 #define SYS_necp_client_action 502 #define SYS___nexus_open 503 #define SYS___nexus_register 504 #define SYS___nexus_deregister 505 #define SYS___nexus_create 506 #define SYS___nexus_destroy 507 #define SYS___nexus_get_opt 508 #define SYS___nexus_set_opt 509 #define SYS___channel_open 510 #define SYS___channel_get_info 511 #define SYS___channel_sync 512 #define SYS___channel_get_opt 513 #define SYS___channel_set_opt 514 #define SYS_ulock_wait 515 #define SYS_ulock_wake 516 #define SYS_fclonefileat 517 #define SYS_fs_snapshot 518 #define SYS_register_uexc_handler 519 #define SYS_terminate_with_payload 520 #define SYS_abort_with_payload 521 #define SYS_necp_session_open 522 #define SYS_necp_session_action 523 #define SYS_setattrlistat 524 #define SYS_net_qos_guideline 525 #define SYS_fmount 526 #define SYS_ntp_adjtime 527 #define SYS_ntp_gettime 528 #define SYS_os_fault_with_payload 529 #define SYS_kqueue_workloop_ctl 530 #define SYS___mach_bridge_remote_time 531 #define SYS_coalition_ledger 532 #define SYS_log_data 533 #define SYS_memorystatus_available_memory 534 #define SYS_objc_bp_assist_cfg_np 535 #define SYS_shared_region_map_and_slide_2_np 536 #define SYS_pivot_root 537 #define SYS_task_inspect_for_pid 538 #define SYS_task_read_for_pid 539 #define SYS_preadv 540 #define SYS_pwritev 541 #define SYS_preadv_nocancel 542 #define SYS_pwritev_nocancel 543 #define SYS_ulock_wait2 544 #define SYS_proc_info_extended_id 545 #define SYS_tracker_action 546 #define SYS_debug_syscall_reject 547 #define SYS_MAXSYSCALL 548 #define SYS_invalid 63 #endif /* __APPLE_API_PRIVATE */ #endif /* !_SYS_SYSCALL_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/sysctl.h ================================================ /* * 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@ */ /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */ /* * Copyright (c) 1989, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Mike Karels at Berkeley Software Design, 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. * * @(#)sysctl.h 8.1 (Berkeley) 6/2/93 */ /* * 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. */ #ifndef _SYS_SYSCTL_H_ #define _SYS_SYSCTL_H_ /* * These are for the eproc structure defined below. */ #include #include #include #include #include #include /* * Definitions for sysctl call. The sysctl call uses a hierarchical name * for objects that can be examined or modified. The name is expressed as * a sequence of integers. Like a file path name, the meaning of each * component depends on its place in the hierarchy. The top-level and kern * identifiers are defined here, and other identifiers are defined in the * respective subsystem header files. */ #define CTL_MAXNAME 12 /* largest number of components supported */ /* * Each subsystem defined by sysctl defines a list of variables * for that subsystem. Each name is either a node with further * levels defined below it, or it is a leaf of some particular * type given below. Each sysctl level defines a set of name/type * pairs to be used by sysctl(1) in manipulating the subsystem. * * When declaring new sysctl names, use the CTLFLAG_LOCKED flag in the * type to indicate that all necessary locking will be handled * within the sysctl. * * Any sysctl defined without CTLFLAG_LOCKED is considered legacy * and will be protected by a global mutex. * * Note: This is not optimal, so it is best to handle locking * yourself, if you are able to do so. A simple design * pattern for use to avoid in a single function known * to potentially be in the paging path ot doing a DMA * to physical memory in a user space process is: * * lock * perform operation vs. local buffer * unlock * SYSCTL_OUT(rey, local buffer, length) * * ...this assumes you are not using a deep call graph * or are unable to pass a local buffer address as a * parameter into your deep call graph. * * Note that very large user buffers can fail the wire * if to do so would require more physical pages than * are available (the caller will get an ENOMEM error, * see sysctl_mem_hold() for details). */ struct ctlname { char *ctl_name; /* subsystem name */ int ctl_type; /* type of name */ }; #define CTLTYPE 0xf /* Mask for the type */ #define CTLTYPE_NODE 1 /* name is a node */ #define CTLTYPE_INT 2 /* name describes an integer */ #define CTLTYPE_STRING 3 /* name describes a string */ #define CTLTYPE_QUAD 4 /* name describes a 64-bit number */ #define CTLTYPE_OPAQUE 5 /* name describes a structure */ #define CTLTYPE_STRUCT CTLTYPE_OPAQUE /* name describes a structure */ #define CTLFLAG_RD 0x80000000 /* Allow reads of variable */ #define CTLFLAG_WR 0x40000000 /* Allow writes to the variable */ #define CTLFLAG_RW (CTLFLAG_RD|CTLFLAG_WR) #define CTLFLAG_NOLOCK 0x20000000 /* XXX Don't Lock */ #define CTLFLAG_ANYBODY 0x10000000 /* All users can set this var */ #define CTLFLAG_SECURE 0x08000000 /* Permit set only if securelevel<=0 */ #define CTLFLAG_MASKED 0x04000000 /* deprecated variable, do not display */ #define CTLFLAG_NOAUTO 0x02000000 /* do not auto-register */ #define CTLFLAG_KERN 0x01000000 /* valid inside the kernel */ #define CTLFLAG_LOCKED 0x00800000 /* node will handle locking itself */ #define CTLFLAG_OID2 0x00400000 /* struct sysctl_oid has version info */ #define CTLFLAG_EXPERIMENT 0x00100000 /* Allows writing w/ the trial experiment entitlement. */ /* * USE THIS instead of a hardwired number from the categories below * to get dynamically assigned sysctl entries using the linker-set * technology. This is the way nearly all new sysctl variables should * be implemented. * * e.g. SYSCTL_INT(_parent, OID_AUTO, name, CTLFLAG_RW, &variable, 0, ""); * * Note that linker set technology will automatically register all nodes * declared like this on kernel initialization, UNLESS they are defined * in I/O-Kit. In this case, you have to call sysctl_register_oid() * manually - just like in a KEXT. */ #define OID_AUTO (-1) #define OID_AUTO_START 100 /* conventional */ #define SYSCTL_DEF_ENABLED #ifdef SYSCTL_DEF_ENABLED /* * Top-level identifiers */ #define CTL_UNSPEC 0 /* unused */ #define CTL_KERN 1 /* "high kernel": proc, limits */ #define CTL_VM 2 /* virtual memory */ #define CTL_VFS 3 /* file system, mount type is next */ #define CTL_NET 4 /* network, see socket.h */ #define CTL_DEBUG 5 /* debugging parameters */ #define CTL_HW 6 /* generic cpu/io */ #define CTL_MACHDEP 7 /* machine dependent */ #define CTL_USER 8 /* user-level */ #define CTL_MAXID 9 /* number of valid top-level ids */ #define CTL_NAMES { \ { 0, 0 }, \ { "kern", CTLTYPE_NODE }, \ { "vm", CTLTYPE_NODE }, \ { "vfs", CTLTYPE_NODE }, \ { "net", CTLTYPE_NODE }, \ { "debug", CTLTYPE_NODE }, \ { "hw", CTLTYPE_NODE }, \ { "machdep", CTLTYPE_NODE }, \ { "user", CTLTYPE_NODE }, \ } /* * CTL_KERN identifiers */ #define KERN_OSTYPE 1 /* string: system version */ #define KERN_OSRELEASE 2 /* string: system release */ #define KERN_OSREV 3 /* int: system revision */ #define KERN_VERSION 4 /* string: compile time info */ #define KERN_MAXVNODES 5 /* int: max vnodes */ #define KERN_MAXPROC 6 /* int: max processes */ #define KERN_MAXFILES 7 /* int: max open files */ #define KERN_ARGMAX 8 /* int: max arguments to exec */ #define KERN_SECURELVL 9 /* int: system security level */ #define KERN_HOSTNAME 10 /* string: hostname */ #define KERN_HOSTID 11 /* int: host identifier */ #define KERN_CLOCKRATE 12 /* struct: struct clockrate */ #define KERN_VNODE 13 /* struct: vnode structures */ #define KERN_PROC 14 /* struct: process entries */ #define KERN_FILE 15 /* struct: file entries */ #define KERN_PROF 16 /* node: kernel profiling info */ #define KERN_POSIX1 17 /* int: POSIX.1 version */ #define KERN_NGROUPS 18 /* int: # of supplemental group ids */ #define KERN_JOB_CONTROL 19 /* int: is job control available */ #define KERN_SAVED_IDS 20 /* int: saved set-user/group-ID */ #define KERN_BOOTTIME 21 /* struct: time kernel was booted */ #define KERN_NISDOMAINNAME 22 /* string: YP domain name */ #define KERN_DOMAINNAME KERN_NISDOMAINNAME #define KERN_MAXPARTITIONS 23 /* int: number of partitions/disk */ #define KERN_KDEBUG 24 /* int: kernel trace points */ #define KERN_UPDATEINTERVAL 25 /* int: update process sleep time */ #define KERN_OSRELDATE 26 /* int: OS release date */ #define KERN_NTP_PLL 27 /* node: NTP PLL control */ #define KERN_BOOTFILE 28 /* string: name of booted kernel */ #define KERN_MAXFILESPERPROC 29 /* int: max open files per proc */ #define KERN_MAXPROCPERUID 30 /* int: max processes per uid */ #define KERN_DUMPDEV 31 /* dev_t: device to dump on */ #define KERN_IPC 32 /* node: anything related to IPC */ #define KERN_DUMMY 33 /* unused */ #define KERN_PS_STRINGS 34 /* int: address of PS_STRINGS */ #define KERN_USRSTACK32 35 /* int: address of USRSTACK */ #define KERN_LOGSIGEXIT 36 /* int: do we log sigexit procs? */ #define KERN_SYMFILE 37 /* string: kernel symbol filename */ #define KERN_PROCARGS 38 /* 39 was KERN_PCSAMPLES... now obsolete */ #define KERN_NETBOOT 40 /* int: are we netbooted? 1=yes,0=no */ /* 41 was KERN_PANICINFO : panic UI information (deprecated) */ #define KERN_SYSV 42 /* node: System V IPC information */ #define KERN_AFFINITY 43 /* xxx */ #define KERN_TRANSLATE 44 /* xxx */ #define KERN_CLASSIC KERN_TRANSLATE /* XXX backwards compat */ #define KERN_EXEC 45 /* xxx */ #define KERN_CLASSICHANDLER KERN_EXEC /* XXX backwards compatibility */ #define KERN_AIOMAX 46 /* int: max aio requests */ #define KERN_AIOPROCMAX 47 /* int: max aio requests per process */ #define KERN_AIOTHREADS 48 /* int: max aio worker threads */ #ifdef __APPLE_API_UNSTABLE #define KERN_PROCARGS2 49 #endif /* __APPLE_API_UNSTABLE */ #define KERN_COREFILE 50 /* string: corefile format string */ #define KERN_COREDUMP 51 /* int: whether to coredump at all */ #define KERN_SUGID_COREDUMP 52 /* int: whether to dump SUGID cores */ #define KERN_PROCDELAYTERM 53 /* int: set/reset current proc for delayed termination during shutdown */ #define KERN_SHREG_PRIVATIZABLE 54 /* int: can shared regions be privatized ? */ /* 55 was KERN_PROC_LOW_PRI_IO... now deprecated */ #define KERN_LOW_PRI_WINDOW 56 /* int: set/reset throttle window - milliseconds */ #define KERN_LOW_PRI_DELAY 57 /* int: set/reset throttle delay - milliseconds */ #define KERN_POSIX 58 /* node: posix tunables */ #define KERN_USRSTACK64 59 /* LP64 user stack query */ #define KERN_NX_PROTECTION 60 /* int: whether no-execute protection is enabled */ #define KERN_TFP 61 /* Task for pid settings */ #define KERN_PROCNAME 62 /* setup process program name(2*MAXCOMLEN) */ #define KERN_THALTSTACK 63 /* for compat with older x86 and does nothing */ #define KERN_SPECULATIVE_READS 64 /* int: whether speculative reads are disabled */ #define KERN_OSVERSION 65 /* for build number i.e. 9A127 */ #define KERN_SAFEBOOT 66 /* are we booted safe? */ /* 67 was KERN_LCTX (login context) */ #define KERN_RAGEVNODE 68 #define KERN_TTY 69 /* node: tty settings */ #define KERN_CHECKOPENEVT 70 /* spi: check the VOPENEVT flag on vnodes at open time */ #define KERN_THREADNAME 71 /* set/get thread name */ #define KERN_MAXID 72 /* number of valid kern ids */ /* * Don't add any more sysctls like this. Instead, use the SYSCTL_*() macros * and OID_AUTO. This will have the added benefit of not having to recompile * sysctl(8) to pick up your changes. */ #if defined(__LP64__) #define KERN_USRSTACK KERN_USRSTACK64 #else #define KERN_USRSTACK KERN_USRSTACK32 #endif /* KERN_RAGEVNODE types */ #define KERN_RAGE_PROC 1 #define KERN_RAGE_THREAD 2 #define KERN_UNRAGE_PROC 3 #define KERN_UNRAGE_THREAD 4 /* KERN_OPENEVT types */ #define KERN_OPENEVT_PROC 1 #define KERN_UNOPENEVT_PROC 2 /* KERN_TFP types */ #define KERN_TFP_POLICY 1 /* KERN_TFP_POLICY values . All policies allow task port for self */ #define KERN_TFP_POLICY_DENY 0 /* Deny Mode: None allowed except privileged */ #define KERN_TFP_POLICY_DEFAULT 2 /* Default Mode: related ones allowed and upcall authentication */ /* KERN_KDEBUG types */ #define KERN_KDEFLAGS 1 #define KERN_KDDFLAGS 2 #define KERN_KDENABLE 3 #define KERN_KDSETBUF 4 #define KERN_KDGETBUF 5 #define KERN_KDSETUP 6 #define KERN_KDREMOVE 7 #define KERN_KDSETREG 8 #define KERN_KDGETREG 9 #define KERN_KDREADTR 10 #define KERN_KDPIDTR 11 #define KERN_KDTHRMAP 12 /* Don't use 13 as it is overloaded with KERN_VNODE */ #define KERN_KDPIDEX 14 #define KERN_KDSETRTCDEC 15 /* obsolete */ #define KERN_KDGETENTROPY 16 /* obsolete */ #define KERN_KDWRITETR 17 #define KERN_KDWRITEMAP 18 #define KERN_KDTEST 19 /* 20 unused */ #define KERN_KDREADCURTHRMAP 21 #define KERN_KDSET_TYPEFILTER 22 #define KERN_KDBUFWAIT 23 #define KERN_KDCPUMAP 24 #define KERN_KDCPUMAP_EXT 25 /* 25 - 27 unused */ #define KERN_KDWRITETR_V3 28 #define CTL_KERN_NAMES { \ { 0, 0 }, \ { "ostype", CTLTYPE_STRING }, \ { "osrelease", CTLTYPE_STRING }, \ { "osrevision", CTLTYPE_INT }, \ { "version", CTLTYPE_STRING }, \ { "maxvnodes", CTLTYPE_INT }, \ { "maxproc", CTLTYPE_INT }, \ { "maxfiles", CTLTYPE_INT }, \ { "argmax", CTLTYPE_INT }, \ { "securelevel", CTLTYPE_INT }, \ { "hostname", CTLTYPE_STRING }, \ { "hostid", CTLTYPE_INT }, \ { "clockrate", CTLTYPE_STRUCT }, \ { "vnode", CTLTYPE_STRUCT }, \ { "proc", CTLTYPE_STRUCT }, \ { "file", CTLTYPE_STRUCT }, \ { "profiling", CTLTYPE_NODE }, \ { "posix1version", CTLTYPE_INT }, \ { "ngroups", CTLTYPE_INT }, \ { "job_control", CTLTYPE_INT }, \ { "saved_ids", CTLTYPE_INT }, \ { "boottime", CTLTYPE_STRUCT }, \ { "nisdomainname", CTLTYPE_STRING }, \ { "maxpartitions", CTLTYPE_INT }, \ { "kdebug", CTLTYPE_INT }, \ { "update", CTLTYPE_INT }, \ { "osreldate", CTLTYPE_INT }, \ { "ntp_pll", CTLTYPE_NODE }, \ { "bootfile", CTLTYPE_STRING }, \ { "maxfilesperproc", CTLTYPE_INT }, \ { "maxprocperuid", CTLTYPE_INT }, \ { "dumpdev", CTLTYPE_STRUCT }, /* we lie; don't print as int */ \ { "ipc", CTLTYPE_NODE }, \ { "dummy", CTLTYPE_INT }, \ { "dummy", CTLTYPE_INT }, \ { "usrstack", CTLTYPE_INT }, \ { "logsigexit", CTLTYPE_INT }, \ { "symfile",CTLTYPE_STRING },\ { "procargs",CTLTYPE_STRUCT },\ { "dummy", CTLTYPE_INT }, /* deprecated pcsamples */ \ { "netboot", CTLTYPE_INT }, \ { "dummy", CTLTYPE_INT }, /* deprecated: panicinfo */ \ { "sysv", CTLTYPE_NODE }, \ { "dummy", CTLTYPE_INT }, \ { "dummy", CTLTYPE_INT }, \ { "exec", CTLTYPE_NODE }, \ { "aiomax", CTLTYPE_INT }, \ { "aioprocmax", CTLTYPE_INT }, \ { "aiothreads", CTLTYPE_INT }, \ { "procargs2",CTLTYPE_STRUCT }, \ { "corefile",CTLTYPE_STRING }, \ { "coredump", CTLTYPE_INT }, \ { "sugid_coredump", CTLTYPE_INT }, \ { "delayterm", CTLTYPE_INT }, \ { "shreg_private", CTLTYPE_INT }, \ { "proc_low_pri_io", CTLTYPE_INT }, \ { "low_pri_window", CTLTYPE_INT }, \ { "low_pri_delay", CTLTYPE_INT }, \ { "posix", CTLTYPE_NODE }, \ { "usrstack64", CTLTYPE_QUAD }, \ { "nx", CTLTYPE_INT }, \ { "tfp", CTLTYPE_NODE }, \ { "procname", CTLTYPE_STRING }, \ { "threadsigaltstack", CTLTYPE_INT }, \ { "speculative_reads_disabled", CTLTYPE_INT }, \ { "osversion", CTLTYPE_STRING }, \ { "safeboot", CTLTYPE_INT }, \ { "dummy", CTLTYPE_INT }, /* deprecated: lctx */ \ { "rage_vnode", CTLTYPE_INT }, \ { "tty", CTLTYPE_NODE }, \ { "check_openevt", CTLTYPE_INT }, \ { "thread_name", CTLTYPE_STRING } \ } /* * CTL_VFS identifiers */ #define CTL_VFS_NAMES { \ { "vfsconf", CTLTYPE_STRUCT } \ } /* * KERN_PROC subtypes */ #define KERN_PROC_ALL 0 /* everything */ #define KERN_PROC_PID 1 /* by process id */ #define KERN_PROC_PGRP 2 /* by process group id */ #define KERN_PROC_SESSION 3 /* by session of pid */ #define KERN_PROC_TTY 4 /* by controlling tty */ #define KERN_PROC_UID 5 /* by effective uid */ #define KERN_PROC_RUID 6 /* by real uid */ #define KERN_PROC_LCID 7 /* by login context id */ /* * KERN_VFSNSPACE subtypes */ #define KERN_VFSNSPACE_HANDLE_PROC 1 #define KERN_VFSNSPACE_UNHANDLE_PROC 2 /* * KERN_PROC subtype ops return arrays of augmented proc structures: */ struct _pcred { char pc_lock[72]; /* opaque content */ struct ucred *pc_ucred; /* Current credentials. */ uid_t p_ruid; /* Real user id. */ uid_t p_svuid; /* Saved effective user id. */ gid_t p_rgid; /* Real group id. */ gid_t p_svgid; /* Saved effective group id. */ int p_refcnt; /* Number of references. */ }; struct _ucred { int32_t cr_ref; /* reference count */ uid_t cr_uid; /* effective user id */ short cr_ngroups; /* number of groups */ gid_t cr_groups[NGROUPS]; /* groups */ }; struct kinfo_proc { struct extern_proc kp_proc; /* proc structure */ struct eproc { struct proc *e_paddr; /* address of proc */ struct session *e_sess; /* session pointer */ struct _pcred e_pcred; /* process credentials */ struct _ucred e_ucred; /* current credentials */ struct vmspace e_vm; /* address space */ pid_t e_ppid; /* parent process id */ pid_t e_pgid; /* process group id */ short e_jobc; /* job control counter */ dev_t e_tdev; /* controlling tty dev */ pid_t e_tpgid; /* tty process group id */ struct session *e_tsess; /* tty session pointer */ #define WMESGLEN 7 char e_wmesg[WMESGLEN + 1]; /* wchan message */ segsz_t e_xsize; /* text size */ short e_xrssize; /* text rss */ short e_xccount; /* text references */ short e_xswrss; int32_t e_flag; #define EPROC_CTTY 0x01 /* controlling tty vnode active */ #define EPROC_SLEADER 0x02 /* session leader */ #define COMAPT_MAXLOGNAME 12 char e_login[COMAPT_MAXLOGNAME]; /* short setlogin() name */ int32_t e_spare[4]; } kp_eproc; }; /* * KERN_IPC identifiers */ #define KIPC_MAXSOCKBUF 1 /* int: max size of a socket buffer */ #define KIPC_SOCKBUF_WASTE 2 /* int: wastage factor in sockbuf */ #define KIPC_SOMAXCONN 3 /* int: max length of connection q */ #define KIPC_MAX_LINKHDR 4 /* int: max length of link header */ #define KIPC_MAX_PROTOHDR 5 /* int: max length of network header */ #define KIPC_MAX_HDR 6 /* int: max total length of headers */ #define KIPC_MAX_DATALEN 7 /* int: max length of data? */ #define KIPC_MBSTAT 8 /* struct: mbuf usage statistics */ #define KIPC_NMBCLUSTERS 9 /* int: maximum mbuf clusters */ #define KIPC_SOQLIMITCOMPAT 10 /* int: socket queue limit */ /* * CTL_VM identifiers */ #define VM_METER 1 /* struct vmmeter */ #define VM_LOADAVG 2 /* struct loadavg */ /* * Note: "3" was skipped sometime ago and should probably remain unused * to avoid any new entry from being accepted by older kernels... */ #define VM_MACHFACTOR 4 /* struct loadavg with mach factor*/ #define VM_SWAPUSAGE 5 /* total swap usage */ #define VM_MAXID 6 /* number of valid vm ids */ #define CTL_VM_NAMES { \ { 0, 0 }, \ { "vmmeter", CTLTYPE_STRUCT }, \ { "loadavg", CTLTYPE_STRUCT }, \ { 0, 0 }, /* placeholder for "3" (see comment above) */ \ { "dummy", CTLTYPE_INT }, \ { "swapusage", CTLTYPE_STRUCT } \ } struct xsw_usage { u_int64_t xsu_total; u_int64_t xsu_avail; u_int64_t xsu_used; u_int32_t xsu_pagesize; boolean_t xsu_encrypted; }; #ifdef __APPLE_API_PRIVATE /* Load average structure. Use of fixpt_t assume in scope. */ /* XXX perhaps we should protect fixpt_t, and define it here (or discard it) */ struct loadavg { fixpt_t ldavg[3]; long fscale; }; extern struct loadavg averunnable; #define LSCALE 1000 /* scaling for "fixed point" arithmetic */ #endif /* __APPLE_API_PRIVATE */ /* * CTL_HW identifiers */ #define HW_MACHINE 1 /* string: machine class (deprecated: use HW_PRODUCT) */ #define HW_MODEL 2 /* string: specific machine model (deprecated: use HW_TARGET) */ #define HW_NCPU 3 /* int: number of cpus */ #define HW_BYTEORDER 4 /* int: machine byte order */ #define HW_PHYSMEM 5 /* int: total memory */ #define HW_USERMEM 6 /* int: non-kernel memory */ #define HW_PAGESIZE 7 /* int: software page size */ #define HW_DISKNAMES 8 /* strings: disk drive names */ #define HW_DISKSTATS 9 /* struct: diskstats[] */ #define HW_EPOCH 10 /* int: 0 for Legacy, else NewWorld */ #define HW_FLOATINGPT 11 /* int: has HW floating point? */ #define HW_MACHINE_ARCH 12 /* string: machine architecture */ #define HW_VECTORUNIT 13 /* int: has HW vector unit? */ #define HW_BUS_FREQ 14 /* int: Bus Frequency */ #define HW_CPU_FREQ 15 /* int: CPU Frequency */ #define HW_CACHELINE 16 /* int: Cache Line Size in Bytes */ #define HW_L1ICACHESIZE 17 /* int: L1 I Cache Size in Bytes */ #define HW_L1DCACHESIZE 18 /* int: L1 D Cache Size in Bytes */ #define HW_L2SETTINGS 19 /* int: L2 Cache Settings */ #define HW_L2CACHESIZE 20 /* int: L2 Cache Size in Bytes */ #define HW_L3SETTINGS 21 /* int: L3 Cache Settings */ #define HW_L3CACHESIZE 22 /* int: L3 Cache Size in Bytes */ #define HW_TB_FREQ 23 /* int: Bus Frequency */ #define HW_MEMSIZE 24 /* uint64_t: physical ram size */ #define HW_AVAILCPU 25 /* int: number of available CPUs */ #define HW_TARGET 26 /* string: model identifier */ #define HW_PRODUCT 27 /* string: product identifier */ #define HW_MAXID 28 /* number of valid hw ids */ #define CTL_HW_NAMES { \ { 0, 0 }, \ { "machine", CTLTYPE_STRING }, /* Deprecated: use hw.product */ \ { "model", CTLTYPE_STRING }, /* Deprecated: use hw.target */ \ { "ncpu", CTLTYPE_INT }, \ { "byteorder", CTLTYPE_INT }, \ { "physmem", CTLTYPE_INT }, \ { "usermem", CTLTYPE_INT }, \ { "pagesize", CTLTYPE_INT }, \ { "disknames", CTLTYPE_STRUCT }, \ { "diskstats", CTLTYPE_STRUCT }, \ { "epoch", CTLTYPE_INT }, \ { "floatingpoint", CTLTYPE_INT }, \ { "machinearch", CTLTYPE_STRING }, \ { "vectorunit", CTLTYPE_INT }, \ { "busfrequency", CTLTYPE_INT }, \ { "cpufrequency", CTLTYPE_INT }, \ { "cachelinesize", CTLTYPE_INT }, \ { "l1icachesize", CTLTYPE_INT }, \ { "l1dcachesize", CTLTYPE_INT }, \ { "l2settings", CTLTYPE_INT }, \ { "l2cachesize", CTLTYPE_INT }, \ { "l3settings", CTLTYPE_INT }, \ { "l3cachesize", CTLTYPE_INT }, \ { "tbfrequency", CTLTYPE_INT }, \ { "memsize", CTLTYPE_QUAD }, \ { "availcpu", CTLTYPE_INT }, \ { "target", CTLTYPE_STRING }, \ { "product", CTLTYPE_STRING }, \ } /* * XXX This information should be moved to the man page. * * These are the support HW selectors for sysctlbyname. Parameters that are byte counts or frequencies are 64 bit numbers. * All other parameters are 32 bit numbers. * * hw.memsize - The number of bytes of physical memory in the system. * * hw.ncpu - The maximum number of processors that could be available this boot. * Use this value for sizing of static per processor arrays; i.e. processor load statistics. * * hw.activecpu - The number of processors currently available for executing threads. * Use this number to determine the number threads to create in SMP aware applications. * This number can change when power management modes are changed. * * hw.physicalcpu - The number of physical processors available in the current power management mode. * hw.physicalcpu_max - The maximum number of physical processors that could be available this boot * * hw.logicalcpu - The number of logical processors available in the current power management mode. * hw.logicalcpu_max - The maximum number of logical processors that could be available this boot * * hw.tbfrequency - This gives the time base frequency used by the OS and is the basis of all timing services. * In general is is better to use mach's or higher level timing services, but this value * is needed to convert the PPC Time Base registers to real time. * * hw.cpufrequency - These values provide the current, min and max cpu frequency. The min and max are for * hw.cpufrequency_max - all power management modes. The current frequency is the max frequency in the current mode. * hw.cpufrequency_min - All frequencies are in Hz. * * hw.busfrequency - These values provide the current, min and max bus frequency. The min and max are for * hw.busfrequency_max - all power management modes. The current frequency is the max frequency in the current mode. * hw.busfrequency_min - All frequencies are in Hz. * * hw.cputype - These values provide the mach-o cpu type and subtype. A complete list is in * hw.cpusubtype - These values should be used to determine what processor family the running cpu is from so that * the best binary can be chosen, or the best dynamic code generated. They should not be used * to determine if a given processor feature is available. * hw.cputhreadtype - This value will be present if the processor supports threads. Like hw.cpusubtype this selector * should not be used to infer features, and only used to name the processors thread architecture. * The values are defined in * * hw.byteorder - Gives the byte order of the processor. 4321 for big endian, 1234 for little. * * hw.pagesize - Gives the size in bytes of the pages used by the processor and VM system. * * hw.cachelinesize - Gives the size in bytes of the processor's cache lines. * This value should be use to control the strides of loops that use cache control instructions * like dcbz, dcbt or dcbst. * * hw.l1dcachesize - These values provide the size in bytes of the L1, L2 and L3 caches. If a cache is not present * hw.l1icachesize - then the selector will return and error. * hw.l2cachesize - * hw.l3cachesize - * * hw.nperflevels - Number of core types in the system. See the parameters below, which can be used to get * - information associated with a specific perf level. * * The following parameters apply to perflevel N, where N is a number between 0 and the number of core types in the system minus one. * perflevel 0 always refers to the highest performance core type in the system. * * hw.perflevelN.physicalcpu - The number of physical processors available in the current power management mode. * hw.perflevelN.physicalcpumax - The maximum number of physical processors that could be available this boot. * hw.perflevelN.logicalcpu - The number of logical processors available in the current power management mode. * hw.perflevelN.logicalcpumax - The maximum number of logical processors that could be available this boot. * * hw.perflevelN.l1dcachesize - These values provide the size in bytes of the L1, L2 and L3 caches. If a cache is not present * hw.perflevelN.l1icachesize - then the selector will return and error. * hw.perflevelN.l2cachesize - * hw.perflevelN.l3cachesize - * * hw.perflevelN.cpusperl2 - These values provide the number of CPUs of the same type that share L2 and L3 caches. * hw.perflevelN.cpusperl3 - If a cache is not present then the selector will return and error. * * hw.perflevelN.l2perflevels - These values provide a bitmap, where bit number of CPUs of the same type that share L2 and L3 caches. * hw.perflevelN.l3perflevels - If a cache is not present then the selector will return and error. * * hw.packages - Gives the number of processor packages. * * These are the selectors for optional processor features for specific processors. Selectors that return errors are not support * on the system. Supported features will return 1 if they are recommended or 0 if they are supported but are not expected to help . * performance. Future versions of these selectors may return larger values as necessary so it is best to test for non zero. * * For PowerPC: * * hw.optional.floatingpoint - Floating Point Instructions * hw.optional.altivec - AltiVec Instructions * hw.optional.graphicsops - Graphics Operations * hw.optional.64bitops - 64-bit Instructions * hw.optional.fsqrt - HW Floating Point Square Root Instruction * hw.optional.stfiwx - Store Floating Point as Integer Word Indexed Instructions * hw.optional.dcba - Data Cache Block Allocate Instruction * hw.optional.datastreams - Data Streams Instructions * hw.optional.dcbtstreams - Data Cache Block Touch Steams Instruction Form * * For x86 Architecture: * * hw.optional.floatingpoint - Floating Point Instructions * hw.optional.mmx - Original MMX vector instructions * hw.optional.sse - Streaming SIMD Extensions * hw.optional.sse2 - Streaming SIMD Extensions 2 * hw.optional.sse3 - Streaming SIMD Extensions 3 * hw.optional.supplementalsse3 - Supplemental Streaming SIMD Extensions 3 * hw.optional.x86_64 - 64-bit support */ /* * CTL_USER definitions */ #define USER_CS_PATH 1 /* string: _CS_PATH */ #define USER_BC_BASE_MAX 2 /* int: BC_BASE_MAX */ #define USER_BC_DIM_MAX 3 /* int: BC_DIM_MAX */ #define USER_BC_SCALE_MAX 4 /* int: BC_SCALE_MAX */ #define USER_BC_STRING_MAX 5 /* int: BC_STRING_MAX */ #define USER_COLL_WEIGHTS_MAX 6 /* int: COLL_WEIGHTS_MAX */ #define USER_EXPR_NEST_MAX 7 /* int: EXPR_NEST_MAX */ #define USER_LINE_MAX 8 /* int: LINE_MAX */ #define USER_RE_DUP_MAX 9 /* int: RE_DUP_MAX */ #define USER_POSIX2_VERSION 10 /* int: POSIX2_VERSION */ #define USER_POSIX2_C_BIND 11 /* int: POSIX2_C_BIND */ #define USER_POSIX2_C_DEV 12 /* int: POSIX2_C_DEV */ #define USER_POSIX2_CHAR_TERM 13 /* int: POSIX2_CHAR_TERM */ #define USER_POSIX2_FORT_DEV 14 /* int: POSIX2_FORT_DEV */ #define USER_POSIX2_FORT_RUN 15 /* int: POSIX2_FORT_RUN */ #define USER_POSIX2_LOCALEDEF 16 /* int: POSIX2_LOCALEDEF */ #define USER_POSIX2_SW_DEV 17 /* int: POSIX2_SW_DEV */ #define USER_POSIX2_UPE 18 /* int: POSIX2_UPE */ #define USER_STREAM_MAX 19 /* int: POSIX2_STREAM_MAX */ #define USER_TZNAME_MAX 20 /* int: POSIX2_TZNAME_MAX */ #define USER_MAXID 21 /* number of valid user ids */ #define CTL_USER_NAMES { \ { 0, 0 }, \ { "cs_path", CTLTYPE_STRING }, \ { "bc_base_max", CTLTYPE_INT }, \ { "bc_dim_max", CTLTYPE_INT }, \ { "bc_scale_max", CTLTYPE_INT }, \ { "bc_string_max", CTLTYPE_INT }, \ { "coll_weights_max", CTLTYPE_INT }, \ { "expr_nest_max", CTLTYPE_INT }, \ { "line_max", CTLTYPE_INT }, \ { "re_dup_max", CTLTYPE_INT }, \ { "posix2_version", CTLTYPE_INT }, \ { "posix2_c_bind", CTLTYPE_INT }, \ { "posix2_c_dev", CTLTYPE_INT }, \ { "posix2_char_term", CTLTYPE_INT }, \ { "posix2_fort_dev", CTLTYPE_INT }, \ { "posix2_fort_run", CTLTYPE_INT }, \ { "posix2_localedef", CTLTYPE_INT }, \ { "posix2_sw_dev", CTLTYPE_INT }, \ { "posix2_upe", CTLTYPE_INT }, \ { "stream_max", CTLTYPE_INT }, \ { "tzname_max", CTLTYPE_INT } \ } /* * CTL_DEBUG definitions * * Second level identifier specifies which debug variable. * Third level identifier specifies which stucture component. */ #define CTL_DEBUG_NAME 0 /* string: variable name */ #define CTL_DEBUG_VALUE 1 /* int: variable value */ #define CTL_DEBUG_MAXID 20 #if (CTL_MAXID != 9) || (KERN_MAXID != 72) || (VM_MAXID != 6) || (HW_MAXID != 28) || (USER_MAXID != 21) || (CTL_DEBUG_MAXID != 20) #error Use the SYSCTL_*() macros and OID_AUTO instead! #endif __BEGIN_DECLS int sysctl(int *, u_int, void *, size_t *, void *, size_t); int sysctlbyname(const char *, void *, size_t *, void *, size_t); int sysctlnametomib(const char *, int *, size_t *); __END_DECLS #endif /* SYSCTL_DEF_ENABLED */ #endif /* !_SYS_SYSCTL_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/syslimits.h ================================================ /* * 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@ */ /* $NetBSD: syslimits.h,v 1.15 1997/06/25 00:48:09 lukem Exp $ */ /* * 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. * * @(#)syslimits.h 8.1 (Berkeley) 6/2/93 */ #ifndef _SYS_SYSLIMITS_H_ #define _SYS_SYSLIMITS_H_ #include #if !defined(_ANSI_SOURCE) /* max bytes for an exec function */ #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) #define ARG_MAX (1024 * 1024) #else #define ARG_MAX (256 * 1024) #endif /* * Note: CHILD_MAX *must* be less than hard_maxproc, which is set at * compile time; you *cannot* set it higher than the hard limit!! */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define CHILD_MAX 266 /* max simultaneous processes */ #define GID_MAX 2147483647U /* max value for a gid_t (2^31-2) */ #endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */ #define LINK_MAX 32767 /* max file link count */ #define MAX_CANON 1024 /* max bytes in term canon input line */ #define MAX_INPUT 1024 /* max bytes in terminal input */ #define NAME_MAX 255 /* max bytes in a file name */ #define NGROUPS_MAX 16 /* max supplemental group id's */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define UID_MAX 2147483647U /* max value for a uid_t (2^31-2) */ #define OPEN_MAX 10240 /* max open files per process - todo, make a config option? */ #endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */ #define PATH_MAX 1024 /* max bytes in pathname */ #define PIPE_BUF 512 /* max bytes for atomic pipe writes */ #define BC_BASE_MAX 99 /* max ibase/obase values in bc(1) */ #define BC_DIM_MAX 2048 /* max array elements in bc(1) */ #define BC_SCALE_MAX 99 /* max scale value in bc(1) */ #define BC_STRING_MAX 1000 /* max const string length in bc(1) */ #define CHARCLASS_NAME_MAX 14 /* max character class name size */ #define COLL_WEIGHTS_MAX 2 /* max weights for order keyword */ #define EQUIV_CLASS_MAX 2 #define EXPR_NEST_MAX 32 /* max expressions nested in expr(1) */ #define LINE_MAX 2048 /* max bytes in an input line */ #define RE_DUP_MAX 255 /* max RE's in interval notation */ #if __DARWIN_UNIX03 #define NZERO 20 /* default priority [XSI] */ /* = ((PRIO_MAX - PRIO_MIN) / 2) + 1 */ /* range: 0 - 39 [(2 * NZERO) - 1] */ /* 0 is not actually used */ #else /* !__DARWIN_UNIX03 */ #define NZERO 0 /* default priority */ /* range: -20 - 20 */ /* (PRIO_MIN - PRIO_MAX) */ #endif /* __DARWIN_UNIX03 */ #endif /* !_ANSI_SOURCE */ #endif /* !_SYS_SYSLIMITS_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/syslog.h ================================================ /* * 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@ */ /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */ /*- * Copyright (c) 1982, 1986, 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. * 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. * * @(#)syslog.h 8.1 (Berkeley) 6/2/93 * $FreeBSD: src/sys/sys/syslog.h,v 1.27.2.1.4.1 2010/06/14 02:09:06 kensmith Exp $ */ #ifndef _SYS_SYSLOG_H_ #define _SYS_SYSLOG_H_ #include #include #define _PATH_LOG "/var/run/syslog" /* * priorities/facilities are encoded into a single 32-bit quantity, where the * bottom 3 bits are the priority (0-7) and the top 28 bits are the facility * (0-big number). Both the priorities and the facilities map roughly * one-to-one to strings in the syslogd(8) source code. This mapping is * included in this file. * * priorities (these are ordered) */ #define LOG_EMERG 0 /* system is unusable */ #define LOG_ALERT 1 /* action must be taken immediately */ #define LOG_CRIT 2 /* critical conditions */ #define LOG_ERR 3 /* error conditions */ #define LOG_WARNING 4 /* warning conditions */ #define LOG_NOTICE 5 /* normal but significant condition */ #define LOG_INFO 6 /* informational */ #define LOG_DEBUG 7 /* debug-level messages */ #define LOG_PRIMASK 0x07 /* mask to extract priority part (internal) */ /* extract priority */ #define LOG_PRI(p) ((p) & LOG_PRIMASK) #define LOG_MAKEPRI(fac, pri) ((fac) | (pri)) #ifdef SYSLOG_NAMES #define INTERNAL_NOPRI 0x10 /* the "no priority" priority */ /* mark "facility" */ #define INTERNAL_MARK LOG_MAKEPRI((LOG_NFACILITIES<<3), 0) typedef struct _code { const char *c_name; int c_val; } CODE; CODE prioritynames[] = { { "alert", LOG_ALERT, }, { "crit", LOG_CRIT, }, { "debug", LOG_DEBUG, }, { "emerg", LOG_EMERG, }, { "err", LOG_ERR, }, { "error", LOG_ERR, }, /* DEPRECATED */ { "info", LOG_INFO, }, { "none", INTERNAL_NOPRI, }, /* INTERNAL */ { "notice", LOG_NOTICE, }, { "panic", LOG_EMERG, }, /* DEPRECATED */ { "warn", LOG_WARNING, }, /* DEPRECATED */ { "warning", LOG_WARNING, }, { NULL, -1, } }; #endif /* facility codes */ #define LOG_KERN (0<<3) /* kernel messages */ #define LOG_USER (1<<3) /* random user-level messages */ #define LOG_MAIL (2<<3) /* mail system */ #define LOG_DAEMON (3<<3) /* system daemons */ #define LOG_AUTH (4<<3) /* authorization messages */ #define LOG_SYSLOG (5<<3) /* messages generated internally by syslogd */ #define LOG_LPR (6<<3) /* line printer subsystem */ #define LOG_NEWS (7<<3) /* network news subsystem */ #define LOG_UUCP (8<<3) /* UUCP subsystem */ #define LOG_CRON (9<<3) /* clock daemon */ #define LOG_AUTHPRIV (10<<3) /* authorization messages (private) */ /* Facility #10 clashes in DEC UNIX, where */ /* it's defined as LOG_MEGASAFE for AdvFS */ /* event logging. */ #define LOG_FTP (11<<3) /* ftp daemon */ //#define LOG_NTP (12<<3) /* NTP subsystem */ //#define LOG_SECURITY (13<<3) /* security subsystems (firewalling, etc.) */ //#define LOG_CONSOLE (14<<3) /* /dev/console output */ #define LOG_NETINFO (12<<3) /* NetInfo */ #define LOG_REMOTEAUTH (13<<3) /* remote authentication/authorization */ #define LOG_INSTALL (14<<3) /* installer subsystem */ #define LOG_RAS (15<<3) /* Remote Access Service (VPN / PPP) */ /* other codes through 15 reserved for system use */ #define LOG_LOCAL0 (16<<3) /* reserved for local use */ #define LOG_LOCAL1 (17<<3) /* reserved for local use */ #define LOG_LOCAL2 (18<<3) /* reserved for local use */ #define LOG_LOCAL3 (19<<3) /* reserved for local use */ #define LOG_LOCAL4 (20<<3) /* reserved for local use */ #define LOG_LOCAL5 (21<<3) /* reserved for local use */ #define LOG_LOCAL6 (22<<3) /* reserved for local use */ #define LOG_LOCAL7 (23<<3) /* reserved for local use */ #define LOG_LAUNCHD (24<<3) /* launchd - general bootstrap daemon */ #define LOG_NFACILITIES 25 /* current number of facilities */ #define LOG_FACMASK 0x03f8 /* mask to extract facility part */ /* facility of pri */ #define LOG_FAC(p) (((p) & LOG_FACMASK) >> 3) #ifdef SYSLOG_NAMES CODE facilitynames[] = { { "auth", LOG_AUTH, }, { "authpriv", LOG_AUTHPRIV, }, { "cron", LOG_CRON, }, { "daemon", LOG_DAEMON, }, { "ftp", LOG_FTP, }, { "install", LOG_INSTALL }, { "kern", LOG_KERN, }, { "lpr", LOG_LPR, }, { "mail", LOG_MAIL, }, { "mark", INTERNAL_MARK, }, /* INTERNAL */ { "netinfo", LOG_NETINFO, }, { "ras", LOG_RAS }, { "remoteauth", LOG_REMOTEAUTH }, { "news", LOG_NEWS, }, { "security", LOG_AUTH }, /* DEPRECATED */ { "syslog", LOG_SYSLOG, }, { "user", LOG_USER, }, { "uucp", LOG_UUCP, }, { "local0", LOG_LOCAL0, }, { "local1", LOG_LOCAL1, }, { "local2", LOG_LOCAL2, }, { "local3", LOG_LOCAL3, }, { "local4", LOG_LOCAL4, }, { "local5", LOG_LOCAL5, }, { "local6", LOG_LOCAL6, }, { "local7", LOG_LOCAL7, }, { "launchd", LOG_LAUNCHD }, { NULL, -1, } }; #endif /* * arguments to setlogmask. */ #define LOG_MASK(pri) (1 << (pri)) /* mask for one priority */ #define LOG_UPTO(pri) ((1 << ((pri)+1)) - 1) /* all priorities through pri */ /* * Option flags for openlog. * * LOG_ODELAY no longer does anything. * LOG_NDELAY is the inverse of what it used to be. */ #define LOG_PID 0x01 /* log the pid with each message */ #define LOG_CONS 0x02 /* log on the console if errors in sending */ #define LOG_ODELAY 0x04 /* delay open until first syslog() (default) */ #define LOG_NDELAY 0x08 /* don't delay open */ #define LOG_NOWAIT 0x10 /* don't wait for console forks: DEPRECATED */ #define LOG_PERROR 0x20 /* log to stderr as well */ /* * Don't use va_list in the vsyslog() prototype. Va_list is typedef'd in two * places ( and ), so if we include one * of them here we may collide with the utility's includes. It's unreasonable * for utilities to have to include one of them to include syslog.h, so we get * __va_list from and use it. */ #include __BEGIN_DECLS void closelog(void); void openlog(const char *, int, int); int setlogmask(int); #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __DARWIN_C_LEVEL >= __DARWIN_C_FULL void syslog(int, const char *, ...) __DARWIN_ALIAS_STARTING(__MAC_10_13, __IPHONE_NA, __DARWIN_EXTSN(syslog)) __printflike(2, 3) __not_tail_called; #else void syslog(int, const char *, ...) __printflike(2, 3) __not_tail_called; #endif #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL void vsyslog(int, const char *, __darwin_va_list) __printflike(2, 0) __not_tail_called; #endif __END_DECLS #endif /* !_SYS_SYSLOG_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/termios.h ================================================ /* * 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@ */ /* Copyright (c) 1997 Apple Computer, Inc. All Rights Reserved */ /* * Copyright (c) 1988, 1989, 1993, 1994 * 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. * * @(#)termios.h 8.3 (Berkeley) 3/28/94 */ #ifndef _SYS_TERMIOS_H_ #define _SYS_TERMIOS_H_ #include /* * Special Control Characters * * Index into c_cc[] character array. * * Name Subscript Enabled by */ #define VEOF 0 /* ICANON */ #define VEOL 1 /* ICANON */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define VEOL2 2 /* ICANON together with IEXTEN */ #endif #define VERASE 3 /* ICANON */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define VWERASE 4 /* ICANON together with IEXTEN */ #endif #define VKILL 5 /* ICANON */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define VREPRINT 6 /* ICANON together with IEXTEN */ #endif /* 7 spare 1 */ #define VINTR 8 /* ISIG */ #define VQUIT 9 /* ISIG */ #define VSUSP 10 /* ISIG */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define VDSUSP 11 /* ISIG together with IEXTEN */ #endif #define VSTART 12 /* IXON, IXOFF */ #define VSTOP 13 /* IXON, IXOFF */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define VLNEXT 14 /* IEXTEN */ #define VDISCARD 15 /* IEXTEN */ #endif #define VMIN 16 /* !ICANON */ #define VTIME 17 /* !ICANON */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define VSTATUS 18 /* ICANON together with IEXTEN */ /* 19 spare 2 */ #endif #define NCCS 20 #include #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define CCEQ(val, c) ((c) == (val) ? (val) != _POSIX_VDISABLE : 0) #endif /* * Input flags - software input processing */ #define IGNBRK 0x00000001 /* ignore BREAK condition */ #define BRKINT 0x00000002 /* map BREAK to SIGINTR */ #define IGNPAR 0x00000004 /* ignore (discard) parity errors */ #define PARMRK 0x00000008 /* mark parity and framing errors */ #define INPCK 0x00000010 /* enable checking of parity errors */ #define ISTRIP 0x00000020 /* strip 8th bit off chars */ #define INLCR 0x00000040 /* map NL into CR */ #define IGNCR 0x00000080 /* ignore CR */ #define ICRNL 0x00000100 /* map CR to NL (ala CRMOD) */ #define IXON 0x00000200 /* enable output flow control */ #define IXOFF 0x00000400 /* enable input flow control */ #define IXANY 0x00000800 /* any char will restart after stop */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define IMAXBEL 0x00002000 /* ring bell on input queue full */ #define IUTF8 0x00004000 /* maintain state for UTF-8 VERASE */ #endif /*(_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */ /* * Output flags - software output processing */ #define OPOST 0x00000001 /* enable following output processing */ #define ONLCR 0x00000002 /* map NL to CR-NL (ala CRMOD) */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define OXTABS 0x00000004 /* expand tabs to spaces */ #define ONOEOT 0x00000008 /* discard EOT's (^D) on output) */ #endif /*(_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */ /* * The following block of features is unimplemented. Use of these flags in * programs will currently result in unexpected behaviour. * * - Begin unimplemented features */ #define OCRNL 0x00000010 /* map CR to NL on output */ #define ONOCR 0x00000020 /* no CR output at column 0 */ #define ONLRET 0x00000040 /* NL performs CR function */ #define OFILL 0x00000080 /* use fill characters for delay */ #define NLDLY 0x00000300 /* \n delay */ #define TABDLY 0x00000c04 /* horizontal tab delay */ #define CRDLY 0x00003000 /* \r delay */ #define FFDLY 0x00004000 /* form feed delay */ #define BSDLY 0x00008000 /* \b delay */ #define VTDLY 0x00010000 /* vertical tab delay */ #define OFDEL 0x00020000 /* fill is DEL, else NUL */ #if !defined(_SYS_IOCTL_COMPAT_H_) || __DARWIN_UNIX03 /* * These manifest constants have the same names as those in the header * , so you are not permitted to have both definitions * in scope simultaneously in the same compilation unit. Nevertheless, * they are required to be in scope when _POSIX_C_SOURCE is requested; * this means that including the header before this * one when _POSIX_C_SOURCE is in scope will result in redefintions. We * attempt to maintain these as the same values so as to avoid this being * an outright error in most compilers. */ #define NL0 0x00000000 #define NL1 0x00000100 #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define NL2 0x00000200 #define NL3 0x00000300 #endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */ #define TAB0 0x00000000 #define TAB1 0x00000400 #define TAB2 0x00000800 /* not in sys/ioctl_compat.h, use OXTABS value */ #define TAB3 0x00000004 #define CR0 0x00000000 #define CR1 0x00001000 #define CR2 0x00002000 #define CR3 0x00003000 #define FF0 0x00000000 #define FF1 0x00004000 #define BS0 0x00000000 #define BS1 0x00008000 #define VT0 0x00000000 #define VT1 0x00010000 #endif /* !_SYS_IOCTL_COMPAT_H_ */ /* * + End unimplemented features */ /* * Control flags - hardware control of terminal */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define CIGNORE 0x00000001 /* ignore control flags */ #endif #define CSIZE 0x00000300 /* character size mask */ #define CS5 0x00000000 /* 5 bits (pseudo) */ #define CS6 0x00000100 /* 6 bits */ #define CS7 0x00000200 /* 7 bits */ #define CS8 0x00000300 /* 8 bits */ #define CSTOPB 0x00000400 /* send 2 stop bits */ #define CREAD 0x00000800 /* enable receiver */ #define PARENB 0x00001000 /* parity enable */ #define PARODD 0x00002000 /* odd parity, else even */ #define HUPCL 0x00004000 /* hang up on last close */ #define CLOCAL 0x00008000 /* ignore modem status lines */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define CCTS_OFLOW 0x00010000 /* CTS flow control of output */ #define CRTSCTS (CCTS_OFLOW | CRTS_IFLOW) #define CRTS_IFLOW 0x00020000 /* RTS flow control of input */ #define CDTR_IFLOW 0x00040000 /* DTR flow control of input */ #define CDSR_OFLOW 0x00080000 /* DSR flow control of output */ #define CCAR_OFLOW 0x00100000 /* DCD flow control of output */ #define MDMBUF 0x00100000 /* old name for CCAR_OFLOW */ #endif /* * "Local" flags - dumping ground for other state * * Warning: some flags in this structure begin with * the letter "I" and look like they belong in the * input flag. */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define ECHOKE 0x00000001 /* visual erase for line kill */ #endif /*(_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */ #define ECHOE 0x00000002 /* visually erase chars */ #define ECHOK 0x00000004 /* echo NL after line kill */ #define ECHO 0x00000008 /* enable echoing */ #define ECHONL 0x00000010 /* echo NL even if ECHO is off */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define ECHOPRT 0x00000020 /* visual erase mode for hardcopy */ #define ECHOCTL 0x00000040 /* echo control chars as ^(Char) */ #endif /*(_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */ #define ISIG 0x00000080 /* enable signals INTR, QUIT, [D]SUSP */ #define ICANON 0x00000100 /* canonicalize input lines */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define ALTWERASE 0x00000200 /* use alternate WERASE algorithm */ #endif /*(_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */ #define IEXTEN 0x00000400 /* enable DISCARD and LNEXT */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define EXTPROC 0x00000800 /* external processing */ #endif /*(_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */ #define TOSTOP 0x00400000 /* stop background jobs from output */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define FLUSHO 0x00800000 /* output being flushed (state) */ #define NOKERNINFO 0x02000000 /* no kernel output from VSTATUS */ #define PENDIN 0x20000000 /* XXX retype pending input (state) */ #endif /*(_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */ #define NOFLSH 0x80000000 /* don't flush after interrupt */ typedef unsigned long tcflag_t; typedef unsigned char cc_t; typedef unsigned long speed_t; struct termios { tcflag_t c_iflag; /* input flags */ tcflag_t c_oflag; /* output flags */ tcflag_t c_cflag; /* control flags */ tcflag_t c_lflag; /* local flags */ cc_t c_cc[NCCS]; /* control chars */ speed_t c_ispeed; /* input speed */ speed_t c_ospeed; /* output speed */ }; /* * Commands passed to tcsetattr() for setting the termios structure. */ #define TCSANOW 0 /* make change immediate */ #define TCSADRAIN 1 /* drain output, then change */ #define TCSAFLUSH 2 /* drain output, flush input */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define TCSASOFT 0x10 /* flag - don't alter h.w. state */ #endif /* * Standard speeds */ #define B0 0 #define B50 50 #define B75 75 #define B110 110 #define B134 134 #define B150 150 #define B200 200 #define B300 300 #define B600 600 #define B1200 1200 #define B1800 1800 #define B2400 2400 #define B4800 4800 #define B9600 9600 #define B19200 19200 #define B38400 38400 #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define B7200 7200 #define B14400 14400 #define B28800 28800 #define B57600 57600 #define B76800 76800 #define B115200 115200 #define B230400 230400 #define EXTA 19200 #define EXTB 38400 #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ #define TCIFLUSH 1 #define TCOFLUSH 2 #define TCIOFLUSH 3 #define TCOOFF 1 #define TCOON 2 #define TCIOFF 3 #define TCION 4 #include __BEGIN_DECLS speed_t cfgetispeed(const struct termios *); speed_t cfgetospeed(const struct termios *); int cfsetispeed(struct termios *, speed_t); int cfsetospeed(struct termios *, speed_t); int tcgetattr(int, struct termios *); int tcsetattr(int, int, const struct termios *); int tcdrain(int) __DARWIN_ALIAS_C(tcdrain); int tcflow(int, int); int tcflush(int, int); int tcsendbreak(int, int); #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) void cfmakeraw(struct termios *); int cfsetspeed(struct termios *, speed_t); #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ __END_DECLS #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) /* * Include tty ioctl's that aren't just for backwards compatibility * with the old tty driver. These ioctl definitions were previously * in . */ #include #endif /* * END OF PROTECTED INCLUDE. */ #endif /* !_SYS_TERMIOS_H_ */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #include #endif ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/time.h ================================================ /* * 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@ */ /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */ /* * Copyright (c) 1982, 1986, 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. * * @(#)time.h 8.2 (Berkeley) 7/10/94 */ #ifndef _SYS_TIME_H_ #define _SYS_TIME_H_ #include #include #include /* * [XSI] The fd_set type shall be defined as described in . * The timespec structure shall be defined as described in */ #include #include #include #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #include #endif /* !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) */ #include #include /* * Structure used as a parameter by getitimer(2) and setitimer(2) system * calls. */ struct itimerval { struct timeval it_interval; /* timer interval */ struct timeval it_value; /* current value */ }; /* * Names of the interval timers, and structure * defining a timer setting. */ #define ITIMER_REAL 0 #define ITIMER_VIRTUAL 1 #define ITIMER_PROF 2 /* * Select uses bit masks of file descriptors in longs. These macros * manipulate such bit fields (the filesystem macros use chars). The * extra protection here is to permit application redefinition above * the default size. */ #include #include #include #include #include #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #include #define TIMEVAL_TO_TIMESPEC(tv, ts) { \ (ts)->tv_sec = (tv)->tv_sec; \ (ts)->tv_nsec = (tv)->tv_usec * 1000; \ } #define TIMESPEC_TO_TIMEVAL(tv, ts) { \ (tv)->tv_sec = (ts)->tv_sec; \ (tv)->tv_usec = (ts)->tv_nsec / 1000; \ } struct timezone { int tz_minuteswest; /* minutes west of Greenwich */ int tz_dsttime; /* type of dst correction */ }; #define DST_NONE 0 /* not on dst */ #define DST_USA 1 /* USA style dst */ #define DST_AUST 2 /* Australian style dst */ #define DST_WET 3 /* Western European dst */ #define DST_MET 4 /* Middle European dst */ #define DST_EET 5 /* Eastern European dst */ #define DST_CAN 6 /* Canada */ /* Operations on timevals. */ #define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0 #define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec) #define timercmp(tvp, uvp, cmp) \ (((tvp)->tv_sec == (uvp)->tv_sec) ? \ ((tvp)->tv_usec cmp (uvp)->tv_usec) : \ ((tvp)->tv_sec cmp (uvp)->tv_sec)) #define timeradd(tvp, uvp, vvp) \ do { \ (vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec; \ (vvp)->tv_usec = (tvp)->tv_usec + (uvp)->tv_usec; \ if ((vvp)->tv_usec >= 1000000) { \ (vvp)->tv_sec++; \ (vvp)->tv_usec -= 1000000; \ } \ } while (0) #define timersub(tvp, uvp, vvp) \ do { \ (vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \ (vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \ if ((vvp)->tv_usec < 0) { \ (vvp)->tv_sec--; \ (vvp)->tv_usec += 1000000; \ } \ } while (0) #define timevalcmp(l, r, cmp) timercmp(l, r, cmp) /* freebsd */ /* * Getkerninfo clock information structure */ struct clockinfo { int hz; /* clock frequency */ int tick; /* micro-seconds per hz tick */ int tickadj; /* clock skew rate for adjtime() */ int stathz; /* statistics clock frequency */ int profhz; /* profiling clock frequency */ }; #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #include #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ __BEGIN_DECLS #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) int adjtime(const struct timeval *, struct timeval *); int futimes(int, const struct timeval *); int lutimes(const char *, const struct timeval *) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0); int settimeofday(const struct timeval *, const struct timezone *); #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ int getitimer(int, struct itimerval *); int gettimeofday(struct timeval * __restrict, void * __restrict); #include /* select() prototype */ int setitimer(int, const struct itimerval * __restrict, struct itimerval * __restrict); int utimes(const char *, const struct timeval *); __END_DECLS #endif /* !_SYS_TIME_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/timeb.h ================================================ /* * 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@ */ /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */ /*- * Copyright (c) 1991, 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. * * @(#)timeb.h 8.2 (Berkeley) 1/21/94 */ #ifndef _SYS_TIMEB_H_ #define _SYS_TIMEB_H_ #include #include #include /* [XSI] The time_t type shall be defined as described in */ #include /* * [XSI] Structure whose address is passed as the first parameter to ftime() */ struct timeb { time_t time; /* [XSI] Seconds since the Epoch */ unsigned short millitm; /* [XSI] Milliseconds since the Epoch */ short timezone; /* [XSI] Minutes west of CUT */ short dstflag; /* [XSI] non-zero if DST in effect */ }; __BEGIN_DECLS /* [XSI] Legacy interface */ int ftime(struct timeb *); __END_DECLS #endif /* !_SYS_TIMEB_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/times.h ================================================ /* * 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@ */ /* Copyright (c) 1995 NeXT Computer, 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. * * @(#)times.h 8.4 (Berkeley) 1/21/94 */ #ifndef _SYS_TIMES_H_ #define _SYS_TIMES_H_ #include #include #include /* [XSI] The clock_t type shall be defined as described in */ #include /* * [XSI] Structure whose address is passed as the first parameter to times() */ struct tms { clock_t tms_utime; /* [XSI] User CPU time */ clock_t tms_stime; /* [XSI] System CPU time */ clock_t tms_cutime; /* [XSI] Terminated children user CPU time */ clock_t tms_cstime; /* [XSI] Terminated children System CPU time */ }; __BEGIN_DECLS clock_t times(struct tms *); __END_DECLS #endif /* !_SYS_TIMES_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/timex.h ================================================ /*- *********************************************************************** * * * Copyright (c) David L. Mills 1993-2001 * * Copyright (c) Poul-Henning Kamp 2000-2001 * * * * Permission to use, copy, modify, and distribute this software and * * its documentation for any purpose and without fee is hereby * * granted, provided that the above copyright notice appears in all * * copies and that both the copyright notice and this permission * * notice appear in supporting documentation, and that the name * * University of Delaware not be used in advertising or publicity * * pertaining to distribution of the software without specific, * * written prior permission. The University of Delaware makes no * * representations about the suitability this software for any * * purpose. It is provided "as is" without express or implied * * warranty. * * * *********************************************************************** * * $FreeBSD$ * * This header file defines the Network Time Protocol (NTP) interfaces * for user and daemon application programs. * * This file was originally created 17 Sep 93 by David L. Mills, Professor * of University of Delaware, building on work which had already been ongoing * for a decade and a half at that point in time. * * In 2000 the APIs got a upgrade from microseconds to nanoseconds, * a joint work between Poul-Henning Kamp and David L. Mills. * */ /* * Copyright (c) 2017 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 _SYS_TIMEX_H_ #define _SYS_TIMEX_H_ 1 #include #define NTP_API 4 /* NTP API version */ /* * The following defines establish the performance envelope of the * kernel discipline loop. Phase or frequency errors greater than * NAXPHASE or MAXFREQ are clamped to these maxima. For update intervals * less than MINSEC, the loop always operates in PLL mode; while, for * update intervals greater than MAXSEC, the loop always operates in FLL * mode. Between these two limits the operating mode is selected by the * STA_FLL bit in the status word. */ #define MAXPHASE 500000000L /* max phase error (ns) */ #define MAXFREQ 500000L /* max freq error (ns/s) */ #define MINSEC 256 /* min FLL update interval (s) */ #define MAXSEC 2048 /* max PLL update interval (s) */ #define NANOSECOND 1000000000L /* nanoseconds in one second */ #define SCALE_PPM (65536 / 1000) /* crude ns/s to scaled PPM */ #define MAXTC 10 /* max time constant */ /* Codes for PPS (pulse-per-second) signals or leap seconds are not used but kept * unchanged and commented for future compatibility. */ /* * Control mode codes (timex.modes) */ #define MOD_OFFSET 0x0001 /* set time offset */ #define MOD_FREQUENCY 0x0002 /* set frequency offset */ #define MOD_MAXERROR 0x0004 /* set maximum time error */ #define MOD_ESTERROR 0x0008 /* set estimated time error */ #define MOD_STATUS 0x0010 /* set clock status bits */ #define MOD_TIMECONST 0x0020 /* set PLL time constant */ #define MOD_PPSMAX 0x0040 /* set PPS maximum averaging time */ #define MOD_TAI 0x0080 /* set TAI offset */ #define MOD_MICRO 0x1000 /* select microsecond resolution */ #define MOD_NANO 0x2000 /* select nanosecond resolution */ #define MOD_CLKB 0x4000 /* select clock B */ #define MOD_CLKA 0x8000 /* select clock A */ /* * Status codes (timex.status) */ #define STA_PLL 0x0001 /* enable PLL updates (rw) */ #define STA_PPSFREQ 0x0002 /* enable PPS freq discipline (rw) */ #define STA_PPSTIME 0x0004 /* enable PPS time discipline (rw) */ #define STA_FLL 0x0008 /* enable FLL mode (rw) */ #define STA_INS 0x0010 /* insert leap (rw) */ #define STA_DEL 0x0020 /* delete leap (rw) */ #define STA_UNSYNC 0x0040 /* clock unsynchronized (rw) */ #define STA_FREQHOLD 0x0080 /* hold frequency (rw) */ #define STA_PPSSIGNAL 0x0100 /* PPS signal present (ro) */ #define STA_PPSJITTER 0x0200 /* PPS signal jitter exceeded (ro) */ #define STA_PPSWANDER 0x0400 /* PPS signal wander exceeded (ro) */ #define STA_PPSERROR 0x0800 /* PPS signal calibration error (ro) */ #define STA_CLOCKERR 0x1000 /* clock hardware fault (ro) */ #define STA_NANO 0x2000 /* resolution (0 = us, 1 = ns) (ro) */ #define STA_MODE 0x4000 /* mode (0 = PLL, 1 = FLL) (ro) */ #define STA_CLK 0x8000 /* clock source (0 = A, 1 = B) (ro) */ #define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER | \ STA_PPSERROR | STA_CLOCKERR | STA_NANO | STA_MODE | STA_CLK) #define STA_SUPPORTED (STA_PLL | STA_FLL | STA_UNSYNC | STA_FREQHOLD | \ STA_CLOCKERR | STA_NANO | STA_MODE | STA_CLK) /* * Clock states (ntptimeval.time_state) */ #define TIME_OK 0 /* no leap second warning */ #define TIME_INS 1 /* insert leap second warning */ #define TIME_DEL 2 /* delete leap second warning */ #define TIME_OOP 3 /* leap second in progress */ #define TIME_WAIT 4 /* leap second has occurred */ #define TIME_ERROR 5 /* error (see status word) */ /* * NTP user interface -- ntp_gettime - used to read kernel clock values */ struct ntptimeval { struct timespec time; /* current time (ns) (ro) */ long maxerror; /* maximum error (us) (ro) */ long esterror; /* estimated error (us) (ro) */ long tai; /* TAI offset */ int time_state; /* time status */ }; /* * NTP daemon interface -- ntp_adjtime -- used to discipline CPU clock * oscillator and control/determine status. * * Note: The offset, precision and jitter members are in microseconds if * STA_NANO is zero and nanoseconds if not. */ struct timex { unsigned int modes; /* clock mode bits (wo) */ long offset; /* time offset (ns/us) (rw) */ long freq; /* frequency offset (scaled PPM) (rw) */ long maxerror; /* maximum error (us) (rw) */ long esterror; /* estimated error (us) (rw) */ int status; /* clock status bits (rw) */ long constant; /* poll interval (log2 s) (rw) */ long precision; /* clock precision (ns/us) (ro) */ long tolerance; /* clock frequency tolerance (scaled * PPM) (ro) */ /* * The following read-only structure members are used by * the PPS signal discipline that is currently not supported. * They are included for compatibility. */ long ppsfreq; /* PPS frequency (scaled PPM) (ro) */ long jitter; /* PPS jitter (ns/us) (ro) */ int shift; /* interval duration (s) (shift) (ro) */ long stabil; /* PPS stability (scaled PPM) (ro) */ long jitcnt; /* jitter limit exceeded (ro) */ long calcnt; /* calibration intervals (ro) */ long errcnt; /* calibration errors (ro) */ long stbcnt; /* stability limit exceeded (ro) */ }; #include __BEGIN_DECLS #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) int ntp_adjtime(struct timex *); int ntp_gettime(struct ntptimeval *); #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ __END_DECLS #endif /* !_SYS_TIMEX_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/tprintf.h ================================================ /* * 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@ */ /* Copyright (c) 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. * * @(#)tprintf.h 8.1 (Berkeley) 6/2/93 */ #ifndef _SYS_TPRINTF_H_ #define _SYS_TPRINTF_H_ #include #include #ifdef __APPLE_API_UNSTABLE struct proc; typedef struct pgrp *tpr_t; __BEGIN_DECLS tpr_t tprintf_open(struct proc *); void tprintf_close(tpr_t); void tprintf(tpr_t, const char *fmt, ...) __printflike(2, 3); __END_DECLS #endif /* __APPLE_API_UNSTABLE */ #endif /* !_SYS_TPRINTF_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/trace.h ================================================ /* * 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@ */ /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */ /*- * Copyright (c) 1982, 1986, 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. * * @(#)trace.h 8.1 (Berkeley) 6/2/93 */ #ifndef _SYS_TRACE_H_ #define _SYS_TRACE_H_ #include #ifdef __APPLE_API_OBSOLETE /* * File system buffer tracing points; all trace */ #define TR_BREADHIT 0 /* buffer read found in cache */ #define TR_BREADMISS 1 /* buffer read not in cache */ #define TR_BWRITE 2 /* buffer written */ #define TR_BREADHITRA 3 /* buffer read-ahead found in cache */ #define TR_BREADMISSRA 4 /* buffer read-ahead not in cache */ #define TR_XFODMISS 5 /* exe fod read */ #define TR_XFODHIT 6 /* exe fod read */ #define TR_BRELSE 7 /* brelse */ #define TR_BREALLOC 8 /* expand/contract a buffer */ /* * Memory allocator trace points; all trace the amount of memory involved */ #define TR_MALL 10 /* memory allocated */ /* * Paging trace points: all are */ #define TR_INTRANS 20 /* page intransit block */ #define TR_EINTRANS 21 /* page intransit wait done */ #define TR_FRECLAIM 22 /* reclaim from free list */ #define TR_RECLAIM 23 /* reclaim from loop */ #define TR_XSFREC 24 /* reclaim from free list instead of drum */ #define TR_XIFREC 25 /* reclaim from free list instead of fsys */ #define TR_WAITMEM 26 /* wait for memory in pagein */ #define TR_EWAITMEM 27 /* end memory wait in pagein */ #define TR_ZFOD 28 /* zfod page fault */ #define TR_EXFOD 29 /* exec fod page fault */ #define TR_VRFOD 30 /* vread fod page fault */ #define TR_CACHEFOD 31 /* fod in file system cache */ #define TR_SWAPIN 32 /* drum page fault */ #define TR_PGINDONE 33 /* page in done */ #define TR_SWAPIO 34 /* swap i/o request arrives */ /* * System call trace points. */ #define TR_VADVISE 40 /* vadvise occurred with */ /* * Miscellaneous */ #define TR_STAMP 45 /* user said vtrace(VTR_STAMP, value); */ /* * This defines the size of the trace flags array. */ #define TR_NFLAGS 100 /* generous */ #define TRCSIZ 4096 /* * Specifications of the vtrace() system call, which takes one argument. */ #define VTRACE 64+51 #define VTR_DISABLE 0 /* set a trace flag to 0 */ #define VTR_ENABLE 1 /* set a trace flag to 1 */ #define VTR_VALUE 2 /* return value of a trace flag */ #define VTR_UALARM 3 /* set alarm to go off (sig 16) */ /* in specified number of hz */ #define VTR_STAMP 4 /* user specified stamp */ #endif /* __APPLE_API_OBSOLETE */ #endif /* !_SYS_TRACE_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/tty.h ================================================ /* * 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@ */ /* Copyright (c) 1997 Apple Computer, Inc. All Rights Reserved */ /*- * Copyright (c) 1982, 1986, 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. * * @(#)tty.h 8.6 (Berkeley) 1/21/94 */ #ifndef _SYS_TTY_H_ #define _SYS_TTY_H_ #include #include #include #include /* For struct selinfo. */ struct tty; struct clist; /* These flags are kept in t_state. */ #define TS_SO_OLOWAT 0x00001 /* Wake up when output <= low water. */ #define TS_ASYNC 0x00002 /* Tty in async I/O mode. */ #define TS_BUSY 0x00004 /* Draining output. */ #define TS_CARR_ON 0x00008 /* Carrier is present. */ #define TS_FLUSH 0x00010 /* Outq has been flushed during DMA. */ #define TS_ISOPEN 0x00020 /* Open has completed. */ #define TS_TBLOCK 0x00040 /* Further input blocked. */ #define TS_TIMEOUT 0x00080 /* Wait for output char processing. */ #define TS_TTSTOP 0x00100 /* Output paused. */ #ifdef notyet #define TS_WOPEN 0x00200 /* Open in progress. */ #endif #define TS_XCLUDE 0x00400 /* Tty requires exclusivity. */ /* State for intra-line fancy editing work. */ #define TS_BKSL 0x00800 /* State for lowercase \ work. */ #define TS_CNTTB 0x01000 /* Counting tab width, ignore FLUSHO. */ #define TS_ERASE 0x02000 /* Within a \.../ for PRTRUB. */ #define TS_LNCH 0x04000 /* Next character is literal. */ #define TS_TYPEN 0x08000 /* Retyping suspended input (PENDIN). */ #define TS_LOCAL (TS_BKSL | TS_CNTTB | TS_ERASE | TS_LNCH | TS_TYPEN) /* Extras. */ #define TS_CAN_BYPASS_L_RINT 0x010000 /* Device in "raw" mode. */ #define TS_CONNECTED 0x020000 /* Connection open. */ #define TS_SNOOP 0x040000 /* Device is being snooped on. */ #define TS_SO_OCOMPLETE 0x080000 /* Wake up when output completes. */ #define TS_ZOMBIE 0x100000 /* Connection lost. */ /* Hardware flow-control-invoked bits. */ #define TS_CAR_OFLOW 0x200000 /* For MDMBUF (XXX handle in driver). */ #ifdef notyet #define TS_CTS_OFLOW 0x400000 /* For CCTS_OFLOW. */ #define TS_DSR_OFLOW 0x800000 /* For CDSR_OFLOW. */ #endif #define TS_IOCTL_NOT_OK 0x1000000 /* Workaround */ #define TS_REVOKE 0x2000000 /* Terminal getting revoked */ /* Character type information. */ #define ORDINARY 0 #define CONTROL 1 #define BACKSPACE 2 #define NEWLINE 3 #define TAB 4 #define VTAB 5 #define RETURN 6 struct speedtab { int sp_speed; int sp_code; }; /* Modem control commands (driver). */ #define DMSET 0 #define DMBIS 1 #define DMBIC 2 #define DMGET 3 /* Flags on a character passed to ttyinput. */ #define TTY_CHARMASK 0x000000ff /* Character mask */ #define TTY_QUOTE 0x00000100 /* Character quoted */ #define TTY_ERRORMASK 0xff000000 /* Error mask */ #define TTY_FE 0x01000000 /* Framing error */ #define TTY_PE 0x02000000 /* Parity error */ #define TTY_OE 0x04000000 /* Overrun error */ #define TTY_BI 0x08000000 /* Break condition */ #endif /* !_SYS_TTY_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/ttychars.h ================================================ /* * 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@ */ /* Copyright (c) 1997 Apple Computer, Inc. All Rights Reserved */ /*- * Copyright (c) 1982, 1986, 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. * * @(#)ttychars.h 8.2 (Berkeley) 1/4/94 */ #ifndef _SYS_TTYCHARS_H_ #define _SYS_TTYCHARS_H_ #include #ifdef __APPLE_API_UNSTABLE /* * 4.3 COMPATIBILITY FILE * * User visible structures and constants related to terminal handling. */ struct ttychars { char tc_erase; /* erase last character */ char tc_kill; /* erase entire line */ char tc_intrc; /* interrupt */ char tc_quitc; /* quit */ char tc_startc; /* start output */ char tc_stopc; /* stop output */ char tc_eofc; /* end-of-file */ char tc_brkc; /* input delimiter (like nl) */ char tc_suspc; /* stop process signal */ char tc_dsuspc; /* delayed stop process signal */ char tc_rprntc; /* reprint line */ char tc_flushc; /* flush output (toggles) */ char tc_werasc; /* word erase */ char tc_lnextc; /* literal next character */ }; #ifdef USE_OLD_TTY #include /* to pick up character defaults */ #endif #endif /* __APPLE_API_UNSTABLE */ #endif /* !_SYS_TTYCHARS_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/ttycom.h ================================================ /* * 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@ */ /* Copyright (c) 1997 Apple Computer, Inc. All Rights Reserved */ /*- * Copyright (c) 1982, 1986, 1990, 1993, 1994 * 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. * * @(#)ttycom.h 8.1 (Berkeley) 3/28/94 */ #ifndef _SYS_TTYCOM_H_ #define _SYS_TTYCOM_H_ #include /* * Tty ioctl's except for those supported only for backwards compatibility * with the old tty driver. */ /* * Window/terminal size structure. This information is stored by the kernel * in order to provide a consistent interface, but is not used by the kernel. */ struct winsize { unsigned short ws_row; /* rows, in characters */ unsigned short ws_col; /* columns, in characters */ unsigned short ws_xpixel; /* horizontal size, pixels */ unsigned short ws_ypixel; /* vertical size, pixels */ }; #define TIOCMODG _IOR('t', 3, int) /* get modem control state */ #define TIOCMODS _IOW('t', 4, int) /* set modem control state */ #define TIOCM_LE 0001 /* line enable */ #define TIOCM_DTR 0002 /* data terminal ready */ #define TIOCM_RTS 0004 /* request to send */ #define TIOCM_ST 0010 /* secondary transmit */ #define TIOCM_SR 0020 /* secondary receive */ #define TIOCM_CTS 0040 /* clear to send */ #define TIOCM_CAR 0100 /* carrier detect */ #define TIOCM_CD TIOCM_CAR #define TIOCM_RNG 0200 /* ring */ #define TIOCM_RI TIOCM_RNG #define TIOCM_DSR 0400 /* data set ready */ /* 8-10 compat */ #define TIOCEXCL _IO('t', 13) /* set exclusive use of tty */ #define TIOCNXCL _IO('t', 14) /* reset exclusive use of tty */ /* 15 unused */ #define TIOCFLUSH _IOW('t', 16, int) /* flush buffers */ /* 17-18 compat */ #define TIOCGETA _IOR('t', 19, struct termios) /* get termios struct */ #define TIOCSETA _IOW('t', 20, struct termios) /* set termios struct */ #define TIOCSETAW _IOW('t', 21, struct termios) /* drain output, set */ #define TIOCSETAF _IOW('t', 22, struct termios) /* drn out, fls in, set */ #define TIOCGETD _IOR('t', 26, int) /* get line discipline */ #define TIOCSETD _IOW('t', 27, int) /* set line discipline */ #define TIOCIXON _IO('t', 129) /* internal input VSTART */ #define TIOCIXOFF _IO('t', 128) /* internal input VSTOP */ /* 127-124 compat */ #define TIOCSBRK _IO('t', 123) /* set break bit */ #define TIOCCBRK _IO('t', 122) /* clear break bit */ #define TIOCSDTR _IO('t', 121) /* set data terminal ready */ #define TIOCCDTR _IO('t', 120) /* clear data terminal ready */ #define TIOCGPGRP _IOR('t', 119, int) /* get pgrp of tty */ #define TIOCSPGRP _IOW('t', 118, int) /* set pgrp of tty */ /* 117-116 compat */ #define TIOCOUTQ _IOR('t', 115, int) /* output queue size */ #define TIOCSTI _IOW('t', 114, char) /* simulate terminal input */ #define TIOCNOTTY _IO('t', 113) /* void tty association */ #define TIOCPKT _IOW('t', 112, int) /* pty: set/clear packet mode */ #define TIOCPKT_DATA 0x00 /* data packet */ #define TIOCPKT_FLUSHREAD 0x01 /* flush packet */ #define TIOCPKT_FLUSHWRITE 0x02 /* flush packet */ #define TIOCPKT_STOP 0x04 /* stop output */ #define TIOCPKT_START 0x08 /* start output */ #define TIOCPKT_NOSTOP 0x10 /* no more ^S, ^Q */ #define TIOCPKT_DOSTOP 0x20 /* now do ^S ^Q */ #define TIOCPKT_IOCTL 0x40 /* state change of pty driver */ #define TIOCSTOP _IO('t', 111) /* stop output, like ^S */ #define TIOCSTART _IO('t', 110) /* start output, like ^Q */ #define TIOCMSET _IOW('t', 109, int) /* set all modem bits */ #define TIOCMBIS _IOW('t', 108, int) /* bis modem bits */ #define TIOCMBIC _IOW('t', 107, int) /* bic modem bits */ #define TIOCMGET _IOR('t', 106, int) /* get all modem bits */ /* 105 unused */ #define TIOCGWINSZ _IOR('t', 104, struct winsize) /* get window size */ #define TIOCSWINSZ _IOW('t', 103, struct winsize) /* set window size */ #define TIOCUCNTL _IOW('t', 102, int) /* pty: set/clr usr cntl mode */ #define TIOCSTAT _IO('t', 101) /* simulate ^T status message */ #define UIOCCMD(n) _IO('u', n) /* usr cntl op "n" */ #define TIOCSCONS _IO('t', 99) /* 4.2 compatibility */ #define TIOCCONS _IOW('t', 98, int) /* become virtual console */ #define TIOCSCTTY _IO('t', 97) /* become controlling tty */ #define TIOCEXT _IOW('t', 96, int) /* pty: external processing */ #define TIOCSIG _IO('t', 95) /* pty: generate signal */ #define TIOCDRAIN _IO('t', 94) /* wait till output drained */ #define TIOCMSDTRWAIT _IOW('t', 91, int) /* modem: set wait on close */ #define TIOCMGDTRWAIT _IOR('t', 90, int) /* modem: get wait on close */ #define TIOCTIMESTAMP _IOR('t', 89, struct timeval) /* enable/get timestamp * of last input event */ #define TIOCDCDTIMESTAMP _IOR('t', 88, struct timeval) /* enable/get timestamp * of last DCd rise */ #define TIOCSDRAINWAIT _IOW('t', 87, int) /* set ttywait timeout */ #define TIOCGDRAINWAIT _IOR('t', 86, int) /* get ttywait timeout */ #define TIOCDSIMICROCODE _IO('t', 85) /* download microcode to * DSI Softmodem */ #define TIOCPTYGRANT _IO('t', 84) /* grantpt(3) */ #define TIOCPTYGNAME _IOC(IOC_OUT, 't', 83, 128) /* ptsname(3) */ #define TIOCPTYUNLK _IO('t', 82) /* unlockpt(3) */ #define TTYDISC 0 /* termios tty line discipline */ #define TABLDISC 3 /* tablet discipline */ #define SLIPDISC 4 /* serial IP discipline */ #define PPPDISC 5 /* PPP discipline */ #endif /* !_SYS_TTYCOM_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/ttydefaults.h ================================================ /* * 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@ */ /* Copyright (c) 1997 Apple Computer, Inc. All Rights Reserved */ /*- * Copyright (c) 1982, 1986, 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. * * @(#)ttydefaults.h 8.4 (Berkeley) 1/21/94 */ /* * System wide defaults for terminal state. */ #ifndef _SYS_TTYDEFAULTS_H_ #define _SYS_TTYDEFAULTS_H_ /* * Defaults on "first" open. */ #define TTYDEF_IFLAG (BRKINT | ICRNL | IMAXBEL | IXON | IXANY) #define TTYDEF_OFLAG (OPOST | ONLCR) #define TTYDEF_LFLAG (ECHO | ICANON | ISIG | IEXTEN | ECHOE|ECHOKE|ECHOCTL) #define TTYDEF_CFLAG (CREAD | CS8 | HUPCL) #define TTYDEF_SPEED (B9600) /* * Control Character Defaults */ #define CTRL(x) (x&037) #define CEOF CTRL('d') #define CEOL 0xff /* XXX avoid _POSIX_VDISABLE */ #define CERASE 0177 #define CINTR CTRL('c') #define CSTATUS CTRL('t') #define CKILL CTRL('u') #define CMIN 1 #define CQUIT 034 /* FS, ^\ */ #define CSUSP CTRL('z') #define CTIME 0 #define CDSUSP CTRL('y') #define CSTART CTRL('q') #define CSTOP CTRL('s') #define CLNEXT CTRL('v') #define CDISCARD CTRL('o') #define CWERASE CTRL('w') #define CREPRINT CTRL('r') #define CEOT CEOF /* compat */ #define CBRK CEOL #define CRPRNT CREPRINT #define CFLUSH CDISCARD /* PROTECTED INCLUSION ENDS HERE */ #endif /* !_SYS_TTYDEFAULTS_H_ */ /* * #define TTYDEFCHARS to include an array of default control characters. */ #ifdef TTYDEFCHARS static cc_t ttydefchars[NCCS] = { CEOF, CEOL, CEOL, CERASE, CWERASE, CKILL, CREPRINT, _POSIX_VDISABLE, CINTR, CQUIT, CSUSP, CDSUSP, CSTART, CSTOP, CLNEXT, CDISCARD, CMIN, CTIME, CSTATUS, _POSIX_VDISABLE }; #undef TTYDEFCHARS #endif ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/ttydev.h ================================================ /* * 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@ */ /* Copyright (c) 1997 Apple Computer, Inc. All Rights Reserved */ /*- * Copyright (c) 1982, 1986, 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. * * @(#)ttydev.h 8.2 (Berkeley) 1/4/94 */ /* COMPATIBILITY HEADER FILE */ #ifndef _SYS_TTYDEV_H_ #define _SYS_TTYDEV_H_ #ifdef USE_OLD_TTY #define B0 0 #define B50 1 #define B75 2 #define B110 3 #define B134 4 #define B150 5 #define B200 6 #define B300 7 #define B600 8 #define B1200 9 #define B1800 10 #define B2400 11 #define B4800 12 #define B9600 13 #define EXTA 14 #define EXTB 15 #define B57600 16 #define B115200 17 #endif /* USE_OLD_TTY */ #endif /* !_SYS_TTYDEV_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/types.h ================================================ /* * Copyright (c) 2000-2008 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 (c) 1995 NeXT Computer, Inc. All Rights Reserved */ /* * Copyright (c) 1982, 1986, 1991, 1993, 1994 * 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. * * @(#)types.h 8.4 (Berkeley) 1/21/94 */ #ifndef _SYS_TYPES_H_ #define _SYS_TYPES_H_ #include #ifndef __ASSEMBLER__ #include /* Machine type dependent parameters. */ #include #include #include #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #include #include #include #ifndef _U_LONG typedef unsigned long u_long; #define _U_LONG #endif typedef unsigned short ushort; /* Sys V compatibility */ typedef unsigned int uint; /* Sys V compatibility */ #endif typedef u_int64_t u_quad_t; /* quads */ typedef int64_t quad_t; typedef quad_t * qaddr_t; #include /* core address */ typedef int32_t daddr_t; /* disk address */ #include /* device number */ typedef u_int32_t fixpt_t; /* fixed point number */ #include #include #include #include #include #include #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #include /* 64bit inode number */ #endif /* !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) */ #include #include #include #include #include #include typedef int32_t segsz_t; /* segment size */ typedef int32_t swblk_t; /* swap offset */ #include #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) /* Major, minor numbers, dev_t's. */ #if defined(__cplusplus) /* * These lowercase macros tend to match member functions in some C++ code, * so for C++, we must use inline functions instead. */ static inline __int32_t major(__uint32_t _x) { return (__int32_t)(((__uint32_t)_x >> 24) & 0xff); } static inline __int32_t minor(__uint32_t _x) { return (__int32_t)((_x) & 0xffffff); } static inline dev_t makedev(__uint32_t _major, __uint32_t _minor) { return (dev_t)(((_major) << 24) | (_minor)); } #else /* !__cplusplus */ #define major(x) ((int32_t)(((u_int32_t)(x) >> 24) & 0xff)) #define minor(x) ((int32_t)((x) & 0xffffff)) #define makedev(x, y) ((dev_t)(((x) << 24) | (y))) #endif /* !__cplusplus */ #endif /* !_POSIX_C_SOURCE */ #include #include #include #include #include #include #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #include #include #endif #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) /* * This code is present here in order to maintain historical backward * compatability, and is intended to be removed at some point in the * future; please include instead. */ #include #define NBBY __DARWIN_NBBY /* bits in a byte */ #define NFDBITS __DARWIN_NFDBITS /* bits per mask */ #define howmany(x, y) __DARWIN_howmany(x, y) /* # y's == x bits? */ typedef __int32_t fd_mask; /* * Select uses bit masks of file descriptors in longs. These macros * manipulate such bit fields (the filesystem macros use chars). The * extra protection here is to permit application redefinition above * the default size. */ #include #include #include #include #include #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #include #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ #endif /* __ASSEMBLER__ */ #ifndef __POSIX_LIB__ #include #include #include #include #include #include #include #include #include #endif /* __POSIX_LIB__ */ #include /* statvfs and fstatvfs */ #include #include #endif /* !_SYS_TYPES_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/ubc.h ================================================ /* * Copyright (c) 1999-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@ */ /* * Header file for Unified Buffer Cache. * */ #ifndef _SYS_UBC_H_ #define _SYS_UBC_H_ #include #include #include #include #include #include #include /* defns for ubc_msync() and ubc_msync */ #define UBC_PUSHDIRTY 0x01 /* clean any dirty pages in the specified range to the backing store */ #define UBC_PUSHALL 0x02 /* push both dirty and precious pages to the backing store */ #define UBC_INVALIDATE 0x04 /* invalidate pages in the specified range... may be used with UBC_PUSHDIRTY/ALL */ #define UBC_SYNC 0x08 /* wait for I/Os generated by UBC_PUSHDIRTY to complete */ __BEGIN_DECLS off_t ubc_blktooff(struct vnode *, daddr64_t); daddr64_t ubc_offtoblk(struct vnode *, off_t); off_t ubc_getsize(struct vnode *); int ubc_setsize(struct vnode *, off_t); kauth_cred_t ubc_getcred(struct vnode *); struct thread; int ubc_setthreadcred(struct vnode *, struct proc *, struct thread *); errno_t ubc_msync(vnode_t, off_t, off_t, off_t *, int); int ubc_pages_resident(vnode_t); int ubc_page_op(vnode_t, off_t, int, ppnum_t *, int *); int ubc_range_op(vnode_t, off_t, off_t, int, int *); /* cluster IO routines */ void cluster_update_state(vnode_t, vm_object_offset_t, vm_object_offset_t, boolean_t); int advisory_read(vnode_t, off_t, off_t, int); int advisory_read_ext(vnode_t, off_t, off_t, int, int (*)(buf_t, void *), void *, int); int cluster_read(vnode_t, struct uio *, off_t, int); int cluster_read_ext(vnode_t, struct uio *, off_t, int, int (*)(buf_t, void *), void *); int cluster_write(vnode_t, struct uio *, off_t, off_t, off_t, off_t, int); int cluster_write_ext(vnode_t, struct uio *, off_t, off_t, off_t, off_t, int, int (*)(buf_t, void *), void *); int cluster_pageout(vnode_t, upl_t, upl_offset_t, off_t, int, off_t, int); int cluster_pageout_ext(vnode_t, upl_t, upl_offset_t, off_t, int, off_t, int, int (*)(buf_t, void *), void *); int cluster_pagein(vnode_t, upl_t, upl_offset_t, off_t, int, off_t, int); int cluster_pagein_ext(vnode_t, upl_t, upl_offset_t, off_t, int, off_t, int, int (*)(buf_t, void *), void *); int cluster_push(vnode_t, int); int cluster_push_ext(vnode_t, int, int (*)(buf_t, void *), void *); int cluster_push_err(vnode_t, int, int (*)(buf_t, void *), void *, int *); int cluster_bp(buf_t); int cluster_bp_ext(buf_t, int (*)(buf_t, void *), void *); void cluster_zero(upl_t, upl_offset_t, int, buf_t); int cluster_copy_upl_data(uio_t, upl_t, int, int *); int cluster_copy_ubc_data(vnode_t, uio_t, int *, int); typedef struct cl_direct_read_lock cl_direct_read_lock_t; cl_direct_read_lock_t *cluster_lock_direct_read(vnode_t vp, lck_rw_type_t exclusive); void cluster_unlock_direct_read(cl_direct_read_lock_t *lck); /* UPL routines */ int ubc_create_upl(vnode_t, off_t, int, upl_t *, upl_page_info_t **, int); int ubc_upl_map(upl_t, vm_offset_t *); int ubc_upl_unmap(upl_t); int ubc_upl_map_range(upl_t, vm_offset_t, vm_size_t, vm_prot_t, vm_offset_t *); int ubc_upl_unmap_range(upl_t, vm_offset_t, vm_size_t); int ubc_upl_commit(upl_t); int ubc_upl_commit_range(upl_t, upl_offset_t, upl_size_t, int); int ubc_upl_abort(upl_t, int); int ubc_upl_abort_range(upl_t, upl_offset_t, upl_size_t, int); void ubc_upl_range_needed(upl_t, int, int); upl_page_info_t *ubc_upl_pageinfo(upl_t); upl_size_t ubc_upl_maxbufsize(void); int is_file_clean(vnode_t, off_t); errno_t mach_to_bsd_errno(kern_return_t mach_err); __END_DECLS #endif /* _SYS_UBC_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/ucontext.h ================================================ /* * Copyright (c) 2002-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 _SYS_UCONTEXT_H_ #define _SYS_UCONTEXT_H_ #include #include #include #include #include #endif /* _SYS_UCONTEXT_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/ucred.h ================================================ /* * Copyright (c) 2000-2004 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@ */ /* Copyright (c) 1995, 1997 Apple Computer, Inc. All Rights Reserved */ /* * Copyright (c) 1989, 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. * * @(#)ucred.h 8.4 (Berkeley) 1/9/95 */ /* * 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. */ #ifndef _SYS_UCRED_H_ #define _SYS_UCRED_H_ #include #include #include #include struct label; #ifdef __APPLE_API_UNSTABLE struct ucred; struct posix_cred; #ifndef _KAUTH_CRED_T #define _KAUTH_CRED_T typedef struct ucred *kauth_cred_t; typedef struct posix_cred *posix_cred_t; #endif /* !_KAUTH_CRED_T */ /* * Credential flags that can be set on a credential */ #define CRF_NOMEMBERD 0x00000001 /* memberd opt out by setgroups() */ #define CRF_MAC_ENFORCE 0x00000002 /* force entry through MAC Framework */ /* also forces credential cache miss */ /* * This is the external representation of struct ucred. */ struct xucred { u_int cr_version; /* structure layout version */ uid_t cr_uid; /* effective user id */ short cr_ngroups; /* number of advisory groups */ gid_t cr_groups[NGROUPS]; /* advisory group list */ }; #define XUCRED_VERSION 0 #define cr_gid cr_groups[0] #define NOCRED ((kauth_cred_t )0) /* no credential available */ #define FSCRED ((kauth_cred_t )-1) /* filesystem credential */ #define IS_VALID_CRED(_cr) ((_cr) != NOCRED && (_cr) != FSCRED) #endif /* __APPLE_API_UNSTABLE */ #endif /* !_SYS_UCRED_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/uio.h ================================================ /* * 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@ */ /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */ /* * Copyright (c) 1982, 1986, 1993, 1994 * 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. * * @(#)uio.h 8.5 (Berkeley) 2/22/94 */ #ifndef _SYS_UIO_H_ #define _SYS_UIO_H_ #include #include #include #include /* * [XSI] The ssize_t and size_t types shall be defined as described * in . */ #include #include /* * [XSI] Structure whose address is passed as the second parameter to the * readv(), preadv(), writev() and pwritev() functions. */ #include #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) /* * IO direction for uio_t. * UIO_READ - data moves into iovec(s) associated with uio_t * UIO_WRITE - data moves out of iovec(s) associated with uio_t */ enum uio_rw { UIO_READ, UIO_WRITE }; #endif __BEGIN_DECLS ssize_t readv(int, const struct iovec *, int) __DARWIN_ALIAS_C(readv); ssize_t writev(int, const struct iovec *, int) __DARWIN_ALIAS_C(writev); #if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || defined(_DARWIN_C_SOURCE) ssize_t preadv(int, const struct iovec *, int, off_t) __DARWIN_NOCANCEL(preadv) __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)); ssize_t pwritev(int, const struct iovec *, int, off_t) __DARWIN_NOCANCEL(pwritev) __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)); #endif /* #if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || defined(_DARWIN_C_SOURCE) */ __END_DECLS #endif /* !_SYS_UIO_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/un.h ================================================ /* * 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@ */ /* * Copyright (c) 1982, 1986, 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. * * @(#)un.h 8.3 (Berkeley) 2/19/95 */ #ifndef _SYS_UN_H_ #define _SYS_UN_H_ #include #include #include /* [XSI] The sa_family_t type shall be defined as described in */ #include /* * [XSI] Definitions for UNIX IPC domain. */ struct sockaddr_un { unsigned char sun_len; /* sockaddr len including null */ sa_family_t sun_family; /* [XSI] AF_UNIX */ char sun_path[104]; /* [XSI] path name (gag) */ }; #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) /* Level number of get/setsockopt for local domain sockets */ #define SOL_LOCAL 0 /* Socket options. */ #define LOCAL_PEERCRED 0x001 /* retrieve peer credentials */ #define LOCAL_PEERPID 0x002 /* retrieve peer pid */ #define LOCAL_PEEREPID 0x003 /* retrieve eff. peer pid */ #define LOCAL_PEERUUID 0x004 /* retrieve peer UUID */ #define LOCAL_PEEREUUID 0x005 /* retrieve eff. peer UUID */ #define LOCAL_PEERTOKEN 0x006 /* retrieve peer audit token */ #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) /* actual length of an initialized sockaddr_un */ #define SUN_LEN(su) \ (sizeof(*(su)) - sizeof((su)->sun_path) + strlen((su)->sun_path)) #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ #endif /* !_SYS_UN_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/unistd.h ================================================ /* * Copyright (c) 2000-2013 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 (c) 1995 NeXT Computer, Inc. All Rights Reserved */ /* * Copyright (c) 1989, 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. * * @(#)unistd.h 8.2 (Berkeley) 1/7/94 */ #ifndef _SYS_UNISTD_H_ #define _SYS_UNISTD_H_ #include /* * Although we have saved user/group IDs, we do not use them in setuid * as described in POSIX 1003.1, because the feature does not work for * root. We use the saved IDs in seteuid/setegid, which are not currently * part of the POSIX 1003.1 specification. */ #ifdef _NOT_AVAILABLE #define _POSIX_SAVED_IDS /* saved set-user-ID and set-group-ID */ #endif #define _POSIX_VERSION 200112L #define _POSIX2_VERSION 200112L /* execution-time symbolic constants */ /* may disable terminal special characters */ #include #define _POSIX_THREAD_KEYS_MAX 128 /* access function */ #define F_OK 0 /* test for existence of file */ #define X_OK (1<<0) /* test for execute or search permission */ #define W_OK (1<<1) /* test for write permission */ #define R_OK (1<<2) /* test for read permission */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) /* * Extended access functions. * Note that we depend on these matching the definitions in sys/kauth.h, * but with the bits shifted left by 8. */ #define _READ_OK (1<<9) /* read file data / read directory */ #define _WRITE_OK (1<<10) /* write file data / add file to directory */ #define _EXECUTE_OK (1<<11) /* execute file / search in directory*/ #define _DELETE_OK (1<<12) /* delete file / delete directory */ #define _APPEND_OK (1<<13) /* append to file / add subdirectory to directory */ #define _RMFILE_OK (1<<14) /* - / remove file from directory */ #define _RATTR_OK (1<<15) /* read basic attributes */ #define _WATTR_OK (1<<16) /* write basic attributes */ #define _REXT_OK (1<<17) /* read extended attributes */ #define _WEXT_OK (1<<18) /* write extended attributes */ #define _RPERM_OK (1<<19) /* read permissions */ #define _WPERM_OK (1<<20) /* write permissions */ #define _CHOWN_OK (1<<21) /* change ownership */ #define _ACCESS_EXTENDED_MASK (_READ_OK | _WRITE_OK | _EXECUTE_OK | \ _DELETE_OK | _APPEND_OK | \ _RMFILE_OK | _REXT_OK | \ _WEXT_OK | _RATTR_OK | _WATTR_OK | _RPERM_OK | \ _WPERM_OK | _CHOWN_OK) #endif /* whence values for lseek(2) */ #include #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) /* whence values for lseek(2); renamed by POSIX 1003.1 */ #define L_SET SEEK_SET #define L_INCR SEEK_CUR #define L_XTND SEEK_END #endif #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) struct accessx_descriptor { unsigned int ad_name_offset; int ad_flags; int ad_pad[2]; }; #define ACCESSX_MAX_DESCRIPTORS 100 #define ACCESSX_MAX_TABLESIZE (16 * 1024) #endif /* configurable pathname variables */ #define _PC_LINK_MAX 1 #define _PC_MAX_CANON 2 #define _PC_MAX_INPUT 3 #define _PC_NAME_MAX 4 #define _PC_PATH_MAX 5 #define _PC_PIPE_BUF 6 #define _PC_CHOWN_RESTRICTED 7 #define _PC_NO_TRUNC 8 #define _PC_VDISABLE 9 #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define _PC_NAME_CHARS_MAX 10 #define _PC_CASE_SENSITIVE 11 #define _PC_CASE_PRESERVING 12 #define _PC_EXTENDED_SECURITY_NP 13 #define _PC_AUTH_OPAQUE_NP 14 #endif #define _PC_2_SYMLINKS 15 /* Symlink supported in directory */ #define _PC_ALLOC_SIZE_MIN 16 /* Minimum storage actually allocated */ #define _PC_ASYNC_IO 17 /* Async I/O [AIO] supported? */ #define _PC_FILESIZEBITS 18 /* # of bits to represent file size */ #define _PC_PRIO_IO 19 /* Priority I/O [PIO] supported? */ #define _PC_REC_INCR_XFER_SIZE 20 /* Recommended increment for next two */ #define _PC_REC_MAX_XFER_SIZE 21 /* Recommended max file transfer size */ #define _PC_REC_MIN_XFER_SIZE 22 /* Recommended min file transfer size */ #define _PC_REC_XFER_ALIGN 23 /* Recommended buffer alignment */ #define _PC_SYMLINK_MAX 24 /* Max # of bytes in symlink name */ #define _PC_SYNC_IO 25 /* Sync I/O [SIO] supported? */ #define _PC_XATTR_SIZE_BITS 26 /* # of bits to represent maximum xattr size */ #define _PC_MIN_HOLE_SIZE 27 /* Recommended minimum hole size for sparse files */ /* configurable system strings */ #define _CS_PATH 1 #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL #include #include #include <_types/_uint64_t.h> #include <_types/_uint32_t.h> #include __BEGIN_DECLS int getattrlistbulk(int, void *, void *, size_t, uint64_t) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0); int getattrlistat(int, const char *, void *, void *, size_t, unsigned long) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0); int setattrlistat(int, const char *, void *, void *, size_t, uint32_t) __OSX_AVAILABLE(10.13) __IOS_AVAILABLE(11.0) __TVOS_AVAILABLE(11.0) __WATCHOS_AVAILABLE(4.0); __END_DECLS #endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */ #if __DARWIN_C_LEVEL >= 200809L #include #include #include #include #include #include #include __BEGIN_DECLS int faccessat(int, const char *, int, int) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0); int fchownat(int, const char *, uid_t, gid_t, int) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0); int linkat(int, const char *, int, const char *, int) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0); ssize_t readlinkat(int, const char *, char *, size_t) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0); int symlinkat(const char *, int, const char *) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0); int unlinkat(int, const char *, int) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0); __END_DECLS #endif /* __DARWIN_C_LEVEL >= 200809L */ #endif /* !_SYS_UNISTD_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/unpcb.h ================================================ /* * Copyright (c) 2008-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@ */ /* * Copyright (c) 1982, 1986, 1989, 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. * * @(#)unpcb.h 8.1 (Berkeley) 6/2/93 */ #ifndef _SYS_UNPCB_H_ #define _SYS_UNPCB_H_ #include #include #include #include #include /* * Protocol control block for an active * instance of a UNIX internal protocol. * * A socket may be associated with an vnode in the * file system. If so, the unp_vnode pointer holds * a reference count to this vnode, which should be irele'd * when the socket goes away. * * A socket may be connected to another socket, in which * case the control block of the socket to which it is connected * is given by unp_conn. * * A socket may be referenced by a number of sockets (e.g. several * sockets may be connected to a datagram socket.) These sockets * are in a linked list starting with unp_refs, linked through * unp_nextref and null-terminated. Note that a socket may be referenced * by a number of other sockets and may also reference a socket (not * necessarily one which is referencing it). This generates * the need for unp_refs and unp_nextref to be separate fields. * * Stream sockets keep copies of receive sockbuf sb_cc and sb_mbcnt * so that changes in the sockbuf may be computed to modify * back pressure on the sender accordingly. */ typedef u_quad_t unp_gen_t; #if defined(__LP64__) struct _unpcb_list_entry { u_int32_t le_next; u_int32_t le_prev; }; #define _UCPCB_LIST_HEAD(name, type) \ struct name { \ u_int32_t lh_first; \ }; #define _UNPCB_LIST_ENTRY(x) struct _unpcb_list_entry #define _UNPCB_PTR(x) u_int32_t #else #define _UCPCB_LIST_HEAD(name, type) LIST_HEAD(name, type) #define _UNPCB_LIST_ENTRY(x) LIST_ENTRY(x) #define _UNPCB_PTR(x) x #endif struct xunpgen { u_int32_t xug_len; u_int xug_count; unp_gen_t xug_gen; so_gen_t xug_sogen; }; #endif /* _SYS_UNPCB_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/user.h ================================================ /* * 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@ */ /* Copyright (c) 1995, 1997 Apple Computer, Inc. All Rights Reserved */ /* * Copyright (c) 1982, 1986, 1989, 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. * * @(#)user.h 8.2 (Berkeley) 9/23/93 */ #ifndef _SYS_USER_H_ #define _SYS_USER_H_ #include struct waitq_set; /* stuff that *used* to be included by user.h, or is now needed */ #include #include #include #include #include #include /* XXX */ #include /* * Per process structure containing data that isn't needed in core * when the process isn't running (esp. when swapped out). * This structure may or may not be at the same kernel address * in all processes. */ struct user { /* NOT USED ANYMORE */ }; #endif /* !_SYS_USER_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/utfconv.h ================================================ /* * 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 _SYS_UTFCONV_H_ #define _SYS_UTFCONV_H_ #include #include #endif /* !_SYS_UTFCONV_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/utsname.h ================================================ /* * 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@ */ /* Copyright 1993,1995 NeXT Computer Inc. All Rights Reserved */ /*- * Copyright (c) 1994 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Chuck Karish of Mindcraft, 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. * * @(#)utsname.h 8.1 (Berkeley) 1/4/94 */ #ifndef _SYS_UTSNAME_H #define _SYS_UTSNAME_H #include #define _SYS_NAMELEN 256 struct utsname { char sysname[_SYS_NAMELEN]; /* [XSI] Name of OS */ char nodename[_SYS_NAMELEN]; /* [XSI] Name of this network node */ char release[_SYS_NAMELEN]; /* [XSI] Release level */ char version[_SYS_NAMELEN]; /* [XSI] Version level */ char machine[_SYS_NAMELEN]; /* [XSI] Hardware type */ }; __BEGIN_DECLS int uname(struct utsname *); __END_DECLS #endif /* !_SYS_UTSNAME_H */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/vadvise.h ================================================ /* * 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@ */ /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */ /*- * Copyright (c) 1982, 1986, 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. * * @(#)vadvise.h 8.1 (Berkeley) 6/2/93 */ #ifndef _SYS_VADVISE_H_ #define _SYS_VADVISE_H_ #include #ifdef __APPLE_API_OBSOLETE /* * Parameters to vadvise() to tell system of particular paging * behaviour: * VA_NORM Normal strategy * VA_ANOM Sampling page behaviour is not a win, don't bother * Suitable during GCs in LISP, or sequential or random * page referencing. * VA_SEQL Sequential behaviour expected. * VA_FLUSH Invalidate all page table entries. */ #define VA_NORM 0 #define VA_ANOM 1 #define VA_SEQL 2 #define VA_FLUSH 3 #endif /* __APPLE_API_OBSOLETE */ #endif /* !_SYS_VADVISE_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/vcmd.h ================================================ /* * 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@ */ /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */ /*- * Copyright (c) 1982, 1986, 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. * * @(#)vcmd.h 8.1 (Berkeley) 6/2/93 */ #ifndef _SYS_VCMD_H_ #define _SYS_VCMD_H_ #include #define VPRINT 0100 #define VPLOT 0200 #define VPRINTPLOT 0400 #define VGETSTATE _IOR('v', 0, int) #define VSETSTATE _IOW('v', 1, int) #endif /* !_SYS_VCMD_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/vm.h ================================================ /* * 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@ */ /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */ /* * Copyright (c) 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. * * @(#)vm.h 8.5 (Berkeley) 5/11/95 */ /* HISTORY * 05-Jun-95 Mac Gillon (mgillon) at NeXT * 4.4 code uses this file to import MACH API */ #ifndef _SYS_VM_H #define _SYS_VM_H #include #include #include /* caddr_t */ #include /* int32_t */ /* just to keep kinfo_proc happy */ /* NOTE: Pointer fields are size variant for LP64 */ struct vmspace { int32_t dummy; caddr_t dummy2; int32_t dummy3[5]; caddr_t dummy4[3]; }; #endif /* _SYS_VM_H */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/vmmeter.h ================================================ /* * 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@ */ /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */ /*- * Copyright (c) 1982, 1986, 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. * * @(#)vmmeter.h 8.2 (Berkeley) 7/10/94 */ #ifndef _SYS_VMMETER_H_ #define _SYS_VMMETER_H_ #include #include #ifdef __APPLE_API_OBSOLETE /* * System wide statistics counters. */ struct vmmeter { /* * General system activity. */ unsigned int v_swtch; /* context switches */ unsigned int v_trap; /* calls to trap */ unsigned int v_syscall; /* calls to syscall() */ unsigned int v_intr; /* device interrupts */ unsigned int v_soft; /* software interrupts */ unsigned int v_faults; /* total faults taken */ /* * Virtual memory activity. */ unsigned int v_lookups; /* object cache lookups */ unsigned int v_hits; /* object cache hits */ unsigned int v_vm_faults; /* number of address memory faults */ unsigned int v_cow_faults; /* number of copy-on-writes */ unsigned int v_swpin; /* swapins */ unsigned int v_swpout; /* swapouts */ unsigned int v_pswpin; /* pages swapped in */ unsigned int v_pswpout; /* pages swapped out */ unsigned int v_pageins; /* number of pageins */ unsigned int v_pageouts; /* number of pageouts */ unsigned int v_pgpgin; /* pages paged in */ unsigned int v_pgpgout; /* pages paged out */ unsigned int v_intrans; /* intransit blocking page faults */ unsigned int v_reactivated; /* number of pages reactivated from free list */ unsigned int v_rev; /* revolutions of the hand */ unsigned int v_scan; /* scans in page out daemon */ unsigned int v_dfree; /* pages freed by daemon */ unsigned int v_pfree; /* pages freed by exiting processes */ unsigned int v_zfod; /* pages zero filled on demand */ unsigned int v_nzfod; /* number of zfod's created */ /* * Distribution of page usages. */ unsigned int v_page_size; /* page size in bytes */ unsigned int v_kernel_pages; /* number of pages in use by kernel */ unsigned int v_free_target; /* number of pages desired free */ unsigned int v_free_min; /* minimum number of pages desired free */ unsigned int v_free_count; /* number of pages free */ unsigned int v_wire_count; /* number of pages wired down */ unsigned int v_active_count; /* number of pages active */ unsigned int v_inactive_target; /* number of pages desired inactive */ unsigned int v_inactive_count; /* number of pages inactive */ }; /* systemwide totals computed every five seconds */ struct vmtotal { int16_t t_rq; /* length of the run queue */ int16_t t_dw; /* jobs in ``disk wait'' (neg priority) */ int16_t t_pw; /* jobs in page wait */ int16_t t_sl; /* jobs sleeping in core */ int16_t t_sw; /* swapped out runnable/short block jobs */ int32_t t_vm; /* total virtual memory */ int32_t t_avm; /* active virtual memory */ int32_t t_rm; /* total real memory in use */ int32_t t_arm; /* active real memory */ int32_t t_vmshr; /* shared virtual memory */ int32_t t_avmshr; /* active shared virtual memory */ int32_t t_rmshr; /* shared real memory */ int32_t t_armshr; /* active shared real memory */ int32_t t_free; /* free memory pages */ }; #endif /*__APPLE_API_OBSOLETE */ #endif /* !_SYS_VMMETER_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/vmparam.h ================================================ /* * 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) 1989 Carnegie-Mellon University * Copyright (c) 1988 Carnegie-Mellon University * All rights reserved. The CMU software License Agreement specifies * the terms and conditions for use and redistribution. */ /* * HISTORY */ #ifndef _SYS_VMPARAM_H_ #define _SYS_VMPARAM_H_ /* * Machine dependent constants */ #include #endif /* _SYS_VMPARAM_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/vnioctl.h ================================================ /* * Copyright (c) 2004-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@ */ /* * Copyright (c) 1988 University of Utah. * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * the Systems Programming Group of the University of Utah Computer * Science Department. * * 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. * * from: Utah $Hdr: fdioctl.h 1.1 90/07/09$ * * @(#)vnioctl.h 8.1 (Berkeley) 6/10/93 * * $FreeBSD: src/sys/sys/vnioctl.h,v 1.4 1999/09/17 05:33:58 dillon Exp $ */ #ifndef _SYS_VNIOCTL_H_ #define _SYS_VNIOCTL_H_ #include #include /* * Ioctl definitions for file (vnode) disk pseudo-device. */ #define _PATH_VNTAB "/etc/vntab" /* default config file */ typedef enum { vncontrol_readwrite_io_e = 0 } vncontrol_t; struct vn_ioctl { char * vn_file; /* pathname of file to mount */ int vn_size; /* (returned) size of disk */ vncontrol_t vn_control; }; /* * Before you can use a unit, it must be configured with VNIOCSET. * The configuration persists across opens and closes of the device; * an VNIOCCLR must be used to reset a configuration. An attempt to * VNIOCSET an already active unit will return EBUSY. */ #define VNIOCATTACH _IOWR('F', 0, struct vn_ioctl) /* attach file */ #define VNIOCDETACH _IOWR('F', 1, struct vn_ioctl) /* detach disk */ #define VNIOCGSET _IOWR('F', 2, u_int32_t ) /* set global option */ #define VNIOCGCLEAR _IOWR('F', 3, u_int32_t ) /* reset --//-- */ #define VNIOCUSET _IOWR('F', 4, u_int32_t ) /* set unit option */ #define VNIOCUCLEAR _IOWR('F', 5, u_int32_t ) /* reset --//-- */ #define VNIOCSHADOW _IOWR('F', 6, struct vn_ioctl) /* attach shadow */ #define VN_LABELS 0x1 /* Use disk(/slice) labels */ #define VN_FOLLOW 0x2 /* Debug flow in vn driver */ #define VN_DEBUG 0x4 /* Debug data in vn driver */ #define VN_IO 0x8 /* Debug I/O in vn driver */ #define VN_DONTCLUSTER 0x10 /* Don't cluster */ #define VN_RESERVE 0x20 /* Pre-reserve swap */ #endif /* _SYS_VNIOCTL_H_*/ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/vnode.h ================================================ /* * Copyright (c) 2000-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@ */ /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */ /* * Copyright (c) 1989, 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. * * @(#)vnode.h 8.17 (Berkeley) 5/20/95 */ #ifndef _VNODE_H_ #define _VNODE_H_ #include #include #include #include /* * The vnode is the focus of all file activity in UNIX. There is a * unique vnode allocated for each active file, each current directory, * each mounted-on file, text file, and the root. */ /* * Vnode types. VNON means no type. */ enum vtype { /* 0 */ VNON, /* 1 - 5 */ VREG, VDIR, VBLK, VCHR, VLNK, /* 6 - 10 */ VSOCK, VFIFO, VBAD, VSTR, VCPLX }; /* * Vnode tag types. * These are for the benefit of external programs only (e.g., pstat) * and should NEVER be inspected by the kernel. */ enum vtagtype { /* 0 */ VT_NON, /* 1 reserved, overlaps with (CTL_VFS, VFS_NUMMNTOPS) */ VT_UFS, /* 2 - 5 */ VT_NFS, VT_MFS, VT_MSDOSFS, VT_LFS, /* 6 - 10 */ VT_LOFS, VT_FDESC, VT_PORTAL, VT_NULL, VT_UMAP, /* 11 - 15 */ VT_KERNFS, VT_PROCFS, VT_AFS, VT_ISOFS, VT_MOCKFS, /* 16 - 20 */ VT_HFS, VT_ZFS, VT_DEVFS, VT_WEBDAV, VT_UDF, /* 21 - 25 */ VT_AFP, VT_CDDA, VT_CIFS, VT_OTHER, VT_APFS, /* 26 - 27*/ VT_LOCKERFS, VT_BINDFS, }; #define HAVE_VT_LOCKERFS 1 /* * flags for VNOP_BLOCKMAP */ #define VNODE_READ 0x01 #define VNODE_WRITE 0x02 #define VNODE_BLOCKMAP_NO_TRACK 0x04 // APFS Fusion: Do not track this request #define VNODE_CLUSTER_VERIFY 0x08 // Verification will be performed in the cluster layer /* flags for VNOP_ALLOCATE */ #define PREALLOCATE 0x00000001 /* preallocate allocation blocks */ #define ALLOCATECONTIG 0x00000002 /* allocate contigious space */ #define ALLOCATEALL 0x00000004 /* allocate all requested space */ /* or no space at all */ #define FREEREMAINDER 0x00000008 /* deallocate allocated but */ /* unfilled blocks */ #define ALLOCATEFROMPEOF 0x00000010 /* allocate from the physical eof */ #define ALLOCATEFROMVOL 0x00000020 /* allocate from the volume offset */ /* * Token indicating no attribute value yet assigned. some user source uses this */ #define VNOVAL (-1) /* * Structure for vnode level IO compression stats */ #define IOCS_BUFFER_NUM_SIZE_BUCKETS 10 #define IOCS_BUFFER_MAX_BUCKET 9 #define IOCS_BUFFER_NUM_COMPRESSION_BUCKETS 7 #define IOCS_BLOCK_NUM_SIZE_BUCKETS 16 struct io_compression_stats { uint64_t uncompressed_size; uint64_t compressed_size; uint32_t buffer_size_compression_dist[IOCS_BUFFER_NUM_SIZE_BUCKETS][IOCS_BUFFER_NUM_COMPRESSION_BUCKETS]; uint32_t block_compressed_size_dist[IOCS_BLOCK_NUM_SIZE_BUCKETS]; }; typedef struct io_compression_stats *io_compression_stats_t; #define IOCS_SBE_PATH_LEN 128 #define IOCS_PATH_START_BYTES_TO_COPY 108 #define IOCS_PATH_END_BYTES_TO_COPY 20 /* Includes null termination */ #define IOCS_SYSCTL_LIVE 0x00000001 #define IOCS_SYSCTL_STORE_BUFFER_RD_ONLY 0x00000002 #define IOCS_SYSCTL_STORE_BUFFER_MARK 0x00000004 struct iocs_store_buffer_entry { char path_name[IOCS_SBE_PATH_LEN]; struct io_compression_stats iocs; }; #endif /* !_VNODE_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/vnode_if.h ================================================ /* * Copyright (c) 2000-2016 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@ */ /* * Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved * Copyright (c) 1992, 1993, 1994, 1995 * 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. */ /* * 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. */ /* * Warning: This file is generated automatically. * (Modifications made here may easily be lost!) * * Created by the script: * @(#)vnode_if.sh 8.7 (Berkeley) 5/11/95 */ #ifndef _SYS_VNODE_IF_H_ #define _SYS_VNODE_IF_H_ #include #include #include #include #include #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdocumentation" #pragma clang diagnostic pop /* #pragma clang diagnostic ignored "-Wdocumentation" */ #endif /* !_SYS_VNODE_IF_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/vsock.h ================================================ /* * Copyright (c) 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@ */ #ifndef _VSOCK_H_ #define _VSOCK_H_ #include __BEGIN_DECLS #include #include #include #define VMADDR_CID_ANY (-1U) #define VMADDR_CID_HYPERVISOR 0 #define VMADDR_CID_RESERVED 1 #define VMADDR_CID_HOST 2 #define VMADDR_PORT_ANY (-1U) #define IOCTL_VM_SOCKETS_GET_LOCAL_CID _IOR('s', 209, uint32_t) struct sockaddr_vm { __uint8_t svm_len; /* total length */ sa_family_t svm_family; /* Address family: AF_VSOCK */ __uint16_t svm_reserved1; __uint32_t svm_port; /* Port # in host byte order */ __uint32_t svm_cid; /* Address in host byte order */ } __attribute__((__packed__)); typedef u_quad_t vsock_gen_t; struct xvsockpcb { u_int32_t xv_len; /* length of this structure */ u_int64_t xv_vsockpp; u_int32_t xvp_local_cid; /* local address cid */ u_int32_t xvp_local_port; /* local address port */ u_int32_t xvp_remote_cid; /* remote address cid */ u_int32_t xvp_remote_port; /* remote address port */ u_int32_t xvp_rxcnt; /* bytes received */ u_int32_t xvp_txcnt; /* bytes transmitted */ u_int32_t xvp_peer_rxhiwat; /* peer's receive buffer */ u_int32_t xvp_peer_rxcnt; /* bytes received by peer */ pid_t xvp_last_pid; /* last pid */ vsock_gen_t xvp_gencnt; /* vsock generation count */ struct xsocket xv_socket; }; struct xvsockpgen { u_int32_t xvg_len; /* length of this structure */ u_int64_t xvg_count; /* number of PCBs at this time */ vsock_gen_t xvg_gen; /* generation count at this time */ so_gen_t xvg_sogen; /* current socket generation count */ }; __END_DECLS #endif /* _VSOCK_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/vstat.h ================================================ /* * 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@ */ /* Copyright (c) 1998 Apple Computer, Inc. All Rights Reserved */ /*- * @(#)vstat.h */ #ifndef _SYS_VSTAT_H_ #define _SYS_VSTAT_H_ #include #include #include #warning obsolete header! delete the include from your sources #ifdef __APPLE_API_OBSOLETE #include #include #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) struct vstat { fsid_t vst_volid; /* volume identifier */ fsobj_id_t vst_nodeid; /* object's id */ fsobj_type_t vst_vnodetype; /* vnode type (VREG, VDIR, etc.) */ fsobj_tag_t vst_vnodetag; /* vnode tag (HFS, UFS, etc.) */ mode_t vst_mode; /* inode protection mode */ nlink_t vst_nlink; /* number of hard links */ uid_t vst_uid; /* user ID of the file's owner */ gid_t vst_gid; /* group ID of the file's group */ dev_t vst_dev; /* inode's device */ dev_t vst_rdev; /* device type */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) struct timespec vst_atimespec; /* time of last access */ struct timespec vst_mtimespec; /* time of last data modification */ struct timespec vst_ctimespec; /* time of last file status change */ #else time_t vst_atime; /* time of last access */ long vst_atimensec; /* nsec of last access */ time_t vst_mtime; /* time of last data modification */ long vst_mtimensec; /* nsec of last data modification */ time_t vst_ctime; /* time of last file status change */ long vst_ctimensec; /* nsec of last file status change */ #endif off_t vst_filesize; /* file size, in bytes */ quad_t vst_blocks; /* bytes allocated for file */ u_int32_t vst_blksize; /* optimal blocksize for I/O */ u_int32_t vst_flags; /* user defined flags for file */ }; #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ #endif /* __APPLE_API_OBSOLETE */ #endif /* !_SYS_VSTAT_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/wait.h ================================================ /* * 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@ */ /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */ /* * Copyright (c) 1982, 1986, 1989, 1993, 1994 * 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. * * @(#)wait.h 8.2 (Berkeley) 7/10/94 */ #ifndef _SYS_WAIT_H_ #define _SYS_WAIT_H_ #include #include /* * This file holds definitions relevent to the wait4 system call * and the alternate interfaces that use it (wait, wait3, waitpid). */ /* * [XSI] The type idtype_t shall be defined as an enumeration type whose * possible values shall include at least P_ALL, P_PID, and P_PGID. */ typedef enum { P_ALL, P_PID, P_PGID } idtype_t; /* * [XSI] The id_t and pid_t types shall be defined as described * in */ #include #include /* * [XSI] The siginfo_t type shall be defined as described in * [XSI] The rusage structure shall be defined as described in * [XSI] Inclusion of the header may also make visible all * symbols from and * * NOTE: This requirement is currently being satisfied by the direct * inclusion of and , below. * * Software should not depend on the exposure of anything other * than the types siginfo_t and struct rusage as a result of * this inclusion. If you depend on any types or manifest * values othe than siginfo_t and struct rusage from either of * those files, you should explicitly include them yourself, as * well, or in future releases your stware may not compile * without modification. */ #include /* [XSI] for siginfo_t */ #include /* [XSI] for struct rusage */ /* * Option bits for the third argument of wait4. WNOHANG causes the * wait to not hang if there are no stopped or terminated processes, rather * returning an error indication in this case (pid==0). WUNTRACED * indicates that the caller should receive status about untraced children * which stop due to signals. If children are stopped and a wait without * this option is done, it is as though they were still running... nothing * about them is returned. */ #define WNOHANG 0x00000001 /* [XSI] no hang in wait/no child to reap */ #define WUNTRACED 0x00000002 /* [XSI] notify on stop, untraced child */ /* * Macros to test the exit status returned by wait * and extract the relevant values. */ #if defined(_POSIX_C_SOURCE) && !defined(_DARWIN_C_SOURCE) #define _W_INT(i) (i) #else #define _W_INT(w) (*(int *)&(w)) /* convert union wait to int */ #define WCOREFLAG 0200 #endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */ /* These macros are permited, as they are in the implementation namespace */ #define _WSTATUS(x) (_W_INT(x) & 0177) #define _WSTOPPED 0177 /* _WSTATUS if process is stopped */ /* * [XSI] The header shall define the following macros for * analysis of process status values */ #if __DARWIN_UNIX03 #define WEXITSTATUS(x) ((_W_INT(x) >> 8) & 0x000000ff) #else /* !__DARWIN_UNIX03 */ #define WEXITSTATUS(x) (_W_INT(x) >> 8) #endif /* !__DARWIN_UNIX03 */ /* 0x13 == SIGCONT */ #define WSTOPSIG(x) (_W_INT(x) >> 8) #define WIFCONTINUED(x) (_WSTATUS(x) == _WSTOPPED && WSTOPSIG(x) == 0x13) #define WIFSTOPPED(x) (_WSTATUS(x) == _WSTOPPED && WSTOPSIG(x) != 0x13) #define WIFEXITED(x) (_WSTATUS(x) == 0) #define WIFSIGNALED(x) (_WSTATUS(x) != _WSTOPPED && _WSTATUS(x) != 0) #define WTERMSIG(x) (_WSTATUS(x)) #if (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) #define WCOREDUMP(x) (_W_INT(x) & WCOREFLAG) #define W_EXITCODE(ret, sig) ((ret) << 8 | (sig)) #define W_STOPCODE(sig) ((sig) << 8 | _WSTOPPED) #endif /* (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) */ /* * [XSI] The following symbolic constants shall be defined as possible * values for the fourth argument to waitid(). */ /* WNOHANG already defined for wait4() */ /* WUNTRACED defined for wait4() but not for waitid() */ #define WEXITED 0x00000004 /* [XSI] Processes which have exitted */ #if __DARWIN_UNIX03 /* waitid() parameter */ #define WSTOPPED 0x00000008 /* [XSI] Any child stopped by signal */ #endif #define WCONTINUED 0x00000010 /* [XSI] Any child stopped then continued */ #define WNOWAIT 0x00000020 /* [XSI] Leave process returned waitable */ #if (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) /* POSIX extensions and 4.2/4.3 compatability: */ /* * Tokens for special values of the "pid" parameter to wait4. */ #define WAIT_ANY (-1) /* any process */ #define WAIT_MYPGRP 0 /* any process in my process group */ #include /* * Deprecated: * Structure of the information in the status word returned by wait4. * If w_stopval==_WSTOPPED, then the second structure describes * the information returned, else the first. */ union wait { int w_status; /* used in syscall */ /* * Terminated process status. */ struct { #if __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN unsigned int w_Termsig:7, /* termination signal */ w_Coredump:1, /* core dump indicator */ w_Retcode:8, /* exit code if w_termsig==0 */ w_Filler:16; /* upper bits filler */ #endif #if __DARWIN_BYTE_ORDER == __DARWIN_BIG_ENDIAN unsigned int w_Filler:16, /* upper bits filler */ w_Retcode:8, /* exit code if w_termsig==0 */ w_Coredump:1, /* core dump indicator */ w_Termsig:7; /* termination signal */ #endif } w_T; /* * Stopped process status. Returned * only for traced children unless requested * with the WUNTRACED option bit. */ struct { #if __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN unsigned int w_Stopval:8, /* == W_STOPPED if stopped */ w_Stopsig:8, /* signal that stopped us */ w_Filler:16; /* upper bits filler */ #endif #if __DARWIN_BYTE_ORDER == __DARWIN_BIG_ENDIAN unsigned int w_Filler:16, /* upper bits filler */ w_Stopsig:8, /* signal that stopped us */ w_Stopval:8; /* == W_STOPPED if stopped */ #endif } w_S; }; #define w_termsig w_T.w_Termsig #define w_coredump w_T.w_Coredump #define w_retcode w_T.w_Retcode #define w_stopval w_S.w_Stopval #define w_stopsig w_S.w_Stopsig #endif /* (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) */ #if !(__DARWIN_UNIX03 - 0) /* * Stopped state value; cannot use waitid() parameter of the same name * in the same scope */ #define WSTOPPED _WSTOPPED #endif /* !__DARWIN_UNIX03 */ __BEGIN_DECLS pid_t wait(int *) __DARWIN_ALIAS_C(wait); pid_t waitpid(pid_t, int *, int) __DARWIN_ALIAS_C(waitpid); #ifndef _ANSI_SOURCE int waitid(idtype_t, id_t, siginfo_t *, int) __DARWIN_ALIAS_C(waitid); #endif /* !_ANSI_SOURCE */ #if (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) pid_t wait3(int *, int, struct rusage *); pid_t wait4(pid_t, int *, int, struct rusage *); #endif /* (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) */ __END_DECLS #endif /* !_SYS_WAIT_H_ */ ================================================ FILE: cross-macos/sysroot/macos-12/usr/include/sys/xattr.h ================================================ /* * Copyright (c) 2004-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 _SYS_XATTR_H_ #define _SYS_XATTR_H_ #include /* Options for pathname based xattr calls */ #define XATTR_NOFOLLOW 0x0001 /* Don't follow symbolic links */ /* Options for setxattr calls */ #define XATTR_CREATE 0x0002 /* set the value, fail if attr already exists */ #define XATTR_REPLACE 0x0004 /* set the value, fail if attr does not exist */ /* Set this to bypass authorization checking (eg. if doing auth-related work) */ #define XATTR_NOSECURITY 0x0008 /* Set this to bypass the default extended attribute file (dot-underscore file) */ #define XATTR_NODEFAULT 0x0010 /* option for f/getxattr() and f/listxattr() to expose the HFS Compression extended attributes */ #define XATTR_SHOWCOMPRESSION 0x0020 #define XATTR_MAXNAMELEN 127 /* See the ATTR_CMN_FNDRINFO section of getattrlist(2) for details on FinderInfo */ #define XATTR_FINDERINFO_NAME "com.apple.FinderInfo" #define XATTR_RESOURCEFORK_NAME "com.apple.ResourceFork" __BEGIN_DECLS ssize_t getxattr(const char *path, const char *name, void *value, size_t size, u_int32_t position, int options); ssize_t fgetxattr(int fd, const char *name, void *value, size_t size, u_int32_t position, int options); int setxattr(const char *path, const char *name, const void *value, size_t size, u_int32_t position, int options); int fsetxattr(int fd, const char *name, const void *value, size_t size, u_int32_t position, int options); int removexattr(const char *path, const char *name, int options); int fremovexattr(int fd, const char *name, int options); ssize_t listxattr(const char *path, char *namebuff, size_t size, int options); ssize_t flistxattr(int fd, char *namebuff, size_t size, int options); __END_DECLS #endif /* _SYS_XATTR_H_ */ ================================================ FILE: cross-windows/TraceLoggingProvider.h ================================================ ================================================ FILE: cross-windows/VersionHelpers.h ================================================ #include ================================================ FILE: cross-windows/Windows.h ================================================ #include ================================================ FILE: cross-windows/src/base/win32-headers.h ================================================ // Copyright 2012 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef V8_BASE_WIN32_HEADERS_H_ #define V8_BASE_WIN32_HEADERS_H_ // This file contains defines and typedefs that allow popular Windows types to // be used without the overhead of including windows.h. // This file no longer includes windows.h but it still sets the defines that // tell windows.h to omit some includes so that the V8 source files that do // include windows.h will still get the minimal version. #ifndef WIN32_LEAN_AND_MEAN // WIN32_LEAN_AND_MEAN implies NOCRYPT and NOGDI. #define WIN32_LEAN_AND_MEAN #endif #ifndef NOMINMAX #define NOMINMAX #endif #ifndef NOKERNEL #define NOKERNEL #endif #ifndef NOUSER #define NOUSER #endif #ifndef NOSERVICE #define NOSERVICE #endif #ifndef NOSOUND #define NOSOUND #endif #ifndef NOMCX #define NOMCX #endif #ifndef _WIN32_WINNT #error This should be set in build config files. See build\config\win\BUILD.gn #endif #include // For raise(). #include // For LocalOffset() implementation. #if !defined(__MINGW32__) || defined(__MINGW64_VERSION_MAJOR) #include // For STRUNCATE #endif // !defined(__MINGW32__) || defined(__MINGW64_VERSION_MAJOR) #include // For INT_MAX and al. #include // For _beginthreadex(). #include // typedef and define the most commonly used Windows integer types. typedef int BOOL; // NOLINT(runtime/int) typedef unsigned long DWORD; // NOLINT(runtime/int) typedef long LONG; // NOLINT(runtime/int) typedef void* LPVOID; typedef void* PVOID; typedef void* HANDLE; #define WINAPI __stdcall #if defined(_WIN64) typedef unsigned __int64 ULONG_PTR, *PULONG_PTR; #else typedef __w64 unsigned long ULONG_PTR, *PULONG_PTR; // NOLINT(runtime/int) #endif typedef struct _RTL_SRWLOCK SRWLOCK; typedef struct _RTL_CONDITION_VARIABLE CONDITION_VARIABLE; typedef struct _RTL_CRITICAL_SECTION CRITICAL_SECTION; typedef struct _RTL_CRITICAL_SECTION_DEBUG* PRTL_CRITICAL_SECTION_DEBUG; // Declare V8 versions of some Windows structures. These are needed for // when we need a concrete type but don't want to pull in Windows.h. We can't // declare the Windows types so we declare our types and cast to the Windows // types in a few places. The sizes must match the Windows types so we verify // that with static asserts in platform-win32.cc. // ChromeToWindowsType functions are provided for pointer conversions. struct V8_SRWLOCK { PVOID Ptr; }; struct V8_CONDITION_VARIABLE { PVOID Ptr; }; struct V8_CRITICAL_SECTION { PRTL_CRITICAL_SECTION_DEBUG DebugInfo; LONG LockCount; LONG RecursionCount; HANDLE OwningThread; HANDLE LockSemaphore; ULONG_PTR SpinCount; }; inline SRWLOCK* V8ToWindowsType(V8_SRWLOCK* p) { return reinterpret_cast(p); } inline const SRWLOCK* V8ToWindowsType(const V8_SRWLOCK* p) { return reinterpret_cast(p); } inline CONDITION_VARIABLE* V8ToWindowsType(V8_CONDITION_VARIABLE* p) { return reinterpret_cast(p); } inline const CONDITION_VARIABLE* V8ToWindowsType( const V8_CONDITION_VARIABLE* p) { return reinterpret_cast(p); } inline CRITICAL_SECTION* V8ToWindowsType(V8_CRITICAL_SECTION* p) { return reinterpret_cast(p); } inline const CRITICAL_SECTION* V8ToWindowsType(const V8_CRITICAL_SECTION* p) { return reinterpret_cast(p); } /// Begin custom config. extern "C" { #define MEM_COALESCE_PLACEHOLDERS 0x00000001 #define MEM_PRESERVE_PLACEHOLDER 0x00000002 #define MEM_REPLACE_PLACEHOLDER 0x00004000 #define MEM_RESERVE_PLACEHOLDER 0x00040000 #include #include #undef DELETE #undef IN // V8 will use it's own bit operations. #undef RotateRight32 #undef RotateLeft32 } /// End custom config. #endif // V8_BASE_WIN32_HEADERS_H_ ================================================ FILE: parse_deps.py ================================================ #!/usr/bin/env python # Parses DEPS file and outputs json. # The DEPS file is just python code so we capture the vars in exec and convert to json. import sys import json def Var(arg): return '@' + arg def main(): deps_file = open(sys.argv[1], "r") deps_str = deps_file.read() deps_file.close() out = {} exec(deps_str, globals(), out) print(json.dumps(out)) if __name__ == "__main__": main() ================================================ FILE: patches/v8.patch ================================================ diff --git a/BUILD.gn b/BUILD.gn index e7b5853..1aa161a 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -1342,7 +1342,7 @@ config("toolchain") { } } - if (is_win) { + if (is_win && !use_zig_tc) { cflags += [ "/wd4245", # Conversion with signed/unsigned mismatch. "/wd4267", # Conversion with possible loss of data. @@ -1364,7 +1364,7 @@ config("toolchain") { ] } - if (!is_clang && is_win) { + if (!is_clang && is_win && !use_zig_tc) { cflags += [ "/wd4506", # Benign "no definition for inline function" diff --git a/src/ast/ast.cc b/src/ast/ast.cc index 34a26d9..bc79e17 100644 --- a/src/ast/ast.cc +++ b/src/ast/ast.cc @@ -30,6 +30,10 @@ #include "src/strings/string-stream.h" #include "src/zone/zone-list-inl.h" +// Turn off mingw defines since we're using them as tokens in the file. +#pragma push_macro("VOID") +#undef VOID + namespace v8 { namespace internal { @@ -1140,5 +1144,7 @@ const char* CallRuntime::debug_name() { #endif // DEBUG } +#pragma pop_macro("VOID") + } // namespace internal } // namespace v8 diff --git a/src/ast/prettyprinter.cc b/src/ast/prettyprinter.cc index e0cb7da..043b92e 100644 --- a/src/ast/prettyprinter.cc +++ b/src/ast/prettyprinter.cc @@ -15,6 +15,10 @@ #include "src/regexp/regexp-flags.h" #include "src/strings/string-builder-inl.h" +// Turn off mingw defines since we're using them as tokens in the file. +#pragma push_macro("VOID") +#undef VOID + namespace v8 { namespace internal { @@ -1484,5 +1488,7 @@ void AstPrinter::VisitSuperCallReference(SuperCallReference* node) { #endif // DEBUG +#pragma pop_macro("VOID") + } // namespace internal } // namespace v8 diff --git a/src/base/bits.h b/src/base/bits.h index 2d61878..831b91c 100644 --- a/src/base/bits.h +++ b/src/base/bits.h @@ -243,7 +243,6 @@ inline uint32_t RoundDownToPowerOfTwo32(uint32_t value) { return result; } - // Precondition: 0 <= shift < 32 inline constexpr uint32_t RotateRight32(uint32_t value, uint32_t shift) { return (value >> shift) | (value << ((32 - shift) & 31)); diff --git a/src/base/platform/platform-win32.cc b/src/base/platform/platform-win32.cc index 0eedaba..14638de 100644 --- a/src/base/platform/platform-win32.cc +++ b/src/base/platform/platform-win32.cc @@ -78,14 +78,14 @@ inline void MemoryFence() { #endif // __MINGW64_VERSION_MAJOR - +// Already included by mingw +/* int localtime_s(tm* out_tm, const time_t* time) { tm* posix_local_time_struct = localtime_r(time, out_tm); if (posix_local_time_struct == nullptr) return 1; return 0; } - int fopen_s(FILE** pFile, const char* filename, const char* mode) { *pFile = fopen(filename, mode); return *pFile != nullptr ? 0 : 1; @@ -128,6 +128,7 @@ int strncpy_s(char* dest, size_t dest_size, const char* source, size_t count) { *dest = 0; return 0; } +*/ #endif // __MINGW32__ diff --git a/src/compiler/revectorizer.cc b/src/compiler/revectorizer.cc index a680934..d433ec4 100644 --- a/src/compiler/revectorizer.cc +++ b/src/compiler/revectorizer.cc @@ -739,7 +739,7 @@ Node* Revectorizer::VectorizeTree(PackNode* pnode) { edge.to()->op()->mnemonic()); if (!input_128) { - TRACE("Create ExtractF128(%lu) node from #%d\n", i, + TRACE("Create ExtractF128(%zu) node from #%d\n", i, new_node->id()); input_128 = graph()->NewNode( mcgraph()->machine()->ExtractF128(int32_t(i)), new_node); diff --git a/src/interpreter/bytecode-generator.cc b/src/interpreter/bytecode-generator.cc index 706d897..5b0aac0 100644 --- a/src/interpreter/bytecode-generator.cc +++ b/src/interpreter/bytecode-generator.cc @@ -36,6 +36,10 @@ #include "src/parsing/token.h" #include "src/utils/ostreams.h" +// Turn off mingw defines since we're using them as tokens in the file. +#pragma push_macro("VOID") +#undef VOID + namespace v8 { namespace internal { namespace interpreter { @@ -7411,3 +7415,5 @@ FeedbackSlot BytecodeGenerator::GetDummyCompareICSlot() { } // namespace interpreter } // namespace internal } // namespace v8 + +#pragma push_macro("VOID") diff --git a/src/interpreter/bytecode-generator.h b/src/interpreter/bytecode-generator.h index 63174d4..6188067 100644 --- a/src/interpreter/bytecode-generator.h +++ b/src/interpreter/bytecode-generator.h @@ -13,6 +13,10 @@ #include "src/objects/feedback-vector.h" #include "src/objects/function-kind.h" +// Turn off mingw defines since we're using them as tokens in the file. +#pragma push_macro("VOID") +#undef VOID + namespace v8 { namespace internal { @@ -562,4 +566,6 @@ class BytecodeGenerator final : public AstVisitor { } // namespace internal } // namespace v8 +#pragma pop_macro("VOID") + #endif // V8_INTERPRETER_BYTECODE_GENERATOR_H_ diff --git a/src/parsing/keywords-gen.h b/src/parsing/keywords-gen.h index 3a8101b..232a16c 100644 --- a/src/parsing/keywords-gen.h +++ b/src/parsing/keywords-gen.h @@ -10,6 +10,12 @@ #include "src/parsing/token.h" +// Turn off mingw defines since we're using them as tokens in the file. +#pragma push_macro("CONST") +#pragma push_macro("VOID") +#undef CONST +#undef VOID + namespace v8 { namespace internal { @@ -174,4 +180,7 @@ inline Token::Value PerfectKeywordHash::GetToken(const char* str, int len) { } // namespace internal } // namespace v8 +#pragma pop_macro("VOID") +#pragma pop_macro("CONST") + #endif // V8_PARSING_KEYWORDS_GEN_H_ diff --git a/src/parsing/parser-base.h b/src/parsing/parser-base.h index 740a02e..a3dbd19 100644 --- a/src/parsing/parser-base.h +++ b/src/parsing/parser-base.h @@ -31,6 +31,10 @@ #include "src/regexp/regexp.h" #include "src/zone/zone-chunk-list.h" +// Turn off mingw defines since we're using them as tokens in the file. +#pragma push_macro("CONST") +#undef CONST + namespace v8 { namespace internal { @@ -6548,4 +6552,6 @@ void ParserBase::CheckClassFieldName(IdentifierT name, bool is_static) { } // namespace internal } // namespace v8 +#pragma pop_macro("CONST") + #endif // V8_PARSING_PARSER_BASE_H_ diff --git a/src/parsing/parser.cc b/src/parsing/parser.cc index aba8ca6..47ca6f1 100644 --- a/src/parsing/parser.cc +++ b/src/parsing/parser.cc @@ -33,6 +33,10 @@ #include "src/tracing/trace-event.h" #include "src/zone/zone-list-inl.h" +// Turn off mingw defines since we're using them as tokens in the file. +#pragma push_macro("CONST") +#undef CONST + namespace v8 { namespace internal { @@ -3681,3 +3685,5 @@ Statement* Parser::CheckCallable(Variable* var, Expression* error, int pos) { } // namespace internal } // namespace v8 + +#pragma pop_macro("CONST") diff --git a/src/parsing/token.h b/src/parsing/token.h index dabbff0..db8f327 100644 --- a/src/parsing/token.h +++ b/src/parsing/token.h @@ -10,6 +10,12 @@ #include "src/base/logging.h" #include "src/common/globals.h" +// Turn off mingw defines since we're using them as tokens in the file. +#pragma push_macro("CONST") +#pragma push_macro("VOID") +#undef CONST +#undef VOID + namespace v8 { namespace internal { @@ -349,4 +355,7 @@ class V8_EXPORT_PRIVATE Token { } // namespace internal } // namespace v8 +#pragma pop_macro("VOID") +#pragma pop_macro("CONST") + #endif // V8_PARSING_TOKEN_H_ diff --git a/src/profiler/heap-snapshot-generator.cc b/src/profiler/heap-snapshot-generator.cc index 763a540..6637f15 100644 --- a/src/profiler/heap-snapshot-generator.cc +++ b/src/profiler/heap-snapshot-generator.cc @@ -400,7 +400,8 @@ HeapSnapshot::HeapSnapshot(HeapProfiler* profiler, static_assert(kSystemPointerSize != 4 || sizeof(HeapGraphEdge) == 12); static_assert(kSystemPointerSize != 8 || sizeof(HeapGraphEdge) == 24); static_assert(kSystemPointerSize != 4 || sizeof(HeapEntry) == 32); -#if V8_CC_MSVC +// Since clang MINGW will use -mms-bitfields by default, it should have the same struct layout as MSVC. +#if V8_CC_MSVC || V8_CC_MINGW static_assert(kSystemPointerSize != 8 || sizeof(HeapEntry) == 48); #else // !V8_CC_MSVC static_assert(kSystemPointerSize != 8 || sizeof(HeapEntry) == 40); ================================================ FILE: patches/v8_build.patch ================================================ diff --git a/config/BUILD.gn b/config/BUILD.gn index 35c9a6275..37fd23e98 100644 --- a/config/BUILD.gn +++ b/config/BUILD.gn @@ -289,7 +289,7 @@ group("shared_library_deps") { # Executable configs ----------------------------------------------------------- # Windows linker setup for EXEs and DLLs. -if (is_win) { +if (is_win && !use_zig_tc) { _windows_linker_configs = [ "//build/config/win:sdk_link", "//build/config/win:common_linker_setup", @@ -300,9 +300,9 @@ if (is_win) { config("executable_config") { configs = [] - if (is_win) { + if (is_win && !use_zig_tc) { configs += _windows_linker_configs - } else if (is_mac) { + } else if (is_mac && !use_zig_tc) { configs += [ "//build/config/mac:mac_dynamic_flags" ] } else if (is_ios) { configs += [ @@ -332,9 +332,9 @@ config("executable_config") { config("shared_library_config") { configs = [] - if (is_win) { + if (is_win && !use_zig_tc) { configs += _windows_linker_configs - } else if (is_mac) { + } else if (is_mac && !use_zig_tc) { configs += [ "//build/config/mac:mac_dynamic_flags" ] } else if (is_ios) { configs += [ diff --git a/config/BUILDCONFIG.gn b/config/BUILDCONFIG.gn index cc7e92ddb..2d1db7e2a 100644 --- a/config/BUILDCONFIG.gn +++ b/config/BUILDCONFIG.gn @@ -158,6 +158,15 @@ declare_args() { # DON'T ADD MORE FLAGS HERE. Read the comment above. } +declare_args() { + use_zig_tc = false + cxx_use_ld = "ldd" + zig_cc = "" + zig_cxx = "" + host_zig_cc = "" + host_zig_cxx = "" +} + declare_args() { # Debug build. Enabling official builds automatically sets is_debug to false. is_debug = !is_official_build @@ -354,7 +363,7 @@ default_compiler_configs = [ "//build/config/sanitizers:default_sanitizer_flags", ] -if (is_win) { +if (is_win && !use_zig_tc) { default_compiler_configs += [ "//build/config/win:default_cfg_compiler", "//build/config/win:default_crt", @@ -411,7 +420,7 @@ set_defaults("rust_proc_macro") { # Compute the set of configs common to all linked targets (shared libraries, # loadable modules, executables) to avoid duplication below. -if (is_win) { +if (is_win && !use_zig_tc) { # Many targets remove these configs, so they are not contained within # //build/config:executable_config for easy removal. _linker_configs = [ @@ -421,7 +430,7 @@ if (is_win) { # that shouldn't use the windows subsystem. "//build/config/win:console", ] -} else if (is_mac) { +} else if (is_mac && !use_zig_tc) { _linker_configs = [ "//build/config/mac:strip_all" ] } else { _linker_configs = [] @@ -433,7 +442,7 @@ default_executable_configs = default_compiler_configs + [ "//build/config:executable_config", ] + _linker_configs -if (is_win) { +if (is_win && !use_zig_tc) { # Turn on linker CFI for executables, and position it so it can be removed # if needed. default_executable_configs += [ "//build/config/win:cfi_linker" ] @@ -449,7 +458,7 @@ default_shared_library_configs = default_compiler_configs + [ "//build/config:default_libs", "//build/config:shared_library_config", ] + _linker_configs -if (is_win) { +if (is_win && !use_zig_tc) { # Turn on linker CFI for DLLs, and position it so it can be removed if needed. default_shared_library_configs += [ "//build/config/win:cfi_linker" ] } diff --git a/config/compiler/BUILD.gn b/config/compiler/BUILD.gn index 50be57ff8..ddac52169 100644 --- a/config/compiler/BUILD.gn +++ b/config/compiler/BUILD.gn @@ -263,7 +263,7 @@ config("compiler") { # System-specific flags. If your compiler flags apply to one of the # categories here, add it to the associated file to keep this shared config # smaller. - if (is_win) { + if (is_win && !use_zig_tc) { configs += [ "//build/config/win:compiler" ] } else if (is_android) { configs += [ "//build/config/android:compiler" ] @@ -271,7 +271,7 @@ config("compiler") { configs += [ "//build/config/linux:compiler" ] } else if (is_nacl) { configs += [ "//build/config/nacl:compiler" ] - } else if (is_mac) { + } else if (is_mac && !use_zig_tc) { configs += [ "//build/config/mac:compiler" ] } else if (is_ios) { configs += [ "//build/config/ios:compiler" ] @@ -292,6 +292,11 @@ config("compiler") { ":compiler_deterministic", ] + if (use_zig_tc) { + # We'll provide the target flags from build.zig. + configs -= [ ":compiler_cpu_abi" ] + } + # Here we enable -fno-delete-null-pointer-checks, which makes various nullptr # operations (e.g. dereferencing) into defined behavior. This avoids deletion # of some security-critical code: see https://crbug.com/1139129. @@ -344,7 +349,7 @@ config("compiler") { } if (use_lld) { - ldflags += [ "-fuse-ld=lld" ] + ldflags += [ "-fuse-ld=${cxx_use_ld}" ] if (lld_path != "") { ldflags += [ "-B$lld_path" ] } @@ -562,7 +567,7 @@ config("compiler") { } # TODO(crbug.com/1235145): Investigate why/if this should be needed. - if (is_win) { + if (is_win && !use_zig_tc) { cflags += [ "/clang:-ffp-contract=off" ] } else { cflags += [ "-ffp-contract=off" ] @@ -621,7 +626,7 @@ config("compiler") { # support "c++20"/"gnu++20". cflags_cc += [ "-std=${standard_prefix}++2a" ] } - } else if (is_win) { + } else if (is_win && !use_zig_tc) { cflags_c += [ "/std:c11" ] if (use_cxx17 || (!is_clang && defined(msvc_use_cxx17) && msvc_use_cxx17)) { cflags_cc += [ "/std:c++17" ] @@ -1473,7 +1478,7 @@ config("runtime_library") { # System-specific flags. If your compiler flags apply to one of the # categories here, add it to the associated file to keep this shared config # smaller. - if (is_win) { + if (is_win && !use_zig_tc) { configs += [ "//build/config/win:runtime_library" ] } else if (is_linux || is_chromeos) { configs += [ "//build/config/linux:runtime_library" ] @@ -1483,7 +1488,9 @@ config("runtime_library") { } else if (is_ios) { configs += [ "//build/config/ios:runtime_library" ] } else if (is_mac) { - configs += [ "//build/config/mac:runtime_library" ] + if (!use_zig_tc) { + configs += [ "//build/config/mac:runtime_library" ] + } } else if (is_android) { configs += [ "//build/config/android:runtime_library" ] } @@ -1504,7 +1511,7 @@ config("default_warnings") { cflags_cc = [] ldflags = [] - if (is_win) { + if (is_win && !use_zig_tc) { if (treat_warnings_as_errors) { cflags += [ "/WX" ] } @@ -1684,7 +1691,7 @@ config("prevent_unsafe_narrowing") { # part of Chromium. config("chromium_code") { - if (is_win) { + if (is_win && !use_zig_tc) { if (is_clang) { cflags = [ "/W4" ] # Warning level 4. @@ -1771,7 +1778,7 @@ config("no_chromium_code") { cflags_cc = [] defines = [] - if (is_win) { + if (is_win && !use_zig_tc) { if (is_clang) { cflags += [ "/W3" ] # Warning level 3. } @@ -1848,7 +1855,7 @@ config("rtti") { config("no_rtti") { # Some sanitizer configs may require RTTI to be left enabled globally if (!use_rtti) { - if (is_win) { + if (is_win && !use_zig_tc) { cflags_cc = [ "/GR-" ] } else { cflags_cc = [ "-fno-rtti" ] @@ -1890,7 +1897,7 @@ config("thin_archive") { # archives. # TODO(crbug.com/1221615): Enable on is_apple if use_lld once that no longer # confuses lldb. - if ((is_posix && !is_nacl && !is_apple) || is_fuchsia) { + if ((is_posix && !is_nacl && !is_apple) || is_fuchsia || use_zig_tc) { arflags = [ "-T" ] } else if (is_win && use_lld) { arflags = [ "/llvmlibthin" ] @@ -1982,7 +1989,7 @@ config("no_incompatible_pointer_warnings") { # Shared settings for both "optimize" and "optimize_max" configs. # IMPORTANT: On Windows "/O1" and "/O2" must go before the common flags. -if (is_win) { +if (is_win && !use_zig_tc) { common_optimize_on_cflags = [ "/Ob2", # Both explicit and auto inlining. "/Oy-", # Disable omitting frame pointers, must be after /O2. @@ -2088,7 +2095,7 @@ config("default_stack_frames") { # Default "optimization on" config. config("optimize") { - if (is_win) { + if (is_win && !use_zig_tc) { if (chrome_pgo_phase != 2) { # Favor size over speed, /O1 must be before the common flags. # /O1 implies /Os and /GF. @@ -2199,7 +2206,7 @@ config("optimize_max") { configs = [ "//build/config/nacl:irt_optimize" ] } else { ldflags = common_optimize_on_ldflags - if (is_win) { + if (is_win && !use_zig_tc) { # Favor speed over size, /O2 must be before the common flags. # /O2 implies /Ot, /Oi, and /GF. cflags = [ "/O2" ] + common_optimize_on_cflags @@ -2232,7 +2239,7 @@ config("optimize_speed") { configs = [ "//build/config/nacl:irt_optimize" ] } else { ldflags = common_optimize_on_ldflags - if (is_win) { + if (is_win && !use_zig_tc) { # Favor speed over size, /O2 must be before the common flags. # /O2 implies /Ot, /Oi, and /GF. cflags = [ "/O2" ] + common_optimize_on_cflags diff --git a/config/linux/BUILD.gn b/config/linux/BUILD.gn index 131bb71d1..5cde9fff4 100644 --- a/config/linux/BUILD.gn +++ b/config/linux/BUILD.gn @@ -42,7 +42,10 @@ config("runtime_library") { if ((!is_chromeos || default_toolchain != "//build/toolchain/cros:target") && (!use_custom_libcxx || current_cpu == "mipsel")) { - libs = [ "atomic" ] + if (!use_zig_tc) { + # -latomic won't be found when using zig tc, it's already compiled from zig libcxx source + libs = [ "atomic" ] + } } } diff --git a/config/sysroot.gni b/config/sysroot.gni index dea380727..2f493a04f 100644 --- a/config/sysroot.gni +++ b/config/sysroot.gni @@ -65,7 +65,7 @@ if (sysroot == "") { "string") == "True", "Missing sysroot ($sysroot). To fix, run: build/linux/sysroot_scripts/install-sysroot.py --arch=$_script_arch") } - } else if (is_mac) { + } else if (is_mac && !use_zig_tc) { import("//build/config/mac/mac_sdk.gni") sysroot = mac_sdk_path } else if (is_ios) { diff --git a/toolchain/gcc_toolchain.gni b/toolchain/gcc_toolchain.gni index 48f931764..21db4578c 100644 --- a/toolchain/gcc_toolchain.gni +++ b/toolchain/gcc_toolchain.gni @@ -361,11 +361,13 @@ template("gcc_toolchain") { extra_ldflags = "" } + if (!use_zig_tc) { if (system_headers_in_deps) { md = "-MD" } else { md = "-MMD" } + } enable_linker_map = defined(invoker.enable_linker_map) && invoker.enable_linker_map && generate_linker_map @@ -380,7 +382,11 @@ template("gcc_toolchain") { tool("cc") { depfile = "{{output}}.d" precompiled_header_type = "gcc" - command = "$cc $md -MF $depfile ${rebuild_string}{{defines}} {{include_dirs}} {{cflags}} {{cflags_c}}${extra_cppflags}${extra_cflags} -c {{source}} -o {{output}}" + if (use_zig_tc) { + command = "$cc ${rebuild_string}{{defines}} {{include_dirs}} {{cflags}} {{cflags_c}}${extra_cppflags}${extra_cflags} -c {{source}} -o {{output}}" + } else { + command = "$cc $md -MF $depfile ${rebuild_string}{{defines}} {{include_dirs}} {{cflags}} {{cflags_c}}${extra_cppflags}${extra_cflags} -c {{source}} -o {{output}}" + } depsformat = "gcc" description = "CC {{output}}" outputs = [ "$object_subdir/{{source_name_part}}.o" ] @@ -389,7 +395,11 @@ template("gcc_toolchain") { tool("cxx") { depfile = "{{output}}.d" precompiled_header_type = "gcc" - command = "$cxx $md -MF $depfile ${rebuild_string}{{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}}${extra_cppflags}${extra_cxxflags} -c {{source}} -o {{output}}" + if (use_zig_tc) { + command = "$cxx ${rebuild_string}{{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}}${extra_cppflags}${extra_cxxflags} -c {{source}} -o {{output}}" + } else { + command = "$cxx $md -MF $depfile ${rebuild_string}{{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}}${extra_cppflags}${extra_cxxflags} -c {{source}} -o {{output}}" + } depsformat = "gcc" description = "CXX {{output}}" outputs = [ "$object_subdir/{{source_name_part}}.o" ] @@ -398,7 +408,11 @@ template("gcc_toolchain") { tool("asm") { # For GCC we can just use the C compiler to compile assembly. depfile = "{{output}}.d" - command = "$asm $md -MF $depfile ${rebuild_string}{{defines}} {{include_dirs}} {{asmflags}}${extra_asmflags} -c {{source}} -o {{output}}" + if (use_zig_tc) { + command = "$asm ${rebuild_string}{{defines}} {{include_dirs}} {{asmflags}}${extra_asmflags} -c {{source}} -o {{output}}" + } else { + command = "$asm $md -MF $depfile ${rebuild_string}{{defines}} {{include_dirs}} {{asmflags}}${extra_asmflags} -c {{source}} -o {{output}}" + } depsformat = "gcc" description = "ASM {{output}}" outputs = [ "$object_subdir/{{source_name_part}}.o" ] @@ -412,7 +426,11 @@ template("gcc_toolchain") { } else { rspfile = "{{output}}.rsp" rspfile_content = "{{inputs}}" - command = "\"$ar\" {{arflags}} -r -c -s -D {{output}} @\"$rspfile\"" + if (use_zig_tc) { + command = "$ar {{arflags}} -r -c -s -D {{output}} @\"$rspfile\"" + } else { + command = "\"$ar\" {{arflags}} -r -c -s -D {{output}} @\"$rspfile\"" + } } # Remove the output file first so that ar doesn't try to modify the ================================================ FILE: src/binding.cpp ================================================ // Based on https://github.com/denoland/rusty_v8/blob/main/src/binding.cc #include #include "include/libplatform/libplatform.h" #include "include/v8.h" #include "src/api/api.h" template class Wrapper { public: Wrapper(T* buf, Args... args) : inner_(args...) {} private: T inner_; }; template void construct_in_place(T* buf, Args... args) { new (buf) Wrapper(buf, std::forward(args)...); } template inline static T* local_to_ptr(v8::Local local) { return *local; } template inline static const v8::Local ptr_to_local(const T* ptr) { static_assert(sizeof(v8::Local) == sizeof(T*), ""); auto local = *reinterpret_cast*>(&ptr); assert(*local == ptr); return local; } template inline static const v8::MaybeLocal ptr_to_maybe_local(const T* ptr) { static_assert(sizeof(v8::MaybeLocal) == sizeof(T*), ""); return *reinterpret_cast*>(&ptr); } template inline static T* maybe_local_to_ptr(v8::MaybeLocal local) { return *local.FromMaybe(v8::Local()); } template inline static v8::Local* const_ptr_array_to_local_array( const T* const ptr_array[]) { static_assert(sizeof(v8::Local) == sizeof(T*), ""); auto mut_ptr_array = const_cast(ptr_array); auto mut_local_array = reinterpret_cast*>(mut_ptr_array); return mut_local_array; } struct SharedPtr { void* a; void* b; }; // The destructor of V is never called. // P is not allowed to have a destructor. template struct make_pod { template inline make_pod(V&& value) : pod_(helper(std::move(value))) {} template inline make_pod(const V& value) : pod_(helper(value)) {} inline operator P() { return pod_; } private: P pod_; // This helper exists to avoid calling the destructor. // Using a union is a C++ trick to achieve this. template union helper { static_assert(std::is_pod

::value, "type P must a pod type"); static_assert(sizeof(V) == sizeof(P), "type P must be same size as type V"); static_assert(alignof(V) == alignof(P), "alignment of type P must be compatible with that of type V"); inline helper(V&& value) : value_(std::move(value)) {} inline helper(const V& value) : value_(value) {} inline ~helper() {} inline operator P() { // Do a memcpy here avoid undefined behavior. P result; memcpy(&result, this, sizeof result); return result; } private: V value_; }; }; extern "C" { // Platform v8::Platform* v8__Platform__NewDefaultPlatform( int thread_pool_size, bool idle_task_support) { return v8::platform::NewDefaultPlatform( thread_pool_size, idle_task_support ? v8::platform::IdleTaskSupport::kEnabled : v8::platform::IdleTaskSupport::kDisabled, v8::platform::InProcessStackDumping::kDisabled, nullptr ).release(); } void v8__Platform__DELETE(v8::Platform* self) { delete self; } bool v8__Platform__PumpMessageLoop( v8::Platform* platform, v8::Isolate* isolate, bool wait_for_work) { return v8::platform::PumpMessageLoop( platform, isolate, wait_for_work ? v8::platform::MessageLoopBehavior::kWaitForWork : v8::platform::MessageLoopBehavior::kDoNotWait); } // Root const v8::Primitive* v8__Undefined(v8::Isolate* isolate) { return local_to_ptr(v8::Undefined(isolate)); } const v8::Primitive* v8__Null(v8::Isolate* isolate) { return local_to_ptr(v8::Null(isolate)); } const v8::Boolean* v8__True(v8::Isolate* isolate) { return local_to_ptr(v8::True(isolate)); } const v8::Boolean* v8__False(v8::Isolate* isolate) { return local_to_ptr(v8::False(isolate)); } const v8::Uint8Array* v8__Uint8Array__New( const v8::ArrayBuffer& buf, size_t byte_offset, size_t length) { return local_to_ptr( v8::Uint8Array::New(ptr_to_local(&buf), byte_offset, length) ); } // V8 const char* v8__V8__GetVersion() { return v8::V8::GetVersion(); } void v8__V8__InitializePlatform(v8::Platform* platform) { v8::V8::InitializePlatform(platform); } void v8__V8__Initialize() { v8::V8::Initialize(); } int v8__V8__Dispose() { return v8::V8::Dispose(); } void v8__V8__DisposePlatform() { v8::V8::DisposePlatform(); } // Isolate v8::Isolate* v8__Isolate__New(const v8::Isolate::CreateParams& params) { return v8::Isolate::New(params); } void v8__Isolate__Dispose(v8::Isolate* isolate) { isolate->Dispose(); } void v8__Isolate__Enter(v8::Isolate* isolate) { isolate->Enter(); } void v8__Isolate__Exit(v8::Isolate* isolate) { isolate->Exit(); } const v8::Context* v8__Isolate__GetCurrentContext(v8::Isolate* isolate) { return local_to_ptr(isolate->GetCurrentContext()); } size_t v8__Isolate__CreateParams__SIZEOF() { return sizeof(v8::Isolate::CreateParams); } void v8__Isolate__CreateParams__CONSTRUCT(v8::Isolate::CreateParams* buf) { // Use in place new constructor otherwise special fields like shared_ptr will attempt to do copy and fail if the buffer had undefined values. new (buf) v8::Isolate::CreateParams(); } const v8::Value* v8__Isolate__ThrowException( v8::Isolate* isolate, const v8::Value& exception) { return local_to_ptr(isolate->ThrowException(ptr_to_local(&exception))); } void v8__Isolate__SetPromiseRejectCallback( v8::Isolate* isolate, v8::PromiseRejectCallback callback) { isolate->SetPromiseRejectCallback(callback); } v8::MicrotasksPolicy v8__Isolate__GetMicrotasksPolicy(const v8::Isolate* self) { return self->GetMicrotasksPolicy(); } void v8__Isolate__SetMicrotasksPolicy( v8::Isolate* self, v8::MicrotasksPolicy policy) { self->SetMicrotasksPolicy(policy); } void v8__Isolate__PerformMicrotaskCheckpoint(v8::Isolate* self) { self->PerformMicrotaskCheckpoint(); } bool v8__Isolate__AddMessageListener( v8::Isolate* self, v8::MessageCallback callback) { return self->AddMessageListener(callback); } bool v8__Isolate__AddMessageListenerWithErrorLevel( v8::Isolate* self, v8::MessageCallback callback, int message_levels, const v8::Value& data) { return self->AddMessageListenerWithErrorLevel(callback, message_levels, ptr_to_local(&data)); } void v8__Isolate__SetCaptureStackTraceForUncaughtExceptions( v8::Isolate* isolate, bool capture, int frame_limit) { isolate->SetCaptureStackTraceForUncaughtExceptions(capture, frame_limit); } void v8__Isolate__TerminateExecution(v8::Isolate* self) { self->TerminateExecution(); } bool v8__Isolate__IsExecutionTerminating(v8::Isolate* self) { return self->IsExecutionTerminating(); } void v8__Isolate__CancelTerminateExecution(v8::Isolate* self) { self->CancelTerminateExecution(); } void v8__Isolate__LowMemoryNotification(v8::Isolate* self) { self->LowMemoryNotification(); } void v8__Isolate__GetHeapStatistics( v8::Isolate* self, v8::HeapStatistics* stats) { self->GetHeapStatistics(stats); } size_t v8__HeapStatistics__SIZEOF() { return sizeof(v8::HeapStatistics); } // ArrayBuffer v8::ArrayBuffer::Allocator* v8__ArrayBuffer__Allocator__NewDefaultAllocator() { return v8::ArrayBuffer::Allocator::NewDefaultAllocator(); } void v8__ArrayBuffer__Allocator__DELETE(v8::ArrayBuffer::Allocator* self) { delete self; } v8::BackingStore* v8__ArrayBuffer__NewBackingStore( v8::Isolate* isolate, size_t byte_len) { std::unique_ptr store = v8::ArrayBuffer::NewBackingStore(isolate, byte_len); return store.release(); } v8::BackingStore* v8__ArrayBuffer__NewBackingStore2( void* data, size_t byte_len, v8::BackingStoreDeleterCallback deleter, void* deleter_data) { std::unique_ptr store = v8::ArrayBuffer::NewBackingStore(data, byte_len, deleter, deleter_data); return store.release(); } void* v8__BackingStore__Data(const v8::BackingStore& self) { return self.Data(); } size_t v8__BackingStore__ByteLength(const v8::BackingStore& self) { return self.ByteLength(); } bool v8__BackingStore__IsShared(const v8::BackingStore& self) { return self.IsShared(); } SharedPtr v8__BackingStore__TO_SHARED_PTR(v8::BackingStore* unique_ptr) { return make_pod(std::shared_ptr(unique_ptr)); } void std__shared_ptr__v8__BackingStore__reset(std::shared_ptr* self) { self->reset(); } v8::BackingStore* std__shared_ptr__v8__BackingStore__get(const std::shared_ptr& self) { return self.get(); } long std__shared_ptr__v8__BackingStore__use_count(const std::shared_ptr& self) { return self.use_count(); } const v8::ArrayBuffer* v8__ArrayBuffer__New( v8::Isolate* isolate, size_t byte_len) { return local_to_ptr(v8::ArrayBuffer::New(isolate, byte_len)); } const v8::ArrayBuffer* v8__ArrayBuffer__New2( v8::Isolate* isolate, const std::shared_ptr& backing_store) { return local_to_ptr(v8::ArrayBuffer::New(isolate, backing_store)); } size_t v8__ArrayBuffer__ByteLength(const v8::ArrayBuffer& self) { return self.ByteLength(); } SharedPtr v8__ArrayBuffer__GetBackingStore(const v8::ArrayBuffer& self) { return make_pod(ptr_to_local(&self)->GetBackingStore()); } // ArrayBufferView const v8::ArrayBuffer* v8__ArrayBufferView__Buffer(const v8::ArrayBufferView& self) { return local_to_ptr(ptr_to_local(&self)->Buffer()); } // HandleScope void v8__HandleScope__CONSTRUCT(v8::HandleScope* buf, v8::Isolate* isolate) { // We can't do in place new, since new is overloaded for HandleScope. // Use in place construct instead. construct_in_place(buf, isolate); } void v8__HandleScope__DESTRUCT(v8::HandleScope* scope) { scope->~HandleScope(); } // Context v8::Context* v8__Context__New( v8::Isolate* isolate, const v8::ObjectTemplate* global_tmpl, const v8::Value* global_obj) { return local_to_ptr( v8::Context::New(isolate, nullptr, ptr_to_maybe_local(global_tmpl), ptr_to_maybe_local(global_obj)) ); } void v8__Context__Enter(const v8::Context& context) { ptr_to_local(&context)->Enter(); } void v8__Context__Exit(const v8::Context& context) { ptr_to_local(&context)->Exit(); } v8::Isolate* v8__Context__GetIsolate(const v8::Context& self) { return ptr_to_local(&self)->GetIsolate(); } const v8::Object* v8__Context__Global( const v8::Context& self) { return local_to_ptr(ptr_to_local(&self)->Global()); } const v8::Value* v8__Context__GetEmbedderData( const v8::Context& self, int idx) { return local_to_ptr(ptr_to_local(&self)->GetEmbedderData(idx)); } void v8__Context__SetEmbedderData( const v8::Context& self, int idx, const v8::Value& val) { ptr_to_local(&self)->SetEmbedderData(idx, ptr_to_local(&val)); } // ScriptOrigin void v8__ScriptOrigin__CONSTRUCT( v8::ScriptOrigin* buf, v8::Isolate* isolate, const v8::Value& resource_name) { new (buf) v8::ScriptOrigin(isolate, ptr_to_local(&resource_name)); } void v8__ScriptOrigin__CONSTRUCT2( v8::ScriptOrigin* buf, v8::Isolate* isolate, const v8::Value& resource_name, int resource_line_offset, int resource_column_offset, bool resource_is_shared_cross_origin, int script_id, const v8::Value& source_map_url, bool resource_is_opaque, bool is_wasm, bool is_module, const v8::Data& host_defined_options) { new (buf) v8::ScriptOrigin( isolate, ptr_to_local(&resource_name), resource_line_offset, resource_column_offset, resource_is_shared_cross_origin, script_id, ptr_to_local(&source_map_url), resource_is_opaque, is_wasm, is_module, ptr_to_local(&host_defined_options) ); } // Script v8::Script* v8__Script__Compile( const v8::Context& context, const v8::String& src, const v8::ScriptOrigin& origin) { return maybe_local_to_ptr( v8::Script::Compile(ptr_to_local(&context), ptr_to_local(&src), const_cast(&origin)) ); } v8::Value* v8__Script__Run( const v8::Script& script, const v8::Context& context) { return maybe_local_to_ptr(ptr_to_local(&script)->Run(ptr_to_local(&context))); } // ScriptCompiler size_t v8__ScriptCompiler__Source__SIZEOF() { return sizeof(v8::ScriptCompiler::Source); } void v8__ScriptCompiler__Source__CONSTRUCT( const v8::String& src, v8::ScriptCompiler::CachedData* cached_data, v8::ScriptCompiler::Source* out) { new (out) v8::ScriptCompiler::Source(ptr_to_local(&src), cached_data); } void v8__ScriptCompiler__Source__CONSTRUCT2( const v8::String& src, const v8::ScriptOrigin* origin, v8::ScriptCompiler::CachedData* cached_data, v8::ScriptCompiler::Source* out) { new (out) v8::ScriptCompiler::Source(ptr_to_local(&src), *origin, cached_data); } void v8__ScriptCompiler__Source__DESTRUCT(v8::ScriptCompiler::Source* self) { self->~Source(); } size_t v8__ScriptCompiler__CachedData__SIZEOF() { return sizeof(v8::ScriptCompiler::CachedData); } v8::ScriptCompiler::CachedData* v8__ScriptCompiler__CachedData__NEW( const uint8_t* data, int length) { return new v8::ScriptCompiler::CachedData( data, length, v8::ScriptCompiler::CachedData::BufferNotOwned ); } void v8__ScriptCompiler__CachedData__DELETE(v8::ScriptCompiler::CachedData* self) { delete self; } const v8::Module* v8__ScriptCompiler__CompileModule( v8::Isolate* isolate, v8::ScriptCompiler::Source* source, v8::ScriptCompiler::CompileOptions options, v8::ScriptCompiler::NoCacheReason reason) { v8::MaybeLocal maybe_local = v8::ScriptCompiler::CompileModule(isolate, source, options, reason); return maybe_local_to_ptr(maybe_local); } // Module v8::Module::Status v8__Module__GetStatus(const v8::Module& self) { return self.GetStatus(); } const v8::Value* v8__Module__GetException(const v8::Module& self) { return local_to_ptr(self.GetException()); } const v8::FixedArray* v8__Module__GetModuleRequests(const v8::Module& self) { return local_to_ptr(self.GetModuleRequests()); } void v8__Module__InstantiateModule( const v8::Module& self, const v8::Context& ctx, v8::Module::ResolveModuleCallback cb, v8::Maybe* out) { *out = ptr_to_local(&self)->InstantiateModule(ptr_to_local(&ctx), cb); } const v8::Value* v8__Module__Evaluate( const v8::Module& self, const v8::Context& ctx) { return maybe_local_to_ptr(ptr_to_local(&self)->Evaluate(ptr_to_local(&ctx))); } int v8__Module__GetIdentityHash(const v8::Module& self) { return self.GetIdentityHash(); } int v8__Module__ScriptId(const v8::Module& self) { return self.ScriptId(); } // ModuleRequest const v8::String* v8__ModuleRequest__GetSpecifier(const v8::ModuleRequest& self) { return local_to_ptr(self.GetSpecifier()); } int v8__ModuleRequest__GetSourceOffset(const v8::ModuleRequest& self) { return self.GetSourceOffset(); } // FixedArray int v8__FixedArray__Length(const v8::FixedArray& self) { return self.Length(); } const v8::Data* v8__FixedArray__Get( const v8::FixedArray& self, const v8::Context& ctx, int idx) { return local_to_ptr(ptr_to_local(&self)->Get(ptr_to_local(&ctx), idx)); } // String v8::String* v8__String__NewFromUtf8( v8::Isolate* isolate, const char* data, v8::NewStringType type, int length) { return maybe_local_to_ptr( v8::String::NewFromUtf8(isolate, data, type, length) ); } int v8__String__WriteUtf8( const v8::String& str, v8::Isolate* isolate, char* buffer, int length, int* nchars_ref, int options) { return str.WriteUtf8(isolate, buffer, length, nchars_ref, options); } int v8__String__Utf8Length(const v8::String& self, v8::Isolate* isolate) { return self.Utf8Length(isolate); } // Boolean const v8::Boolean* v8__Boolean__New( v8::Isolate* isolate, bool value) { return local_to_ptr(v8::Boolean::New(isolate, value)); } // Number const v8::Number* v8__Number__New( v8::Isolate* isolate, double value) { return *v8::Number::New(isolate, value); } // Integer const v8::Integer* v8__Integer__New( v8::Isolate* isolate, int32_t value) { return *v8::Integer::New(isolate, value); } const v8::Integer* v8__Integer__NewFromUnsigned( v8::Isolate* isolate, uint32_t value) { return *v8::Integer::NewFromUnsigned(isolate, value); } int64_t v8__Integer__Value(const v8::Integer& self) { return self.Value(); } // BigInt const v8::BigInt* v8__BigInt__New( v8::Isolate* iso, int64_t val) { return local_to_ptr(v8::BigInt::New(iso, val)); } const v8::BigInt* v8__BigInt__NewFromUnsigned( v8::Isolate* iso, uint64_t val) { return local_to_ptr(v8::BigInt::NewFromUnsigned(iso, val)); } uint64_t v8__BigInt__Uint64Value( const v8::BigInt& self, bool* lossless) { return ptr_to_local(&self)->Uint64Value(lossless); } int64_t v8__BigInt__Int64Value( const v8::BigInt& self, bool* lossless) { return ptr_to_local(&self)->Int64Value(lossless); } // Promise const v8::Promise::Resolver* v8__Promise__Resolver__New( const v8::Context& ctx) { return maybe_local_to_ptr( v8::Promise::Resolver::New(ptr_to_local(&ctx)) ); } const v8::Promise* v8__Promise__Resolver__GetPromise( const v8::Promise::Resolver& self) { return local_to_ptr(ptr_to_local(&self)->GetPromise()); } void v8__Promise__Resolver__Resolve( const v8::Promise::Resolver& self, const v8::Context& ctx, const v8::Value& value, v8::Maybe* out) { *out = ptr_to_local(&self)->Resolve( ptr_to_local(&ctx), ptr_to_local(&value) ); } void v8__Promise__Resolver__Reject( const v8::Promise::Resolver& self, const v8::Context& ctx, const v8::Value& value, v8::Maybe* out) { *out = ptr_to_local(&self)->Reject( ptr_to_local(&ctx), ptr_to_local(&value) ); } const v8::Promise* v8__Promise__Catch( const v8::Promise& self, const v8::Context& ctx, const v8::Function& handler) { return maybe_local_to_ptr( ptr_to_local(&self)->Catch(ptr_to_local(&ctx), ptr_to_local(&handler)) ); } const v8::Promise* v8__Promise__Then( const v8::Promise& self, const v8::Context& ctx, const v8::Function& handler) { return maybe_local_to_ptr( ptr_to_local(&self)->Then(ptr_to_local(&ctx), ptr_to_local(&handler)) ); } const v8::Promise* v8__Promise__Then2( const v8::Promise& self, const v8::Context& ctx, const v8::Function& on_fulfilled, const v8::Function& on_rejected) { return maybe_local_to_ptr( ptr_to_local(&self)->Then( ptr_to_local(&ctx), ptr_to_local(&on_fulfilled), ptr_to_local(&on_rejected) ) ); } v8::Promise::PromiseState v8__Promise__State(const v8::Promise& self) { return ptr_to_local(&self)->State(); } void v8__Promise__MarkAsHandled(const v8::Promise& self) { ptr_to_local(&self)->MarkAsHandled(); } const v8::Value* v8__Promise__Result(const v8::Promise& self) { return local_to_ptr(ptr_to_local(&self)->Result()); } // Value const v8::String* v8__Value__ToString( const v8::Value& self, const v8::Context& ctx) { return maybe_local_to_ptr(self.ToString(ptr_to_local(&ctx))); } const v8::String* v8__Value__ToDetailString( const v8::Value& self, const v8::Context& ctx) { return maybe_local_to_ptr(self.ToDetailString(ptr_to_local(&ctx))); } bool v8__Value__BooleanValue( const v8::Value& self, v8::Isolate* isolate) { return self.BooleanValue(isolate); } void v8__Value__Uint32Value( const v8::Value& self, const v8::Context& ctx, v8::Maybe* out) { *out = self.Uint32Value(ptr_to_local(&ctx)); } void v8__Value__Int32Value( const v8::Value& self, const v8::Context& ctx, v8::Maybe* out) { *out = self.Int32Value(ptr_to_local(&ctx)); } void v8__Value__NumberValue( const v8::Value& self, const v8::Context& ctx, v8::Maybe* out) { *out = self.NumberValue(ptr_to_local(&ctx)); } bool v8__Value__IsFunction(const v8::Value& self) { return self.IsFunction(); } bool v8__Value__IsAsyncFunction(const v8::Value& self) { return self.IsAsyncFunction(); } bool v8__Value__IsObject(const v8::Value& self) { return self.IsObject(); } bool v8__Value__IsString(const v8::Value& self) { return self.IsString(); } bool v8__Value__IsArray(const v8::Value& self) { return self.IsArray(); } bool v8__Value__IsArrayBuffer(const v8::Value& self) { return self.IsArrayBuffer(); } bool v8__Value__IsArrayBufferView(const v8::Value& self) { return self.IsArrayBufferView(); } bool v8__Value__IsUint8Array(const v8::Value& self) { return self.IsUint8Array(); } bool v8__Value__IsExternal(const v8::Value& self) { return self.IsExternal(); } bool v8__Value__IsTrue(const v8::Value& self) { return self.IsTrue(); } bool v8__Value__IsFalse(const v8::Value& self) { return self.IsFalse(); } bool v8__Value__IsUndefined(const v8::Value& self) { return self.IsUndefined(); } bool v8__Value__IsNull(const v8::Value& self) { return self.IsNull(); } bool v8__Value__IsNullOrUndefined(const v8::Value& self) { return self.IsNullOrUndefined(); } bool v8__Value__IsNativeError(const v8::Value& self) { return self.IsNativeError(); } bool v8__Value__IsBigInt(const v8::Value& self) { return self.IsBigInt(); } bool v8__Value__IsBigIntObject(const v8::Value& self) { return self.IsBigIntObject(); } void v8__Value__InstanceOf( const v8::Value& self, const v8::Context& ctx, const v8::Object& object, v8::Maybe* out) { *out = ptr_to_local(&self)->InstanceOf(ptr_to_local(&ctx), ptr_to_local(&object)); } // Template void v8__Template__Set( const v8::Template& self, const v8::Name& key, const v8::Data& value, v8::PropertyAttribute attr) { ptr_to_local(&self)->Set(ptr_to_local(&key), ptr_to_local(&value), attr); } void v8__Template__SetAccessorProperty__DEFAULT( const v8::Template& self, const v8::Name& key, const v8::FunctionTemplate& getter) { ptr_to_local(&self)->SetAccessorProperty(ptr_to_local(&key), ptr_to_local(&getter)); } // ObjectTemplate const v8::ObjectTemplate* v8__ObjectTemplate__New__DEFAULT( v8::Isolate* isolate) { return local_to_ptr(v8::ObjectTemplate::New(isolate)); } const v8::ObjectTemplate* v8__ObjectTemplate__New( v8::Isolate* isolate, const v8::FunctionTemplate& constructor) { return local_to_ptr(v8::ObjectTemplate::New(isolate, ptr_to_local(&constructor))); } const v8::Object* v8__ObjectTemplate__NewInstance( const v8::ObjectTemplate& self, const v8::Context& ctx) { return maybe_local_to_ptr( ptr_to_local(&self)->NewInstance(ptr_to_local(&ctx)) ); } void v8__ObjectTemplate__SetInternalFieldCount( const v8::ObjectTemplate& self, int value) { ptr_to_local(&self)->SetInternalFieldCount(value); } void v8__ObjectTemplate__SetAccessor__DEFAULT( const v8::ObjectTemplate& self, const v8::Name& key, v8::AccessorNameGetterCallback getter) { ptr_to_local(&self)->SetAccessor(ptr_to_local(&key), getter); } void v8__ObjectTemplate__SetAccessor__DEFAULT2( const v8::ObjectTemplate& self, const v8::Name& key, v8::AccessorNameGetterCallback getter, v8::AccessorNameSetterCallback setter) { ptr_to_local(&self)->SetAccessor(ptr_to_local(&key), getter, setter); } // Array const v8::Array* v8__Array__New( v8::Isolate* isolate, int length) { return local_to_ptr(v8::Array::New(isolate, length)); } const v8::Array* v8__Array__New2( v8::Isolate* isolate, const v8::Value* const elements[], size_t length) { return local_to_ptr( v8::Array::New(isolate, const_ptr_array_to_local_array(elements), length) ); } uint32_t v8__Array__Length(const v8::Array& self) { return self.Length(); } // Object const v8::Object* v8__Object__New( v8::Isolate* isolate) { return local_to_ptr(v8::Object::New(isolate)); } void v8__Object__SetInternalField( const v8::Object& self, int index, const v8::Value& value) { ptr_to_local(&self)->SetInternalField(index, ptr_to_local(&value)); } const v8::Value* v8__Object__GetInternalField( const v8::Object& self, int index) { return local_to_ptr(ptr_to_local(&self)->GetInternalField(index)); } const v8::Value* v8__Object__Get( const v8::Object& self, const v8::Context& ctx, const v8::Value& key) { return maybe_local_to_ptr( ptr_to_local(&self)->Get(ptr_to_local(&ctx), ptr_to_local(&key)) ); } const v8::Value* v8__Object__GetIndex( const v8::Object& self, const v8::Context& ctx, uint32_t idx) { return maybe_local_to_ptr( ptr_to_local(&self)->Get(ptr_to_local(&ctx), idx) ); } void v8__Object__Set( const v8::Object& self, const v8::Context& ctx, const v8::Value& key, const v8::Value& value, v8::Maybe* out) { *out = ptr_to_local(&self)->Set( ptr_to_local(&ctx), ptr_to_local(&key), ptr_to_local(&value) ); } void v8__Object__DefineOwnProperty( const v8::Object& self, const v8::Context& ctx, const v8::Name& key, const v8::Value& value, v8::PropertyAttribute attr, v8::Maybe* out) { *out = ptr_to_local(&self)->DefineOwnProperty( ptr_to_local(&ctx), ptr_to_local(&key), ptr_to_local(&value), attr ); } v8::Isolate* v8__Object__GetIsolate(const v8::Object& self) { return ptr_to_local(&self)->GetIsolate(); } const v8::Context* v8__Object__GetCreationContext(const v8::Object& self) { return maybe_local_to_ptr(ptr_to_local(&self)->GetCreationContext()); } int v8__Object__GetIdentityHash(const v8::Object& self) { return ptr_to_local(&self)->GetIdentityHash(); } void v8__Object__Has( const v8::Object& self, const v8::Context& ctx, const v8::Value& key, v8::Maybe* out) { *out = ptr_to_local(&self)->Has( ptr_to_local(&ctx), ptr_to_local(&key) ); } void v8__Object__HasIndex( const v8::Object& self, const v8::Context& ctx, uint32_t idx, v8::Maybe* out) { *out = ptr_to_local(&self)->Has(ptr_to_local(&ctx), idx); } const v8::Array* v8__Object__GetOwnPropertyNames( const v8::Object* self, const v8::Context* ctx) { return maybe_local_to_ptr( ptr_to_local(self)->GetOwnPropertyNames(ptr_to_local(ctx)) ); } const v8::Array* v8__Object__GetPropertyNames( const v8::Object* self, const v8::Context* ctx) { return maybe_local_to_ptr( ptr_to_local(self)->GetPropertyNames(ptr_to_local(ctx)) ); } void v8__Object__SetAlignedPointerInInternalField( const v8::Object* self, int idx, void* ptr) { ptr_to_local(self)->SetAlignedPointerInInternalField(idx, ptr); } // FunctionCallbackInfo v8::Isolate* v8__FunctionCallbackInfo__GetIsolate( const v8::FunctionCallbackInfo& self) { return self.GetIsolate(); } int v8__FunctionCallbackInfo__Length( const v8::FunctionCallbackInfo& self) { return self.Length(); } const v8::Value* v8__FunctionCallbackInfo__INDEX( const v8::FunctionCallbackInfo& self, int i) { return local_to_ptr(self[i]); } void v8__FunctionCallbackInfo__GetReturnValue( const v8::FunctionCallbackInfo& self, v8::ReturnValue* out) { // Can't return incomplete type to C so copy to res pointer. *out = self.GetReturnValue(); } const v8::Object* v8__FunctionCallbackInfo__This( const v8::FunctionCallbackInfo& self) { return local_to_ptr(self.This()); } const v8::Value* v8__FunctionCallbackInfo__Data( const v8::FunctionCallbackInfo& self) { return local_to_ptr(self.Data()); } // PropertyCallbackInfo v8::Isolate* v8__PropertyCallbackInfo__GetIsolate( const v8::PropertyCallbackInfo& self) { return self.GetIsolate(); } void v8__PropertyCallbackInfo__GetReturnValue( const v8::PropertyCallbackInfo& self, v8::ReturnValue* out) { *out = self.GetReturnValue(); } const v8::Object* v8__PropertyCallbackInfo__This( const v8::PropertyCallbackInfo& self) { return local_to_ptr(self.This()); } const v8::Value* v8__PropertyCallbackInfo__Data( const v8::PropertyCallbackInfo& self) { return local_to_ptr(self.Data()); } // PromiseRejectMessage v8::PromiseRejectEvent v8__PromiseRejectMessage__GetEvent(const v8::PromiseRejectMessage& self) { return self.GetEvent(); } const v8::Promise* v8__PromiseRejectMessage__GetPromise(const v8::PromiseRejectMessage& self) { return local_to_ptr(self.GetPromise()); } const v8::Value* v8__PromiseRejectMessage__GetValue(const v8::PromiseRejectMessage& self) { return local_to_ptr(self.GetValue()); } size_t v8__PromiseRejectMessage__SIZEOF() { return sizeof(v8::PromiseRejectMessage); } // ReturnValue void v8__ReturnValue__Set( v8::ReturnValue self, const v8::Value& value) { self.Set(ptr_to_local(&value)); } const v8::Value* v8__ReturnValue__Get( v8::ReturnValue self) { return local_to_ptr(self.Get()); } // FunctionTemplate const v8::FunctionTemplate* v8__FunctionTemplate__New__DEFAULT( v8::Isolate* isolate) { return local_to_ptr(v8::FunctionTemplate::New(isolate)); } const v8::FunctionTemplate* v8__FunctionTemplate__New__DEFAULT2( v8::Isolate* isolate, v8::FunctionCallback callback_or_null) { return local_to_ptr(v8::FunctionTemplate::New(isolate, callback_or_null)); } const v8::FunctionTemplate* v8__FunctionTemplate__New__DEFAULT3( v8::Isolate* isolate, v8::FunctionCallback callback_or_null, const v8::Value& data) { return local_to_ptr(v8::FunctionTemplate::New(isolate, callback_or_null, ptr_to_local(&data))); } const v8::ObjectTemplate* v8__FunctionTemplate__InstanceTemplate( const v8::FunctionTemplate& self) { return local_to_ptr(ptr_to_local(&self)->InstanceTemplate()); } const v8::ObjectTemplate* v8__FunctionTemplate__PrototypeTemplate( const v8::FunctionTemplate& self) { return local_to_ptr(ptr_to_local(&self)->PrototypeTemplate()); } const v8::Function* v8__FunctionTemplate__GetFunction( const v8::FunctionTemplate& self, const v8::Context& context) { return maybe_local_to_ptr( ptr_to_local(&self)->GetFunction(ptr_to_local(&context)) ); } void v8__FunctionTemplate__SetClassName( const v8::FunctionTemplate& self, const v8::String& name) { ptr_to_local(&self)->SetClassName(ptr_to_local(&name)); } void v8__FunctionTemplate__ReadOnlyPrototype( const v8::FunctionTemplate& self) { ptr_to_local(&self)->ReadOnlyPrototype(); } // Function const v8::Function* v8__Function__New__DEFAULT( const v8::Context& ctx, v8::FunctionCallback callback) { return maybe_local_to_ptr( v8::Function::New(ptr_to_local(&ctx), callback) ); } const v8::Function* v8__Function__New__DEFAULT2( const v8::Context& ctx, v8::FunctionCallback callback, const v8::Value& data) { return maybe_local_to_ptr( v8::Function::New(ptr_to_local(&ctx), callback, ptr_to_local(&data)) ); } const v8::Value* v8__Function__Call( const v8::Function& self, const v8::Context& context, const v8::Value& recv, int argc, const v8::Value* const argv[]) { return maybe_local_to_ptr( ptr_to_local(&self)->Call( ptr_to_local(&context), ptr_to_local(&recv), argc, const_ptr_array_to_local_array(argv) ) ); } const v8::Object* v8__Function__NewInstance( const v8::Function& self, const v8::Context& context, int argc, const v8::Value* const argv[]) { return maybe_local_to_ptr( ptr_to_local(&self)->NewInstance( ptr_to_local(&context), argc, const_ptr_array_to_local_array(argv) ) ); } const v8::Value* v8__Function__GetName(const v8::Function& self) { return local_to_ptr(self.GetName()); } void v8__Function__SetName( const v8::Function& self, const v8::String& name) { return ptr_to_local(&self)->SetName(ptr_to_local(&name)); } // External const v8::External* v8__External__New( v8::Isolate* isolate, void* value) { return local_to_ptr(v8::External::New(isolate, value)); } void* v8__External__Value(const v8::External& self) { return self.Value(); } // Persistent void v8__Persistent__New( v8::Isolate* isolate, // Allow passing in a data pointer which includes values, templates, context, and more. const v8::Data& data, v8::Persistent* out) { new (out) v8::Persistent(isolate, ptr_to_local(&data)); } void v8__Persistent__Reset(v8::Persistent* self) { // v8::Persistent by default uses NonCopyablePersistentTraits which will create a bad copy if we accept v8::Persistent as the arg. // Instead we operate on its pointer. self->Reset(); } void v8__Persistent__SetWeak(v8::Persistent* self) { self->SetWeak(); } void v8__Persistent__SetWeakFinalizer( v8::Persistent* self, void* finalizer_ctx, v8::WeakCallbackInfo::Callback finalizer_cb, v8::WeakCallbackType type) { self->SetWeak(finalizer_ctx, finalizer_cb, type); } // WeakCallbackInfo v8::Isolate* v8__WeakCallbackInfo__GetIsolate( const v8::WeakCallbackInfo& self) { return self.GetIsolate(); } void* v8__WeakCallbackInfo__GetParameter( const v8::WeakCallbackInfo& self) { return self.GetParameter(); } void* v8__WeakCallbackInfo__GetInternalField( const v8::WeakCallbackInfo& self, int idx) { return self.GetInternalField(idx); } // Exception const v8::Value* v8__Exception__Error(const v8::String& message) { return local_to_ptr(v8::Exception::Error(ptr_to_local(&message))); } const v8::Value* v8__Exception__TypeError(const v8::String& message) { return local_to_ptr(v8::Exception::TypeError(ptr_to_local(&message))); } const v8::Value* v8__Exception__SyntaxError(const v8::String& message) { return local_to_ptr(v8::Exception::SyntaxError(ptr_to_local(&message))); } const v8::Value* v8__Exception__ReferenceError(const v8::String& message) { return local_to_ptr(v8::Exception::ReferenceError(ptr_to_local(&message))); } const v8::Value* v8__Exception__RangeError(const v8::String& message) { return local_to_ptr(v8::Exception::RangeError(ptr_to_local(&message))); } const v8::StackTrace* v8__Exception__GetStackTrace(const v8::Value& exception) { return local_to_ptr(v8::Exception::GetStackTrace(ptr_to_local(&exception))); } const v8::Message* v8__Exception__CreateMessage( v8::Isolate* isolate, const v8::Value& exception) { return local_to_ptr(v8::Exception::CreateMessage(isolate, ptr_to_local(&exception))); } // TryCatch size_t v8__TryCatch__SIZEOF() { return sizeof(v8::TryCatch); } void v8__TryCatch__CONSTRUCT( v8::TryCatch* buf, v8::Isolate* isolate) { construct_in_place(buf, isolate); } void v8__TryCatch__DESTRUCT(v8::TryCatch* self) { self->~TryCatch(); } const v8::Value* v8__TryCatch__Exception(const v8::TryCatch& self) { return local_to_ptr(self.Exception()); } const v8::Message* v8__TryCatch__Message(const v8::TryCatch& self) { return local_to_ptr(self.Message()); } bool v8__TryCatch__HasCaught(const v8::TryCatch& self) { return self.HasCaught(); } const v8::Value* v8__TryCatch__StackTrace( const v8::TryCatch& self, const v8::Context& context) { return maybe_local_to_ptr(self.StackTrace(ptr_to_local(&context))); } bool v8__TryCatch__IsVerbose(const v8::TryCatch& self) { return self.IsVerbose(); } void v8__TryCatch__SetVerbose( v8::TryCatch* self, bool value) { self->SetVerbose(value); } const v8::Value* v8__TryCatch__ReThrow(v8::TryCatch* self) { return local_to_ptr(self->ReThrow()); } // Message const v8::String* v8__Message__Get(const v8::Message& self) { return local_to_ptr(self.Get()); } const v8::String* v8__Message__GetSourceLine( const v8::Message& self, const v8::Context& context) { return maybe_local_to_ptr(self.GetSourceLine(ptr_to_local(&context))); } const v8::Value* v8__Message__GetScriptResourceName(const v8::Message& self) { return local_to_ptr(self.GetScriptResourceName()); } int v8__Message__GetLineNumber( const v8::Message& self, const v8::Context& context) { v8::Maybe maybe = self.GetLineNumber(ptr_to_local(&context)); return maybe.FromMaybe(-1); } int v8__Message__GetStartColumn(const v8::Message& self) { return self.GetStartColumn(); } int v8__Message__GetEndColumn(const v8::Message& self) { return self.GetEndColumn(); } const v8::StackTrace* v8__Message__GetStackTrace(const v8::Message& self) { return local_to_ptr(self.GetStackTrace()); } // StackTrace int v8__StackTrace__GetFrameCount(const v8::StackTrace& self) { return self.GetFrameCount(); } const v8::StackFrame* v8__StackTrace__GetFrame( const v8::StackTrace& self, v8::Isolate* isolate, uint32_t idx) { return local_to_ptr(self.GetFrame(isolate, idx)); } const v8::StackTrace* v8__StackTrace__CurrentStackTrace__STATIC( v8::Isolate* isolate, int frame_limit) { return local_to_ptr(v8::StackTrace::CurrentStackTrace(isolate, frame_limit)); } const v8::String* v8__StackTrace__CurrentScriptNameOrSourceURL__STATIC(v8::Isolate* isolate) { return local_to_ptr(v8::StackTrace::CurrentScriptNameOrSourceURL(isolate)); } // StackFrame int v8__StackFrame__GetLineNumber(const v8::StackFrame& self) { return self.GetLineNumber(); } int v8__StackFrame__GetColumn(const v8::StackFrame& self) { return self.GetColumn(); } int v8__StackFrame__GetScriptId(const v8::StackFrame& self) { return self.GetScriptId(); } const v8::String* v8__StackFrame__GetScriptName(const v8::StackFrame& self) { return local_to_ptr(self.GetScriptName()); } const v8::String* v8__StackFrame__GetScriptNameOrSourceURL(const v8::StackFrame& self) { return local_to_ptr(self.GetScriptNameOrSourceURL()); } const v8::String* v8__StackFrame__GetFunctionName(const v8::StackFrame& self) { return local_to_ptr(self.GetFunctionName()); } bool v8__StackFrame__IsEval(const v8::StackFrame& self) { return self.IsEval(); } bool v8__StackFrame__IsConstructor(const v8::StackFrame& self) { return self.IsConstructor(); } bool v8__StackFrame__IsWasm(const v8::StackFrame& self) { return self.IsWasm(); } bool v8__StackFrame__IsUserJavaScript(const v8::StackFrame& self) { return self.IsUserJavaScript(); } // JSON const v8::Value* v8__JSON__Parse( const v8::Context& ctx, const v8::String& json) { return maybe_local_to_ptr( v8::JSON::Parse(ptr_to_local(&ctx), ptr_to_local(&json))); } const v8::String* v8__JSON__Stringify( const v8::Context& ctx, const v8::Value& val, const v8::String& gap) { return maybe_local_to_ptr( v8::JSON::Stringify(ptr_to_local(&ctx), ptr_to_local(&val), ptr_to_local(&gap))); } // Misc. void v8__base__SetDcheckFunction(void (*func)(const char*, int, const char*)) { v8::base::SetDcheckFunction(func); } } ================================================ FILE: src/binding.h ================================================ #include #include #include typedef uintptr_t usize; typedef struct Data Data; typedef struct ArrayBuffer ArrayBuffer; typedef struct ArrayBufferAllocator ArrayBufferAllocator; typedef struct CreateParams CreateParams; typedef struct Isolate Isolate; typedef struct StackTrace StackTrace; typedef struct StackFrame StackFrame; typedef struct FixedArray FixedArray; typedef struct Module Module; typedef struct FunctionTemplate FunctionTemplate; typedef struct Message Message; typedef struct Name Name; typedef struct Context Context; // Internally, all Value types have a base InternalAddress struct. typedef uintptr_t InternalAddress; // Super type. typedef Data Value; typedef Value Object; typedef Value String; typedef Value Function; typedef Value Number; typedef Value Primitive; typedef Value Integer; typedef Value BigInt; typedef Value Array; typedef Value Uint8Array; typedef Value ArrayBufferView; typedef Value External; typedef Value Boolean; typedef Value Promise; typedef Value PromiseResolver; typedef enum CompileOptions { kNoCompileOptions = 0, kConsumeCodeCache = 1, kEagerCompile = 2, } CompileOptions; typedef enum NoCacheReason { kNoCacheNoReason = 0, kNoCacheBecauseCachingDisabled, kNoCacheBecauseNoResource, kNoCacheBecauseInlineScript, kNoCacheBecauseModule, kNoCacheBecauseStreamingSource, kNoCacheBecauseInspector, kNoCacheBecauseScriptTooSmall, kNoCacheBecauseCacheTooCold, kNoCacheBecauseV8Extension, kNoCacheBecauseExtensionModule, kNoCacheBecausePacScript, kNoCacheBecauseInDocumentWrite, kNoCacheBecauseResourceWithNoCacheHandler, kNoCacheBecauseDeferredProduceCodeCache } NoCacheReason; typedef enum PromiseRejectEvent { kPromiseRejectWithNoHandler = 0, kPromiseHandlerAddedAfterReject = 1, kPromiseRejectAfterResolved = 2, kPromiseResolveAfterResolved = 3, } PromiseRejectEvent; typedef struct PromiseRejectMessage PromiseRejectMessage; typedef void (*PromiseRejectCallback)(PromiseRejectMessage); typedef enum MessageErrorLevel { kMessageLog = (1 << 0), kMessageDebug = (1 << 1), kMessageInfo = (1 << 2), kMessageError = (1 << 3), kMessageWarning = (1 << 4), kMessageAll = kMessageLog | kMessageDebug | kMessageInfo | kMessageError | kMessageWarning, } MessageErrorLevel; typedef void (*MessageCallback)(const Message* message, const Value* data); typedef usize UniquePtr; typedef struct SharedPtr { usize a; usize b; } SharedPtr; typedef uintptr_t IntAddress; // v8::internal::Address typedef struct MaybeU32 { bool has_value; uint32_t value; } MaybeU32; typedef struct MaybeI32 { bool has_value; int32_t value; } MaybeI32; typedef struct MaybeF64 { bool has_value; double value; } MaybeF64; typedef struct MaybeBool { bool has_value; bool value; } MaybeBool; typedef enum PropertyAttribute { /** None. **/ None = 0, /** ReadOnly, i.e., not writable. **/ ReadOnly = 1 << 0, /** DontEnum, i.e., not enumerable. **/ DontEnum = 1 << 1, /** DontDelete, i.e., not configurable. **/ DontDelete = 1 << 2 } PropertyAttribute; // Platform typedef struct Platform Platform; Platform* v8__Platform__NewDefaultPlatform(int thread_pool_size, int idle_task_support); void v8__Platform__DELETE(Platform* platform); bool v8__Platform__PumpMessageLoop(Platform* platform, Isolate* isolate, bool wait_for_work); // Root const Primitive* v8__Undefined(Isolate* isolate); const Primitive* v8__Null(Isolate* isolate); const Boolean* v8__True(Isolate* isolate); const Boolean* v8__False(Isolate* isolate); const Uint8Array* v8__Uint8Array__New( const ArrayBuffer* buf, size_t byte_offset, size_t length); // V8 void v8__V8__InitializePlatform(Platform* platform); void v8__V8__Initialize(); int v8__V8__Dispose(); void v8__V8__DisposePlatform(); const char* v8__V8__GetVersion(); // Microtask typedef enum MicrotasksPolicy { kExplicit, kScoped, kAuto } MicrotasksPolicy; // Isolate Isolate* v8__Isolate__New(CreateParams* params); void v8__Isolate__Enter(Isolate* isolate); void v8__Isolate__Exit(Isolate* isolate); void v8__Isolate__Dispose(Isolate* isolate); Context* v8__Isolate__GetCurrentContext(Isolate* isolate); const Value* v8__Isolate__ThrowException( Isolate* isolate, const Value* exception); void v8__Isolate__SetPromiseRejectCallback( Isolate* isolate, PromiseRejectCallback callback); MicrotasksPolicy v8__Isolate__GetMicrotasksPolicy(const Isolate* self); void v8__Isolate__SetMicrotasksPolicy( Isolate* self, MicrotasksPolicy policy); void v8__Isolate__PerformMicrotaskCheckpoint(Isolate* self); bool v8__Isolate__AddMessageListener( Isolate* self, MessageCallback callback); bool v8__Isolate__AddMessageListenerWithErrorLevel( Isolate* self, MessageCallback callback, int message_levels, const Value* data); void v8__Isolate__SetCaptureStackTraceForUncaughtExceptions( Isolate* isolate, bool capture, int frame_limit); void v8__Isolate__TerminateExecution(Isolate* self); bool v8__Isolate__IsExecutionTerminating(Isolate* self); void v8__Isolate__CancelTerminateExecution(Isolate* self); void v8__Isolate__LowMemoryNotification(Isolate* self); typedef struct HeapStatistics { size_t total_heap_size; size_t total_heap_size_executable; size_t total_physical_size; size_t total_available_size; size_t used_heap_size; size_t heap_size_limit; size_t malloced_memory; size_t external_memory; size_t peak_malloced_memory; bool does_zap_garbage; size_t number_of_native_contexts; size_t number_of_detached_contexts; size_t total_global_handles_size; size_t used_global_handles_size; } HeapStatistics; void v8__Isolate__GetHeapStatistics( Isolate* self, HeapStatistics* stats); usize v8__HeapStatistics__SIZEOF(); typedef struct StartupData { const char* data; int raw_size; } StartupData; typedef struct ResourceConstraints { usize code_range_size_; usize max_old_generation_size_; usize max_young_generation_size_; usize initial_old_generation_size_; usize initial_young_generation_size_; uint32_t* stack_limit_; } ResourceConstraints; typedef struct CreateParams { void* code_event_handler; // JitCodeEventHandler ResourceConstraints constraints; StartupData* snapshot_blob; void* counter_lookup_callback; void* create_histogram_callback; // CreateHistogramCallback void* add_histogram_sample_callback; // AddHistogramSampleCallback ArrayBufferAllocator* array_buffer_allocator; SharedPtr array_buffer_allocator_shared; const intptr_t* external_references; bool allow_atomics_wait; bool only_terminate_in_safe_scope; int embedder_wrapper_type_index; int embedder_wrapper_object_index; void* fatal_error_callback; void* oom_error_callback; } CreateParams; usize v8__Isolate__CreateParams__SIZEOF(); void v8__Isolate__CreateParams__CONSTRUCT(CreateParams* buf); // FixedArray int v8__FixedArray__Length(const FixedArray* self); const Data* v8__FixedArray__Get( const FixedArray* self, const Context* ctx, int idx); // ArrayBuffer typedef void (*PromiseRejectCallback)(PromiseRejectMessage); typedef void (*BackingStoreDeleterCallback)(void* data, size_t len, void* deleter_data); typedef struct BackingStore BackingStore; ArrayBufferAllocator* v8__ArrayBuffer__Allocator__NewDefaultAllocator(); void v8__ArrayBuffer__Allocator__DELETE(ArrayBufferAllocator* self); BackingStore* v8__ArrayBuffer__NewBackingStore( Isolate* isolate, size_t byte_len); BackingStore* v8__ArrayBuffer__NewBackingStore2( void* data, size_t byte_len, BackingStoreDeleterCallback deleter, void* deleter_data); void* v8__BackingStore__Data(const BackingStore* self); size_t v8__BackingStore__ByteLength(const BackingStore* self); bool v8__BackingStore__IsShared(const BackingStore* self); SharedPtr v8__BackingStore__TO_SHARED_PTR(BackingStore* unique_ptr); void std__shared_ptr__v8__BackingStore__reset(SharedPtr* self); BackingStore* std__shared_ptr__v8__BackingStore__get(const SharedPtr* self); long std__shared_ptr__v8__BackingStore__use_count(const SharedPtr* self); const ArrayBuffer* v8__ArrayBuffer__New(Isolate* isolate, size_t byte_len); const ArrayBuffer* v8__ArrayBuffer__New2(Isolate* isolate, const SharedPtr* backing_store); size_t v8__ArrayBuffer__ByteLength(const ArrayBuffer* self); SharedPtr v8__ArrayBuffer__GetBackingStore(const ArrayBuffer* self); // ArrayBufferView const ArrayBuffer* v8__ArrayBufferView__Buffer(const ArrayBufferView* self); // HandleScope typedef struct HandleScope { // internal vars. Isolate* isolate_; InternalAddress* prev_next_; InternalAddress* prev_limit_; } HandleScope; void v8__HandleScope__CONSTRUCT(HandleScope* buf, Isolate* isolate); void v8__HandleScope__DESTRUCT(HandleScope* scope); // Message const String* v8__Message__Get(const Message* self); const String* v8__Message__GetSourceLine(const Message* self, const Context* context); const Value* v8__Message__GetScriptResourceName(const Message* self); int v8__Message__GetLineNumber(const Message* self, const Context* context); int v8__Message__GetStartColumn(const Message* self); int v8__Message__GetEndColumn(const Message* self); const StackTrace* v8__Message__GetStackTrace(const Message* self); // TryCatch typedef struct TryCatch { void* isolate_; struct TryCatch* next_; void* exception_; void* message_obj_; IntAddress js_stack_comparable_address_; usize flags; } TryCatch; usize v8__TryCatch__SIZEOF(); void v8__TryCatch__CONSTRUCT(TryCatch* buf, Isolate* isolate); void v8__TryCatch__DESTRUCT(TryCatch* self); const Value* v8__TryCatch__Exception(const TryCatch* self); const Message* v8__TryCatch__Message(const TryCatch* self); bool v8__TryCatch__HasCaught(const TryCatch* self); const Value* v8__TryCatch__StackTrace(const TryCatch* self, const Context* context); bool v8__TryCatch__IsVerbose(const TryCatch* self); void v8__TryCatch__SetVerbose( TryCatch* self, bool value); const Value* v8__TryCatch__ReThrow(TryCatch* self); // StackTrace int v8__StackTrace__GetFrameCount(const StackTrace* self); const StackFrame* v8__StackTrace__GetFrame( const StackTrace* self, Isolate* isolate, uint32_t idx); const StackTrace* v8__StackTrace__CurrentStackTrace__STATIC(Isolate* isolate, int frame_limit); const String* v8__StackTrace__CurrentScriptNameOrSourceURL__STATIC(Isolate* isolate); // StackFrame int v8__StackFrame__GetLineNumber(const StackFrame* self); int v8__StackFrame__GetColumn(const StackFrame* self); int v8__StackFrame__GetScriptId(const StackFrame* self); const String* v8__StackFrame__GetScriptName(const StackFrame* self); const String* v8__StackFrame__GetScriptNameOrSourceURL(const StackFrame* self); const String* v8__StackFrame__GetFunctionName(const StackFrame* self); bool v8__StackFrame__IsEval(const StackFrame* self); bool v8__StackFrame__IsConstructor(const StackFrame* self); bool v8__StackFrame__IsWasm(const StackFrame* self); bool v8__StackFrame__IsUserJavaScript(const StackFrame* self); // Context typedef struct Context Context; typedef struct ObjectTemplate ObjectTemplate; Context* v8__Context__New(Isolate* isolate, const ObjectTemplate* global_tmpl, const Value* global_obj); void v8__Context__Enter(const Context* context); void v8__Context__Exit(const Context* context); Isolate* v8__Context__GetIsolate(const Context* context); const Object* v8__Context__Global(const Context* self); const Value* v8__Context__GetEmbedderData( const Context* self, int idx); void v8__Context__SetEmbedderData( const Context* self, int idx, const Value* val); // Boolean const Boolean* v8__Boolean__New( Isolate* isolate, bool value); // String typedef enum NewStringType { /** * Create a new string, always allocating new storage memory. */ kNormal, /** * Acts as a hint that the string should be created in the * old generation heap space and be deduplicated if an identical string * already exists. */ kInternalized } NewStringType; typedef enum WriteOptions { NO_OPTIONS = 0, HINT_MANY_WRITES_EXPECTED = 1, NO_NULL_TERMINATION = 2, PRESERVE_ONE_BYTE_NULL = 4, // Used by WriteUtf8 to replace orphan surrogate code units with the // unicode replacement character. Needs to be set to guarantee valid UTF-8 // output. REPLACE_INVALID_UTF8 = 8 } WriteOptions; String* v8__String__NewFromUtf8(Isolate* isolate, const char* data, NewStringType type, int length); int v8__String__WriteUtf8(const String* str, Isolate* isolate, const char* buf, int len, int* nchars, WriteOptions options); int v8__String__Utf8Length(const String* str, Isolate* isolate); // Value String* v8__Value__ToString( const Value* self, const Context* ctx); const String* v8__Value__ToDetailString( const Value* self, const Context* ctx); bool v8__Value__BooleanValue( const Value* self, Isolate* isolate); void v8__Value__Uint32Value( const Value* self, const Context* ctx, MaybeU32* out); void v8__Value__Int32Value( const Value* self, const Context* ctx, MaybeI32* out); void v8__Value__NumberValue( const Value* self, const Context* context, MaybeF64* out); bool v8__Value__IsFunction(const Value* self); bool v8__Value__IsAsyncFunction(const Value* self); bool v8__Value__IsObject(const Value* self); bool v8__Value__IsString(const Value* self); bool v8__Value__IsArray(const Value* self); bool v8__Value__IsArrayBuffer(const Value* self); bool v8__Value__IsArrayBufferView(const Value* self); bool v8__Value__IsUint8Array(const Value* self); bool v8__Value__IsExternal(const Value* self); bool v8__Value__IsTrue(const Value* self); bool v8__Value__IsFalse(const Value* self); bool v8__Value__IsUndefined(const Value* self); bool v8__Value__IsNull(const Value* self); bool v8__Value__IsNullOrUndefined(const Value* self); bool v8__Value__IsNativeError(const Value* self); bool v8__Value__IsBigInt(const Value* self); bool v8__Value__IsBigIntObject(const Value* self); void v8__Value__InstanceOf( const Value* self, const Context* ctx, const Object* object, MaybeBool* out); // Promise typedef enum PromiseState { kPending, kFulfilled, kRejected } PromiseState; const PromiseResolver* v8__Promise__Resolver__New( const Context* ctx); const Promise* v8__Promise__Resolver__GetPromise( const PromiseResolver* self); void v8__Promise__Resolver__Resolve( const PromiseResolver* self, const Context* ctx, const Value* value, MaybeBool* out); void v8__Promise__Resolver__Reject( const PromiseResolver* self, const Context* ctx, const Value* value, MaybeBool* out); const Promise* v8__Promise__Catch( const Promise* self, const Context* ctx, const Function* handler); const Promise* v8__Promise__Then( const Promise* self, const Context* ctx, const Function* handler); const Promise* v8__Promise__Then2( const Promise* self, const Context* ctx, const Function* on_fulfilled, const Function* on_rejected); PromiseState v8__Promise__State(const Promise* self); void v8__Promise__MarkAsHandled(const Promise* self); const Value* v8__Promise__Result(const Promise* self); // Array const Array* v8__Array__New( Isolate* isolate, int length); const Array* v8__Array__New2( Isolate* isolate, const Value* const elements[], size_t length); uint32_t v8__Array__Length(const Array* self); // Object const Object* v8__Object__New(Isolate* isolate); const Value* v8__Object__GetInternalField( const Object* self, int index); void v8__Object__SetInternalField( const Object* self, int index, const Value* value); const Value* v8__Object__Get( const Object* self, const Context* ctx, const Value* key); const Value* v8__Object__GetIndex( const Object* self, const Context* ctx, uint32_t idx); void v8__Object__Set( const Object* self, const Context* ctx, const Value* key, const Value* value, MaybeBool* out); void v8__Object__DefineOwnProperty( const Object* self, const Context* ctx, const Name* key, const Value* value, PropertyAttribute attr, MaybeBool* out); Isolate* v8__Object__GetIsolate(const Object* self); const Context* v8__Object__GetCreationContext(const Object* self); int v8__Object__GetIdentityHash(const Object* self); void v8__Object__Has( const Object* self, const Context* ctx, const Value* key, MaybeBool* out); void v8__Object__HasIndex( const Object* self, const Context* ctx, uint32_t idx, MaybeBool* out); const Array* v8__Object__GetOwnPropertyNames( const Object* self, const Context* ctx); const Array* v8__Object__GetPropertyNames( const Object* self, const Context* ctx); void v8__Object__SetAlignedPointerInInternalField( const Object* self, int idx, void* ptr); // Exception const Value* v8__Exception__Error(const String* message); const Value* v8__Exception__TypeError(const String* message); const Value* v8__Exception__SyntaxError(const String* message); const Value* v8__Exception__ReferenceError(const String* message); const Value* v8__Exception__RangeError(const String* message); const StackTrace* v8__Exception__GetStackTrace(const Value* exception); const Message* v8__Exception__CreateMessage( Isolate* isolate, const Value* exception); // Number const Number* v8__Number__New( Isolate* isolate, double value); // Integer const Integer* v8__Integer__New( Isolate* isolate, int32_t value); const Integer* v8__Integer__NewFromUnsigned( Isolate* isolate, uint32_t value); int64_t v8__Integer__Value(const Integer* self); // BigInt const BigInt* v8__BigInt__New( Isolate* iso, int64_t val); const BigInt* v8__BigInt__NewFromUnsigned( Isolate* iso, uint64_t val); uint64_t v8__BigInt__Uint64Value( const BigInt* self, bool* lossless); int64_t v8__BigInt__Int64Value( const BigInt* self, bool* lossless); // Template typedef struct Template Template; void v8__Template__Set( const Template* self, const Name* key, const Data* value, PropertyAttribute attr); void v8__Template__SetAccessorProperty__DEFAULT( const Template* self, const Name* key, const FunctionTemplate* getter); // FunctionCallbackInfo typedef struct FunctionCallbackInfo FunctionCallbackInfo; typedef struct ReturnValue { uintptr_t addr; } ReturnValue; Isolate* v8__FunctionCallbackInfo__GetIsolate( const FunctionCallbackInfo* self); int v8__FunctionCallbackInfo__Length( const FunctionCallbackInfo* self); const Value* v8__FunctionCallbackInfo__INDEX( const FunctionCallbackInfo* self, int i); void v8__FunctionCallbackInfo__GetReturnValue( const FunctionCallbackInfo* self, ReturnValue* res); const Object* v8__FunctionCallbackInfo__This( const FunctionCallbackInfo* self); const Value* v8__FunctionCallbackInfo__Data( const FunctionCallbackInfo* self); // PropertyCallbackInfo typedef struct PropertyCallbackInfo PropertyCallbackInfo; Isolate* v8__PropertyCallbackInfo__GetIsolate( const PropertyCallbackInfo* self); void v8__PropertyCallbackInfo__GetReturnValue( const PropertyCallbackInfo* self, ReturnValue* res); const Object* v8__PropertyCallbackInfo__This( const PropertyCallbackInfo* self); const Value* v8__PropertyCallbackInfo__Data( const PropertyCallbackInfo* self); // PromiseRejectMessage struct PromiseRejectMessage { uintptr_t promise; PromiseRejectEvent event; uintptr_t value; }; PromiseRejectEvent v8__PromiseRejectMessage__GetEvent( const PromiseRejectMessage* self); const Promise* v8__PromiseRejectMessage__GetPromise( const PromiseRejectMessage* self); const Value* v8__PromiseRejectMessage__GetValue( const PromiseRejectMessage* self); usize v8__PromiseRejectMessage__SIZEOF(); // ReturnValue void v8__ReturnValue__Set( const ReturnValue self, const Value* value); const Value* v8__ReturnValue__Get( const ReturnValue self); // FunctionTemplate typedef void (*FunctionCallback)(const FunctionCallbackInfo*); const FunctionTemplate* v8__FunctionTemplate__New__DEFAULT( Isolate* isolate); const FunctionTemplate* v8__FunctionTemplate__New__DEFAULT2( Isolate* isolate, FunctionCallback callback_or_null); const FunctionTemplate* v8__FunctionTemplate__New__DEFAULT3( Isolate* isolate, FunctionCallback callback_or_null, const Value* data); const ObjectTemplate* v8__FunctionTemplate__InstanceTemplate( const FunctionTemplate* self); const ObjectTemplate* v8__FunctionTemplate__PrototypeTemplate( const FunctionTemplate* self); const Function* v8__FunctionTemplate__GetFunction( const FunctionTemplate* self, const Context* context); void v8__FunctionTemplate__SetClassName( const FunctionTemplate* self, const String* name); void v8__FunctionTemplate__ReadOnlyPrototype( const FunctionTemplate* self); // Function const Function* v8__Function__New__DEFAULT( const Context* ctx, FunctionCallback callback); const Function* v8__Function__New__DEFAULT2( const Context* ctx, FunctionCallback callback, const Value* data); const Value* v8__Function__Call( const Function* self, const Context* context, const Value* recv, int argc, const Value* const argv[]); const Object* v8__Function__NewInstance( const Function* self, const Context* context, int argc, const Value* const argv[]); const Value* v8__Function__GetName(const Function* self); void v8__Function__SetName(const Function* self, const String* name); // External const External* v8__External__New( Isolate* isolate, void* value); void* v8__External__Value( const External* self); // Persistent typedef struct Persistent { uintptr_t data_ptr; } Persistent; void v8__Persistent__New( Isolate* isolate, const Data* data, Persistent* out); void v8__Persistent__Reset( Persistent* self); void v8__Persistent__SetWeak( Persistent* self); typedef struct WeakCallbackInfo WeakCallbackInfo; typedef void (*WeakCallback)(const WeakCallbackInfo*); typedef enum WeakCallbackType { kParameter, kInternalFields, kFinalizer } WeakCallbackType; void v8__Persistent__SetWeakFinalizer( Persistent* self, void* finalizer_ctx, WeakCallback finalizer_cb, WeakCallbackType type); // WeakCallbackInfo Isolate* v8__WeakCallbackInfo__GetIsolate(const WeakCallbackInfo* self); void* v8__WeakCallbackInfo__GetParameter(const WeakCallbackInfo* self); void* v8__WeakCallbackInfo__GetInternalField( const WeakCallbackInfo* self, int idx); // ObjectTemplate typedef struct ObjectTemplate ObjectTemplate; ObjectTemplate* v8__ObjectTemplate__New__DEFAULT( Isolate* isolate); ObjectTemplate* v8__ObjectTemplate__New( Isolate* isolate, const FunctionTemplate* templ); Object* v8__ObjectTemplate__NewInstance( const ObjectTemplate* self, const Context* ctx); void v8__ObjectTemplate__SetInternalFieldCount( const ObjectTemplate* self, int value); typedef void (*AccessorNameGetterCallback)(const Name*, const PropertyCallbackInfo*); typedef void (*AccessorNameSetterCallback)(const Name*, const Value*, const PropertyCallbackInfo*); void v8__ObjectTemplate__SetAccessor__DEFAULT( const ObjectTemplate* self, const Name* key, AccessorNameGetterCallback getter); void v8__ObjectTemplate__SetAccessor__DEFAULT2( const ObjectTemplate* self, const Name* key, AccessorNameGetterCallback getter, AccessorNameSetterCallback setter); // ScriptOrigin typedef struct ScriptOriginOptions { const int flags_; } ScriptOriginOptions; typedef struct ScriptOrigin { Isolate* isolate_; Value* resource_name_; int resource_line_offset_; int resource_column_offset_; ScriptOriginOptions options_; int script_id_; Value* source_map_url_; void* host_defined_options_; } ScriptOrigin; void v8__ScriptOrigin__CONSTRUCT(ScriptOrigin* buf, Isolate* isolate, const Value* resource_name); void v8__ScriptOrigin__CONSTRUCT2( ScriptOrigin* buf, Isolate* isolate, const Value* resource_name, int resource_line_offset, int resource_column_offset, bool resource_is_shared_cross_origin, int script_id, const Value* source_map_url, bool resource_is_opaque, bool is_wasm, bool is_module, const Data* host_defined_options ); // ScriptCompiler typedef struct ScriptCompilerSource { String* source_string; // Origin information Value* resource_name; int resource_line_offset; int resource_column_offset; ScriptOriginOptions resource_options; Value* source_map_url; Data* host_defined_options; // Cached data from previous compilation (if a kConsume*Cache flag is // set), or hold newly generated cache data (kProduce*Cache flags) are // set when calling a compile method. UniquePtr cached_data; UniquePtr consume_cache_task; } ScriptCompilerSource; typedef enum BufferPolicy { BufferNotOwned, BufferOwned } BufferPolicy; typedef struct ScriptCompilerCachedData { const uint8_t* data; int length; bool rejected; BufferPolicy buffer_policy; } ScriptCompilerCachedData; size_t v8__ScriptCompiler__Source__SIZEOF(); void v8__ScriptCompiler__Source__CONSTRUCT( const String* src, ScriptCompilerCachedData* cached_data, ScriptCompilerSource* out); void v8__ScriptCompiler__Source__CONSTRUCT2( const String* src, const ScriptOrigin* origin, ScriptCompilerCachedData* cached_data, ScriptCompilerSource* out); void v8__ScriptCompiler__Source__DESTRUCT(ScriptCompilerSource* self); size_t v8__ScriptCompiler__CachedData__SIZEOF(); ScriptCompilerCachedData* v8__ScriptCompiler__CachedData__NEW( const uint8_t* data, int length); void v8__ScriptCompiler__CachedData__DELETE(ScriptCompilerCachedData* self); const Module* v8__ScriptCompiler__CompileModule( Isolate* isolate, ScriptCompilerSource* source, CompileOptions options, NoCacheReason reason); // Script typedef struct Script Script; Script* v8__Script__Compile(const Context* context, const String* src, const ScriptOrigin* origin); Value* v8__Script__Run(const Script* script, const Context* context); // Module typedef enum ModuleStatus { kUninstantiated, kInstantiating, kInstantiated, kEvaluating, kEvaluated, kErrored } ModuleStatus; ModuleStatus v8__Module__GetStatus(const Module* self); const Value* v8__Module__GetException(const Module* self); const FixedArray* v8__Module__GetModuleRequests(const Module* self); typedef const Module* (*ResolveModuleCallback)( const Context* ctx, const String* spec, const FixedArray* import_assertions, const Module* referrer); void v8__Module__InstantiateModule( const Module* self, const Context* ctx, ResolveModuleCallback cb, MaybeBool* out); const Value* v8__Module__Evaluate(const Module* self, const Context* ctx); int v8__Module__GetIdentityHash(const Module* self); int v8__Module__ScriptId(const Module* self); // ModuleRequest typedef Data ModuleRequest; const String* v8__ModuleRequest__GetSpecifier(const ModuleRequest* self); int v8__ModuleRequest__GetSourceOffset(const ModuleRequest* self); // JSON const Value* v8__JSON__Parse( const Context* ctx, const String* json); const String* v8__JSON__Stringify( const Context* ctx, const Value* val, const String* gap); // Misc. void v8__base__SetDcheckFunction(void (*func)(const char*, int, const char*)); ================================================ FILE: src/shell.zig ================================================ const std = @import("std"); const v8 = @import("v8.zig"); // Demo js repl. pub fn main() !void { repl(); std.process.exit(0); } fn repl() void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; defer _ = gpa.deinit(); const alloc = gpa.allocator(); var input_buf = std.ArrayList(u8).init(alloc); defer input_buf.deinit(); const platform = v8.Platform.initDefault(0, true); defer platform.deinit(); v8.initV8Platform(platform); defer v8.deinitV8Platform(); v8.initV8(); defer _ = v8.deinitV8(); var params = v8.initCreateParams(); params.array_buffer_allocator = v8.createDefaultArrayBufferAllocator(); defer v8.destroyArrayBufferAllocator(params.array_buffer_allocator.?); var isolate = v8.Isolate.init(¶ms); defer isolate.deinit(); isolate.enter(); defer isolate.exit(); var hscope: v8.HandleScope = undefined; hscope.init(isolate); defer hscope.deinit(); var context = v8.Context.init(isolate, null, null); context.enter(); defer context.exit(); const origin = v8.String.initUtf8(isolate, "(shell)"); printFmt( \\JS Repl \\exit with Ctrl+D or "exit()" \\ , .{}); while (true) { printFmt("\n> ", .{}); if (getInput(&input_buf)) |input| { if (std.mem.eql(u8, input, "exit()")) { break; } var res: ExecuteResult = undefined; defer res.deinit(); executeString(alloc, isolate, input, origin, &res); if (res.success) { printFmt("{s}", .{res.result.?}); } else { printFmt("{s}", .{res.err.?}); } while (platform.pumpMessageLoop(isolate, false)) { continue; } } else { printFmt("\n", .{}); return; } } } fn getInput(input_buf: *std.ArrayList(u8)) ?[]const u8 { input_buf.clearRetainingCapacity(); std.io.getStdIn().reader().readUntilDelimiterArrayList(input_buf, '\n', 1e9) catch |err| { if (err == error.EndOfStream) { return null; } else { unreachable; } }; return input_buf.items; } pub fn printFmt(comptime format: []const u8, args: anytype) void { const stdout = std.io.getStdOut().writer(); stdout.print(format, args) catch unreachable; } pub const ExecuteResult = struct { const Self = @This(); alloc: std.mem.Allocator, result: ?[]const u8, err: ?[]const u8, success: bool, pub fn deinit(self: Self) void { if (self.result) |result| { self.alloc.free(result); } if (self.err) |err| { self.alloc.free(err); } } }; pub fn executeString(alloc: std.mem.Allocator, isolate: v8.Isolate, src: []const u8, src_origin: v8.String, result: *ExecuteResult) void { var hscope: v8.HandleScope = undefined; hscope.init(isolate); defer hscope.deinit(); var try_catch: v8.TryCatch = undefined; try_catch.init(isolate); defer try_catch.deinit(); const origin = v8.ScriptOrigin.initDefault(isolate, src_origin.toValue()); const context = isolate.getCurrentContext(); const js_src = v8.String.initUtf8(isolate, src); const script = v8.Script.compile(context, js_src, origin) catch { setResultError(alloc, isolate, try_catch, result); return; }; const script_res = script.run(context) catch { setResultError(alloc, isolate, try_catch, result); return; }; result.* = .{ .alloc = alloc, .result = valueToUtf8Alloc(alloc, isolate, context, script_res), .err = null, .success = true, }; } fn setResultError(alloc: std.mem.Allocator, isolate: v8.Isolate, try_catch: v8.TryCatch, result: *ExecuteResult) void { result.* = .{ .alloc = alloc, .result = null, .err = getTryCatchErrorString(alloc, isolate, try_catch), .success = false, }; } pub fn valueToUtf8Alloc(alloc: std.mem.Allocator, isolate: v8.Isolate, ctx: v8.Context, any_value: anytype) []const u8 { const val = v8.getValue(any_value); const str = val.toString(ctx) catch unreachable; const len = str.lenUtf8(isolate); const buf = alloc.alloc(u8, len) catch unreachable; _ = str.writeUtf8(isolate, buf); return buf; } pub fn getTryCatchErrorString(alloc: std.mem.Allocator, isolate: v8.Isolate, try_catch: v8.TryCatch) []const u8 { var hscope: v8.HandleScope = undefined; hscope.init(isolate); defer hscope.deinit(); const ctx = isolate.getCurrentContext(); if (try_catch.getMessage()) |message| { var buf = std.ArrayList(u8).init(alloc); const writer = buf.writer(); // Append source line. const source_line = message.getSourceLine(ctx).?; _ = appendValueAsUtf8(&buf, isolate, ctx, source_line); writer.writeAll("\n") catch unreachable; // Print wavy underline. const col_start = message.getStartColumn().?; const col_end = message.getEndColumn().?; var i: u32 = 0; while (i < col_start) : (i += 1) { writer.writeByte(' ') catch unreachable; } while (i < col_end) : (i += 1) { writer.writeByte('^') catch unreachable; } writer.writeByte('\n') catch unreachable; if (try_catch.getStackTrace(ctx)) |trace| { _ = appendValueAsUtf8(&buf, isolate, ctx, trace); writer.writeByte('\n') catch unreachable; } return buf.toOwnedSlice() catch unreachable; } else { // V8 didn't provide any extra information about this error, just get exception str. const exception = try_catch.getException().?; return valueToUtf8Alloc(alloc, isolate, ctx, exception); } } pub fn appendValueAsUtf8(arr: *std.ArrayList(u8), isolate: v8.Isolate, ctx: v8.Context, any_value: anytype) []const u8 { const val = v8.getValue(any_value); const str = val.toString(ctx) catch unreachable; const len = str.lenUtf8(isolate); const start = arr.items.len; arr.resize(start + len) catch unreachable; _ = str.writeUtf8(isolate, arr.items[start..arr.items.len]); return arr.items[start..]; } ================================================ FILE: src/test.zig ================================================ const std = @import("std"); const t = std.testing; const v8 = @import("./v8.zig"); test { // Based on https://chromium.googlesource.com/v8/v8/+/branch-heads/6.8/samples/hello-world.cc const platform = v8.Platform.initDefault(0, true); defer platform.deinit(); std.log.info("v8 version: {s}\n", .{v8.getVersion()}); v8.initV8Platform(platform); v8.initV8(); defer { _ = v8.deinitV8(); v8.deinitV8Platform(); } var params = v8.initCreateParams(); params.array_buffer_allocator = v8.createDefaultArrayBufferAllocator(); defer v8.destroyArrayBufferAllocator(params.array_buffer_allocator.?); var isolate = v8.Isolate.init(¶ms); defer isolate.deinit(); isolate.enter(); defer isolate.exit(); // Create a stack-allocated handle scope. var hscope: v8.HandleScope = undefined; hscope.init(isolate); defer hscope.deinit(); // Create a new context. var context = v8.Context.init(isolate, null, null); context.enter(); defer context.exit(); // Create a string containing the JavaScript source code. const source = v8.String.initUtf8(isolate, "'Hello' + ', World! 🍏🍓' + Math.sin(Math.PI/2)"); // Compile the source code. const script = try v8.Script.compile(context, source, null); // Run the script to get the result. const value = try script.run(context); // Convert the result to an UTF8 string and print it. const res = valueToRawUtf8Alloc(t.allocator, isolate, context, value); defer t.allocator.free(res); std.log.info("{s}", .{res}); try t.expectEqualStrings(res, "Hello, World! 🍏🍓1"); } pub fn valueToRawUtf8Alloc(alloc: std.mem.Allocator, isolate: v8.Isolate, ctx: v8.Context, val: v8.Value) []const u8 { const str = val.toString(ctx) catch unreachable; const len = str.lenUtf8(isolate); const buf = alloc.alloc(u8, len) catch unreachable; _ = str.writeUtf8(isolate, buf); return buf; } ================================================ FILE: src/v8.zig ================================================ const std = @import("std"); const t = std.testing; const c = @cImport({ @cInclude("binding.h"); }); pub const PropertyAttribute = struct { pub const None = c.None; pub const ReadOnly = c.ReadOnly; }; pub const PromiseRejectEvent = struct { pub const kPromiseRejectWithNoHandler = c.kPromiseRejectWithNoHandler; pub const kPromiseHandlerAddedAfterReject = c.kPromiseHandlerAddedAfterReject; pub const kPromiseRejectAfterResolved = c.kPromiseRejectAfterResolved; pub const kPromiseResolveAfterResolved = c.kPromiseResolveAfterResolved; }; pub const MessageErrorLevel = struct { pub const kMessageLog = c.kMessageLog; pub const kMessageDebug = c.kMessageDebug; pub const kMessageInfo = c.kMessageInfo; pub const kMessageError = c.kMessageError; pub const kMessageWarning = c.kMessageWarning; pub const kMessageAll = c.kMessageAll; }; /// [V8] /// Policy for running microtasks: /// - explicit: microtasks are invoked with the /// Isolate::PerformMicrotaskCheckpoint() method; /// - scoped: microtasks invocation is controlled by MicrotasksScope objects; /// - auto: microtasks are invoked when the script call depth decrements to zero. pub const MicrotasksPolicy = struct { pub const kExplicit = c.kExplicit; pub const kScoped = c.kScoped; pub const kAuto = c.kAuto; }; // Currently, user callback functions passed into FunctionTemplate will need to have this declared as a param and then // converted to FunctionCallbackInfo to get a nicer interface. pub const C_FunctionCallbackInfo = c.FunctionCallbackInfo; pub const C_PropertyCallbackInfo = c.PropertyCallbackInfo; pub const C_WeakCallbackInfo = c.WeakCallbackInfo; pub const C_PromiseRejectMessage = c.PromiseRejectMessage; pub const C_Message = c.Message; pub const C_Value = c.Value; pub const C_Context = c.Context; pub const C_Data = c.Data; pub const C_FixedArray = c.FixedArray; pub const C_Module = c.Module; pub const C_InternalAddress = c.InternalAddress; pub const MessageCallback = c.MessageCallback; pub const FunctionCallback = c.FunctionCallback; pub const AccessorNameGetterCallback = c.AccessorNameGetterCallback; pub const AccessorNameSetterCallback = c.AccessorNameSetterCallback; pub const CreateParams = c.CreateParams; pub const Name = c.Name; pub const SharedPtr = c.SharedPtr; const Root = @This(); pub const Platform = struct { const Self = @This(); handle: *c.Platform, /// Must be called first before initV8Platform and initV8 /// Returns a new instance of the default v8::Platform implementation. /// /// |thread_pool_size| is the number of worker threads to allocate for /// background jobs. If a value of zero is passed, a suitable default /// based on the current number of processors online will be chosen. /// If |idle_task_support| is enabled then the platform will accept idle /// tasks (IdleTasksEnabled will return true) and will rely on the embedder /// calling v8::platform::RunIdleTasks to process the idle tasks. pub fn initDefault(thread_pool_size: u32, idle_task_support: bool) Self { return .{ .handle = c.v8__Platform__NewDefaultPlatform(@intCast(thread_pool_size), if (idle_task_support) 1 else 0).?, }; } pub fn deinit(self: Self) void { c.v8__Platform__DELETE(self.handle); } /// [V8] /// Pumps the message loop for the given isolate. /// /// The caller has to make sure that this is called from the right thread. /// Returns true if a task was executed, and false otherwise. If the call to /// PumpMessageLoop is nested within another call to PumpMessageLoop, only /// nestable tasks may run. Otherwise, any task may run. Unless requested through /// the |behavior| parameter, this call does not block if no task is pending. The /// |platform| has to be created using |NewDefaultPlatform|. pub fn pumpMessageLoop(self: Self, isolate: Isolate, wait_for_work: bool) bool { return c.v8__Platform__PumpMessageLoop(self.handle, isolate.handle, wait_for_work); } }; pub fn getVersion() []const u8 { const str = c.v8__V8__GetVersion(); const idx = std.mem.indexOfSentinel(u8, 0, str); return str[0..idx]; } /// [v8] /// Sets the v8::Platform to use. This should be invoked before V8 is /// initialized. pub fn initV8Platform(platform: Platform) void { c.v8__V8__InitializePlatform(platform.handle); } /// [v8] /// Initializes V8. This function needs to be called before the first Isolate /// is created. It always returns true. pub fn initV8() void { c.v8__V8__Initialize(); } /// [v8] /// Releases any resources used by v8 and stops any utility thread /// that may be running. Note that disposing v8 is permanent, it /// cannot be reinitialized. /// /// It should generally not be necessary to dispose v8 before exiting /// a process, this should happen automatically. It is only necessary /// to use if the process needs the resources taken up by v8. pub fn deinitV8() bool { return c.v8__V8__Dispose() == 1; } /// [v8] /// Clears all references to the v8::Platform. This should be invoked after /// V8 was disposed. pub fn deinitV8Platform() void { c.v8__V8__DisposePlatform(); } pub fn initCreateParams() c.CreateParams { var params: c.CreateParams = undefined; c.v8__Isolate__CreateParams__CONSTRUCT(¶ms); return params; } pub fn createDefaultArrayBufferAllocator() *c.ArrayBufferAllocator { return c.v8__ArrayBuffer__Allocator__NewDefaultAllocator().?; } pub fn destroyArrayBufferAllocator(alloc: *c.ArrayBufferAllocator) void { c.v8__ArrayBuffer__Allocator__DELETE(alloc); } pub const Exception = struct { pub fn initError(msg: String) Value { return .{ .handle = c.v8__Exception__Error(msg.handle).?, }; } pub fn initTypeError(msg: String) Value { return .{ .handle = c.v8__Exception__TypeError(msg.handle).?, }; } pub fn initSyntaxError(msg: String) Value { return .{ .handle = c.v8__Exception__SyntaxError(msg.handle).?, }; } pub fn initReferenceError(msg: String) Value { return .{ .handle = c.v8__Exception__ReferenceError(msg.handle).?, }; } pub fn initRangeError(msg: String) Value { return .{ .handle = c.v8__Exception__RangeError(msg.handle).?, }; } pub fn initMessage(iso: Isolate, exception: Value) Message { return .{ .handle = c.v8__Exception__CreateMessage(iso.handle, exception.handle).?, }; } /// [v8] /// Returns the original stack trace that was captured at the creation time /// of a given exception, or an empty handle if not available. pub fn getStackTrace(exception: Value) ?StackTrace { if (c.v8__Exception__GetStackTrace(exception.handle)) |handle| { return StackTrace{ .handle = handle, }; } else return null; } }; /// Contains Isolate related methods and convenience methods for creating js values. pub const Isolate = struct { const Self = @This(); handle: *c.Isolate, pub fn init(params: *const c.CreateParams) Self { // const ptr = @intToPtr(*c.CreateParams, @ptrToInt(params)); return .{ .handle = c.v8__Isolate__New(@constCast(params)).?, }; } /// [V8] /// Disposes the isolate. The isolate must not be entered by any /// thread to be disposable. pub fn deinit(self: Self) void { c.v8__Isolate__Dispose(self.handle); } /// [V8] /// Sets this isolate as the entered one for the current thread. /// Saves the previously entered one (if any), so that it can be /// restored when exiting. Re-entering an isolate is allowed. /// [Notes] /// This is equivalent to initing an Isolate Scope. pub fn enter(self: *Self) void { c.v8__Isolate__Enter(self.handle); } /// [V8] /// Exits this isolate by restoring the previously entered one in the /// current thread. The isolate may still stay the same, if it was /// entered more than once. /// /// Requires: this == Isolate::GetCurrent(). /// [Notes] /// This is equivalent to deiniting an Isolate Scope. pub fn exit(self: *Self) void { c.v8__Isolate__Exit(self.handle); } pub fn getCurrentContext(self: Self) Context { return .{ .handle = c.v8__Isolate__GetCurrentContext(self.handle).?, }; } /// It seems stack trace is only captured if the value is wrapped in an Exception.initError. pub fn throwException(self: Self, value: anytype) Value { return .{ .handle = c.v8__Isolate__ThrowException(self.handle, getValueHandle(value)).?, }; } /// [V8] /// Set callback to notify about promise reject with no handler, or /// revocation of such a previous notification once the handler is added. pub fn setPromiseRejectCallback(self: Self, callback: c.PromiseRejectCallback) void { c.v8__Isolate__SetPromiseRejectCallback(self.handle, callback); } pub fn getMicrotasksPolicy(self: Self) c.MicrotasksPolicy { return c.v8__Isolate__GetMicrotasksPolicy(self.handle); } pub fn setMicrotasksPolicy(self: Self, policy: c.MicrotasksPolicy) void { c.v8__Isolate__SetMicrotasksPolicy(self.handle, policy); } pub fn performMicrotasksCheckpoint(self: Self) void { c.v8__Isolate__PerformMicrotaskCheckpoint(self.handle); } pub fn addMessageListener(self: Self, callback: c.MessageCallback) bool { return c.v8__Isolate__AddMessageListener(self.handle, callback); } pub fn addMessageListenerWithErrorLevel(self: Self, callback: c.MessageCallback, message_levels: c_int, value: Value) bool { return c.v8__Isolate__AddMessageListenerWithErrorLevel(self.handle, callback, message_levels, value.handle); } /// [v8] /// Tells V8 to capture current stack trace when uncaught exception occurs /// and report it to the message listeners. The option is off by default. pub fn setCaptureStackTraceForUncaughtExceptions(self: Self, capture: bool, frame_limit: u32) void { c.v8__Isolate__SetCaptureStackTraceForUncaughtExceptions(self.handle, capture, @intCast(frame_limit)); } /// This does not terminate the current script immediately. V8 will mark it for termination at a later time. This was intended to end long running loops. pub fn terminateExecution(self: Self) void { c.v8__Isolate__TerminateExecution(self.handle); } pub fn isExecutionTerminating(self: Self) bool { return c.v8__Isolate__IsExecutionTerminating(self.handle); } pub fn cancelTerminateExecution(self: Self) void { c.v8__Isolate__CancelTerminateExecution(self.handle); } pub fn lowMemoryNotification(self: Self) void { c.v8__Isolate__LowMemoryNotification(self.handle); } pub fn getHeapStatistics(self: Self) c.HeapStatistics { var res: c.HeapStatistics = undefined; c.v8__Isolate__GetHeapStatistics(self.handle, &res); return res; } pub fn initNumber(self: Self, val: f64) Number { return Number.init(self, val); } pub fn initNumberBitCastedU64(self: Self, val: u64) Number { return Number.initBitCastedU64(self, val); } pub fn initBoolean(self: Self, val: bool) Boolean { return Boolean.init(self, val); } pub fn initIntegerI32(self: Self, val: i32) Integer { return Integer.initI32(self, val); } pub fn initIntegerU32(self: Self, val: u32) Integer { return Integer.initU32(self, val); } pub fn initBigIntI64(self: Self, val: i64) BigInt { return BigInt.initI64(self, val); } pub fn initBigIntU64(self: Self, val: u64) BigInt { return BigInt.initU64(self, val); } pub fn initStringUtf8(self: Self, val: []const u8) String { return String.initUtf8(self, val); } pub fn initPersistent(self: Self, comptime T: type, val: T) Persistent(T) { return Persistent(T).init(self, val); } pub fn initFunctionTemplateDefault(self: Self) FunctionTemplate { return FunctionTemplate.initDefault(self); } pub fn initFunctionTemplateCallback(self: Self, callback: c.FunctionCallback) FunctionTemplate { return FunctionTemplate.initCallback(self, callback); } pub fn initFunctionTemplateCallbackData(self: Self, callback: c.FunctionCallback, data_value: anytype) FunctionTemplate { return FunctionTemplate.initCallbackData(self, callback, data_value); } pub fn initObjectTemplateDefault(self: Self) ObjectTemplate { return ObjectTemplate.initDefault(self); } pub fn initObjectTemplate(self: Self, constructor: FunctionTemplate) ObjectTemplate { return ObjectTemplate.init(self, constructor); } pub fn initObject(self: Self) Object { return Object.init(self); } pub fn initArray(self: Self, len: u32) Array { return Array.init(self, len); } pub fn initArrayElements(self: Self, elems: []const Value) Array { return Array.initElements(self, elems); } pub fn initUndefined(self: Self) Primitive { return Root.initUndefined(self); } pub fn initNull(self: Self) Primitive { return Root.initNull(self); } pub fn initTrue(self: Self) Boolean { return Root.initTrue(self); } pub fn initFalse(self: Self) Boolean { return Root.initFalse(self); } pub fn initContext(self: Self, global_tmpl: ?ObjectTemplate, global_obj: ?*c.Value) Context { return Context.init(self, global_tmpl, global_obj); } pub fn initExternal(self: Self, val: ?*anyopaque) External { return External.init(self, val); } }; pub const HandleScope = struct { const Self = @This(); inner: c.HandleScope, /// [Notes] /// This starts a new stack frame to record local objects created. /// Since deinit depends on the inner pointer being the same, init should construct in place. pub fn init(self: *Self, isolate: Isolate) void { c.v8__HandleScope__CONSTRUCT(&self.inner, isolate.handle); } /// [Notes] /// This pops the scope frame and allows V8 to mark/free local objects created since HandleScope.init. /// In C++ code, this would happen automatically when the HandleScope var leaves the current scope. pub fn deinit(self: *Self) void { c.v8__HandleScope__DESTRUCT(&self.inner); } }; pub const Context = struct { const Self = @This(); handle: *const c.Context, /// [V8] /// Creates a new context and returns a handle to the newly allocated /// context. /// /// \param isolate The isolate in which to create the context. /// /// \param extensions An optional extension configuration containing /// the extensions to be installed in the newly created context. /// /// \param global_template An optional object template from which the /// global object for the newly created context will be created. /// /// \param global_object An optional global object to be reused for /// the newly created context. This global object must have been /// created by a previous call to Context::New with the same global /// template. The state of the global object will be completely reset /// and only object identify will remain. pub fn init(isolate: Isolate, global_tmpl: ?ObjectTemplate, global_obj: ?*c.Value) Self { return .{ .handle = c.v8__Context__New(isolate.handle, if (global_tmpl != null) global_tmpl.?.handle else null, global_obj).?, }; } /// [V8] /// Enter this context. After entering a context, all code compiled /// and run is compiled and run in this context. If another context /// is already entered, this old context is saved so it can be /// restored when the new context is exited. pub fn enter(self: Self) void { c.v8__Context__Enter(self.handle); } /// [V8] /// Exit this context. Exiting the current context restores the /// context that was in place when entering the current context. pub fn exit(self: Self) void { c.v8__Context__Exit(self.handle); } /// [V8] /// Returns the isolate associated with a current context. pub fn getIsolate(self: Self) Isolate { return Isolate{ .handle = c.v8__Context__GetIsolate(self.handle).?, }; } pub fn getGlobal(self: Self) Object { return .{ .handle = c.v8__Context__Global(self.handle).?, }; } pub fn getEmbedderData(self: Self, idx: u32) Value { return .{ .handle = c.v8__Context__GetEmbedderData(self.handle, @intCast(idx)).?, }; } pub fn setEmbedderData(self: Self, idx: u32, val: anytype) void { c.v8__Context__SetEmbedderData(self.handle, @intCast(idx), getValueHandle(val)); } }; pub const PropertyCallbackInfo = struct { const Self = @This(); handle: *const c.PropertyCallbackInfo, pub fn initFromV8(val: ?*const c.PropertyCallbackInfo) Self { return .{ .handle = val.?, }; } pub fn getIsolate(self: Self) Isolate { return .{ .handle = c.v8__PropertyCallbackInfo__GetIsolate(self.handle).?, }; } pub fn getReturnValue(self: Self) ReturnValue { var res: c.ReturnValue = undefined; c.v8__PropertyCallbackInfo__GetReturnValue(self.handle, &res); return .{ .inner = res, }; } pub fn getThis(self: Self) Object { return .{ .handle = c.v8__PropertyCallbackInfo__This(self.handle).?, }; } pub fn getData(self: Self) Value { return .{ .handle = c.v8__PropertyCallbackInfo__Data(self.handle).?, }; } pub fn getExternalValue(self: Self) ?*anyopaque { return self.getData().castTo(External).get(); } }; pub const WeakCallbackInfo = struct { const Self = @This(); handle: *const c.WeakCallbackInfo, pub fn initFromC(val: ?*const c.WeakCallbackInfo) Self { return .{ .handle = val.?, }; } pub fn getIsolate(self: Self) Isolate { return .{ .handle = c.v8__WeakCallbackInfo__GetIsolate(self.handle).?, }; } pub fn getParameter(self: Self) *anyopaque { return c.v8__WeakCallbackInfo__GetParameter(self.handle).?; } pub fn getInternalField(self: Self, idx: u32) ?*anyopaque { return c.v8__WeakCallbackInfo__GetInternalField(self.handle, @intCast(idx)); } }; pub const PromiseRejectMessage = struct { const Self = @This(); inner: c.PromiseRejectMessage, pub fn initFromC(val: c.PromiseRejectMessage) Self { return .{ .inner = val, }; } pub fn getEvent(self: Self) c.PromiseRejectEvent { return c.v8__PromiseRejectMessage__GetEvent(&self.inner); } pub fn getPromise(self: Self) Promise { return .{ .handle = c.v8__PromiseRejectMessage__GetPromise(&self.inner).?, }; } pub fn getValue(self: Self) Value { return .{ .handle = c.v8__PromiseRejectMessage__GetValue(&self.inner).?, }; } }; pub const FunctionCallbackInfo = struct { const Self = @This(); handle: *const c.FunctionCallbackInfo, pub fn initFromV8(val: ?*const c.FunctionCallbackInfo) Self { return .{ .handle = val.?, }; } pub fn length(self: Self) u32 { return @intCast(c.v8__FunctionCallbackInfo__Length(self.handle)); } pub fn getIsolate(self: Self) Isolate { return .{ .handle = c.v8__FunctionCallbackInfo__GetIsolate(self.handle).?, }; } pub fn getArg(self: Self, i: u32) Value { return .{ .handle = c.v8__FunctionCallbackInfo__INDEX(self.handle, @intCast(i)).?, }; } pub fn getReturnValue(self: Self) ReturnValue { var res: c.ReturnValue = undefined; c.v8__FunctionCallbackInfo__GetReturnValue(self.handle, &res); return .{ .inner = res, }; } pub fn getThis(self: Self) Object { return .{ .handle = c.v8__FunctionCallbackInfo__This(self.handle).?, }; } pub fn getData(self: Self) Value { return .{ .handle = c.v8__FunctionCallbackInfo__Data(self.handle).?, }; } pub fn getExternalValue(self: Self) ?*anyopaque { return self.getData().castTo(External).get(); } }; pub const ReturnValue = struct { const Self = @This(); inner: c.ReturnValue, pub fn set(self: Self, value: anytype) void { c.v8__ReturnValue__Set(self.inner, getValueHandle(value)); } pub fn setValueHandle(self: Self, ptr: *const c.Value) void { c.v8__ReturnValue__Set(self.inner, ptr); } pub fn get(self: Self) Value { return .{ .handle = c.v8__ReturnValue__Get(self.inner).?, }; } }; pub const FunctionTemplate = struct { const Self = @This(); handle: *const c.FunctionTemplate, pub fn initDefault(isolate: Isolate) Self { return .{ .handle = c.v8__FunctionTemplate__New__DEFAULT(isolate.handle).?, }; } pub fn initCallback(isolate: Isolate, callback: c.FunctionCallback) Self { return .{ .handle = c.v8__FunctionTemplate__New__DEFAULT2(isolate.handle, callback).?, }; } pub fn initCallbackData(isolate: Isolate, callback: c.FunctionCallback, data_val: anytype) Self { return .{ .handle = c.v8__FunctionTemplate__New__DEFAULT3(isolate.handle, callback, getValueHandle(data_val)).?, }; } /// This is typically used to set class fields. pub fn getInstanceTemplate(self: Self) ObjectTemplate { return .{ .handle = c.v8__FunctionTemplate__InstanceTemplate(self.handle).?, }; } /// This is typically used to set class methods. pub fn getPrototypeTemplate(self: Self) ObjectTemplate { return .{ .handle = c.v8__FunctionTemplate__PrototypeTemplate(self.handle).?, }; } /// There is only one unique function for a FunctionTemplate in a given context. /// The Function can then be used to invoke NewInstance which is equivalent to doing js "new". pub fn getFunction(self: Self, ctx: Context) Function { return .{ .handle = c.v8__FunctionTemplate__GetFunction(self.handle, ctx.handle).?, }; } /// Sets static property on the template. pub fn set(self: Self, key: anytype, value: anytype, attr: c.PropertyAttribute) void { c.v8__Template__Set(getTemplateHandle(self), getNameHandle(key), getDataHandle(value), attr); } pub fn setGetter(self: Self, name: anytype, getter: FunctionTemplate) void { c.v8__Template__SetAccessorProperty__DEFAULT(getTemplateHandle(self), getNameHandle(name), getter.handle); } pub fn setClassName(self: Self, name: String) void { c.v8__FunctionTemplate__SetClassName(self.handle, name.handle); } pub fn setReadOnlyPrototype(self: Self) void { c.v8__FunctionTemplate__ReadOnlyPrototype(self.handle); } }; pub const Function = struct { const Self = @This(); handle: *const c.Function, /// Internally, this will create a temporary FunctionTemplate to get a new Function instance. pub fn initDefault(ctx: Context, callback: c.FunctionCallback) Self { return .{ .handle = c.v8__Function__New__DEFAULT(ctx.handle, callback).?, }; } pub fn initWithData(ctx: Context, callback: c.FunctionCallback, data_val: anytype) Self { return .{ .handle = c.v8__Function__New__DEFAULT2(ctx.handle, callback, getValueHandle(data_val)).?, }; } /// receiver_val is "this" in the function context. This is equivalent to calling fn.apply(receiver, args) in JS. /// Returns null if there was an error. pub fn call(self: Self, ctx: Context, receiver_val: anytype, args: []const Value) ?Value { const c_args: ?[*]const ?*c.Value = @ptrCast(args.ptr); if (c.v8__Function__Call(self.handle, ctx.handle, getValueHandle(receiver_val), @intCast(args.len), c_args)) |ret| { return Value{ .handle = ret, }; } else return null; } // Equavalent to js "new". pub fn initInstance(self: Self, ctx: Context, args: []const Value) ?Object { const c_args: ?[*]const ?*c.Value = @ptrCast(args.ptr); if (c.v8__Function__NewInstance(self.handle, ctx.handle, @intCast(args.len), c_args)) |ret| { return Object{ .handle = ret, }; } else return null; } pub fn toObject(self: Self) Object { return .{ .handle = @ptrCast(self.handle), }; } pub fn toValue(self: Self) Value { return .{ .handle = self.handle, }; } pub fn getName(self: Self) Value { return .{ .handle = c.v8__Function__GetName(self.handle).?, }; } pub fn setName(self: Self, name: String) void { c.v8__Function__SetName(self.handle, name.handle); } }; pub fn Persistent(comptime T: type) type { return struct { const Self = @This(); inner: T, /// A new value is created that references the original value. /// A Persistent handle is a pointer just like any other value handles, /// but when creating and operating on it, an indirect pointer is used to represent a c.Persistent struct (v8::Persistent in C++). pub fn init(isolate: Isolate, data: T) Self { var handle: *c.Data = undefined; c.v8__Persistent__New(isolate.handle, getDataHandle(data), @ptrCast(&handle)); return .{ .inner = .{ .handle = @ptrCast(handle), }, }; } pub fn deinit(self: *Self) void { c.v8__Persistent__Reset(@ptrCast(&self.inner.handle)); } pub fn setWeak(self: *Self) void { c.v8__Persistent__SetWeak(@ptrCast(&self.inner.handle)); } /// An external pointer can be set when cb_type is kParameter or kInternalFields. /// When cb_type is kInternalFields, the object fields are expected to be set with setAlignedPointerInInternalField. /// The pointer value must be a multiple of 2 due to how v8 encodes the pointers. pub fn setWeakFinalizer(self: *Self, finalizer_ctx: *anyopaque, cb: c.WeakCallback, cb_type: WeakCallbackType) void { c.v8__Persistent__SetWeakFinalizer(@ptrCast(&self.inner.handle), finalizer_ctx, cb, @intCast(cb_type)); } /// Should only be called if you know the underlying type is a v8.Function. pub fn castToFunction(self: Self) Function { return .{ .handle = @ptrCast(self.inner.handle), }; } /// Should only be called if you know the underlying type is a v8.Object. pub fn castToObject(self: Self) Object { return .{ .handle = @ptrCast(self.inner.handle), }; } /// Should only be called if you know the underlying type is a v8.PromiseResolver. pub fn castToPromiseResolver(self: Self) PromiseResolver { return .{ .handle = @ptrCast(self.inner.handle), }; } pub fn toValue(self: Self) Value { return .{ .handle = self.inner.handle, }; } }; } /// [V8] /// kParameter will pass a void* parameter back to the callback, kInternalFields /// will pass the first two internal fields back to the callback, kFinalizer /// will pass a void* parameter back, but is invoked before the object is /// actually collected, so it can be resurrected. In the last case, it is not /// possible to request a second pass callback. pub const WeakCallbackType = enum(u32) { kParameter = c.kParameter, kInternalFields = c.kInternalFields, kFinalizer = c.kFinalizer, }; pub const ObjectTemplate = struct { const Self = @This(); handle: *const c.ObjectTemplate, pub fn initDefault(isolate: Isolate) Self { return .{ .handle = c.v8__ObjectTemplate__New__DEFAULT(isolate.handle).?, }; } pub fn init(isolate: Isolate, constructor: FunctionTemplate) Self { return .{ .handle = c.v8__ObjectTemplate__New(isolate.handle, constructor.handle).?, }; } pub fn initInstance(self: Self, ctx: Context) Object { return .{ .handle = c.v8__ObjectTemplate__NewInstance(self.handle, ctx.handle).?, }; } pub fn setGetter(self: Self, name: anytype, getter: c.AccessorNameGetterCallback) void { c.v8__ObjectTemplate__SetAccessor__DEFAULT(self.handle, getNameHandle(name), getter); } pub fn setGetterAndSetter(self: Self, name: anytype, getter: c.AccessorNameGetterCallback, setter: c.AccessorNameSetterCallback) void { c.v8__ObjectTemplate__SetAccessor__DEFAULT2(self.handle, getNameHandle(name), getter, setter); } pub fn set(self: Self, key: anytype, value: anytype, attr: c.PropertyAttribute) void { c.v8__Template__Set(getTemplateHandle(self), getNameHandle(key), getDataHandle(value), attr); } pub fn setInternalFieldCount(self: Self, count: u32) void { c.v8__ObjectTemplate__SetInternalFieldCount(self.handle, @intCast(count)); } pub fn toValue(self: Self) Value { return .{ .handle = self.handle, }; } }; pub const Array = struct { const Self = @This(); handle: *const c.Array, pub fn init(iso: Isolate, len: u32) Self { return .{ .handle = c.v8__Array__New(iso.handle, @intCast(len)).?, }; } pub fn initElements(iso: Isolate, elems: []const Value) Self { const c_elems: ?[*]const ?*c.Value = @ptrCast(elems.ptr); return .{ .handle = c.v8__Array__New2(iso.handle, c_elems, elems.len).?, }; } pub fn length(self: Self) u32 { return c.v8__Array__Length(self.handle); } pub fn castTo(self: Self, comptime T: type) T { switch (T) { Object => { return .{ .handle = @ptrCast(self.handle), }; }, else => unreachable, } } }; pub const Object = struct { const Self = @This(); handle: *const c.Object, pub fn init(isolate: Isolate) Self { return .{ .handle = c.v8__Object__New(isolate.handle).?, }; } pub fn setInternalField(self: Self, idx: u32, value: anytype) void { c.v8__Object__SetInternalField(self.handle, @intCast(idx), getValueHandle(value)); } pub fn getInternalField(self: Self, idx: u32) Value { return .{ .handle = c.v8__Object__GetInternalField(self.handle, @intCast(idx)).?, }; } pub fn setAlignedPointerInInternalField(self: Self, idx: u32, ptr: ?*anyopaque) void { c.v8__Object__SetAlignedPointerInInternalField(self.handle, @intCast(idx), ptr); } // Returns true on success, false on fail. pub fn setValue(self: Self, ctx: Context, key: anytype, value: anytype) bool { var out: c.MaybeBool = undefined; c.v8__Object__Set(self.handle, ctx.handle, getValueHandle(key), getValueHandle(value), &out); // Set only returns empty for an error or true. return out.has_value == 1; } pub fn getValue(self: Self, ctx: Context, key: anytype) !Value { if (c.v8__Object__Get(self.handle, ctx.handle, getValueHandle(key))) |handle| { return Value{ .handle = handle, }; } else return error.JsException; } pub fn getAtIndex(self: Self, ctx: Context, idx: u32) !Value { if (c.v8__Object__GetIndex(self.handle, ctx.handle, idx)) |handle| { return Value{ .handle = handle, }; } else return error.JsException; } pub fn toValue(self: Self) Value { return .{ .handle = self.handle, }; } pub fn defineOwnProperty(self: Self, ctx: Context, name: anytype, value: anytype, attr: c.PropertyAttribute) ?bool { var out: c.MaybeBool = undefined; c.v8__Object__DefineOwnProperty(self.handle, ctx.handle, getNameHandle(name), getValueHandle(value), attr, &out); if (out.has_value == 1) { return out.value == 1; } else return null; } pub fn getIsolate(self: Self) Isolate { return .{ .handle = c.v8__Object__GetIsolate(self.handle).?, }; } pub fn getCreationContext(self: Self) Context { return .{ .handle = c.v8__Object__GetCreationContext(self.handle).?, }; } pub fn getIdentityHash(self: Self) u32 { return @bitCast(c.v8__Object__GetIdentityHash(self.handle)); } pub fn has(self: Self, ctx: Context, key: Value) bool { var out: c.MaybeBool = undefined; c.v8__Object__Has(self.handle, ctx.handle, key.handle, &out); if (out.has_value == 1) { return out.value == 1; } else return false; } pub fn hasIndex(self: Self, ctx: Context, idx: u32) bool { var out: c.MaybeBool = undefined; c.v8__Object__Has(self.handle, ctx.handle, idx, &out); if (out.has_value == 1) { return out.value == 1; } else return false; } pub fn getOwnPropertyNames(self: Self, ctx: Context) Array { return .{ .handle = c.v8__Object__GetOwnPropertyNames(self.handle, ctx.handle).?, }; } pub fn getPropertyNames(self: Self, ctx: Context) Array { return .{ .handle = c.v8__Object__GetPropertyNames(self.handle, ctx.handle).?, }; } }; pub const External = struct { const Self = @This(); handle: *const c.External, pub fn init(isolate: Isolate, val: ?*anyopaque) Self { return .{ .handle = c.v8__External__New(isolate.handle, val).?, }; } pub fn get(self: Self) ?*anyopaque { return c.v8__External__Value(self.handle); } pub fn toValue(self: Self) Value { return .{ .handle = self.handle, }; } }; pub const Number = struct { const Self = @This(); handle: *const c.Number, pub fn init(isolate: Isolate, val: f64) Self { return .{ .handle = c.v8__Number__New(isolate.handle, val).?, }; } pub fn initBitCastedU64(isolate: Isolate, val: u64) Self { return init(isolate, @bitCast(val)); } pub fn toValue(self: Self) Value { return .{ .handle = self.handle, }; } }; pub const Integer = struct { const Self = @This(); handle: *const c.Integer, pub fn initI32(isolate: Isolate, val: i32) Self { return .{ .handle = c.v8__Integer__New(isolate.handle, val).?, }; } pub fn initU32(isolate: Isolate, val: u32) Self { return .{ .handle = c.v8__Integer__NewFromUnsigned(isolate.handle, val).?, }; } pub fn getValue(self: Self) u64 { return c.v8__Integer__Value(self.handle); } pub fn getValueU32(self: Self) u32 { return @intCast(c.v8__Integer__Value(self.handle)); } pub fn toValue(self: Self) Value { return .{ .handle = self.handle, }; } }; pub const BigInt = struct { const Self = @This(); handle: *const c.Integer, pub fn initI64(iso: Isolate, val: i64) Self { return .{ .handle = c.v8__BigInt__New(iso.handle, val).?, }; } pub fn initU64(iso: Isolate, val: u64) Self { return .{ .handle = c.v8__BigInt__NewFromUnsigned(iso.handle, val).?, }; } pub fn getUint64(self: Self) u64 { return c.v8__BigInt__Uint64Value(self.handle, null); } pub fn getInt64(self: Self) i64 { return c.v8__BigInt__Int64Value(self.handle, null); } }; pub inline fn getValue(val: anytype) Value { return .{ .handle = getValueHandle(val), }; } inline fn getValueHandle(val: anytype) *const c.Value { return @ptrCast(switch (@TypeOf(val)) { Object => val.handle, Value => val.handle, String => val.handle, Integer => val.handle, Primitive => val.handle, Number => val.handle, Function => val.handle, PromiseResolver => val.handle, External => val.handle, Array => val.handle, Uint8Array => val.handle, StackTrace => val.handle, ObjectTemplate => val.handle, Persistent(Object) => val.inner.handle, Persistent(Value) => val.inner.handle, Persistent(String) => val.inner.handle, Persistent(Integer) => val.inner.handle, Persistent(Primitive) => val.inner.handle, Persistent(Number) => val.inner.handle, Persistent(PromiseResolver) => val.inner.handle, Persistent(Array) => val.inner.handle, else => @compileError(std.fmt.comptimePrint("{s} is not a subtype of v8::Value", .{@typeName(@TypeOf(val))})), }); } inline fn getNameHandle(val: anytype) *const c.Name { return @ptrCast(comptime switch (@TypeOf(val)) { *const c.String => val, String => val.handle, else => @compileError(std.fmt.comptimePrint("{s} is not a subtype of v8::Name", .{@typeName(@TypeOf(val))})), }); } inline fn getTemplateHandle(val: anytype) *const c.Template { return @ptrCast(comptime switch (@TypeOf(val)) { FunctionTemplate => val.handle, ObjectTemplate => val.handle, else => @compileError(std.fmt.comptimePrint("{s} is not a subtype of v8::Template", .{@typeName(@TypeOf(val))})), }); } inline fn getDataHandle(val: anytype) *const c.Data { return @ptrCast(comptime switch (@TypeOf(val)) { FunctionTemplate => val.handle, ObjectTemplate => val.handle, Integer => val.handle, Function => val.handle, Context => val.handle, Object => val.handle, Value => val.handle, Module => val.handle, Promise => val.handle, PromiseResolver => val.handle, else => @compileError(std.fmt.comptimePrint("{s} is not a subtype of v8::Data", .{@typeName(@TypeOf(val))})), }); } pub const Message = struct { const Self = @This(); handle: *const c.Message, pub fn getMessage(self: Self) String { return String{ .handle = c.v8__Message__Get(self.handle).?, }; } pub fn getSourceLine(self: Self, ctx: Context) ?String { if (c.v8__Message__GetSourceLine(self.handle, ctx.handle)) |string| { return String{ .handle = string, }; } else return null; } pub fn getScriptResourceName(self: Self) Value { return .{ .handle = c.v8__Message__GetScriptResourceName(self.handle).?, }; } pub fn getLineNumber(self: Self, ctx: Context) ?u32 { const res = c.v8__Message__GetLineNumber(self.handle, ctx.handle); if (res != -1) { return @intCast(res); } else return null; } pub fn getStartColumn(self: Self) ?u32 { const res = c.v8__Message__GetStartColumn(self.handle); if (res != -1) { return @intCast(res); } else return null; } pub fn getEndColumn(self: Self) ?u32 { const res = c.v8__Message__GetEndColumn(self.handle); if (res != -1) { return @intCast(res); } else return null; } /// [v8] Exception stack trace. By default stack traces are not captured for /// uncaught exceptions. SetCaptureStackTraceForUncaughtExceptions allows /// to change this option. pub fn getStackTrace(self: Self) ?StackTrace { if (c.v8__Message__GetStackTrace(self.handle)) |trace| { return StackTrace{ .handle = trace, }; } else return null; } }; pub const StackTrace = struct { const Self = @This(); handle: *const c.StackTrace, pub fn getFrameCount(self: Self) u32 { return @intCast(c.v8__StackTrace__GetFrameCount(self.handle)); } pub fn getFrame(self: Self, iso: Isolate, idx: u32) StackFrame { return .{ .handle = c.v8__StackTrace__GetFrame(self.handle, iso.handle, idx).?, }; } pub fn getCurrentStackTrace(iso: Isolate, frame_limit: u32) StackTrace { return .{ .handle = c.v8__StackTrace__CurrentStackTrace__STATIC(iso.handle, @intCast(frame_limit)).?, }; } pub fn getCurrentScriptNameOrSourceUrl(iso: Isolate) String { return .{ .handle = c.v8__StackTrace__CurrentScriptNameOrSourceURL__STATIC(iso.handle).?, }; } }; pub const StackFrame = struct { const Self = @This(); handle: *const c.StackFrame, pub fn getLineNumber(self: Self) u32 { return @intCast(c.v8__StackFrame__GetLineNumber(self.handle)); } pub fn getColumn(self: Self) u32 { return @intCast(c.v8__StackFrame__GetColumn(self.handle)); } pub fn getScriptId(self: Self) u32 { return @intCast(c.v8__StackFrame__GetScriptId(self.handle)); } pub fn getScriptName(self: Self) String { return .{ .handle = c.v8__StackFrame__GetScriptName(self.handle).?, }; } pub fn getScriptNameOrSourceUrl(self: Self) String { return .{ .handle = c.v8__StackFrame__GetScriptNameOrSourceURL(self.handle).?, }; } pub fn getFunctionName(self: Self) ?String { if (c.v8__StackFrame__GetFunctionName(self.handle)) |ptr| { return String{ .handle = ptr, }; } else return null; } pub fn isEval(self: Self) bool { return c.v8__StackFrame__IsEval(self.handle); } pub fn isConstructor(self: Self) bool { return c.v8__StackFrame__IsConstructor(self.handle); } pub fn isWasm(self: Self) bool { return c.v8__StackFrame__IsWasm(self.handle); } pub fn isUserJavascript(self: Self) bool { return c.v8__StackFrame__IsUserJavaScript(self.handle); } }; pub const TryCatch = struct { const Self = @This(); inner: c.TryCatch, // TryCatch is wrapped in a v8::Local so have to initialize in place. pub fn init(self: *Self, isolate: Isolate) void { c.v8__TryCatch__CONSTRUCT(&self.inner, isolate.handle); } pub fn deinit(self: *Self) void { c.v8__TryCatch__DESTRUCT(&self.inner); } pub fn hasCaught(self: Self) bool { return c.v8__TryCatch__HasCaught(&self.inner); } pub fn getException(self: Self) ?Value { if (c.v8__TryCatch__Exception(&self.inner)) |exception| { return Value{ .handle = exception, }; } else return null; } pub fn getStackTrace(self: Self, ctx: Context) ?Value { if (c.v8__TryCatch__StackTrace(&self.inner, ctx.handle)) |value| { return Value{ .handle = value, }; } else return null; } pub fn getMessage(self: Self) ?Message { if (c.v8__TryCatch__Message(&self.inner)) |message| { return Message{ .handle = message, }; } else return null; } pub fn isVerbose(self: Self) bool { return c.v8__TryCatch__IsVerbose(&self.inner); } pub fn setVerbose(self: *Self, verbose: bool) void { c.v8__TryCatch__SetVerbose(&self.inner, verbose); } pub fn rethrow(self: *Self) Value { return .{ .handle = c.v8__TryCatch__ReThrow(&self.inner).?, }; } }; pub const ScriptOrigin = struct { const Self = @This(); inner: c.ScriptOrigin, pub fn initDefault(isolate: Isolate, resource_name: Value) Self { var inner: c.ScriptOrigin = undefined; c.v8__ScriptOrigin__CONSTRUCT(&inner, isolate.handle, resource_name.handle); return .{ .inner = inner, }; } pub fn init( isolate: Isolate, resource_name: Value, resource_line_offset: i32, resource_column_offset: i32, resource_is_shared_cross_origin: bool, script_id: i32, source_map_url: ?Value, resource_is_opaque: bool, is_wasm: bool, is_module: bool, host_defined_options: ?Data, ) Self { var inner: c.ScriptOrigin = undefined; c.v8__ScriptOrigin__CONSTRUCT2( &inner, isolate.handle, resource_name.handle, resource_line_offset, resource_column_offset, resource_is_shared_cross_origin, script_id, if (source_map_url != null) source_map_url.?.handle else null, resource_is_opaque, is_wasm, is_module, if (host_defined_options != null) host_defined_options.?.handle else null, ); return .{ .inner = inner, }; } }; pub const Boolean = struct { const Self = @This(); handle: *const c.Boolean, pub fn init(isolate: Isolate, val: bool) Self { return .{ .handle = c.v8__Boolean__New(isolate.handle, val).?, }; } }; pub const String = struct { const Self = @This(); handle: *const c.String, pub fn initUtf8(isolate: Isolate, str: []const u8) Self { return .{ .handle = c.v8__String__NewFromUtf8(isolate.handle, str.ptr, c.kNormal, @intCast(str.len)).?, }; } pub fn lenUtf8(self: Self, isolate: Isolate) u32 { return @intCast(c.v8__String__Utf8Length(self.handle, isolate.handle)); } pub fn writeUtf8(self: String, isolate: Isolate, buf: []const u8) u32 { const options = c.NO_NULL_TERMINATION | c.REPLACE_INVALID_UTF8; // num chars is how many utf8 characters are actually written and the function returns how many bytes were written. var nchars: c_int = 0; // TODO: Return num chars return @intCast(c.v8__String__WriteUtf8(self.handle, isolate.handle, buf.ptr, @intCast(buf.len), &nchars, options)); } pub fn toValue(self: Self) Value { return .{ .handle = self.handle, }; } }; pub const ScriptCompilerSource = struct { const Self = @This(); inner: c.ScriptCompilerSource, pub fn init(self: *Self, src: String, mb_origin: ?ScriptOrigin, cached_data: ?ScriptCompilerCachedData) void { const cached_data_ptr = if (cached_data != null) cached_data.?.handle else null; if (mb_origin) |origin| { c.v8__ScriptCompiler__Source__CONSTRUCT2(src.handle, &origin.inner, cached_data_ptr, &self.inner); } else { c.v8__ScriptCompiler__Source__CONSTRUCT(src.handle, cached_data_ptr, &self.inner); } } pub fn deinit(self: *Self) void { c.v8__ScriptCompiler__Source__DESTRUCT(&self.inner); } }; pub const ScriptCompilerCachedData = struct { const Self = @This(); handle: *c.ScriptCompilerCachedData, pub fn init(data: []const u8) Self { return .{ .handle = c.v8__ScriptCompiler__CachedData__NEW(data.ptr, @intCast(data.len)).?, }; } pub fn deinit(self: Self) void { c.v8__ScriptCompiler__CachedData__DELETE(self.handle); } }; pub const ScriptCompiler = struct { const CompileOptions = enum(u32) { kNoCompileOptions = c.kNoCompileOptions, kConsumeCodeCache = c.kConsumeCodeCache, kEagerCompile = c.kEagerCompile, }; const NoCacheReason = enum(u32) { kNoCacheNoReason = c.kNoCacheNoReason, kNoCacheBecauseCachingDisabled = c.kNoCacheBecauseCachingDisabled, kNoCacheBecauseNoResource = c.kNoCacheBecauseNoResource, kNoCacheBecauseInlineScript = c.kNoCacheBecauseInlineScript, kNoCacheBecauseModule = c.kNoCacheBecauseModule, kNoCacheBecauseStreamingSource = c.kNoCacheBecauseStreamingSource, kNoCacheBecauseInspector = c.kNoCacheBecauseInspector, kNoCacheBecauseScriptTooSmall = c.kNoCacheBecauseScriptTooSmall, kNoCacheBecauseCacheTooCold = c.kNoCacheBecauseCacheTooCold, kNoCacheBecauseV8Extension = c.kNoCacheBecauseV8Extension, kNoCacheBecauseExtensionModule = c.kNoCacheBecauseExtensionModule, kNoCacheBecausePacScript = c.kNoCacheBecausePacScript, kNoCacheBecauseInDocumentWrite = c.kNoCacheBecauseInDocumentWrite, kNoCacheBecauseResourceWithNoCacheHandler = c.kNoCacheBecauseResourceWithNoCacheHandler, kNoCacheBecauseDeferredProduceCodeCache = c.kNoCacheBecauseDeferredProduceCodeCache, }; /// [v8] /// Compile an ES module, returning a Module that encapsulates the compiled code. /// Corresponds to the ParseModule abstract operation in the ECMAScript specification. pub fn compileModule(iso: Isolate, src: *ScriptCompilerSource, options: ScriptCompiler.CompileOptions, reason: ScriptCompiler.NoCacheReason) !Module { const mb_res = c.v8__ScriptCompiler__CompileModule( iso.handle, &src.inner, @intCast(options), @intCast(reason), ); if (mb_res) |res| { return Module{ .handle = res, }; } else return error.JsException; } }; pub const Script = struct { const Self = @This(); handle: *const c.Script, /// [v8] /// A shorthand for ScriptCompiler::Compile(). pub fn compile(ctx: Context, src: String, origin: ?ScriptOrigin) !Self { if (c.v8__Script__Compile(ctx.handle, src.handle, if (origin != null) &origin.?.inner else null)) |handle| { return Self{ .handle = handle, }; } else return error.JsException; } pub fn run(self: Self, ctx: Context) !Value { if (c.v8__Script__Run(self.handle, ctx.handle)) |value| { return Value{ .handle = value, }; } else return error.JsException; } }; pub const Module = struct { const Self = @This(); const Status = enum(u32) { kUninstantiated = c.kUninstantiated, kInstantiating = c.kInstantiating, kInstantiated = c.kInstantiated, kEvaluating = c.kEvaluating, kEvaluated = c.kEvaluated, kErrored = c.kErrored, }; handle: *const c.Module, pub fn getStatus(self: Self) Status { return @intFromEnum(c.v8__Module__GetStatus(self.handle)); } pub fn getException(self: Self) Value { return .{ .handle = c.v8__Module__GetException(self.handle).?, }; } pub fn getModuleRequests(self: Self) FixedArray { return .{ .handle = c.v8__Module__GetModuleRequests(self.handle).?, }; } /// [v8] /// Instantiates the module and its dependencies. /// /// Returns an empty Maybe if an exception occurred during /// instantiation. (In the case where the callback throws an exception, that /// exception is propagated.) pub fn instantiate(self: Self, ctx: Context, cb: c.ResolveModuleCallback) !bool { var out: c.MaybeBool = undefined; c.v8__Module__InstantiateModule(self.handle, ctx.handle, cb, &out); if (out.has_value == 1) { return out.value == 1; } else return error.JsException; } /// Evaulates the module, assumes module has been instantiated. /// [v8] /// Evaluates the module and its dependencies. /// /// If status is kInstantiated, run the module's code and return a Promise /// object. On success, set status to kEvaluated and resolve the Promise with /// the completion value; on failure, set status to kErrored and reject the /// Promise with the error. /// /// If IsGraphAsync() is false, the returned Promise is settled. pub fn evaluate(self: Self, ctx: Context) !Value { if (c.v8__Module__Evaluate(self.handle, ctx.handle)) |res| { return Value{ .handle = res, }; } else return error.JsException; } pub fn getIdentityHash(self: Self) u32 { return @bitCast(c.v8__Module__GetIdentityHash(self.handle)); } pub fn getScriptId(self: Self) u32 { return @intCast(c.v8__Module__ScriptId(self.handle)); } }; pub const ModuleRequest = struct { const Self = @This(); handle: *const c.ModuleRequest, /// Returns the specifier of the import inside the double quotes pub fn getSpecifier(self: Self) String { return .{ .handle = c.v8__ModuleRequest__GetSpecifier(self.handle).?, }; } /// Returns the offset from the start of the source code. pub fn getSourceOffset(self: Self) u32 { return @intCast(c.v8__ModuleRequest__GetSourceOffset(self.handle)); } }; pub const Data = struct { const Self = @This(); handle: *const c.Data, /// Should only be called if you know the underlying type. pub fn castTo(self: Self, comptime T: type) T { switch (T) { ModuleRequest => { return .{ .handle = self.handle, }; }, else => unreachable, } } }; pub const Value = struct { const Self = @This(); handle: *const c.Value, pub fn toString(self: Self, ctx: Context) !String { return String{ .handle = c.v8__Value__ToString(self.handle, ctx.handle) orelse return error.JsException, }; } pub fn toDetailString(self: Self, ctx: Context) !String { return String{ .handle = c.v8__Value__ToDetailString(self.handle, ctx.handle) orelse return error.JsException, }; } pub fn toBool(self: Self, isolate: Isolate) bool { return c.v8__Value__BooleanValue(self.handle, isolate.handle); } pub fn toI32(self: Self, ctx: Context) !i32 { var out: c.MaybeI32 = undefined; c.v8__Value__Int32Value(self.handle, ctx.handle, &out); if (out.has_value == 1) { return out.value; } else return error.JsException; } pub fn toU32(self: Self, ctx: Context) !u32 { var out: c.MaybeU32 = undefined; c.v8__Value__Uint32Value(self.handle, ctx.handle, &out); if (out.has_value == 1) { return out.value; } else return error.JsException; } pub fn toF32(self: Self, ctx: Context) !f32 { var out: c.MaybeF64 = undefined; c.v8__Value__NumberValue(self.handle, ctx.handle, &out); if (out.has_value == 1) { return @floatCast(out.value); } else return error.JsException; } pub fn toF64(self: Self, ctx: Context) !f64 { var out: c.MaybeF64 = undefined; c.v8__Value__NumberValue(self.handle, ctx.handle, &out); if (out.has_value == 1) { return out.value; } else return error.JsException; } pub fn bitCastToU64(self: Self, ctx: Context) !u64 { var out: c.MaybeF64 = undefined; c.v8__Value__NumberValue(self.handle, ctx.handle, &out); if (out.has_value == 1) { return @bitCast(out.value); } else return error.JsException; } pub fn instanceOf(self: Self, ctx: Context, obj: Object) !bool { var out: c.MaybeBool = undefined; c.v8__Value__InstanceOf(self.handle, ctx.handle, obj.handle, &out); if (out.has_value == 1) { return out.value == 1; } else return error.JsException; } pub fn isObject(self: Self) bool { return c.v8__Value__IsObject(self.handle); } pub fn isString(self: Self) bool { return c.v8__Value__IsString(self.handle); } pub fn isFunction(self: Self) bool { return c.v8__Value__IsFunction(self.handle); } pub fn isAsyncFunction(self: Self) bool { return c.v8__Value__IsAsyncFunction(self.handle); } pub fn isArray(self: Self) bool { return c.v8__Value__IsArray(self.handle); } pub fn isArrayBuffer(self: Self) bool { return c.v8__Value__IsArrayBuffer(self.handle); } pub fn isArrayBufferView(self: Self) bool { return c.v8__Value__IsArrayBufferView(self.handle); } pub fn isUint8Array(self: Self) bool { return c.v8__Value__IsUint8Array(self.handle); } pub fn isExternal(self: Self) bool { return c.v8__Value__IsExternal(self.handle); } pub fn isTrue(self: Self) bool { return c.v8__Value__IsTrue(self.handle); } pub fn isFalse(self: Self) bool { return c.v8__Value__IsFalse(self.handle); } pub fn isUndefined(self: Self) bool { return c.v8__Value__IsUndefined(self.handle); } pub fn isNull(self: Self) bool { return c.v8__Value__IsNull(self.handle); } pub fn isNullOrUndefined(self: Self) bool { return c.v8__Value__IsNullOrUndefined(self.handle); } pub fn isNativeError(self: Self) bool { return c.v8__Value__IsNativeError(self.handle); } pub fn isBigInt(self: Self) bool { return c.v8__Value__IsBigInt(self.handle); } pub fn isBigIntObject(self: Self) bool { return c.v8__Value__IsBigIntObject(self.handle); } /// Should only be called if you know the underlying type. pub fn castTo(self: Self, comptime T: type) T { switch (T) { Object, Function, Array, Promise, External, Integer, ArrayBuffer, ArrayBufferView, Uint8Array, String => { return .{ .handle = self.handle, }; }, else => unreachable, } } }; pub const Primitive = struct { const Self = @This(); handle: *const c.Primitive, }; pub fn initUndefined(isolate: Isolate) Primitive { return .{ .handle = c.v8__Undefined(isolate.handle).?, }; } pub fn initNull(isolate: Isolate) Primitive { return .{ .handle = c.v8__Null(isolate.handle).?, }; } pub fn initTrue(isolate: Isolate) Boolean { return .{ .handle = c.v8__True(isolate.handle).?, }; } pub fn initFalse(isolate: Isolate) Boolean { return .{ .handle = c.v8__False(isolate.handle).?, }; } pub const Promise = struct { const Self = @This(); pub const State = enum(u32) { kPending = c.kPending, kFulfilled = c.kFulfilled, kRejected = c.kRejected, }; handle: *const c.Promise, /// [V8] /// Register a resolution/rejection handler with a promise. /// The handler is given the respective resolution/rejection value as /// an argument. If the promise is already resolved/rejected, the handler is /// invoked at the end of turn. pub fn onCatch(self: Self, ctx: Context, handler: Function) !Promise { if (c.v8__Promise__Catch(self.handle, ctx.handle, handler.handle)) |handle| { return Promise{ .handle = handle }; } else return error.JsException; } pub fn then(self: Self, ctx: Context, handler: Function) !Promise { if (c.v8__Promise__Then(self.handle, ctx.handle, handler.handle)) |handle| { return Promise{ .handle = handle }; } else return error.JsException; } pub fn thenAndCatch(self: Self, ctx: Context, on_fulfilled: Function, on_rejected: Function) !Promise { if (c.v8__Promise__Then2(self.handle, ctx.handle, on_fulfilled.handle, on_rejected.handle)) |handle| { return Promise{ .handle = handle }; } else return error.JsException; } pub fn getState(self: Self) State { return @intFromEnum(c.v8__Promise__State(self.handle)); } /// [V8] /// Marks this promise as handled to avoid reporting unhandled rejections. pub fn markAsHandled(self: Self) void { c.v8__Promise__MarkAsHandled(self.handle); } pub fn toObject(self: Self) Object { return .{ .handle = @ptrCast(self.handle), }; } /// [V8] /// Returns the content of the [[PromiseResult]] field. The Promise must not be pending. pub fn getResult(self: Self) Value { return .{ .handle = c.v8__Promise__Result(self.handle).?, }; } }; pub const PromiseResolver = struct { const Self = @This(); handle: *const c.PromiseResolver, pub fn init(ctx: Context) Self { return .{ .handle = c.v8__Promise__Resolver__New(ctx.handle).?, }; } pub fn getPromise(self: Self) Promise { return .{ .handle = c.v8__Promise__Resolver__GetPromise(self.handle).?, }; } /// Resolve will continue execution of any yielding generators. pub fn resolve(self: Self, ctx: Context, val: Value) ?bool { var out: c.MaybeBool = undefined; c.v8__Promise__Resolver__Resolve(self.handle, ctx.handle, val.handle, &out); if (out.has_value == 1) { return out.value == 1; } else return null; } /// Reject will continue execution of any yielding generators. pub fn reject(self: Self, ctx: Context, val: Value) ?bool { var out: c.MaybeBool = undefined; c.v8__Promise__Resolver__Reject(self.handle, ctx.handle, val.handle, &out); if (out.has_value == 1) { return out.value == 1; } else return null; } }; pub const BackingStore = struct { const Self = @This(); handle: *c.BackingStore, /// Underlying handle is initially unmanaged. pub fn init(iso: Isolate, len: usize) Self { return .{ .handle = c.v8__ArrayBuffer__NewBackingStore(iso.handle, len).?, }; } /// Returns null if len is 0. pub fn getData(self: Self) ?*anyopaque { return c.v8__BackingStore__Data(self.handle); } pub fn getByteLength(self: Self) usize { return c.v8__BackingStore__ByteLength(self.handle); } pub fn isShared(self: Self) bool { return c.v8__BackingStore__IsShared(self.handle); } pub fn toSharedPtr(self: Self) SharedPtr { return c.v8__BackingStore__TO_SHARED_PTR(self.handle); } pub fn sharedPtrReset(ptr: *SharedPtr) void { c.std__shared_ptr__v8__BackingStore__reset(ptr); } pub fn sharedPtrGet(ptr: *const SharedPtr) Self { return .{ .handle = c.std__shared_ptr__v8__BackingStore__get(ptr).?, }; } pub fn sharedPtrUseCount(ptr: *const SharedPtr) u32 { return @intCast(c.std__shared_ptr__v8__BackingStore__use_count(ptr)); } }; pub const ArrayBuffer = struct { const Self = @This(); handle: *const c.ArrayBuffer, pub fn init(iso: Isolate, len: usize) Self { return .{ .handle = c.v8__ArrayBuffer__New(iso.handle, len).?, }; } pub fn initWithBackingStore(iso: Isolate, store: *const SharedPtr) Self { return .{ .handle = c.v8__ArrayBuffer__New2(iso.handle, store).?, }; } pub fn getBackingStore(self: Self) SharedPtr { return c.v8__ArrayBuffer__GetBackingStore(self.handle); } }; pub const ArrayBufferView = struct { const Self = @This(); handle: *const c.ArrayBufferView, pub fn getBuffer(self: Self) ArrayBuffer { return .{ .handle = c.v8__ArrayBufferView__Buffer(self.handle).?, }; } pub fn castFrom(val: anytype) Self { switch (@TypeOf(val)) { Uint8Array => return .{ .handle = @ptrCast(val.handle), }, else => unreachable, } } }; pub const FixedArray = struct { const Self = @This(); handle: *const c.FixedArray, pub fn length(self: Self) u32 { return @intCast(c.v8__FixedArray__Length(self.handle)); } pub fn get(self: Self, ctx: Context, idx: u32) Data { return .{ .handle = c.v8__FixedArray__Get(self.handle, ctx.handle, @intCast(idx)).?, }; } }; pub const Uint8Array = struct { const Self = @This(); handle: *const c.Uint8Array, pub fn init(buf: ArrayBuffer, offset: usize, len: usize) Self { return .{ .handle = c.v8__Uint8Array__New(buf.handle, offset, len).?, }; } }; pub const Json = struct { pub fn parse(ctx: Context, json: String) !Value { return Value{ .handle = c.v8__JSON__Parse(ctx.handle, json.handle) orelse return error.JsException, }; } pub fn stringify(ctx: Context, val: Value, gap: ?String) !String { return String{ .handle = c.v8__JSON__Stringify(ctx.handle, val.handle, if (gap != null) gap.?.handle else null) orelse return error.JsException, }; } }; inline fn ptrCastAlign(comptime Ptr: type, ptr: anytype) Ptr { const alignment = @typeInfo(Ptr).Pointer.alignment; if (alignment == 0) { return @ptrCast(ptr); } else { return @ptrCast(@alignCast(ptr)); } } pub fn setDcheckFunction(func: fn (file: [*c]const u8, line: c_int, msg: [*c]const u8) callconv(.C) void) void { c.v8__base__SetDcheckFunction(func); } test "Internals." { // Verify struct sizes. const eq = t.expectEqual; try eq(c.v8__Isolate__CreateParams__SIZEOF(), @sizeOf(c.CreateParams)); try eq(c.v8__TryCatch__SIZEOF(), @sizeOf(c.TryCatch)); try eq(c.v8__PromiseRejectMessage__SIZEOF(), @sizeOf(c.PromiseRejectMessage)); try eq(c.v8__ScriptCompiler__Source__SIZEOF(), @sizeOf(c.ScriptCompilerSource)); try eq(c.v8__ScriptCompiler__CachedData__SIZEOF(), @sizeOf(c.ScriptCompilerCachedData)); try eq(c.v8__HeapStatistics__SIZEOF(), @sizeOf(c.HeapStatistics)); }