Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Remove MemorySyncKind.invalidated field covered by `invalidateOther…
…Mappings` parameter in `memorySync`
  • Loading branch information
jsflax committed Nov 7, 2021
commit a21e70dd650731a7af0ee92b4875e36dded12614
8 changes: 1 addition & 7 deletions Sources/System/FileOperations.swift
Original file line number Diff line number Diff line change
Expand Up @@ -461,8 +461,7 @@ extension FileDescriptor {
}

/// Determines whether memory sync should be
/// synchronous, asynchronous, and/or invalidate
/// other mappings of the same file.
/// synchronous, asynchronous.
@frozen
public struct MemorySyncKind: RawRepresentable, Hashable, Codable {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like MemoryMapKind, I think this should be modeling the original (open-ended) flags. It ought to be called MemorySyncFlags, and it needs to be an OptionSet, not an enum-like struct.

/// The raw C flag number.
Expand All @@ -483,11 +482,6 @@ extension FileDescriptor {
/// returns immediately.
@_alwaysEmitIntoClient
public static var asynchronous: MemorySyncKind { MemorySyncKind(rawValue: _MS_ASYNC) }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we also want MS_INVALIDATE here.

On Darwin, we probably also want to expose MS_KILLPAGES and MS_DEACTIVATE.

/// Asks to invalidate other mappings of the same file (so
/// that they can be updated with the fresh values just
/// written).
@_alwaysEmitIntoClient
public static var invalidate: MemorySyncKind { MemorySyncKind(rawValue: _MS_INVALIDATE) }
}

/// Create a new mapping in the virtual address space of the
Expand Down