PR_SET_TSC(2const)
π
PR_SET_TSC (the 2const one, bestie)
okay so you know how prctl(2) has like a million little sub-commands and you're supposed to just know which one does what? yeah. this is one of them. it lives in the 2const corner of the manual, and honestly? she's a lil niche x86 queen. π
It's all about the timestamp counter β that RDTSC-ish thing your CPU keeps ticking away β and whether your process is allowed to read it. That's it. That's the whole job. π
β¨ NAME β¨
PR_SET_TSC β change whether the timestamp counter can be read by the process
yes literally that. no cap. π¦
π LIBRARY π
Standard C library (libc, -lc)
like every other normal human function, she's just chillin' in libc. π«Ά
πΈ SYNOPSIS πΈ
#include <linux/prctl.h> /* Definition of PR_* constants */
#include <sys/prctl.h>
int prctl(PR_SET_TSC, long flag);
so you're calling prctl (the big grab-bag syscall wrapper) and you're passing PR_SET_TSC as the operation, plus one long called flag. That flag is where you tell her what vibe you want. π«
π DESCRIPTION π
So what she does is: she sets the state of the flag that determines whether the timestamp counter can be read by the process. Think of it like a lil permission switch on your process, and the CPU's counter is the thing behind it. π
And you flip that switch with flag, and there are exactly two moods:
PR_TSC_ENABLEβ pass this and you're allowing the timestamp counter to be read. she's unlocked. go read it. β¨PR_TSC_SIGSEGVβ pass this and the process gets hit with aSIGSEGVthe moment it tries to read the timestamp counter. not a fun surprise. she said no. π
fr fr, that second one is not a gentle "permission denied" β it's a whole signal. so if you hand PR_TSC_SIGSEGV to some code that's just casually reading the TSC, you're gonna have a bad time. π
π₯ RETURN VALUE π₯
- On success:
0is returned. slay. β - On error:
-1is returned, anderrnogets set to tell you what went wrong. π
π ERRORS π
EINVALβflagis not a valid value.
that's it. that's the only one on the list. give her a flag she doesn't recognise and she simply Will Not. π
π STANDARDS π
- Linux.
- x86 only.
so if you're out here on some other architecture, bestie, this is not the page for you. x86 girlies only. π§
β HISTORY β
- Linux 2.6.26 (x86).
ancient by now but still iconic. π
π¦ SEE ALSO π¦
(that second one is the read-only sibling β she asks, this one tells. iykyk. π)
that's the whole page, every single detail intact, nothing skipped, she's fully unhinged but 100% accurate. π
smooches, and remember: read your man pages, check your errno, and never hand PR_TSC_SIGSEGV to a process that's just vibing. π
β¨
this lil love letter is from Linux man-pages 6.20, dated 2026-02-08 β mwah, bye 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
- 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