mirror of
https://github.com/apple/swift-system
synced 2026-11-28 05:14:33 +00:00
Remove commented-out code for future directions
This commit is contained in:
3 files changed
-99
No files matched your search
@@ -62,28 +62,6 @@ public struct DeviceID: RawRepresentable, Sendable, Hashable, Codable {
|
||||
/// Creates a strongly-typed `DeviceID` from the raw C value.
|
||||
@_alwaysEmitIntoClient
|
||||
public init(_ rawValue: CInterop.DeviceID) { self.rawValue = rawValue }
|
||||
|
||||
// TODO: API review for ID wrapper functionality
|
||||
|
||||
// /// Creates a `DeviceID` from the given major and minor device numbers.
|
||||
// ///
|
||||
// /// The corresponding C function is `makedev()`.
|
||||
// @_alwaysEmitIntoClient
|
||||
// private static func make(major: CUnsignedInt, minor: CUnsignedInt) -> DeviceID {
|
||||
// DeviceID(rawValue: system_makedev(major, minor))
|
||||
// }
|
||||
//
|
||||
// /// The major device number
|
||||
// ///
|
||||
// /// The corresponding C function is `major()`.
|
||||
// @_alwaysEmitIntoClient
|
||||
// private var major: CInt { system_major(rawValue) }
|
||||
//
|
||||
// /// The minor device number
|
||||
// ///
|
||||
// /// The corresponding C function is `minor()`.
|
||||
// @_alwaysEmitIntoClient
|
||||
// private var minor: CInt { system_minor(rawValue) }
|
||||
}
|
||||
|
||||
/// A Swift wrapper of the C `ino_t` type.
|
||||
|
||||
@@ -85,17 +85,6 @@ public struct Stat: RawRepresentable, Sendable {
|
||||
@available(macOS 26.0, iOS 26.0, tvOS 26.0, watchOS 26.0, visionOS 26.0, *)
|
||||
public static var resolveBeneath: Flags { Flags(rawValue: _AT_RESOLVE_BENEATH) }
|
||||
#endif
|
||||
|
||||
// TODO: Re-enable when _GNU_SOURCE can be defined.
|
||||
// #if os(FreeBSD) || os(Linux) || os(Android)
|
||||
// /// If the path is an empty string (or `NULL` since Linux 6.11),
|
||||
// /// return information about the given file descriptor.
|
||||
// ///
|
||||
// /// The corresponding C constant is `AT_EMPTY_PATH`.
|
||||
// /// - Note: Only available on FreeBSD, Linux, and Android.
|
||||
// @_alwaysEmitIntoClient
|
||||
// public static var emptyPath: Flags { Flags(rawValue: _AT_EMPTY_PATH) }
|
||||
// #endif
|
||||
}
|
||||
|
||||
// MARK: Initializers
|
||||
@@ -520,59 +509,6 @@ public struct Stat: RawRepresentable, Sendable {
|
||||
}
|
||||
#endif
|
||||
|
||||
// TODO: Investigate changing time properties to UTCClock.Instant once available.
|
||||
|
||||
// /// Time of last access, given as a `UTCClock.Instant`
|
||||
// ///
|
||||
// /// The corresponding C property is `st_atim` (or `st_atimespec` on Darwin).
|
||||
// public var accessTime: UTCClock.Instant {
|
||||
// get {
|
||||
// UTCClock.systemEpoch.advanced(by: Duration(st_atim))
|
||||
// }
|
||||
// set {
|
||||
// st_atim = timespec(UTCClock.systemEpoch.duration(to: newValue))
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /// Time of last modification, given as a `UTCClock.Instant`
|
||||
// ///
|
||||
// /// The corresponding C property is `st_mtim` (or `st_mtimespec` on Darwin).
|
||||
// public var modificationTime: UTCClock.Instant {
|
||||
// get {
|
||||
// UTCClock.systemEpoch.advanced(by: Duration(st_mtim))
|
||||
// }
|
||||
// set {
|
||||
// st_mtim = timespec(UTCClock.systemEpoch.duration(to: newValue))
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /// Time of last status (inode) change, given as a `UTCClock.Instant`
|
||||
// ///
|
||||
// /// The corresponding C property is `st_ctim` (or `st_ctimespec` on Darwin).
|
||||
// public var changeTime: UTCClock.Instant {
|
||||
// get {
|
||||
// UTCClock.systemEpoch.advanced(by: Duration(st_ctim))
|
||||
// }
|
||||
// set {
|
||||
// st_ctim = timespec(UTCClock.systemEpoch.duration(to: newValue))
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// #if SYSTEM_PACKAGE_DARWIN || os(FreeBSD)
|
||||
// /// Time of file creation, given as a `UTCClock.Instant`
|
||||
// ///
|
||||
// /// The corresponding C property is `st_birthtim` (or `st_birthtimespec` on Darwin).
|
||||
// /// - Note: Only available on Darwin and FreeBSD.
|
||||
// public var creationTime: UTCClock.Instant {
|
||||
// get {
|
||||
// UTCClock.systemEpoch.advanced(by: Duration(st_birthtim))
|
||||
// }
|
||||
// set {
|
||||
// st_birthtim = timespec(UTCClock.systemEpoch.duration(to: newValue))
|
||||
// }
|
||||
// }
|
||||
// #endif
|
||||
|
||||
#if SYSTEM_PACKAGE_DARWIN || os(FreeBSD) || os(OpenBSD)
|
||||
/// File flags
|
||||
///
|
||||
|
||||
@@ -103,19 +103,6 @@ internal func system_fstat(_ fd: CInt, _ s: inout CInterop.Stat) -> Int32 {
|
||||
internal func system_fstatat(_ fd: CInt, _ p: UnsafePointer<CChar>, _ s: inout CInterop.Stat, _ flags: CInt) -> Int32 {
|
||||
fstatat(fd, p, &s, flags)
|
||||
}
|
||||
|
||||
@usableFromInline
|
||||
internal func system_major(_ dev: CInterop.DeviceID) -> CInt {
|
||||
numericCast((dev >> 24) & 0xff)
|
||||
}
|
||||
@usableFromInline
|
||||
internal func system_minor(_ dev: CInterop.DeviceID) -> CInt {
|
||||
numericCast(dev & 0xffffff)
|
||||
}
|
||||
@usableFromInline
|
||||
internal func system_makedev(_ maj: CUnsignedInt, _ min: CUnsignedInt) -> CInterop.DeviceID {
|
||||
CInterop.DeviceID((maj << 24) | min)
|
||||
}
|
||||
#endif
|
||||
|
||||
// Convention: `system_platform_foo` is a
|
||||
|
||||
Reference in new issue
Block a user