get_futex_key(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– get_futex_key(9) πŸ’–

okay bestie, welcome to the Kernel API Manual page for get_futex_key(9) β€” this one is literally about getting the parameters that are the keys for a futex. no cap, it’s a little kernel-key situation and we’re keeping every detail. 🫢✨

🌸 NAME 🌸

get_futex_key β€” Get parameters which are the keys for a futex

✨ SYNOPSIS ✨

int get_futex_key (u32 __user *uaddr , unsigned int flags , union
futex_key *key , enum futex_access rw );

πŸŽ€ ARGUMENTS πŸŽ€

  • uaddr β€” virtual address of the futex
  • flags β€” FLAGS_*
  • key β€” address where result is stored.
  • rw β€” mapping needs to be read/write (values: FUTEX_READ, FUTEX_WRITE)

πŸ”₯ RETURN πŸ”₯

a negative error code or 0

πŸ¦‹ DESCRIPTION πŸ¦‹

The key words are stored in key on success.

For shared mappings (when fshared), the key is:

( inode->i_sequence, page offset within mapping, 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. πŸ’€

πŸ”— SEE ALSO πŸ”—

Kernel file ./kernel/futex/core.c β€” also peep these:


okay that’s the whole page, bestie! source/version ./kernel/futex, date October 2026, and the page is get_futex_key(9). mwah πŸ’…πŸ’–βœ¨

πŸ“¦ where this page comes from