spark-connector
aien-dev/spark-connector
Brought by drakestapleton
spark-connector / gates / hostile / fork.om
| 1 | note hostile probe: try to start 50 processes; prints how many forks succeeded |
| 2 | text m1 "forks " |
| 3 | text nl "\n" |
| 4 | fn main to int |
| 5 | d = new uchar 24 0 |
| 6 | ok = ulong 0 |
| 7 | for i ulong 50 |
| 8 | r = fork |
| 9 | if eq r 0 |
| 10 | exit 0 |
| 11 | end |
| 12 | if gt r 0 |
| 13 | ok = add ok 1 |
| 14 | end |
| 15 | end |
| 16 | k = write 1 m1 0 len m1 |
| 17 | v = ok |
| 18 | n = ulong 0 |
| 19 | put d 0 uchar add 48 div v 10 |
| 20 | put d 1 uchar add 48 rem v 10 |
| 21 | k = write 1 d 0 2 |
| 22 | k = write 1 nl 0 len nl |
| 23 | ret 0 |
| 24 | end |