From aa7f5dff8f7131fcb9b38c115cf93554e9633641 Mon Sep 17 00:00:00 2001 From: Luis <42945842+ldiaz94@users.noreply.github.com> Date: Fri, 16 Oct 2026 15:06:53 +0100 Subject: [PATCH] PROPOSALS: a file's link count --- diff --git a/PROPOSALS.md b/PROPOSALS.md index b4c48f2..85ea96b 100644 --- a/PROPOSALS.md +++ b/PROPOSALS.md @@ -649,3 +649,28 @@ Met in rrem's `RremUcd`, whose tables `tools/Ucd.raz` writes: before the tool's first run, each table needs a placeholder of one element, which the code reading it must then not take for a real one. + +## A file's link count + +`Sys.Info` names a file (`dev`, `ino`) but doesn't say how many names +it has. A program that lets a writer loose in a directory of its own +can't tell a file made there from a hard link to one somewhere else: +both are regular files inside the directory, and writing to either +writes to the one file. + +The proposal, in `Info`, beside `ino`: + +``` +links*: U64; (* how many names the file has: 1 for a file no hard link shares *) +``` + +filled in `fromStat` from `st_nlink`, which is `st[2]` on +x86_64 Linux, as `st_ino` is `st[1]`. A field more in a record breaks +only a program that builds an `Info` by a literal of all its fields, +so it could come with a thaw. + +Met in arno: a conversation's scratch directory is the model's own, +and its `edit`, `move` and `remove` there go ahead without asking. The +Pascal arno refused that freedom for a file with a second link, which +shares its contents with a name outside, perhaps one of the human's; +the raz arno can't, until `Info` says how many links a file has.