UFFDIO_WAKE(2const)

πŸ’– UFFDIO_WAKE πŸ’–

okay so bestie, welcome to UFFDIO_WAKE(2const) β€” yes that's a real one, it lives in section 2const of the Linux manual, and today we're gonna make friends with it. grab a matcha, we're doing kernel-flavored lore πŸ“βœ¨


✨ NAME ✨

UFFDIO_WAKE β€” wake up a thread waiting for page-fault resolution πŸ˜΄βž‘οΈπŸ‘‘


πŸ“š LIBRARY πŸ“š

Standard C library β€” that's libc, -lc. she's a classic, she's been here forever πŸ’…


πŸ› οΈ SYNOPSIS πŸ› οΈ

#include <linux/userfaultfd.h>  /* Definition of UFFD* constants */
#include <sys/ioctl.h>

int ioctl(int fd, UFFDIO_WAKE, const struct uffdio_range *argp);

like, you call ioctl(2) with UFFDIO_WAKE, hand her the fd, and point argp at a const struct uffdio_range. that's the whole vibe πŸ¦‹


🌸 DESCRIPTION 🌸

So. Wake up the thread waiting for page-fault resolution on a specified memory address range. that's the elevator pitch, no cap.

Here's when you actually reach for this: UFFDIO_WAKE is used in conjunction with the UFFDIO_COPY and UFFDIO_ZEROPAGE operations β€” specifically the ones that have UFFDIO_COPY_MODE_DONTWAKE or UFFDIO_ZEROPAGE_MODE_DONTWAKE set in the mode field. yes, the DONTWAKE bits. those ones. πŸ™ˆ

Why would anyone do that? because the userfault monitor can batch a bunch of UFFDIO_COPY and UFFDIO_ZEROPAGE operations together, and then explicitly wake up the faulting thread with UFFDIO_WAKE. it's giving efficiency. it's giving "I'll handle all of you at once, besties." πŸ”₯πŸ‘‘

so like, DONTWAKE = "hold that thought", and UFFDIO_WAKE = "okay go, we're done here". iconic teamwork fr fr.


πŸ” RETURN VALUE πŸ”

  • 0 β€” success, we ate, we devoured πŸ’–
  • -1 β€” error, and errno gets set to tell you what went wrong. always check your errno, bestie, she's the group chat receipts 😭

πŸ’€ ERRORS πŸ’€

  • EINVAL β€” the start or the len field of the ufdio_range structure was not a multiple of the system page size; or len was zero; or the specified range was otherwise invalid.
okay so real talk: page-size multiples only, len cannot be 0, and if the range is just weird/invalid in any other way, you're getting EINVAL. she is not subtle about it. respect the page size or perish 🧚✨

πŸ“œ STANDARDS πŸ“œ

Linux. that's the standard. that's the whole standard. periodt πŸŽ€


πŸ•°οΈ HISTORY πŸ•°οΈ

Linux 4.3 β€” she's been around since 2015 and still serving looks πŸ‘‘


πŸ§ͺ EXAMPLES πŸ§ͺ

See userfaultfd(2) β€” yeah bestie, the whole example situation lives over there, go peek 🫢


πŸ‘€ SEE ALSO πŸ‘€


πŸ’œ cute sign-off: this lil page came straight from Linux man-pages 6.20, dated 2026-02-08. go forth and wake your threads, angel πŸŒˆβ­πŸ’…
πŸ“¦ where this page comes from
  • arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
  • nixpkgs unstable: man-pages 6.20
  • πŸ“œ the page's license: Linux-man-pages-copyleft
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms