1# zx_futex_get_owner
2
3## NAME
4
5<!-- Updated by update-docs-from-abigen, do not edit. -->
6
7futex_get_owner - Fetch the koid current owner of a futex, if any.
8
9## SYNOPSIS
10
11<!-- Updated by update-docs-from-abigen, do not edit. -->
12
13```
14#include <zircon/syscalls.h>
15
16zx_status_t zx_futex_get_owner(const zx_futex_t* value_ptr, zx_koid_t* koid);
17```
18
19## DESCRIPTION
20
21Fetch the koid of the current owner of the futex identified by *value_ptr*, or
22**ZX_KOID_INVALID** if there is no current owner.  Knowledge of the ownership of
23a futex typically serves no purpose when building synchronization primitives
24from futexes.  This syscall is used primarily for testing.
25
26See *Ownership and Priority Inheritance* in [futex](../objects/futex.md) for
27details.
28
29## RIGHTS
30
31<!-- Updated by update-docs-from-abigen, do not edit. -->
32
33None.
34
35## RETURN VALUE
36
37`zx_futex_get_owner()` returns **ZX_OK** on success, and koids hold the owner of
38the futex at the time of the syscall, or **ZX_KOID_INVALID** if there was no
39owner.
40
41## ERRORS
42
43**ZX_ERR_INVALID_ARGS**  One of the following is true:
44+ *value_ptr* is not a valid userspace pointer.
45+ *value_ptr* is not aligned to a `sizeof(zx_futex_t)` boundary.
46+ *koid* is not a valid userspace pointer.
47
48## SEE ALSO
49
50
51[futex objects](../objects/futex.md)
52