Add availability to new CInterop typealiases

This commit is contained in:
Jonathan Flat committed 2025-11-02 22:31:37 -07:00
1 parent 87f8e49ba7
commit 55350cd06d
3 files changed
+11 -5

No files matched your search

@@ -39,10 +39,6 @@
// |------------------|---------------|---------------|---------------|
#if SYSTEM_PACKAGE_DARWIN || os(FreeBSD) || os(OpenBSD)
@available(System 99, *)
extension CInterop {
public typealias FileFlags = UInt32
}
/// File-specific flags found in the `st_flags` property of a `stat` struct
/// or used as input to `chflags()`.
+7 -1
View File
@@ -78,12 +78,18 @@ public enum CInterop {
/// on API.
public typealias PlatformUnicodeEncoding = UTF8
#endif
}
#if !os(Windows)
#if !os(Windows)
@available(System 99, *)
extension CInterop {
public typealias Stat = stat
public typealias DeviceID = dev_t
public typealias Inode = ino_t
public typealias UserID = uid_t
public typealias GroupID = gid_t
#if SYSTEM_PACKAGE_DARWIN || os(FreeBSD) || os(OpenBSD)
public typealias FileFlags = UInt32
#endif
}
#endif
+4
View File
@@ -91,15 +91,19 @@ internal func system_strlen(_ s: UnsafeMutablePointer<CChar>) -> Int {
}
#if !os(Windows)
@available(System 99, *)
internal func system_stat(_ p: UnsafePointer<CChar>, _ s: inout CInterop.Stat) -> Int32 {
stat(p, &s)
}
@available(System 99, *)
internal func system_lstat(_ p: UnsafePointer<CChar>, _ s: inout CInterop.Stat) -> Int32 {
lstat(p, &s)
}
@available(System 99, *)
internal func system_fstat(_ fd: CInt, _ s: inout CInterop.Stat) -> Int32 {
fstat(fd, &s)
}
@available(System 99, *)
internal func system_fstatat(_ fd: CInt, _ p: UnsafePointer<CChar>, _ s: inout CInterop.Stat, _ flags: CInt) -> Int32 {
fstatat(fd, p, &s, flags)
}