diff --git a/Sources/System/FileOperations.swift b/Sources/System/FileOperations.swift index a8b107cd..055daeea 100644 --- a/Sources/System/FileOperations.swift +++ b/Sources/System/FileOperations.swift @@ -401,7 +401,6 @@ extension FileDescriptor { } #endif -#if !os(Windows) /*System 1.2.0, @available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)*/ extension FileDescriptor { /// Truncate or extend the file referenced by this file descriptor. @@ -447,4 +446,3 @@ extension FileDescriptor { } } } -#endif diff --git a/Sources/System/Internals/WindowsSyscallAdapters.swift b/Sources/System/Internals/WindowsSyscallAdapters.swift index 36acaceb..13f42c96 100644 --- a/Sources/System/Internals/WindowsSyscallAdapters.swift +++ b/Sources/System/Internals/WindowsSyscallAdapters.swift @@ -105,4 +105,11 @@ internal func pwrite( return Int(nNumberOfBytesWritten) } +@inline(__always) +internal func ftruncate( + _ fd: Int32, + _ length: off_t +) -> Int32 { + _chsize_s(fd, numericCast(length)) +} #endif