Skip to content

Commit a549484

Browse files
authored
Merge pull request #203 from ryanbreen/feat/bsh-default-shell
feat: make bsh (Breenish) the default boot shell
2 parents 0383167 + 84bfd61 commit a549484

File tree

3 files changed

+18
-12
lines changed

3 files changed

+18
-12
lines changed

docs/planning/BREENISH_SHELL_PLAN.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,17 @@
2929
- cd(), pwd(), which(), readFile(), writeFile(), exit() builtins
3030
- Auto-exec mode for bare commands; directory-aware prompt
3131
- 86 passing tests, bsh.elf cross-compiles to 303KB
32-
- **Phase 4**: IN PROGRESS -- Async/await (Promises, event loop)
32+
- **Phase 4**: COMPLETE (PRs #194-195) -- Async/await (Promises, event loop)
3333
- Promise object: PromiseState (Fulfilled/Rejected/Pending), ObjectKind::Promise
34-
- Promise.resolve(), Promise.reject(), Promise.all() as native functions
34+
- Promise.resolve(), Promise.reject(), Promise.all(), Promise.race(), Promise.allSettled()
3535
- Await opcode: extracts fulfilled value, throws on rejected, passes through non-promises
3636
- .then()/.catch()/.finally() built-in methods on Promise objects
3737
- Persistent globals with cross-pool property re-keying for Promise global
38-
- 94 passing tests, bsh.elf includes Promise builtins
39-
- **Phase 5**: IN PROGRESS -- Full shell experience
38+
- Async function declarations and async arrow functions
39+
- WrapPromise opcode for implicit Promise wrapping
40+
- pipe() native function for pipeline execution
41+
- 102 passing tests
42+
- **Phase 5**: COMPLETE (PRs #196-201) -- Full shell experience
4043
- JSON.parse/JSON.stringify with recursive descent JSON parser
4144
- Math object: floor, ceil, round, abs, min, max, pow, sqrt, random, log, trunc, PI, E
4245
- Number object: isInteger, isFinite, isNaN, parseInt, parseFloat
@@ -60,7 +63,10 @@
6063
- Map and Set collections with full method support (get/set/has/delete/size/clear/keys/values/forEach)
6164
- do...while loops with continue fix (deferred forward-jump patching)
6265
- 182 passing tests, bsh v0.5.0 with full shell builtins
63-
- **Phase 6**: PLANNED -- Advanced features (class, Proxy, JIT)
66+
- CI: ecosystem-tests job runs all 182 tests in GitHub Actions (PR #201)
67+
- aarch64: libbreenix-libc provides environ/pow/log for cross-compilation (PR #202)
68+
- **Default shell**: init.rs and telnetd.rs launch /bin/bsh instead of /bin/init_shell
69+
- **Phase 6**: PLANNED -- Advanced features (class, regex, modules, Proxy, JIT)
6470

6571
## Architecture
6672

userspace/programs/src/init.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
//!
55
//! Spawns:
66
//! - /sbin/telnetd (background service)
7-
//! - /bin/init_shell (foreground shell on serial console)
7+
//! - /bin/bsh (Breenish ECMAScript shell, foreground on serial console)
88
//!
99
//! Main loop reaps terminated children with waitpid(WNOHANG) and respawns
1010
//! crashed services.
1111
1212
use libbreenix::process::{fork, exec, waitpid, getpid, yield_now, ForkResult, WNOHANG};
1313

1414
const TELNETD_PATH: &[u8] = b"/sbin/telnetd\0";
15-
const SHELL_PATH: &[u8] = b"/bin/init_shell\0";
15+
const SHELL_PATH: &[u8] = b"/bin/bsh\0";
1616

1717
/// Fork and exec a binary. Returns the child PID on success, -1 on failure.
1818
fn spawn(path: &[u8], name: &str) -> i64 {
@@ -42,9 +42,9 @@ fn main() {
4242
print!("[init] Starting /sbin/telnetd...\n");
4343
let mut telnetd_pid = spawn(TELNETD_PATH, "telnetd");
4444

45-
// Start interactive shell
46-
print!("[init] Starting /bin/init_shell...\n");
47-
let mut shell_pid = spawn(SHELL_PATH, "init_shell");
45+
// Start Breenish shell
46+
print!("[init] Starting /bin/bsh...\n");
47+
let mut shell_pid = spawn(SHELL_PATH, "bsh");
4848

4949
// Main loop: reap zombies and respawn crashed services
5050
let mut status: i32 = 0;
@@ -56,7 +56,7 @@ fn main() {
5656
if reaped == shell_pid {
5757
// Shell exited -- respawn it
5858
print!("[init] Shell exited, respawning...\n");
59-
shell_pid = spawn(SHELL_PATH, "init_shell");
59+
shell_pid = spawn(SHELL_PATH, "bsh");
6060
} else if reaped == telnetd_pid {
6161
// Telnetd crashed -- respawn it
6262
print!("[init] telnetd exited, respawning...\n");

userspace/programs/src/telnetd.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use libbreenix::socket::{socket, bind_inet, listen, accept, SockAddrIn, AF_INET,
1414
use libbreenix::types::Fd;
1515

1616
const TELNET_PORT: u16 = 2323;
17-
const SHELL_PATH: &[u8] = b"/bin/init_shell\0";
17+
const SHELL_PATH: &[u8] = b"/bin/bsh\0";
1818

1919
// setsockopt constants (not yet in libbreenix)
2020
const SOL_SOCKET: i32 = 1;

0 commit comments

Comments
 (0)