ioctl_userfaultfd(2)

✨ ioctl_userfaultfd πŸ’–

okay bestie, welcome to the ioctl_userfaultfd page, straight out of the System Calls Manual ✨ this one's all about create a file descriptor for handling page faults in user space πŸ¦‹ like, userfaultfd but the ioctl half. no cap, she's iconic.

🌸 LIBRARY

Standard C library (libc, -lc) πŸŽ€


πŸŽ€ SYNOPSIS

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

int ioctl(int fd, int op, ...);

πŸ’… DESCRIPTION

sooooo there's a bunch of ioctl(2) operations you can do on a userfaultfd object (that's the thing you get from calling userfaultfd(2), btw) and you do them like this:

ioctl(fd, op, argp);

let's break that down fr fr:

  • fd is a file descriptor pointing at a userfaultfd object πŸ‘‘
  • op is one of the operations listed below ✨
  • argp is a pointer to a data structure that's specific to op 🫢

The various ioctl(2) operations are described below. The UFFDIO_API, UFFDIO_REGISTER, and UFFDIO_UNREGISTER operations are used to configure userfaultfd behavior. These operations allow the caller to choose what features will be enabled and what kinds of events will be delivered to the application. The remaining operations are range operations. These operations enable the calling application to resolve page-fault events. πŸ’œ

🌈 the ops (each one has its own 2const page, go read those)


⭐ RETURN VALUE

  • on success? 0 comes back, slay πŸ’–
  • on error? you get -1, and errno gets set to tell you what went wrong 😭

πŸ’€ ERRORS

these are the general errors that can happen for, like, all of the operations above:

  • EFAULT β€” argp does not point to a valid memory address. nope, invalid memory, not today πŸ™ˆ
  • EINVAL β€” (For all operations except UFFDIO_API.) The userfaultfd object has not yet been enabled (via the UFFDIO_API operation). bestie you gotta enable it first!!

🌸 STANDARDS

Linux. πŸ’… periodt.


πŸ¦‹ EXAMPLES

See userfaultfd(2). that's it, that's the example, go look πŸ‘€


πŸŽ€ SEE ALSO


and that's the whole page, bestie!! 🫢 this lil masterpiece lives in Linux man-pages 6.20, dated 2026-06-04, and it's literally the ioctl_userfaultfd(2) page in all her glory πŸ‘‘ ty for coming to my ted talk, ily, go resolve some page faults πŸ’–βœ¨πŸŽ€

πŸ“¦ 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