---
name: "get_futex_key"
section: "9"
platform: "linux"
package: "linux-manual-4.9"
version: "4.9.228-1"
release: "Debian 9 (Stretch)"
platforms: ["linux"]
url: "https://new.carta.tech/get_futex_key"
---

# get\_futex\_key(9)

Get parameters which are the keys for a futex

## NAME

get\_futex\_key - Get parameters which are the keys for a futex

## SYNOPSIS

**int get\_futex\_key(u32 \_\_user \*** *uaddr***, int** *fshared***, union futex\_key \*** *key***, int** *rw***);**

## ARGUMENTS

*uaddr*

virtual address of the futex

*fshared*

0 for a PROCESS\_PRIVATE futex, 1 for PROCESS\_SHARED

*key*

address where result is stored.

*rw*

mapping needs to be read/write (values: VERIFY\_READ, VERIFY\_WRITE)

## RETURN

a negative error code or 0

The key words are stored in \*key on success.

For shared mappings (when *fshared*), the key is: ( inode-\>i\_sequence, page-\>index, offset\_within\_page ) \[ also see **get\_inode\_sequence\_number** \]

For private mappings (or when !*fshared*), the key is: ( current-\>mm, address, 0 )

This allows (cross process, where applicable) identification of the futex without keeping the page pinned for the duration of the FUTEX\_WAIT.

**lock\_page** might sleep, the caller should not hold a spinlock.

## AUTHOR

**Rusty Russell** \<rusty@rustcorp.com.au\>

Author.

## COPYRIGHT
