From 9da66e7b29d4a3625051619cec85fba16c86dc00 Mon Sep 17 00:00:00 2001 From: koniifer <koniifer@proton.me> Date: Thu, 30 Jan 2025 21:26:11 +0000 Subject: [PATCH] forgot to document --- sysdata/libraries/stn/src/process.hb | 1 + .../test/src/tests/stn/assets/lily.axe | Bin 6043 -> 575 bytes sysdata/programs/test/src/tests/stn/process.hb | 6 +++++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/sysdata/libraries/stn/src/process.hb b/sysdata/libraries/stn/src/process.hb index 23bc4f1..498d1b3 100644 --- a/sysdata/libraries/stn/src/process.hb +++ b/sysdata/libraries/stn/src/process.hb @@ -3,6 +3,7 @@ $spawn := fn(proc_exe: ^u8, length: uint): uint { return @eca(3, 6, proc_exe, length) } +// returns: 0 if child process, child PID if parent process $fork := fn(): uint return @eca(3, 7) /* TODO: diff --git a/sysdata/programs/test/src/tests/stn/assets/lily.axe b/sysdata/programs/test/src/tests/stn/assets/lily.axe index ff23ae1280245253d00e408a429ff4f5f2eb97b7..7c30ef360ea5a1592146d1e67e1ee73f786da6de 100644 GIT binary patch literal 575 zcmZ`$J5Iwu5FOhDjKn&oKt!VOY)1i-k3fM|M4Pw)1VtJ|ECtCT5Fv36Zb3!IMYsTG z-~tQJ@$5PcQ;g^H{N~N<!P^(XexlYB9d@68{Z&CJno;T8`)_Ae;m!m<qAGEvBsrCR zVtGf(RwojfSet}rhNFq54+yBVW9g-2^`68iABXZZ4w#&v<`bP8rZG*J>Xw6D9>A6d zo`c;el)>RKYmR4hF3;h>anx}L7Ry@RmIT!8?yaQ+jxHoxbDSbG5luIbfg{}t=$Z-- zNA=sEE_VA;#<lvysQ4m_%V8K%Wg*0jOnI)9(2=KWMJd%Qtd!do9JWw?kj*^a=KV|L mCdtg!&<xZJ`n3GFq5A1=RX@JmFCLotqHdby3BN8^&HN8{Hc+7e literal 6043 zcmdT|O^h5z6|SC{T@RM#$3Z~>p}2m!XJ=RZbi`V+;~adUG)ix`G7RzBVuidoiySG6 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zNW<EQbnM(UBmH%Vlu95skv2qdR~S(L00+3M{M>x=H18@aD{>+e{0oIbC{kp~K1NZU zFh!+;N)$}s124{tXOn?|M|lbSDTG&Z8Pr_rw$L4=*ZAIQfIj}v0u;6kfTk+}x)A{4 z&VW0BLS>(~0DTSPz|C19X52(+|AtE@D&+oGFo>=M(3@a{M(_%-^Uf034?6!-0p|@3 z1Tn(o)%*VE2X@~SBRA*58RzhSCB}2W|8q}_n}7R!5aR@Be+X>4Q{NLY-v8^}663W{ z5Tt}wG4MeS!oHa-#brKw&C}p2jv^{P|KF7UCq~)j!rFZ9m)sk5*;&qBGCe`mZ>unz zuT~h&cnTdk=2oz}8pQs;5S2R|*{}S?0vVt|h3&fqqYArnu>aIkmoM&LJ$Qm&*?)F* z<B5YOpMLV{!`zKtzCs<C5juZ(<zV52Mt^c}k&mDKrturBHV=<_r<>NnGe7>(CAhhI InPd8Y004l7g8%>k diff --git a/sysdata/programs/test/src/tests/stn/process.hb b/sysdata/programs/test/src/tests/stn/process.hb index 86a7bfa..0f01c94 100644 --- a/sysdata/programs/test/src/tests/stn/process.hb +++ b/sysdata/programs/test/src/tests/stn/process.hb @@ -9,7 +9,11 @@ opaque := fn(ptr: ^bool): bool { return *ptr } +// axe := @embed("assets/lily.axe") + test := fn(): uint { + // process.spawn(@bitcast(&axe), @sizeof(@TypeOf(axe))) + a: ^bool = @bitcast(memory.request_page(1, true)) x := process.fork() log.info("both will print this") @@ -19,7 +23,7 @@ test := fn(): uint { // ! NOTE: NEVER DO THIS!!! USE BUFFERS INSTEAD!!! :) // acts as a lock. when parent is done, this can go ahead. loop if opaque(a) break else { - }; + } log.info("child done.") } else { *a = true