PR_SET_ENDIAN(2const)

πŸŽ€ PR_SET_ENDIAN β€” the endianness glow-up πŸ’…

okay so this is from the PR_SET_ENDIAN(2const) manual page, and bestie, it's a whole little vibe. It lives in the Standard C library (libc, -lc) β€” yes, the standard girly. 🌸


✨ NAME ✨

PR_SET_ENDIAN β€” set endianness of the calling process πŸ¦‹

Lowkey the whole personality of this call: it flips your process's byte-order aesthetic. Big or little? That's the question. πŸ‘‘


✨ LIBRARY ✨

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


✨ SYNOPSIS ✨

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

int prctl(PR_SET_ENDIAN, long endianness);

Not me making you include two headers πŸ™ˆ but yes, both. linux/prctl.h is where the PR_* constants live, and sys/prctl.h is the actual prctl() doorway. You need them both, fr fr.


✨ DESCRIPTION ✨

So basically you're setting the endianness of the calling process to whatever value you pass in endianness. πŸŽ€

That endianness argument should be one of these three icons:

  • PR_ENDIAN_BIG β€” big endian energy πŸ”₯
  • PR_ENDIAN_LITTLE β€” little endian energy πŸ“
  • PR_ENDIAN_PPC_LITTLE β€” the PowerPC pseudo little endian one (iykyk, it's a whole special PowerPC situation) πŸ’œ
no cap, it needs to be one of those three β€” anything else and it's not going to go the way you want it to. See ERRORS below, bestie. 😭

✨ RETURN VALUE ✨

  • On success β†’ 0 is returned. slay. ✨
  • On error β†’ -1 is returned, and errno gets set to tell you what went wrong. πŸ’€

✨ ERRORS ✨

  • EINVAL β€” endianness is not a valid value. literally the only way this throws hands. 🫢

✨ STANDARDS ✨

Linux. And PowerPC only β€” this is not a general population call, it's giving exclusive invite. πŸ‘‘


✨ HISTORY ✨

Linux 2.6.18 (PowerPC). vintage. iconic. a classic. 🌈


✨ SEE ALSO ✨

(yes bestie, there's a getter β€” go read it, the pair is adorable πŸ₯°)


mwah πŸ’‹ this page is from Linux man-pages 6.20, dated 2026-02-08 β€” so you know it's fresh, it's current, and it's serving exactly what the kernel ordered. πŸ’–βœ¨πŸŽ€

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