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, 0 is returned. slay ✨
  • On error, -1 is returned, and errno is set to tell you exactly what went wrong. 😭

πŸ’€ ERRORS πŸ’€

  • EFAULT β€” flag is 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: flag has to be a real, valid address or you're getting EFAULT and 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
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms