Alastair Houghton
53471ce33b
[Windows] Fix a problem with opening files read only.
...
`_O_RDONLY` is zero, so we can't test for it by AND-ing.
2024-10-14 16:01:01 -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
cf7530848e
[Linux] Glibc's DIR doesn't get imported into Swift.
...
Swift ends up with OpaquePointer instead of a typed pointer.
rdar://125087707
2024-10-14 15:59:36 -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 and Karoy Lorentey
bcc7f6d569
Update Sources/System/FilePath/FilePathTemp.swift
...
Co-authored-by: Karoy Lorentey <klorentey@apple.com >
2024-10-14 15:59:36 -07:00
Alastair Houghton
e293300430
Map mode bits to Windows ACLs.
...
This adds support for mapping POSIX-style mode bits to Windows ACLs when
calling `open()` or `mkdir()`.
rdar://125087707
2024-10-14 15:59:36 -07:00
Alastair Houghton
4cafcc96f6
Changes after comments from Saleem.
...
Use idiomatic Swift notation, not `Optional<Bool>`.
Prefer Win32 APIs to UCRT APIs.
rdar://125087707
2024-10-14 15:59:36 -07:00
Alastair Houghton
85de4e51e2
Use the proper temporary directory on Darwin.
...
It seems we can get the temporary directory from confstr().
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
Karoy Lorentey
8564f96d1f
Merge branch 'release/1.3.0' into release/1.4.0
...
# Conflicts:
# .gitignore
# .swiftci/5_10_ubuntu2204
# .swiftci/5_8_ubuntu2204
# .swiftci/5_9_ubuntu2204
# .swiftci/nightly_6_0_macos
# .swiftci/nightly_6_0_ubuntu2204
# .swiftci/nightly_main_macos
# .swiftci/nightly_main_ubuntu2204
# .swiftci/nightly_main_windows
# Package.swift
# Sources/System/FilePath/FilePath.swift
# Sources/System/Internals/CInterop.swift
2024-09-19 16:50:34 -07:00
Stephen Canon
a1f77d0e1a
Cherry-pick: ensure invariants are enforced when decoding
...
Ensure that FilePath and SystemString's invariants are enforced when decoding.
Cherry-pick of merge-commit 9c42c54644
from PR #189
# Conflicts:
# Sources/System/FilePath/FilePath.swift
2024-07-23 11:26:26 -07:00
Guillaume Lessard
6a9e38e7bd
Merge pull request #185 from glessard/disfavoredOverload-1.3.0
...
[1.3.x] Disfavor String.init(platformString: UnsafePointer<CChar>)
2024-06-07 17:43:21 -07:00
Karoy Lorentey
b7dc8e8e41
[CMake] Restore to working order on Apple platforms
2024-05-15 14:30:14 -07:00
Guillaume Lessard
7b14e48d0d
Remove the repeated list of Darwin-based platforms
...
Replaced with a constant defined in the package manifest.
2024-05-10 16:09:22 -07:00
Guillaume Lessard and Finagolfin
9620c1d30e
Cherry-pick changes from PR148
...
Co-authored-by: Finagolfin <finagolfin@tuta.io >
2024-05-09 22:24:04 -07:00
Guillaume Lessard and Max Desiatov
c3a7235bf7
Cherry-pick changes from PR133
...
Co-authored-by: Max Desiatov <m_desiatov@apple.com >
2024-05-09 19:10:58 -07:00
Guillaume Lessard
e5a56da50e
Cherry-pick changes from PR154
2024-05-09 16:03:48 -07:00
Karoy Lorentey
73baf1113d
Retarget pending changes to 1.4.0
...
We decided to spend the 1.3.0 version number on a small interim release; retarget the currently pending changes to 1.4.0.
2024-05-09 14:31:11 -07:00
Jeremy Schonfeld
dd45c80062
Disfavor String.init(platformString: UnsafePointer<CChar>)
2024-05-02 13:25:04 -07:00
Guillaume Lessard
dae787c199
Merge pull request #148 from finagolfin/droid
...
Android: update pread/pwrite for nullability annotations in NDK 26
2024-03-19 18:23:38 -07:00
Guillaume Lessard
5ca37e7d39
Android: more targeted approach to unusual nullabilities
2024-03-11 09:10:11 -07:00
Guillaume Lessard
403776dc2a
Merge pull request #152 from noahpistilli/visionPro
...
Add support for visionOS
2024-03-08 14:54:35 -08:00
Sketch
f59a0b73ce
Add support for visionOS
2024-03-08 10:39:54 -05:00
Guillaume Lessard
adca1f70b1
Fix SystemString.withCSIA()
...
- The original implementation simply forwarded to the underlying `nullTerminatedStorage`, which contains one element – a null terminator – more than the actual `String`.
- This isn’t in keeping with the sperit of `withContiguousStorageIfAvailable()`, which should present exactly the elements of the collection.
2024-03-07 15:15:56 -08:00
Guillaume Lessard
c2e8f24c7c
avoid passing null pointer to pread() or pwrite()
2024-01-04 17:53:38 -08:00
Finagolfin
5c3617b9e9
Android: update pread/pwrite for nullability annotations in NDK 26
2023-11-24 19:01:31 +05:30
Guillaume Lessard
882466a730
apply missing availability attributes to Mach.Port
2023-10-13 18:55:23 -07:00
Guillaume Lessard
b92be8a02a
Update availability declarations for swift-system 1.1.0 API
2023-10-13 10:21:57 -07:00
Guillaume Lessard
495f729347
[noncopyability] explicitly prevent a capture
...
This may be needed because of a bug involving resilient structs.
2023-10-12 15:01:08 -07:00
Guillaume Lessard
7654f14f8c
[gardening] add some more availability annotations
2023-10-11 14:28:43 -07:00
Guillaume Lessard
0e060b7a7a
Merge pull request #144 from kateinoigakukun/katei/fix-rename-typo
...
Fix typos in renaming message for `Errno`
2023-09-07 15:21:20 -07:00
Yuta Saito
1ccaee141c
Fix typos in renaming message for Errno
2023-09-05 11:36:08 -07:00
Guillaume Lessard
8a8552f617
Merge pull request #129 from glessard/reenable-mach-port
...
Re-enable Mach.Port
2023-08-16 16:04:53 -07:00
Guillaume Lessard
87e68fca36
declare Sendable conformances along with the types
...
- `Sendable` is fundamental, it is preferably not declared as an extension.
2023-08-16 11:19:06 -07:00
Guillaume Lessard
f32faad415
remove code depending on Swift older than 5.6
2023-08-16 11:02:51 -07:00
Guillaume Lessard
8730f2cf25
[gardening] 80-column enforcement
2023-08-15 09:34:05 -07:00
Guillaume Lessard
65693b8b80
improve memory rebinding for mach_port_get_attributes call
2023-08-15 09:11:46 -07:00
Guillaume Lessard
6189c1f553
fix copySendRight() for send rights that become dead names
2023-08-11 14:09:44 -07:00
Guillaume Lessard
e4d06ae3ea
simplify deinit
2023-08-10 15:35:27 -07:00
Guillaume Lessard
d259ef476e
test two-parameter withBorrowedName
2023-08-10 15:35:27 -07:00
Guillaume Lessard
5e03246e4e
test copies of dead mach port names
2023-08-10 15:32:19 -07:00
Guillaume Lessard
40b5b3068b
test all the relinquish() methods
2023-08-10 15:32:19 -07:00
Guillaume Lessard
e8bb779909
use inout conversion
...
- this is the situation where it is appropriate
2023-08-10 15:32:19 -07:00
Guillaume Lessard
6ee96ffdb5
modify consuming methods to call discard self
2023-08-09 15:58:56 -07:00
Guillaume Lessard
9123120c08
destroy Send rights with mach_port_deallocate
2023-08-09 15:58:56 -07:00
Daniel Loffgren
2df5b0b031
srdelta argument to mach_port_destruct should be zero
...
This should never have been -1, as there is no send right for
it to balance when `RightType.self == ReceiveRight.self`.
2023-08-09 15:58:56 -07:00
Guillaume Lessard
af4544c869
Re-enable Mach.Port
2023-08-09 15:58:56 -07:00
Max Desiatov
0062c82c90
Add support for Musl libc ( #133 )
...
Since Musl is sufficiently different from Glibc (see https://wiki.musl-libc.org/functional-differences-from-glibc.html ), it requires a different import, which now should be applied to files that have `import Glibc` in them.
2023-07-04 16:50:13 +01:00
Guillaume Lessard
adbf8d2856
Add availability attributes to Sendable conformances
2023-06-21 14:50:47 -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