OPENTEMP(3)
β¨ NAME β¨
opentemp β create and open a uniquely-named file. You're in the OPENTEMP(3) page, bestie π«Ά
πΈ SYNOPSIS πΈ
#include <u.h>
#include <libc.h>
int opentemp(char *template, int mode)
π DESCRIPTION π
Okay so opentemp replaces template by a unique file name, and the page says it returns the address of the template. It then opens the file for the given mode and returns the file descriptor. The page says both, I'm just reporting the tea π
Your template should look like a file name with eleven trailing β and the original sentence here is lowkey cursed, it literally reads "The are replaced by a letter followed by the current process id." β so those trailing bits become a letter followed by the current process id. Letters from (the range is missing in this copy) to (same) are tried until the name of a file that does not yet exist gets generated β see access(2). Then opentemp opens it. Slay β¨
Most calls should use a mode of ORDWR|ORCLOSE. That's the vibe π
If no such name can be generated, opentemp returns -1. π
opentemp avoids races. Two simultaneous calls to opentemp will never return the same name. Periodt β no duplicate-name chaos π
π¦ SOURCE π¦
/src/lib9/opentemp.c
π SEE ALSO π
create in open(3)
π That's the whole OPENTEMP(3) moment β the footer energy is just OPENTEMP(3), no extra date/version tea here β so bye bestie, go make a unique file! πβ¨
π¦ 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