feat(shell): implement getcwd/chdir syscalls for shell navigation #89
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
cdandpwdcommandslsto list current directory by default instead of rootChanges
Kernel
cwdfield to Process struct (initialized to "/")sys_getcwd(syscall 79) - returns cwd in user buffer with POSIX pointer returnsys_chdir(syscall 80) - validates path exists and is directorysys_openusing process cwdShell
cdandpwdbuilt-in commands to init_shellls_cmdto default to "." (cwd) instead of "/" (root)Tests
cwd_test.rswith 7 comprehensive testsTest plan
cd /test && lsworks correctlypwdshows correct directory aftercd🤖 Generated with Claude Code
Note
Introduces filesystem navigation capabilities and wires them through kernel, libc, shell, and tests.
Process.cwd, implementsys_getcwd(79) andsys_chdir(80), wire in dispatcher/handler, addERANGE, makesys_openresolve relative paths viacwdwithnormalize_path, and ensure fork inheritscwdin all fork pathsprocess::getcwdandprocess::chdirwrappers; shell adds built-inscdandpwd;ls_cmddefaults to"."when no path is givencwd_testbinary with 7 checks (initial/, chdir success/ENOENT/ENOTDIR, relative.., fork inheritance, getcwd errors) and 8 new boot markers; kernel runstest_cwd; build script and Cargo wireddocs/planning/SHELL_AND_APPS_ROADMAP.mdoutlining roadmap for shell and third‑party appsWritten by Cursor Bugbot for commit ed02fe3. This will update automatically on new commits. Configure here.