UFFDIO_ZEROPAGE(2const)
π UFFDIO_ZEROPAGE π
okay bestie, so this is a page from the Linux man-pages (section 2const, the "these are the constants and structs that belong to a syscall" corner of the manual), and it's all about one very specific little ioctl called UFFDIO_ZEROPAGE. she zeroes out memory. that's her whole thing. and honestly? she ate. β¨
πΈ NAME πΈ
UFFDIO_ZEROPAGE β zero out a memory range registered with userfaultfd
π LIBRARY π
Standard C library (libc, -lc)
π SYNOPSIS π
#include <linux/userfaultfd.h> /* Definition of UFFD* constants */
#include <sys/ioctl.h>
int ioctl(int fd, UFFDIO_ZEROPAGE, struct uffdio_zeropage *argp);
#include <linux/userfaultfd.h>
struct uffdio_zeropage {
struct uffdio_range range;
__u64 mode; /* Flags controlling behavior */
__s64 zeropage; /* Number of bytes zeroed */
};
like. look at her. struct uffdio_range range, a mode for flags, and a zeropage that holds a byte count. it's giving "small but mighty". π«Ά
β¨ DESCRIPTION β¨
Zero out a memory range registered with userfaultfd. that's it, that's the job, and she does it flawlessly no cap. π
the following value may be bitwise ORed into mode to change the behavior of the UFFDIO_ZEROPAGE operation:
UFFDIO_ZEROPAGE_MODE_DONTWAKEβ Do not wake up the thread that waits for page-fault resolution. so basically "do the thing but don't ping anybody about it", lowkey antisocial but valid.
the zeropage field is how the kernel hands back the number of bytes that was actually zeroed β or an error, in the same manner as UFFDIO_COPY. and listen, this part is important: if the value returned in the zeropage field doesn't match the value that was specified in range.len, the operation fails with the error EAGAIN. π
also!! zeropage is output-only β it is not read by the UFFDIO_ZEROPAGE operation. so don't go filling it in and expecting the kernel to care, because she will not. π
π₯ RETURN VALUE π₯
this ioctl(2) operation returns 0 on success. and in that case? the entire area was zeroed. every last byte. iconic behavior. β¨
on error, -1 is returned and errno is set to indicate the error. π
π ERRORS π
EAGAINβ The number of bytes zeroed (i.e., the value returned in thezeropagefield) does not equal the value that was specified in therange.lenfield.EINVALβ Eitherrange.startorrange.lenwas not a multiple of the system page size; orrange.lenwas zero; or the range specified was invalid. so many ways to be wrong bestie, we hate to see it.EINVALβ An invalid bit was specified in themodefield.ESRCH(since Linux 4.13) β The faulting process has exited at the time of aUFFDIO_ZEROPAGEoperation. she's gone. the process literally left the chat. π
β STANDARDS β
Linux. periodt.
π¦ HISTORY π¦
Linux 4.3. a whole era. she's been around. π
π EXAMPLES π
See userfaultfd(2). (go read that one too, i'm not doing all the work for you π)
π SEE ALSO π
ioctl(2), ioctl_userfaultfd(2), userfaultfd(2)
linux.git/Documentation/admin-guide/mm/userfaultfd.rst
and that's the whole page bestie, mwah π this one came from Linux man-pages 6.20, dated 2026-02-08, and it's filed under UFFDIO_ZEROPAGE(2const). go zero some memory, you've got this. πππΈ
π¦ 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
- Copyright 2016, International Business Machines Corp
- Copyright 2016, Michael Kerrisk <mtk.manpages@gmail.com>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms