| | @@ -649,3 +649,28 @@ |
| 649 | 649 | Met in rrem's `RremUcd`, whose tables `tools/Ucd.raz` writes: before |
| 650 | 650 | the tool's first run, each table needs a placeholder of one element, |
| 651 | 651 | which the code reading it must then not take for a real one. |
| 652 | + |
| 653 | +## A file's link count |
| 654 | + |
| 655 | +`Sys.Info` names a file (`dev`, `ino`) but doesn't say how many names |
| 656 | +it has. A program that lets a writer loose in a directory of its own |
| 657 | +can't tell a file made there from a hard link to one somewhere else: |
| 658 | +both are regular files inside the directory, and writing to either |
| 659 | +writes to the one file. |
| 660 | + |
| 661 | +The proposal, in `Info`, beside `ino`: |
| 662 | + |
| 663 | +``` |
| 664 | +links*: U64; (* how many names the file has: 1 for a file no hard link shares *) |
| 665 | +``` |
| 666 | + |
| 667 | +filled in `fromStat` from `st_nlink`, which is `st[2]` on |
| 668 | +x86_64 Linux, as `st_ino` is `st[1]`. A field more in a record breaks |
| 669 | +only a program that builds an `Info` by a literal of all its fields, |
| 670 | +so it could come with a thaw. |
| 671 | + |
| 672 | +Met in arno: a conversation's scratch directory is the model's own, |
| 673 | +and its `edit`, `move` and `remove` there go ahead without asking. The |
| 674 | +Pascal arno refused that freedom for a file with a second link, which |
| 675 | +shares its contents with a name outside, perhaps one of the human's; |
| 676 | +the raz arno can't, until `Info` says how many links a file has. |