@@ -23,6 +23,7 @@ extension FileDescriptor {
2323 /// - Returns: A file descriptor for the open file
2424 ///
2525 /// The corresponding C function is `open`.
26+ @available ( System 0 . 0 . 1 , * )
2627 @_alwaysEmitIntoClient
2728 public static func open(
2829 _ path: FilePath ,
@@ -62,6 +63,7 @@ extension FileDescriptor {
6263 /// - Returns: A file descriptor for the open file
6364 ///
6465 /// The corresponding C function is `open`.
66+ @available ( System 0 . 0 . 1 , * )
6567 @_alwaysEmitIntoClient
6668 public static func open(
6769 _ path: UnsafePointer < CChar > ,
@@ -75,6 +77,7 @@ extension FileDescriptor {
7577 ) . get ( )
7678 }
7779
80+ @available ( System 0 . 0 . 1 , * )
7881 @usableFromInline
7982 internal static func _open(
8083 _ path: UnsafePointer < CChar > ,
@@ -148,6 +151,7 @@ extension FileDescriptor {
148151 /// the object will be deactivated.
149152 ///
150153 /// The corresponding C function is `close`.
154+ @available ( System 0 . 0 . 1 , * )
151155 @_alwaysEmitIntoClient
152156 public func close( ) throws { try _close ( ) . get ( ) }
153157
@@ -165,6 +169,7 @@ extension FileDescriptor {
165169 /// in bytes from the beginning of the file.
166170 ///
167171 /// The corresponding C function is `lseek`.
172+ @available ( System 0 . 0 . 1 , * )
168173 @_alwaysEmitIntoClient
169174 @discardableResult
170175 public func seek(
@@ -173,6 +178,7 @@ extension FileDescriptor {
173178 try _seek ( offset: offset, from: whence) . get ( )
174179 }
175180
181+ @available ( System 0 . 0 . 1 , * )
176182 @usableFromInline
177183 internal func _seek(
178184 offset: Int64 , from whence: FileDescriptor . SeekOrigin
@@ -210,6 +216,7 @@ extension FileDescriptor {
210216 /// call the ``seek(offset:from:)`` method.
211217 ///
212218 /// The corresponding C function is `read`.
219+ @available ( System 0 . 0 . 1 , * )
213220 @_alwaysEmitIntoClient
214221 public func read(
215222 into buffer: UnsafeMutableRawBufferPointer ,
@@ -218,6 +225,7 @@ extension FileDescriptor {
218225 try _read ( into: buffer, retryOnInterrupt: retryOnInterrupt) . get ( )
219226 }
220227
228+ @available ( System 0 . 0 . 1 , * )
221229 @usableFromInline
222230 internal func _read(
223231 into buffer: UnsafeMutableRawBufferPointer ,
@@ -246,6 +254,7 @@ extension FileDescriptor {
246254 /// this method leaves the file's existing offset unchanged.
247255 ///
248256 /// The corresponding C function is `pread`.
257+ @available ( System 0 . 0 . 1 , * )
249258 @_alwaysEmitIntoClient
250259 public func read(
251260 fromAbsoluteOffset offset: Int64 ,
@@ -259,6 +268,7 @@ extension FileDescriptor {
259268 ) . get ( )
260269 }
261270
271+ @available ( System 0 . 0 . 1 , * )
262272 @usableFromInline
263273 internal func _read(
264274 fromAbsoluteOffset offset: Int64 ,
@@ -299,6 +309,7 @@ extension FileDescriptor {
299309 /// call the ``seek(offset:from:)`` method.
300310 ///
301311 /// The corresponding C function is `write`.
312+ @available ( System 0 . 0 . 1 , * )
302313 @_alwaysEmitIntoClient
303314 public func write(
304315 _ buffer: UnsafeRawBufferPointer ,
@@ -307,6 +318,7 @@ extension FileDescriptor {
307318 try _write ( buffer, retryOnInterrupt: retryOnInterrupt) . get ( )
308319 }
309320
321+ @available ( System 0 . 0 . 1 , * )
310322 @usableFromInline
311323 internal func _write(
312324 _ buffer: UnsafeRawBufferPointer ,
@@ -332,6 +344,7 @@ extension FileDescriptor {
332344 /// this method leaves the file's existing offset unchanged.
333345 ///
334346 /// The corresponding C function is `pwrite`.
347+ @available ( System 0 . 0 . 1 , * )
335348 @_alwaysEmitIntoClient
336349 public func write(
337350 toAbsoluteOffset offset: Int64 ,
@@ -341,6 +354,7 @@ extension FileDescriptor {
341354 try _write ( toAbsoluteOffset: offset, buffer, retryOnInterrupt: retryOnInterrupt) . get ( )
342355 }
343356
357+ @available ( System 0 . 0 . 1 , * )
344358 @usableFromInline
345359 internal func _write(
346360 toAbsoluteOffset offset: Int64 ,
@@ -366,6 +380,7 @@ extension FileDescriptor {
366380 retryOnInterrupt: retryOnInterrupt)
367381 }
368382
383+ #if compiler(>=6.2)
369384 /// Writes the contents of a buffer at the current file offset.
370385 ///
371386 /// - Parameters:
@@ -382,7 +397,7 @@ extension FileDescriptor {
382397 /// call the ``seek(offset:from:)`` method.
383398 ///
384399 /// The corresponding C function is `write`.
385- @available ( macOS 15 , iOS 18 , watchOS 11 , tvOS 18 , visionOS 2 , * )
400+ @available ( SystemWithSpan 0 . 0 . 1 , * )
386401 @_alwaysEmitIntoClient
387402 public func write(
388403 _ data: RawSpan ,
@@ -408,7 +423,7 @@ extension FileDescriptor {
408423 /// this method leaves the file's existing offset unchanged.
409424 ///
410425 /// The corresponding C function is `pwrite`.
411- @available ( macOS 15 , iOS 18 , watchOS 11 , tvOS 18 , visionOS 2 , * )
426+ @available ( SystemWithSpan 0 . 0 . 1 , * )
412427 @_alwaysEmitIntoClient
413428 public func write(
414429 toAbsoluteOffset offset: Int64 ,
@@ -420,7 +435,7 @@ extension FileDescriptor {
420435 }
421436 }
422437
423- @available ( macOS 15 , iOS 18 , watchOS 11 , tvOS 18 , visionOS 2 , * )
438+ @available ( SystemWithSpan 0 . 0 . 1 , * )
424439 @_alwaysEmitIntoClient
425440 internal func _readIntoOutputBuffer(
426441 _ buffer: UnsafeMutableRawBufferPointer ,
@@ -459,7 +474,7 @@ extension FileDescriptor {
459474 /// call the ``seek(offset:from:)`` method.
460475 ///
461476 /// The corresponding C function is `read`.
462- @available ( macOS 15 , iOS 18 , watchOS 11 , tvOS 18 , visionOS 2 , * )
477+ @available ( SystemWithSpan 0 . 0 . 1 , * )
463478 @_alwaysEmitIntoClient
464479 public func read(
465480 into buffer: inout OutputRawSpan ,
@@ -485,7 +500,7 @@ extension FileDescriptor {
485500 /// this method leaves the file's existing offset unchanged.
486501 ///
487502 /// The corresponding C function is `pread`.
488- @available ( macOS 15 , iOS 18 , watchOS 11 , tvOS 18 , visionOS 2 , * )
503+ @available ( SystemWithSpan 0 . 0 . 1 , * )
489504 @_alwaysEmitIntoClient
490505 public func read(
491506 fromAbsoluteOffset offset: Int64 ,
@@ -509,6 +524,7 @@ extension FileDescriptor {
509524 fatalError ( " Unexpected error type " )
510525 }
511526 }
527+ #endif // compiler(>=6.2)
512528}
513529
514530#if !os(WASI)
0 commit comments