Skip to content

Commit 16c7885

Browse files
committed
Move public annotations from extensions down to each function explicitly
1 parent 0fb71dd commit 16c7885

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

Sources/System/MachPort.swift

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public enum Mach {
134134
}
135135
}
136136

137-
public extension Mach.Port where RightType == Mach.ReceiveRight {
137+
extension Mach.Port where RightType == Mach.ReceiveRight {
138138
/// Transfer ownership of an existing, unmanaged, but already guarded,
139139
/// Mach port right into a Mach.Port by name.
140140
///
@@ -145,7 +145,7 @@ public extension Mach.Port where RightType == Mach.ReceiveRight {
145145
///
146146
/// The underlying port right will be automatically deallocated when
147147
/// the Mach.Port object is destroyed.
148-
init(name: mach_port_name_t, context: mach_port_context_t) {
148+
public init(name: mach_port_name_t, context: mach_port_context_t) {
149149
self._name = name
150150
self._context = context
151151
}
@@ -155,7 +155,7 @@ public extension Mach.Port where RightType == Mach.ReceiveRight {
155155
///
156156
/// This initializer will abort if the right could not be created.
157157
/// Callers may assert that a valid right is always returned.
158-
init() {
158+
public init() {
159159
var storage: mach_port_name_t = mach_port_name_t(MACH_PORT_NULL)
160160
withUnsafeMutablePointer(to: &storage) { storage in
161161
_machPrecondition(mach_port_allocate(mach_task_self_, MACH_PORT_RIGHT_RECEIVE, storage))
@@ -176,7 +176,7 @@ public extension Mach.Port where RightType == Mach.ReceiveRight {
176176
///
177177
/// After this function completes, the Mach.Port is destroyed and no longer
178178
/// usable.
179-
__consuming func relinquish() ->
179+
public __consuming func relinquish() ->
180180
(name: mach_port_name_t, context: mach_port_context_t) {
181181
return (name: _name, context: _context)
182182
}
@@ -195,7 +195,7 @@ public extension Mach.Port where RightType == Mach.ReceiveRight {
195195
/// This function makes a syscall to remove the guard from
196196
/// Mach.ReceiveRights. Use relinquish() to avoid the syscall and extract
197197
/// the context value along with the port name.
198-
__consuming func unguardAndRelinquish() -> mach_port_name_t {
198+
public __consuming func unguardAndRelinquish() -> mach_port_name_t {
199199
_machPrecondition(mach_port_unguard(mach_task_self_, _name, _context))
200200
return _name
201201
}
@@ -209,7 +209,7 @@ public extension Mach.Port where RightType == Mach.ReceiveRight {
209209
///
210210
/// The body block may optionally return something, which will then be
211211
/// returned to the caller of withBorrowedName.
212-
func withBorrowedName<ReturnType>(
212+
public func withBorrowedName<ReturnType>(
213213
body: (mach_port_name_t, mach_port_context_t) -> ReturnType
214214
) -> ReturnType {
215215
body(_name, _context)
@@ -221,7 +221,7 @@ public extension Mach.Port where RightType == Mach.ReceiveRight {
221221
///
222222
/// This function will abort if the right could not be created.
223223
/// Callers may assert that a valid right is always returned.
224-
func makeSendOnceRight() -> Mach.Port<Mach.SendOnceRight> {
224+
public func makeSendOnceRight() -> Mach.Port<Mach.SendOnceRight> {
225225
// send once rights do not coalesce
226226
var newRight: mach_port_name_t = mach_port_name_t(MACH_PORT_NULL)
227227
var newRightType: mach_port_type_t = MACH_PORT_TYPE_NONE
@@ -250,7 +250,7 @@ public extension Mach.Port where RightType == Mach.ReceiveRight {
250250
///
251251
/// This function will abort if the right could not be created.
252252
/// Callers may assert that a valid right is always returned.
253-
func makeSendRight() -> Mach.Port<Mach.SendRight> {
253+
public func makeSendRight() -> Mach.Port<Mach.SendRight> {
254254
let how = MACH_MSG_TYPE_MAKE_SEND
255255

256256
// name is the same because send and recv rights are coalesced
@@ -262,7 +262,7 @@ public extension Mach.Port where RightType == Mach.ReceiveRight {
262262
/// Access the make-send count.
263263
///
264264
/// Each get/set of this property makes a syscall.
265-
var makeSendCount : mach_port_mscount_t {
265+
public var makeSendCount : mach_port_mscount_t {
266266
get {
267267
var status: mach_port_status = mach_port_status()
268268
var size: mach_msg_type_number_t = mach_msg_type_number_t(MemoryLayout<mach_port_status>.size / MemoryLayout<natural_t>.size)
@@ -281,7 +281,7 @@ public extension Mach.Port where RightType == Mach.ReceiveRight {
281281
}
282282
}
283283

284-
public extension Mach.Port where RightType == Mach.SendRight {
284+
extension Mach.Port where RightType == Mach.SendRight {
285285
/// Transfer ownership of the underlying port right to the caller.
286286
///
287287
/// Returns the Mach port name representing the right.
@@ -291,7 +291,7 @@ public extension Mach.Port where RightType == Mach.SendRight {
291291
///
292292
/// After this function completes, the Mach.Port is destroyed and no longer
293293
/// usable.
294-
__consuming func relinquish() -> mach_port_name_t {
294+
public __consuming func relinquish() -> mach_port_name_t {
295295
return _name
296296
}
297297

@@ -302,7 +302,7 @@ public extension Mach.Port where RightType == Mach.SendRight {
302302
/// If the send right being copied has become a dead name, meaning the
303303
/// receiving side has been deallocated, then copySendRight() will throw
304304
/// a Mach.PortRightError.deadName error.
305-
func copySendRight() throws -> Mach.Port<Mach.SendRight> {
305+
public func copySendRight() throws -> Mach.Port<Mach.SendRight> {
306306
let how = MACH_MSG_TYPE_COPY_SEND
307307

308308
// name is the same because send rights are coalesced
@@ -317,7 +317,7 @@ public extension Mach.Port where RightType == Mach.SendRight {
317317
}
318318

319319

320-
public extension Mach.Port where RightType == Mach.SendOnceRight {
320+
extension Mach.Port where RightType == Mach.SendOnceRight {
321321
/// Transfer ownership of the underlying port right to the caller.
322322
///
323323
/// Returns the Mach port name representing the right.
@@ -327,7 +327,7 @@ public extension Mach.Port where RightType == Mach.SendOnceRight {
327327
///
328328
/// After this function completes, the Mach.Port is destroyed and no longer
329329
/// usable.
330-
__consuming func relinquish() -> mach_port_name_t {
330+
public __consuming func relinquish() -> mach_port_name_t {
331331
return _name
332332
}
333333
}

0 commit comments

Comments
 (0)