---
title: os_workgroup_copy_port
framework: os
role: symbol
role_heading: Function
path: os/os_workgroup_copy_port
---

# os_workgroup_copy_port

Returns the Mach port associated with the workgroup.

## Declaration

```occ
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

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

## Discussion

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.

## See Also

### Common Utilities

- [os_workgroup_create_with_workgroup](os/os_workgroup_create_with_workgroup.md)
- [os_workgroup_create_with_port](os/os_workgroup_create_with_port.md)
- [os_workgroup_t](os/os_workgroup_t.md)
- [os_workgroup_attr_t](os/os_workgroup_attr_t.md)
