GETCALLERPC(3)
β¨ NAME β¨
getcallerpc β fetch return PC of current function. This is the GETCALLERPC(3) manual page, bestie, and weβre about to get a little PC-coded. π
π SYNOPSIS π
#include <u.h>
#include <libc.h>
ulong getcallerpc(void *firstarg)
π DESCRIPTION π
Okay so Getcallerpc is a portable way to discover the PC to which the current function will return. Thatβs the whole assignment, no cap. β¨
firstarg should be a pointer to the first argument to the function in question. Thatβs it β pointer to the first arg, main character of the parameter list. π«Ά
πΈ EXAMPLE πΈ
Hereβs the example, exactly as the page gives it, bestie β donβt let the indentation vibe-check you:
void
printpc(ulong arg)
{
print("Called from %.8lux\n", getcallerpc(&arg));
}
void
main(int argc, char *argv[])
{
printpc(0);
printpc(0);
printpc(0);
}
π¦ SOURCE π¦
/src/lib9/
π BUGS π
ngl, the firstarg parameter should not be necessary. Thatβs the bug note, periodt. π
thatβs the whole page, bestie β GETCALLERPC(3) from the Library Functions Manual, source at /src/lib9/, and the footer gave us no date, so weβre not inventing one. π«Άπ
π¦ where this page comes from
- alpine 3.24: plan9port-doc 0_git20260208-r0 Β· LPL-1.02
- arch rolling: plan9port 20261021-2 Β· custom
- nixos 26.05: plan9port 0-unstable-2025-11-10
- nixos 26.05: plan9port-wayland 0-unstable-2025-11-26
- nixpkgs unstable: plan9port 0-unstable-2025-11-10
- nixpkgs unstable: plan9port-wayland 0-unstable-2025-11-26
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms