@@ -122,7 +122,7 @@ public struct Stat: RawRepresentable, Sendable {
122122 } . get ( )
123123 }
124124
125- /// Creates a `Stat` struct from an`UnsafePointer<CChar>` path.
125+ /// Creates a `Stat` struct from an `UnsafePointer<CChar>` path.
126126 ///
127127 /// `followTargetSymlink` determines the behavior if `path` ends with a symbolic link.
128128 /// By default, `followTargetSymlink` is `true` and this initializer behaves like `stat()`.
@@ -314,6 +314,9 @@ public struct Stat: RawRepresentable, Sendable {
314314 }
315315
316316 /// File type for the given mode
317+ ///
318+ /// - Note: This property is equivalent to `mode.type`. Modifying this
319+ /// property will update the underlying `st_mode` accordingly.
317320 @_alwaysEmitIntoClient
318321 public var type : FileType {
319322 get { mode. type }
@@ -325,6 +328,9 @@ public struct Stat: RawRepresentable, Sendable {
325328 }
326329
327330 /// File permissions for the given mode
331+ ///
332+ /// - Note: This property is equivalent to `mode.permissions`. Modifying
333+ /// this property will update the underlying `st_mode` accordingly.
328334 @_alwaysEmitIntoClient
329335 public var permissions : FilePermissions {
330336 get { mode. permissions }
@@ -365,7 +371,7 @@ public struct Stat: RawRepresentable, Sendable {
365371 /// Device ID (if special file)
366372 ///
367373 /// For character or block special files, the returned `DeviceID` may have
368- /// meaningful `. major` and `. minor` values. For non-special files, this
374+ /// meaningful major and minor values. For non-special files, this
369375 /// property is usually meaningless and often set to 0.
370376 ///
371377 /// The corresponding C property is `st_rdev`.
@@ -377,6 +383,12 @@ public struct Stat: RawRepresentable, Sendable {
377383
378384 /// Total size, in bytes
379385 ///
386+ /// The semantics of this property are tied to the underlying C `st_size` field,
387+ /// which can have file system-dependent behavior. For example, this property
388+ /// can return different values for a file's data fork and resource fork, and some
389+ /// file systems report logical size rather than actual disk usage for compressed
390+ /// or cloned files.
391+ ///
380392 /// The corresponding C property is `st_size`.
381393 @_alwaysEmitIntoClient
382394 public var size : Int64 {
@@ -395,6 +407,9 @@ public struct Stat: RawRepresentable, Sendable {
395407
396408 /// Number of 512-byte blocks allocated
397409 ///
410+ /// The semantics of this property are tied to the underlying C `st_blocks` field,
411+ /// which can have file system-dependent behavior.
412+ ///
398413 /// The corresponding C property is `st_blocks`.
399414 @_alwaysEmitIntoClient
400415 public var blocksAllocated : Int64 {
@@ -404,12 +419,19 @@ public struct Stat: RawRepresentable, Sendable {
404419
405420 /// Total size allocated, in bytes
406421 ///
422+ /// The semantics of this property are tied to the underlying C `st_blocks` field,
423+ /// which can have file system-dependent behavior.
424+ ///
407425 /// - Note: Calculated as `512 * blocksAllocated`.
408426 @_alwaysEmitIntoClient
409427 public var sizeAllocated : Int64 {
410428 512 * blocksAllocated
411429 }
412430
431+ // NOTE: "st_" property names are used for the `timespec` properties so
432+ // we can reserve `accessTime`, `modificationTime`, etc. for potential
433+ // `UTCClock.Instant` properties in the future.
434+
413435 /// Time of last access, given as a C `timespec` since the Epoch.
414436 ///
415437 /// The corresponding C property is `st_atim` (or `st_atimespec` on Darwin).
@@ -497,7 +519,7 @@ public struct Stat: RawRepresentable, Sendable {
497519 }
498520 #endif
499521
500- // TODO: jflat - Change time properties to UTCClock.Instant when possible .
522+ // TODO: Investigate changing time properties to UTCClock.Instant once available .
501523
502524// /// Time of last access, given as a `UTCClock.Instant`
503525// ///
@@ -602,8 +624,6 @@ extension Stat: Hashable {
602624
603625// MARK: - CustomStringConvertible and CustomDebugStringConvertible
604626
605- // TODO: jflat
606-
607627// MARK: - FileDescriptor Extensions
608628
609629// @available(System X.Y.Z, *)
@@ -673,7 +693,7 @@ extension FilePath {
673693 }
674694 }
675695
676- /// Creates a `Stat` struct for the file referenced by this`FilePath` using the given `Flags`.
696+ /// Creates a `Stat` struct for the file referenced by this `FilePath` using the given `Flags`.
677697 ///
678698 /// If `path` is relative, it is resolved against the current working directory.
679699 ///
@@ -690,7 +710,7 @@ extension FilePath {
690710 ) . get ( )
691711 }
692712
693- /// Creates a `Stat` struct for the file referenced by this`FilePath` using the given `Flags`,
713+ /// Creates a `Stat` struct for the file referenced by this `FilePath` using the given `Flags`,
694714 /// including a `FileDescriptor` to resolve a relative path.
695715 ///
696716 /// If `path` is absolute (starts with a forward slash), then `fd` is ignored.
0 commit comments