`FileDescriptor.duplicate(as:retryOnInterrupt:)` writes its first
parameter entry as ``- `target`:`` rather than `- target:`. DocC matches
parameter documentation by the bare identifier, so the backticked entry
is not associated with the parameter: the description is dropped from
the rendered parameter list and DocC reports the parameter as
undocumented.
The `duplicate(as:options:retryOnInterrupt:)` overload twenty lines
below documents the same parameter without backticks, which is what
this changes the first overload to match.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MDv2d3fEYCVWGpu7AgD4qq
FileDescriptor.open traps when options contains .create but permissions
is nil. The previous precondition could elide its message in optimized
builds, leaving users to hunt through source to diagnose the crash.
Use fatalError with a descriptive message so the reason is always
present in the crash dump, and document the trapping behavior.
Fixes#78
This follows the existing pattern of wrapping dup/dup2 and pipe with FileDescriptor.duplicate and FileDescriptor.pipe, with additional overloads for passing the O_CLOEXEC and similar flags.
Broke `FilePathTemp.swift` into separate files for POSIX and
Windows.
Added tests for permissions code on Windows.
Added leading underscores to some function names.
Made some other functions `fileprivate`.
rdar://125087707
The swift-system tests were not passing, for various reasons, mostly
to do with path related confusion.
As part of this, add a function to create a temporary directory, as that
was one of the problems.
Also add Windows support for pipe() and ftruncate(), which was missing.
rdar://125087707
This brings the contents of this package up to date with versions of the ABI stable `System` module that shipped in recent iOS/macOS releases.
Most changes only touch internal implementation details, but some ABI-related fixes also affect the public API. There are no source-incompatible changes.
- ABI stability fixes (un-deprecate CModeT, don't use PlatformChar in inlinable contexts that need to deploy to iOS 14)
- New utilities: `_RawBuffer`, `Array<String>._withCStringArray`, `_withOptionalUnsafePointerOrNull`, `_withStackBuffer`, `system_memset`
- Prefer using explicit optionals to implicitly-unwrapped ones
- Add support for wildcard matching in mocking tests
- A bunch of new availability annotations. (I expect there will be more of these coming in future PRs.)
Availability annotations now follow a rigid syntax that mentions the swift-system version that introduced the entry point:
```
/*System 0.0.2, @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *)*/
public func greeting() -> String {
"Hello"
}
```
This is designed to be processed by automated source generation tools.
Scrap the separate module SystemInternals and instead have it be a
subdirectory. Adjust all access control accordingly. One day, when Swift gets
proper submodules or supermodules (i.e. resilience domains), we can reinstate
it. For now, a separate module makes binary distribution much more
complicated.
Add CInterop namespace and PlatformChar/PlatformEncoding typealiases for
narrow/wide characters.
Change Windows syscalls to use wide-character variants. Add full Windows root
parser to error-correct malformed roots and correctly normalize roots and
post-root portions of the path.
Add platformString APIs as replacements for cString APIs.
Add internal SystemString as backing storage type for FilePath.
Add Windows path mocking support.
This change includes API/ABI additions and deprecations.