PR_GET_TSC(2const)
π PR_GET_TSC(2const) π
okay bestie, gather round, because we're about to ask the kernel the most nosy little question: can I read the timestamp counter or not? π°οΈβ¨
This one lives in the PR_GET_TSC(2const) chapter of the man pages, ngl the name is giving very "cryptic constant energy" and I am obsessed.
πΈ NAME πΈ
PR_GET_TSC β get wether the timestamp counter can be read
(no I did not fix the typo, it's literally what the page says, we respect the source in this house π )
π LIBRARY π
Standard C library (libc, -lc) β your everyday bestie, nothing exotic here π«Ά
β¨ SYNOPSIS β¨
#include <linux/prctl.h> /* Definition of PR_* constants */
#include <sys/prctl.h>
int prctl(PR_GET_TSC, int *flag);
like, that's it. one call. one little int *. go off π¦
π DESCRIPTION π
So here's the tea: this call returns the state of the flag that decides whether the timestamp counter can be read, and it drops that state right into the location pointed to by flag. π
That's the whole job. It reads the vibe of the flag. It does not set anything. (If you wanna change it, that's a whole different bestie β see PR_SET_TSC(2const) down in SEE ALSO π)
π₯ RETURN VALUE π₯
- On success,
0is returned. slay β¨ - On error,
-1is returned, anderrnois set to tell you exactly what went wrong. π
π ERRORS π
EFAULTβflagis an invalid address. bestie. bestie no. that pointer is not pointing anywhere real π
π STANDARDS π
Linux. x86 only. so if you're on some other architecture, this is not your moment, sorry babe π
π§ HISTORY π§
Linux 2.6.26 (x86). vintage. iconic. still serving π
π SEE ALSO π
π«Ά little reminder:flaghas to be a real, valid address or you're gettingEFAULTand a sad little-1. check your pointers, queen.
k that's the whole page, ty for coming to my ted talk π this was Linux man-pages 6.20, dated 2026-02-08 β mwah, bye, go read the timestamp counter (if the flag says you can) πβ¨π
π¦ 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 2008, Erik Bosman <ejbosman@cs.vu.nl>
- Copyright 2008-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