From 814d09c7ea874badbe57236d2441e200e76f0557 Mon Sep 17 00:00:00 2001 From: Guillaume Lessard Date: Tue, 19 May 2026 19:17:40 -0700 Subject: [PATCH] Improve doc-comments --- Sources/System/FileDescriptor.swift | 44 +++++++++++------------------ Sources/System/FileOperations.swift | 15 +++++----- 2 files changed, 25 insertions(+), 34 deletions(-) diff --git a/Sources/System/FileDescriptor.swift b/Sources/System/FileDescriptor.swift index 6f21317..5ebf9b1 100644 --- a/Sources/System/FileDescriptor.swift +++ b/Sources/System/FileDescriptor.swift @@ -306,12 +306,10 @@ extension FileDescriptor { /// /// Normally, file descriptors remain open /// across calls to the `exec(2)` family of functions. - /// If you specify this option, - /// the file descriptor is closed when replacing this process - /// with another process. + /// If you specify this option, the system closes the file + /// descriptor when replacing this process with another process. /// - /// The state of the file - /// descriptor flags can be inspected using `F_GETFD`, + /// You can inspect the file descriptor flag state using `F_GETFD`, /// as described in the `fcntl(2)` man page. /// /// The corresponding C constant is `O_CLOEXEC`. @@ -342,8 +340,8 @@ extension FileDescriptor { public init(rawValue: CInt) { self.rawValue = rawValue } #if !os(Windows) - /// Indicates that all - /// subsequent input and output operations on the pipe's file descriptors will be nonblocking. + /// Indicates that all subsequent input and output operations + /// on the pipe's file descriptors will be nonblocking. /// /// The corresponding C constant is `O_NONBLOCK`. @_alwaysEmitIntoClient @@ -357,12 +355,10 @@ extension FileDescriptor { /// /// Normally, file descriptors remain open /// across calls to the `exec(2)` family of functions. - /// If you specify this option, - /// the file descriptor is closed when replacing this process - /// with another process. + /// If you specify this option, the system closes the file + /// descriptor when replacing this process with another process. /// - /// The state of the file - /// descriptor flags can be inspected using `F_GETFD`, + /// You can inspect the file descriptor flag state using `F_GETFD`, /// as described in the `fcntl(2)` man page. /// /// The corresponding C constant is `O_CLOEXEC`. @@ -378,12 +374,10 @@ extension FileDescriptor { /// /// Normally, file descriptors remain open /// across calls to the `fork(2)` function. - /// If you specify this option, - /// the file descriptor is closed when forking this process - /// into another process. + /// If you specify this option, the system closes the file + /// descriptor when forking this process into another process. /// - /// The state of the file - /// descriptor flags can be inspected using `F_GETFD`, + /// You can inspect the file descriptor flag state using `F_GETFD`, /// as described in the `fcntl(2)` man page. /// /// The corresponding C constant is `O_CLOFORK`. @@ -419,12 +413,10 @@ extension FileDescriptor { /// /// Normally, file descriptors remain open /// across calls to the `exec(2)` family of functions. - /// If you specify this option, - /// the file descriptor is closed when replacing this process - /// with another process. + /// If you specify this option, the system closes the file + /// descriptor when replacing this process with another process. /// - /// The state of the file - /// descriptor flags can be inspected using `F_GETFD`, + /// You can inspect the file descriptor flag state using `F_GETFD`, /// as described in the `fcntl(2)` man page. /// /// The corresponding C constant is `O_CLOEXEC`. @@ -440,12 +432,10 @@ extension FileDescriptor { /// /// Normally, file descriptors remain open /// across calls to the `fork(2)` function. - /// If you specify this option, - /// the file descriptor is closed when forking this process - /// into another process. + /// If you specify this option, the system closes the file + /// descriptor when forking this process into another process. /// - /// The state of the file - /// descriptor flags can be inspected using `F_GETFD`, + /// You can inspect the file descriptor flag state using `F_GETFD`, /// as described in the `fcntl(2)` man page. /// /// The corresponding C constant is `O_CLOFORK`. diff --git a/Sources/System/FileOperations.swift b/Sources/System/FileOperations.swift index c52c4d3..fb32e3d 100644 --- a/Sources/System/FileOperations.swift +++ b/Sources/System/FileOperations.swift @@ -406,12 +406,12 @@ extension FileDescriptor { try _duplicate(as: target, options: 0, retryOnInterrupt: retryOnInterrupt).get() } - /// Duplicates this file descriptor and return the newly created copy. + /// Duplicate this file descriptor and return the newly created copy. /// /// - Parameters: - /// - `target`: The desired target file descriptor. - /// - `options`: The behavior for creating the target file descriptor. - /// - retryOnInterrupt: Whether to retry the write operation + /// - target: The desired target file descriptor. + /// - options: The behavior for creating the target file descriptor. + /// - retryOnInterrupt: Whether to retry the operation /// if it throws ``Errno/interrupted``. The default is `true`. /// Pass `false` to try only once and throw an error upon interruption. /// - Returns: The new file descriptor. @@ -428,8 +428,8 @@ extension FileDescriptor { /// a different object reference to the file must be obtained by issuing an /// additional call to `open`. /// - /// However, each file descriptor maintains its own close-on-exec flag. - /// + /// However, each file descriptor maintains its own close-on-exec and + /// close-on-fork flags. /// /// The corresponding C function is `dup3`. @discardableResult @@ -500,7 +500,8 @@ extension FileDescriptor { try _pipe(options: 0).get() } - /// Creates a unidirectional data channel, which can be used for interprocess communication. + /// Creates a unidirectional data channel, which can be used for + /// interprocess communication. /// /// - Parameters: /// - options: The behavior for creating the pipe.