<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: 11.0.0 -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "os",
  "identifier" : "/documentation/os/os_workgroup_copy_port",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "os"
    ],
    "preciseIdentifier" : "c:@F@os_workgroup_copy_port"
  },
  "title" : "os_workgroup_copy_port"
}
-->

# os_workgroup_copy_port

Returns the Mach port associated with the workgroup.

```
extern int os_workgroup_copy_port(os_workgroup_t wg, mach_port_t *mach_port_out);
```

## Parameters

`wg`

The workgroup whose Mach port you want.

`mach_port_out`

A pointer to a Mach port variable. When the function returns, this parameter contains the specified workgroup’s Mach port reference.

## Return Value

A value of `0` on success, or a nonzero error code if an error occurred.

## Discussion

This function returns the send right for the workgroup’s Mach port in the kernel. Pass this port to other processes and use it to construct a reference to the same workgroup in those processes, which lets those processes coordinate their threads with the threads of the workgroup in the `wg` parameter.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)