apple/swift-system
61.4
Adequate · 15 November 2026
14k
lines of production code
Swift
primary language
5
measurements over time
What this system is
Features
Add C system header compatibility layer for Swift System
The CSystem include directory now provides a platform-specific compatibility layer for Swift System. This includes platform headers (Darwin, FreeBSD, Linux, WASI, Windows) that expose necessary C constants and structures, such as a compatibility macro for \O\_CLOFORK\ on Apple and FreeBSD, and a modified \dirent\ struct for WASI to ensure Swift importability. It also includes a custom \io\_uring.h\ header that defines fallback structures and feature macros for older Linux kernels or static SDKs where the system header is missing or incomplete, alongside a module map to expose these headers to Swift.
Sources/CSystem/include · high confidence
Add CMake build system and Swift integration support
Introduces a CMake-based build system for the Swift System library, enabling integration with Swift Package Manager (SwiftPM) and other CMake consumers. The new build infrastructure includes modules to detect and map host architectures (including Windows ARM64, RISC-V, and various ARM/x86 variants) and operating systems, as well as logic to install Swift module files (.swiftmodule, .swiftdoc) into standard directories using the correct Swift module triple. This allows the library to be built and installed as a native CMake target (SwiftSystem::SystemPackage) alongside its Swift components.
cmake · high confidence
Add Swift CI configuration for multiple platforms and versions
The project now includes automated CI job definitions for the \swift-system\ repository, enabling builds on macOS, Ubuntu 22.04, and Windows Server 2019. These configurations cover Swift versions 5.9, 5.10, and 6.0, as well as nightly builds for the main branch, ensuring the package is tested across these environments.
.swiftci · high confidence
Initial release of Swift System with cross-platform file and error handling
This change introduces the Swift System library, providing a modern, type-safe API for system-level operations. It adds the \Errno\ struct for strongly-typed error numbers with deprecation of raw C constants, and \FileDescriptor\ for managing file handles, including standard input/output/error and access modes. The library includes \FileOperations\ for opening, closing, and seeking files, \FilePermissions\ for managing Unix-style access rights, and \FileHelpers\ for utilities like \closeAfter\ and \writeAll\. It also introduces \SystemString\ and \PlatformString\ for handling platform-native character encodings (UTF-8 on Unix, UTF-16 on Windows) and \MachPort\ for managing Mach port rights on Darwin systems. The CMake build system is added to support building the library outside of Swift Package Manager.
Sources/System · high confidence
Introduce FilePath API with cross-platform path handling and syntactic operations
This change introduces the \FilePath\ type, providing a unified, cross-platform way to represent and manipulate file system paths. The API automatically normalizes separators (converting forward slashes to backslashes on Windows) and enforces invariants at construction. It includes syntactic operations such as accessing the path \root\, iterating over \components\, and checking if a path is absolute or relative. The implementation supports Windows-specific path forms (traditional DOS, UNC, and device paths) alongside standard Unix paths, and adds support for creating and managing temporary directories securely across platforms.
Sources/System/FilePath · high confidence
New IORing API for Linux with lifetimes support
This change introduces a new \IORing\ API for Linux, gated behind the \compiler(\>=6.2)\ and \$Lifetimes\ feature flags. It provides a structured interface for asynchronous I/O using the \io\_uring\ subsystem, including request types for file operations (open, read, write, close, unlink), cancellation, and polling. The implementation includes a \Completion\ struct to handle results and flags, a \PollEvents\ option set for monitoring file descriptor states, and internal utilities for interacting with the kernel ring buffers. This API is designed to work with Swift's ownership and lifetimes model, offering a modern, safe alternative to traditional POSIX I/O for supported platforms.
Sources/System/IORing · high confidence
New strongly-typed file system metadata types
Introduces new Swift types for file system metadata in the \Sources/System/FileSystem\ directory, including \Stat\ (a wrapper for the C \stat\ struct), \FileFlags\ (for file-specific flags on Darwin, FreeBSD, and OpenBSD), \FileMode\ (for C \mode\_t\), \FileType\ (for file type bits), and identifiers like \UserID\, \GroupID\, \DeviceID\, and \Inode\. These types provide a strongly-typed, safe API for accessing file system information, available from System 1.7.0 on Unix-like platforms.
Sources/System/FileSystem · high confidence
Behavioural changes
CSystem ported to static library with POSIX shim implementations
The CSystem module is now built as a static library via CMake, ensuring the C shim source (shims.c) is compiled and headers are installed for system use. This change introduces C wrappers for the POSIX \pipe2\ and \dup3\ APIs, providing native support on Linux, FreeBSD, and macOS (27+), while returning \ENOSYS\ on platforms lacking these functions. It also adds platform-specific header includes for Windows, WASI, and Darwin to support cross-platform system calls.
Sources/CSystem · high confidence
Internal refactoring for cross-platform compatibility and testing
The internal implementation layer has been reorganized to improve cross-platform support and testability. A new CInterop module centralizes platform-specific type definitions (such as mode\_t and character encodings) and provides a back-deployed stat() wrapper for migration compatibility. Platform-specific logic for errno, syscalls, and string handling is now consolidated in dedicated internal files (Constants, Exports, Syscalls), with specific fixes for Android nullability and Windows file operations. Additionally, a new MockingDriver subsystem has been added to enable syscall tracing and error injection during testing.
Sources/System/Internals · high confidence
Test coverage
Added compile-only test to detect MemberImportVisibility regressions; Added comprehensive test coverage for FilePath parsing, components, and decoding; Expanded test coverage for Swift System core APIs.
Dependencies
40 commits updating dependencies (2 manifests)
A dependency / build maintenance change in (dependencies) — 40 commits (8 fixs), 2 files.
(dependencies) · medium confidence · unverified
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Score
- CAI 63 → 61 (-1.6)
- Rubric changed (rubric-2026.10.5 → rubric-2026.11.4) — scores are not directly comparable.
Lenses
- Code Health 91 → 89 (-1.9)
- Architecture 97 → 97 (+0.0)
- Maturity 57 → 57 (+0.1)
- Readiness 55 → 49 (-5.7)
- Security 85 → 85 (+0.0)
Resolved (8)
- Change coupling: CInterop.swift ↔ Constants.swift (Sources/System/Internals/CInterop.swift)
- Hotspot: Sources/System/IORing/IORequest.swift (Sources/System/IORing/IORequest.swift)
- Off-boarding risk: anonymized user #1
- Orphaned file (Sources/System/FilePath/FilePathComponentView.swift)
- TodoComment (Tests/SystemTests/ErrnoTest.swift)
- TodoComment (Tests/SystemTests/ErrnoTest.swift)
- TodoComment (Tests/SystemTests/FilePathTests/FilePathComponentsTest.swift)
- TodoComment (Tests/SystemTests/FilePathTests/FilePathComponentsTest.swift)
New (34)
- Dependency hygiene PARTLY measured — SwiftPM pinning read, dependency currency NOT established
- Duplicated block (11 lines × 2) (Sources/System/FileSystem/MountFlags.swift)
- Duplicated block (6 lines × 3) (Sources/System/FileSystem/MountFlags.swift)
- Duplicated block (7 lines × 3) (Sources/System/FileSystem/MountFlags.swift)
- Duplicated block (8 lines × 2) (Sources/System/FileSystem/MountFlags.swift)
- Edited copies of one member (3 members, 12+ corresponding lines) (Sources/System/FilePath/FilePathString.swift)
- Edited copies of one member (3 members, 14+ corresponding lines) (Sources/System/FileSystem/Stat.swift)
- Edited copies of one member (3 members, 15+ corresponding lines) (Sources/System/FilePath/FilePathString.swift)
- Edited copies of one member (3 members, 8+ corresponding lines) (Sources/System/IORing/IORequest.swift)
- Edited copies of one member (3 members, 8+ corresponding lines) (Sources/System/IORing/IORequest.swift)
- Edited copy of a member (10 corresponding lines) (Sources/System/FilePath/FilePathString.swift)
- Edited copy of a member (12 corresponding lines) (Sources/System/FileOperations.swift)
- Edited copy of a member (12 corresponding lines) (Sources/System/FilePath/FilePath.swift)
- Edited copy of a member (12 corresponding lines) (Sources/System/FileSystem/Stat.swift)
- Edited copy of a member (13 corresponding lines) (Sources/System/FileOperations.swift)
- Edited copy of a member (13 corresponding lines) (Sources/System/IORing/IORing+Util.swift)
- Edited copy of a member (14 corresponding lines) (Sources/System/IORing/IORequest.swift)
- Edited copy of a member (14 corresponding lines) (Sources/System/IORing/IORequest.swift)
- Edited copy of a member (15 corresponding lines) (Sources/System/FilePath/FilePathWindows.swift)
- Edited copy of a member (15 corresponding lines) (Sources/System/IORing/IORequest.swift)
- …and 14 more
Changes since last survey
- 22 commits — 19 feature/other, 3 fixes
By area
- (repo) — 11 commits
- Sources/System — 4 commits
- Tests/SystemTests — 3 commits
- (root) — 1 commit
- .github/workflows — 1 commit
- Proposals/0009-system-statfs.md — 1 commit
- Sources/CSystem — 1 commit
Notable commits
- fix: Fix Windows test build with typed WinSDK constants
- fix: Merge pull request #421 from 100lalitahegde-eng/fix-156-thread-safe-strerror
- fix: fix(FilePath.ComponentView): prevent trailing separator when replacing suffix
- change: Clarify we'll use the modern @export(implementation) spelling once possible
- change: Copy strerror message directly into the String buffer
- change: Implement FilePathComponentsTest’s testRRC()
- change: Merge pull request #361 from jrflat/statfs-implementation
- change: Merge pull request #362 from jrflat/statfs-proposal
- change: Merge pull request #409 from finagolfin/ci
- change: Merge pull request #413 from apple/require-swift-6.2
- change: Merge pull request #414 from jrflat/statfs-availability
- change: Merge pull request #415 from jrflat/automerger-1.9.x
- change: Merge pull request #418 from apple/automerge/merge-main-2026-11-05_09-07
- change: Merge pull request #419 from jrflat/windows-test-typed-winsdk-constants
- change: Merge pull request #420 from apple/automerge/merge-main-2026-11-11_09-06
- change: Merge pull request #422 from apple/automerge/merge-main-2026-11-13_09-06
- change: Remove trapping operations from test
- change: Report truncated strerror messages as ERANGE on every platform
- change: Require Swift 6.2
- change: Update StatFS availability to 1.9.0
- …and 2 more
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
apple/swift-system was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 15 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit abc83c2de129497cd53c44c05ad64b56a868922d — the exact code this score is about.
- Scored under rubric-2026.11.4 — the same rubric and the same method as every other entry in this index.
- Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.65+preprod-3c33c1882dc1.