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 β
0is returned. slay. β¨ - On error β
-1is returned, anderrnogets set to tell you what went wrong. π
β¨ ERRORS β¨
EINVALβendiannessis 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
- Copyright 2006-2015, 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