Skip to content

Commit f177ef1

Browse files
committed
Minor fixes
1 parent 483c4fa commit f177ef1

File tree

4 files changed

+16
-18
lines changed

4 files changed

+16
-18
lines changed

Sources/System/FileStatus/FileMode.swift

+7-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,13 @@
1111

1212
// FIXME: should the subtypes of Mode mask their rawValues to only allow their bits to be changed?
1313

14-
// FIXME: Document
14+
/// The superset of access permissions and type for a file.
15+
///
16+
/// The following example creates an instance of the `FileMode` structure
17+
/// from a raw octal literal and reads the file type from it:
18+
///
19+
/// let mode = FileMode(rawValue: 0o140000)
20+
/// mode.type == .socket // true
1521
@frozen
1622
// @available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
1723
public struct FileMode: RawRepresentable {

Sources/System/FileStatus/FileStatus.swift

-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ public struct FileStatus: RawRepresentable {
2222
public init(rawValue: CInterop.Stat) { self.rawValue = rawValue }
2323

2424
// FIXME: replace with swift type DeviceID that splits out major/minor
25-
// FIXME: whats the difference between this and rDeviceID?
2625
/// ID of device containing file.
2726
@_alwaysEmitIntoClient
2827
public var deviceID: CInterop.DeviceID { rawValue.st_dev }
@@ -47,7 +46,6 @@ public struct FileStatus: RawRepresentable {
4746
@_alwaysEmitIntoClient
4847
public var groupID: CInterop.GroupID { rawValue.st_gid }
4948

50-
// FIXME: whats the difference between this and deviceID?
5149
/// Device ID.
5250
@_alwaysEmitIntoClient
5351
public var rDeviceID: CInterop.DeviceID { rawValue.st_rdev }

Sources/System/FileStatus/FileStatusOperations.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,8 @@ extension FileDescriptor {
234234
) -> Result<Void, Errno> {
235235
path.withPlatformString { ptr in
236236
nothingOrErrno(retryOnInterrupt: retryOnInterrupt) {
237-
system_fchmodat(self.rawValue, ptr, permissions.rawValue, fcntrl.rawValue)
237+
system_fchmodat(
238+
self.rawValue, ptr, permissions.rawValue, fcntrl.rawValue)
238239
}
239240
}
240241
}

Sources/System/TimeSpecification.swift

+7-14
Original file line numberDiff line numberDiff line change
@@ -23,25 +23,18 @@ public struct TimeSpecification: RawRepresentable {
2323
@_alwaysEmitIntoClient
2424
private init(_ raw: CInterop.TimeSpec) { self.init(rawValue: raw) }
2525

26-
// FIXME: This isn't right
2726
/// seconds since 1970
2827
@_alwaysEmitIntoClient
29-
public var seconds: Int { Int(rawValue.tv_sec) }
28+
public var seconds: Int {
29+
get { rawValue.tv_sec }
30+
set { rawValue.tv_sec = newValue }
31+
}
3032

3133
/// nanoseconds
3234
@_alwaysEmitIntoClient
33-
public var nanoseconds: Int { rawValue.tv_nsec }
34-
35-
// FIXME: This isn't right
36-
// (-1)
37-
static var now: TimeSpecification {
38-
.init(rawValue: CInterop.TimeSpec(tv_sec: .min, tv_nsec: _UTIME_NOW))
39-
}
40-
41-
// FIXME: This isn't right
42-
// (-2)
43-
static var omit: TimeSpecification {
44-
.init(rawValue: CInterop.TimeSpec(tv_sec: .min, tv_nsec: _UTIME_OMIT))
35+
public var nanoseconds: Int {
36+
get { rawValue.tv_nsec }
37+
set { rawValue.tv_nsec = newValue }
4538
}
4639
}
4740

0 commit comments

Comments
 (0)