GET9ROOT(3)
π GET9ROOT(3) β Library Functions Manual π
okay so bestie, welcome to the GET9ROOT(3) page from the Library Functions Manual. this one is literally about getting the path to the root of the Plan 9 tree, and it's giving niche-but-iconic. no cap. β¨
πΈ NAME πΈ
get9root, unsharp β get path to root of Plan 9 tree
β¨ SYNOPSIS β¨
#include <u.h>
#include <libc.h>
char* get9root(void)
char* unsharp(char *path)
π¦ DESCRIPTION π¦
So this tree of Plan 9 software is conventionally installed in but may be installed in other places β yes, the source lowkey leaves that first spot open, and we are not inventing a path, bestie β for example, users without the ability to write to /usr/local may wish to install it in their own home directories. The environment variable $PLAN9 should contain the path to the root.
get9root returns a static pointer to the pathname of root, first checking $PLAN9 and defaulting to .. static pointer, slay π
The lack of a fixed location for the Plan 9 tree makes it difficult to hard-code paths to files. unsharp replaces a leading #9 in path with the root of the tree. unsharp also replaces a leading #d with the path to the underlying system's file descriptor dup device, typically /dev/fd.
The string returned from unsharp, if different from path, should be freed with free (see malloc(3)) when no longer needed.
π¨ convention check: programs should never unsharp paths obtained from user input. periodt.
π EXAMPLE π
The plumber(4) uses this code to find unrooted file names included by plumb rules.
snprint(buf, sizeof buf, "#9/plumb/%s", name);
fd = open(unsharp(buf), OREAD);
π SOURCE π
/src/lib9/get9root.c/src/lib9/unsharp.c
π SEE ALSO π
π BUGS π
Get9root could be smarter about finding the tree when $PLAN9 is not set.
k bye bestie β this was GET9ROOT(3) from the Library Functions Manual, source/version GET9ROOT(3), and the footer didn't give us a date, so that's the whole vibe. stay iconic π«Άβ¨
π¦ 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