Bug 257580

Summary: Make MachSendRight move-only
Product: WebKit Reporter: Matt Woodrow <mattwoodrow>
Component: WebKit2Assignee: Matt Woodrow <mattwoodrow>
Status: RESOLVED FIXED    
Severity: Normal CC: kkinnunen, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 257581, 258608    
Bug Blocks:    

Description Matt Woodrow 2023-05-31 19:13:34 PDT
MachSendRight are expensive to copy, since it calls into the kernel. We generally don't want to do that by accident.

We should make MachSendRight move-only, and switch callers to use the existing 'copySendRight' function where they do want a duplicate.
Comment 1 Kimmo Kinnunen 2023-05-31 23:21:30 PDT
This extends to all the handle types that should unify their interface:
UnixFileDescriptor
Win32Handle
MachSendRight

If the copy constructor should be removed, the interface should be the same for all so that generic code can be written.
E.g. 
  ...::copy() or ...::duplicate()
Comment 2 Radar WebKit Bug Importer 2023-06-07 17:29:28 PDT
<rdar://problem/110431180>
Comment 3 Matt Woodrow 2023-06-07 17:32:39 PDT
Pull request: https://github.com/WebKit/WebKit/pull/14771
Comment 4 Kimmo Kinnunen 2023-06-27 23:45:09 PDT
maybe bug 258608 needs to be addressed before landing the patch
Comment 5 EWS 2023-07-26 13:52:35 PDT
Committed 266327@main (aeb697fb2c06): <https://commits.webkit.org/266327@main>

Reviewed commits have been landed. Closing PR #14771 and removing active labels.