Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
21 changes: 12 additions & 9 deletions src/swift/Source.swift
Original file line number Diff line number Diff line change
Expand Up @@ -116,24 +116,27 @@ extension DispatchSource {
}
#endif

#if !os(Linux) && !os(Android) && !os(Windows) && !os(OpenBSD)
#if !os(Linux) && !os(Android) && !os(Windows)
public struct ProcessEvent : OptionSet, RawRepresentable {
public let rawValue: UInt
public init(rawValue: UInt) { self.rawValue = rawValue }

public static let exit = ProcessEvent(rawValue: 0x80000000)
public static let fork = ProcessEvent(rawValue: 0x40000000)
public static let exec = ProcessEvent(rawValue: 0x20000000)
#if os(FreeBSD)
public static let track = ProcessEvent(rawValue: 0x00000001)
#else

#if canImport(Darwin)
public static let signal = ProcessEvent(rawValue: 0x08000000)
#endif
#if os(FreeBSD) || os(OpenBSD)
public static let track = ProcessEvent(rawValue: 0x00000001)
#endif

#if os(FreeBSD)
public static let all: ProcessEvent = [.exit, .fork, .exec, .track]
#else
#if canImport(Darwin)
public static let all: ProcessEvent = [.exit, .fork, .exec, .signal]
#endif
#if os(FreeBSD) || os(OpenBSD)
public static let all: ProcessEvent = [.exit, .fork, .exec, .track]
#endif
}
#endif
Expand Down Expand Up @@ -183,7 +186,7 @@ extension DispatchSource {
}
#endif

#if !os(Linux) && !os(Android) && !os(Windows) && !os(OpenBSD)
#if !os(Linux) && !os(Android) && !os(Windows)
public class func makeProcessSource(identifier: pid_t, eventMask: ProcessEvent, queue: DispatchQueue? = nil) -> DispatchSourceProcess {
let source = dispatch_source_create(_swift_dispatch_source_type_PROC(), UInt(identifier), eventMask.rawValue, queue?.__wrapped)
return DispatchSource(source: source) as DispatchSourceProcess
Expand Down Expand Up @@ -299,7 +302,7 @@ extension DispatchSourceMemoryPressure {
}
#endif

#if !os(Linux) && !os(Android) && !os(Windows) && !os(OpenBSD)
#if !os(Linux) && !os(Android) && !os(Windows)
extension DispatchSourceProcess {
public var handle: pid_t {
return pid_t(CDispatch.dispatch_source_get_handle((self as! DispatchSource).__wrapped))
Expand Down
4 changes: 2 additions & 2 deletions src/swift/Wrapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ extension DispatchSource : DispatchSourceMachSend,
}
#endif

#if !os(Linux) && !os(Android) && !os(Windows) && !os(OpenBSD)
#if !os(Linux) && !os(Android) && !os(Windows)
extension DispatchSource : DispatchSourceProcess {
}
#endif
Expand Down Expand Up @@ -277,7 +277,7 @@ public protocol DispatchSourceMemoryPressure : DispatchSourceProtocol {
}
#endif

#if !os(Linux) && !os(Android) && !os(Windows) && !os(OpenBSD)
#if !os(Linux) && !os(Android) && !os(Windows)
public protocol DispatchSourceProcess : DispatchSourceProtocol {
var handle: pid_t { get }

Expand Down
2 changes: 1 addition & 1 deletion src/swift/shims/DispatchOverlayShims.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ SWIFT_DISPATCH_SOURCE_TYPE(PROC)
SWIFT_DISPATCH_SOURCE_TYPE(VNODE)
#endif

#if defined(__FreeBSD__)
#if defined(__FreeBSD__) || defined(__OpenBSD__)
SWIFT_DISPATCH_SOURCE_TYPE(PROC)
SWIFT_DISPATCH_SOURCE_TYPE(VNODE)
#endif
Expand Down