PR_SET_UNALIGN(2const)

πŸ’… PR_SET_UNALIGN πŸ’…

okay bestie, welcome to the PR_SET_UNALIGN(2const) era of your life ✨ it's a prctl(2) constant, it lives in the Linux man-pages, and it is lowkey one of the most niche-but-iconic little ops you'll ever run. let's get into it πŸŽ€


🌸 NAME 🌸

PR_SET_UNALIGN β€” set unaligned access control bits πŸ¦‹


πŸ“š LIBRARY πŸ“š

Standard C library (libc, -lc) πŸ’–


✨ SYNOPSIS ✨

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

int prctl(PR_SET_UNALIGN, unsigned long flag);

like yes, it's a prctl call, but a very specific flavor of one πŸ“


🫢 DESCRIPTION 🫢

So basically, this sets the unaligned access control bits to arg2. That's the whole vibe check. πŸ‘‘

You pass in one of two named flags:

  • PR_UNALIGN_NOPRINT β€” this one makes the kernel silently fix up unaligned user accesses. no drama, no noise, just quietly handling it. 🀫
  • PR_UNALIGN_SIGBUS β€” this one says "nope, I'm gonna make a whole scene" and generates SIGBUS on unaligned user access. πŸ’€ dramatic but valid.

and THEN, plot twist 🎬 β€” Alpha also supports an additional flag with the value of 4, and it has no corresponding named constant (rude, honestly). it instructs the kernel to not fix up unaligned accesses at all. it's analogous to providing the UAC_NOFIX flag in the SSI_NVPAIRS operation of the setsysinfo() system call on Tru64. iykyk 🧚


⭐ RETURN VALUE ⭐

  • On success: 0 is returned. slay. βœ…
  • On error: -1 is returned, and errno is set to indicate the error. the audacity 😭

😭 ERRORS 😭

  • EINVAL β€” flag is not a valid value. bestie. that flag is not it. πŸ™ˆ

🌈 STANDARDS 🌈

Linux. πŸ’œ


πŸ‘‘ HISTORY πŸ‘‘

This one is only on:

  • ia64, since Linux 2.3.48
  • parisc, since Linux 2.6.15
  • PowerPC, since Linux 2.6.18
  • Alpha, since Linux 2.6.22
  • sh, since Linux 2.6.34
  • tile, since Linux 3.12

like it's giving architecture-exclusive ✨ main character energy only on those platforms ✨


πŸ”₯ SEE ALSO πŸ”₯


fr fr, if your arch isn't on that history list, this constant just isn't gonna hit the same. vibe check your architecture first πŸ’…

mwah πŸ’– this page came to you courtesy of Linux man-pages 6.20, dated 2026-02-08. go forth and align your accesses, bestie πŸ¦‹πŸŽ€πŸŒΈ

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