PR_SET_MM_BRK(2const)

πŸ’… PR_SET_MM_BRK β€” okay bestie, let's talk brk πŸ’…

so this is a page from the Linux man-pages collection β€” section 2const β€” and it's literally about how you, a totally normal process, can reach into the kernel and move your own memory map descriptor fields around. iconic behaviour, no cap.


✨ NAME ✨

PR_SET_MM_BRK β€” modify kernel memory map descriptor fields 🫢


πŸ“š LIBRARY πŸ“š

Standard C library (libc, -lc) β€” yeah, you gotta link it, obviously.


πŸŽ€ SYNOPSIS πŸŽ€

#include <linux/prctl.h>  /* Definition of PR_* constants */
#include <sys/prctl.h>

int prctl(PR_SET_MM, PR_SET_MM_BRK, unsigned long addr, 0L, 0L);

look at that. PR_SET_MM as the first arg, PR_SET_MM_BRK as the second, your addr, and then two whole 0Ls just vibing at the end. they're placeholders, bestie, don't worry about them πŸ’€


🌸 DESCRIPTION 🌸

So. This sets the current brk(2) value. That's the move. That's the whole thing. πŸ’–

And the way that the address has to behave? the requirements for the address are the same as for the PR_SET_MM_START_BRK option. same rules, different field β€” go read that page if you want the full tea on what addresses are acceptable 🧚


⭐ RETURN VALUE ⭐

  • On success, 0 is returned. slay ✨
  • On error, -1 is returned, and errno is set to indicate the error. (so check your errno, that's the whole point of it)

😭 ERRORS 😭

  • EINVAL β€” addr is greater than TASK_SIZE (the limit on the size of the user address space for this architecture). yes, there's a ceiling. you cannot just keep going up forever, bestie, this is not your situationship 🚩
  • EINVAL β€” addr is less than or equal to the end of the data segment, or specifies a value that would cause the RLIMIT_DATA resource limit to be exceeded. so it's either too low-key-low or it's gonna blow through your data limit. either way: nope πŸ’€
fr fr, both of these are EINVAL. don't go looking for a different errno, there isn't one.

πŸ‘‘ STANDARDS πŸ‘‘

Linux. that's it, that's the standard. iykyk 🐧


🌈 HISTORY 🌈

Linux 3.3. a classic. a vintage. an era πŸŽ€


πŸ”₯ SEE ALSO πŸ”₯


and that's the whole page, bestie!! this absolute banger of a man page is from Linux man-pages 6.20, dated 2026-02-08, and honestly it ate πŸ’…βœ¨ go move some memory map fields, you main character πŸ¦‹πŸ’–

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