43 Commits
Author SHA1 Message Date
hxperlandClaude Opus 5 e96ba28879 Unbacktick the target parameter name so DocC recognises it
`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
2026-11-18 16:03:46 -08:00
Guillaume Lessard 6a63f086f6 Merge branch 'release/1.7.0' into main
# Conflicts:
#	Tests/SystemTests/FileOperationsTest.swift
2026-07-29 18:12:22 -07:00
Guillaume Lessard 353a48d98d Correct a doc-comment 2026-07-27 12:43:15 -07:00
Guillaume Lessard cd18a372c0 Implement dup3/pipe2 wrappers and types for Darwin 2026-07-22 11:10:19 -07:00
Guillaume Lessard 0d9e29baa0 Fix some doc-comments 2026-07-22 11:01:56 -07:00
Guillaume Lessard a9597cc068 Merge branch 'release/1.7.0' into main 2026-07-21 10:25:33 -07:00
Guillaume Lessard 7edc09a749 Remove an accidental throw annotation 2026-07-13 10:56:05 -07:00
Aditya Singh 671bd1a573 Replace precondition with fatalError for missing permissions on .create (#307)
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
2026-06-12 17:12:22 -07:00
Guillaume Lessard d937d15735 Add clarifications to the doc-comments of the new overloads. 2026-06-11 13:22:29 -07:00
Guillaume Lessard e59002fa14 Add option-taking pipe() implementation for Windows 2026-06-09 16:27:18 -07:00
Guillaume Lessard 491b97c7c0 Complete implementation of SYS-0007 2026-05-20 10:01:11 -07:00
Guillaume Lessard 814d09c7ea Improve doc-comments 2026-05-20 09:58:46 -07:00
Guillaume Lessard 61280ab365 Fix declaration inconsistencies 2026-05-20 09:58:46 -07:00
Jake Petroules 348b497836 Add overloads to cover dup3 and pipe2 POSIX APIs
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.
2026-05-20 09:58:46 -07:00
Rauhul Varma 9a1530813e Replace bespoke availability system
Removes the script based availability system with the experimental
availability macro feature.
2025-07-30 08:40:08 -07:00
Jonathan Flat 8de80270cb Fix WASI build (dirent, umask, errno and open flag tests) 2025-07-25 14:03:59 -06:00
Guillaume Lessard b9e4d2b2ba Remove more accidentally public functions 2024-10-16 17:03:59 -07:00
Alastair Houghton f1d7eb52c6 Remove accidentally public functions.
These can't be new API as they haven't been reviewed.
2024-10-14 16:01:01 -07:00
Alastair Houghton 5ae5d5a3af Refactor FilePathTemp, add tests for permission code.
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
2024-10-14 15:59:36 -07:00
Alastair Houghton d4e2b09c37 Fix swift-system to work on Windows.
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
2024-10-14 15:59:36 -07:00
Guillaume Lessard b92be8a02a Update availability declarations for swift-system 1.1.0 API 2023-10-13 10:21:57 -07:00
Alex Martini 1d1bef36c9 Fix abstracts to follow reference style.
- Use a present tense verb phrase
- Avoid repeating the symbol's name
2023-06-21 10:26:04 -07:00
Karoy Lorentey bb6ab43e44 Update availability declarations 2023-03-01 18:10:40 -08:00
Karoy Lorentey cc96d40bee Merge pull request #76 from apple/lorentey/post-back-ios15-system
Update package with changes from recent ABI stable releases
2023-02-28 16:13:44 -08:00
Alex Martini 015e9baf40 Fix a broken link. (#107) 2022-08-23 07:21:09 -06:00
Karoy Lorentey e9886bf251 Merge branch 'main' into lorentey/post-back-ios15-system
# Conflicts:
#	Sources/System/FilePath/FilePathString.swift
2022-06-13 16:45:25 -07:00
Karoy Lorentey f5e4aac51b Revert "FileOperations: Add Windows implementation for FileDescriptor.resize(to:) (#89)"
This reverts commit 94fa6bd2ff.
2022-06-11 12:54:19 -07:00
Si Beaumont 94fa6bd2ff FileOperations: Add Windows implementation for FileDescriptor.resize(to:) (#89)
* FileOperations: Add Windows implementation for FileDescriptor.resize(to:)

Replace _chsize with _chsize_s on Windows
2022-06-09 09:51:28 -06:00
Alex Martini 6db5a4a43b Fix broken links.
Fixes rdar://79096457
2022-06-03 15:23:53 -07:00
Guillaume Lessard 914c782b96 Replace assumingMemoryBound with temporary rebinding
- this doesn’t use the new memory binding API.
2022-05-27 18:09:45 -06:00
Karoy Lorentey 147ebc053a Unbreak the Windows port 2022-05-21 12:43:59 -07:00
Si Beaumont 02daf4b6a7 fixup: Move FileDescriptor.resize to extension with #if !os(Windows) 2022-05-06 11:55:00 +01:00
Si Beaumont 5d3519dcef FileOperations: Add FileDescriptor.resize, using ftruncate(2)
Signed-off-by: Si Beaumont <beaumont@apple.com>
2022-05-05 08:24:48 +01:00
Karoy Lorentey ca700460b1 Fix compatibility with Swift 5.3.3 2021-12-26 22:00:07 -08:00
Karoy Lorentey 81d78be499 Fix Windows build 2021-12-26 21:53:28 -08:00
Karoy Lorentey c0e8ef346b Update package with changes from recent ABI stable releases
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.)
2021-12-21 17:50:21 -08:00
Karoy Lorentey 1daa0c9677 Unify availability annotations and synchronize them with macOS 12 / iOS 15
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.
2021-12-20 17:10:59 -08:00
George Lyon 689390f50f Implement FileDescriptor.Pipe() (#58)
Adds support for pipe(2)
2021-09-27 16:02:52 -06:00
Michael Ilseman 090d109c0f Make retryOnInterrupt always explicit internally 2021-03-22 15:58:10 -06:00
Michael Ilseman d7611ca8ad Internalize SystemInternals
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.
2021-02-25 21:14:46 -07:00
Karoy Lorentey 2d24a58a41 Add support for dup/dup2 2021-02-24 13:30:07 -08:00
Michael Ilseman 920ef3085d Add PlatformString and Windows support
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.
2021-02-01 08:20:05 -07:00
Michael Ilseman 8ffa04c0a0 Initial version of Swift System 2020-09-25 08:20:58 -07:00