aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authoruser <user@clank>2026-09-24 23:08:35 +0200
committeruser <user@clank>2026-09-24 23:08:35 +0200
commit1430515ad419f2fddeb0265337a0da043901411b (patch)
treee94c53cb7d59ca4826242b81afeb3de3c655d02e /include
parentusr: touch, tr, rev, cut, uniq (diff)
downloadgbos-1430515ad419f2fddeb0265337a0da043901411b.tar.gz
gbos-1430515ad419f2fddeb0265337a0da043901411b.tar.xz
gbos-1430515ad419f2fddeb0265337a0da043901411b.zip
fs: hard links - ln(1), and rm that removes a NAME
gbfs has carried I_NLINK since the beginning and nothing ever incremented it, so a file could only have one name. SYS_LINK adds a second directory entry pointing at the same inode: the data is stored once, and both names read it. That makes rm's job different. It now decrements the link count and only frees the inode and its blocks when the LAST name goes - removing one of two links used to free blocks the other still pointed at. Refused, with the reasons that matter here: linking a directory (it would make a cycle the tree walkers cannot survive), an existing name, and anything under /bin, which is ROM. The syscall takes a request block because the trap needs HL for its dispatch table - and ln copies both paths to the stack first, since that block is a static living at $A000, on top of the command line it is reading.
Diffstat (limited to 'include')
-rw-r--r--include/gbos.inc14
1 files changed, 13 insertions, 1 deletions
diff --git a/include/gbos.inc b/include/gbos.inc
index a51dd31..24756e1 100644
--- a/include/gbos.inc
+++ b/include/gbos.inc
@@ -171,7 +171,10 @@ DEF SYS_UPTIME EQU 36 ; copy the 64 Hz tick counter (4B LE) to [DE]
DEF SYS_STAT EQU 37 ; stat a path (DE=&statreq -> A=0/$FF)
DEF SYS_FSSTAT EQU 38 ; filesystem totals (DE=buf[4] -> A=0)
DEF SYS_ISATTY EQU 39 ; is stdin the console? (-> A=1/0)
-DEF SYS_MAX EQU 40
+DEF SYS_LINK EQU 40 ; hard-link a file (DE=&linkreq -> A=0/$FF)
+DEF SYS_SETTIME EQU 41 ; set the wall clock (DE=buf[4], LE epoch)
+DEF SYS_GETTIME EQU 42 ; read the wall clock (DE=buf[4] -> A=1 if set)
+DEF SYS_MAX EQU 43
; ---- SYS_STAT request block (see fs.asm sys_stat) ---------------------------
; The syscall trap needs HL for its dispatch table, so a call that takes both a
@@ -343,5 +346,14 @@ DEF PROG_TR EQU 48
DEF PROG_REV EQU 49
DEF PROG_CUT EQU 50
DEF PROG_UNIQ EQU 51
+DEF PROG_SORT EQU 52
+DEF PROG_CMP EQU 53
+DEF PROG_STRINGS EQU 54
+DEF PROG_DU EQU 55
+DEF PROG_TIME EQU 56
+DEF PROG_CLEAR EQU 57
+DEF PROG_LN EQU 58
+DEF PROG_NTPDATE EQU 59
+DEF PROG_DATE EQU 60
ENDC