interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

branch main Branches Tags History

omega-mv / seed / node / auth.om

881 lines · 20109 bytes Raw Blame History
1note Omega Node proposals, authority and cancellation (DRA-288). Concatenate
2note after transport.om, pool.om, super.om, sched.om and
3note seed/authority/action.om, before one program with fn main.
4note A worker proposes and the creator alone decides and commits. A proposal
5note is typed and bound to its operation identity, the job id and
6note assignment seq, the worker slot and incarnation, the input epoch and
7note version it read, and the authority generation it holds. Every effect is
8note one action record of seed/authority/action.om per operation identity:
9note started with actstart, closed with actrecon or actlost. A performed
10note operation is never started again and an UNKNOWN one is never retried;
11note one with no external effect (class 2) whose worker died is closed as
12note not performed, so it may run again.
13note Control page (16384 bytes), cell of worker w at 128*w. Creator writes
14note 0 control seq, 8 cancel target (assignment seq, 0 none), 16 decided
15note proposal seq, 24 verdict, 32 generation at the decision. Worker
16note writes 64 control ack seq, 72 proposal seq, 80 report seq, 88 report
17note outcome, 96 tool wait status, 104 paused as last seen, 112 running tool
18note pid (its process group), 120 tool output bytes held. Word 8192 mirrors
19note the authority generation and 8200 the paused flag.
20note Proposal page: 4096 bytes per worker at 4096*w. Words 0..15: 0 version
21note 1, 1 kind 1, 2 job id, 3 assignment seq, 4 slot, 5 incarnation, 6 input
22note epoch, 7 input version, 8 generation, 9..12 operation identity, 13 class
23note (1 external effect, 2 no external effect, 3 idempotent external effect
24note whose completion is visible as a key, see journal.om), 14 and 15 zero.
25note Bytes 128..4095 hold the running tool's output.
26note Verdicts: 0 granted, 1 malformed, 2 not the worker's assignment, 3 other
27note incarnation, 4 stale input, 5 stale authority, 6 cancelled, 7 already
28note performed or UNKNOWN, 8 attempt limit, 9 refused by the action contract.
29note Outcomes, as action.om receipts: 0 UNKNOWN, 1 not performed, 2 performed.
30text audevnul "/dev/null"
31global aumap long 2
32global auctl int 64
33global auinc ulong 64
34global augen ulong 1
35global aurec ulong 2048
36global auuse ulong 64
37global aujob ulong 64
38global aured ulong 64
39global aupf uchar 8
40global aufd int 1
41
42fn au_cell w ulong off ulong to ulong
43ret mapget get aumap 0 add mul w 128 off 8
44end
45
46fn au_set w ulong off ulong v ulong to void
47r = mapset get aumap 0 add mul w 128 off 8 v
48end
49
50fn au_pw w ulong i ulong to ulong
51ret mapget get aumap 1 add mul w 4096 mul i 8 8
52end
53
54fn au_spw w ulong i ulong v ulong to void
55r = mapset get aumap 1 add mul w 4096 mul i 8 8 v
56end
57
58fn au_pfd off ulong to int
59v = ulong get aupf off
60v = or v shl ulong get aupf add off 1 8
61v = or v shl ulong get aupf add off 2 16
62v = or v shl ulong get aupf add off 3 24
63ret int v
64end
65
66note Poll record at off; a negative fd keeps its bit pattern, so the kernel
67note ignores that record.
68fn au_lpfd p edit uchar 40 off ulong fd int to void
69u = bitcast uint fd
70for i ulong 4
71put p add off i uchar and shr u uint mul i 8 255
72end
73put p add off 4 1
74end
75
76note Creator, after sup_init and before any spawn: map the control and
77note proposal pages, one control eventfd per worker slot, generation 1.
78note 0, -6 not creator, or a negative errno.
79fn auth_new c long to long
80if not pool_mine c
81ret neg long 6
82end
83a = mapnew neg int 1 0 16384 3 33
84if le a 0
85ret a
86end
87b = mapnew neg int 1 0 262144 3 33
88if le b 0
89r = mapdrop a
90ret b
91end
92put aumap 0 a
93put aumap 1 b
94for i ulong 64
95put auctl i neg int 1
96put auinc i 0
97put auuse i 0
98put aujob i 0
99put aured i 0
100end
101n = mapget c 48 8
102for i ulong n bound 64
103e = eventfd uint 0
104if lt e 0
105x = auth_free
106ret e
107end
108put auctl i int e
109end
110put augen 0 1
111r = mapset a 8192 8 1
112r = mapset a 8200 8 0
113ret 0
114end
115
116note Creator: close the control eventfds and drop both pages.
117fn auth_free to long
118for i ulong 64
119if ge get auctl i 0
120r = fclose get auctl i
121end
122put auctl i neg int 1
123end
124r = mapdrop get aumap 1
125if lt r 0
126ret r
127end
128ret mapdrop get aumap 0
129end
130
131note Creator: start a new incarnation of worker slot w (sup_spawn). The child
132note inherits its incarnation number. 0 in the child, else as sup_spawn.
133fn auth_spawn c long w ulong to long
134if ge w 64
135ret neg long 7
136end
137if ne get swpid w 0
138ret neg long 16
139end
140put auinc w add get auinc w 1
141ret sup_spawn c w
142end
143
144note Creator: post control to worker w. A nonzero target asks it to cancel
145note that assignment. The state words go first, then the seq, then the hint.
146fn au_ctl w ulong target ulong to void
147if gt target 0
148au_set w 8 target
149end
150au_set w 0 add au_cell w 0 1
151r = node_notify get auctl w
152end
153
154note Worker w: bounded control handler. Records the paused flag it saw and
155note acknowledges the control seq; returns the cancel target (0 none).
156fn auth_wctl w ulong to ulong
157s = au_cell w 0
158au_set w 104 mapget get aumap 0 8200 8
159au_set w 64 s
160ret au_cell w 8
161end
162
163note Worker w: wait up to interval ns. 3 creator gone, 2 stop, 4 control,
164note 5 descriptor x readable or hung up (x negative: none), 1 work hint,
165note 0 timeout, or a negative errno. Creator loss outranks stop, stop
166note outranks control, control outranks output and work. Control and work
167note hints are drained; reread the shared state after any return.
168fn auth_wwait c long w ulong x int interval long to long
169p = new uchar 40 0
170if ge w 64
171ret neg long 7
172end
173iv = interval
174if pool_stopped c
175iv = long 0
176end
177au_lpfd p 0 get swwake w
178au_lpfd p 8 get swstop w
179au_lpfd p 16 get swpar 0
180au_lpfd p 24 get auctl w
181au_lpfd p 32 x
182r = pollfds p 0 40 iv
183if lt r 0
184ret r
185end
186if ne get p 22 0
187ret 3
188end
189if pool_stopped c
190ret 2
191end
192if ne and get p 14 1 0
193r = node_drain get swstop w
194ret 2
195end
196if ne get p 30 0
197r = node_drain get auctl w
198ret 4
199end
200if ne get p 38 0
201ret 5
202end
203if ne and get p 6 1 0
204r = node_drain get swwake w
205ret 1
206end
207ret 0
208end
209
210note Worker w: propose the effect of assignment q with operation identity
211note op and class (1 external effect, 2 none, 3 keyed idempotent). The words go first, then the
212note proposal seq, then an ack to the creator. 0 or the ack refusal.
213fn auth_propose w ulong q ulong op view ulong 4 class ulong to long
214if ge w 64
215ret neg long 7
216end
217au_spw w 0 1
218au_spw w 1 1
219au_spw w 2 sc_cell w 8
220au_spw w 3 q
221au_spw w 4 w
222au_spw w 5 get auinc w
223au_spw w 6 sc_cell w 16
224au_spw w 7 sc_cell w 24
225au_spw w 8 mapget get aumap 0 8192 8
226for i ulong 4
227au_spw w add 9 i get op i
228end
229au_spw w 13 class
230au_spw w 14 0
231au_spw w 15 0
232au_set w 72 q
233ret sup_ack w
234end
235
236note Worker w: wait up to interval ns for the decision on proposal q,
237note handling control meanwhile. The verdict (0 granted), 102 stop, 103
238note creator gone, 110 no decision yet, or a negative errno.
239fn auth_wdecide c long w ulong q ulong interval long to long
240dl = add ulong monons ulong interval
241for it ulong 100000000
242if eq au_cell w 16 q
243ret long au_cell w 24
244end
245now = ulong monons
246if ge now dl
247ret 110
248end
249r = auth_wwait c w neg int 1 long sub dl now
250if lt r 0
251ret r
252end
253if or eq r 2 eq r 3
254ret add 100 r
255end
256if eq r 4
257t = auth_wctl w
258end
259end
260ret 110
261end
262
263note Worker w: fork the packed argv pk (pn bytes) as the leader of a new
264note process group, stdin on /dev/null, stdout and stderr on a pipe whose
265note read end is left in aufd. Both sides call setpgid, so the group exists
266note before either side goes on. The pid, or a negative errno.
267fn au_fork w ulong pk view uchar 4096 pn ulong to long
268r = pipefds aupf 0 8 524288
269if lt r 0
270ret r
271end
272rfd = au_pfd 0
273wfd = au_pfd 4
274dn = fopen audevnul 0 len audevnul 524288 0
275pid = fork
276if eq pid 0
277r = setpgid 0 0
278r = dupfd wfd 1 0
279r = dupfd wfd 2 0
280if ge dn 0
281r = dupfd int dn 0 0
282end
283r = execprog pk 0 pn
284exit 127
285end
286r = fclose wfd
287if ge dn 0
288r = fclose int dn
289end
290if lt pid 0
291r = fclose rfd
292ret pid
293end
294r = setpgid int pid int pid
295au_set w 120 0
296au_set w 112 ulong pid
297put aufd 0 rfd
298ret pid
299end
300
301note Worker w: move available tool output into its proposal page from byte
302note 128 (bytes past 4096 are dropped). false at end of file or on error.
303fn au_out w ulong rfd int to bool
304buf = new uchar 4096 0
305n = read rfd buf 0 4096
306if eq n 0
307ret false
308end
309if lt n 0
310ret or eq n neg long 4 eq n neg long 11
311end
312k = au_cell w 120
313m = ulong n
314if gt add k m 3968
315m = sub 3968 k
316end
317if gt m 0
318h = get aumap 1
319off = add mul w 4096 add 128 k
320r = mapwrite h off buf 0 m
321au_set w 120 add k m
322end
323ret true
324end
325
326note Outcome of a reaped tool from its wait status: it exited, so it ran
327note (2); it was killed or crashed, so an external effect is UNKNOWN (0) and
328note a class 2 tool had none (1).
329fn au_outcome st ulong class ulong to long
330if eq and st 127 0
331ret 2
332end
333if eq class 2
334ret 1
335end
336ret 0
337end
338
339note Worker w: finish tool pid of assignment q. Without kill, wait for its
340note exit while still obeying control. With kill, a tool that has already
341note exited is not cancelled; otherwise SIGKILL its whole group. Its wait
342note status alone decides the outcome, never the fact that a kill was sent.
343note Group members left behind are killed either way.
344fn au_end c long w ulong q ulong pid long class ulong kill bool to long
345ws = new uchar 4 0
346k = kill
347g = long 0
348if not k
349for it ulong 100000000
350g = waitpid int pid ws 0 4 1
351if ne g 0
352break
353end
354r = auth_wwait c w neg int 1 5000000
355if eq r 4
356if eq auth_wctl w q
357k = true
358break
359end
360end
361if or eq r 2 eq r 3
362k = true
363break
364end
365end
366end
367if k
368g = waitpid int pid ws 0 4 1
369end
370if eq g 0
371r = killpid neg int pid 9
372if lt r 0
373r = killpid int pid 9
374end
375g = waitpid int pid ws 0 4 0
376else
377r = killpid neg int pid 9
378end
379r = fclose get aufd 0
380put aufd 0 neg int 1
381au_set w 112 0
382if lt g 0
383au_set w 96 65535
384ret 0
385end
386st = or ulong get ws 0 shl ulong get ws 1 8
387au_set w 96 st
388ret au_outcome st class
389end
390
391note Worker w: run the granted tool pk of assignment q (see au_fork). Its
392note output goes to the proposal page; cancellation of q, stop or creator
393note loss kill its process group. Returns the outcome: 1 when q was
394note cancelled before the tool started or the fork failed, else from
395note au_end. The wait status is in cell word 96.
396fn auth_wtool c long w ulong q ulong pk view uchar 4096 pn ulong class ulong to long
397if eq auth_wctl w q
398ret 1
399end
400pid = au_fork w pk pn
401if le pid 0
402ret 1
403end
404rfd = get aufd 0
405for it ulong 100000000
406r = auth_wwait c w rfd 1000000000
407if eq r 5
408if not au_out w rfd
409ret au_end c w q pid class false
410end
411end
412if eq r 4
413if eq auth_wctl w q
414ret au_end c w q pid class true
415end
416end
417if or eq r 2 eq r 3
418ret au_end c w q pid class true
419end
420if lt r 0
421ret au_end c w q pid class true
422end
423end
424ret au_end c w q pid class true
425end
426
427note Worker w: report the outcome of the granted tool of assignment q.
428fn auth_wreport w ulong q ulong outcome ulong to long
429au_set w 88 outcome
430au_set w 80 q
431ret sup_ack w
432end
433
434note Creator: the action slot whose operation identity is op, or -1.
435fn au_find op view ulong 4 to long
436for k ulong 64
437if ne get auuse k 0
438m = true
439for i ulong 4
440if ne get aurec add mul k 32 add 8 i get op i
441m = false
442end
443end
444if m
445ret long k
446end
447end
448end
449ret neg long 1
450end
451
452note Creator: a new ready action record for op and class in a free slot,
453note bound to the current generation; -1 when all 64 are in use.
454note Identities: operation and request op, scope node, provider class,
455note policy 1, grant 1. Attempt limit 3, epoch 1, no expiry in practice.
456fn au_alloc op view ulong 4 class ulong to long
457for k ulong 64
458if eq get auuse k 0
459b = mul k 32
460for i ulong 32
461put aurec add b i 0
462end
463put aurec b 1
464put aurec add b 1 1
465put aurec add b 3 3
466put aurec add b 4 get augen 0
467put aurec add b 5 1
468put aurec add b 6 9223372036854775807
469for i ulong 4
470put aurec add b add 8 i get op i
471put aurec add b add 12 i get op i
472end
473put aurec add b 16 1313817669
474put aurec add b 20 class
475put aurec add b 24 1
476put aurec add b 28 1
477put auuse k 1
478ret long k
479end
480end
481ret neg long 1
482end
483
484fn au_load k ulong r edit ulong 32 to void
485for i ulong 32
486put r i get aurec add mul k 32 i
487end
488end
489
490fn au_save k ulong r view ulong 32 to void
491for i ulong 32
492put aurec add mul k 32 i get r i
493end
494end
495
496note Creator: commit the start of the operation proposed by worker w.
497note A ready record moves to the current generation; actstart checks the
498note state, the attempt limit and the credential. The verdict.
499fn au_commit w ulong to ulong
500op = new ulong 4 0
501r = new ulong 32 0
502cr = new ulong 32 0
503for i ulong 4
504put op i au_pw w add 9 i
505end
506k = au_find op
507if lt k 0
508k = au_alloc op au_pw w 13
509if lt k 0
510ret 9
511end
512end
513au_load ulong k r
514if and eq get r 1 1 ne get r 4 get augen 0
515put r 4 get augen 0
516end
517for i ulong 32
518put cr i get r i
519end
520put cr 1 1
521put cr 2 1
522put cr 3 0
523put cr 4 get augen 0
524put cr 6 0
525put cr 7 0
526e = actstart r cr
527if eq e 0
528au_save ulong k r
529put aujob w add ulong k 1
530ret 0
531end
532if or eq e 21 eq e 22
533ret 7
534end
535if eq e 23
536ret 8
537end
538if eq e 31
539ret 5
540end
541ret 9
542end
543
544note Creator: a proposal is stale when the input it read is not the
545note assignment's, its epoch is no longer current, or a newer version on the
546note job's dependency topics has been published since.
547fn au_stale c long w ulong j ulong to bool
548if ne au_pw w 6 sc_cell w 16
549ret true
550end
551if ne au_pw w 7 sc_cell w 24
552ret true
553end
554if ne au_pw w 6 pool_epoch c
555ret true
556end
557t = get sjdep j
558if eq t 0
559ret false
560end
561h = pool_current c
562if le h 0
563ret true
564end
565ret ne node_next h au_pw w 7 t 0
566end
567
568note Creator: check the pending proposal of worker w; the verdict.
569fn au_valid c long w ulong to ulong
570q = au_cell w 72
571if or ne au_pw w 0 1 ne au_pw w 1 1
572ret 1
573end
574cl = au_pw w 13
575if or eq cl 0 gt cl 3
576ret 1
577end
578if or ne au_pw w 14 0 ne au_pw w 15 0
579ret 1
580end
581b = get scbusy w
582if eq b 0
583ret 2
584end
585j = sub b 1
586if ne get sjst j 3
587ret 2
588end
589if or ne au_pw w 3 q ne q sc_cell w 0
590ret 2
591end
592if or ne au_pw w 2 get sjid j ne au_pw w 4 w
593ret 2
594end
595if ne au_pw w 5 get auinc w
596ret 3
597end
598if au_stale c w j
599ret 4
600end
601if ne au_pw w 8 get augen 0
602ret 5
603end
604if eq au_cell w 8 q
605ret 6
606end
607ret 0
608end
609
610note Creator: decide worker w's pending proposal. A grant is journaled
611note (START, made durable) before the verdict is published; if the journal
612note refuses, the action is closed as not performed and the verdict is 9.
613fn au_decide c long w ulong to void
614q = au_cell w 72
615v = au_valid c w
616if eq v 0
617v = au_commit w
618end
619if eq v 0
620if ne au_jstart w 0
621e = au_recon sub get aujob w 1 1
622put aujob w 0
623v = 9
624end
625end
626if eq v 0
627jn_hit 2
628end
629au_set w 24 v
630au_set w 32 get augen 0
631au_set w 16 q
632r = sup_wake w
633end
634
635fn au_jstart w ulong to ulong
636op = new ulong 4 0
637k = sub get aujob w 1
638for i ulong 4
639put op i au_pw w add 9 i
640end
641b = mul k 32
642ret jn_start op au_pw w 13 au_pw w 2 get aurec add b 2 get aurec add b 4
643end
644
645note Journal DONE for the action in slot b-1 of worker w's job.
646fn au_jdone b ulong o ulong w ulong how ulong to ulong
647op = new ulong 4 0
648k = sub b 1
649for i ulong 4
650put op i get aurec add mul k 32 add 8 i
651end
652ret jn_done op o au_pw w 2 how
653end
654
655note Creator: apply receipt outcome o to action slot k (actrecon). An
656note outcome of 0 leaves the action UNKNOWN.
657fn au_recon k ulong o ulong to ulong
658r = new ulong 32 0
659s = new ulong 32 0
660au_load k r
661for i ulong 32
662put s i get r i
663end
664put s 0 1
665put s 1 o
666put s 3 1
667put s 6 0
668put s 7 0
669e = actrecon r s
670au_save k r
671ret e
672end
673
674note Creator: record worker w's report. DONE is made durable before the
675note action record changes; if the journal refuses, the report stays
676note unrecorded and is tried again at the next step.
677fn au_record w ulong to void
678b = get aujob w
679if eq b 0
680put aured w au_cell w 80
681ret
682end
683jn_hit 3
684if ne au_jdone b au_cell w 88 w 1 0
685ret
686end
687jn_hit 4
688put aured w au_cell w 80
689put aujob w 0
690e = au_recon sub b 1 au_cell w 88
691end
692
693note Creator, after worker w was reaped: kill the process group of a tool
694note it left running and close its in-flight action. One of class 2 (no
695note external effect) is not performed (DONE how 6, as jn_settle closes it
696note at a restart), so its rerunnable job may start again; any other is
697note UNKNOWN (actlost, DONE how 2) and never runs again (DRA-292).
698fn au_lost w ulong to void
699r = new ulong 32 0
700p = au_cell w 112
701if gt p 0
702x = killpid neg int p 9
703au_set w 112 0
704end
705b = get aujob w
706if eq b 0
707ret
708end
709k = sub b 1
710if eq get aurec add mul k 32 20 2
711if ne au_jdone b 1 w 6 0
712ret
713end
714put aujob w 0
715e = au_recon k 1
716ret
717end
718if ne au_jdone b 0 w 2 0
719ret
720end
721put aujob w 0
722au_load k r
723e = actlost r
724au_save k r
725end
726
727note Creator, after sched_step: make the dispatch decisions so far durable
728note (jn_drain), record tool reports, close the actions of reaped workers,
729note and decide pending proposals unless paused. Returns the number of
730note proposals decided.
731fn auth_step c long to ulong
732dr = jn_drain
733n = mapget c 48 8
734k = ulong 0
735for w ulong n bound 64
736if gt au_cell w 80 get aured w
737au_record w
738end
739if gt get swpid w 0
740if and eq get scpause 0 0 gt au_cell w 72 au_cell w 16
741au_decide c w
742k = add k 1
743end
744else
745au_lost w
746end
747end
748ret k
749end
750
751note Creator: revoke the current authority. The generation moves on, so a
752note pending or later proposal made under the old one is refused (5), and
753note every granted tool still running is told to cancel. Its outcome is
754note recorded as reported: performed if it had already exited, UNKNOWN if
755note it was killed. Returns the new generation, or 0 with nothing changed
756note when the journal refused REVOKE.
757fn auth_revoke c long to ulong
758g = add get augen 0 1
759if ne jn_rec 6 g 0 0 0
760ret 0
761end
762put augen 0 g
763r = mapset get aumap 0 8192 8 g
764n = mapget c 48 8
765for w ulong n bound 64
766if and gt get swpid w 0 gt get aujob w 0
767au_ctl w au_cell w 16
768end
769end
770ret g
771end
772
773note Creator: pause (on true) or resume. While paused no job is assigned and
774note no proposal is decided; running tools go on. Every live worker gets a
775note control notification and acknowledges it. Returns sched_pause's count,
776note or -5 with nothing changed when the journal refused PAUSE.
777fn auth_pause c long on bool to long
778v = ulong 0
779if on
780v = 1
781end
782if ne jn_rec 7 v 0 0 0
783ret neg long 5
784end
785r = mapset get aumap 0 8200 8 v
786n = mapget c 48 8
787for w ulong n bound 64
788if gt get swpid w 0
789au_ctl w 0
790end
791end
792ret long sched_pause c on
793end
794
795note Creator: cancel job j. 1 freed before it started (no effect), 2 its
796note worker was told to cancel and the outcome comes from its report (a
797note pending proposal is refused with 6), 3 already finished, 4 UNKNOWN,
798note -3 no such job. CANCEL is journaled first; a job freed before it
799note started is also released (outcome 300). -5 when the journal refused
800note CANCEL (nothing changed) or that RELEASE (the job is freed, and the
801note journal, now failed, releases it as cancelled at recovery).
802fn auth_cancel c long j ulong to long
803if ge j 64
804ret neg long 3
805end
806id = get sjid j
807if ne jn_rec 8 id 0 0 0
808ret neg long 5
809end
810s = sched_cancel j
811if eq s 1
812if ne jn_rec 5 id 300 0 0
813ret neg long 5
814end
815end
816if eq s 2
817w = get sjw j
818au_ctl w sc_cell w 0
819end
820ret s
821end
822
823note Creator, after auth_new, jn_open and sched_new, before any spawn:
824note settle and release from the journal (jn_recover), then install every
825note journaled action into the action records, move the generation past
826note every journaled one and restore the paused flag. 0 or an error.
827fn auth_recover c long to ulong
828e = jn_recover c
829if ne e 0
830ret e
831end
832op = new ulong 4 0
833for k ulong 64
834if ne jn_act k 0 0
835for i ulong 4
836put op i jn_act k add 1 i
837end
838s = au_alloc op jn_act k 5
839if lt s 0
840ret 32
841end
842b = mul ulong s 32
843put aurec add b 1 jn_act k 6
844put aurec add b 2 jn_act k 7
845put aurec add b 4 jn_act k 8
846end
847end
848put augen 0 jn_gen
849r = mapset get aumap 0 8192 8 jn_gen
850if ne jn_stat 2 0
851r = mapset get aumap 0 8200 8 1
852x = sched_pause c true
853end
854ret 0
855end
856
857note Creator: word i (0..31) of the action record for op, or -1 if none.
858fn auth_act op view ulong 4 i ulong to long
859k = au_find op
860if or lt k 0 gt i 31
861ret neg long 1
862end
863ret long get aurec add mul ulong k 32 i
864end
865
866note Worker w's control or proposal cell word, for the creator's view.
867fn auth_cell w ulong off ulong to ulong
868ret au_cell w off
869end
870
871note Copy up to 3968 bytes of worker w's tool output into dst; the count.
872fn auth_wout w ulong dst edit uchar 4096 to ulong
873n = au_cell w 120
874if gt n 3968
875n = 3968
876end
877if gt n 0
878r = mapread get aumap 1 add mul w 4096 128 dst 0 n
879end
880ret n
881end