461 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
Joe Heck 1da023b4ca Point setUserID and setGroupID docs at the chmod(2) man page
The docs for FilePermissions.setUserID and setGroupID referred to the setuid(2) and setgid(2) man pages. Those pages describe system calls that change a process's IDs. The permission bits are documented in chmod(2) as S_ISUID and S_ISGID. This matches how saveText already refers to S_ISVTX.
2026-11-13 15:46:58 -08:00
Lalita Hegade 1c44ed678c Copy strerror message directly into the String buffer
Use String(unsafeUninitializedCapacity:initializingUTF8With:), through
the existing backwards-compatible helper, so the message is written
straight into the string's storage instead of a stack buffer that is
then copied. Also update the copyright year range of Errno.swift.

musl's message for an unknown error number doesn't include the number,
so skip that check when building against Musl, as on WASI.
2026-11-12 08:13:35 +01:00
Lalita Hegade 6c5077b2d2 Report truncated strerror messages as ERANGE on every platform
strerror_s on Windows and bionic's strerror_r truncate without
returning an error, so detect a full buffer in the shim instead.
Also avoid the deprecated String(cString:) array overload in the test.
2026-11-11 22:12:05 +01:00
Lalita Hegade 013178c00e Use a thread-safe strerror in Errno.description
strerror(3) isn't guaranteed to be thread-safe: for an unknown error
number, it may format the message into a static buffer shared by all
threads, so concurrent calls to Errno.description could return each
other's text.

Add a csystem_strerror_r shim to CSystem that writes into a
caller-provided buffer. It hides the difference between the XSI
strerror_r (Darwin, BSDs, musl, WASI) and the GNU variant that glibc
and bionic provide under _GNU_SOURCE, and uses strerror_s on Windows.
Errno.description now formats into a stack buffer through this shim.

Also add tests for Errno.description, which were a TODO.

Fixes #156
2026-11-11 17:46:01 +01:00
Ugur Toprakdeviren 77882a1fc8 fix(FilePath.ComponentView): prevent trailing separator when replacing suffix 2026-11-04 15:21:12 -08:00
Jonathan Flat 443e03c16f Update StatFS availability to 1.9.0 2026-11-04 14:25:26 -07:00
Jonathan Flat 90a005db2f Merge pull request #361 from jrflat/statfs-implementation
[Implementation] StatFS and supporting types
2026-11-04 12:54:26 -07:00
Jonathan Flat b1f3496e31 Move table to doc comment, other comment updates 2026-10-21 13:49:53 -06:00
Jonathan Flat 15479b53b9 Merge branch 'main' into statfs-implementation 2026-10-21 13:07:09 -06:00
RKS 688716f8a2 Merge remote-tracking branch 'upstream/main' into codex/system402-refresh-20261020 2026-10-20 21:42:47 -04:00
Jonathan Flat feb66db229 Merge remote-tracking branch 'origin/main' into automerge/merge-main-2026-10-17_09-08 2026-10-17 13:38:14 -06:00
RKS a51425f6d8 Disfavor deprecated mutable write overloads 2026-10-16 22:42:35 -04:00
Jonathan Flat 4179b2cce5 Remove CSystemFreeBSD.h, too 2026-10-12 19:39:54 -06:00
Jonathan Flat f5fe750a57 Improve CSystem import handling 2026-10-12 19:39:51 -06:00
Jonathan Flat 9bf5df3d10 v4: Add FileSystemTypeName wrapper 2026-10-12 16:59:19 -06:00
Jonathan Flat d27cb52754 v3: Rename MountFlags constants for consistency, remove type on Darwin and FreeBSD, and remove the statfs() methods on FilePath and FileDescriptor, eliminating the need for CInterop back-deployment 2026-10-12 16:58:24 -06:00
RKS 92481cc056 [IO_URING] Document immutable write requests 2026-10-06 12:39:41 -04:00
RKS f0d63f4282 Merge remote-tracking branch 'origin/main' into codex/system-400-immutable-writes 2026-10-06 12:38:53 -04:00
Franz Busch 95ed6aa2a4 Address review comments 2026-10-06 10:21:52 +02:00
RKS 0eab740450 [IO_URING] Accept immutable buffers for unregistered writes 2026-10-05 22:39:32 -04:00
Franz Busch cbf57d4575 [IO_URING] Keep the completion of failed IORing operations
When an operation failed, the blocking consume methods dropped its completion and only reported the `Errno`. The caller could not tell which request failed, since the `context` was lost. This breaks any user that matches completions to requests.

This PR makes `blockingConsumeCompletions` pass the completion of a failed operation together with its error. Errors of the ring itself, such as `.timeout`, are still passed without a completion. Additionally, `blockingConsumeCompletion(timeout:)` now returns the completion of a failed operation instead of throwing. It only throws errors of the ring itself.

I also added `Completion.error`, which is `nil` on success and the decoded `Errno` otherwise to make it easy to get to the error of a completion.

Fixes #364
Fixes #395
2026-10-05 20:59:39 +02:00
Jonathan Flat cf36a2fe7b v2: Use statfs on Linux and Android, make StatFS unavailable on WASI, omit Linux flags the kernel never reports, add descriptions for MountFlags and FileSystemID, and back-deploy CInterop.StatFS with CInterop.statfs(_:_:) for migration 2026-10-01 10:30:50 -06:00
Jonathan Flat 74a7b6f618 Fix missing done in IORing.blockingConsumeCompletions 2026-09-30 15:59:05 -06:00
Jonathan Flat 9a9b78e4e9 Include statvfs.h in CSystemWASI 2026-09-30 15:30:38 -06:00
Jonathan Flat 292eb44442 Add missing CSystem import on Android 2026-09-30 15:30:38 -06:00
Jonathan Flat b2237390d8 Define ST_NOSYMFOLLOW for older Linux versions 2026-09-30 15:30:37 -06:00
Jonathan Flat 671a219316 StatFS implementation 2026-09-30 15:30:36 -06:00
Guillaume Lessard e6796eb47d Merge branch 'release/1.8.x' into main 2026-09-25 15:03:14 -07:00
Franz Busch b62bce1bc4 Merge pull request #273 from apple/fb-io-uring-poll-add
[IO_URING] Add support for `pollAdd` operation
2026-09-25 10:52:31 +02:00
Jonathan Flat 6843adad5a Add missing @inlinable 2026-09-24 19:38:24 -06:00
Jonathan Flat 4699556133 Add unavailable/renamed hints for C names 2026-09-24 19:37:41 -06:00
Jonathan Flat 1c80f27aef Remove PollEvents.allEvents and use internal Event enum for testing 2026-09-24 19:37:41 -06:00
Jonathan Flat 59b5659a1e Make internal isMultiShot default match public API 2026-09-24 19:37:38 -06:00
Jonathan Flat dc65a924d9 Doc comment updates 2026-09-24 19:36:21 -06:00
Franz Busch 3b8124e350 Smaller touch ups 2026-09-22 10:18:47 +02:00
Franz Busch 241fedcbbd Address review feedback 2026-09-22 10:07:05 +02:00
Aryan Singh K.andGuillaume Lessard 869129b7bf fix(MachPort): silence concurrency check for mach_task_self_ (#379)
Darwin.Mach's mach_task_self_ is a shared global; Swift 6.3
reports it as not concurrency-safe when imported. Use a
preconcurrency import for older Darwin SDKs.

Fixes #373

Co-authored-by: Guillaume Lessard <guillaume.lessard@apple.com>
2026-08-13 12:54:10 -07:00
Aryan Singh K. 5c2854d7bd fix(wasi): use mock TLS for all non-threaded WASI targets (#378)
The gate os(WASI) && (swift(<6.1) || !_runtime) incorrectly falls
through to pthread APIs on Swift 6.1+ non-threaded WASI, where
pthread_* is not in scope. Guard solely on !_runtime.

Fixes #370
2026-08-12 11:08:01 -07:00
Guillaume Lessard 79b7490ae9 Hoist “import CSystem” above the platform-specific imports 2026-08-07 15:43:00 -07:00
Guillaume Lessard c5c1a835d6 Explicitly import CSystem for wasi 2026-08-07 15:42:10 -07:00
Guillaume Lessard 755a5b4b3d Merge pull request #367 from apple/dev/linux-import-issue
Prepare for Swift 6 language mode
2026-07-30 07:18:05 -07:00
Guillaume Lessard 6485260369 [Windows] use Atomic to protect the backing store of umask() 2026-07-29 19:41:17 -07:00
Guillaume Lessard d4e86324e9 Add availability macro support to CMake build
For now this heplfully silences warnings.
2026-07-29 19:41:17 -07:00
Guillaume Lessard 29b14a3025 Concurrency tweak for single-thread wasm 2026-07-29 19:41:17 -07: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 b9e0ecaa60 [linux] remove @_implementationOnly import qualifiers 2026-07-29 09:28:38 -07:00
Guillaume Lessard d4373e36f6 Clarify .pollNval and add test reading from an invalid descriptor 2026-07-28 16:46:33 -07:00
Guillaume Lessard 4df226b098 Fix copyright notices 2026-07-28 16:46:33 -07:00
Guillaume Lessard a2ca84e281 Round out PollEvents 2026-07-28 16:46:33 -07:00