mirror of
https://github.com/apple/swift-system
synced 2026-11-25 04:47:55 +00:00
2 files changed
+12
-12
No files matched your search
@@ -693,8 +693,9 @@ internal var _S_IFLNK: mode_t { S_IFLNK }
|
||||
internal var _S_IFSOCK: mode_t { S_IFSOCK }
|
||||
|
||||
#if SYSTEM_PACKAGE_DARWIN || os(FreeBSD)
|
||||
// `S_IFWHT` is `Int32` on FreeBSD.
|
||||
@_alwaysEmitIntoClient
|
||||
internal var _S_IFWHT: mode_t { S_IFWHT }
|
||||
internal var _S_IFWHT: mode_t { .init(S_IFWHT) }
|
||||
#endif
|
||||
|
||||
// MARK: - stat/chflags File Flags
|
||||
|
||||
@@ -118,7 +118,7 @@ private struct StatTests {
|
||||
#expect(targetStat.type == .regular)
|
||||
#expect(symlinkStat.type == .symbolicLink)
|
||||
#expect(symlinkStat.size < targetStat.size)
|
||||
#expect(symlinkStat.sizeAllocated < targetStat.sizeAllocated)
|
||||
#expect(symlinkStat.sizeAllocated <= targetStat.sizeAllocated)
|
||||
|
||||
// Set each .st_atim back to its original value for comparison
|
||||
|
||||
@@ -368,14 +368,11 @@ private struct StatTests {
|
||||
]
|
||||
#elseif os(FreeBSD)
|
||||
let userSettableFlags: FileFlags = [
|
||||
.noDump, .userImmutable, .userAppend,
|
||||
.opaque, .tracked, .hidden,
|
||||
.userNoUnlink,
|
||||
.offline,
|
||||
.readOnly,
|
||||
.reparse,
|
||||
.sparse,
|
||||
.system
|
||||
.noDump, .hidden, .offline,
|
||||
.readOnly, .sparse, .system
|
||||
// The following flags throw EPERM on ZFS.
|
||||
// .userImmutable, .userAppend, .opaque,
|
||||
// .userNoUnlink, .reparse,
|
||||
]
|
||||
#else // os(OpenBSD)
|
||||
let userSettableFlags: FileFlags = [
|
||||
@@ -384,13 +381,15 @@ private struct StatTests {
|
||||
#endif
|
||||
|
||||
flags.insert(userSettableFlags)
|
||||
try #require(fchflags(fd.rawValue, flags.rawValue) == 0, "\(Errno.current)")
|
||||
// On FreeBSD, the second argument of `fchflags` requires `UInt` instead of`UInt32`.
|
||||
try #require(fchflags(fd.rawValue, .init(flags.rawValue)) == 0, "\(Errno.current)")
|
||||
|
||||
stat = try fd.stat()
|
||||
#expect(stat.flags == flags)
|
||||
|
||||
flags.remove(userSettableFlags)
|
||||
try #require(fchflags(fd.rawValue, flags.rawValue) == 0, "\(Errno.current)")
|
||||
// On FreeBSD, the second argument of `fchflags` requires `UInt` instead of`UInt32`.
|
||||
try #require(fchflags(fd.rawValue, .init(flags.rawValue)) == 0, "\(Errno.current)")
|
||||
|
||||
stat = try fd.stat()
|
||||
#expect(stat.flags == flags)
|
||||
|
||||
Reference in new issue
Block a user