mirror of
https://github.com/Leonmmcoset/cleonos.git
synced 2026-04-24 03:07:16 +00:00
Compare commits
36 Commits
XLeonOS
...
e7062c3045
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e7062c3045 | ||
|
|
af477d0602 | ||
|
|
8803d5a5d4 | ||
|
|
97a65b3580 | ||
|
|
1678af87b8 | ||
|
|
ddacc3e863 | ||
|
|
c587215e80 | ||
|
|
6b3c74f66f | ||
|
|
6a93335e53 | ||
|
|
8e968af551 | ||
|
|
2f0ee08485 | ||
|
|
e83b51f220 | ||
|
|
caf948f4f6 | ||
|
|
db1b849957 | ||
|
|
59b1b05e0d | ||
|
|
56bfa58e56 | ||
|
|
081b0d391a | ||
|
|
d4c2c62543 | ||
|
|
5817722cd3 | ||
|
|
bf6720c6e8 | ||
|
|
cb2406cbed | ||
|
|
42b5925222 | ||
|
|
f93af4a2a6 | ||
|
|
bf41872d8d | ||
|
|
589a83cb07 | ||
|
|
2d843a100e | ||
|
|
4eae6c34c4 | ||
|
|
643b26cfb2 | ||
|
|
af4ad36f6a | ||
|
|
25b2c080c1 | ||
|
|
8483ab7141 | ||
|
|
56ca2f5fdb | ||
|
|
3725203496 | ||
|
|
0a50c6a146 | ||
|
|
dad78c4f2e | ||
|
|
ceb04e9289 |
198
.VSCodeCounter/2026-04-17_16-44-24/details.md
Normal file
198
.VSCodeCounter/2026-04-17_16-44-24/details.md
Normal file
@@ -0,0 +1,198 @@
|
||||
# Details
|
||||
|
||||
Date : 2026-04-17 16:44:24
|
||||
|
||||
Directory d:\\Projects\\C\\cleonos
|
||||
|
||||
Total : 183 files, 22140 codes, 11 comments, 5616 blanks, all 27767 lines
|
||||
|
||||
[Summary](results.md) / Details / [Diff Summary](diff.md) / [Diff Details](diff-details.md)
|
||||
|
||||
## Files
|
||||
| filename | language | code | comment | blank | total |
|
||||
| :--- | :--- | ---: | ---: | ---: | ---: |
|
||||
| [.github/workflows/build-os.yml](/.github/workflows/build-os.yml) | YAML | 48 | 0 | 10 | 58 |
|
||||
| [CMakeLists.txt](/CMakeLists.txt) | CMake | 587 | 0 | 86 | 673 |
|
||||
| [Makefile](/Makefile) | Makefile | 100 | 0 | 22 | 122 |
|
||||
| [README.md](/README.md) | Markdown | 92 | 0 | 34 | 126 |
|
||||
| [README.zh-CN.md](/README.zh-CN.md) | Markdown | 92 | 0 | 34 | 126 |
|
||||
| [cleonos/c/apps/ansi\_main.c](/cleonos/c/apps/ansi_main.c) | C | 43 | 0 | 11 | 54 |
|
||||
| [cleonos/c/apps/ansitest\_main.c](/cleonos/c/apps/ansitest_main.c) | C | 142 | 0 | 35 | 177 |
|
||||
| [cleonos/c/apps/append\_main.c](/cleonos/c/apps/append_main.c) | C | 74 | 0 | 18 | 92 |
|
||||
| [cleonos/c/apps/args\_main.c](/cleonos/c/apps/args_main.c) | C | 49 | 0 | 13 | 62 |
|
||||
| [cleonos/c/apps/cat\_main.c](/cleonos/c/apps/cat_main.c) | C | 83 | 0 | 24 | 107 |
|
||||
| [cleonos/c/apps/cd\_main.c](/cleonos/c/apps/cd_main.c) | C | 54 | 0 | 15 | 69 |
|
||||
| [cleonos/c/apps/clear\_main.c](/cleonos/c/apps/clear_main.c) | C | 39 | 0 | 11 | 50 |
|
||||
| [cleonos/c/apps/cmd\_runtime.c](/cleonos/c/apps/cmd_runtime.c) | C | 446 | 0 | 143 | 589 |
|
||||
| [cleonos/c/apps/cmd\_runtime.h](/cleonos/c/apps/cmd_runtime.h) | C++ | 80 | 0 | 19 | 99 |
|
||||
| [cleonos/c/apps/cp\_main.c](/cleonos/c/apps/cp_main.c) | C | 95 | 0 | 26 | 121 |
|
||||
| [cleonos/c/apps/cut\_main.c](/cleonos/c/apps/cut_main.c) | C | 214 | 1 | 55 | 270 |
|
||||
| [cleonos/c/apps/dmesg\_main.c](/cleonos/c/apps/dmesg_main.c) | C | 64 | 0 | 18 | 82 |
|
||||
| [cleonos/c/apps/elfrunner\_kmain.c](/cleonos/c/apps/elfrunner_kmain.c) | C | 6 | 0 | 3 | 9 |
|
||||
| [cleonos/c/apps/elfrunner\_main.c](/cleonos/c/apps/elfrunner_main.c) | C | 6 | 0 | 3 | 9 |
|
||||
| [cleonos/c/apps/exec\_main.c](/cleonos/c/apps/exec_main.c) | C | 87 | 0 | 22 | 109 |
|
||||
| [cleonos/c/apps/exit\_main.c](/cleonos/c/apps/exit_main.c) | C | 54 | 0 | 14 | 68 |
|
||||
| [cleonos/c/apps/fastfetch\_main.c](/cleonos/c/apps/fastfetch_main.c) | C | 180 | 0 | 34 | 214 |
|
||||
| [cleonos/c/apps/fsstat\_main.c](/cleonos/c/apps/fsstat_main.c) | C | 45 | 0 | 11 | 56 |
|
||||
| [cleonos/c/apps/grep\_main.c](/cleonos/c/apps/grep_main.c) | C | 195 | 0 | 54 | 249 |
|
||||
| [cleonos/c/apps/head\_main.c](/cleonos/c/apps/head_main.c) | C | 164 | 0 | 47 | 211 |
|
||||
| [cleonos/c/apps/hello\_main.c](/cleonos/c/apps/hello_main.c) | C | 6 | 0 | 2 | 8 |
|
||||
| [cleonos/c/apps/help\_main.c](/cleonos/c/apps/help_main.c) | C | 75 | 0 | 10 | 85 |
|
||||
| [cleonos/c/apps/kbdstat\_main.c](/cleonos/c/apps/kbdstat_main.c) | C | 44 | 0 | 11 | 55 |
|
||||
| [cleonos/c/apps/ls\_main.c](/cleonos/c/apps/ls_main.c) | C | 262 | 0 | 76 | 338 |
|
||||
| [cleonos/c/apps/memc\_kmain.c](/cleonos/c/apps/memc_kmain.c) | C | 6 | 0 | 3 | 9 |
|
||||
| [cleonos/c/apps/memc\_main.c](/cleonos/c/apps/memc_main.c) | C | 8 | 0 | 3 | 11 |
|
||||
| [cleonos/c/apps/memstat\_main.c](/cleonos/c/apps/memstat_main.c) | C | 43 | 0 | 11 | 54 |
|
||||
| [cleonos/c/apps/mkdir\_main.c](/cleonos/c/apps/mkdir_main.c) | C | 57 | 0 | 16 | 73 |
|
||||
| [cleonos/c/apps/mv\_main.c](/cleonos/c/apps/mv_main.c) | C | 102 | 0 | 28 | 130 |
|
||||
| [cleonos/c/apps/pid\_main.c](/cleonos/c/apps/pid_main.c) | C | 39 | 0 | 11 | 50 |
|
||||
| [cleonos/c/apps/pwd\_main.c](/cleonos/c/apps/pwd_main.c) | C | 39 | 0 | 11 | 50 |
|
||||
| [cleonos/c/apps/restart\_main.c](/cleonos/c/apps/restart_main.c) | C | 40 | 0 | 11 | 51 |
|
||||
| [cleonos/c/apps/rm\_main.c](/cleonos/c/apps/rm_main.c) | C | 57 | 0 | 16 | 73 |
|
||||
| [cleonos/c/apps/shell/shell\_cmd.c](/cleonos/c/apps/shell/shell_cmd.c) | C | 2,311 | 0 | 574 | 2,885 |
|
||||
| [cleonos/c/apps/shell/shell\_external.c](/cleonos/c/apps/shell/shell_external.c) | C | 166 | 0 | 55 | 221 |
|
||||
| [cleonos/c/apps/shell/shell\_input.c](/cleonos/c/apps/shell/shell_input.c) | C | 514 | 0 | 132 | 646 |
|
||||
| [cleonos/c/apps/shell/shell\_internal.h](/cleonos/c/apps/shell/shell_internal.h) | C++ | 92 | 0 | 20 | 112 |
|
||||
| [cleonos/c/apps/shell/shell\_path.c](/cleonos/c/apps/shell/shell_path.c) | C | 153 | 0 | 50 | 203 |
|
||||
| [cleonos/c/apps/shell/shell\_script.c](/cleonos/c/apps/shell/shell_script.c) | C | 35 | 0 | 12 | 47 |
|
||||
| [cleonos/c/apps/shell/shell\_util.c](/cleonos/c/apps/shell/shell_util.c) | C | 283 | 0 | 86 | 369 |
|
||||
| [cleonos/c/apps/shell\_main.c](/cleonos/c/apps/shell_main.c) | C | 19 | 0 | 6 | 25 |
|
||||
| [cleonos/c/apps/shstat\_main.c](/cleonos/c/apps/shstat_main.c) | C | 45 | 0 | 11 | 56 |
|
||||
| [cleonos/c/apps/shutdown\_main.c](/cleonos/c/apps/shutdown_main.c) | C | 40 | 0 | 11 | 51 |
|
||||
| [cleonos/c/apps/sleep\_main.c](/cleonos/c/apps/sleep_main.c) | C | 52 | 0 | 14 | 66 |
|
||||
| [cleonos/c/apps/sort\_main.c](/cleonos/c/apps/sort_main.c) | C | 205 | 0 | 63 | 268 |
|
||||
| [cleonos/c/apps/spawn\_main.c](/cleonos/c/apps/spawn_main.c) | C | 76 | 0 | 20 | 96 |
|
||||
| [cleonos/c/apps/stats\_main.c](/cleonos/c/apps/stats_main.c) | C | 102 | 0 | 17 | 119 |
|
||||
| [cleonos/c/apps/tail\_main.c](/cleonos/c/apps/tail_main.c) | C | 190 | 0 | 54 | 244 |
|
||||
| [cleonos/c/apps/taskstat\_main.c](/cleonos/c/apps/taskstat_main.c) | C | 43 | 0 | 11 | 54 |
|
||||
| [cleonos/c/apps/touch\_main.c](/cleonos/c/apps/touch_main.c) | C | 58 | 0 | 16 | 74 |
|
||||
| [cleonos/c/apps/tty\_main.c](/cleonos/c/apps/tty_main.c) | C | 64 | 0 | 17 | 81 |
|
||||
| [cleonos/c/apps/ttydrv\_main.c](/cleonos/c/apps/ttydrv_main.c) | C | 6 | 0 | 3 | 9 |
|
||||
| [cleonos/c/apps/uniq\_main.c](/cleonos/c/apps/uniq_main.c) | C | 168 | 0 | 48 | 216 |
|
||||
| [cleonos/c/apps/userstat\_main.c](/cleonos/c/apps/userstat_main.c) | C | 48 | 0 | 11 | 59 |
|
||||
| [cleonos/c/apps/wait\_main.c](/cleonos/c/apps/wait_main.c) | C | 68 | 0 | 17 | 85 |
|
||||
| [cleonos/c/apps/wavplay\_main.c](/cleonos/c/apps/wavplay_main.c) | C | 396 | 0 | 99 | 495 |
|
||||
| [cleonos/c/apps/wc\_main.c](/cleonos/c/apps/wc_main.c) | C | 164 | 0 | 45 | 209 |
|
||||
| [cleonos/c/apps/write\_main.c](/cleonos/c/apps/write_main.c) | C | 74 | 0 | 18 | 92 |
|
||||
| [cleonos/c/apps/yield\_main.c](/cleonos/c/apps/yield_main.c) | C | 39 | 0 | 11 | 50 |
|
||||
| [cleonos/c/include/cleonos\_rust\_bridge.h](/cleonos/c/include/cleonos_rust_bridge.h) | C++ | 6 | 0 | 4 | 10 |
|
||||
| [cleonos/c/include/cleonos\_syscall.h](/cleonos/c/include/cleonos_syscall.h) | C++ | 128 | 0 | 6 | 134 |
|
||||
| [cleonos/c/src/runtime.c](/cleonos/c/src/runtime.c) | C | 37 | 0 | 12 | 49 |
|
||||
| [cleonos/c/src/syscall.c](/cleonos/c/src/syscall.c) | C | 191 | 0 | 64 | 255 |
|
||||
| [cleonos/c/stub.c](/cleonos/c/stub.c) | C | 3 | 4 | 2 | 9 |
|
||||
| [cleonos/rust/src/lib.rs](/cleonos/rust/src/lib.rs) | Rust | 23 | 0 | 9 | 32 |
|
||||
| [clks/arch/aarch64/boot.c](/clks/arch/aarch64/boot.c) | C | 6 | 0 | 1 | 7 |
|
||||
| [clks/arch/x86\_64/boot.c](/clks/arch/x86_64/boot.c) | C | 6 | 0 | 1 | 7 |
|
||||
| [clks/arch/x86\_64/exec\_stack\_call.S](/clks/arch/x86_64/exec_stack_call.S) | Go Assembly | 22 | 0 | 8 | 30 |
|
||||
| [clks/arch/x86\_64/interrupt\_stubs.S](/clks/arch/x86_64/interrupt_stubs.S) | Go Assembly | 108 | 0 | 12 | 120 |
|
||||
| [clks/drivers/audio/pcspeaker.c](/clks/drivers/audio/pcspeaker.c) | C | 101 | 0 | 25 | 126 |
|
||||
| [clks/drivers/serial/serial.c](/clks/drivers/serial/serial.c) | C | 52 | 0 | 16 | 68 |
|
||||
| [clks/drivers/video/font8x8.c](/clks/drivers/video/font8x8.c) | C | 67 | 0 | 8 | 75 |
|
||||
| [clks/drivers/video/font8x8.h](/clks/drivers/video/font8x8.h) | C++ | 5 | 0 | 3 | 8 |
|
||||
| [clks/drivers/video/framebuffer.c](/clks/drivers/video/framebuffer.c) | C | 251 | 0 | 70 | 321 |
|
||||
| [clks/drivers/video/psf\_font.c](/clks/drivers/video/psf_font.c) | C | 230 | 0 | 56 | 286 |
|
||||
| [clks/drivers/video/psf\_font.h](/clks/drivers/video/psf_font.h) | C++ | 15 | 0 | 5 | 20 |
|
||||
| [clks/include/clks/audio.h](/clks/include/clks/audio.h) | C++ | 9 | 0 | 3 | 12 |
|
||||
| [clks/include/clks/boot.h](/clks/include/clks/boot.h) | C++ | 11 | 0 | 4 | 15 |
|
||||
| [clks/include/clks/compiler.h](/clks/include/clks/compiler.h) | C++ | 13 | 0 | 4 | 17 |
|
||||
| [clks/include/clks/cpu.h](/clks/include/clks/cpu.h) | C++ | 20 | 0 | 4 | 24 |
|
||||
| [clks/include/clks/desktop.h](/clks/include/clks/desktop.h) | C++ | 7 | 0 | 4 | 11 |
|
||||
| [clks/include/clks/driver.h](/clks/include/clks/driver.h) | C++ | 29 | 0 | 8 | 37 |
|
||||
| [clks/include/clks/elf64.h](/clks/include/clks/elf64.h) | C++ | 32 | 0 | 9 | 41 |
|
||||
| [clks/include/clks/elfrunner.h](/clks/include/clks/elfrunner.h) | C++ | 6 | 0 | 3 | 9 |
|
||||
| [clks/include/clks/exec.h](/clks/include/clks/exec.h) | C++ | 34 | 0 | 4 | 38 |
|
||||
| [clks/include/clks/framebuffer.h](/clks/include/clks/framebuffer.h) | C++ | 26 | 0 | 6 | 32 |
|
||||
| [clks/include/clks/fs.h](/clks/include/clks/fs.h) | C++ | 23 | 0 | 7 | 30 |
|
||||
| [clks/include/clks/heap.h](/clks/include/clks/heap.h) | C++ | 15 | 0 | 4 | 19 |
|
||||
| [clks/include/clks/interrupts.h](/clks/include/clks/interrupts.h) | C++ | 6 | 0 | 3 | 9 |
|
||||
| [clks/include/clks/kelf.h](/clks/include/clks/kelf.h) | C++ | 9 | 0 | 5 | 14 |
|
||||
| [clks/include/clks/kernel.h](/clks/include/clks/kernel.h) | C++ | 4 | 0 | 2 | 6 |
|
||||
| [clks/include/clks/keyboard.h](/clks/include/clks/keyboard.h) | C++ | 27 | 0 | 6 | 33 |
|
||||
| [clks/include/clks/limine.h](/clks/include/clks/limine.h) | C++ | 132 | 0 | 24 | 156 |
|
||||
| [clks/include/clks/log.h](/clks/include/clks/log.h) | C++ | 14 | 0 | 5 | 19 |
|
||||
| [clks/include/clks/mouse.h](/clks/include/clks/mouse.h) | C++ | 20 | 0 | 6 | 26 |
|
||||
| [clks/include/clks/panic.h](/clks/include/clks/panic.h) | C++ | 7 | 0 | 3 | 10 |
|
||||
| [clks/include/clks/pmm.h](/clks/include/clks/pmm.h) | C++ | 16 | 0 | 5 | 21 |
|
||||
| [clks/include/clks/ramdisk.h](/clks/include/clks/ramdisk.h) | C++ | 17 | 0 | 8 | 25 |
|
||||
| [clks/include/clks/scheduler.h](/clks/include/clks/scheduler.h) | C++ | 18 | 0 | 5 | 23 |
|
||||
| [clks/include/clks/serial.h](/clks/include/clks/serial.h) | C++ | 6 | 0 | 2 | 8 |
|
||||
| [clks/include/clks/service.h](/clks/include/clks/service.h) | C++ | 31 | 0 | 8 | 39 |
|
||||
| [clks/include/clks/shell.h](/clks/include/clks/shell.h) | C++ | 7 | 0 | 3 | 10 |
|
||||
| [clks/include/clks/string.h](/clks/include/clks/string.h) | C++ | 9 | 0 | 3 | 12 |
|
||||
| [clks/include/clks/syscall.h](/clks/include/clks/syscall.h) | C++ | 68 | 0 | 5 | 73 |
|
||||
| [clks/include/clks/task.h](/clks/include/clks/task.h) | C++ | 24 | 0 | 7 | 31 |
|
||||
| [clks/include/clks/tty.h](/clks/include/clks/tty.h) | C++ | 14 | 0 | 4 | 18 |
|
||||
| [clks/include/clks/types.h](/clks/include/clks/types.h) | C++ | 17 | 0 | 6 | 23 |
|
||||
| [clks/include/clks/userland.h](/clks/include/clks/userland.h) | C++ | 12 | 0 | 4 | 16 |
|
||||
| [clks/kernel/desktop.c](/clks/kernel/desktop.c) | C | 321 | 0 | 86 | 407 |
|
||||
| [clks/kernel/driver.c](/clks/kernel/driver.c) | C | 169 | 0 | 49 | 218 |
|
||||
| [clks/kernel/elf64.c](/clks/kernel/elf64.c) | C | 239 | 0 | 73 | 312 |
|
||||
| [clks/kernel/elfrunner.c](/clks/kernel/elfrunner.c) | C | 30 | 0 | 8 | 38 |
|
||||
| [clks/kernel/exec.c](/clks/kernel/exec.c) | C | 854 | 0 | 237 | 1,091 |
|
||||
| [clks/kernel/fs.c](/clks/kernel/fs.c) | C | 698 | 0 | 220 | 918 |
|
||||
| [clks/kernel/heap.c](/clks/kernel/heap.c) | C | 134 | 0 | 42 | 176 |
|
||||
| [clks/kernel/interrupts.c](/clks/kernel/interrupts.c) | C | 311 | 0 | 44 | 355 |
|
||||
| [clks/kernel/kelf.c](/clks/kernel/kelf.c) | C | 203 | 1 | 53 | 257 |
|
||||
| [clks/kernel/keyboard.c](/clks/kernel/keyboard.c) | C | 311 | 0 | 79 | 390 |
|
||||
| [clks/kernel/kmain.c](/clks/kernel/kmain.c) | C | 200 | 1 | 52 | 253 |
|
||||
| [clks/kernel/limine\_requests.c](/clks/kernel/limine_requests.c) | C | 76 | 0 | 26 | 102 |
|
||||
| [clks/kernel/log.c](/clks/kernel/log.c) | C | 123 | 0 | 33 | 156 |
|
||||
| [clks/kernel/mouse.c](/clks/kernel/mouse.c) | C | 246 | 0 | 63 | 309 |
|
||||
| [clks/kernel/panic.c](/clks/kernel/panic.c) | C | 179 | 0 | 60 | 239 |
|
||||
| [clks/kernel/pmm.c](/clks/kernel/pmm.c) | C | 82 | 0 | 23 | 105 |
|
||||
| [clks/kernel/ramdisk.c](/clks/kernel/ramdisk.c) | C | 172 | 0 | 50 | 222 |
|
||||
| [clks/kernel/scheduler.c](/clks/kernel/scheduler.c) | C | 136 | 0 | 44 | 180 |
|
||||
| [clks/kernel/service.c](/clks/kernel/service.c) | C | 113 | 0 | 34 | 147 |
|
||||
| [clks/kernel/shell.c](/clks/kernel/shell.c) | C | 1,249 | 0 | 317 | 1,566 |
|
||||
| [clks/kernel/syscall.c](/clks/kernel/syscall.c) | C | 619 | 0 | 140 | 759 |
|
||||
| [clks/kernel/tty.c](/clks/kernel/tty.c) | C | 1,115 | 0 | 275 | 1,390 |
|
||||
| [clks/kernel/userland.c](/clks/kernel/userland.c) | C | 124 | 0 | 35 | 159 |
|
||||
| [clks/lib/libc\_compat.c](/clks/lib/libc_compat.c) | C | 25 | 0 | 7 | 32 |
|
||||
| [clks/lib/string.c](/clks/lib/string.c) | C | 54 | 0 | 16 | 70 |
|
||||
| [clks/rust/src/lib.rs](/clks/rust/src/lib.rs) | Rust | 21 | 0 | 6 | 27 |
|
||||
| [cmake/check\_tools.cmake](/cmake/check_tools.cmake) | CMake | 32 | 0 | 6 | 38 |
|
||||
| [cmake/log.cmake](/cmake/log.cmake) | CMake | 30 | 0 | 6 | 36 |
|
||||
| [cmake/log\_emit.cmake](/cmake/log_emit.cmake) | CMake | 23 | 0 | 6 | 29 |
|
||||
| [cmake/setup\_limine.cmake](/cmake/setup_limine.cmake) | CMake | 100 | 0 | 18 | 118 |
|
||||
| [configs/limine.conf](/configs/limine.conf) | Properties | 6 | 0 | 1 | 7 |
|
||||
| [docs/README.md](/docs/README.md) | Markdown | 31 | 0 | 4 | 35 |
|
||||
| [docs/stage1.md](/docs/stage1.md) | Markdown | 41 | 0 | 5 | 46 |
|
||||
| [docs/stage10.md](/docs/stage10.md) | Markdown | 34 | 0 | 6 | 40 |
|
||||
| [docs/stage11.md](/docs/stage11.md) | Markdown | 36 | 0 | 5 | 41 |
|
||||
| [docs/stage12.md](/docs/stage12.md) | Markdown | 40 | 0 | 6 | 46 |
|
||||
| [docs/stage13.md](/docs/stage13.md) | Markdown | 34 | 0 | 6 | 40 |
|
||||
| [docs/stage14.md](/docs/stage14.md) | Markdown | 44 | 0 | 8 | 52 |
|
||||
| [docs/stage15.md](/docs/stage15.md) | Markdown | 47 | 0 | 7 | 54 |
|
||||
| [docs/stage2.md](/docs/stage2.md) | Markdown | 30 | 0 | 5 | 35 |
|
||||
| [docs/stage20.md](/docs/stage20.md) | Markdown | 46 | 0 | 6 | 52 |
|
||||
| [docs/stage21.md](/docs/stage21.md) | Markdown | 72 | 0 | 7 | 79 |
|
||||
| [docs/stage22.md](/docs/stage22.md) | Markdown | 68 | 0 | 7 | 75 |
|
||||
| [docs/stage23.md](/docs/stage23.md) | Markdown | 41 | 0 | 6 | 47 |
|
||||
| [docs/stage24.md](/docs/stage24.md) | Markdown | 42 | 0 | 7 | 49 |
|
||||
| [docs/stage25.md](/docs/stage25.md) | Markdown | 58 | 0 | 7 | 65 |
|
||||
| [docs/stage26.md](/docs/stage26.md) | Markdown | 32 | 0 | 7 | 39 |
|
||||
| [docs/stage27.md](/docs/stage27.md) | Markdown | 32 | 0 | 7 | 39 |
|
||||
| [docs/stage28.md](/docs/stage28.md) | Markdown | 37 | 0 | 7 | 44 |
|
||||
| [docs/stage29.md](/docs/stage29.md) | Markdown | 33 | 0 | 7 | 40 |
|
||||
| [docs/stage3.md](/docs/stage3.md) | Markdown | 29 | 0 | 5 | 34 |
|
||||
| [docs/stage4.md](/docs/stage4.md) | Markdown | 30 | 0 | 5 | 35 |
|
||||
| [docs/stage5.md](/docs/stage5.md) | Markdown | 29 | 0 | 5 | 34 |
|
||||
| [docs/stage6.md](/docs/stage6.md) | Markdown | 30 | 0 | 6 | 36 |
|
||||
| [docs/stage7.md](/docs/stage7.md) | Markdown | 34 | 0 | 6 | 40 |
|
||||
| [docs/stage8.md](/docs/stage8.md) | Markdown | 31 | 0 | 6 | 37 |
|
||||
| [docs/stage9.md](/docs/stage9.md) | Markdown | 31 | 0 | 6 | 37 |
|
||||
| [docs/syscall.md](/docs/syscall.md) | Markdown | 328 | 0 | 154 | 482 |
|
||||
| [ramdisk/shell/init.cmd](/ramdisk/shell/init.cmd) | Batch | 4 | 0 | 2 | 6 |
|
||||
| [scripts/gen-tty-psf.ps1](/scripts/gen-tty-psf.ps1) | PowerShell | 171 | 2 | 42 | 215 |
|
||||
| [wine/README.md](/wine/README.md) | Markdown | 49 | 0 | 19 | 68 |
|
||||
| [wine/cleonos\_wine.py](/wine/cleonos_wine.py) | Python | 3 | 1 | 3 | 7 |
|
||||
| [wine/cleonos\_wine\_lib/\_\_init\_\_.py](/wine/cleonos_wine_lib/__init__.py) | Python | 4 | 0 | 1 | 5 |
|
||||
| [wine/cleonos\_wine\_lib/cli.py](/wine/cleonos_wine_lib/cli.py) | Python | 44 | 0 | 10 | 54 |
|
||||
| [wine/cleonos\_wine\_lib/constants.py](/wine/cleonos_wine_lib/constants.py) | Python | 76 | 1 | 11 | 88 |
|
||||
| [wine/cleonos\_wine\_lib/input\_pump.py](/wine/cleonos_wine_lib/input_pump.py) | Python | 82 | 0 | 17 | 99 |
|
||||
| [wine/cleonos\_wine\_lib/platform.py](/wine/cleonos_wine_lib/platform.py) | Python | 55 | 0 | 5 | 60 |
|
||||
| [wine/cleonos\_wine\_lib/runner.py](/wine/cleonos_wine_lib/runner.py) | Python | 990 | 0 | 175 | 1,165 |
|
||||
| [wine/cleonos\_wine\_lib/state.py](/wine/cleonos_wine_lib/state.py) | Python | 164 | 0 | 40 | 204 |
|
||||
| [wine/requirements.txt](/wine/requirements.txt) | pip requirements | 1 | 0 | 1 | 2 |
|
||||
|
||||
[Summary](results.md) / Details / [Diff Summary](diff.md) / [Diff Details](diff-details.md)
|
||||
95
.VSCodeCounter/2026-04-17_16-44-24/diff-details.md
Normal file
95
.VSCodeCounter/2026-04-17_16-44-24/diff-details.md
Normal file
@@ -0,0 +1,95 @@
|
||||
# Diff Details
|
||||
|
||||
Date : 2026-04-17 16:44:24
|
||||
|
||||
Directory d:\\Projects\\C\\cleonos
|
||||
|
||||
Total : 80 files, 8302 codes, 1 comments, 2069 blanks, all 10372 lines
|
||||
|
||||
[Summary](results.md) / [Details](details.md) / [Diff Summary](diff.md) / Diff Details
|
||||
|
||||
## Files
|
||||
| filename | language | code | comment | blank | total |
|
||||
| :--- | :--- | ---: | ---: | ---: | ---: |
|
||||
| [.github/workflows/build-os.yml](/.github/workflows/build-os.yml) | YAML | 48 | 0 | 10 | 58 |
|
||||
| [CMakeLists.txt](/CMakeLists.txt) | CMake | 8 | 0 | 2 | 10 |
|
||||
| [README.md](/README.md) | Markdown | 92 | 0 | 34 | 126 |
|
||||
| [README.zh-CN.md](/README.zh-CN.md) | Markdown | 92 | 0 | 34 | 126 |
|
||||
| [cleonos/c/apps/ansi\_main.c](/cleonos/c/apps/ansi_main.c) | C | 39 | 0 | 8 | 47 |
|
||||
| [cleonos/c/apps/ansitest\_main.c](/cleonos/c/apps/ansitest_main.c) | C | 142 | 0 | 35 | 177 |
|
||||
| [cleonos/c/apps/append\_main.c](/cleonos/c/apps/append_main.c) | C | 70 | 0 | 15 | 85 |
|
||||
| [cleonos/c/apps/args\_main.c](/cleonos/c/apps/args_main.c) | C | 49 | 0 | 13 | 62 |
|
||||
| [cleonos/c/apps/cat\_main.c](/cleonos/c/apps/cat_main.c) | C | 79 | 0 | 21 | 100 |
|
||||
| [cleonos/c/apps/cd\_main.c](/cleonos/c/apps/cd_main.c) | C | 50 | 0 | 12 | 62 |
|
||||
| [cleonos/c/apps/clear\_main.c](/cleonos/c/apps/clear_main.c) | C | 35 | 0 | 8 | 43 |
|
||||
| [cleonos/c/apps/cmd\_runtime.c](/cleonos/c/apps/cmd_runtime.c) | C | 446 | 0 | 143 | 589 |
|
||||
| [cleonos/c/apps/cmd\_runtime.h](/cleonos/c/apps/cmd_runtime.h) | C++ | 80 | 0 | 19 | 99 |
|
||||
| [cleonos/c/apps/cp\_main.c](/cleonos/c/apps/cp_main.c) | C | 91 | 0 | 23 | 114 |
|
||||
| [cleonos/c/apps/cut\_main.c](/cleonos/c/apps/cut_main.c) | C | 214 | 1 | 55 | 270 |
|
||||
| [cleonos/c/apps/dmesg\_main.c](/cleonos/c/apps/dmesg_main.c) | C | 60 | 0 | 15 | 75 |
|
||||
| [cleonos/c/apps/exec\_main.c](/cleonos/c/apps/exec_main.c) | C | 83 | 0 | 19 | 102 |
|
||||
| [cleonos/c/apps/exit\_main.c](/cleonos/c/apps/exit_main.c) | C | 50 | 0 | 11 | 61 |
|
||||
| [cleonos/c/apps/fastfetch\_main.c](/cleonos/c/apps/fastfetch_main.c) | C | 180 | 0 | 34 | 214 |
|
||||
| [cleonos/c/apps/fsstat\_main.c](/cleonos/c/apps/fsstat_main.c) | C | 41 | 0 | 8 | 49 |
|
||||
| [cleonos/c/apps/grep\_main.c](/cleonos/c/apps/grep_main.c) | C | 195 | 0 | 54 | 249 |
|
||||
| [cleonos/c/apps/head\_main.c](/cleonos/c/apps/head_main.c) | C | 164 | 0 | 47 | 211 |
|
||||
| [cleonos/c/apps/help\_main.c](/cleonos/c/apps/help_main.c) | C | 71 | 0 | 7 | 78 |
|
||||
| [cleonos/c/apps/kbdstat\_main.c](/cleonos/c/apps/kbdstat_main.c) | C | 40 | 0 | 8 | 48 |
|
||||
| [cleonos/c/apps/ls\_main.c](/cleonos/c/apps/ls_main.c) | C | 258 | 0 | 73 | 331 |
|
||||
| [cleonos/c/apps/memstat\_main.c](/cleonos/c/apps/memstat_main.c) | C | 39 | 0 | 8 | 47 |
|
||||
| [cleonos/c/apps/mkdir\_main.c](/cleonos/c/apps/mkdir_main.c) | C | 53 | 0 | 13 | 66 |
|
||||
| [cleonos/c/apps/mv\_main.c](/cleonos/c/apps/mv_main.c) | C | 98 | 0 | 25 | 123 |
|
||||
| [cleonos/c/apps/pid\_main.c](/cleonos/c/apps/pid_main.c) | C | 35 | 0 | 8 | 43 |
|
||||
| [cleonos/c/apps/pwd\_main.c](/cleonos/c/apps/pwd_main.c) | C | 35 | 0 | 8 | 43 |
|
||||
| [cleonos/c/apps/restart\_main.c](/cleonos/c/apps/restart_main.c) | C | 36 | 0 | 8 | 44 |
|
||||
| [cleonos/c/apps/rm\_main.c](/cleonos/c/apps/rm_main.c) | C | 53 | 0 | 13 | 66 |
|
||||
| [cleonos/c/apps/shell/shell\_cmd.c](/cleonos/c/apps/shell/shell_cmd.c) | C | 1,535 | 0 | 392 | 1,927 |
|
||||
| [cleonos/c/apps/shell/shell\_external.c](/cleonos/c/apps/shell/shell_external.c) | C | -57 | 0 | -20 | -77 |
|
||||
| [cleonos/c/apps/shell/shell\_input.c](/cleonos/c/apps/shell/shell_input.c) | C | 259 | 0 | 64 | 323 |
|
||||
| [cleonos/c/apps/shell/shell\_internal.h](/cleonos/c/apps/shell/shell_internal.h) | C++ | 8 | 0 | 1 | 9 |
|
||||
| [cleonos/c/apps/shell/shell\_util.c](/cleonos/c/apps/shell/shell_util.c) | C | 72 | 0 | 20 | 92 |
|
||||
| [cleonos/c/apps/shstat\_main.c](/cleonos/c/apps/shstat_main.c) | C | 41 | 0 | 8 | 49 |
|
||||
| [cleonos/c/apps/shutdown\_main.c](/cleonos/c/apps/shutdown_main.c) | C | 36 | 0 | 8 | 44 |
|
||||
| [cleonos/c/apps/sleep\_main.c](/cleonos/c/apps/sleep_main.c) | C | 48 | 0 | 11 | 59 |
|
||||
| [cleonos/c/apps/sort\_main.c](/cleonos/c/apps/sort_main.c) | C | 205 | 0 | 63 | 268 |
|
||||
| [cleonos/c/apps/spawn\_main.c](/cleonos/c/apps/spawn_main.c) | C | 72 | 0 | 17 | 89 |
|
||||
| [cleonos/c/apps/stats\_main.c](/cleonos/c/apps/stats_main.c) | C | 98 | 0 | 14 | 112 |
|
||||
| [cleonos/c/apps/tail\_main.c](/cleonos/c/apps/tail_main.c) | C | 190 | 0 | 54 | 244 |
|
||||
| [cleonos/c/apps/taskstat\_main.c](/cleonos/c/apps/taskstat_main.c) | C | 39 | 0 | 8 | 47 |
|
||||
| [cleonos/c/apps/touch\_main.c](/cleonos/c/apps/touch_main.c) | C | 54 | 0 | 13 | 67 |
|
||||
| [cleonos/c/apps/tty\_main.c](/cleonos/c/apps/tty_main.c) | C | 60 | 0 | 14 | 74 |
|
||||
| [cleonos/c/apps/uniq\_main.c](/cleonos/c/apps/uniq_main.c) | C | 168 | 0 | 48 | 216 |
|
||||
| [cleonos/c/apps/userstat\_main.c](/cleonos/c/apps/userstat_main.c) | C | 44 | 0 | 8 | 52 |
|
||||
| [cleonos/c/apps/wait\_main.c](/cleonos/c/apps/wait_main.c) | C | 64 | 0 | 14 | 78 |
|
||||
| [cleonos/c/apps/wavplay\_main.c](/cleonos/c/apps/wavplay_main.c) | C | 396 | 0 | 99 | 495 |
|
||||
| [cleonos/c/apps/wc\_main.c](/cleonos/c/apps/wc_main.c) | C | 164 | 0 | 45 | 209 |
|
||||
| [cleonos/c/apps/write\_main.c](/cleonos/c/apps/write_main.c) | C | 70 | 0 | 15 | 85 |
|
||||
| [cleonos/c/apps/yield\_main.c](/cleonos/c/apps/yield_main.c) | C | 35 | 0 | 8 | 43 |
|
||||
| [cleonos/c/include/cleonos\_syscall.h](/cleonos/c/include/cleonos_syscall.h) | C++ | 26 | 0 | 0 | 26 |
|
||||
| [cleonos/c/src/runtime.c](/cleonos/c/src/runtime.c) | C | 29 | 0 | 7 | 36 |
|
||||
| [cleonos/c/src/syscall.c](/cleonos/c/src/syscall.c) | C | 39 | 0 | 14 | 53 |
|
||||
| [clks/arch/x86\_64/exec\_stack\_call.S](/clks/arch/x86_64/exec_stack_call.S) | Go Assembly | 8 | 0 | 2 | 10 |
|
||||
| [clks/drivers/audio/pcspeaker.c](/clks/drivers/audio/pcspeaker.c) | C | 101 | 0 | 25 | 126 |
|
||||
| [clks/drivers/video/framebuffer.c](/clks/drivers/video/framebuffer.c) | C | 21 | 0 | 6 | 27 |
|
||||
| [clks/include/clks/audio.h](/clks/include/clks/audio.h) | C++ | 9 | 0 | 3 | 12 |
|
||||
| [clks/include/clks/driver.h](/clks/include/clks/driver.h) | C++ | 1 | 0 | 0 | 1 |
|
||||
| [clks/include/clks/exec.h](/clks/include/clks/exec.h) | C++ | 16 | 0 | 0 | 16 |
|
||||
| [clks/include/clks/framebuffer.h](/clks/include/clks/framebuffer.h) | C++ | 3 | 0 | 1 | 4 |
|
||||
| [clks/include/clks/keyboard.h](/clks/include/clks/keyboard.h) | C++ | 7 | 0 | 1 | 8 |
|
||||
| [clks/include/clks/syscall.h](/clks/include/clks/syscall.h) | C++ | 13 | 0 | 1 | 14 |
|
||||
| [clks/kernel/driver.c](/clks/kernel/driver.c) | C | 6 | 0 | 1 | 7 |
|
||||
| [clks/kernel/exec.c](/clks/kernel/exec.c) | C | 299 | 0 | 71 | 370 |
|
||||
| [clks/kernel/interrupts.c](/clks/kernel/interrupts.c) | C | 9 | 0 | 1 | 10 |
|
||||
| [clks/kernel/keyboard.c](/clks/kernel/keyboard.c) | C | 52 | 0 | 15 | 67 |
|
||||
| [clks/kernel/kmain.c](/clks/kernel/kmain.c) | C | 2 | 0 | 0 | 2 |
|
||||
| [clks/kernel/syscall.c](/clks/kernel/syscall.c) | C | 127 | 0 | 30 | 157 |
|
||||
| [clks/kernel/tty.c](/clks/kernel/tty.c) | C | 486 | 0 | 108 | 594 |
|
||||
| [docs/stage27.md](/docs/stage27.md) | Markdown | 4 | 0 | 0 | 4 |
|
||||
| [docs/syscall.md](/docs/syscall.md) | Markdown | 77 | 0 | 30 | 107 |
|
||||
| [wine/README.md](/wine/README.md) | Markdown | 12 | 0 | 5 | 17 |
|
||||
| [wine/cleonos\_wine\_lib/constants.py](/wine/cleonos_wine_lib/constants.py) | Python | 13 | 0 | 1 | 14 |
|
||||
| [wine/cleonos\_wine\_lib/platform.py](/wine/cleonos_wine_lib/platform.py) | Python | 18 | 0 | 1 | 19 |
|
||||
| [wine/cleonos\_wine\_lib/runner.py](/wine/cleonos_wine_lib/runner.py) | Python | 237 | 0 | 38 | 275 |
|
||||
| [wine/cleonos\_wine\_lib/state.py](/wine/cleonos_wine_lib/state.py) | Python | 60 | 0 | 13 | 73 |
|
||||
|
||||
[Summary](results.md) / [Details](details.md) / [Diff Summary](diff.md) / Diff Details
|
||||
82
.VSCodeCounter/2026-04-17_16-44-24/diff.csv
Normal file
82
.VSCodeCounter/2026-04-17_16-44-24/diff.csv
Normal file
@@ -0,0 +1,82 @@
|
||||
"filename", "language", "Python", "YAML", "Markdown", "CMake", "C", "C++", "Go Assembly", "comment", "blank", "total"
|
||||
"d:\Projects\C\cleonos\.github\workflows\build-os.yml", "YAML", 0, 48, 0, 0, 0, 0, 0, 0, 10, 58
|
||||
"d:\Projects\C\cleonos\CMakeLists.txt", "CMake", 0, 0, 0, 8, 0, 0, 0, 0, 2, 10
|
||||
"d:\Projects\C\cleonos\README.md", "Markdown", 0, 0, 92, 0, 0, 0, 0, 0, 34, 126
|
||||
"d:\Projects\C\cleonos\README.zh-CN.md", "Markdown", 0, 0, 92, 0, 0, 0, 0, 0, 34, 126
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\ansi_main.c", "C", 0, 0, 0, 0, 39, 0, 0, 0, 8, 47
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\ansitest_main.c", "C", 0, 0, 0, 0, 142, 0, 0, 0, 35, 177
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\append_main.c", "C", 0, 0, 0, 0, 70, 0, 0, 0, 15, 85
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\args_main.c", "C", 0, 0, 0, 0, 49, 0, 0, 0, 13, 62
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\cat_main.c", "C", 0, 0, 0, 0, 79, 0, 0, 0, 21, 100
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\cd_main.c", "C", 0, 0, 0, 0, 50, 0, 0, 0, 12, 62
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\clear_main.c", "C", 0, 0, 0, 0, 35, 0, 0, 0, 8, 43
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\cmd_runtime.c", "C", 0, 0, 0, 0, 446, 0, 0, 0, 143, 589
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\cmd_runtime.h", "C++", 0, 0, 0, 0, 0, 80, 0, 0, 19, 99
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\cp_main.c", "C", 0, 0, 0, 0, 91, 0, 0, 0, 23, 114
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\cut_main.c", "C", 0, 0, 0, 0, 214, 0, 0, 1, 55, 270
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\dmesg_main.c", "C", 0, 0, 0, 0, 60, 0, 0, 0, 15, 75
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\exec_main.c", "C", 0, 0, 0, 0, 83, 0, 0, 0, 19, 102
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\exit_main.c", "C", 0, 0, 0, 0, 50, 0, 0, 0, 11, 61
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\fastfetch_main.c", "C", 0, 0, 0, 0, 180, 0, 0, 0, 34, 214
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\fsstat_main.c", "C", 0, 0, 0, 0, 41, 0, 0, 0, 8, 49
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\grep_main.c", "C", 0, 0, 0, 0, 195, 0, 0, 0, 54, 249
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\head_main.c", "C", 0, 0, 0, 0, 164, 0, 0, 0, 47, 211
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\help_main.c", "C", 0, 0, 0, 0, 71, 0, 0, 0, 7, 78
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\kbdstat_main.c", "C", 0, 0, 0, 0, 40, 0, 0, 0, 8, 48
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\ls_main.c", "C", 0, 0, 0, 0, 258, 0, 0, 0, 73, 331
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\memstat_main.c", "C", 0, 0, 0, 0, 39, 0, 0, 0, 8, 47
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\mkdir_main.c", "C", 0, 0, 0, 0, 53, 0, 0, 0, 13, 66
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\mv_main.c", "C", 0, 0, 0, 0, 98, 0, 0, 0, 25, 123
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\pid_main.c", "C", 0, 0, 0, 0, 35, 0, 0, 0, 8, 43
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\pwd_main.c", "C", 0, 0, 0, 0, 35, 0, 0, 0, 8, 43
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\restart_main.c", "C", 0, 0, 0, 0, 36, 0, 0, 0, 8, 44
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\rm_main.c", "C", 0, 0, 0, 0, 53, 0, 0, 0, 13, 66
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\shell\shell_cmd.c", "C", 0, 0, 0, 0, 1535, 0, 0, 0, 392, 1927
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\shell\shell_external.c", "C", 0, 0, 0, 0, -57, 0, 0, 0, -20, -77
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\shell\shell_input.c", "C", 0, 0, 0, 0, 259, 0, 0, 0, 64, 323
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\shell\shell_internal.h", "C++", 0, 0, 0, 0, 0, 8, 0, 0, 1, 9
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\shell\shell_util.c", "C", 0, 0, 0, 0, 72, 0, 0, 0, 20, 92
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\shstat_main.c", "C", 0, 0, 0, 0, 41, 0, 0, 0, 8, 49
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\shutdown_main.c", "C", 0, 0, 0, 0, 36, 0, 0, 0, 8, 44
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\sleep_main.c", "C", 0, 0, 0, 0, 48, 0, 0, 0, 11, 59
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\sort_main.c", "C", 0, 0, 0, 0, 205, 0, 0, 0, 63, 268
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\spawn_main.c", "C", 0, 0, 0, 0, 72, 0, 0, 0, 17, 89
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\stats_main.c", "C", 0, 0, 0, 0, 98, 0, 0, 0, 14, 112
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\tail_main.c", "C", 0, 0, 0, 0, 190, 0, 0, 0, 54, 244
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\taskstat_main.c", "C", 0, 0, 0, 0, 39, 0, 0, 0, 8, 47
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\touch_main.c", "C", 0, 0, 0, 0, 54, 0, 0, 0, 13, 67
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\tty_main.c", "C", 0, 0, 0, 0, 60, 0, 0, 0, 14, 74
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\uniq_main.c", "C", 0, 0, 0, 0, 168, 0, 0, 0, 48, 216
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\userstat_main.c", "C", 0, 0, 0, 0, 44, 0, 0, 0, 8, 52
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\wait_main.c", "C", 0, 0, 0, 0, 64, 0, 0, 0, 14, 78
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\wavplay_main.c", "C", 0, 0, 0, 0, 396, 0, 0, 0, 99, 495
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\wc_main.c", "C", 0, 0, 0, 0, 164, 0, 0, 0, 45, 209
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\write_main.c", "C", 0, 0, 0, 0, 70, 0, 0, 0, 15, 85
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\yield_main.c", "C", 0, 0, 0, 0, 35, 0, 0, 0, 8, 43
|
||||
"d:\Projects\C\cleonos\cleonos\c\include\cleonos_syscall.h", "C++", 0, 0, 0, 0, 0, 26, 0, 0, 0, 26
|
||||
"d:\Projects\C\cleonos\cleonos\c\src\runtime.c", "C", 0, 0, 0, 0, 29, 0, 0, 0, 7, 36
|
||||
"d:\Projects\C\cleonos\cleonos\c\src\syscall.c", "C", 0, 0, 0, 0, 39, 0, 0, 0, 14, 53
|
||||
"d:\Projects\C\cleonos\clks\arch\x86_64\exec_stack_call.S", "Go Assembly", 0, 0, 0, 0, 0, 0, 8, 0, 2, 10
|
||||
"d:\Projects\C\cleonos\clks\drivers\audio\pcspeaker.c", "C", 0, 0, 0, 0, 101, 0, 0, 0, 25, 126
|
||||
"d:\Projects\C\cleonos\clks\drivers\video\framebuffer.c", "C", 0, 0, 0, 0, 21, 0, 0, 0, 6, 27
|
||||
"d:\Projects\C\cleonos\clks\include\clks\audio.h", "C++", 0, 0, 0, 0, 0, 9, 0, 0, 3, 12
|
||||
"d:\Projects\C\cleonos\clks\include\clks\driver.h", "C++", 0, 0, 0, 0, 0, 1, 0, 0, 0, 1
|
||||
"d:\Projects\C\cleonos\clks\include\clks\exec.h", "C++", 0, 0, 0, 0, 0, 16, 0, 0, 0, 16
|
||||
"d:\Projects\C\cleonos\clks\include\clks\framebuffer.h", "C++", 0, 0, 0, 0, 0, 3, 0, 0, 1, 4
|
||||
"d:\Projects\C\cleonos\clks\include\clks\keyboard.h", "C++", 0, 0, 0, 0, 0, 7, 0, 0, 1, 8
|
||||
"d:\Projects\C\cleonos\clks\include\clks\syscall.h", "C++", 0, 0, 0, 0, 0, 13, 0, 0, 1, 14
|
||||
"d:\Projects\C\cleonos\clks\kernel\driver.c", "C", 0, 0, 0, 0, 6, 0, 0, 0, 1, 7
|
||||
"d:\Projects\C\cleonos\clks\kernel\exec.c", "C", 0, 0, 0, 0, 299, 0, 0, 0, 71, 370
|
||||
"d:\Projects\C\cleonos\clks\kernel\interrupts.c", "C", 0, 0, 0, 0, 9, 0, 0, 0, 1, 10
|
||||
"d:\Projects\C\cleonos\clks\kernel\keyboard.c", "C", 0, 0, 0, 0, 52, 0, 0, 0, 15, 67
|
||||
"d:\Projects\C\cleonos\clks\kernel\kmain.c", "C", 0, 0, 0, 0, 2, 0, 0, 0, 0, 2
|
||||
"d:\Projects\C\cleonos\clks\kernel\syscall.c", "C", 0, 0, 0, 0, 127, 0, 0, 0, 30, 157
|
||||
"d:\Projects\C\cleonos\clks\kernel\tty.c", "C", 0, 0, 0, 0, 486, 0, 0, 0, 108, 594
|
||||
"d:\Projects\C\cleonos\docs\stage27.md", "Markdown", 0, 0, 4, 0, 0, 0, 0, 0, 0, 4
|
||||
"d:\Projects\C\cleonos\docs\syscall.md", "Markdown", 0, 0, 77, 0, 0, 0, 0, 0, 30, 107
|
||||
"d:\Projects\C\cleonos\wine\README.md", "Markdown", 0, 0, 12, 0, 0, 0, 0, 0, 5, 17
|
||||
"d:\Projects\C\cleonos\wine\cleonos_wine_lib\constants.py", "Python", 13, 0, 0, 0, 0, 0, 0, 0, 1, 14
|
||||
"d:\Projects\C\cleonos\wine\cleonos_wine_lib\platform.py", "Python", 18, 0, 0, 0, 0, 0, 0, 0, 1, 19
|
||||
"d:\Projects\C\cleonos\wine\cleonos_wine_lib\runner.py", "Python", 237, 0, 0, 0, 0, 0, 0, 0, 38, 275
|
||||
"d:\Projects\C\cleonos\wine\cleonos_wine_lib\state.py", "Python", 60, 0, 0, 0, 0, 0, 0, 0, 13, 73
|
||||
"Total", "-", 328, 48, 277, 8, 7470, 163, 8, 1, 2069, 10372
|
||||
|
50
.VSCodeCounter/2026-04-17_16-44-24/diff.md
Normal file
50
.VSCodeCounter/2026-04-17_16-44-24/diff.md
Normal file
@@ -0,0 +1,50 @@
|
||||
# Diff Summary
|
||||
|
||||
Date : 2026-04-17 16:44:24
|
||||
|
||||
Directory d:\\Projects\\C\\cleonos
|
||||
|
||||
Total : 80 files, 8302 codes, 1 comments, 2069 blanks, all 10372 lines
|
||||
|
||||
[Summary](results.md) / [Details](details.md) / Diff Summary / [Diff Details](diff-details.md)
|
||||
|
||||
## Languages
|
||||
| language | files | code | comment | blank | total |
|
||||
| :--- | ---: | ---: | ---: | ---: | ---: |
|
||||
| C | 59 | 7,470 | 1 | 1,873 | 9,344 |
|
||||
| Python | 4 | 328 | 0 | 53 | 381 |
|
||||
| Markdown | 5 | 277 | 0 | 103 | 380 |
|
||||
| C++ | 9 | 163 | 0 | 26 | 189 |
|
||||
| YAML | 1 | 48 | 0 | 10 | 58 |
|
||||
| CMake | 1 | 8 | 0 | 2 | 10 |
|
||||
| Go Assembly | 1 | 8 | 0 | 2 | 10 |
|
||||
|
||||
## Directories
|
||||
| path | files | code | comment | blank | total |
|
||||
| :--- | ---: | ---: | ---: | ---: | ---: |
|
||||
| . | 80 | 8,302 | 1 | 2,069 | 10,372 |
|
||||
| . (Files) | 3 | 192 | 0 | 70 | 262 |
|
||||
| .github | 1 | 48 | 0 | 10 | 58 |
|
||||
| .github\\workflows | 1 | 48 | 0 | 10 | 58 |
|
||||
| cleonos | 53 | 6,481 | 1 | 1,636 | 8,118 |
|
||||
| cleonos\\c | 53 | 6,481 | 1 | 1,636 | 8,118 |
|
||||
| cleonos\\c\\apps | 50 | 6,387 | 1 | 1,615 | 8,003 |
|
||||
| cleonos\\c\\apps (Files) | 45 | 4,570 | 1 | 1,158 | 5,729 |
|
||||
| cleonos\\c\\apps\\shell | 5 | 1,817 | 0 | 457 | 2,274 |
|
||||
| cleonos\\c\\include | 1 | 26 | 0 | 0 | 26 |
|
||||
| cleonos\\c\\src | 2 | 68 | 0 | 21 | 89 |
|
||||
| clks | 16 | 1,160 | 0 | 265 | 1,425 |
|
||||
| clks\\arch | 1 | 8 | 0 | 2 | 10 |
|
||||
| clks\\arch\\x86_64 | 1 | 8 | 0 | 2 | 10 |
|
||||
| clks\\drivers | 2 | 122 | 0 | 31 | 153 |
|
||||
| clks\\drivers\\audio | 1 | 101 | 0 | 25 | 126 |
|
||||
| clks\\drivers\\video | 1 | 21 | 0 | 6 | 27 |
|
||||
| clks\\include | 6 | 49 | 0 | 6 | 55 |
|
||||
| clks\\include\\clks | 6 | 49 | 0 | 6 | 55 |
|
||||
| clks\\kernel | 7 | 981 | 0 | 226 | 1,207 |
|
||||
| docs | 2 | 81 | 0 | 30 | 111 |
|
||||
| wine | 5 | 340 | 0 | 58 | 398 |
|
||||
| wine (Files) | 1 | 12 | 0 | 5 | 17 |
|
||||
| wine\\cleonos_wine_lib | 4 | 328 | 0 | 53 | 381 |
|
||||
|
||||
[Summary](results.md) / [Details](details.md) / Diff Summary / [Diff Details](diff-details.md)
|
||||
133
.VSCodeCounter/2026-04-17_16-44-24/diff.txt
Normal file
133
.VSCodeCounter/2026-04-17_16-44-24/diff.txt
Normal file
@@ -0,0 +1,133 @@
|
||||
Date : 2026-04-17 16:44:24
|
||||
Directory : d:\Projects\C\cleonos
|
||||
Total : 80 files, 8302 codes, 1 comments, 2069 blanks, all 10372 lines
|
||||
|
||||
Languages
|
||||
+-------------+------------+------------+------------+------------+------------+
|
||||
| language | files | code | comment | blank | total |
|
||||
+-------------+------------+------------+------------+------------+------------+
|
||||
| C | 59 | 7,470 | 1 | 1,873 | 9,344 |
|
||||
| Python | 4 | 328 | 0 | 53 | 381 |
|
||||
| Markdown | 5 | 277 | 0 | 103 | 380 |
|
||||
| C++ | 9 | 163 | 0 | 26 | 189 |
|
||||
| YAML | 1 | 48 | 0 | 10 | 58 |
|
||||
| CMake | 1 | 8 | 0 | 2 | 10 |
|
||||
| Go Assembly | 1 | 8 | 0 | 2 | 10 |
|
||||
+-------------+------------+------------+------------+------------+------------+
|
||||
|
||||
Directories
|
||||
+-------------------------------------------------------------+------------+------------+------------+------------+------------+
|
||||
| path | files | code | comment | blank | total |
|
||||
+-------------------------------------------------------------+------------+------------+------------+------------+------------+
|
||||
| . | 80 | 8,302 | 1 | 2,069 | 10,372 |
|
||||
| . (Files) | 3 | 192 | 0 | 70 | 262 |
|
||||
| .github | 1 | 48 | 0 | 10 | 58 |
|
||||
| .github\workflows | 1 | 48 | 0 | 10 | 58 |
|
||||
| cleonos | 53 | 6,481 | 1 | 1,636 | 8,118 |
|
||||
| cleonos\c | 53 | 6,481 | 1 | 1,636 | 8,118 |
|
||||
| cleonos\c\apps | 50 | 6,387 | 1 | 1,615 | 8,003 |
|
||||
| cleonos\c\apps (Files) | 45 | 4,570 | 1 | 1,158 | 5,729 |
|
||||
| cleonos\c\apps\shell | 5 | 1,817 | 0 | 457 | 2,274 |
|
||||
| cleonos\c\include | 1 | 26 | 0 | 0 | 26 |
|
||||
| cleonos\c\src | 2 | 68 | 0 | 21 | 89 |
|
||||
| clks | 16 | 1,160 | 0 | 265 | 1,425 |
|
||||
| clks\arch | 1 | 8 | 0 | 2 | 10 |
|
||||
| clks\arch\x86_64 | 1 | 8 | 0 | 2 | 10 |
|
||||
| clks\drivers | 2 | 122 | 0 | 31 | 153 |
|
||||
| clks\drivers\audio | 1 | 101 | 0 | 25 | 126 |
|
||||
| clks\drivers\video | 1 | 21 | 0 | 6 | 27 |
|
||||
| clks\include | 6 | 49 | 0 | 6 | 55 |
|
||||
| clks\include\clks | 6 | 49 | 0 | 6 | 55 |
|
||||
| clks\kernel | 7 | 981 | 0 | 226 | 1,207 |
|
||||
| docs | 2 | 81 | 0 | 30 | 111 |
|
||||
| wine | 5 | 340 | 0 | 58 | 398 |
|
||||
| wine (Files) | 1 | 12 | 0 | 5 | 17 |
|
||||
| wine\cleonos_wine_lib | 4 | 328 | 0 | 53 | 381 |
|
||||
+-------------------------------------------------------------+------------+------------+------------+------------+------------+
|
||||
|
||||
Files
|
||||
+-------------------------------------------------------------+-------------+------------+------------+------------+------------+
|
||||
| filename | language | code | comment | blank | total |
|
||||
+-------------------------------------------------------------+-------------+------------+------------+------------+------------+
|
||||
| d:\Projects\C\cleonos\.github\workflows\build-os.yml | YAML | 48 | 0 | 10 | 58 |
|
||||
| d:\Projects\C\cleonos\CMakeLists.txt | CMake | 8 | 0 | 2 | 10 |
|
||||
| d:\Projects\C\cleonos\README.md | Markdown | 92 | 0 | 34 | 126 |
|
||||
| d:\Projects\C\cleonos\README.zh-CN.md | Markdown | 92 | 0 | 34 | 126 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\ansi_main.c | C | 39 | 0 | 8 | 47 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\ansitest_main.c | C | 142 | 0 | 35 | 177 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\append_main.c | C | 70 | 0 | 15 | 85 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\args_main.c | C | 49 | 0 | 13 | 62 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\cat_main.c | C | 79 | 0 | 21 | 100 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\cd_main.c | C | 50 | 0 | 12 | 62 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\clear_main.c | C | 35 | 0 | 8 | 43 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\cmd_runtime.c | C | 446 | 0 | 143 | 589 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\cmd_runtime.h | C++ | 80 | 0 | 19 | 99 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\cp_main.c | C | 91 | 0 | 23 | 114 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\cut_main.c | C | 214 | 1 | 55 | 270 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\dmesg_main.c | C | 60 | 0 | 15 | 75 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\exec_main.c | C | 83 | 0 | 19 | 102 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\exit_main.c | C | 50 | 0 | 11 | 61 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\fastfetch_main.c | C | 180 | 0 | 34 | 214 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\fsstat_main.c | C | 41 | 0 | 8 | 49 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\grep_main.c | C | 195 | 0 | 54 | 249 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\head_main.c | C | 164 | 0 | 47 | 211 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\help_main.c | C | 71 | 0 | 7 | 78 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\kbdstat_main.c | C | 40 | 0 | 8 | 48 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\ls_main.c | C | 258 | 0 | 73 | 331 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\memstat_main.c | C | 39 | 0 | 8 | 47 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\mkdir_main.c | C | 53 | 0 | 13 | 66 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\mv_main.c | C | 98 | 0 | 25 | 123 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\pid_main.c | C | 35 | 0 | 8 | 43 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\pwd_main.c | C | 35 | 0 | 8 | 43 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\restart_main.c | C | 36 | 0 | 8 | 44 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\rm_main.c | C | 53 | 0 | 13 | 66 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\shell\shell_cmd.c | C | 1,535 | 0 | 392 | 1,927 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\shell\shell_external.c | C | -57 | 0 | -20 | -77 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\shell\shell_input.c | C | 259 | 0 | 64 | 323 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\shell\shell_internal.h | C++ | 8 | 0 | 1 | 9 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\shell\shell_util.c | C | 72 | 0 | 20 | 92 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\shstat_main.c | C | 41 | 0 | 8 | 49 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\shutdown_main.c | C | 36 | 0 | 8 | 44 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\sleep_main.c | C | 48 | 0 | 11 | 59 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\sort_main.c | C | 205 | 0 | 63 | 268 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\spawn_main.c | C | 72 | 0 | 17 | 89 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\stats_main.c | C | 98 | 0 | 14 | 112 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\tail_main.c | C | 190 | 0 | 54 | 244 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\taskstat_main.c | C | 39 | 0 | 8 | 47 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\touch_main.c | C | 54 | 0 | 13 | 67 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\tty_main.c | C | 60 | 0 | 14 | 74 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\uniq_main.c | C | 168 | 0 | 48 | 216 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\userstat_main.c | C | 44 | 0 | 8 | 52 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\wait_main.c | C | 64 | 0 | 14 | 78 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\wavplay_main.c | C | 396 | 0 | 99 | 495 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\wc_main.c | C | 164 | 0 | 45 | 209 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\write_main.c | C | 70 | 0 | 15 | 85 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\yield_main.c | C | 35 | 0 | 8 | 43 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\include\cleonos_syscall.h | C++ | 26 | 0 | 0 | 26 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\src\runtime.c | C | 29 | 0 | 7 | 36 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\src\syscall.c | C | 39 | 0 | 14 | 53 |
|
||||
| d:\Projects\C\cleonos\clks\arch\x86_64\exec_stack_call.S | Go Assembly | 8 | 0 | 2 | 10 |
|
||||
| d:\Projects\C\cleonos\clks\drivers\audio\pcspeaker.c | C | 101 | 0 | 25 | 126 |
|
||||
| d:\Projects\C\cleonos\clks\drivers\video\framebuffer.c | C | 21 | 0 | 6 | 27 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\audio.h | C++ | 9 | 0 | 3 | 12 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\driver.h | C++ | 1 | 0 | 0 | 1 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\exec.h | C++ | 16 | 0 | 0 | 16 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\framebuffer.h | C++ | 3 | 0 | 1 | 4 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\keyboard.h | C++ | 7 | 0 | 1 | 8 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\syscall.h | C++ | 13 | 0 | 1 | 14 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\driver.c | C | 6 | 0 | 1 | 7 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\exec.c | C | 299 | 0 | 71 | 370 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\interrupts.c | C | 9 | 0 | 1 | 10 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\keyboard.c | C | 52 | 0 | 15 | 67 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\kmain.c | C | 2 | 0 | 0 | 2 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\syscall.c | C | 127 | 0 | 30 | 157 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\tty.c | C | 486 | 0 | 108 | 594 |
|
||||
| d:\Projects\C\cleonos\docs\stage27.md | Markdown | 4 | 0 | 0 | 4 |
|
||||
| d:\Projects\C\cleonos\docs\syscall.md | Markdown | 77 | 0 | 30 | 107 |
|
||||
| d:\Projects\C\cleonos\wine\README.md | Markdown | 12 | 0 | 5 | 17 |
|
||||
| d:\Projects\C\cleonos\wine\cleonos_wine_lib\constants.py | Python | 13 | 0 | 1 | 14 |
|
||||
| d:\Projects\C\cleonos\wine\cleonos_wine_lib\platform.py | Python | 18 | 0 | 1 | 19 |
|
||||
| d:\Projects\C\cleonos\wine\cleonos_wine_lib\runner.py | Python | 237 | 0 | 38 | 275 |
|
||||
| d:\Projects\C\cleonos\wine\cleonos_wine_lib\state.py | Python | 60 | 0 | 13 | 73 |
|
||||
| Total | | 8,302 | 1 | 2,069 | 10,372 |
|
||||
+-------------------------------------------------------------+-------------+------------+------------+------------+------------+
|
||||
185
.VSCodeCounter/2026-04-17_16-44-24/results.csv
Normal file
185
.VSCodeCounter/2026-04-17_16-44-24/results.csv
Normal file
@@ -0,0 +1,185 @@
|
||||
"filename", "language", "pip requirements", "Python", "YAML", "Markdown", "Batch", "PowerShell", "Properties", "Makefile", "CMake", "Rust", "C", "C++", "Go Assembly", "comment", "blank", "total"
|
||||
"d:\Projects\C\cleonos\.github\workflows\build-os.yml", "YAML", 0, 0, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 58
|
||||
"d:\Projects\C\cleonos\CMakeLists.txt", "CMake", 0, 0, 0, 0, 0, 0, 0, 0, 587, 0, 0, 0, 0, 0, 86, 673
|
||||
"d:\Projects\C\cleonos\Makefile", "Makefile", 0, 0, 0, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 22, 122
|
||||
"d:\Projects\C\cleonos\README.md", "Markdown", 0, 0, 0, 92, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 126
|
||||
"d:\Projects\C\cleonos\README.zh-CN.md", "Markdown", 0, 0, 0, 92, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 126
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\ansi_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 43, 0, 0, 0, 11, 54
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\ansitest_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 142, 0, 0, 0, 35, 177
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\append_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 74, 0, 0, 0, 18, 92
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\args_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 0, 0, 0, 13, 62
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\cat_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 83, 0, 0, 0, 24, 107
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\cd_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 15, 69
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\clear_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 39, 0, 0, 0, 11, 50
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\cmd_runtime.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 446, 0, 0, 0, 143, 589
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\cmd_runtime.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 80, 0, 0, 19, 99
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\cp_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 95, 0, 0, 0, 26, 121
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\cut_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 214, 0, 0, 1, 55, 270
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\dmesg_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 18, 82
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\elfrunner_kmain.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 3, 9
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\elfrunner_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 3, 9
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\exec_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 87, 0, 0, 0, 22, 109
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\exit_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 14, 68
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\fastfetch_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 180, 0, 0, 0, 34, 214
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\fsstat_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45, 0, 0, 0, 11, 56
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\grep_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 195, 0, 0, 0, 54, 249
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\head_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 164, 0, 0, 0, 47, 211
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\hello_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 2, 8
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\help_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 75, 0, 0, 0, 10, 85
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\kbdstat_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 44, 0, 0, 0, 11, 55
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\ls_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 262, 0, 0, 0, 76, 338
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\memc_kmain.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 3, 9
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\memc_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 3, 11
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\memstat_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 43, 0, 0, 0, 11, 54
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\mkdir_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 57, 0, 0, 0, 16, 73
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\mv_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 102, 0, 0, 0, 28, 130
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\pid_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 39, 0, 0, 0, 11, 50
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\pwd_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 39, 0, 0, 0, 11, 50
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\restart_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 40, 0, 0, 0, 11, 51
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\rm_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 57, 0, 0, 0, 16, 73
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\shell\shell_cmd.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2311, 0, 0, 0, 574, 2885
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\shell\shell_external.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 166, 0, 0, 0, 55, 221
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\shell\shell_input.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 514, 0, 0, 0, 132, 646
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\shell\shell_internal.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92, 0, 0, 20, 112
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\shell\shell_path.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 153, 0, 0, 0, 50, 203
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\shell\shell_script.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 35, 0, 0, 0, 12, 47
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\shell\shell_util.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 283, 0, 0, 0, 86, 369
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\shell_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 6, 25
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\shstat_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45, 0, 0, 0, 11, 56
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\shutdown_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 40, 0, 0, 0, 11, 51
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\sleep_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 52, 0, 0, 0, 14, 66
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\sort_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 205, 0, 0, 0, 63, 268
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\spawn_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 76, 0, 0, 0, 20, 96
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\stats_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 102, 0, 0, 0, 17, 119
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\tail_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 190, 0, 0, 0, 54, 244
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\taskstat_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 43, 0, 0, 0, 11, 54
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\touch_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 58, 0, 0, 0, 16, 74
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\tty_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 17, 81
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\ttydrv_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 3, 9
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\uniq_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 168, 0, 0, 0, 48, 216
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\userstat_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 0, 0, 0, 11, 59
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\wait_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 0, 0, 0, 17, 85
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\wavplay_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 396, 0, 0, 0, 99, 495
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\wc_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 164, 0, 0, 0, 45, 209
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\write_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 74, 0, 0, 0, 18, 92
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\yield_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 39, 0, 0, 0, 11, 50
|
||||
"d:\Projects\C\cleonos\cleonos\c\include\cleonos_rust_bridge.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 4, 10
|
||||
"d:\Projects\C\cleonos\cleonos\c\include\cleonos_syscall.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 6, 134
|
||||
"d:\Projects\C\cleonos\cleonos\c\src\runtime.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 37, 0, 0, 0, 12, 49
|
||||
"d:\Projects\C\cleonos\cleonos\c\src\syscall.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 191, 0, 0, 0, 64, 255
|
||||
"d:\Projects\C\cleonos\cleonos\c\stub.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 4, 2, 9
|
||||
"d:\Projects\C\cleonos\cleonos\rust\src\lib.rs", "Rust", 0, 0, 0, 0, 0, 0, 0, 0, 0, 23, 0, 0, 0, 0, 9, 32
|
||||
"d:\Projects\C\cleonos\clks\arch\aarch64\boot.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 1, 7
|
||||
"d:\Projects\C\cleonos\clks\arch\x86_64\boot.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 1, 7
|
||||
"d:\Projects\C\cleonos\clks\arch\x86_64\exec_stack_call.S", "Go Assembly", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 22, 0, 8, 30
|
||||
"d:\Projects\C\cleonos\clks\arch\x86_64\interrupt_stubs.S", "Go Assembly", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 108, 0, 12, 120
|
||||
"d:\Projects\C\cleonos\clks\drivers\audio\pcspeaker.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 101, 0, 0, 0, 25, 126
|
||||
"d:\Projects\C\cleonos\clks\drivers\serial\serial.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 52, 0, 0, 0, 16, 68
|
||||
"d:\Projects\C\cleonos\clks\drivers\video\font8x8.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 67, 0, 0, 0, 8, 75
|
||||
"d:\Projects\C\cleonos\clks\drivers\video\font8x8.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 3, 8
|
||||
"d:\Projects\C\cleonos\clks\drivers\video\framebuffer.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 251, 0, 0, 0, 70, 321
|
||||
"d:\Projects\C\cleonos\clks\drivers\video\psf_font.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 230, 0, 0, 0, 56, 286
|
||||
"d:\Projects\C\cleonos\clks\drivers\video\psf_font.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 5, 20
|
||||
"d:\Projects\C\cleonos\clks\include\clks\audio.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 3, 12
|
||||
"d:\Projects\C\cleonos\clks\include\clks\boot.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 0, 0, 4, 15
|
||||
"d:\Projects\C\cleonos\clks\include\clks\compiler.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 0, 0, 4, 17
|
||||
"d:\Projects\C\cleonos\clks\include\clks\cpu.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 0, 4, 24
|
||||
"d:\Projects\C\cleonos\clks\include\clks\desktop.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 4, 11
|
||||
"d:\Projects\C\cleonos\clks\include\clks\driver.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, 0, 0, 8, 37
|
||||
"d:\Projects\C\cleonos\clks\include\clks\elf64.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 9, 41
|
||||
"d:\Projects\C\cleonos\clks\include\clks\elfrunner.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 3, 9
|
||||
"d:\Projects\C\cleonos\clks\include\clks\exec.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 0, 0, 4, 38
|
||||
"d:\Projects\C\cleonos\clks\include\clks\framebuffer.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 26, 0, 0, 6, 32
|
||||
"d:\Projects\C\cleonos\clks\include\clks\fs.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 23, 0, 0, 7, 30
|
||||
"d:\Projects\C\cleonos\clks\include\clks\heap.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 4, 19
|
||||
"d:\Projects\C\cleonos\clks\include\clks\interrupts.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 3, 9
|
||||
"d:\Projects\C\cleonos\clks\include\clks\kelf.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 5, 14
|
||||
"d:\Projects\C\cleonos\clks\include\clks\kernel.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 2, 6
|
||||
"d:\Projects\C\cleonos\clks\include\clks\keyboard.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 27, 0, 0, 6, 33
|
||||
"d:\Projects\C\cleonos\clks\include\clks\limine.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 132, 0, 0, 24, 156
|
||||
"d:\Projects\C\cleonos\clks\include\clks\log.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 0, 0, 5, 19
|
||||
"d:\Projects\C\cleonos\clks\include\clks\mouse.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 0, 6, 26
|
||||
"d:\Projects\C\cleonos\clks\include\clks\panic.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 3, 10
|
||||
"d:\Projects\C\cleonos\clks\include\clks\pmm.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 5, 21
|
||||
"d:\Projects\C\cleonos\clks\include\clks\ramdisk.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 8, 25
|
||||
"d:\Projects\C\cleonos\clks\include\clks\scheduler.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 5, 23
|
||||
"d:\Projects\C\cleonos\clks\include\clks\serial.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 2, 8
|
||||
"d:\Projects\C\cleonos\clks\include\clks\service.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, 0, 0, 8, 39
|
||||
"d:\Projects\C\cleonos\clks\include\clks\shell.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 3, 10
|
||||
"d:\Projects\C\cleonos\clks\include\clks\string.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 3, 12
|
||||
"d:\Projects\C\cleonos\clks\include\clks\syscall.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 0, 0, 5, 73
|
||||
"d:\Projects\C\cleonos\clks\include\clks\task.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 7, 31
|
||||
"d:\Projects\C\cleonos\clks\include\clks\tty.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 0, 0, 4, 18
|
||||
"d:\Projects\C\cleonos\clks\include\clks\types.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 6, 23
|
||||
"d:\Projects\C\cleonos\clks\include\clks\userland.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 4, 16
|
||||
"d:\Projects\C\cleonos\clks\kernel\desktop.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 321, 0, 0, 0, 86, 407
|
||||
"d:\Projects\C\cleonos\clks\kernel\driver.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 169, 0, 0, 0, 49, 218
|
||||
"d:\Projects\C\cleonos\clks\kernel\elf64.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 239, 0, 0, 0, 73, 312
|
||||
"d:\Projects\C\cleonos\clks\kernel\elfrunner.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 0, 0, 0, 8, 38
|
||||
"d:\Projects\C\cleonos\clks\kernel\exec.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 854, 0, 0, 0, 237, 1091
|
||||
"d:\Projects\C\cleonos\clks\kernel\fs.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 698, 0, 0, 0, 220, 918
|
||||
"d:\Projects\C\cleonos\clks\kernel\heap.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 134, 0, 0, 0, 42, 176
|
||||
"d:\Projects\C\cleonos\clks\kernel\interrupts.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 311, 0, 0, 0, 44, 355
|
||||
"d:\Projects\C\cleonos\clks\kernel\kelf.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 203, 0, 0, 1, 53, 257
|
||||
"d:\Projects\C\cleonos\clks\kernel\keyboard.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 311, 0, 0, 0, 79, 390
|
||||
"d:\Projects\C\cleonos\clks\kernel\kmain.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 200, 0, 0, 1, 52, 253
|
||||
"d:\Projects\C\cleonos\clks\kernel\limine_requests.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 76, 0, 0, 0, 26, 102
|
||||
"d:\Projects\C\cleonos\clks\kernel\log.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 123, 0, 0, 0, 33, 156
|
||||
"d:\Projects\C\cleonos\clks\kernel\mouse.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 246, 0, 0, 0, 63, 309
|
||||
"d:\Projects\C\cleonos\clks\kernel\panic.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 179, 0, 0, 0, 60, 239
|
||||
"d:\Projects\C\cleonos\clks\kernel\pmm.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 82, 0, 0, 0, 23, 105
|
||||
"d:\Projects\C\cleonos\clks\kernel\ramdisk.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 172, 0, 0, 0, 50, 222
|
||||
"d:\Projects\C\cleonos\clks\kernel\scheduler.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 136, 0, 0, 0, 44, 180
|
||||
"d:\Projects\C\cleonos\clks\kernel\service.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 113, 0, 0, 0, 34, 147
|
||||
"d:\Projects\C\cleonos\clks\kernel\shell.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1249, 0, 0, 0, 317, 1566
|
||||
"d:\Projects\C\cleonos\clks\kernel\syscall.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 619, 0, 0, 0, 140, 759
|
||||
"d:\Projects\C\cleonos\clks\kernel\tty.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1115, 0, 0, 0, 275, 1390
|
||||
"d:\Projects\C\cleonos\clks\kernel\userland.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 124, 0, 0, 0, 35, 159
|
||||
"d:\Projects\C\cleonos\clks\lib\libc_compat.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25, 0, 0, 0, 7, 32
|
||||
"d:\Projects\C\cleonos\clks\lib\string.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 16, 70
|
||||
"d:\Projects\C\cleonos\clks\rust\src\lib.rs", "Rust", 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, 0, 0, 0, 0, 6, 27
|
||||
"d:\Projects\C\cleonos\cmake\check_tools.cmake", "CMake", 0, 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, 0, 6, 38
|
||||
"d:\Projects\C\cleonos\cmake\log.cmake", "CMake", 0, 0, 0, 0, 0, 0, 0, 0, 30, 0, 0, 0, 0, 0, 6, 36
|
||||
"d:\Projects\C\cleonos\cmake\log_emit.cmake", "CMake", 0, 0, 0, 0, 0, 0, 0, 0, 23, 0, 0, 0, 0, 0, 6, 29
|
||||
"d:\Projects\C\cleonos\cmake\setup_limine.cmake", "CMake", 0, 0, 0, 0, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 18, 118
|
||||
"d:\Projects\C\cleonos\configs\limine.conf", "Properties", 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 1, 7
|
||||
"d:\Projects\C\cleonos\docs\README.md", "Markdown", 0, 0, 0, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 35
|
||||
"d:\Projects\C\cleonos\docs\stage1.md", "Markdown", 0, 0, 0, 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 46
|
||||
"d:\Projects\C\cleonos\docs\stage10.md", "Markdown", 0, 0, 0, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 40
|
||||
"d:\Projects\C\cleonos\docs\stage11.md", "Markdown", 0, 0, 0, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 41
|
||||
"d:\Projects\C\cleonos\docs\stage12.md", "Markdown", 0, 0, 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 46
|
||||
"d:\Projects\C\cleonos\docs\stage13.md", "Markdown", 0, 0, 0, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 40
|
||||
"d:\Projects\C\cleonos\docs\stage14.md", "Markdown", 0, 0, 0, 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 52
|
||||
"d:\Projects\C\cleonos\docs\stage15.md", "Markdown", 0, 0, 0, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 54
|
||||
"d:\Projects\C\cleonos\docs\stage2.md", "Markdown", 0, 0, 0, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 35
|
||||
"d:\Projects\C\cleonos\docs\stage20.md", "Markdown", 0, 0, 0, 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 52
|
||||
"d:\Projects\C\cleonos\docs\stage21.md", "Markdown", 0, 0, 0, 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 79
|
||||
"d:\Projects\C\cleonos\docs\stage22.md", "Markdown", 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 75
|
||||
"d:\Projects\C\cleonos\docs\stage23.md", "Markdown", 0, 0, 0, 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 47
|
||||
"d:\Projects\C\cleonos\docs\stage24.md", "Markdown", 0, 0, 0, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 49
|
||||
"d:\Projects\C\cleonos\docs\stage25.md", "Markdown", 0, 0, 0, 58, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 65
|
||||
"d:\Projects\C\cleonos\docs\stage26.md", "Markdown", 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 39
|
||||
"d:\Projects\C\cleonos\docs\stage27.md", "Markdown", 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 39
|
||||
"d:\Projects\C\cleonos\docs\stage28.md", "Markdown", 0, 0, 0, 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 44
|
||||
"d:\Projects\C\cleonos\docs\stage29.md", "Markdown", 0, 0, 0, 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 40
|
||||
"d:\Projects\C\cleonos\docs\stage3.md", "Markdown", 0, 0, 0, 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 34
|
||||
"d:\Projects\C\cleonos\docs\stage4.md", "Markdown", 0, 0, 0, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 35
|
||||
"d:\Projects\C\cleonos\docs\stage5.md", "Markdown", 0, 0, 0, 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 34
|
||||
"d:\Projects\C\cleonos\docs\stage6.md", "Markdown", 0, 0, 0, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 36
|
||||
"d:\Projects\C\cleonos\docs\stage7.md", "Markdown", 0, 0, 0, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 40
|
||||
"d:\Projects\C\cleonos\docs\stage8.md", "Markdown", 0, 0, 0, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 37
|
||||
"d:\Projects\C\cleonos\docs\stage9.md", "Markdown", 0, 0, 0, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 37
|
||||
"d:\Projects\C\cleonos\docs\syscall.md", "Markdown", 0, 0, 0, 328, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 154, 482
|
||||
"d:\Projects\C\cleonos\ramdisk\shell\init.cmd", "Batch", 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 6
|
||||
"d:\Projects\C\cleonos\scripts\gen-tty-psf.ps1", "PowerShell", 0, 0, 0, 0, 0, 171, 0, 0, 0, 0, 0, 0, 0, 2, 42, 215
|
||||
"d:\Projects\C\cleonos\wine\README.md", "Markdown", 0, 0, 0, 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 68
|
||||
"d:\Projects\C\cleonos\wine\cleonos_wine.py", "Python", 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 7
|
||||
"d:\Projects\C\cleonos\wine\cleonos_wine_lib\__init__.py", "Python", 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 5
|
||||
"d:\Projects\C\cleonos\wine\cleonos_wine_lib\cli.py", "Python", 0, 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 54
|
||||
"d:\Projects\C\cleonos\wine\cleonos_wine_lib\constants.py", "Python", 0, 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 11, 88
|
||||
"d:\Projects\C\cleonos\wine\cleonos_wine_lib\input_pump.py", "Python", 0, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 99
|
||||
"d:\Projects\C\cleonos\wine\cleonos_wine_lib\platform.py", "Python", 0, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 60
|
||||
"d:\Projects\C\cleonos\wine\cleonos_wine_lib\runner.py", "Python", 0, 990, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 175, 1165
|
||||
"d:\Projects\C\cleonos\wine\cleonos_wine_lib\state.py", "Python", 0, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 40, 204
|
||||
"d:\Projects\C\cleonos\wine\requirements.txt", "pip requirements", 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2
|
||||
"Total", "-", 1, 1418, 48, 1573, 4, 171, 6, 100, 772, 44, 16864, 1009, 130, 11, 5616, 27767
|
||||
|
1
.VSCodeCounter/2026-04-17_16-44-24/results.json
Normal file
1
.VSCodeCounter/2026-04-17_16-44-24/results.json
Normal file
File diff suppressed because one or more lines are too long
69
.VSCodeCounter/2026-04-17_16-44-24/results.md
Normal file
69
.VSCodeCounter/2026-04-17_16-44-24/results.md
Normal file
@@ -0,0 +1,69 @@
|
||||
# Summary
|
||||
|
||||
Date : 2026-04-17 16:44:24
|
||||
|
||||
Directory d:\\Projects\\C\\cleonos
|
||||
|
||||
Total : 183 files, 22140 codes, 11 comments, 5616 blanks, all 27767 lines
|
||||
|
||||
Summary / [Details](details.md) / [Diff Summary](diff.md) / [Diff Details](diff-details.md)
|
||||
|
||||
## Languages
|
||||
| language | files | code | comment | blank | total |
|
||||
| :--- | ---: | ---: | ---: | ---: | ---: |
|
||||
| C | 92 | 16,864 | 7 | 4,488 | 21,359 |
|
||||
| Markdown | 30 | 1,573 | 0 | 400 | 1,973 |
|
||||
| Python | 8 | 1,418 | 2 | 262 | 1,682 |
|
||||
| C++ | 38 | 1,009 | 0 | 231 | 1,240 |
|
||||
| CMake | 5 | 772 | 0 | 122 | 894 |
|
||||
| PowerShell | 1 | 171 | 2 | 42 | 215 |
|
||||
| Go Assembly | 2 | 130 | 0 | 20 | 150 |
|
||||
| Makefile | 1 | 100 | 0 | 22 | 122 |
|
||||
| YAML | 1 | 48 | 0 | 10 | 58 |
|
||||
| Rust | 2 | 44 | 0 | 15 | 59 |
|
||||
| Properties | 1 | 6 | 0 | 1 | 7 |
|
||||
| Batch | 1 | 4 | 0 | 2 | 6 |
|
||||
| pip requirements | 1 | 1 | 0 | 1 | 2 |
|
||||
|
||||
## Directories
|
||||
| path | files | code | comment | blank | total |
|
||||
| :--- | ---: | ---: | ---: | ---: | ---: |
|
||||
| . | 183 | 22,140 | 11 | 5,616 | 27,767 |
|
||||
| . (Files) | 4 | 871 | 0 | 176 | 1,047 |
|
||||
| .github | 1 | 48 | 0 | 10 | 58 |
|
||||
| .github\\workflows | 1 | 48 | 0 | 10 | 58 |
|
||||
| cleonos | 65 | 8,697 | 5 | 2,303 | 11,005 |
|
||||
| cleonos\\c | 64 | 8,674 | 5 | 2,294 | 10,973 |
|
||||
| cleonos\\c (Files) | 1 | 3 | 4 | 2 | 9 |
|
||||
| cleonos\\c\\apps | 59 | 8,309 | 1 | 2,206 | 10,516 |
|
||||
| cleonos\\c\\apps (Files) | 52 | 4,755 | 1 | 1,277 | 6,033 |
|
||||
| cleonos\\c\\apps\\shell | 7 | 3,554 | 0 | 929 | 4,483 |
|
||||
| cleonos\\c\\include | 2 | 134 | 0 | 10 | 144 |
|
||||
| cleonos\\c\\src | 2 | 228 | 0 | 76 | 304 |
|
||||
| cleonos\\rust | 1 | 23 | 0 | 9 | 32 |
|
||||
| cleonos\\rust\\src | 1 | 23 | 0 | 9 | 32 |
|
||||
| clks | 69 | 9,350 | 2 | 2,451 | 11,803 |
|
||||
| clks\\arch | 4 | 142 | 0 | 22 | 164 |
|
||||
| clks\\arch\\aarch64 | 1 | 6 | 0 | 1 | 7 |
|
||||
| clks\\arch\\x86_64 | 3 | 136 | 0 | 21 | 157 |
|
||||
| clks\\drivers | 7 | 721 | 0 | 183 | 904 |
|
||||
| clks\\drivers\\audio | 1 | 101 | 0 | 25 | 126 |
|
||||
| clks\\drivers\\serial | 1 | 52 | 0 | 16 | 68 |
|
||||
| clks\\drivers\\video | 5 | 568 | 0 | 142 | 710 |
|
||||
| clks\\include | 32 | 683 | 0 | 174 | 857 |
|
||||
| clks\\include\\clks | 32 | 683 | 0 | 174 | 857 |
|
||||
| clks\\kernel | 23 | 7,704 | 2 | 2,043 | 9,749 |
|
||||
| clks\\lib | 2 | 79 | 0 | 23 | 102 |
|
||||
| clks\\rust | 1 | 21 | 0 | 6 | 27 |
|
||||
| clks\\rust\\src | 1 | 21 | 0 | 6 | 27 |
|
||||
| cmake | 4 | 185 | 0 | 36 | 221 |
|
||||
| configs | 1 | 6 | 0 | 1 | 7 |
|
||||
| docs | 27 | 1,340 | 0 | 313 | 1,653 |
|
||||
| ramdisk | 1 | 4 | 0 | 2 | 6 |
|
||||
| ramdisk\\shell | 1 | 4 | 0 | 2 | 6 |
|
||||
| scripts | 1 | 171 | 2 | 42 | 215 |
|
||||
| wine | 10 | 1,468 | 2 | 282 | 1,752 |
|
||||
| wine (Files) | 3 | 53 | 1 | 23 | 77 |
|
||||
| wine\\cleonos_wine_lib | 7 | 1,415 | 1 | 259 | 1,675 |
|
||||
|
||||
Summary / [Details](details.md) / [Diff Summary](diff.md) / [Diff Details](diff-details.md)
|
||||
255
.VSCodeCounter/2026-04-17_16-44-24/results.txt
Normal file
255
.VSCodeCounter/2026-04-17_16-44-24/results.txt
Normal file
@@ -0,0 +1,255 @@
|
||||
Date : 2026-04-17 16:44:24
|
||||
Directory : d:\Projects\C\cleonos
|
||||
Total : 183 files, 22140 codes, 11 comments, 5616 blanks, all 27767 lines
|
||||
|
||||
Languages
|
||||
+------------------+------------+------------+------------+------------+------------+
|
||||
| language | files | code | comment | blank | total |
|
||||
+------------------+------------+------------+------------+------------+------------+
|
||||
| C | 92 | 16,864 | 7 | 4,488 | 21,359 |
|
||||
| Markdown | 30 | 1,573 | 0 | 400 | 1,973 |
|
||||
| Python | 8 | 1,418 | 2 | 262 | 1,682 |
|
||||
| C++ | 38 | 1,009 | 0 | 231 | 1,240 |
|
||||
| CMake | 5 | 772 | 0 | 122 | 894 |
|
||||
| PowerShell | 1 | 171 | 2 | 42 | 215 |
|
||||
| Go Assembly | 2 | 130 | 0 | 20 | 150 |
|
||||
| Makefile | 1 | 100 | 0 | 22 | 122 |
|
||||
| YAML | 1 | 48 | 0 | 10 | 58 |
|
||||
| Rust | 2 | 44 | 0 | 15 | 59 |
|
||||
| Properties | 1 | 6 | 0 | 1 | 7 |
|
||||
| Batch | 1 | 4 | 0 | 2 | 6 |
|
||||
| pip requirements | 1 | 1 | 0 | 1 | 2 |
|
||||
+------------------+------------+------------+------------+------------+------------+
|
||||
|
||||
Directories
|
||||
+---------------------------------------------------------------+------------+------------+------------+------------+------------+
|
||||
| path | files | code | comment | blank | total |
|
||||
+---------------------------------------------------------------+------------+------------+------------+------------+------------+
|
||||
| . | 183 | 22,140 | 11 | 5,616 | 27,767 |
|
||||
| . (Files) | 4 | 871 | 0 | 176 | 1,047 |
|
||||
| .github | 1 | 48 | 0 | 10 | 58 |
|
||||
| .github\workflows | 1 | 48 | 0 | 10 | 58 |
|
||||
| cleonos | 65 | 8,697 | 5 | 2,303 | 11,005 |
|
||||
| cleonos\c | 64 | 8,674 | 5 | 2,294 | 10,973 |
|
||||
| cleonos\c (Files) | 1 | 3 | 4 | 2 | 9 |
|
||||
| cleonos\c\apps | 59 | 8,309 | 1 | 2,206 | 10,516 |
|
||||
| cleonos\c\apps (Files) | 52 | 4,755 | 1 | 1,277 | 6,033 |
|
||||
| cleonos\c\apps\shell | 7 | 3,554 | 0 | 929 | 4,483 |
|
||||
| cleonos\c\include | 2 | 134 | 0 | 10 | 144 |
|
||||
| cleonos\c\src | 2 | 228 | 0 | 76 | 304 |
|
||||
| cleonos\rust | 1 | 23 | 0 | 9 | 32 |
|
||||
| cleonos\rust\src | 1 | 23 | 0 | 9 | 32 |
|
||||
| clks | 69 | 9,350 | 2 | 2,451 | 11,803 |
|
||||
| clks\arch | 4 | 142 | 0 | 22 | 164 |
|
||||
| clks\arch\aarch64 | 1 | 6 | 0 | 1 | 7 |
|
||||
| clks\arch\x86_64 | 3 | 136 | 0 | 21 | 157 |
|
||||
| clks\drivers | 7 | 721 | 0 | 183 | 904 |
|
||||
| clks\drivers\audio | 1 | 101 | 0 | 25 | 126 |
|
||||
| clks\drivers\serial | 1 | 52 | 0 | 16 | 68 |
|
||||
| clks\drivers\video | 5 | 568 | 0 | 142 | 710 |
|
||||
| clks\include | 32 | 683 | 0 | 174 | 857 |
|
||||
| clks\include\clks | 32 | 683 | 0 | 174 | 857 |
|
||||
| clks\kernel | 23 | 7,704 | 2 | 2,043 | 9,749 |
|
||||
| clks\lib | 2 | 79 | 0 | 23 | 102 |
|
||||
| clks\rust | 1 | 21 | 0 | 6 | 27 |
|
||||
| clks\rust\src | 1 | 21 | 0 | 6 | 27 |
|
||||
| cmake | 4 | 185 | 0 | 36 | 221 |
|
||||
| configs | 1 | 6 | 0 | 1 | 7 |
|
||||
| docs | 27 | 1,340 | 0 | 313 | 1,653 |
|
||||
| ramdisk | 1 | 4 | 0 | 2 | 6 |
|
||||
| ramdisk\shell | 1 | 4 | 0 | 2 | 6 |
|
||||
| scripts | 1 | 171 | 2 | 42 | 215 |
|
||||
| wine | 10 | 1,468 | 2 | 282 | 1,752 |
|
||||
| wine (Files) | 3 | 53 | 1 | 23 | 77 |
|
||||
| wine\cleonos_wine_lib | 7 | 1,415 | 1 | 259 | 1,675 |
|
||||
+---------------------------------------------------------------+------------+------------+------------+------------+------------+
|
||||
|
||||
Files
|
||||
+---------------------------------------------------------------+------------------+------------+------------+------------+------------+
|
||||
| filename | language | code | comment | blank | total |
|
||||
+---------------------------------------------------------------+------------------+------------+------------+------------+------------+
|
||||
| d:\Projects\C\cleonos\.github\workflows\build-os.yml | YAML | 48 | 0 | 10 | 58 |
|
||||
| d:\Projects\C\cleonos\CMakeLists.txt | CMake | 587 | 0 | 86 | 673 |
|
||||
| d:\Projects\C\cleonos\Makefile | Makefile | 100 | 0 | 22 | 122 |
|
||||
| d:\Projects\C\cleonos\README.md | Markdown | 92 | 0 | 34 | 126 |
|
||||
| d:\Projects\C\cleonos\README.zh-CN.md | Markdown | 92 | 0 | 34 | 126 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\ansi_main.c | C | 43 | 0 | 11 | 54 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\ansitest_main.c | C | 142 | 0 | 35 | 177 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\append_main.c | C | 74 | 0 | 18 | 92 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\args_main.c | C | 49 | 0 | 13 | 62 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\cat_main.c | C | 83 | 0 | 24 | 107 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\cd_main.c | C | 54 | 0 | 15 | 69 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\clear_main.c | C | 39 | 0 | 11 | 50 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\cmd_runtime.c | C | 446 | 0 | 143 | 589 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\cmd_runtime.h | C++ | 80 | 0 | 19 | 99 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\cp_main.c | C | 95 | 0 | 26 | 121 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\cut_main.c | C | 214 | 1 | 55 | 270 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\dmesg_main.c | C | 64 | 0 | 18 | 82 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\elfrunner_kmain.c | C | 6 | 0 | 3 | 9 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\elfrunner_main.c | C | 6 | 0 | 3 | 9 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\exec_main.c | C | 87 | 0 | 22 | 109 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\exit_main.c | C | 54 | 0 | 14 | 68 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\fastfetch_main.c | C | 180 | 0 | 34 | 214 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\fsstat_main.c | C | 45 | 0 | 11 | 56 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\grep_main.c | C | 195 | 0 | 54 | 249 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\head_main.c | C | 164 | 0 | 47 | 211 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\hello_main.c | C | 6 | 0 | 2 | 8 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\help_main.c | C | 75 | 0 | 10 | 85 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\kbdstat_main.c | C | 44 | 0 | 11 | 55 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\ls_main.c | C | 262 | 0 | 76 | 338 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\memc_kmain.c | C | 6 | 0 | 3 | 9 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\memc_main.c | C | 8 | 0 | 3 | 11 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\memstat_main.c | C | 43 | 0 | 11 | 54 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\mkdir_main.c | C | 57 | 0 | 16 | 73 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\mv_main.c | C | 102 | 0 | 28 | 130 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\pid_main.c | C | 39 | 0 | 11 | 50 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\pwd_main.c | C | 39 | 0 | 11 | 50 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\restart_main.c | C | 40 | 0 | 11 | 51 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\rm_main.c | C | 57 | 0 | 16 | 73 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\shell\shell_cmd.c | C | 2,311 | 0 | 574 | 2,885 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\shell\shell_external.c | C | 166 | 0 | 55 | 221 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\shell\shell_input.c | C | 514 | 0 | 132 | 646 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\shell\shell_internal.h | C++ | 92 | 0 | 20 | 112 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\shell\shell_path.c | C | 153 | 0 | 50 | 203 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\shell\shell_script.c | C | 35 | 0 | 12 | 47 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\shell\shell_util.c | C | 283 | 0 | 86 | 369 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\shell_main.c | C | 19 | 0 | 6 | 25 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\shstat_main.c | C | 45 | 0 | 11 | 56 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\shutdown_main.c | C | 40 | 0 | 11 | 51 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\sleep_main.c | C | 52 | 0 | 14 | 66 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\sort_main.c | C | 205 | 0 | 63 | 268 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\spawn_main.c | C | 76 | 0 | 20 | 96 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\stats_main.c | C | 102 | 0 | 17 | 119 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\tail_main.c | C | 190 | 0 | 54 | 244 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\taskstat_main.c | C | 43 | 0 | 11 | 54 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\touch_main.c | C | 58 | 0 | 16 | 74 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\tty_main.c | C | 64 | 0 | 17 | 81 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\ttydrv_main.c | C | 6 | 0 | 3 | 9 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\uniq_main.c | C | 168 | 0 | 48 | 216 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\userstat_main.c | C | 48 | 0 | 11 | 59 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\wait_main.c | C | 68 | 0 | 17 | 85 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\wavplay_main.c | C | 396 | 0 | 99 | 495 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\wc_main.c | C | 164 | 0 | 45 | 209 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\write_main.c | C | 74 | 0 | 18 | 92 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\yield_main.c | C | 39 | 0 | 11 | 50 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\include\cleonos_rust_bridge.h | C++ | 6 | 0 | 4 | 10 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\include\cleonos_syscall.h | C++ | 128 | 0 | 6 | 134 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\src\runtime.c | C | 37 | 0 | 12 | 49 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\src\syscall.c | C | 191 | 0 | 64 | 255 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\stub.c | C | 3 | 4 | 2 | 9 |
|
||||
| d:\Projects\C\cleonos\cleonos\rust\src\lib.rs | Rust | 23 | 0 | 9 | 32 |
|
||||
| d:\Projects\C\cleonos\clks\arch\aarch64\boot.c | C | 6 | 0 | 1 | 7 |
|
||||
| d:\Projects\C\cleonos\clks\arch\x86_64\boot.c | C | 6 | 0 | 1 | 7 |
|
||||
| d:\Projects\C\cleonos\clks\arch\x86_64\exec_stack_call.S | Go Assembly | 22 | 0 | 8 | 30 |
|
||||
| d:\Projects\C\cleonos\clks\arch\x86_64\interrupt_stubs.S | Go Assembly | 108 | 0 | 12 | 120 |
|
||||
| d:\Projects\C\cleonos\clks\drivers\audio\pcspeaker.c | C | 101 | 0 | 25 | 126 |
|
||||
| d:\Projects\C\cleonos\clks\drivers\serial\serial.c | C | 52 | 0 | 16 | 68 |
|
||||
| d:\Projects\C\cleonos\clks\drivers\video\font8x8.c | C | 67 | 0 | 8 | 75 |
|
||||
| d:\Projects\C\cleonos\clks\drivers\video\font8x8.h | C++ | 5 | 0 | 3 | 8 |
|
||||
| d:\Projects\C\cleonos\clks\drivers\video\framebuffer.c | C | 251 | 0 | 70 | 321 |
|
||||
| d:\Projects\C\cleonos\clks\drivers\video\psf_font.c | C | 230 | 0 | 56 | 286 |
|
||||
| d:\Projects\C\cleonos\clks\drivers\video\psf_font.h | C++ | 15 | 0 | 5 | 20 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\audio.h | C++ | 9 | 0 | 3 | 12 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\boot.h | C++ | 11 | 0 | 4 | 15 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\compiler.h | C++ | 13 | 0 | 4 | 17 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\cpu.h | C++ | 20 | 0 | 4 | 24 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\desktop.h | C++ | 7 | 0 | 4 | 11 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\driver.h | C++ | 29 | 0 | 8 | 37 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\elf64.h | C++ | 32 | 0 | 9 | 41 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\elfrunner.h | C++ | 6 | 0 | 3 | 9 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\exec.h | C++ | 34 | 0 | 4 | 38 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\framebuffer.h | C++ | 26 | 0 | 6 | 32 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\fs.h | C++ | 23 | 0 | 7 | 30 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\heap.h | C++ | 15 | 0 | 4 | 19 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\interrupts.h | C++ | 6 | 0 | 3 | 9 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\kelf.h | C++ | 9 | 0 | 5 | 14 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\kernel.h | C++ | 4 | 0 | 2 | 6 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\keyboard.h | C++ | 27 | 0 | 6 | 33 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\limine.h | C++ | 132 | 0 | 24 | 156 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\log.h | C++ | 14 | 0 | 5 | 19 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\mouse.h | C++ | 20 | 0 | 6 | 26 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\panic.h | C++ | 7 | 0 | 3 | 10 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\pmm.h | C++ | 16 | 0 | 5 | 21 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\ramdisk.h | C++ | 17 | 0 | 8 | 25 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\scheduler.h | C++ | 18 | 0 | 5 | 23 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\serial.h | C++ | 6 | 0 | 2 | 8 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\service.h | C++ | 31 | 0 | 8 | 39 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\shell.h | C++ | 7 | 0 | 3 | 10 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\string.h | C++ | 9 | 0 | 3 | 12 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\syscall.h | C++ | 68 | 0 | 5 | 73 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\task.h | C++ | 24 | 0 | 7 | 31 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\tty.h | C++ | 14 | 0 | 4 | 18 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\types.h | C++ | 17 | 0 | 6 | 23 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\userland.h | C++ | 12 | 0 | 4 | 16 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\desktop.c | C | 321 | 0 | 86 | 407 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\driver.c | C | 169 | 0 | 49 | 218 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\elf64.c | C | 239 | 0 | 73 | 312 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\elfrunner.c | C | 30 | 0 | 8 | 38 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\exec.c | C | 854 | 0 | 237 | 1,091 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\fs.c | C | 698 | 0 | 220 | 918 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\heap.c | C | 134 | 0 | 42 | 176 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\interrupts.c | C | 311 | 0 | 44 | 355 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\kelf.c | C | 203 | 1 | 53 | 257 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\keyboard.c | C | 311 | 0 | 79 | 390 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\kmain.c | C | 200 | 1 | 52 | 253 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\limine_requests.c | C | 76 | 0 | 26 | 102 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\log.c | C | 123 | 0 | 33 | 156 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\mouse.c | C | 246 | 0 | 63 | 309 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\panic.c | C | 179 | 0 | 60 | 239 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\pmm.c | C | 82 | 0 | 23 | 105 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\ramdisk.c | C | 172 | 0 | 50 | 222 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\scheduler.c | C | 136 | 0 | 44 | 180 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\service.c | C | 113 | 0 | 34 | 147 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\shell.c | C | 1,249 | 0 | 317 | 1,566 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\syscall.c | C | 619 | 0 | 140 | 759 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\tty.c | C | 1,115 | 0 | 275 | 1,390 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\userland.c | C | 124 | 0 | 35 | 159 |
|
||||
| d:\Projects\C\cleonos\clks\lib\libc_compat.c | C | 25 | 0 | 7 | 32 |
|
||||
| d:\Projects\C\cleonos\clks\lib\string.c | C | 54 | 0 | 16 | 70 |
|
||||
| d:\Projects\C\cleonos\clks\rust\src\lib.rs | Rust | 21 | 0 | 6 | 27 |
|
||||
| d:\Projects\C\cleonos\cmake\check_tools.cmake | CMake | 32 | 0 | 6 | 38 |
|
||||
| d:\Projects\C\cleonos\cmake\log.cmake | CMake | 30 | 0 | 6 | 36 |
|
||||
| d:\Projects\C\cleonos\cmake\log_emit.cmake | CMake | 23 | 0 | 6 | 29 |
|
||||
| d:\Projects\C\cleonos\cmake\setup_limine.cmake | CMake | 100 | 0 | 18 | 118 |
|
||||
| d:\Projects\C\cleonos\configs\limine.conf | Properties | 6 | 0 | 1 | 7 |
|
||||
| d:\Projects\C\cleonos\docs\README.md | Markdown | 31 | 0 | 4 | 35 |
|
||||
| d:\Projects\C\cleonos\docs\stage1.md | Markdown | 41 | 0 | 5 | 46 |
|
||||
| d:\Projects\C\cleonos\docs\stage10.md | Markdown | 34 | 0 | 6 | 40 |
|
||||
| d:\Projects\C\cleonos\docs\stage11.md | Markdown | 36 | 0 | 5 | 41 |
|
||||
| d:\Projects\C\cleonos\docs\stage12.md | Markdown | 40 | 0 | 6 | 46 |
|
||||
| d:\Projects\C\cleonos\docs\stage13.md | Markdown | 34 | 0 | 6 | 40 |
|
||||
| d:\Projects\C\cleonos\docs\stage14.md | Markdown | 44 | 0 | 8 | 52 |
|
||||
| d:\Projects\C\cleonos\docs\stage15.md | Markdown | 47 | 0 | 7 | 54 |
|
||||
| d:\Projects\C\cleonos\docs\stage2.md | Markdown | 30 | 0 | 5 | 35 |
|
||||
| d:\Projects\C\cleonos\docs\stage20.md | Markdown | 46 | 0 | 6 | 52 |
|
||||
| d:\Projects\C\cleonos\docs\stage21.md | Markdown | 72 | 0 | 7 | 79 |
|
||||
| d:\Projects\C\cleonos\docs\stage22.md | Markdown | 68 | 0 | 7 | 75 |
|
||||
| d:\Projects\C\cleonos\docs\stage23.md | Markdown | 41 | 0 | 6 | 47 |
|
||||
| d:\Projects\C\cleonos\docs\stage24.md | Markdown | 42 | 0 | 7 | 49 |
|
||||
| d:\Projects\C\cleonos\docs\stage25.md | Markdown | 58 | 0 | 7 | 65 |
|
||||
| d:\Projects\C\cleonos\docs\stage26.md | Markdown | 32 | 0 | 7 | 39 |
|
||||
| d:\Projects\C\cleonos\docs\stage27.md | Markdown | 32 | 0 | 7 | 39 |
|
||||
| d:\Projects\C\cleonos\docs\stage28.md | Markdown | 37 | 0 | 7 | 44 |
|
||||
| d:\Projects\C\cleonos\docs\stage29.md | Markdown | 33 | 0 | 7 | 40 |
|
||||
| d:\Projects\C\cleonos\docs\stage3.md | Markdown | 29 | 0 | 5 | 34 |
|
||||
| d:\Projects\C\cleonos\docs\stage4.md | Markdown | 30 | 0 | 5 | 35 |
|
||||
| d:\Projects\C\cleonos\docs\stage5.md | Markdown | 29 | 0 | 5 | 34 |
|
||||
| d:\Projects\C\cleonos\docs\stage6.md | Markdown | 30 | 0 | 6 | 36 |
|
||||
| d:\Projects\C\cleonos\docs\stage7.md | Markdown | 34 | 0 | 6 | 40 |
|
||||
| d:\Projects\C\cleonos\docs\stage8.md | Markdown | 31 | 0 | 6 | 37 |
|
||||
| d:\Projects\C\cleonos\docs\stage9.md | Markdown | 31 | 0 | 6 | 37 |
|
||||
| d:\Projects\C\cleonos\docs\syscall.md | Markdown | 328 | 0 | 154 | 482 |
|
||||
| d:\Projects\C\cleonos\ramdisk\shell\init.cmd | Batch | 4 | 0 | 2 | 6 |
|
||||
| d:\Projects\C\cleonos\scripts\gen-tty-psf.ps1 | PowerShell | 171 | 2 | 42 | 215 |
|
||||
| d:\Projects\C\cleonos\wine\README.md | Markdown | 49 | 0 | 19 | 68 |
|
||||
| d:\Projects\C\cleonos\wine\cleonos_wine.py | Python | 3 | 1 | 3 | 7 |
|
||||
| d:\Projects\C\cleonos\wine\cleonos_wine_lib\__init__.py | Python | 4 | 0 | 1 | 5 |
|
||||
| d:\Projects\C\cleonos\wine\cleonos_wine_lib\cli.py | Python | 44 | 0 | 10 | 54 |
|
||||
| d:\Projects\C\cleonos\wine\cleonos_wine_lib\constants.py | Python | 76 | 1 | 11 | 88 |
|
||||
| d:\Projects\C\cleonos\wine\cleonos_wine_lib\input_pump.py | Python | 82 | 0 | 17 | 99 |
|
||||
| d:\Projects\C\cleonos\wine\cleonos_wine_lib\platform.py | Python | 55 | 0 | 5 | 60 |
|
||||
| d:\Projects\C\cleonos\wine\cleonos_wine_lib\runner.py | Python | 990 | 0 | 175 | 1,165 |
|
||||
| d:\Projects\C\cleonos\wine\cleonos_wine_lib\state.py | Python | 164 | 0 | 40 | 204 |
|
||||
| d:\Projects\C\cleonos\wine\requirements.txt | pip requirements | 1 | 0 | 1 | 2 |
|
||||
| Total | | 22,140 | 11 | 5,616 | 27,767 |
|
||||
+---------------------------------------------------------------+------------------+------------+------------+------------+------------+
|
||||
207
.VSCodeCounter/2026-04-17_19-36-06/details.md
Normal file
207
.VSCodeCounter/2026-04-17_19-36-06/details.md
Normal file
@@ -0,0 +1,207 @@
|
||||
# Details
|
||||
|
||||
Date : 2026-04-17 19:36:06
|
||||
|
||||
Directory d:\\Projects\\C\\cleonos
|
||||
|
||||
Total : 192 files, 25119 codes, 12 comments, 6368 blanks, all 31499 lines
|
||||
|
||||
[Summary](results.md) / Details / [Diff Summary](diff.md) / [Diff Details](diff-details.md)
|
||||
|
||||
## Files
|
||||
| filename | language | code | comment | blank | total |
|
||||
| :--- | :--- | ---: | ---: | ---: | ---: |
|
||||
| [.github/workflows/build-os.yml](/.github/workflows/build-os.yml) | YAML | 48 | 0 | 10 | 58 |
|
||||
| [CMakeLists.txt](/CMakeLists.txt) | CMake | 614 | 0 | 88 | 702 |
|
||||
| [Makefile](/Makefile) | Makefile | 100 | 0 | 22 | 122 |
|
||||
| [README.md](/README.md) | Markdown | 92 | 0 | 34 | 126 |
|
||||
| [README.zh-CN.md](/README.zh-CN.md) | Markdown | 92 | 0 | 34 | 126 |
|
||||
| [cleonos/c/apps/ansi\_main.c](/cleonos/c/apps/ansi_main.c) | C | 43 | 0 | 11 | 54 |
|
||||
| [cleonos/c/apps/ansitest\_main.c](/cleonos/c/apps/ansitest_main.c) | C | 142 | 0 | 35 | 177 |
|
||||
| [cleonos/c/apps/append\_main.c](/cleonos/c/apps/append_main.c) | C | 74 | 0 | 18 | 92 |
|
||||
| [cleonos/c/apps/args\_main.c](/cleonos/c/apps/args_main.c) | C | 49 | 0 | 13 | 62 |
|
||||
| [cleonos/c/apps/bg\_main.c](/cleonos/c/apps/bg_main.c) | C | 101 | 0 | 26 | 127 |
|
||||
| [cleonos/c/apps/cat\_main.c](/cleonos/c/apps/cat_main.c) | C | 83 | 0 | 24 | 107 |
|
||||
| [cleonos/c/apps/cd\_main.c](/cleonos/c/apps/cd_main.c) | C | 54 | 0 | 15 | 69 |
|
||||
| [cleonos/c/apps/clear\_main.c](/cleonos/c/apps/clear_main.c) | C | 39 | 0 | 11 | 50 |
|
||||
| [cleonos/c/apps/cmd\_runtime.c](/cleonos/c/apps/cmd_runtime.c) | C | 446 | 0 | 143 | 589 |
|
||||
| [cleonos/c/apps/cmd\_runtime.h](/cleonos/c/apps/cmd_runtime.h) | C++ | 80 | 0 | 19 | 99 |
|
||||
| [cleonos/c/apps/cp\_main.c](/cleonos/c/apps/cp_main.c) | C | 95 | 0 | 26 | 121 |
|
||||
| [cleonos/c/apps/cut\_main.c](/cleonos/c/apps/cut_main.c) | C | 214 | 1 | 55 | 270 |
|
||||
| [cleonos/c/apps/dmesg\_main.c](/cleonos/c/apps/dmesg_main.c) | C | 64 | 0 | 18 | 82 |
|
||||
| [cleonos/c/apps/elfrunner\_kmain.c](/cleonos/c/apps/elfrunner_kmain.c) | C | 6 | 0 | 3 | 9 |
|
||||
| [cleonos/c/apps/elfrunner\_main.c](/cleonos/c/apps/elfrunner_main.c) | C | 6 | 0 | 3 | 9 |
|
||||
| [cleonos/c/apps/exec\_main.c](/cleonos/c/apps/exec_main.c) | C | 87 | 0 | 22 | 109 |
|
||||
| [cleonos/c/apps/exit\_main.c](/cleonos/c/apps/exit_main.c) | C | 54 | 0 | 14 | 68 |
|
||||
| [cleonos/c/apps/fastfetch\_main.c](/cleonos/c/apps/fastfetch_main.c) | C | 180 | 0 | 34 | 214 |
|
||||
| [cleonos/c/apps/fg\_main.c](/cleonos/c/apps/fg_main.c) | C | 150 | 0 | 36 | 186 |
|
||||
| [cleonos/c/apps/fsstat\_main.c](/cleonos/c/apps/fsstat_main.c) | C | 45 | 0 | 11 | 56 |
|
||||
| [cleonos/c/apps/grep\_main.c](/cleonos/c/apps/grep_main.c) | C | 195 | 0 | 54 | 249 |
|
||||
| [cleonos/c/apps/head\_main.c](/cleonos/c/apps/head_main.c) | C | 164 | 0 | 47 | 211 |
|
||||
| [cleonos/c/apps/hello\_main.c](/cleonos/c/apps/hello_main.c) | C | 6 | 0 | 2 | 8 |
|
||||
| [cleonos/c/apps/help\_main.c](/cleonos/c/apps/help_main.c) | C | 79 | 0 | 10 | 89 |
|
||||
| [cleonos/c/apps/jobs\_main.c](/cleonos/c/apps/jobs_main.c) | C | 120 | 0 | 26 | 146 |
|
||||
| [cleonos/c/apps/kbdstat\_main.c](/cleonos/c/apps/kbdstat_main.c) | C | 44 | 0 | 11 | 55 |
|
||||
| [cleonos/c/apps/kdbg\_main.c](/cleonos/c/apps/kdbg_main.c) | C | 214 | 0 | 56 | 270 |
|
||||
| [cleonos/c/apps/kill\_main.c](/cleonos/c/apps/kill_main.c) | C | 144 | 0 | 39 | 183 |
|
||||
| [cleonos/c/apps/ls\_main.c](/cleonos/c/apps/ls_main.c) | C | 262 | 0 | 76 | 338 |
|
||||
| [cleonos/c/apps/memc\_kmain.c](/cleonos/c/apps/memc_kmain.c) | C | 6 | 0 | 3 | 9 |
|
||||
| [cleonos/c/apps/memc\_main.c](/cleonos/c/apps/memc_main.c) | C | 8 | 0 | 3 | 11 |
|
||||
| [cleonos/c/apps/memstat\_main.c](/cleonos/c/apps/memstat_main.c) | C | 43 | 0 | 11 | 54 |
|
||||
| [cleonos/c/apps/mkdir\_main.c](/cleonos/c/apps/mkdir_main.c) | C | 57 | 0 | 16 | 73 |
|
||||
| [cleonos/c/apps/mv\_main.c](/cleonos/c/apps/mv_main.c) | C | 102 | 0 | 28 | 130 |
|
||||
| [cleonos/c/apps/pid\_main.c](/cleonos/c/apps/pid_main.c) | C | 39 | 0 | 11 | 50 |
|
||||
| [cleonos/c/apps/ps\_main.c](/cleonos/c/apps/ps_main.c) | C | 160 | 0 | 35 | 195 |
|
||||
| [cleonos/c/apps/pwd\_main.c](/cleonos/c/apps/pwd_main.c) | C | 39 | 0 | 11 | 50 |
|
||||
| [cleonos/c/apps/restart\_main.c](/cleonos/c/apps/restart_main.c) | C | 40 | 0 | 11 | 51 |
|
||||
| [cleonos/c/apps/rm\_main.c](/cleonos/c/apps/rm_main.c) | C | 57 | 0 | 16 | 73 |
|
||||
| [cleonos/c/apps/shell/shell\_cmd.c](/cleonos/c/apps/shell/shell_cmd.c) | C | 2,314 | 0 | 574 | 2,888 |
|
||||
| [cleonos/c/apps/shell/shell\_external.c](/cleonos/c/apps/shell/shell_external.c) | C | 166 | 0 | 55 | 221 |
|
||||
| [cleonos/c/apps/shell/shell\_input.c](/cleonos/c/apps/shell/shell_input.c) | C | 514 | 0 | 132 | 646 |
|
||||
| [cleonos/c/apps/shell/shell\_internal.h](/cleonos/c/apps/shell/shell_internal.h) | C++ | 92 | 0 | 20 | 112 |
|
||||
| [cleonos/c/apps/shell/shell\_path.c](/cleonos/c/apps/shell/shell_path.c) | C | 153 | 0 | 50 | 203 |
|
||||
| [cleonos/c/apps/shell/shell\_script.c](/cleonos/c/apps/shell/shell_script.c) | C | 35 | 0 | 12 | 47 |
|
||||
| [cleonos/c/apps/shell/shell\_util.c](/cleonos/c/apps/shell/shell_util.c) | C | 283 | 0 | 86 | 369 |
|
||||
| [cleonos/c/apps/shell\_main.c](/cleonos/c/apps/shell_main.c) | C | 19 | 0 | 6 | 25 |
|
||||
| [cleonos/c/apps/shstat\_main.c](/cleonos/c/apps/shstat_main.c) | C | 45 | 0 | 11 | 56 |
|
||||
| [cleonos/c/apps/shutdown\_main.c](/cleonos/c/apps/shutdown_main.c) | C | 40 | 0 | 11 | 51 |
|
||||
| [cleonos/c/apps/sleep\_main.c](/cleonos/c/apps/sleep_main.c) | C | 52 | 0 | 14 | 66 |
|
||||
| [cleonos/c/apps/sort\_main.c](/cleonos/c/apps/sort_main.c) | C | 205 | 0 | 63 | 268 |
|
||||
| [cleonos/c/apps/spawn\_main.c](/cleonos/c/apps/spawn_main.c) | C | 76 | 0 | 20 | 96 |
|
||||
| [cleonos/c/apps/spin\_main.c](/cleonos/c/apps/spin_main.c) | C | 13 | 0 | 4 | 17 |
|
||||
| [cleonos/c/apps/stats\_main.c](/cleonos/c/apps/stats_main.c) | C | 102 | 0 | 17 | 119 |
|
||||
| [cleonos/c/apps/tail\_main.c](/cleonos/c/apps/tail_main.c) | C | 190 | 0 | 54 | 244 |
|
||||
| [cleonos/c/apps/taskstat\_main.c](/cleonos/c/apps/taskstat_main.c) | C | 43 | 0 | 11 | 54 |
|
||||
| [cleonos/c/apps/top\_main.c](/cleonos/c/apps/top_main.c) | C | 195 | 0 | 47 | 242 |
|
||||
| [cleonos/c/apps/touch\_main.c](/cleonos/c/apps/touch_main.c) | C | 58 | 0 | 16 | 74 |
|
||||
| [cleonos/c/apps/tty\_main.c](/cleonos/c/apps/tty_main.c) | C | 64 | 0 | 17 | 81 |
|
||||
| [cleonos/c/apps/ttydrv\_main.c](/cleonos/c/apps/ttydrv_main.c) | C | 6 | 0 | 3 | 9 |
|
||||
| [cleonos/c/apps/uniq\_main.c](/cleonos/c/apps/uniq_main.c) | C | 168 | 0 | 48 | 216 |
|
||||
| [cleonos/c/apps/userstat\_main.c](/cleonos/c/apps/userstat_main.c) | C | 48 | 0 | 11 | 59 |
|
||||
| [cleonos/c/apps/wait\_main.c](/cleonos/c/apps/wait_main.c) | C | 68 | 0 | 17 | 85 |
|
||||
| [cleonos/c/apps/wavplay\_main.c](/cleonos/c/apps/wavplay_main.c) | C | 396 | 0 | 99 | 495 |
|
||||
| [cleonos/c/apps/wc\_main.c](/cleonos/c/apps/wc_main.c) | C | 164 | 0 | 45 | 209 |
|
||||
| [cleonos/c/apps/write\_main.c](/cleonos/c/apps/write_main.c) | C | 74 | 0 | 18 | 92 |
|
||||
| [cleonos/c/apps/yield\_main.c](/cleonos/c/apps/yield_main.c) | C | 39 | 0 | 11 | 50 |
|
||||
| [cleonos/c/include/cleonos\_rust\_bridge.h](/cleonos/c/include/cleonos_rust_bridge.h) | C++ | 6 | 0 | 4 | 10 |
|
||||
| [cleonos/c/include/cleonos\_syscall.h](/cleonos/c/include/cleonos_syscall.h) | C++ | 168 | 0 | 9 | 177 |
|
||||
| [cleonos/c/src/runtime.c](/cleonos/c/src/runtime.c) | C | 37 | 0 | 12 | 49 |
|
||||
| [cleonos/c/src/syscall.c](/cleonos/c/src/syscall.c) | C | 223 | 0 | 74 | 297 |
|
||||
| [cleonos/c/stub.c](/cleonos/c/stub.c) | C | 3 | 4 | 2 | 9 |
|
||||
| [cleonos/rust/src/lib.rs](/cleonos/rust/src/lib.rs) | Rust | 23 | 0 | 9 | 32 |
|
||||
| [clks/arch/aarch64/boot.c](/clks/arch/aarch64/boot.c) | C | 6 | 0 | 1 | 7 |
|
||||
| [clks/arch/x86\_64/boot.c](/clks/arch/x86_64/boot.c) | C | 6 | 0 | 1 | 7 |
|
||||
| [clks/arch/x86\_64/exec\_stack\_call.S](/clks/arch/x86_64/exec_stack_call.S) | Go Assembly | 40 | 0 | 8 | 48 |
|
||||
| [clks/arch/x86\_64/interrupt\_stubs.S](/clks/arch/x86_64/interrupt_stubs.S) | Go Assembly | 108 | 0 | 12 | 120 |
|
||||
| [clks/drivers/audio/pcspeaker.c](/clks/drivers/audio/pcspeaker.c) | C | 101 | 0 | 25 | 126 |
|
||||
| [clks/drivers/serial/serial.c](/clks/drivers/serial/serial.c) | C | 52 | 0 | 16 | 68 |
|
||||
| [clks/drivers/video/font8x8.c](/clks/drivers/video/font8x8.c) | C | 67 | 0 | 8 | 75 |
|
||||
| [clks/drivers/video/font8x8.h](/clks/drivers/video/font8x8.h) | C++ | 5 | 0 | 3 | 8 |
|
||||
| [clks/drivers/video/framebuffer.c](/clks/drivers/video/framebuffer.c) | C | 251 | 0 | 70 | 321 |
|
||||
| [clks/drivers/video/psf\_font.c](/clks/drivers/video/psf_font.c) | C | 230 | 0 | 56 | 286 |
|
||||
| [clks/drivers/video/psf\_font.h](/clks/drivers/video/psf_font.h) | C++ | 15 | 0 | 5 | 20 |
|
||||
| [clks/include/clks/audio.h](/clks/include/clks/audio.h) | C++ | 9 | 0 | 3 | 12 |
|
||||
| [clks/include/clks/boot.h](/clks/include/clks/boot.h) | C++ | 11 | 0 | 4 | 15 |
|
||||
| [clks/include/clks/compiler.h](/clks/include/clks/compiler.h) | C++ | 13 | 0 | 4 | 17 |
|
||||
| [clks/include/clks/cpu.h](/clks/include/clks/cpu.h) | C++ | 20 | 0 | 4 | 24 |
|
||||
| [clks/include/clks/desktop.h](/clks/include/clks/desktop.h) | C++ | 7 | 0 | 4 | 11 |
|
||||
| [clks/include/clks/driver.h](/clks/include/clks/driver.h) | C++ | 29 | 0 | 8 | 37 |
|
||||
| [clks/include/clks/elf64.h](/clks/include/clks/elf64.h) | C++ | 32 | 0 | 9 | 41 |
|
||||
| [clks/include/clks/elfrunner.h](/clks/include/clks/elfrunner.h) | C++ | 6 | 0 | 3 | 9 |
|
||||
| [clks/include/clks/exec.h](/clks/include/clks/exec.h) | C++ | 66 | 0 | 8 | 74 |
|
||||
| [clks/include/clks/framebuffer.h](/clks/include/clks/framebuffer.h) | C++ | 26 | 0 | 6 | 32 |
|
||||
| [clks/include/clks/fs.h](/clks/include/clks/fs.h) | C++ | 23 | 0 | 7 | 30 |
|
||||
| [clks/include/clks/heap.h](/clks/include/clks/heap.h) | C++ | 15 | 0 | 4 | 19 |
|
||||
| [clks/include/clks/interrupts.h](/clks/include/clks/interrupts.h) | C++ | 6 | 0 | 3 | 9 |
|
||||
| [clks/include/clks/kelf.h](/clks/include/clks/kelf.h) | C++ | 9 | 0 | 5 | 14 |
|
||||
| [clks/include/clks/kernel.h](/clks/include/clks/kernel.h) | C++ | 4 | 0 | 2 | 6 |
|
||||
| [clks/include/clks/keyboard.h](/clks/include/clks/keyboard.h) | C++ | 27 | 0 | 6 | 33 |
|
||||
| [clks/include/clks/limine.h](/clks/include/clks/limine.h) | C++ | 132 | 0 | 24 | 156 |
|
||||
| [clks/include/clks/log.h](/clks/include/clks/log.h) | C++ | 14 | 0 | 5 | 19 |
|
||||
| [clks/include/clks/mouse.h](/clks/include/clks/mouse.h) | C++ | 20 | 0 | 6 | 26 |
|
||||
| [clks/include/clks/panic.h](/clks/include/clks/panic.h) | C++ | 12 | 0 | 4 | 16 |
|
||||
| [clks/include/clks/pmm.h](/clks/include/clks/pmm.h) | C++ | 16 | 0 | 5 | 21 |
|
||||
| [clks/include/clks/ramdisk.h](/clks/include/clks/ramdisk.h) | C++ | 17 | 0 | 8 | 25 |
|
||||
| [clks/include/clks/scheduler.h](/clks/include/clks/scheduler.h) | C++ | 18 | 0 | 5 | 23 |
|
||||
| [clks/include/clks/serial.h](/clks/include/clks/serial.h) | C++ | 6 | 0 | 2 | 8 |
|
||||
| [clks/include/clks/service.h](/clks/include/clks/service.h) | C++ | 31 | 0 | 8 | 39 |
|
||||
| [clks/include/clks/shell.h](/clks/include/clks/shell.h) | C++ | 7 | 0 | 3 | 10 |
|
||||
| [clks/include/clks/string.h](/clks/include/clks/string.h) | C++ | 9 | 0 | 3 | 12 |
|
||||
| [clks/include/clks/syscall.h](/clks/include/clks/syscall.h) | C++ | 75 | 0 | 5 | 80 |
|
||||
| [clks/include/clks/task.h](/clks/include/clks/task.h) | C++ | 24 | 0 | 7 | 31 |
|
||||
| [clks/include/clks/tty.h](/clks/include/clks/tty.h) | C++ | 14 | 0 | 4 | 18 |
|
||||
| [clks/include/clks/types.h](/clks/include/clks/types.h) | C++ | 17 | 0 | 6 | 23 |
|
||||
| [clks/include/clks/userland.h](/clks/include/clks/userland.h) | C++ | 12 | 0 | 4 | 16 |
|
||||
| [clks/kernel/desktop.c](/clks/kernel/desktop.c) | C | 321 | 0 | 86 | 407 |
|
||||
| [clks/kernel/driver.c](/clks/kernel/driver.c) | C | 169 | 0 | 49 | 218 |
|
||||
| [clks/kernel/elf64.c](/clks/kernel/elf64.c) | C | 239 | 0 | 73 | 312 |
|
||||
| [clks/kernel/elfrunner.c](/clks/kernel/elfrunner.c) | C | 30 | 0 | 8 | 38 |
|
||||
| [clks/kernel/exec.c](/clks/kernel/exec.c) | C | 1,203 | 1 | 335 | 1,539 |
|
||||
| [clks/kernel/fs.c](/clks/kernel/fs.c) | C | 698 | 0 | 220 | 918 |
|
||||
| [clks/kernel/heap.c](/clks/kernel/heap.c) | C | 134 | 0 | 42 | 176 |
|
||||
| [clks/kernel/interrupts.c](/clks/kernel/interrupts.c) | C | 317 | 0 | 44 | 361 |
|
||||
| [clks/kernel/kelf.c](/clks/kernel/kelf.c) | C | 203 | 1 | 53 | 257 |
|
||||
| [clks/kernel/keyboard.c](/clks/kernel/keyboard.c) | C | 351 | 0 | 88 | 439 |
|
||||
| [clks/kernel/kmain.c](/clks/kernel/kmain.c) | C | 200 | 1 | 52 | 253 |
|
||||
| [clks/kernel/limine\_requests.c](/clks/kernel/limine_requests.c) | C | 76 | 0 | 26 | 102 |
|
||||
| [clks/kernel/log.c](/clks/kernel/log.c) | C | 185 | 0 | 48 | 233 |
|
||||
| [clks/kernel/mouse.c](/clks/kernel/mouse.c) | C | 246 | 0 | 63 | 309 |
|
||||
| [clks/kernel/panic.c](/clks/kernel/panic.c) | C | 546 | 0 | 155 | 701 |
|
||||
| [clks/kernel/pmm.c](/clks/kernel/pmm.c) | C | 82 | 0 | 23 | 105 |
|
||||
| [clks/kernel/ramdisk.c](/clks/kernel/ramdisk.c) | C | 172 | 0 | 50 | 222 |
|
||||
| [clks/kernel/scheduler.c](/clks/kernel/scheduler.c) | C | 136 | 0 | 44 | 180 |
|
||||
| [clks/kernel/service.c](/clks/kernel/service.c) | C | 113 | 0 | 34 | 147 |
|
||||
| [clks/kernel/shell.c](/clks/kernel/shell.c) | C | 1,249 | 0 | 317 | 1,566 |
|
||||
| [clks/kernel/syscall.c](/clks/kernel/syscall.c) | C | 1,375 | 0 | 344 | 1,719 |
|
||||
| [clks/kernel/tty.c](/clks/kernel/tty.c) | C | 1,115 | 0 | 275 | 1,390 |
|
||||
| [clks/kernel/userland.c](/clks/kernel/userland.c) | C | 124 | 0 | 35 | 159 |
|
||||
| [clks/lib/libc\_compat.c](/clks/lib/libc_compat.c) | C | 25 | 0 | 7 | 32 |
|
||||
| [clks/lib/string.c](/clks/lib/string.c) | C | 54 | 0 | 16 | 70 |
|
||||
| [clks/rust/src/lib.rs](/clks/rust/src/lib.rs) | Rust | 21 | 0 | 6 | 27 |
|
||||
| [cmake/check\_tools.cmake](/cmake/check_tools.cmake) | CMake | 34 | 0 | 7 | 41 |
|
||||
| [cmake/gen\_kernel\_symbols.cmake](/cmake/gen_kernel_symbols.cmake) | CMake | 80 | 0 | 26 | 106 |
|
||||
| [cmake/log.cmake](/cmake/log.cmake) | CMake | 30 | 0 | 6 | 36 |
|
||||
| [cmake/log\_emit.cmake](/cmake/log_emit.cmake) | CMake | 23 | 0 | 6 | 29 |
|
||||
| [cmake/setup\_limine.cmake](/cmake/setup_limine.cmake) | CMake | 100 | 0 | 19 | 119 |
|
||||
| [configs/limine.conf](/configs/limine.conf) | Properties | 6 | 0 | 1 | 7 |
|
||||
| [docs/README.md](/docs/README.md) | Markdown | 31 | 0 | 4 | 35 |
|
||||
| [docs/stage1.md](/docs/stage1.md) | Markdown | 41 | 0 | 5 | 46 |
|
||||
| [docs/stage10.md](/docs/stage10.md) | Markdown | 34 | 0 | 6 | 40 |
|
||||
| [docs/stage11.md](/docs/stage11.md) | Markdown | 36 | 0 | 5 | 41 |
|
||||
| [docs/stage12.md](/docs/stage12.md) | Markdown | 40 | 0 | 6 | 46 |
|
||||
| [docs/stage13.md](/docs/stage13.md) | Markdown | 34 | 0 | 6 | 40 |
|
||||
| [docs/stage14.md](/docs/stage14.md) | Markdown | 44 | 0 | 8 | 52 |
|
||||
| [docs/stage15.md](/docs/stage15.md) | Markdown | 47 | 0 | 7 | 54 |
|
||||
| [docs/stage2.md](/docs/stage2.md) | Markdown | 30 | 0 | 5 | 35 |
|
||||
| [docs/stage20.md](/docs/stage20.md) | Markdown | 46 | 0 | 6 | 52 |
|
||||
| [docs/stage21.md](/docs/stage21.md) | Markdown | 72 | 0 | 7 | 79 |
|
||||
| [docs/stage22.md](/docs/stage22.md) | Markdown | 68 | 0 | 7 | 75 |
|
||||
| [docs/stage23.md](/docs/stage23.md) | Markdown | 41 | 0 | 6 | 47 |
|
||||
| [docs/stage24.md](/docs/stage24.md) | Markdown | 42 | 0 | 7 | 49 |
|
||||
| [docs/stage25.md](/docs/stage25.md) | Markdown | 58 | 0 | 7 | 65 |
|
||||
| [docs/stage26.md](/docs/stage26.md) | Markdown | 32 | 0 | 7 | 39 |
|
||||
| [docs/stage27.md](/docs/stage27.md) | Markdown | 32 | 0 | 7 | 39 |
|
||||
| [docs/stage28.md](/docs/stage28.md) | Markdown | 37 | 0 | 7 | 44 |
|
||||
| [docs/stage29.md](/docs/stage29.md) | Markdown | 33 | 0 | 7 | 40 |
|
||||
| [docs/stage3.md](/docs/stage3.md) | Markdown | 29 | 0 | 5 | 34 |
|
||||
| [docs/stage4.md](/docs/stage4.md) | Markdown | 30 | 0 | 5 | 35 |
|
||||
| [docs/stage5.md](/docs/stage5.md) | Markdown | 29 | 0 | 5 | 34 |
|
||||
| [docs/stage6.md](/docs/stage6.md) | Markdown | 30 | 0 | 6 | 36 |
|
||||
| [docs/stage7.md](/docs/stage7.md) | Markdown | 34 | 0 | 6 | 40 |
|
||||
| [docs/stage8.md](/docs/stage8.md) | Markdown | 31 | 0 | 6 | 37 |
|
||||
| [docs/stage9.md](/docs/stage9.md) | Markdown | 31 | 0 | 6 | 37 |
|
||||
| [docs/syscall.md](/docs/syscall.md) | Markdown | 380 | 0 | 168 | 548 |
|
||||
| [ramdisk/shell/init.cmd](/ramdisk/shell/init.cmd) | Batch | 4 | 0 | 2 | 6 |
|
||||
| [scripts/gen-tty-psf.ps1](/scripts/gen-tty-psf.ps1) | PowerShell | 171 | 2 | 42 | 215 |
|
||||
| [wine/README.md](/wine/README.md) | Markdown | 49 | 0 | 19 | 68 |
|
||||
| [wine/cleonos\_wine.py](/wine/cleonos_wine.py) | Python | 3 | 1 | 3 | 7 |
|
||||
| [wine/cleonos\_wine\_lib/\_\_init\_\_.py](/wine/cleonos_wine_lib/__init__.py) | Python | 4 | 0 | 1 | 5 |
|
||||
| [wine/cleonos\_wine\_lib/cli.py](/wine/cleonos_wine_lib/cli.py) | Python | 44 | 0 | 10 | 54 |
|
||||
| [wine/cleonos\_wine\_lib/constants.py](/wine/cleonos_wine_lib/constants.py) | Python | 76 | 1 | 11 | 88 |
|
||||
| [wine/cleonos\_wine\_lib/input\_pump.py](/wine/cleonos_wine_lib/input_pump.py) | Python | 82 | 0 | 17 | 99 |
|
||||
| [wine/cleonos\_wine\_lib/platform.py](/wine/cleonos_wine_lib/platform.py) | Python | 55 | 0 | 5 | 60 |
|
||||
| [wine/cleonos\_wine\_lib/runner.py](/wine/cleonos_wine_lib/runner.py) | Python | 990 | 0 | 175 | 1,165 |
|
||||
| [wine/cleonos\_wine\_lib/state.py](/wine/cleonos_wine_lib/state.py) | Python | 164 | 0 | 40 | 204 |
|
||||
| [wine/requirements.txt](/wine/requirements.txt) | pip requirements | 1 | 0 | 1 | 2 |
|
||||
|
||||
[Summary](results.md) / Details / [Diff Summary](diff.md) / [Diff Details](diff-details.md)
|
||||
42
.VSCodeCounter/2026-04-17_19-36-06/diff-details.md
Normal file
42
.VSCodeCounter/2026-04-17_19-36-06/diff-details.md
Normal file
@@ -0,0 +1,42 @@
|
||||
# Diff Details
|
||||
|
||||
Date : 2026-04-17 19:36:06
|
||||
|
||||
Directory d:\\Projects\\C\\cleonos
|
||||
|
||||
Total : 27 files, 2979 codes, 1 comments, 752 blanks, all 3732 lines
|
||||
|
||||
[Summary](results.md) / [Details](details.md) / [Diff Summary](diff.md) / Diff Details
|
||||
|
||||
## Files
|
||||
| filename | language | code | comment | blank | total |
|
||||
| :--- | :--- | ---: | ---: | ---: | ---: |
|
||||
| [CMakeLists.txt](/CMakeLists.txt) | CMake | 27 | 0 | 2 | 29 |
|
||||
| [cleonos/c/apps/bg\_main.c](/cleonos/c/apps/bg_main.c) | C | 101 | 0 | 26 | 127 |
|
||||
| [cleonos/c/apps/fg\_main.c](/cleonos/c/apps/fg_main.c) | C | 150 | 0 | 36 | 186 |
|
||||
| [cleonos/c/apps/help\_main.c](/cleonos/c/apps/help_main.c) | C | 4 | 0 | 0 | 4 |
|
||||
| [cleonos/c/apps/jobs\_main.c](/cleonos/c/apps/jobs_main.c) | C | 120 | 0 | 26 | 146 |
|
||||
| [cleonos/c/apps/kdbg\_main.c](/cleonos/c/apps/kdbg_main.c) | C | 214 | 0 | 56 | 270 |
|
||||
| [cleonos/c/apps/kill\_main.c](/cleonos/c/apps/kill_main.c) | C | 144 | 0 | 39 | 183 |
|
||||
| [cleonos/c/apps/ps\_main.c](/cleonos/c/apps/ps_main.c) | C | 160 | 0 | 35 | 195 |
|
||||
| [cleonos/c/apps/shell/shell\_cmd.c](/cleonos/c/apps/shell/shell_cmd.c) | C | 3 | 0 | 0 | 3 |
|
||||
| [cleonos/c/apps/spin\_main.c](/cleonos/c/apps/spin_main.c) | C | 13 | 0 | 4 | 17 |
|
||||
| [cleonos/c/apps/top\_main.c](/cleonos/c/apps/top_main.c) | C | 195 | 0 | 47 | 242 |
|
||||
| [cleonos/c/include/cleonos\_syscall.h](/cleonos/c/include/cleonos_syscall.h) | C++ | 40 | 0 | 3 | 43 |
|
||||
| [cleonos/c/src/syscall.c](/cleonos/c/src/syscall.c) | C | 32 | 0 | 10 | 42 |
|
||||
| [clks/arch/x86\_64/exec\_stack\_call.S](/clks/arch/x86_64/exec_stack_call.S) | Go Assembly | 18 | 0 | 0 | 18 |
|
||||
| [clks/include/clks/exec.h](/clks/include/clks/exec.h) | C++ | 32 | 0 | 4 | 36 |
|
||||
| [clks/include/clks/panic.h](/clks/include/clks/panic.h) | C++ | 5 | 0 | 1 | 6 |
|
||||
| [clks/include/clks/syscall.h](/clks/include/clks/syscall.h) | C++ | 7 | 0 | 0 | 7 |
|
||||
| [clks/kernel/exec.c](/clks/kernel/exec.c) | C | 349 | 1 | 98 | 448 |
|
||||
| [clks/kernel/interrupts.c](/clks/kernel/interrupts.c) | C | 6 | 0 | 0 | 6 |
|
||||
| [clks/kernel/keyboard.c](/clks/kernel/keyboard.c) | C | 40 | 0 | 9 | 49 |
|
||||
| [clks/kernel/log.c](/clks/kernel/log.c) | C | 62 | 0 | 15 | 77 |
|
||||
| [clks/kernel/panic.c](/clks/kernel/panic.c) | C | 367 | 0 | 95 | 462 |
|
||||
| [clks/kernel/syscall.c](/clks/kernel/syscall.c) | C | 756 | 0 | 204 | 960 |
|
||||
| [cmake/check\_tools.cmake](/cmake/check_tools.cmake) | CMake | 2 | 0 | 1 | 3 |
|
||||
| [cmake/gen\_kernel\_symbols.cmake](/cmake/gen_kernel_symbols.cmake) | CMake | 80 | 0 | 26 | 106 |
|
||||
| [cmake/setup\_limine.cmake](/cmake/setup_limine.cmake) | CMake | 0 | 0 | 1 | 1 |
|
||||
| [docs/syscall.md](/docs/syscall.md) | Markdown | 52 | 0 | 14 | 66 |
|
||||
|
||||
[Summary](results.md) / [Details](details.md) / [Diff Summary](diff.md) / Diff Details
|
||||
29
.VSCodeCounter/2026-04-17_19-36-06/diff.csv
Normal file
29
.VSCodeCounter/2026-04-17_19-36-06/diff.csv
Normal file
@@ -0,0 +1,29 @@
|
||||
"filename", "language", "CMake", "Markdown", "C", "C++", "Go Assembly", "comment", "blank", "total"
|
||||
"d:\Projects\C\cleonos\CMakeLists.txt", "CMake", 27, 0, 0, 0, 0, 0, 2, 29
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\bg_main.c", "C", 0, 0, 101, 0, 0, 0, 26, 127
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\fg_main.c", "C", 0, 0, 150, 0, 0, 0, 36, 186
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\help_main.c", "C", 0, 0, 4, 0, 0, 0, 0, 4
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\jobs_main.c", "C", 0, 0, 120, 0, 0, 0, 26, 146
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\kdbg_main.c", "C", 0, 0, 214, 0, 0, 0, 56, 270
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\kill_main.c", "C", 0, 0, 144, 0, 0, 0, 39, 183
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\ps_main.c", "C", 0, 0, 160, 0, 0, 0, 35, 195
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\shell\shell_cmd.c", "C", 0, 0, 3, 0, 0, 0, 0, 3
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\spin_main.c", "C", 0, 0, 13, 0, 0, 0, 4, 17
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\top_main.c", "C", 0, 0, 195, 0, 0, 0, 47, 242
|
||||
"d:\Projects\C\cleonos\cleonos\c\include\cleonos_syscall.h", "C++", 0, 0, 0, 40, 0, 0, 3, 43
|
||||
"d:\Projects\C\cleonos\cleonos\c\src\syscall.c", "C", 0, 0, 32, 0, 0, 0, 10, 42
|
||||
"d:\Projects\C\cleonos\clks\arch\x86_64\exec_stack_call.S", "Go Assembly", 0, 0, 0, 0, 18, 0, 0, 18
|
||||
"d:\Projects\C\cleonos\clks\include\clks\exec.h", "C++", 0, 0, 0, 32, 0, 0, 4, 36
|
||||
"d:\Projects\C\cleonos\clks\include\clks\panic.h", "C++", 0, 0, 0, 5, 0, 0, 1, 6
|
||||
"d:\Projects\C\cleonos\clks\include\clks\syscall.h", "C++", 0, 0, 0, 7, 0, 0, 0, 7
|
||||
"d:\Projects\C\cleonos\clks\kernel\exec.c", "C", 0, 0, 349, 0, 0, 1, 98, 448
|
||||
"d:\Projects\C\cleonos\clks\kernel\interrupts.c", "C", 0, 0, 6, 0, 0, 0, 0, 6
|
||||
"d:\Projects\C\cleonos\clks\kernel\keyboard.c", "C", 0, 0, 40, 0, 0, 0, 9, 49
|
||||
"d:\Projects\C\cleonos\clks\kernel\log.c", "C", 0, 0, 62, 0, 0, 0, 15, 77
|
||||
"d:\Projects\C\cleonos\clks\kernel\panic.c", "C", 0, 0, 367, 0, 0, 0, 95, 462
|
||||
"d:\Projects\C\cleonos\clks\kernel\syscall.c", "C", 0, 0, 756, 0, 0, 0, 204, 960
|
||||
"d:\Projects\C\cleonos\cmake\check_tools.cmake", "CMake", 2, 0, 0, 0, 0, 0, 1, 3
|
||||
"d:\Projects\C\cleonos\cmake\gen_kernel_symbols.cmake", "CMake", 80, 0, 0, 0, 0, 0, 26, 106
|
||||
"d:\Projects\C\cleonos\cmake\setup_limine.cmake", "CMake", 0, 0, 0, 0, 0, 0, 1, 1
|
||||
"d:\Projects\C\cleonos\docs\syscall.md", "Markdown", 0, 52, 0, 0, 0, 0, 14, 66
|
||||
"Total", "-", 109, 52, 2716, 84, 18, 1, 752, 3732
|
||||
|
41
.VSCodeCounter/2026-04-17_19-36-06/diff.md
Normal file
41
.VSCodeCounter/2026-04-17_19-36-06/diff.md
Normal file
@@ -0,0 +1,41 @@
|
||||
# Diff Summary
|
||||
|
||||
Date : 2026-04-17 19:36:06
|
||||
|
||||
Directory d:\\Projects\\C\\cleonos
|
||||
|
||||
Total : 27 files, 2979 codes, 1 comments, 752 blanks, all 3732 lines
|
||||
|
||||
[Summary](results.md) / [Details](details.md) / Diff Summary / [Diff Details](diff-details.md)
|
||||
|
||||
## Languages
|
||||
| language | files | code | comment | blank | total |
|
||||
| :--- | ---: | ---: | ---: | ---: | ---: |
|
||||
| C | 17 | 2,716 | 1 | 700 | 3,417 |
|
||||
| CMake | 4 | 109 | 0 | 30 | 139 |
|
||||
| C++ | 4 | 84 | 0 | 8 | 92 |
|
||||
| Markdown | 1 | 52 | 0 | 14 | 66 |
|
||||
| Go Assembly | 1 | 18 | 0 | 0 | 18 |
|
||||
|
||||
## Directories
|
||||
| path | files | code | comment | blank | total |
|
||||
| :--- | ---: | ---: | ---: | ---: | ---: |
|
||||
| . | 27 | 2,979 | 1 | 752 | 3,732 |
|
||||
| . (Files) | 1 | 27 | 0 | 2 | 29 |
|
||||
| cleonos | 12 | 1,176 | 0 | 282 | 1,458 |
|
||||
| cleonos\\c | 12 | 1,176 | 0 | 282 | 1,458 |
|
||||
| cleonos\\c\\apps | 10 | 1,104 | 0 | 269 | 1,373 |
|
||||
| cleonos\\c\\apps (Files) | 9 | 1,101 | 0 | 269 | 1,370 |
|
||||
| cleonos\\c\\apps\\shell | 1 | 3 | 0 | 0 | 3 |
|
||||
| cleonos\\c\\include | 1 | 40 | 0 | 3 | 43 |
|
||||
| cleonos\\c\\src | 1 | 32 | 0 | 10 | 42 |
|
||||
| clks | 10 | 1,642 | 1 | 426 | 2,069 |
|
||||
| clks\\arch | 1 | 18 | 0 | 0 | 18 |
|
||||
| clks\\arch\\x86_64 | 1 | 18 | 0 | 0 | 18 |
|
||||
| clks\\include | 3 | 44 | 0 | 5 | 49 |
|
||||
| clks\\include\\clks | 3 | 44 | 0 | 5 | 49 |
|
||||
| clks\\kernel | 6 | 1,580 | 1 | 421 | 2,002 |
|
||||
| cmake | 3 | 82 | 0 | 28 | 110 |
|
||||
| docs | 1 | 52 | 0 | 14 | 66 |
|
||||
|
||||
[Summary](results.md) / [Details](details.md) / Diff Summary / [Diff Details](diff-details.md)
|
||||
71
.VSCodeCounter/2026-04-17_19-36-06/diff.txt
Normal file
71
.VSCodeCounter/2026-04-17_19-36-06/diff.txt
Normal file
@@ -0,0 +1,71 @@
|
||||
Date : 2026-04-17 19:36:06
|
||||
Directory : d:\Projects\C\cleonos
|
||||
Total : 27 files, 2979 codes, 1 comments, 752 blanks, all 3732 lines
|
||||
|
||||
Languages
|
||||
+-------------+------------+------------+------------+------------+------------+
|
||||
| language | files | code | comment | blank | total |
|
||||
+-------------+------------+------------+------------+------------+------------+
|
||||
| C | 17 | 2,716 | 1 | 700 | 3,417 |
|
||||
| CMake | 4 | 109 | 0 | 30 | 139 |
|
||||
| C++ | 4 | 84 | 0 | 8 | 92 |
|
||||
| Markdown | 1 | 52 | 0 | 14 | 66 |
|
||||
| Go Assembly | 1 | 18 | 0 | 0 | 18 |
|
||||
+-------------+------------+------------+------------+------------+------------+
|
||||
|
||||
Directories
|
||||
+-----------------------------------------------------------+------------+------------+------------+------------+------------+
|
||||
| path | files | code | comment | blank | total |
|
||||
+-----------------------------------------------------------+------------+------------+------------+------------+------------+
|
||||
| . | 27 | 2,979 | 1 | 752 | 3,732 |
|
||||
| . (Files) | 1 | 27 | 0 | 2 | 29 |
|
||||
| cleonos | 12 | 1,176 | 0 | 282 | 1,458 |
|
||||
| cleonos\c | 12 | 1,176 | 0 | 282 | 1,458 |
|
||||
| cleonos\c\apps | 10 | 1,104 | 0 | 269 | 1,373 |
|
||||
| cleonos\c\apps (Files) | 9 | 1,101 | 0 | 269 | 1,370 |
|
||||
| cleonos\c\apps\shell | 1 | 3 | 0 | 0 | 3 |
|
||||
| cleonos\c\include | 1 | 40 | 0 | 3 | 43 |
|
||||
| cleonos\c\src | 1 | 32 | 0 | 10 | 42 |
|
||||
| clks | 10 | 1,642 | 1 | 426 | 2,069 |
|
||||
| clks\arch | 1 | 18 | 0 | 0 | 18 |
|
||||
| clks\arch\x86_64 | 1 | 18 | 0 | 0 | 18 |
|
||||
| clks\include | 3 | 44 | 0 | 5 | 49 |
|
||||
| clks\include\clks | 3 | 44 | 0 | 5 | 49 |
|
||||
| clks\kernel | 6 | 1,580 | 1 | 421 | 2,002 |
|
||||
| cmake | 3 | 82 | 0 | 28 | 110 |
|
||||
| docs | 1 | 52 | 0 | 14 | 66 |
|
||||
+-----------------------------------------------------------+------------+------------+------------+------------+------------+
|
||||
|
||||
Files
|
||||
+-----------------------------------------------------------+-------------+------------+------------+------------+------------+
|
||||
| filename | language | code | comment | blank | total |
|
||||
+-----------------------------------------------------------+-------------+------------+------------+------------+------------+
|
||||
| d:\Projects\C\cleonos\CMakeLists.txt | CMake | 27 | 0 | 2 | 29 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\bg_main.c | C | 101 | 0 | 26 | 127 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\fg_main.c | C | 150 | 0 | 36 | 186 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\help_main.c | C | 4 | 0 | 0 | 4 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\jobs_main.c | C | 120 | 0 | 26 | 146 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\kdbg_main.c | C | 214 | 0 | 56 | 270 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\kill_main.c | C | 144 | 0 | 39 | 183 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\ps_main.c | C | 160 | 0 | 35 | 195 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\shell\shell_cmd.c | C | 3 | 0 | 0 | 3 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\spin_main.c | C | 13 | 0 | 4 | 17 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\top_main.c | C | 195 | 0 | 47 | 242 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\include\cleonos_syscall.h | C++ | 40 | 0 | 3 | 43 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\src\syscall.c | C | 32 | 0 | 10 | 42 |
|
||||
| d:\Projects\C\cleonos\clks\arch\x86_64\exec_stack_call.S | Go Assembly | 18 | 0 | 0 | 18 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\exec.h | C++ | 32 | 0 | 4 | 36 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\panic.h | C++ | 5 | 0 | 1 | 6 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\syscall.h | C++ | 7 | 0 | 0 | 7 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\exec.c | C | 349 | 1 | 98 | 448 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\interrupts.c | C | 6 | 0 | 0 | 6 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\keyboard.c | C | 40 | 0 | 9 | 49 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\log.c | C | 62 | 0 | 15 | 77 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\panic.c | C | 367 | 0 | 95 | 462 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\syscall.c | C | 756 | 0 | 204 | 960 |
|
||||
| d:\Projects\C\cleonos\cmake\check_tools.cmake | CMake | 2 | 0 | 1 | 3 |
|
||||
| d:\Projects\C\cleonos\cmake\gen_kernel_symbols.cmake | CMake | 80 | 0 | 26 | 106 |
|
||||
| d:\Projects\C\cleonos\cmake\setup_limine.cmake | CMake | 0 | 0 | 1 | 1 |
|
||||
| d:\Projects\C\cleonos\docs\syscall.md | Markdown | 52 | 0 | 14 | 66 |
|
||||
| Total | | 2,979 | 1 | 752 | 3,732 |
|
||||
+-----------------------------------------------------------+-------------+------------+------------+------------+------------+
|
||||
194
.VSCodeCounter/2026-04-17_19-36-06/results.csv
Normal file
194
.VSCodeCounter/2026-04-17_19-36-06/results.csv
Normal file
@@ -0,0 +1,194 @@
|
||||
"filename", "language", "Python", "Markdown", "pip requirements", "CMake", "Properties", "PowerShell", "C", "C++", "Rust", "Batch", "Makefile", "Go Assembly", "YAML", "comment", "blank", "total"
|
||||
"d:\Projects\C\cleonos\.github\workflows\build-os.yml", "YAML", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 0, 10, 58
|
||||
"d:\Projects\C\cleonos\CMakeLists.txt", "CMake", 0, 0, 0, 614, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 88, 702
|
||||
"d:\Projects\C\cleonos\Makefile", "Makefile", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 100, 0, 0, 0, 22, 122
|
||||
"d:\Projects\C\cleonos\README.md", "Markdown", 0, 92, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 126
|
||||
"d:\Projects\C\cleonos\README.zh-CN.md", "Markdown", 0, 92, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 126
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\ansi_main.c", "C", 0, 0, 0, 0, 0, 0, 43, 0, 0, 0, 0, 0, 0, 0, 11, 54
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\ansitest_main.c", "C", 0, 0, 0, 0, 0, 0, 142, 0, 0, 0, 0, 0, 0, 0, 35, 177
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\append_main.c", "C", 0, 0, 0, 0, 0, 0, 74, 0, 0, 0, 0, 0, 0, 0, 18, 92
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\args_main.c", "C", 0, 0, 0, 0, 0, 0, 49, 0, 0, 0, 0, 0, 0, 0, 13, 62
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\bg_main.c", "C", 0, 0, 0, 0, 0, 0, 101, 0, 0, 0, 0, 0, 0, 0, 26, 127
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\cat_main.c", "C", 0, 0, 0, 0, 0, 0, 83, 0, 0, 0, 0, 0, 0, 0, 24, 107
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\cd_main.c", "C", 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 0, 0, 0, 0, 15, 69
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\clear_main.c", "C", 0, 0, 0, 0, 0, 0, 39, 0, 0, 0, 0, 0, 0, 0, 11, 50
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\cmd_runtime.c", "C", 0, 0, 0, 0, 0, 0, 446, 0, 0, 0, 0, 0, 0, 0, 143, 589
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\cmd_runtime.h", "C++", 0, 0, 0, 0, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 19, 99
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\cp_main.c", "C", 0, 0, 0, 0, 0, 0, 95, 0, 0, 0, 0, 0, 0, 0, 26, 121
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\cut_main.c", "C", 0, 0, 0, 0, 0, 0, 214, 0, 0, 0, 0, 0, 0, 1, 55, 270
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\dmesg_main.c", "C", 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 18, 82
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\elfrunner_kmain.c", "C", 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 3, 9
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\elfrunner_main.c", "C", 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 3, 9
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\exec_main.c", "C", 0, 0, 0, 0, 0, 0, 87, 0, 0, 0, 0, 0, 0, 0, 22, 109
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\exit_main.c", "C", 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 0, 0, 0, 0, 14, 68
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\fastfetch_main.c", "C", 0, 0, 0, 0, 0, 0, 180, 0, 0, 0, 0, 0, 0, 0, 34, 214
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\fg_main.c", "C", 0, 0, 0, 0, 0, 0, 150, 0, 0, 0, 0, 0, 0, 0, 36, 186
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\fsstat_main.c", "C", 0, 0, 0, 0, 0, 0, 45, 0, 0, 0, 0, 0, 0, 0, 11, 56
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\grep_main.c", "C", 0, 0, 0, 0, 0, 0, 195, 0, 0, 0, 0, 0, 0, 0, 54, 249
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\head_main.c", "C", 0, 0, 0, 0, 0, 0, 164, 0, 0, 0, 0, 0, 0, 0, 47, 211
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\hello_main.c", "C", 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 2, 8
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\help_main.c", "C", 0, 0, 0, 0, 0, 0, 79, 0, 0, 0, 0, 0, 0, 0, 10, 89
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\jobs_main.c", "C", 0, 0, 0, 0, 0, 0, 120, 0, 0, 0, 0, 0, 0, 0, 26, 146
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\kbdstat_main.c", "C", 0, 0, 0, 0, 0, 0, 44, 0, 0, 0, 0, 0, 0, 0, 11, 55
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\kdbg_main.c", "C", 0, 0, 0, 0, 0, 0, 214, 0, 0, 0, 0, 0, 0, 0, 56, 270
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\kill_main.c", "C", 0, 0, 0, 0, 0, 0, 144, 0, 0, 0, 0, 0, 0, 0, 39, 183
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\ls_main.c", "C", 0, 0, 0, 0, 0, 0, 262, 0, 0, 0, 0, 0, 0, 0, 76, 338
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\memc_kmain.c", "C", 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 3, 9
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\memc_main.c", "C", 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 3, 11
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\memstat_main.c", "C", 0, 0, 0, 0, 0, 0, 43, 0, 0, 0, 0, 0, 0, 0, 11, 54
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\mkdir_main.c", "C", 0, 0, 0, 0, 0, 0, 57, 0, 0, 0, 0, 0, 0, 0, 16, 73
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\mv_main.c", "C", 0, 0, 0, 0, 0, 0, 102, 0, 0, 0, 0, 0, 0, 0, 28, 130
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\pid_main.c", "C", 0, 0, 0, 0, 0, 0, 39, 0, 0, 0, 0, 0, 0, 0, 11, 50
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\ps_main.c", "C", 0, 0, 0, 0, 0, 0, 160, 0, 0, 0, 0, 0, 0, 0, 35, 195
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\pwd_main.c", "C", 0, 0, 0, 0, 0, 0, 39, 0, 0, 0, 0, 0, 0, 0, 11, 50
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\restart_main.c", "C", 0, 0, 0, 0, 0, 0, 40, 0, 0, 0, 0, 0, 0, 0, 11, 51
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\rm_main.c", "C", 0, 0, 0, 0, 0, 0, 57, 0, 0, 0, 0, 0, 0, 0, 16, 73
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\shell\shell_cmd.c", "C", 0, 0, 0, 0, 0, 0, 2314, 0, 0, 0, 0, 0, 0, 0, 574, 2888
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\shell\shell_external.c", "C", 0, 0, 0, 0, 0, 0, 166, 0, 0, 0, 0, 0, 0, 0, 55, 221
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\shell\shell_input.c", "C", 0, 0, 0, 0, 0, 0, 514, 0, 0, 0, 0, 0, 0, 0, 132, 646
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\shell\shell_internal.h", "C++", 0, 0, 0, 0, 0, 0, 0, 92, 0, 0, 0, 0, 0, 0, 20, 112
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\shell\shell_path.c", "C", 0, 0, 0, 0, 0, 0, 153, 0, 0, 0, 0, 0, 0, 0, 50, 203
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\shell\shell_script.c", "C", 0, 0, 0, 0, 0, 0, 35, 0, 0, 0, 0, 0, 0, 0, 12, 47
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\shell\shell_util.c", "C", 0, 0, 0, 0, 0, 0, 283, 0, 0, 0, 0, 0, 0, 0, 86, 369
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\shell_main.c", "C", 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 0, 0, 0, 0, 6, 25
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\shstat_main.c", "C", 0, 0, 0, 0, 0, 0, 45, 0, 0, 0, 0, 0, 0, 0, 11, 56
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\shutdown_main.c", "C", 0, 0, 0, 0, 0, 0, 40, 0, 0, 0, 0, 0, 0, 0, 11, 51
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\sleep_main.c", "C", 0, 0, 0, 0, 0, 0, 52, 0, 0, 0, 0, 0, 0, 0, 14, 66
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\sort_main.c", "C", 0, 0, 0, 0, 0, 0, 205, 0, 0, 0, 0, 0, 0, 0, 63, 268
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\spawn_main.c", "C", 0, 0, 0, 0, 0, 0, 76, 0, 0, 0, 0, 0, 0, 0, 20, 96
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\spin_main.c", "C", 0, 0, 0, 0, 0, 0, 13, 0, 0, 0, 0, 0, 0, 0, 4, 17
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\stats_main.c", "C", 0, 0, 0, 0, 0, 0, 102, 0, 0, 0, 0, 0, 0, 0, 17, 119
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\tail_main.c", "C", 0, 0, 0, 0, 0, 0, 190, 0, 0, 0, 0, 0, 0, 0, 54, 244
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\taskstat_main.c", "C", 0, 0, 0, 0, 0, 0, 43, 0, 0, 0, 0, 0, 0, 0, 11, 54
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\top_main.c", "C", 0, 0, 0, 0, 0, 0, 195, 0, 0, 0, 0, 0, 0, 0, 47, 242
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\touch_main.c", "C", 0, 0, 0, 0, 0, 0, 58, 0, 0, 0, 0, 0, 0, 0, 16, 74
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\tty_main.c", "C", 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 17, 81
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\ttydrv_main.c", "C", 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 3, 9
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\uniq_main.c", "C", 0, 0, 0, 0, 0, 0, 168, 0, 0, 0, 0, 0, 0, 0, 48, 216
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\userstat_main.c", "C", 0, 0, 0, 0, 0, 0, 48, 0, 0, 0, 0, 0, 0, 0, 11, 59
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\wait_main.c", "C", 0, 0, 0, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 17, 85
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\wavplay_main.c", "C", 0, 0, 0, 0, 0, 0, 396, 0, 0, 0, 0, 0, 0, 0, 99, 495
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\wc_main.c", "C", 0, 0, 0, 0, 0, 0, 164, 0, 0, 0, 0, 0, 0, 0, 45, 209
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\write_main.c", "C", 0, 0, 0, 0, 0, 0, 74, 0, 0, 0, 0, 0, 0, 0, 18, 92
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\yield_main.c", "C", 0, 0, 0, 0, 0, 0, 39, 0, 0, 0, 0, 0, 0, 0, 11, 50
|
||||
"d:\Projects\C\cleonos\cleonos\c\include\cleonos_rust_bridge.h", "C++", 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 4, 10
|
||||
"d:\Projects\C\cleonos\cleonos\c\include\cleonos_syscall.h", "C++", 0, 0, 0, 0, 0, 0, 0, 168, 0, 0, 0, 0, 0, 0, 9, 177
|
||||
"d:\Projects\C\cleonos\cleonos\c\src\runtime.c", "C", 0, 0, 0, 0, 0, 0, 37, 0, 0, 0, 0, 0, 0, 0, 12, 49
|
||||
"d:\Projects\C\cleonos\cleonos\c\src\syscall.c", "C", 0, 0, 0, 0, 0, 0, 223, 0, 0, 0, 0, 0, 0, 0, 74, 297
|
||||
"d:\Projects\C\cleonos\cleonos\c\stub.c", "C", 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 4, 2, 9
|
||||
"d:\Projects\C\cleonos\cleonos\rust\src\lib.rs", "Rust", 0, 0, 0, 0, 0, 0, 0, 0, 23, 0, 0, 0, 0, 0, 9, 32
|
||||
"d:\Projects\C\cleonos\clks\arch\aarch64\boot.c", "C", 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 1, 7
|
||||
"d:\Projects\C\cleonos\clks\arch\x86_64\boot.c", "C", 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 1, 7
|
||||
"d:\Projects\C\cleonos\clks\arch\x86_64\exec_stack_call.S", "Go Assembly", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 40, 0, 0, 8, 48
|
||||
"d:\Projects\C\cleonos\clks\arch\x86_64\interrupt_stubs.S", "Go Assembly", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 108, 0, 0, 12, 120
|
||||
"d:\Projects\C\cleonos\clks\drivers\audio\pcspeaker.c", "C", 0, 0, 0, 0, 0, 0, 101, 0, 0, 0, 0, 0, 0, 0, 25, 126
|
||||
"d:\Projects\C\cleonos\clks\drivers\serial\serial.c", "C", 0, 0, 0, 0, 0, 0, 52, 0, 0, 0, 0, 0, 0, 0, 16, 68
|
||||
"d:\Projects\C\cleonos\clks\drivers\video\font8x8.c", "C", 0, 0, 0, 0, 0, 0, 67, 0, 0, 0, 0, 0, 0, 0, 8, 75
|
||||
"d:\Projects\C\cleonos\clks\drivers\video\font8x8.h", "C++", 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 3, 8
|
||||
"d:\Projects\C\cleonos\clks\drivers\video\framebuffer.c", "C", 0, 0, 0, 0, 0, 0, 251, 0, 0, 0, 0, 0, 0, 0, 70, 321
|
||||
"d:\Projects\C\cleonos\clks\drivers\video\psf_font.c", "C", 0, 0, 0, 0, 0, 0, 230, 0, 0, 0, 0, 0, 0, 0, 56, 286
|
||||
"d:\Projects\C\cleonos\clks\drivers\video\psf_font.h", "C++", 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0, 0, 0, 5, 20
|
||||
"d:\Projects\C\cleonos\clks\include\clks\audio.h", "C++", 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 3, 12
|
||||
"d:\Projects\C\cleonos\clks\include\clks\boot.h", "C++", 0, 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, 0, 0, 0, 4, 15
|
||||
"d:\Projects\C\cleonos\clks\include\clks\compiler.h", "C++", 0, 0, 0, 0, 0, 0, 0, 13, 0, 0, 0, 0, 0, 0, 4, 17
|
||||
"d:\Projects\C\cleonos\clks\include\clks\cpu.h", "C++", 0, 0, 0, 0, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 4, 24
|
||||
"d:\Projects\C\cleonos\clks\include\clks\desktop.h", "C++", 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 4, 11
|
||||
"d:\Projects\C\cleonos\clks\include\clks\driver.h", "C++", 0, 0, 0, 0, 0, 0, 0, 29, 0, 0, 0, 0, 0, 0, 8, 37
|
||||
"d:\Projects\C\cleonos\clks\include\clks\elf64.h", "C++", 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 9, 41
|
||||
"d:\Projects\C\cleonos\clks\include\clks\elfrunner.h", "C++", 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 3, 9
|
||||
"d:\Projects\C\cleonos\clks\include\clks\exec.h", "C++", 0, 0, 0, 0, 0, 0, 0, 66, 0, 0, 0, 0, 0, 0, 8, 74
|
||||
"d:\Projects\C\cleonos\clks\include\clks\framebuffer.h", "C++", 0, 0, 0, 0, 0, 0, 0, 26, 0, 0, 0, 0, 0, 0, 6, 32
|
||||
"d:\Projects\C\cleonos\clks\include\clks\fs.h", "C++", 0, 0, 0, 0, 0, 0, 0, 23, 0, 0, 0, 0, 0, 0, 7, 30
|
||||
"d:\Projects\C\cleonos\clks\include\clks\heap.h", "C++", 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0, 0, 0, 4, 19
|
||||
"d:\Projects\C\cleonos\clks\include\clks\interrupts.h", "C++", 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 3, 9
|
||||
"d:\Projects\C\cleonos\clks\include\clks\kelf.h", "C++", 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 5, 14
|
||||
"d:\Projects\C\cleonos\clks\include\clks\kernel.h", "C++", 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 2, 6
|
||||
"d:\Projects\C\cleonos\clks\include\clks\keyboard.h", "C++", 0, 0, 0, 0, 0, 0, 0, 27, 0, 0, 0, 0, 0, 0, 6, 33
|
||||
"d:\Projects\C\cleonos\clks\include\clks\limine.h", "C++", 0, 0, 0, 0, 0, 0, 0, 132, 0, 0, 0, 0, 0, 0, 24, 156
|
||||
"d:\Projects\C\cleonos\clks\include\clks\log.h", "C++", 0, 0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 5, 19
|
||||
"d:\Projects\C\cleonos\clks\include\clks\mouse.h", "C++", 0, 0, 0, 0, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 6, 26
|
||||
"d:\Projects\C\cleonos\clks\include\clks\panic.h", "C++", 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 4, 16
|
||||
"d:\Projects\C\cleonos\clks\include\clks\pmm.h", "C++", 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 5, 21
|
||||
"d:\Projects\C\cleonos\clks\include\clks\ramdisk.h", "C++", 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 8, 25
|
||||
"d:\Projects\C\cleonos\clks\include\clks\scheduler.h", "C++", 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 5, 23
|
||||
"d:\Projects\C\cleonos\clks\include\clks\serial.h", "C++", 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 2, 8
|
||||
"d:\Projects\C\cleonos\clks\include\clks\service.h", "C++", 0, 0, 0, 0, 0, 0, 0, 31, 0, 0, 0, 0, 0, 0, 8, 39
|
||||
"d:\Projects\C\cleonos\clks\include\clks\shell.h", "C++", 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 3, 10
|
||||
"d:\Projects\C\cleonos\clks\include\clks\string.h", "C++", 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 3, 12
|
||||
"d:\Projects\C\cleonos\clks\include\clks\syscall.h", "C++", 0, 0, 0, 0, 0, 0, 0, 75, 0, 0, 0, 0, 0, 0, 5, 80
|
||||
"d:\Projects\C\cleonos\clks\include\clks\task.h", "C++", 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0, 0, 7, 31
|
||||
"d:\Projects\C\cleonos\clks\include\clks\tty.h", "C++", 0, 0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 4, 18
|
||||
"d:\Projects\C\cleonos\clks\include\clks\types.h", "C++", 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 6, 23
|
||||
"d:\Projects\C\cleonos\clks\include\clks\userland.h", "C++", 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 4, 16
|
||||
"d:\Projects\C\cleonos\clks\kernel\desktop.c", "C", 0, 0, 0, 0, 0, 0, 321, 0, 0, 0, 0, 0, 0, 0, 86, 407
|
||||
"d:\Projects\C\cleonos\clks\kernel\driver.c", "C", 0, 0, 0, 0, 0, 0, 169, 0, 0, 0, 0, 0, 0, 0, 49, 218
|
||||
"d:\Projects\C\cleonos\clks\kernel\elf64.c", "C", 0, 0, 0, 0, 0, 0, 239, 0, 0, 0, 0, 0, 0, 0, 73, 312
|
||||
"d:\Projects\C\cleonos\clks\kernel\elfrunner.c", "C", 0, 0, 0, 0, 0, 0, 30, 0, 0, 0, 0, 0, 0, 0, 8, 38
|
||||
"d:\Projects\C\cleonos\clks\kernel\exec.c", "C", 0, 0, 0, 0, 0, 0, 1203, 0, 0, 0, 0, 0, 0, 1, 335, 1539
|
||||
"d:\Projects\C\cleonos\clks\kernel\fs.c", "C", 0, 0, 0, 0, 0, 0, 698, 0, 0, 0, 0, 0, 0, 0, 220, 918
|
||||
"d:\Projects\C\cleonos\clks\kernel\heap.c", "C", 0, 0, 0, 0, 0, 0, 134, 0, 0, 0, 0, 0, 0, 0, 42, 176
|
||||
"d:\Projects\C\cleonos\clks\kernel\interrupts.c", "C", 0, 0, 0, 0, 0, 0, 317, 0, 0, 0, 0, 0, 0, 0, 44, 361
|
||||
"d:\Projects\C\cleonos\clks\kernel\kelf.c", "C", 0, 0, 0, 0, 0, 0, 203, 0, 0, 0, 0, 0, 0, 1, 53, 257
|
||||
"d:\Projects\C\cleonos\clks\kernel\keyboard.c", "C", 0, 0, 0, 0, 0, 0, 351, 0, 0, 0, 0, 0, 0, 0, 88, 439
|
||||
"d:\Projects\C\cleonos\clks\kernel\kmain.c", "C", 0, 0, 0, 0, 0, 0, 200, 0, 0, 0, 0, 0, 0, 1, 52, 253
|
||||
"d:\Projects\C\cleonos\clks\kernel\limine_requests.c", "C", 0, 0, 0, 0, 0, 0, 76, 0, 0, 0, 0, 0, 0, 0, 26, 102
|
||||
"d:\Projects\C\cleonos\clks\kernel\log.c", "C", 0, 0, 0, 0, 0, 0, 185, 0, 0, 0, 0, 0, 0, 0, 48, 233
|
||||
"d:\Projects\C\cleonos\clks\kernel\mouse.c", "C", 0, 0, 0, 0, 0, 0, 246, 0, 0, 0, 0, 0, 0, 0, 63, 309
|
||||
"d:\Projects\C\cleonos\clks\kernel\panic.c", "C", 0, 0, 0, 0, 0, 0, 546, 0, 0, 0, 0, 0, 0, 0, 155, 701
|
||||
"d:\Projects\C\cleonos\clks\kernel\pmm.c", "C", 0, 0, 0, 0, 0, 0, 82, 0, 0, 0, 0, 0, 0, 0, 23, 105
|
||||
"d:\Projects\C\cleonos\clks\kernel\ramdisk.c", "C", 0, 0, 0, 0, 0, 0, 172, 0, 0, 0, 0, 0, 0, 0, 50, 222
|
||||
"d:\Projects\C\cleonos\clks\kernel\scheduler.c", "C", 0, 0, 0, 0, 0, 0, 136, 0, 0, 0, 0, 0, 0, 0, 44, 180
|
||||
"d:\Projects\C\cleonos\clks\kernel\service.c", "C", 0, 0, 0, 0, 0, 0, 113, 0, 0, 0, 0, 0, 0, 0, 34, 147
|
||||
"d:\Projects\C\cleonos\clks\kernel\shell.c", "C", 0, 0, 0, 0, 0, 0, 1249, 0, 0, 0, 0, 0, 0, 0, 317, 1566
|
||||
"d:\Projects\C\cleonos\clks\kernel\syscall.c", "C", 0, 0, 0, 0, 0, 0, 1375, 0, 0, 0, 0, 0, 0, 0, 344, 1719
|
||||
"d:\Projects\C\cleonos\clks\kernel\tty.c", "C", 0, 0, 0, 0, 0, 0, 1115, 0, 0, 0, 0, 0, 0, 0, 275, 1390
|
||||
"d:\Projects\C\cleonos\clks\kernel\userland.c", "C", 0, 0, 0, 0, 0, 0, 124, 0, 0, 0, 0, 0, 0, 0, 35, 159
|
||||
"d:\Projects\C\cleonos\clks\lib\libc_compat.c", "C", 0, 0, 0, 0, 0, 0, 25, 0, 0, 0, 0, 0, 0, 0, 7, 32
|
||||
"d:\Projects\C\cleonos\clks\lib\string.c", "C", 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 0, 0, 0, 0, 16, 70
|
||||
"d:\Projects\C\cleonos\clks\rust\src\lib.rs", "Rust", 0, 0, 0, 0, 0, 0, 0, 0, 21, 0, 0, 0, 0, 0, 6, 27
|
||||
"d:\Projects\C\cleonos\cmake\check_tools.cmake", "CMake", 0, 0, 0, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 41
|
||||
"d:\Projects\C\cleonos\cmake\gen_kernel_symbols.cmake", "CMake", 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 26, 106
|
||||
"d:\Projects\C\cleonos\cmake\log.cmake", "CMake", 0, 0, 0, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 36
|
||||
"d:\Projects\C\cleonos\cmake\log_emit.cmake", "CMake", 0, 0, 0, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 29
|
||||
"d:\Projects\C\cleonos\cmake\setup_limine.cmake", "CMake", 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 119
|
||||
"d:\Projects\C\cleonos\configs\limine.conf", "Properties", 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 7
|
||||
"d:\Projects\C\cleonos\docs\README.md", "Markdown", 0, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 35
|
||||
"d:\Projects\C\cleonos\docs\stage1.md", "Markdown", 0, 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 46
|
||||
"d:\Projects\C\cleonos\docs\stage10.md", "Markdown", 0, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 40
|
||||
"d:\Projects\C\cleonos\docs\stage11.md", "Markdown", 0, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 41
|
||||
"d:\Projects\C\cleonos\docs\stage12.md", "Markdown", 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 46
|
||||
"d:\Projects\C\cleonos\docs\stage13.md", "Markdown", 0, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 40
|
||||
"d:\Projects\C\cleonos\docs\stage14.md", "Markdown", 0, 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 52
|
||||
"d:\Projects\C\cleonos\docs\stage15.md", "Markdown", 0, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 54
|
||||
"d:\Projects\C\cleonos\docs\stage2.md", "Markdown", 0, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 35
|
||||
"d:\Projects\C\cleonos\docs\stage20.md", "Markdown", 0, 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 52
|
||||
"d:\Projects\C\cleonos\docs\stage21.md", "Markdown", 0, 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 79
|
||||
"d:\Projects\C\cleonos\docs\stage22.md", "Markdown", 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 75
|
||||
"d:\Projects\C\cleonos\docs\stage23.md", "Markdown", 0, 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 47
|
||||
"d:\Projects\C\cleonos\docs\stage24.md", "Markdown", 0, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 49
|
||||
"d:\Projects\C\cleonos\docs\stage25.md", "Markdown", 0, 58, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 65
|
||||
"d:\Projects\C\cleonos\docs\stage26.md", "Markdown", 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 39
|
||||
"d:\Projects\C\cleonos\docs\stage27.md", "Markdown", 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 39
|
||||
"d:\Projects\C\cleonos\docs\stage28.md", "Markdown", 0, 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 44
|
||||
"d:\Projects\C\cleonos\docs\stage29.md", "Markdown", 0, 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 40
|
||||
"d:\Projects\C\cleonos\docs\stage3.md", "Markdown", 0, 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 34
|
||||
"d:\Projects\C\cleonos\docs\stage4.md", "Markdown", 0, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 35
|
||||
"d:\Projects\C\cleonos\docs\stage5.md", "Markdown", 0, 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 34
|
||||
"d:\Projects\C\cleonos\docs\stage6.md", "Markdown", 0, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 36
|
||||
"d:\Projects\C\cleonos\docs\stage7.md", "Markdown", 0, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 40
|
||||
"d:\Projects\C\cleonos\docs\stage8.md", "Markdown", 0, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 37
|
||||
"d:\Projects\C\cleonos\docs\stage9.md", "Markdown", 0, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 37
|
||||
"d:\Projects\C\cleonos\docs\syscall.md", "Markdown", 0, 380, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 168, 548
|
||||
"d:\Projects\C\cleonos\ramdisk\shell\init.cmd", "Batch", 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 2, 6
|
||||
"d:\Projects\C\cleonos\scripts\gen-tty-psf.ps1", "PowerShell", 0, 0, 0, 0, 0, 171, 0, 0, 0, 0, 0, 0, 0, 2, 42, 215
|
||||
"d:\Projects\C\cleonos\wine\README.md", "Markdown", 0, 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 68
|
||||
"d:\Projects\C\cleonos\wine\cleonos_wine.py", "Python", 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 7
|
||||
"d:\Projects\C\cleonos\wine\cleonos_wine_lib\__init__.py", "Python", 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 5
|
||||
"d:\Projects\C\cleonos\wine\cleonos_wine_lib\cli.py", "Python", 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 54
|
||||
"d:\Projects\C\cleonos\wine\cleonos_wine_lib\constants.py", "Python", 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 11, 88
|
||||
"d:\Projects\C\cleonos\wine\cleonos_wine_lib\input_pump.py", "Python", 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 99
|
||||
"d:\Projects\C\cleonos\wine\cleonos_wine_lib\platform.py", "Python", 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 60
|
||||
"d:\Projects\C\cleonos\wine\cleonos_wine_lib\runner.py", "Python", 990, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 175, 1165
|
||||
"d:\Projects\C\cleonos\wine\cleonos_wine_lib\state.py", "Python", 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 40, 204
|
||||
"d:\Projects\C\cleonos\wine\requirements.txt", "pip requirements", 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2
|
||||
"Total", "-", 1418, 1625, 1, 881, 6, 171, 19580, 1093, 44, 4, 100, 148, 48, 12, 6368, 31499
|
||||
|
1
.VSCodeCounter/2026-04-17_19-36-06/results.json
Normal file
1
.VSCodeCounter/2026-04-17_19-36-06/results.json
Normal file
File diff suppressed because one or more lines are too long
69
.VSCodeCounter/2026-04-17_19-36-06/results.md
Normal file
69
.VSCodeCounter/2026-04-17_19-36-06/results.md
Normal file
@@ -0,0 +1,69 @@
|
||||
# Summary
|
||||
|
||||
Date : 2026-04-17 19:36:06
|
||||
|
||||
Directory d:\\Projects\\C\\cleonos
|
||||
|
||||
Total : 192 files, 25119 codes, 12 comments, 6368 blanks, all 31499 lines
|
||||
|
||||
Summary / [Details](details.md) / [Diff Summary](diff.md) / [Diff Details](diff-details.md)
|
||||
|
||||
## Languages
|
||||
| language | files | code | comment | blank | total |
|
||||
| :--- | ---: | ---: | ---: | ---: | ---: |
|
||||
| C | 100 | 19,580 | 8 | 5,188 | 24,776 |
|
||||
| Markdown | 30 | 1,625 | 0 | 414 | 2,039 |
|
||||
| Python | 8 | 1,418 | 2 | 262 | 1,682 |
|
||||
| C++ | 38 | 1,093 | 0 | 239 | 1,332 |
|
||||
| CMake | 6 | 881 | 0 | 152 | 1,033 |
|
||||
| PowerShell | 1 | 171 | 2 | 42 | 215 |
|
||||
| Go Assembly | 2 | 148 | 0 | 20 | 168 |
|
||||
| Makefile | 1 | 100 | 0 | 22 | 122 |
|
||||
| YAML | 1 | 48 | 0 | 10 | 58 |
|
||||
| Rust | 2 | 44 | 0 | 15 | 59 |
|
||||
| Properties | 1 | 6 | 0 | 1 | 7 |
|
||||
| Batch | 1 | 4 | 0 | 2 | 6 |
|
||||
| pip requirements | 1 | 1 | 0 | 1 | 2 |
|
||||
|
||||
## Directories
|
||||
| path | files | code | comment | blank | total |
|
||||
| :--- | ---: | ---: | ---: | ---: | ---: |
|
||||
| . | 192 | 25,119 | 12 | 6,368 | 31,499 |
|
||||
| . (Files) | 4 | 898 | 0 | 178 | 1,076 |
|
||||
| .github | 1 | 48 | 0 | 10 | 58 |
|
||||
| .github\\workflows | 1 | 48 | 0 | 10 | 58 |
|
||||
| cleonos | 73 | 9,873 | 5 | 2,585 | 12,463 |
|
||||
| cleonos\\c | 72 | 9,850 | 5 | 2,576 | 12,431 |
|
||||
| cleonos\\c (Files) | 1 | 3 | 4 | 2 | 9 |
|
||||
| cleonos\\c\\apps | 67 | 9,413 | 1 | 2,475 | 11,889 |
|
||||
| cleonos\\c\\apps (Files) | 60 | 5,856 | 1 | 1,546 | 7,403 |
|
||||
| cleonos\\c\\apps\\shell | 7 | 3,557 | 0 | 929 | 4,486 |
|
||||
| cleonos\\c\\include | 2 | 174 | 0 | 13 | 187 |
|
||||
| cleonos\\c\\src | 2 | 260 | 0 | 86 | 346 |
|
||||
| cleonos\\rust | 1 | 23 | 0 | 9 | 32 |
|
||||
| cleonos\\rust\\src | 1 | 23 | 0 | 9 | 32 |
|
||||
| clks | 69 | 10,992 | 3 | 2,877 | 13,872 |
|
||||
| clks\\arch | 4 | 160 | 0 | 22 | 182 |
|
||||
| clks\\arch\\aarch64 | 1 | 6 | 0 | 1 | 7 |
|
||||
| clks\\arch\\x86_64 | 3 | 154 | 0 | 21 | 175 |
|
||||
| clks\\drivers | 7 | 721 | 0 | 183 | 904 |
|
||||
| clks\\drivers\\audio | 1 | 101 | 0 | 25 | 126 |
|
||||
| clks\\drivers\\serial | 1 | 52 | 0 | 16 | 68 |
|
||||
| clks\\drivers\\video | 5 | 568 | 0 | 142 | 710 |
|
||||
| clks\\include | 32 | 727 | 0 | 179 | 906 |
|
||||
| clks\\include\\clks | 32 | 727 | 0 | 179 | 906 |
|
||||
| clks\\kernel | 23 | 9,284 | 3 | 2,464 | 11,751 |
|
||||
| clks\\lib | 2 | 79 | 0 | 23 | 102 |
|
||||
| clks\\rust | 1 | 21 | 0 | 6 | 27 |
|
||||
| clks\\rust\\src | 1 | 21 | 0 | 6 | 27 |
|
||||
| cmake | 5 | 267 | 0 | 64 | 331 |
|
||||
| configs | 1 | 6 | 0 | 1 | 7 |
|
||||
| docs | 27 | 1,392 | 0 | 327 | 1,719 |
|
||||
| ramdisk | 1 | 4 | 0 | 2 | 6 |
|
||||
| ramdisk\\shell | 1 | 4 | 0 | 2 | 6 |
|
||||
| scripts | 1 | 171 | 2 | 42 | 215 |
|
||||
| wine | 10 | 1,468 | 2 | 282 | 1,752 |
|
||||
| wine (Files) | 3 | 53 | 1 | 23 | 77 |
|
||||
| wine\\cleonos_wine_lib | 7 | 1,415 | 1 | 259 | 1,675 |
|
||||
|
||||
Summary / [Details](details.md) / [Diff Summary](diff.md) / [Diff Details](diff-details.md)
|
||||
264
.VSCodeCounter/2026-04-17_19-36-06/results.txt
Normal file
264
.VSCodeCounter/2026-04-17_19-36-06/results.txt
Normal file
@@ -0,0 +1,264 @@
|
||||
Date : 2026-04-17 19:36:06
|
||||
Directory : d:\Projects\C\cleonos
|
||||
Total : 192 files, 25119 codes, 12 comments, 6368 blanks, all 31499 lines
|
||||
|
||||
Languages
|
||||
+------------------+------------+------------+------------+------------+------------+
|
||||
| language | files | code | comment | blank | total |
|
||||
+------------------+------------+------------+------------+------------+------------+
|
||||
| C | 100 | 19,580 | 8 | 5,188 | 24,776 |
|
||||
| Markdown | 30 | 1,625 | 0 | 414 | 2,039 |
|
||||
| Python | 8 | 1,418 | 2 | 262 | 1,682 |
|
||||
| C++ | 38 | 1,093 | 0 | 239 | 1,332 |
|
||||
| CMake | 6 | 881 | 0 | 152 | 1,033 |
|
||||
| PowerShell | 1 | 171 | 2 | 42 | 215 |
|
||||
| Go Assembly | 2 | 148 | 0 | 20 | 168 |
|
||||
| Makefile | 1 | 100 | 0 | 22 | 122 |
|
||||
| YAML | 1 | 48 | 0 | 10 | 58 |
|
||||
| Rust | 2 | 44 | 0 | 15 | 59 |
|
||||
| Properties | 1 | 6 | 0 | 1 | 7 |
|
||||
| Batch | 1 | 4 | 0 | 2 | 6 |
|
||||
| pip requirements | 1 | 1 | 0 | 1 | 2 |
|
||||
+------------------+------------+------------+------------+------------+------------+
|
||||
|
||||
Directories
|
||||
+---------------------------------------------------------------+------------+------------+------------+------------+------------+
|
||||
| path | files | code | comment | blank | total |
|
||||
+---------------------------------------------------------------+------------+------------+------------+------------+------------+
|
||||
| . | 192 | 25,119 | 12 | 6,368 | 31,499 |
|
||||
| . (Files) | 4 | 898 | 0 | 178 | 1,076 |
|
||||
| .github | 1 | 48 | 0 | 10 | 58 |
|
||||
| .github\workflows | 1 | 48 | 0 | 10 | 58 |
|
||||
| cleonos | 73 | 9,873 | 5 | 2,585 | 12,463 |
|
||||
| cleonos\c | 72 | 9,850 | 5 | 2,576 | 12,431 |
|
||||
| cleonos\c (Files) | 1 | 3 | 4 | 2 | 9 |
|
||||
| cleonos\c\apps | 67 | 9,413 | 1 | 2,475 | 11,889 |
|
||||
| cleonos\c\apps (Files) | 60 | 5,856 | 1 | 1,546 | 7,403 |
|
||||
| cleonos\c\apps\shell | 7 | 3,557 | 0 | 929 | 4,486 |
|
||||
| cleonos\c\include | 2 | 174 | 0 | 13 | 187 |
|
||||
| cleonos\c\src | 2 | 260 | 0 | 86 | 346 |
|
||||
| cleonos\rust | 1 | 23 | 0 | 9 | 32 |
|
||||
| cleonos\rust\src | 1 | 23 | 0 | 9 | 32 |
|
||||
| clks | 69 | 10,992 | 3 | 2,877 | 13,872 |
|
||||
| clks\arch | 4 | 160 | 0 | 22 | 182 |
|
||||
| clks\arch\aarch64 | 1 | 6 | 0 | 1 | 7 |
|
||||
| clks\arch\x86_64 | 3 | 154 | 0 | 21 | 175 |
|
||||
| clks\drivers | 7 | 721 | 0 | 183 | 904 |
|
||||
| clks\drivers\audio | 1 | 101 | 0 | 25 | 126 |
|
||||
| clks\drivers\serial | 1 | 52 | 0 | 16 | 68 |
|
||||
| clks\drivers\video | 5 | 568 | 0 | 142 | 710 |
|
||||
| clks\include | 32 | 727 | 0 | 179 | 906 |
|
||||
| clks\include\clks | 32 | 727 | 0 | 179 | 906 |
|
||||
| clks\kernel | 23 | 9,284 | 3 | 2,464 | 11,751 |
|
||||
| clks\lib | 2 | 79 | 0 | 23 | 102 |
|
||||
| clks\rust | 1 | 21 | 0 | 6 | 27 |
|
||||
| clks\rust\src | 1 | 21 | 0 | 6 | 27 |
|
||||
| cmake | 5 | 267 | 0 | 64 | 331 |
|
||||
| configs | 1 | 6 | 0 | 1 | 7 |
|
||||
| docs | 27 | 1,392 | 0 | 327 | 1,719 |
|
||||
| ramdisk | 1 | 4 | 0 | 2 | 6 |
|
||||
| ramdisk\shell | 1 | 4 | 0 | 2 | 6 |
|
||||
| scripts | 1 | 171 | 2 | 42 | 215 |
|
||||
| wine | 10 | 1,468 | 2 | 282 | 1,752 |
|
||||
| wine (Files) | 3 | 53 | 1 | 23 | 77 |
|
||||
| wine\cleonos_wine_lib | 7 | 1,415 | 1 | 259 | 1,675 |
|
||||
+---------------------------------------------------------------+------------+------------+------------+------------+------------+
|
||||
|
||||
Files
|
||||
+---------------------------------------------------------------+------------------+------------+------------+------------+------------+
|
||||
| filename | language | code | comment | blank | total |
|
||||
+---------------------------------------------------------------+------------------+------------+------------+------------+------------+
|
||||
| d:\Projects\C\cleonos\.github\workflows\build-os.yml | YAML | 48 | 0 | 10 | 58 |
|
||||
| d:\Projects\C\cleonos\CMakeLists.txt | CMake | 614 | 0 | 88 | 702 |
|
||||
| d:\Projects\C\cleonos\Makefile | Makefile | 100 | 0 | 22 | 122 |
|
||||
| d:\Projects\C\cleonos\README.md | Markdown | 92 | 0 | 34 | 126 |
|
||||
| d:\Projects\C\cleonos\README.zh-CN.md | Markdown | 92 | 0 | 34 | 126 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\ansi_main.c | C | 43 | 0 | 11 | 54 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\ansitest_main.c | C | 142 | 0 | 35 | 177 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\append_main.c | C | 74 | 0 | 18 | 92 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\args_main.c | C | 49 | 0 | 13 | 62 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\bg_main.c | C | 101 | 0 | 26 | 127 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\cat_main.c | C | 83 | 0 | 24 | 107 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\cd_main.c | C | 54 | 0 | 15 | 69 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\clear_main.c | C | 39 | 0 | 11 | 50 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\cmd_runtime.c | C | 446 | 0 | 143 | 589 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\cmd_runtime.h | C++ | 80 | 0 | 19 | 99 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\cp_main.c | C | 95 | 0 | 26 | 121 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\cut_main.c | C | 214 | 1 | 55 | 270 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\dmesg_main.c | C | 64 | 0 | 18 | 82 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\elfrunner_kmain.c | C | 6 | 0 | 3 | 9 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\elfrunner_main.c | C | 6 | 0 | 3 | 9 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\exec_main.c | C | 87 | 0 | 22 | 109 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\exit_main.c | C | 54 | 0 | 14 | 68 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\fastfetch_main.c | C | 180 | 0 | 34 | 214 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\fg_main.c | C | 150 | 0 | 36 | 186 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\fsstat_main.c | C | 45 | 0 | 11 | 56 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\grep_main.c | C | 195 | 0 | 54 | 249 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\head_main.c | C | 164 | 0 | 47 | 211 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\hello_main.c | C | 6 | 0 | 2 | 8 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\help_main.c | C | 79 | 0 | 10 | 89 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\jobs_main.c | C | 120 | 0 | 26 | 146 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\kbdstat_main.c | C | 44 | 0 | 11 | 55 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\kdbg_main.c | C | 214 | 0 | 56 | 270 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\kill_main.c | C | 144 | 0 | 39 | 183 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\ls_main.c | C | 262 | 0 | 76 | 338 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\memc_kmain.c | C | 6 | 0 | 3 | 9 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\memc_main.c | C | 8 | 0 | 3 | 11 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\memstat_main.c | C | 43 | 0 | 11 | 54 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\mkdir_main.c | C | 57 | 0 | 16 | 73 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\mv_main.c | C | 102 | 0 | 28 | 130 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\pid_main.c | C | 39 | 0 | 11 | 50 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\ps_main.c | C | 160 | 0 | 35 | 195 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\pwd_main.c | C | 39 | 0 | 11 | 50 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\restart_main.c | C | 40 | 0 | 11 | 51 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\rm_main.c | C | 57 | 0 | 16 | 73 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\shell\shell_cmd.c | C | 2,314 | 0 | 574 | 2,888 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\shell\shell_external.c | C | 166 | 0 | 55 | 221 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\shell\shell_input.c | C | 514 | 0 | 132 | 646 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\shell\shell_internal.h | C++ | 92 | 0 | 20 | 112 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\shell\shell_path.c | C | 153 | 0 | 50 | 203 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\shell\shell_script.c | C | 35 | 0 | 12 | 47 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\shell\shell_util.c | C | 283 | 0 | 86 | 369 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\shell_main.c | C | 19 | 0 | 6 | 25 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\shstat_main.c | C | 45 | 0 | 11 | 56 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\shutdown_main.c | C | 40 | 0 | 11 | 51 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\sleep_main.c | C | 52 | 0 | 14 | 66 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\sort_main.c | C | 205 | 0 | 63 | 268 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\spawn_main.c | C | 76 | 0 | 20 | 96 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\spin_main.c | C | 13 | 0 | 4 | 17 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\stats_main.c | C | 102 | 0 | 17 | 119 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\tail_main.c | C | 190 | 0 | 54 | 244 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\taskstat_main.c | C | 43 | 0 | 11 | 54 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\top_main.c | C | 195 | 0 | 47 | 242 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\touch_main.c | C | 58 | 0 | 16 | 74 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\tty_main.c | C | 64 | 0 | 17 | 81 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\ttydrv_main.c | C | 6 | 0 | 3 | 9 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\uniq_main.c | C | 168 | 0 | 48 | 216 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\userstat_main.c | C | 48 | 0 | 11 | 59 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\wait_main.c | C | 68 | 0 | 17 | 85 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\wavplay_main.c | C | 396 | 0 | 99 | 495 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\wc_main.c | C | 164 | 0 | 45 | 209 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\write_main.c | C | 74 | 0 | 18 | 92 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\yield_main.c | C | 39 | 0 | 11 | 50 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\include\cleonos_rust_bridge.h | C++ | 6 | 0 | 4 | 10 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\include\cleonos_syscall.h | C++ | 168 | 0 | 9 | 177 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\src\runtime.c | C | 37 | 0 | 12 | 49 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\src\syscall.c | C | 223 | 0 | 74 | 297 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\stub.c | C | 3 | 4 | 2 | 9 |
|
||||
| d:\Projects\C\cleonos\cleonos\rust\src\lib.rs | Rust | 23 | 0 | 9 | 32 |
|
||||
| d:\Projects\C\cleonos\clks\arch\aarch64\boot.c | C | 6 | 0 | 1 | 7 |
|
||||
| d:\Projects\C\cleonos\clks\arch\x86_64\boot.c | C | 6 | 0 | 1 | 7 |
|
||||
| d:\Projects\C\cleonos\clks\arch\x86_64\exec_stack_call.S | Go Assembly | 40 | 0 | 8 | 48 |
|
||||
| d:\Projects\C\cleonos\clks\arch\x86_64\interrupt_stubs.S | Go Assembly | 108 | 0 | 12 | 120 |
|
||||
| d:\Projects\C\cleonos\clks\drivers\audio\pcspeaker.c | C | 101 | 0 | 25 | 126 |
|
||||
| d:\Projects\C\cleonos\clks\drivers\serial\serial.c | C | 52 | 0 | 16 | 68 |
|
||||
| d:\Projects\C\cleonos\clks\drivers\video\font8x8.c | C | 67 | 0 | 8 | 75 |
|
||||
| d:\Projects\C\cleonos\clks\drivers\video\font8x8.h | C++ | 5 | 0 | 3 | 8 |
|
||||
| d:\Projects\C\cleonos\clks\drivers\video\framebuffer.c | C | 251 | 0 | 70 | 321 |
|
||||
| d:\Projects\C\cleonos\clks\drivers\video\psf_font.c | C | 230 | 0 | 56 | 286 |
|
||||
| d:\Projects\C\cleonos\clks\drivers\video\psf_font.h | C++ | 15 | 0 | 5 | 20 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\audio.h | C++ | 9 | 0 | 3 | 12 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\boot.h | C++ | 11 | 0 | 4 | 15 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\compiler.h | C++ | 13 | 0 | 4 | 17 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\cpu.h | C++ | 20 | 0 | 4 | 24 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\desktop.h | C++ | 7 | 0 | 4 | 11 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\driver.h | C++ | 29 | 0 | 8 | 37 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\elf64.h | C++ | 32 | 0 | 9 | 41 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\elfrunner.h | C++ | 6 | 0 | 3 | 9 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\exec.h | C++ | 66 | 0 | 8 | 74 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\framebuffer.h | C++ | 26 | 0 | 6 | 32 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\fs.h | C++ | 23 | 0 | 7 | 30 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\heap.h | C++ | 15 | 0 | 4 | 19 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\interrupts.h | C++ | 6 | 0 | 3 | 9 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\kelf.h | C++ | 9 | 0 | 5 | 14 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\kernel.h | C++ | 4 | 0 | 2 | 6 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\keyboard.h | C++ | 27 | 0 | 6 | 33 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\limine.h | C++ | 132 | 0 | 24 | 156 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\log.h | C++ | 14 | 0 | 5 | 19 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\mouse.h | C++ | 20 | 0 | 6 | 26 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\panic.h | C++ | 12 | 0 | 4 | 16 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\pmm.h | C++ | 16 | 0 | 5 | 21 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\ramdisk.h | C++ | 17 | 0 | 8 | 25 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\scheduler.h | C++ | 18 | 0 | 5 | 23 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\serial.h | C++ | 6 | 0 | 2 | 8 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\service.h | C++ | 31 | 0 | 8 | 39 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\shell.h | C++ | 7 | 0 | 3 | 10 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\string.h | C++ | 9 | 0 | 3 | 12 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\syscall.h | C++ | 75 | 0 | 5 | 80 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\task.h | C++ | 24 | 0 | 7 | 31 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\tty.h | C++ | 14 | 0 | 4 | 18 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\types.h | C++ | 17 | 0 | 6 | 23 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\userland.h | C++ | 12 | 0 | 4 | 16 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\desktop.c | C | 321 | 0 | 86 | 407 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\driver.c | C | 169 | 0 | 49 | 218 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\elf64.c | C | 239 | 0 | 73 | 312 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\elfrunner.c | C | 30 | 0 | 8 | 38 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\exec.c | C | 1,203 | 1 | 335 | 1,539 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\fs.c | C | 698 | 0 | 220 | 918 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\heap.c | C | 134 | 0 | 42 | 176 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\interrupts.c | C | 317 | 0 | 44 | 361 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\kelf.c | C | 203 | 1 | 53 | 257 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\keyboard.c | C | 351 | 0 | 88 | 439 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\kmain.c | C | 200 | 1 | 52 | 253 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\limine_requests.c | C | 76 | 0 | 26 | 102 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\log.c | C | 185 | 0 | 48 | 233 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\mouse.c | C | 246 | 0 | 63 | 309 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\panic.c | C | 546 | 0 | 155 | 701 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\pmm.c | C | 82 | 0 | 23 | 105 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\ramdisk.c | C | 172 | 0 | 50 | 222 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\scheduler.c | C | 136 | 0 | 44 | 180 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\service.c | C | 113 | 0 | 34 | 147 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\shell.c | C | 1,249 | 0 | 317 | 1,566 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\syscall.c | C | 1,375 | 0 | 344 | 1,719 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\tty.c | C | 1,115 | 0 | 275 | 1,390 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\userland.c | C | 124 | 0 | 35 | 159 |
|
||||
| d:\Projects\C\cleonos\clks\lib\libc_compat.c | C | 25 | 0 | 7 | 32 |
|
||||
| d:\Projects\C\cleonos\clks\lib\string.c | C | 54 | 0 | 16 | 70 |
|
||||
| d:\Projects\C\cleonos\clks\rust\src\lib.rs | Rust | 21 | 0 | 6 | 27 |
|
||||
| d:\Projects\C\cleonos\cmake\check_tools.cmake | CMake | 34 | 0 | 7 | 41 |
|
||||
| d:\Projects\C\cleonos\cmake\gen_kernel_symbols.cmake | CMake | 80 | 0 | 26 | 106 |
|
||||
| d:\Projects\C\cleonos\cmake\log.cmake | CMake | 30 | 0 | 6 | 36 |
|
||||
| d:\Projects\C\cleonos\cmake\log_emit.cmake | CMake | 23 | 0 | 6 | 29 |
|
||||
| d:\Projects\C\cleonos\cmake\setup_limine.cmake | CMake | 100 | 0 | 19 | 119 |
|
||||
| d:\Projects\C\cleonos\configs\limine.conf | Properties | 6 | 0 | 1 | 7 |
|
||||
| d:\Projects\C\cleonos\docs\README.md | Markdown | 31 | 0 | 4 | 35 |
|
||||
| d:\Projects\C\cleonos\docs\stage1.md | Markdown | 41 | 0 | 5 | 46 |
|
||||
| d:\Projects\C\cleonos\docs\stage10.md | Markdown | 34 | 0 | 6 | 40 |
|
||||
| d:\Projects\C\cleonos\docs\stage11.md | Markdown | 36 | 0 | 5 | 41 |
|
||||
| d:\Projects\C\cleonos\docs\stage12.md | Markdown | 40 | 0 | 6 | 46 |
|
||||
| d:\Projects\C\cleonos\docs\stage13.md | Markdown | 34 | 0 | 6 | 40 |
|
||||
| d:\Projects\C\cleonos\docs\stage14.md | Markdown | 44 | 0 | 8 | 52 |
|
||||
| d:\Projects\C\cleonos\docs\stage15.md | Markdown | 47 | 0 | 7 | 54 |
|
||||
| d:\Projects\C\cleonos\docs\stage2.md | Markdown | 30 | 0 | 5 | 35 |
|
||||
| d:\Projects\C\cleonos\docs\stage20.md | Markdown | 46 | 0 | 6 | 52 |
|
||||
| d:\Projects\C\cleonos\docs\stage21.md | Markdown | 72 | 0 | 7 | 79 |
|
||||
| d:\Projects\C\cleonos\docs\stage22.md | Markdown | 68 | 0 | 7 | 75 |
|
||||
| d:\Projects\C\cleonos\docs\stage23.md | Markdown | 41 | 0 | 6 | 47 |
|
||||
| d:\Projects\C\cleonos\docs\stage24.md | Markdown | 42 | 0 | 7 | 49 |
|
||||
| d:\Projects\C\cleonos\docs\stage25.md | Markdown | 58 | 0 | 7 | 65 |
|
||||
| d:\Projects\C\cleonos\docs\stage26.md | Markdown | 32 | 0 | 7 | 39 |
|
||||
| d:\Projects\C\cleonos\docs\stage27.md | Markdown | 32 | 0 | 7 | 39 |
|
||||
| d:\Projects\C\cleonos\docs\stage28.md | Markdown | 37 | 0 | 7 | 44 |
|
||||
| d:\Projects\C\cleonos\docs\stage29.md | Markdown | 33 | 0 | 7 | 40 |
|
||||
| d:\Projects\C\cleonos\docs\stage3.md | Markdown | 29 | 0 | 5 | 34 |
|
||||
| d:\Projects\C\cleonos\docs\stage4.md | Markdown | 30 | 0 | 5 | 35 |
|
||||
| d:\Projects\C\cleonos\docs\stage5.md | Markdown | 29 | 0 | 5 | 34 |
|
||||
| d:\Projects\C\cleonos\docs\stage6.md | Markdown | 30 | 0 | 6 | 36 |
|
||||
| d:\Projects\C\cleonos\docs\stage7.md | Markdown | 34 | 0 | 6 | 40 |
|
||||
| d:\Projects\C\cleonos\docs\stage8.md | Markdown | 31 | 0 | 6 | 37 |
|
||||
| d:\Projects\C\cleonos\docs\stage9.md | Markdown | 31 | 0 | 6 | 37 |
|
||||
| d:\Projects\C\cleonos\docs\syscall.md | Markdown | 380 | 0 | 168 | 548 |
|
||||
| d:\Projects\C\cleonos\ramdisk\shell\init.cmd | Batch | 4 | 0 | 2 | 6 |
|
||||
| d:\Projects\C\cleonos\scripts\gen-tty-psf.ps1 | PowerShell | 171 | 2 | 42 | 215 |
|
||||
| d:\Projects\C\cleonos\wine\README.md | Markdown | 49 | 0 | 19 | 68 |
|
||||
| d:\Projects\C\cleonos\wine\cleonos_wine.py | Python | 3 | 1 | 3 | 7 |
|
||||
| d:\Projects\C\cleonos\wine\cleonos_wine_lib\__init__.py | Python | 4 | 0 | 1 | 5 |
|
||||
| d:\Projects\C\cleonos\wine\cleonos_wine_lib\cli.py | Python | 44 | 0 | 10 | 54 |
|
||||
| d:\Projects\C\cleonos\wine\cleonos_wine_lib\constants.py | Python | 76 | 1 | 11 | 88 |
|
||||
| d:\Projects\C\cleonos\wine\cleonos_wine_lib\input_pump.py | Python | 82 | 0 | 17 | 99 |
|
||||
| d:\Projects\C\cleonos\wine\cleonos_wine_lib\platform.py | Python | 55 | 0 | 5 | 60 |
|
||||
| d:\Projects\C\cleonos\wine\cleonos_wine_lib\runner.py | Python | 990 | 0 | 175 | 1,165 |
|
||||
| d:\Projects\C\cleonos\wine\cleonos_wine_lib\state.py | Python | 164 | 0 | 40 | 204 |
|
||||
| d:\Projects\C\cleonos\wine\requirements.txt | pip requirements | 1 | 0 | 1 | 2 |
|
||||
| Total | | 25,119 | 12 | 6,368 | 31,499 |
|
||||
+---------------------------------------------------------------+------------------+------------+------------+------------+------------+
|
||||
209
.VSCodeCounter/2026-04-17_22-23-18/details.md
Normal file
209
.VSCodeCounter/2026-04-17_22-23-18/details.md
Normal file
@@ -0,0 +1,209 @@
|
||||
# Details
|
||||
|
||||
Date : 2026-04-17 22:23:18
|
||||
|
||||
Directory d:\\Projects\\C\\cleonos
|
||||
|
||||
Total : 194 files, 26202 codes, 12 comments, 6631 blanks, all 32845 lines
|
||||
|
||||
[Summary](results.md) / Details / [Diff Summary](diff.md) / [Diff Details](diff-details.md)
|
||||
|
||||
## Files
|
||||
| filename | language | code | comment | blank | total |
|
||||
| :--- | :--- | ---: | ---: | ---: | ---: |
|
||||
| [.github/workflows/build-os.yml](/.github/workflows/build-os.yml) | YAML | 48 | 0 | 10 | 58 |
|
||||
| [CMakeLists.txt](/CMakeLists.txt) | CMake | 615 | 0 | 88 | 703 |
|
||||
| [Makefile](/Makefile) | Makefile | 100 | 0 | 22 | 122 |
|
||||
| [README.md](/README.md) | Markdown | 92 | 0 | 34 | 126 |
|
||||
| [README.zh-CN.md](/README.zh-CN.md) | Markdown | 92 | 0 | 34 | 126 |
|
||||
| [cleonos/c/apps/ansi\_main.c](/cleonos/c/apps/ansi_main.c) | C | 43 | 0 | 11 | 54 |
|
||||
| [cleonos/c/apps/ansitest\_main.c](/cleonos/c/apps/ansitest_main.c) | C | 142 | 0 | 35 | 177 |
|
||||
| [cleonos/c/apps/append\_main.c](/cleonos/c/apps/append_main.c) | C | 74 | 0 | 18 | 92 |
|
||||
| [cleonos/c/apps/args\_main.c](/cleonos/c/apps/args_main.c) | C | 49 | 0 | 13 | 62 |
|
||||
| [cleonos/c/apps/bg\_main.c](/cleonos/c/apps/bg_main.c) | C | 101 | 0 | 26 | 127 |
|
||||
| [cleonos/c/apps/cat\_main.c](/cleonos/c/apps/cat_main.c) | C | 83 | 0 | 24 | 107 |
|
||||
| [cleonos/c/apps/cd\_main.c](/cleonos/c/apps/cd_main.c) | C | 54 | 0 | 15 | 69 |
|
||||
| [cleonos/c/apps/clear\_main.c](/cleonos/c/apps/clear_main.c) | C | 39 | 0 | 11 | 50 |
|
||||
| [cleonos/c/apps/cmd\_runtime.c](/cleonos/c/apps/cmd_runtime.c) | C | 446 | 0 | 143 | 589 |
|
||||
| [cleonos/c/apps/cmd\_runtime.h](/cleonos/c/apps/cmd_runtime.h) | C++ | 80 | 0 | 19 | 99 |
|
||||
| [cleonos/c/apps/cp\_main.c](/cleonos/c/apps/cp_main.c) | C | 95 | 0 | 26 | 121 |
|
||||
| [cleonos/c/apps/cut\_main.c](/cleonos/c/apps/cut_main.c) | C | 214 | 1 | 55 | 270 |
|
||||
| [cleonos/c/apps/dmesg\_main.c](/cleonos/c/apps/dmesg_main.c) | C | 64 | 0 | 18 | 82 |
|
||||
| [cleonos/c/apps/elfrunner\_kmain.c](/cleonos/c/apps/elfrunner_kmain.c) | C | 6 | 0 | 3 | 9 |
|
||||
| [cleonos/c/apps/elfrunner\_main.c](/cleonos/c/apps/elfrunner_main.c) | C | 6 | 0 | 3 | 9 |
|
||||
| [cleonos/c/apps/exec\_main.c](/cleonos/c/apps/exec_main.c) | C | 87 | 0 | 22 | 109 |
|
||||
| [cleonos/c/apps/exit\_main.c](/cleonos/c/apps/exit_main.c) | C | 54 | 0 | 14 | 68 |
|
||||
| [cleonos/c/apps/fastfetch\_main.c](/cleonos/c/apps/fastfetch_main.c) | C | 180 | 0 | 34 | 214 |
|
||||
| [cleonos/c/apps/fg\_main.c](/cleonos/c/apps/fg_main.c) | C | 150 | 0 | 36 | 186 |
|
||||
| [cleonos/c/apps/fsstat\_main.c](/cleonos/c/apps/fsstat_main.c) | C | 45 | 0 | 11 | 56 |
|
||||
| [cleonos/c/apps/grep\_main.c](/cleonos/c/apps/grep_main.c) | C | 195 | 0 | 54 | 249 |
|
||||
| [cleonos/c/apps/head\_main.c](/cleonos/c/apps/head_main.c) | C | 164 | 0 | 47 | 211 |
|
||||
| [cleonos/c/apps/hello\_main.c](/cleonos/c/apps/hello_main.c) | C | 6 | 0 | 2 | 8 |
|
||||
| [cleonos/c/apps/help\_main.c](/cleonos/c/apps/help_main.c) | C | 80 | 0 | 10 | 90 |
|
||||
| [cleonos/c/apps/jobs\_main.c](/cleonos/c/apps/jobs_main.c) | C | 120 | 0 | 26 | 146 |
|
||||
| [cleonos/c/apps/kbdstat\_main.c](/cleonos/c/apps/kbdstat_main.c) | C | 44 | 0 | 11 | 55 |
|
||||
| [cleonos/c/apps/kdbg\_main.c](/cleonos/c/apps/kdbg_main.c) | C | 214 | 0 | 56 | 270 |
|
||||
| [cleonos/c/apps/kill\_main.c](/cleonos/c/apps/kill_main.c) | C | 144 | 0 | 39 | 183 |
|
||||
| [cleonos/c/apps/ls\_main.c](/cleonos/c/apps/ls_main.c) | C | 262 | 0 | 76 | 338 |
|
||||
| [cleonos/c/apps/memc\_kmain.c](/cleonos/c/apps/memc_kmain.c) | C | 6 | 0 | 3 | 9 |
|
||||
| [cleonos/c/apps/memc\_main.c](/cleonos/c/apps/memc_main.c) | C | 8 | 0 | 3 | 11 |
|
||||
| [cleonos/c/apps/memstat\_main.c](/cleonos/c/apps/memstat_main.c) | C | 43 | 0 | 11 | 54 |
|
||||
| [cleonos/c/apps/mkdir\_main.c](/cleonos/c/apps/mkdir_main.c) | C | 57 | 0 | 16 | 73 |
|
||||
| [cleonos/c/apps/mv\_main.c](/cleonos/c/apps/mv_main.c) | C | 102 | 0 | 28 | 130 |
|
||||
| [cleonos/c/apps/pid\_main.c](/cleonos/c/apps/pid_main.c) | C | 39 | 0 | 11 | 50 |
|
||||
| [cleonos/c/apps/procstat\_main.c](/cleonos/c/apps/procstat_main.c) | C | 202 | 0 | 43 | 245 |
|
||||
| [cleonos/c/apps/ps\_main.c](/cleonos/c/apps/ps_main.c) | C | 160 | 0 | 35 | 195 |
|
||||
| [cleonos/c/apps/pwd\_main.c](/cleonos/c/apps/pwd_main.c) | C | 39 | 0 | 11 | 50 |
|
||||
| [cleonos/c/apps/restart\_main.c](/cleonos/c/apps/restart_main.c) | C | 40 | 0 | 11 | 51 |
|
||||
| [cleonos/c/apps/rm\_main.c](/cleonos/c/apps/rm_main.c) | C | 57 | 0 | 16 | 73 |
|
||||
| [cleonos/c/apps/shell/shell\_cmd.c](/cleonos/c/apps/shell/shell_cmd.c) | C | 2,315 | 0 | 574 | 2,889 |
|
||||
| [cleonos/c/apps/shell/shell\_external.c](/cleonos/c/apps/shell/shell_external.c) | C | 166 | 0 | 55 | 221 |
|
||||
| [cleonos/c/apps/shell/shell\_input.c](/cleonos/c/apps/shell/shell_input.c) | C | 563 | 0 | 147 | 710 |
|
||||
| [cleonos/c/apps/shell/shell\_internal.h](/cleonos/c/apps/shell/shell_internal.h) | C++ | 92 | 0 | 20 | 112 |
|
||||
| [cleonos/c/apps/shell/shell\_path.c](/cleonos/c/apps/shell/shell_path.c) | C | 153 | 0 | 50 | 203 |
|
||||
| [cleonos/c/apps/shell/shell\_script.c](/cleonos/c/apps/shell/shell_script.c) | C | 35 | 0 | 12 | 47 |
|
||||
| [cleonos/c/apps/shell/shell\_util.c](/cleonos/c/apps/shell/shell_util.c) | C | 283 | 0 | 86 | 369 |
|
||||
| [cleonos/c/apps/shell\_main.c](/cleonos/c/apps/shell_main.c) | C | 19 | 0 | 6 | 25 |
|
||||
| [cleonos/c/apps/shstat\_main.c](/cleonos/c/apps/shstat_main.c) | C | 45 | 0 | 11 | 56 |
|
||||
| [cleonos/c/apps/shutdown\_main.c](/cleonos/c/apps/shutdown_main.c) | C | 40 | 0 | 11 | 51 |
|
||||
| [cleonos/c/apps/sleep\_main.c](/cleonos/c/apps/sleep_main.c) | C | 52 | 0 | 14 | 66 |
|
||||
| [cleonos/c/apps/sort\_main.c](/cleonos/c/apps/sort_main.c) | C | 205 | 0 | 63 | 268 |
|
||||
| [cleonos/c/apps/spawn\_main.c](/cleonos/c/apps/spawn_main.c) | C | 76 | 0 | 20 | 96 |
|
||||
| [cleonos/c/apps/spin\_main.c](/cleonos/c/apps/spin_main.c) | C | 13 | 0 | 4 | 17 |
|
||||
| [cleonos/c/apps/stats\_main.c](/cleonos/c/apps/stats_main.c) | C | 102 | 0 | 17 | 119 |
|
||||
| [cleonos/c/apps/sysstat\_main.c](/cleonos/c/apps/sysstat_main.c) | C | 267 | 0 | 45 | 312 |
|
||||
| [cleonos/c/apps/tail\_main.c](/cleonos/c/apps/tail_main.c) | C | 190 | 0 | 54 | 244 |
|
||||
| [cleonos/c/apps/taskstat\_main.c](/cleonos/c/apps/taskstat_main.c) | C | 43 | 0 | 11 | 54 |
|
||||
| [cleonos/c/apps/top\_main.c](/cleonos/c/apps/top_main.c) | C | 195 | 0 | 47 | 242 |
|
||||
| [cleonos/c/apps/touch\_main.c](/cleonos/c/apps/touch_main.c) | C | 58 | 0 | 16 | 74 |
|
||||
| [cleonos/c/apps/tty\_main.c](/cleonos/c/apps/tty_main.c) | C | 64 | 0 | 17 | 81 |
|
||||
| [cleonos/c/apps/ttydrv\_main.c](/cleonos/c/apps/ttydrv_main.c) | C | 6 | 0 | 3 | 9 |
|
||||
| [cleonos/c/apps/uniq\_main.c](/cleonos/c/apps/uniq_main.c) | C | 168 | 0 | 48 | 216 |
|
||||
| [cleonos/c/apps/userstat\_main.c](/cleonos/c/apps/userstat_main.c) | C | 48 | 0 | 11 | 59 |
|
||||
| [cleonos/c/apps/wait\_main.c](/cleonos/c/apps/wait_main.c) | C | 68 | 0 | 17 | 85 |
|
||||
| [cleonos/c/apps/wavplay\_main.c](/cleonos/c/apps/wavplay_main.c) | C | 396 | 0 | 99 | 495 |
|
||||
| [cleonos/c/apps/wc\_main.c](/cleonos/c/apps/wc_main.c) | C | 164 | 0 | 45 | 209 |
|
||||
| [cleonos/c/apps/write\_main.c](/cleonos/c/apps/write_main.c) | C | 74 | 0 | 18 | 92 |
|
||||
| [cleonos/c/apps/yield\_main.c](/cleonos/c/apps/yield_main.c) | C | 39 | 0 | 11 | 50 |
|
||||
| [cleonos/c/include/cleonos\_rust\_bridge.h](/cleonos/c/include/cleonos_rust_bridge.h) | C++ | 6 | 0 | 4 | 10 |
|
||||
| [cleonos/c/include/cleonos\_syscall.h](/cleonos/c/include/cleonos_syscall.h) | C++ | 192 | 0 | 10 | 202 |
|
||||
| [cleonos/c/src/runtime.c](/cleonos/c/src/runtime.c) | C | 37 | 0 | 12 | 49 |
|
||||
| [cleonos/c/src/syscall.c](/cleonos/c/src/syscall.c) | C | 250 | 0 | 83 | 333 |
|
||||
| [cleonos/c/stub.c](/cleonos/c/stub.c) | C | 3 | 4 | 2 | 9 |
|
||||
| [cleonos/rust/src/lib.rs](/cleonos/rust/src/lib.rs) | Rust | 23 | 0 | 9 | 32 |
|
||||
| [clks/arch/aarch64/boot.c](/clks/arch/aarch64/boot.c) | C | 6 | 0 | 1 | 7 |
|
||||
| [clks/arch/x86\_64/boot.c](/clks/arch/x86_64/boot.c) | C | 6 | 0 | 1 | 7 |
|
||||
| [clks/arch/x86\_64/exec\_stack\_call.S](/clks/arch/x86_64/exec_stack_call.S) | Go Assembly | 40 | 0 | 8 | 48 |
|
||||
| [clks/arch/x86\_64/interrupt\_stubs.S](/clks/arch/x86_64/interrupt_stubs.S) | Go Assembly | 108 | 0 | 12 | 120 |
|
||||
| [clks/drivers/audio/pcspeaker.c](/clks/drivers/audio/pcspeaker.c) | C | 101 | 0 | 25 | 126 |
|
||||
| [clks/drivers/serial/serial.c](/clks/drivers/serial/serial.c) | C | 52 | 0 | 16 | 68 |
|
||||
| [clks/drivers/video/font8x8.c](/clks/drivers/video/font8x8.c) | C | 67 | 0 | 8 | 75 |
|
||||
| [clks/drivers/video/font8x8.h](/clks/drivers/video/font8x8.h) | C++ | 5 | 0 | 3 | 8 |
|
||||
| [clks/drivers/video/framebuffer.c](/clks/drivers/video/framebuffer.c) | C | 251 | 0 | 70 | 321 |
|
||||
| [clks/drivers/video/psf\_font.c](/clks/drivers/video/psf_font.c) | C | 230 | 0 | 56 | 286 |
|
||||
| [clks/drivers/video/psf\_font.h](/clks/drivers/video/psf_font.h) | C++ | 15 | 0 | 5 | 20 |
|
||||
| [clks/include/clks/audio.h](/clks/include/clks/audio.h) | C++ | 9 | 0 | 3 | 12 |
|
||||
| [clks/include/clks/boot.h](/clks/include/clks/boot.h) | C++ | 11 | 0 | 4 | 15 |
|
||||
| [clks/include/clks/compiler.h](/clks/include/clks/compiler.h) | C++ | 13 | 0 | 4 | 17 |
|
||||
| [clks/include/clks/cpu.h](/clks/include/clks/cpu.h) | C++ | 20 | 0 | 4 | 24 |
|
||||
| [clks/include/clks/desktop.h](/clks/include/clks/desktop.h) | C++ | 7 | 0 | 4 | 11 |
|
||||
| [clks/include/clks/driver.h](/clks/include/clks/driver.h) | C++ | 29 | 0 | 8 | 37 |
|
||||
| [clks/include/clks/elf64.h](/clks/include/clks/elf64.h) | C++ | 32 | 0 | 9 | 41 |
|
||||
| [clks/include/clks/elfrunner.h](/clks/include/clks/elfrunner.h) | C++ | 6 | 0 | 3 | 9 |
|
||||
| [clks/include/clks/exec.h](/clks/include/clks/exec.h) | C++ | 71 | 0 | 8 | 79 |
|
||||
| [clks/include/clks/framebuffer.h](/clks/include/clks/framebuffer.h) | C++ | 26 | 0 | 6 | 32 |
|
||||
| [clks/include/clks/fs.h](/clks/include/clks/fs.h) | C++ | 23 | 0 | 7 | 30 |
|
||||
| [clks/include/clks/heap.h](/clks/include/clks/heap.h) | C++ | 15 | 0 | 4 | 19 |
|
||||
| [clks/include/clks/interrupts.h](/clks/include/clks/interrupts.h) | C++ | 6 | 0 | 3 | 9 |
|
||||
| [clks/include/clks/kelf.h](/clks/include/clks/kelf.h) | C++ | 9 | 0 | 5 | 14 |
|
||||
| [clks/include/clks/kernel.h](/clks/include/clks/kernel.h) | C++ | 4 | 0 | 2 | 6 |
|
||||
| [clks/include/clks/keyboard.h](/clks/include/clks/keyboard.h) | C++ | 27 | 0 | 6 | 33 |
|
||||
| [clks/include/clks/limine.h](/clks/include/clks/limine.h) | C++ | 132 | 0 | 24 | 156 |
|
||||
| [clks/include/clks/log.h](/clks/include/clks/log.h) | C++ | 14 | 0 | 5 | 19 |
|
||||
| [clks/include/clks/mouse.h](/clks/include/clks/mouse.h) | C++ | 20 | 0 | 6 | 26 |
|
||||
| [clks/include/clks/panic.h](/clks/include/clks/panic.h) | C++ | 12 | 0 | 4 | 16 |
|
||||
| [clks/include/clks/pmm.h](/clks/include/clks/pmm.h) | C++ | 16 | 0 | 5 | 21 |
|
||||
| [clks/include/clks/ramdisk.h](/clks/include/clks/ramdisk.h) | C++ | 17 | 0 | 8 | 25 |
|
||||
| [clks/include/clks/scheduler.h](/clks/include/clks/scheduler.h) | C++ | 18 | 0 | 5 | 23 |
|
||||
| [clks/include/clks/serial.h](/clks/include/clks/serial.h) | C++ | 6 | 0 | 2 | 8 |
|
||||
| [clks/include/clks/service.h](/clks/include/clks/service.h) | C++ | 31 | 0 | 8 | 39 |
|
||||
| [clks/include/clks/shell.h](/clks/include/clks/shell.h) | C++ | 7 | 0 | 3 | 10 |
|
||||
| [clks/include/clks/string.h](/clks/include/clks/string.h) | C++ | 9 | 0 | 3 | 12 |
|
||||
| [clks/include/clks/syscall.h](/clks/include/clks/syscall.h) | C++ | 84 | 0 | 5 | 89 |
|
||||
| [clks/include/clks/task.h](/clks/include/clks/task.h) | C++ | 24 | 0 | 7 | 31 |
|
||||
| [clks/include/clks/tty.h](/clks/include/clks/tty.h) | C++ | 14 | 0 | 4 | 18 |
|
||||
| [clks/include/clks/types.h](/clks/include/clks/types.h) | C++ | 17 | 0 | 6 | 23 |
|
||||
| [clks/include/clks/userland.h](/clks/include/clks/userland.h) | C++ | 12 | 0 | 4 | 16 |
|
||||
| [clks/kernel/desktop.c](/clks/kernel/desktop.c) | C | 321 | 0 | 86 | 407 |
|
||||
| [clks/kernel/driver.c](/clks/kernel/driver.c) | C | 169 | 0 | 49 | 218 |
|
||||
| [clks/kernel/elf64.c](/clks/kernel/elf64.c) | C | 239 | 0 | 73 | 312 |
|
||||
| [clks/kernel/elfrunner.c](/clks/kernel/elfrunner.c) | C | 30 | 0 | 8 | 38 |
|
||||
| [clks/kernel/exec.c](/clks/kernel/exec.c) | C | 1,522 | 1 | 435 | 1,958 |
|
||||
| [clks/kernel/fs.c](/clks/kernel/fs.c) | C | 698 | 0 | 220 | 918 |
|
||||
| [clks/kernel/heap.c](/clks/kernel/heap.c) | C | 134 | 0 | 42 | 176 |
|
||||
| [clks/kernel/interrupts.c](/clks/kernel/interrupts.c) | C | 317 | 0 | 44 | 361 |
|
||||
| [clks/kernel/kelf.c](/clks/kernel/kelf.c) | C | 203 | 1 | 53 | 257 |
|
||||
| [clks/kernel/keyboard.c](/clks/kernel/keyboard.c) | C | 351 | 0 | 88 | 439 |
|
||||
| [clks/kernel/kmain.c](/clks/kernel/kmain.c) | C | 200 | 1 | 52 | 253 |
|
||||
| [clks/kernel/limine\_requests.c](/clks/kernel/limine_requests.c) | C | 76 | 0 | 26 | 102 |
|
||||
| [clks/kernel/log.c](/clks/kernel/log.c) | C | 185 | 0 | 48 | 233 |
|
||||
| [clks/kernel/mouse.c](/clks/kernel/mouse.c) | C | 246 | 0 | 63 | 309 |
|
||||
| [clks/kernel/panic.c](/clks/kernel/panic.c) | C | 546 | 0 | 155 | 701 |
|
||||
| [clks/kernel/pmm.c](/clks/kernel/pmm.c) | C | 82 | 0 | 23 | 105 |
|
||||
| [clks/kernel/ramdisk.c](/clks/kernel/ramdisk.c) | C | 172 | 0 | 50 | 222 |
|
||||
| [clks/kernel/scheduler.c](/clks/kernel/scheduler.c) | C | 136 | 0 | 44 | 180 |
|
||||
| [clks/kernel/service.c](/clks/kernel/service.c) | C | 113 | 0 | 34 | 147 |
|
||||
| [clks/kernel/shell.c](/clks/kernel/shell.c) | C | 1,249 | 0 | 317 | 1,566 |
|
||||
| [clks/kernel/syscall.c](/clks/kernel/syscall.c) | C | 1,480 | 0 | 370 | 1,850 |
|
||||
| [clks/kernel/tty.c](/clks/kernel/tty.c) | C | 1,115 | 0 | 275 | 1,390 |
|
||||
| [clks/kernel/userland.c](/clks/kernel/userland.c) | C | 124 | 0 | 35 | 159 |
|
||||
| [clks/lib/libc\_compat.c](/clks/lib/libc_compat.c) | C | 25 | 0 | 7 | 32 |
|
||||
| [clks/lib/string.c](/clks/lib/string.c) | C | 54 | 0 | 16 | 70 |
|
||||
| [clks/rust/src/lib.rs](/clks/rust/src/lib.rs) | Rust | 21 | 0 | 6 | 27 |
|
||||
| [cmake/check\_tools.cmake](/cmake/check_tools.cmake) | CMake | 34 | 0 | 7 | 41 |
|
||||
| [cmake/gen\_kernel\_symbols.cmake](/cmake/gen_kernel_symbols.cmake) | CMake | 80 | 0 | 26 | 106 |
|
||||
| [cmake/log.cmake](/cmake/log.cmake) | CMake | 30 | 0 | 6 | 36 |
|
||||
| [cmake/log\_emit.cmake](/cmake/log_emit.cmake) | CMake | 23 | 0 | 6 | 29 |
|
||||
| [cmake/setup\_limine.cmake](/cmake/setup_limine.cmake) | CMake | 100 | 0 | 19 | 119 |
|
||||
| [configs/limine.conf](/configs/limine.conf) | Properties | 6 | 0 | 1 | 7 |
|
||||
| [docs/README.md](/docs/README.md) | Markdown | 31 | 0 | 4 | 35 |
|
||||
| [docs/stage1.md](/docs/stage1.md) | Markdown | 41 | 0 | 5 | 46 |
|
||||
| [docs/stage10.md](/docs/stage10.md) | Markdown | 34 | 0 | 6 | 40 |
|
||||
| [docs/stage11.md](/docs/stage11.md) | Markdown | 36 | 0 | 5 | 41 |
|
||||
| [docs/stage12.md](/docs/stage12.md) | Markdown | 40 | 0 | 6 | 46 |
|
||||
| [docs/stage13.md](/docs/stage13.md) | Markdown | 34 | 0 | 6 | 40 |
|
||||
| [docs/stage14.md](/docs/stage14.md) | Markdown | 44 | 0 | 8 | 52 |
|
||||
| [docs/stage15.md](/docs/stage15.md) | Markdown | 47 | 0 | 7 | 54 |
|
||||
| [docs/stage2.md](/docs/stage2.md) | Markdown | 30 | 0 | 5 | 35 |
|
||||
| [docs/stage20.md](/docs/stage20.md) | Markdown | 46 | 0 | 6 | 52 |
|
||||
| [docs/stage21.md](/docs/stage21.md) | Markdown | 72 | 0 | 7 | 79 |
|
||||
| [docs/stage22.md](/docs/stage22.md) | Markdown | 68 | 0 | 7 | 75 |
|
||||
| [docs/stage23.md](/docs/stage23.md) | Markdown | 41 | 0 | 6 | 47 |
|
||||
| [docs/stage24.md](/docs/stage24.md) | Markdown | 42 | 0 | 7 | 49 |
|
||||
| [docs/stage25.md](/docs/stage25.md) | Markdown | 58 | 0 | 7 | 65 |
|
||||
| [docs/stage26.md](/docs/stage26.md) | Markdown | 32 | 0 | 7 | 39 |
|
||||
| [docs/stage27.md](/docs/stage27.md) | Markdown | 32 | 0 | 7 | 39 |
|
||||
| [docs/stage28.md](/docs/stage28.md) | Markdown | 37 | 0 | 7 | 44 |
|
||||
| [docs/stage29.md](/docs/stage29.md) | Markdown | 33 | 0 | 7 | 40 |
|
||||
| [docs/stage3.md](/docs/stage3.md) | Markdown | 29 | 0 | 5 | 34 |
|
||||
| [docs/stage4.md](/docs/stage4.md) | Markdown | 30 | 0 | 5 | 35 |
|
||||
| [docs/stage5.md](/docs/stage5.md) | Markdown | 29 | 0 | 5 | 34 |
|
||||
| [docs/stage6.md](/docs/stage6.md) | Markdown | 30 | 0 | 6 | 36 |
|
||||
| [docs/stage7.md](/docs/stage7.md) | Markdown | 34 | 0 | 6 | 40 |
|
||||
| [docs/stage8.md](/docs/stage8.md) | Markdown | 31 | 0 | 6 | 37 |
|
||||
| [docs/stage9.md](/docs/stage9.md) | Markdown | 31 | 0 | 6 | 37 |
|
||||
| [docs/syscall.md](/docs/syscall.md) | Markdown | 453 | 0 | 192 | 645 |
|
||||
| [ramdisk/shell/init.cmd](/ramdisk/shell/init.cmd) | Batch | 4 | 0 | 2 | 6 |
|
||||
| [scripts/gen-tty-psf.ps1](/scripts/gen-tty-psf.ps1) | PowerShell | 171 | 2 | 42 | 215 |
|
||||
| [wine/README.md](/wine/README.md) | Markdown | 49 | 0 | 19 | 68 |
|
||||
| [wine/cleonos\_wine.py](/wine/cleonos_wine.py) | Python | 3 | 1 | 3 | 7 |
|
||||
| [wine/cleonos\_wine\_lib/\_\_init\_\_.py](/wine/cleonos_wine_lib/__init__.py) | Python | 4 | 0 | 1 | 5 |
|
||||
| [wine/cleonos\_wine\_lib/cli.py](/wine/cleonos_wine_lib/cli.py) | Python | 44 | 0 | 10 | 54 |
|
||||
| [wine/cleonos\_wine\_lib/constants.py](/wine/cleonos_wine_lib/constants.py) | Python | 76 | 1 | 11 | 88 |
|
||||
| [wine/cleonos\_wine\_lib/input\_pump.py](/wine/cleonos_wine_lib/input_pump.py) | Python | 82 | 0 | 17 | 99 |
|
||||
| [wine/cleonos\_wine\_lib/platform.py](/wine/cleonos_wine_lib/platform.py) | Python | 55 | 0 | 5 | 60 |
|
||||
| [wine/cleonos\_wine\_lib/runner.py](/wine/cleonos_wine_lib/runner.py) | Python | 990 | 0 | 175 | 1,165 |
|
||||
| [wine/cleonos\_wine\_lib/state.py](/wine/cleonos_wine_lib/state.py) | Python | 164 | 0 | 40 | 204 |
|
||||
| [wine/requirements.txt](/wine/requirements.txt) | pip requirements | 1 | 0 | 1 | 2 |
|
||||
|
||||
[Summary](results.md) / Details / [Diff Summary](diff.md) / [Diff Details](diff-details.md)
|
||||
28
.VSCodeCounter/2026-04-17_22-23-18/diff-details.md
Normal file
28
.VSCodeCounter/2026-04-17_22-23-18/diff-details.md
Normal file
@@ -0,0 +1,28 @@
|
||||
# Diff Details
|
||||
|
||||
Date : 2026-04-17 22:23:18
|
||||
|
||||
Directory d:\\Projects\\C\\cleonos
|
||||
|
||||
Total : 13 files, 1083 codes, 0 comments, 263 blanks, all 1346 lines
|
||||
|
||||
[Summary](results.md) / [Details](details.md) / [Diff Summary](diff.md) / Diff Details
|
||||
|
||||
## Files
|
||||
| filename | language | code | comment | blank | total |
|
||||
| :--- | :--- | ---: | ---: | ---: | ---: |
|
||||
| [CMakeLists.txt](/CMakeLists.txt) | CMake | 1 | 0 | 0 | 1 |
|
||||
| [cleonos/c/apps/help\_main.c](/cleonos/c/apps/help_main.c) | C | 1 | 0 | 0 | 1 |
|
||||
| [cleonos/c/apps/procstat\_main.c](/cleonos/c/apps/procstat_main.c) | C | 202 | 0 | 43 | 245 |
|
||||
| [cleonos/c/apps/shell/shell\_cmd.c](/cleonos/c/apps/shell/shell_cmd.c) | C | 1 | 0 | 0 | 1 |
|
||||
| [cleonos/c/apps/shell/shell\_input.c](/cleonos/c/apps/shell/shell_input.c) | C | 49 | 0 | 15 | 64 |
|
||||
| [cleonos/c/apps/sysstat\_main.c](/cleonos/c/apps/sysstat_main.c) | C | 267 | 0 | 45 | 312 |
|
||||
| [cleonos/c/include/cleonos\_syscall.h](/cleonos/c/include/cleonos_syscall.h) | C++ | 24 | 0 | 1 | 25 |
|
||||
| [cleonos/c/src/syscall.c](/cleonos/c/src/syscall.c) | C | 27 | 0 | 9 | 36 |
|
||||
| [clks/include/clks/exec.h](/clks/include/clks/exec.h) | C++ | 5 | 0 | 0 | 5 |
|
||||
| [clks/include/clks/syscall.h](/clks/include/clks/syscall.h) | C++ | 9 | 0 | 0 | 9 |
|
||||
| [clks/kernel/exec.c](/clks/kernel/exec.c) | C | 319 | 0 | 100 | 419 |
|
||||
| [clks/kernel/syscall.c](/clks/kernel/syscall.c) | C | 105 | 0 | 26 | 131 |
|
||||
| [docs/syscall.md](/docs/syscall.md) | Markdown | 73 | 0 | 24 | 97 |
|
||||
|
||||
[Summary](results.md) / [Details](details.md) / [Diff Summary](diff.md) / Diff Details
|
||||
15
.VSCodeCounter/2026-04-17_22-23-18/diff.csv
Normal file
15
.VSCodeCounter/2026-04-17_22-23-18/diff.csv
Normal file
@@ -0,0 +1,15 @@
|
||||
"filename", "language", "CMake", "C", "Markdown", "C++", "comment", "blank", "total"
|
||||
"d:\Projects\C\cleonos\CMakeLists.txt", "CMake", 1, 0, 0, 0, 0, 0, 1
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\help_main.c", "C", 0, 1, 0, 0, 0, 0, 1
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\procstat_main.c", "C", 0, 202, 0, 0, 0, 43, 245
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\shell\shell_cmd.c", "C", 0, 1, 0, 0, 0, 0, 1
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\shell\shell_input.c", "C", 0, 49, 0, 0, 0, 15, 64
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\sysstat_main.c", "C", 0, 267, 0, 0, 0, 45, 312
|
||||
"d:\Projects\C\cleonos\cleonos\c\include\cleonos_syscall.h", "C++", 0, 0, 0, 24, 0, 1, 25
|
||||
"d:\Projects\C\cleonos\cleonos\c\src\syscall.c", "C", 0, 27, 0, 0, 0, 9, 36
|
||||
"d:\Projects\C\cleonos\clks\include\clks\exec.h", "C++", 0, 0, 0, 5, 0, 0, 5
|
||||
"d:\Projects\C\cleonos\clks\include\clks\syscall.h", "C++", 0, 0, 0, 9, 0, 0, 9
|
||||
"d:\Projects\C\cleonos\clks\kernel\exec.c", "C", 0, 319, 0, 0, 0, 100, 419
|
||||
"d:\Projects\C\cleonos\clks\kernel\syscall.c", "C", 0, 105, 0, 0, 0, 26, 131
|
||||
"d:\Projects\C\cleonos\docs\syscall.md", "Markdown", 0, 0, 73, 0, 0, 24, 97
|
||||
"Total", "-", 1, 971, 73, 38, 0, 263, 1346
|
||||
|
37
.VSCodeCounter/2026-04-17_22-23-18/diff.md
Normal file
37
.VSCodeCounter/2026-04-17_22-23-18/diff.md
Normal file
@@ -0,0 +1,37 @@
|
||||
# Diff Summary
|
||||
|
||||
Date : 2026-04-17 22:23:18
|
||||
|
||||
Directory d:\\Projects\\C\\cleonos
|
||||
|
||||
Total : 13 files, 1083 codes, 0 comments, 263 blanks, all 1346 lines
|
||||
|
||||
[Summary](results.md) / [Details](details.md) / Diff Summary / [Diff Details](diff-details.md)
|
||||
|
||||
## Languages
|
||||
| language | files | code | comment | blank | total |
|
||||
| :--- | ---: | ---: | ---: | ---: | ---: |
|
||||
| C | 8 | 971 | 0 | 238 | 1,209 |
|
||||
| Markdown | 1 | 73 | 0 | 24 | 97 |
|
||||
| C++ | 3 | 38 | 0 | 1 | 39 |
|
||||
| CMake | 1 | 1 | 0 | 0 | 1 |
|
||||
|
||||
## Directories
|
||||
| path | files | code | comment | blank | total |
|
||||
| :--- | ---: | ---: | ---: | ---: | ---: |
|
||||
| . | 13 | 1,083 | 0 | 263 | 1,346 |
|
||||
| . (Files) | 1 | 1 | 0 | 0 | 1 |
|
||||
| cleonos | 7 | 571 | 0 | 113 | 684 |
|
||||
| cleonos\\c | 7 | 571 | 0 | 113 | 684 |
|
||||
| cleonos\\c\\apps | 5 | 520 | 0 | 103 | 623 |
|
||||
| cleonos\\c\\apps (Files) | 3 | 470 | 0 | 88 | 558 |
|
||||
| cleonos\\c\\apps\\shell | 2 | 50 | 0 | 15 | 65 |
|
||||
| cleonos\\c\\include | 1 | 24 | 0 | 1 | 25 |
|
||||
| cleonos\\c\\src | 1 | 27 | 0 | 9 | 36 |
|
||||
| clks | 4 | 438 | 0 | 126 | 564 |
|
||||
| clks\\include | 2 | 14 | 0 | 0 | 14 |
|
||||
| clks\\include\\clks | 2 | 14 | 0 | 0 | 14 |
|
||||
| clks\\kernel | 2 | 424 | 0 | 126 | 550 |
|
||||
| docs | 1 | 73 | 0 | 24 | 97 |
|
||||
|
||||
[Summary](results.md) / [Details](details.md) / Diff Summary / [Diff Details](diff-details.md)
|
||||
53
.VSCodeCounter/2026-04-17_22-23-18/diff.txt
Normal file
53
.VSCodeCounter/2026-04-17_22-23-18/diff.txt
Normal file
@@ -0,0 +1,53 @@
|
||||
Date : 2026-04-17 22:23:18
|
||||
Directory : d:\Projects\C\cleonos
|
||||
Total : 13 files, 1083 codes, 0 comments, 263 blanks, all 1346 lines
|
||||
|
||||
Languages
|
||||
+----------+------------+------------+------------+------------+------------+
|
||||
| language | files | code | comment | blank | total |
|
||||
+----------+------------+------------+------------+------------+------------+
|
||||
| C | 8 | 971 | 0 | 238 | 1,209 |
|
||||
| Markdown | 1 | 73 | 0 | 24 | 97 |
|
||||
| C++ | 3 | 38 | 0 | 1 | 39 |
|
||||
| CMake | 1 | 1 | 0 | 0 | 1 |
|
||||
+----------+------------+------------+------------+------------+------------+
|
||||
|
||||
Directories
|
||||
+-----------------------------------------------------------+------------+------------+------------+------------+------------+
|
||||
| path | files | code | comment | blank | total |
|
||||
+-----------------------------------------------------------+------------+------------+------------+------------+------------+
|
||||
| . | 13 | 1,083 | 0 | 263 | 1,346 |
|
||||
| . (Files) | 1 | 1 | 0 | 0 | 1 |
|
||||
| cleonos | 7 | 571 | 0 | 113 | 684 |
|
||||
| cleonos\c | 7 | 571 | 0 | 113 | 684 |
|
||||
| cleonos\c\apps | 5 | 520 | 0 | 103 | 623 |
|
||||
| cleonos\c\apps (Files) | 3 | 470 | 0 | 88 | 558 |
|
||||
| cleonos\c\apps\shell | 2 | 50 | 0 | 15 | 65 |
|
||||
| cleonos\c\include | 1 | 24 | 0 | 1 | 25 |
|
||||
| cleonos\c\src | 1 | 27 | 0 | 9 | 36 |
|
||||
| clks | 4 | 438 | 0 | 126 | 564 |
|
||||
| clks\include | 2 | 14 | 0 | 0 | 14 |
|
||||
| clks\include\clks | 2 | 14 | 0 | 0 | 14 |
|
||||
| clks\kernel | 2 | 424 | 0 | 126 | 550 |
|
||||
| docs | 1 | 73 | 0 | 24 | 97 |
|
||||
+-----------------------------------------------------------+------------+------------+------------+------------+------------+
|
||||
|
||||
Files
|
||||
+-----------------------------------------------------------+----------+------------+------------+------------+------------+
|
||||
| filename | language | code | comment | blank | total |
|
||||
+-----------------------------------------------------------+----------+------------+------------+------------+------------+
|
||||
| d:\Projects\C\cleonos\CMakeLists.txt | CMake | 1 | 0 | 0 | 1 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\help_main.c | C | 1 | 0 | 0 | 1 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\procstat_main.c | C | 202 | 0 | 43 | 245 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\shell\shell_cmd.c | C | 1 | 0 | 0 | 1 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\shell\shell_input.c | C | 49 | 0 | 15 | 64 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\sysstat_main.c | C | 267 | 0 | 45 | 312 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\include\cleonos_syscall.h | C++ | 24 | 0 | 1 | 25 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\src\syscall.c | C | 27 | 0 | 9 | 36 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\exec.h | C++ | 5 | 0 | 0 | 5 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\syscall.h | C++ | 9 | 0 | 0 | 9 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\exec.c | C | 319 | 0 | 100 | 419 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\syscall.c | C | 105 | 0 | 26 | 131 |
|
||||
| d:\Projects\C\cleonos\docs\syscall.md | Markdown | 73 | 0 | 24 | 97 |
|
||||
| Total | | 1,083 | 0 | 263 | 1,346 |
|
||||
+-----------------------------------------------------------+----------+------------+------------+------------+------------+
|
||||
196
.VSCodeCounter/2026-04-17_22-23-18/results.csv
Normal file
196
.VSCodeCounter/2026-04-17_22-23-18/results.csv
Normal file
@@ -0,0 +1,196 @@
|
||||
"filename", "language", "Python", "pip requirements", "Markdown", "PowerShell", "Makefile", "CMake", "Properties", "Rust", "C", "YAML", "Batch", "C++", "Go Assembly", "comment", "blank", "total"
|
||||
"d:\Projects\C\cleonos\.github\workflows\build-os.yml", "YAML", 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 0, 0, 0, 0, 10, 58
|
||||
"d:\Projects\C\cleonos\CMakeLists.txt", "CMake", 0, 0, 0, 0, 0, 615, 0, 0, 0, 0, 0, 0, 0, 0, 88, 703
|
||||
"d:\Projects\C\cleonos\Makefile", "Makefile", 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 22, 122
|
||||
"d:\Projects\C\cleonos\README.md", "Markdown", 0, 0, 92, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 126
|
||||
"d:\Projects\C\cleonos\README.zh-CN.md", "Markdown", 0, 0, 92, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 126
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\ansi_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 43, 0, 0, 0, 0, 0, 11, 54
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\ansitest_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 142, 0, 0, 0, 0, 0, 35, 177
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\append_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 74, 0, 0, 0, 0, 0, 18, 92
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\args_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 49, 0, 0, 0, 0, 0, 13, 62
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\bg_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 101, 0, 0, 0, 0, 0, 26, 127
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\cat_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 83, 0, 0, 0, 0, 0, 24, 107
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\cd_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 0, 0, 15, 69
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\clear_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 39, 0, 0, 0, 0, 0, 11, 50
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\cmd_runtime.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 446, 0, 0, 0, 0, 0, 143, 589
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\cmd_runtime.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 80, 0, 0, 19, 99
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\cp_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 95, 0, 0, 0, 0, 0, 26, 121
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\cut_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 214, 0, 0, 0, 0, 1, 55, 270
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\dmesg_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 18, 82
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\elfrunner_kmain.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 3, 9
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\elfrunner_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 3, 9
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\exec_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 87, 0, 0, 0, 0, 0, 22, 109
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\exit_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 0, 0, 14, 68
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\fastfetch_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 180, 0, 0, 0, 0, 0, 34, 214
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\fg_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 150, 0, 0, 0, 0, 0, 36, 186
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\fsstat_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 45, 0, 0, 0, 0, 0, 11, 56
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\grep_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 195, 0, 0, 0, 0, 0, 54, 249
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\head_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 164, 0, 0, 0, 0, 0, 47, 211
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\hello_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 2, 8
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\help_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 80, 0, 0, 0, 0, 0, 10, 90
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\jobs_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 120, 0, 0, 0, 0, 0, 26, 146
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\kbdstat_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 44, 0, 0, 0, 0, 0, 11, 55
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\kdbg_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 214, 0, 0, 0, 0, 0, 56, 270
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\kill_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 144, 0, 0, 0, 0, 0, 39, 183
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\ls_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 262, 0, 0, 0, 0, 0, 76, 338
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\memc_kmain.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 3, 9
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\memc_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 3, 11
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\memstat_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 43, 0, 0, 0, 0, 0, 11, 54
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\mkdir_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 57, 0, 0, 0, 0, 0, 16, 73
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\mv_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 102, 0, 0, 0, 0, 0, 28, 130
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\pid_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 39, 0, 0, 0, 0, 0, 11, 50
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\procstat_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 202, 0, 0, 0, 0, 0, 43, 245
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\ps_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 160, 0, 0, 0, 0, 0, 35, 195
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\pwd_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 39, 0, 0, 0, 0, 0, 11, 50
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\restart_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 40, 0, 0, 0, 0, 0, 11, 51
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\rm_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 57, 0, 0, 0, 0, 0, 16, 73
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\shell\shell_cmd.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 2315, 0, 0, 0, 0, 0, 574, 2889
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\shell\shell_external.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 166, 0, 0, 0, 0, 0, 55, 221
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\shell\shell_input.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 563, 0, 0, 0, 0, 0, 147, 710
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\shell\shell_internal.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92, 0, 0, 20, 112
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\shell\shell_path.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 153, 0, 0, 0, 0, 0, 50, 203
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\shell\shell_script.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 35, 0, 0, 0, 0, 0, 12, 47
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\shell\shell_util.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 283, 0, 0, 0, 0, 0, 86, 369
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\shell_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 0, 0, 6, 25
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\shstat_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 45, 0, 0, 0, 0, 0, 11, 56
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\shutdown_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 40, 0, 0, 0, 0, 0, 11, 51
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\sleep_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 52, 0, 0, 0, 0, 0, 14, 66
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\sort_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 205, 0, 0, 0, 0, 0, 63, 268
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\spawn_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 76, 0, 0, 0, 0, 0, 20, 96
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\spin_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 13, 0, 0, 0, 0, 0, 4, 17
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\stats_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 102, 0, 0, 0, 0, 0, 17, 119
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\sysstat_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 267, 0, 0, 0, 0, 0, 45, 312
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\tail_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 190, 0, 0, 0, 0, 0, 54, 244
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\taskstat_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 43, 0, 0, 0, 0, 0, 11, 54
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\top_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 195, 0, 0, 0, 0, 0, 47, 242
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\touch_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 58, 0, 0, 0, 0, 0, 16, 74
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\tty_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 17, 81
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\ttydrv_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 3, 9
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\uniq_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 168, 0, 0, 0, 0, 0, 48, 216
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\userstat_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 48, 0, 0, 0, 0, 0, 11, 59
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\wait_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 68, 0, 0, 0, 0, 0, 17, 85
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\wavplay_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 396, 0, 0, 0, 0, 0, 99, 495
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\wc_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 164, 0, 0, 0, 0, 0, 45, 209
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\write_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 74, 0, 0, 0, 0, 0, 18, 92
|
||||
"d:\Projects\C\cleonos\cleonos\c\apps\yield_main.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 39, 0, 0, 0, 0, 0, 11, 50
|
||||
"d:\Projects\C\cleonos\cleonos\c\include\cleonos_rust_bridge.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 4, 10
|
||||
"d:\Projects\C\cleonos\cleonos\c\include\cleonos_syscall.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 192, 0, 0, 10, 202
|
||||
"d:\Projects\C\cleonos\cleonos\c\src\runtime.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 37, 0, 0, 0, 0, 0, 12, 49
|
||||
"d:\Projects\C\cleonos\cleonos\c\src\syscall.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 250, 0, 0, 0, 0, 0, 83, 333
|
||||
"d:\Projects\C\cleonos\cleonos\c\stub.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 4, 2, 9
|
||||
"d:\Projects\C\cleonos\cleonos\rust\src\lib.rs", "Rust", 0, 0, 0, 0, 0, 0, 0, 23, 0, 0, 0, 0, 0, 0, 9, 32
|
||||
"d:\Projects\C\cleonos\clks\arch\aarch64\boot.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 1, 7
|
||||
"d:\Projects\C\cleonos\clks\arch\x86_64\boot.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 1, 7
|
||||
"d:\Projects\C\cleonos\clks\arch\x86_64\exec_stack_call.S", "Go Assembly", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 40, 0, 8, 48
|
||||
"d:\Projects\C\cleonos\clks\arch\x86_64\interrupt_stubs.S", "Go Assembly", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 108, 0, 12, 120
|
||||
"d:\Projects\C\cleonos\clks\drivers\audio\pcspeaker.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 101, 0, 0, 0, 0, 0, 25, 126
|
||||
"d:\Projects\C\cleonos\clks\drivers\serial\serial.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 52, 0, 0, 0, 0, 0, 16, 68
|
||||
"d:\Projects\C\cleonos\clks\drivers\video\font8x8.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 67, 0, 0, 0, 0, 0, 8, 75
|
||||
"d:\Projects\C\cleonos\clks\drivers\video\font8x8.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 3, 8
|
||||
"d:\Projects\C\cleonos\clks\drivers\video\framebuffer.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 251, 0, 0, 0, 0, 0, 70, 321
|
||||
"d:\Projects\C\cleonos\clks\drivers\video\psf_font.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 230, 0, 0, 0, 0, 0, 56, 286
|
||||
"d:\Projects\C\cleonos\clks\drivers\video\psf_font.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 5, 20
|
||||
"d:\Projects\C\cleonos\clks\include\clks\audio.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 3, 12
|
||||
"d:\Projects\C\cleonos\clks\include\clks\boot.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 0, 0, 4, 15
|
||||
"d:\Projects\C\cleonos\clks\include\clks\compiler.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 0, 0, 4, 17
|
||||
"d:\Projects\C\cleonos\clks\include\clks\cpu.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 0, 4, 24
|
||||
"d:\Projects\C\cleonos\clks\include\clks\desktop.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 4, 11
|
||||
"d:\Projects\C\cleonos\clks\include\clks\driver.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, 0, 0, 8, 37
|
||||
"d:\Projects\C\cleonos\clks\include\clks\elf64.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 9, 41
|
||||
"d:\Projects\C\cleonos\clks\include\clks\elfrunner.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 3, 9
|
||||
"d:\Projects\C\cleonos\clks\include\clks\exec.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 71, 0, 0, 8, 79
|
||||
"d:\Projects\C\cleonos\clks\include\clks\framebuffer.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 26, 0, 0, 6, 32
|
||||
"d:\Projects\C\cleonos\clks\include\clks\fs.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 23, 0, 0, 7, 30
|
||||
"d:\Projects\C\cleonos\clks\include\clks\heap.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 4, 19
|
||||
"d:\Projects\C\cleonos\clks\include\clks\interrupts.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 3, 9
|
||||
"d:\Projects\C\cleonos\clks\include\clks\kelf.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 5, 14
|
||||
"d:\Projects\C\cleonos\clks\include\clks\kernel.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 2, 6
|
||||
"d:\Projects\C\cleonos\clks\include\clks\keyboard.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 27, 0, 0, 6, 33
|
||||
"d:\Projects\C\cleonos\clks\include\clks\limine.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 132, 0, 0, 24, 156
|
||||
"d:\Projects\C\cleonos\clks\include\clks\log.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 0, 0, 5, 19
|
||||
"d:\Projects\C\cleonos\clks\include\clks\mouse.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 0, 6, 26
|
||||
"d:\Projects\C\cleonos\clks\include\clks\panic.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 4, 16
|
||||
"d:\Projects\C\cleonos\clks\include\clks\pmm.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 5, 21
|
||||
"d:\Projects\C\cleonos\clks\include\clks\ramdisk.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 8, 25
|
||||
"d:\Projects\C\cleonos\clks\include\clks\scheduler.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 5, 23
|
||||
"d:\Projects\C\cleonos\clks\include\clks\serial.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 2, 8
|
||||
"d:\Projects\C\cleonos\clks\include\clks\service.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, 0, 0, 8, 39
|
||||
"d:\Projects\C\cleonos\clks\include\clks\shell.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 3, 10
|
||||
"d:\Projects\C\cleonos\clks\include\clks\string.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 3, 12
|
||||
"d:\Projects\C\cleonos\clks\include\clks\syscall.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 84, 0, 0, 5, 89
|
||||
"d:\Projects\C\cleonos\clks\include\clks\task.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 7, 31
|
||||
"d:\Projects\C\cleonos\clks\include\clks\tty.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 0, 0, 4, 18
|
||||
"d:\Projects\C\cleonos\clks\include\clks\types.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 6, 23
|
||||
"d:\Projects\C\cleonos\clks\include\clks\userland.h", "C++", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 4, 16
|
||||
"d:\Projects\C\cleonos\clks\kernel\desktop.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 321, 0, 0, 0, 0, 0, 86, 407
|
||||
"d:\Projects\C\cleonos\clks\kernel\driver.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 169, 0, 0, 0, 0, 0, 49, 218
|
||||
"d:\Projects\C\cleonos\clks\kernel\elf64.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 239, 0, 0, 0, 0, 0, 73, 312
|
||||
"d:\Projects\C\cleonos\clks\kernel\elfrunner.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 30, 0, 0, 0, 0, 0, 8, 38
|
||||
"d:\Projects\C\cleonos\clks\kernel\exec.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 1522, 0, 0, 0, 0, 1, 435, 1958
|
||||
"d:\Projects\C\cleonos\clks\kernel\fs.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 698, 0, 0, 0, 0, 0, 220, 918
|
||||
"d:\Projects\C\cleonos\clks\kernel\heap.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 134, 0, 0, 0, 0, 0, 42, 176
|
||||
"d:\Projects\C\cleonos\clks\kernel\interrupts.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 317, 0, 0, 0, 0, 0, 44, 361
|
||||
"d:\Projects\C\cleonos\clks\kernel\kelf.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 203, 0, 0, 0, 0, 1, 53, 257
|
||||
"d:\Projects\C\cleonos\clks\kernel\keyboard.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 351, 0, 0, 0, 0, 0, 88, 439
|
||||
"d:\Projects\C\cleonos\clks\kernel\kmain.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 200, 0, 0, 0, 0, 1, 52, 253
|
||||
"d:\Projects\C\cleonos\clks\kernel\limine_requests.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 76, 0, 0, 0, 0, 0, 26, 102
|
||||
"d:\Projects\C\cleonos\clks\kernel\log.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 185, 0, 0, 0, 0, 0, 48, 233
|
||||
"d:\Projects\C\cleonos\clks\kernel\mouse.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 246, 0, 0, 0, 0, 0, 63, 309
|
||||
"d:\Projects\C\cleonos\clks\kernel\panic.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 546, 0, 0, 0, 0, 0, 155, 701
|
||||
"d:\Projects\C\cleonos\clks\kernel\pmm.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 82, 0, 0, 0, 0, 0, 23, 105
|
||||
"d:\Projects\C\cleonos\clks\kernel\ramdisk.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 172, 0, 0, 0, 0, 0, 50, 222
|
||||
"d:\Projects\C\cleonos\clks\kernel\scheduler.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 136, 0, 0, 0, 0, 0, 44, 180
|
||||
"d:\Projects\C\cleonos\clks\kernel\service.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 113, 0, 0, 0, 0, 0, 34, 147
|
||||
"d:\Projects\C\cleonos\clks\kernel\shell.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 1249, 0, 0, 0, 0, 0, 317, 1566
|
||||
"d:\Projects\C\cleonos\clks\kernel\syscall.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 1480, 0, 0, 0, 0, 0, 370, 1850
|
||||
"d:\Projects\C\cleonos\clks\kernel\tty.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 1115, 0, 0, 0, 0, 0, 275, 1390
|
||||
"d:\Projects\C\cleonos\clks\kernel\userland.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 124, 0, 0, 0, 0, 0, 35, 159
|
||||
"d:\Projects\C\cleonos\clks\lib\libc_compat.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 25, 0, 0, 0, 0, 0, 7, 32
|
||||
"d:\Projects\C\cleonos\clks\lib\string.c", "C", 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 0, 0, 16, 70
|
||||
"d:\Projects\C\cleonos\clks\rust\src\lib.rs", "Rust", 0, 0, 0, 0, 0, 0, 0, 21, 0, 0, 0, 0, 0, 0, 6, 27
|
||||
"d:\Projects\C\cleonos\cmake\check_tools.cmake", "CMake", 0, 0, 0, 0, 0, 34, 0, 0, 0, 0, 0, 0, 0, 0, 7, 41
|
||||
"d:\Projects\C\cleonos\cmake\gen_kernel_symbols.cmake", "CMake", 0, 0, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 0, 26, 106
|
||||
"d:\Projects\C\cleonos\cmake\log.cmake", "CMake", 0, 0, 0, 0, 0, 30, 0, 0, 0, 0, 0, 0, 0, 0, 6, 36
|
||||
"d:\Projects\C\cleonos\cmake\log_emit.cmake", "CMake", 0, 0, 0, 0, 0, 23, 0, 0, 0, 0, 0, 0, 0, 0, 6, 29
|
||||
"d:\Projects\C\cleonos\cmake\setup_limine.cmake", "CMake", 0, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 0, 19, 119
|
||||
"d:\Projects\C\cleonos\configs\limine.conf", "Properties", 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 1, 7
|
||||
"d:\Projects\C\cleonos\docs\README.md", "Markdown", 0, 0, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 35
|
||||
"d:\Projects\C\cleonos\docs\stage1.md", "Markdown", 0, 0, 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 46
|
||||
"d:\Projects\C\cleonos\docs\stage10.md", "Markdown", 0, 0, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 40
|
||||
"d:\Projects\C\cleonos\docs\stage11.md", "Markdown", 0, 0, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 41
|
||||
"d:\Projects\C\cleonos\docs\stage12.md", "Markdown", 0, 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 46
|
||||
"d:\Projects\C\cleonos\docs\stage13.md", "Markdown", 0, 0, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 40
|
||||
"d:\Projects\C\cleonos\docs\stage14.md", "Markdown", 0, 0, 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 52
|
||||
"d:\Projects\C\cleonos\docs\stage15.md", "Markdown", 0, 0, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 54
|
||||
"d:\Projects\C\cleonos\docs\stage2.md", "Markdown", 0, 0, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 35
|
||||
"d:\Projects\C\cleonos\docs\stage20.md", "Markdown", 0, 0, 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 52
|
||||
"d:\Projects\C\cleonos\docs\stage21.md", "Markdown", 0, 0, 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 79
|
||||
"d:\Projects\C\cleonos\docs\stage22.md", "Markdown", 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 75
|
||||
"d:\Projects\C\cleonos\docs\stage23.md", "Markdown", 0, 0, 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 47
|
||||
"d:\Projects\C\cleonos\docs\stage24.md", "Markdown", 0, 0, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 49
|
||||
"d:\Projects\C\cleonos\docs\stage25.md", "Markdown", 0, 0, 58, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 65
|
||||
"d:\Projects\C\cleonos\docs\stage26.md", "Markdown", 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 39
|
||||
"d:\Projects\C\cleonos\docs\stage27.md", "Markdown", 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 39
|
||||
"d:\Projects\C\cleonos\docs\stage28.md", "Markdown", 0, 0, 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 44
|
||||
"d:\Projects\C\cleonos\docs\stage29.md", "Markdown", 0, 0, 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 40
|
||||
"d:\Projects\C\cleonos\docs\stage3.md", "Markdown", 0, 0, 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 34
|
||||
"d:\Projects\C\cleonos\docs\stage4.md", "Markdown", 0, 0, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 35
|
||||
"d:\Projects\C\cleonos\docs\stage5.md", "Markdown", 0, 0, 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 34
|
||||
"d:\Projects\C\cleonos\docs\stage6.md", "Markdown", 0, 0, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 36
|
||||
"d:\Projects\C\cleonos\docs\stage7.md", "Markdown", 0, 0, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 40
|
||||
"d:\Projects\C\cleonos\docs\stage8.md", "Markdown", 0, 0, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 37
|
||||
"d:\Projects\C\cleonos\docs\stage9.md", "Markdown", 0, 0, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 37
|
||||
"d:\Projects\C\cleonos\docs\syscall.md", "Markdown", 0, 0, 453, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 192, 645
|
||||
"d:\Projects\C\cleonos\ramdisk\shell\init.cmd", "Batch", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 2, 6
|
||||
"d:\Projects\C\cleonos\scripts\gen-tty-psf.ps1", "PowerShell", 0, 0, 0, 171, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 42, 215
|
||||
"d:\Projects\C\cleonos\wine\README.md", "Markdown", 0, 0, 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 68
|
||||
"d:\Projects\C\cleonos\wine\cleonos_wine.py", "Python", 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 7
|
||||
"d:\Projects\C\cleonos\wine\cleonos_wine_lib\__init__.py", "Python", 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 5
|
||||
"d:\Projects\C\cleonos\wine\cleonos_wine_lib\cli.py", "Python", 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 54
|
||||
"d:\Projects\C\cleonos\wine\cleonos_wine_lib\constants.py", "Python", 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 11, 88
|
||||
"d:\Projects\C\cleonos\wine\cleonos_wine_lib\input_pump.py", "Python", 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 99
|
||||
"d:\Projects\C\cleonos\wine\cleonos_wine_lib\platform.py", "Python", 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 60
|
||||
"d:\Projects\C\cleonos\wine\cleonos_wine_lib\runner.py", "Python", 990, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 175, 1165
|
||||
"d:\Projects\C\cleonos\wine\cleonos_wine_lib\state.py", "Python", 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 40, 204
|
||||
"d:\Projects\C\cleonos\wine\requirements.txt", "pip requirements", 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2
|
||||
"Total", "-", 1418, 1, 1698, 171, 100, 882, 6, 44, 20551, 48, 4, 1131, 148, 12, 6631, 32845
|
||||
|
1
.VSCodeCounter/2026-04-17_22-23-18/results.json
Normal file
1
.VSCodeCounter/2026-04-17_22-23-18/results.json
Normal file
File diff suppressed because one or more lines are too long
69
.VSCodeCounter/2026-04-17_22-23-18/results.md
Normal file
69
.VSCodeCounter/2026-04-17_22-23-18/results.md
Normal file
@@ -0,0 +1,69 @@
|
||||
# Summary
|
||||
|
||||
Date : 2026-04-17 22:23:18
|
||||
|
||||
Directory d:\\Projects\\C\\cleonos
|
||||
|
||||
Total : 194 files, 26202 codes, 12 comments, 6631 blanks, all 32845 lines
|
||||
|
||||
Summary / [Details](details.md) / [Diff Summary](diff.md) / [Diff Details](diff-details.md)
|
||||
|
||||
## Languages
|
||||
| language | files | code | comment | blank | total |
|
||||
| :--- | ---: | ---: | ---: | ---: | ---: |
|
||||
| C | 102 | 20,551 | 8 | 5,426 | 25,985 |
|
||||
| Markdown | 30 | 1,698 | 0 | 438 | 2,136 |
|
||||
| Python | 8 | 1,418 | 2 | 262 | 1,682 |
|
||||
| C++ | 38 | 1,131 | 0 | 240 | 1,371 |
|
||||
| CMake | 6 | 882 | 0 | 152 | 1,034 |
|
||||
| PowerShell | 1 | 171 | 2 | 42 | 215 |
|
||||
| Go Assembly | 2 | 148 | 0 | 20 | 168 |
|
||||
| Makefile | 1 | 100 | 0 | 22 | 122 |
|
||||
| YAML | 1 | 48 | 0 | 10 | 58 |
|
||||
| Rust | 2 | 44 | 0 | 15 | 59 |
|
||||
| Properties | 1 | 6 | 0 | 1 | 7 |
|
||||
| Batch | 1 | 4 | 0 | 2 | 6 |
|
||||
| pip requirements | 1 | 1 | 0 | 1 | 2 |
|
||||
|
||||
## Directories
|
||||
| path | files | code | comment | blank | total |
|
||||
| :--- | ---: | ---: | ---: | ---: | ---: |
|
||||
| . | 194 | 26,202 | 12 | 6,631 | 32,845 |
|
||||
| . (Files) | 4 | 899 | 0 | 178 | 1,077 |
|
||||
| .github | 1 | 48 | 0 | 10 | 58 |
|
||||
| .github\\workflows | 1 | 48 | 0 | 10 | 58 |
|
||||
| cleonos | 75 | 10,444 | 5 | 2,698 | 13,147 |
|
||||
| cleonos\\c | 74 | 10,421 | 5 | 2,689 | 13,115 |
|
||||
| cleonos\\c (Files) | 1 | 3 | 4 | 2 | 9 |
|
||||
| cleonos\\c\\apps | 69 | 9,933 | 1 | 2,578 | 12,512 |
|
||||
| cleonos\\c\\apps (Files) | 62 | 6,326 | 1 | 1,634 | 7,961 |
|
||||
| cleonos\\c\\apps\\shell | 7 | 3,607 | 0 | 944 | 4,551 |
|
||||
| cleonos\\c\\include | 2 | 198 | 0 | 14 | 212 |
|
||||
| cleonos\\c\\src | 2 | 287 | 0 | 95 | 382 |
|
||||
| cleonos\\rust | 1 | 23 | 0 | 9 | 32 |
|
||||
| cleonos\\rust\\src | 1 | 23 | 0 | 9 | 32 |
|
||||
| clks | 69 | 11,430 | 3 | 3,003 | 14,436 |
|
||||
| clks\\arch | 4 | 160 | 0 | 22 | 182 |
|
||||
| clks\\arch\\aarch64 | 1 | 6 | 0 | 1 | 7 |
|
||||
| clks\\arch\\x86_64 | 3 | 154 | 0 | 21 | 175 |
|
||||
| clks\\drivers | 7 | 721 | 0 | 183 | 904 |
|
||||
| clks\\drivers\\audio | 1 | 101 | 0 | 25 | 126 |
|
||||
| clks\\drivers\\serial | 1 | 52 | 0 | 16 | 68 |
|
||||
| clks\\drivers\\video | 5 | 568 | 0 | 142 | 710 |
|
||||
| clks\\include | 32 | 741 | 0 | 179 | 920 |
|
||||
| clks\\include\\clks | 32 | 741 | 0 | 179 | 920 |
|
||||
| clks\\kernel | 23 | 9,708 | 3 | 2,590 | 12,301 |
|
||||
| clks\\lib | 2 | 79 | 0 | 23 | 102 |
|
||||
| clks\\rust | 1 | 21 | 0 | 6 | 27 |
|
||||
| clks\\rust\\src | 1 | 21 | 0 | 6 | 27 |
|
||||
| cmake | 5 | 267 | 0 | 64 | 331 |
|
||||
| configs | 1 | 6 | 0 | 1 | 7 |
|
||||
| docs | 27 | 1,465 | 0 | 351 | 1,816 |
|
||||
| ramdisk | 1 | 4 | 0 | 2 | 6 |
|
||||
| ramdisk\\shell | 1 | 4 | 0 | 2 | 6 |
|
||||
| scripts | 1 | 171 | 2 | 42 | 215 |
|
||||
| wine | 10 | 1,468 | 2 | 282 | 1,752 |
|
||||
| wine (Files) | 3 | 53 | 1 | 23 | 77 |
|
||||
| wine\\cleonos_wine_lib | 7 | 1,415 | 1 | 259 | 1,675 |
|
||||
|
||||
Summary / [Details](details.md) / [Diff Summary](diff.md) / [Diff Details](diff-details.md)
|
||||
266
.VSCodeCounter/2026-04-17_22-23-18/results.txt
Normal file
266
.VSCodeCounter/2026-04-17_22-23-18/results.txt
Normal file
@@ -0,0 +1,266 @@
|
||||
Date : 2026-04-17 22:23:18
|
||||
Directory : d:\Projects\C\cleonos
|
||||
Total : 194 files, 26202 codes, 12 comments, 6631 blanks, all 32845 lines
|
||||
|
||||
Languages
|
||||
+------------------+------------+------------+------------+------------+------------+
|
||||
| language | files | code | comment | blank | total |
|
||||
+------------------+------------+------------+------------+------------+------------+
|
||||
| C | 102 | 20,551 | 8 | 5,426 | 25,985 |
|
||||
| Markdown | 30 | 1,698 | 0 | 438 | 2,136 |
|
||||
| Python | 8 | 1,418 | 2 | 262 | 1,682 |
|
||||
| C++ | 38 | 1,131 | 0 | 240 | 1,371 |
|
||||
| CMake | 6 | 882 | 0 | 152 | 1,034 |
|
||||
| PowerShell | 1 | 171 | 2 | 42 | 215 |
|
||||
| Go Assembly | 2 | 148 | 0 | 20 | 168 |
|
||||
| Makefile | 1 | 100 | 0 | 22 | 122 |
|
||||
| YAML | 1 | 48 | 0 | 10 | 58 |
|
||||
| Rust | 2 | 44 | 0 | 15 | 59 |
|
||||
| Properties | 1 | 6 | 0 | 1 | 7 |
|
||||
| Batch | 1 | 4 | 0 | 2 | 6 |
|
||||
| pip requirements | 1 | 1 | 0 | 1 | 2 |
|
||||
+------------------+------------+------------+------------+------------+------------+
|
||||
|
||||
Directories
|
||||
+---------------------------------------------------------------+------------+------------+------------+------------+------------+
|
||||
| path | files | code | comment | blank | total |
|
||||
+---------------------------------------------------------------+------------+------------+------------+------------+------------+
|
||||
| . | 194 | 26,202 | 12 | 6,631 | 32,845 |
|
||||
| . (Files) | 4 | 899 | 0 | 178 | 1,077 |
|
||||
| .github | 1 | 48 | 0 | 10 | 58 |
|
||||
| .github\workflows | 1 | 48 | 0 | 10 | 58 |
|
||||
| cleonos | 75 | 10,444 | 5 | 2,698 | 13,147 |
|
||||
| cleonos\c | 74 | 10,421 | 5 | 2,689 | 13,115 |
|
||||
| cleonos\c (Files) | 1 | 3 | 4 | 2 | 9 |
|
||||
| cleonos\c\apps | 69 | 9,933 | 1 | 2,578 | 12,512 |
|
||||
| cleonos\c\apps (Files) | 62 | 6,326 | 1 | 1,634 | 7,961 |
|
||||
| cleonos\c\apps\shell | 7 | 3,607 | 0 | 944 | 4,551 |
|
||||
| cleonos\c\include | 2 | 198 | 0 | 14 | 212 |
|
||||
| cleonos\c\src | 2 | 287 | 0 | 95 | 382 |
|
||||
| cleonos\rust | 1 | 23 | 0 | 9 | 32 |
|
||||
| cleonos\rust\src | 1 | 23 | 0 | 9 | 32 |
|
||||
| clks | 69 | 11,430 | 3 | 3,003 | 14,436 |
|
||||
| clks\arch | 4 | 160 | 0 | 22 | 182 |
|
||||
| clks\arch\aarch64 | 1 | 6 | 0 | 1 | 7 |
|
||||
| clks\arch\x86_64 | 3 | 154 | 0 | 21 | 175 |
|
||||
| clks\drivers | 7 | 721 | 0 | 183 | 904 |
|
||||
| clks\drivers\audio | 1 | 101 | 0 | 25 | 126 |
|
||||
| clks\drivers\serial | 1 | 52 | 0 | 16 | 68 |
|
||||
| clks\drivers\video | 5 | 568 | 0 | 142 | 710 |
|
||||
| clks\include | 32 | 741 | 0 | 179 | 920 |
|
||||
| clks\include\clks | 32 | 741 | 0 | 179 | 920 |
|
||||
| clks\kernel | 23 | 9,708 | 3 | 2,590 | 12,301 |
|
||||
| clks\lib | 2 | 79 | 0 | 23 | 102 |
|
||||
| clks\rust | 1 | 21 | 0 | 6 | 27 |
|
||||
| clks\rust\src | 1 | 21 | 0 | 6 | 27 |
|
||||
| cmake | 5 | 267 | 0 | 64 | 331 |
|
||||
| configs | 1 | 6 | 0 | 1 | 7 |
|
||||
| docs | 27 | 1,465 | 0 | 351 | 1,816 |
|
||||
| ramdisk | 1 | 4 | 0 | 2 | 6 |
|
||||
| ramdisk\shell | 1 | 4 | 0 | 2 | 6 |
|
||||
| scripts | 1 | 171 | 2 | 42 | 215 |
|
||||
| wine | 10 | 1,468 | 2 | 282 | 1,752 |
|
||||
| wine (Files) | 3 | 53 | 1 | 23 | 77 |
|
||||
| wine\cleonos_wine_lib | 7 | 1,415 | 1 | 259 | 1,675 |
|
||||
+---------------------------------------------------------------+------------+------------+------------+------------+------------+
|
||||
|
||||
Files
|
||||
+---------------------------------------------------------------+------------------+------------+------------+------------+------------+
|
||||
| filename | language | code | comment | blank | total |
|
||||
+---------------------------------------------------------------+------------------+------------+------------+------------+------------+
|
||||
| d:\Projects\C\cleonos\.github\workflows\build-os.yml | YAML | 48 | 0 | 10 | 58 |
|
||||
| d:\Projects\C\cleonos\CMakeLists.txt | CMake | 615 | 0 | 88 | 703 |
|
||||
| d:\Projects\C\cleonos\Makefile | Makefile | 100 | 0 | 22 | 122 |
|
||||
| d:\Projects\C\cleonos\README.md | Markdown | 92 | 0 | 34 | 126 |
|
||||
| d:\Projects\C\cleonos\README.zh-CN.md | Markdown | 92 | 0 | 34 | 126 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\ansi_main.c | C | 43 | 0 | 11 | 54 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\ansitest_main.c | C | 142 | 0 | 35 | 177 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\append_main.c | C | 74 | 0 | 18 | 92 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\args_main.c | C | 49 | 0 | 13 | 62 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\bg_main.c | C | 101 | 0 | 26 | 127 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\cat_main.c | C | 83 | 0 | 24 | 107 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\cd_main.c | C | 54 | 0 | 15 | 69 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\clear_main.c | C | 39 | 0 | 11 | 50 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\cmd_runtime.c | C | 446 | 0 | 143 | 589 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\cmd_runtime.h | C++ | 80 | 0 | 19 | 99 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\cp_main.c | C | 95 | 0 | 26 | 121 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\cut_main.c | C | 214 | 1 | 55 | 270 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\dmesg_main.c | C | 64 | 0 | 18 | 82 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\elfrunner_kmain.c | C | 6 | 0 | 3 | 9 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\elfrunner_main.c | C | 6 | 0 | 3 | 9 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\exec_main.c | C | 87 | 0 | 22 | 109 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\exit_main.c | C | 54 | 0 | 14 | 68 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\fastfetch_main.c | C | 180 | 0 | 34 | 214 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\fg_main.c | C | 150 | 0 | 36 | 186 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\fsstat_main.c | C | 45 | 0 | 11 | 56 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\grep_main.c | C | 195 | 0 | 54 | 249 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\head_main.c | C | 164 | 0 | 47 | 211 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\hello_main.c | C | 6 | 0 | 2 | 8 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\help_main.c | C | 80 | 0 | 10 | 90 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\jobs_main.c | C | 120 | 0 | 26 | 146 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\kbdstat_main.c | C | 44 | 0 | 11 | 55 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\kdbg_main.c | C | 214 | 0 | 56 | 270 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\kill_main.c | C | 144 | 0 | 39 | 183 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\ls_main.c | C | 262 | 0 | 76 | 338 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\memc_kmain.c | C | 6 | 0 | 3 | 9 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\memc_main.c | C | 8 | 0 | 3 | 11 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\memstat_main.c | C | 43 | 0 | 11 | 54 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\mkdir_main.c | C | 57 | 0 | 16 | 73 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\mv_main.c | C | 102 | 0 | 28 | 130 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\pid_main.c | C | 39 | 0 | 11 | 50 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\procstat_main.c | C | 202 | 0 | 43 | 245 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\ps_main.c | C | 160 | 0 | 35 | 195 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\pwd_main.c | C | 39 | 0 | 11 | 50 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\restart_main.c | C | 40 | 0 | 11 | 51 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\rm_main.c | C | 57 | 0 | 16 | 73 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\shell\shell_cmd.c | C | 2,315 | 0 | 574 | 2,889 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\shell\shell_external.c | C | 166 | 0 | 55 | 221 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\shell\shell_input.c | C | 563 | 0 | 147 | 710 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\shell\shell_internal.h | C++ | 92 | 0 | 20 | 112 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\shell\shell_path.c | C | 153 | 0 | 50 | 203 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\shell\shell_script.c | C | 35 | 0 | 12 | 47 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\shell\shell_util.c | C | 283 | 0 | 86 | 369 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\shell_main.c | C | 19 | 0 | 6 | 25 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\shstat_main.c | C | 45 | 0 | 11 | 56 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\shutdown_main.c | C | 40 | 0 | 11 | 51 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\sleep_main.c | C | 52 | 0 | 14 | 66 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\sort_main.c | C | 205 | 0 | 63 | 268 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\spawn_main.c | C | 76 | 0 | 20 | 96 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\spin_main.c | C | 13 | 0 | 4 | 17 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\stats_main.c | C | 102 | 0 | 17 | 119 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\sysstat_main.c | C | 267 | 0 | 45 | 312 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\tail_main.c | C | 190 | 0 | 54 | 244 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\taskstat_main.c | C | 43 | 0 | 11 | 54 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\top_main.c | C | 195 | 0 | 47 | 242 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\touch_main.c | C | 58 | 0 | 16 | 74 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\tty_main.c | C | 64 | 0 | 17 | 81 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\ttydrv_main.c | C | 6 | 0 | 3 | 9 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\uniq_main.c | C | 168 | 0 | 48 | 216 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\userstat_main.c | C | 48 | 0 | 11 | 59 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\wait_main.c | C | 68 | 0 | 17 | 85 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\wavplay_main.c | C | 396 | 0 | 99 | 495 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\wc_main.c | C | 164 | 0 | 45 | 209 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\write_main.c | C | 74 | 0 | 18 | 92 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\apps\yield_main.c | C | 39 | 0 | 11 | 50 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\include\cleonos_rust_bridge.h | C++ | 6 | 0 | 4 | 10 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\include\cleonos_syscall.h | C++ | 192 | 0 | 10 | 202 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\src\runtime.c | C | 37 | 0 | 12 | 49 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\src\syscall.c | C | 250 | 0 | 83 | 333 |
|
||||
| d:\Projects\C\cleonos\cleonos\c\stub.c | C | 3 | 4 | 2 | 9 |
|
||||
| d:\Projects\C\cleonos\cleonos\rust\src\lib.rs | Rust | 23 | 0 | 9 | 32 |
|
||||
| d:\Projects\C\cleonos\clks\arch\aarch64\boot.c | C | 6 | 0 | 1 | 7 |
|
||||
| d:\Projects\C\cleonos\clks\arch\x86_64\boot.c | C | 6 | 0 | 1 | 7 |
|
||||
| d:\Projects\C\cleonos\clks\arch\x86_64\exec_stack_call.S | Go Assembly | 40 | 0 | 8 | 48 |
|
||||
| d:\Projects\C\cleonos\clks\arch\x86_64\interrupt_stubs.S | Go Assembly | 108 | 0 | 12 | 120 |
|
||||
| d:\Projects\C\cleonos\clks\drivers\audio\pcspeaker.c | C | 101 | 0 | 25 | 126 |
|
||||
| d:\Projects\C\cleonos\clks\drivers\serial\serial.c | C | 52 | 0 | 16 | 68 |
|
||||
| d:\Projects\C\cleonos\clks\drivers\video\font8x8.c | C | 67 | 0 | 8 | 75 |
|
||||
| d:\Projects\C\cleonos\clks\drivers\video\font8x8.h | C++ | 5 | 0 | 3 | 8 |
|
||||
| d:\Projects\C\cleonos\clks\drivers\video\framebuffer.c | C | 251 | 0 | 70 | 321 |
|
||||
| d:\Projects\C\cleonos\clks\drivers\video\psf_font.c | C | 230 | 0 | 56 | 286 |
|
||||
| d:\Projects\C\cleonos\clks\drivers\video\psf_font.h | C++ | 15 | 0 | 5 | 20 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\audio.h | C++ | 9 | 0 | 3 | 12 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\boot.h | C++ | 11 | 0 | 4 | 15 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\compiler.h | C++ | 13 | 0 | 4 | 17 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\cpu.h | C++ | 20 | 0 | 4 | 24 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\desktop.h | C++ | 7 | 0 | 4 | 11 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\driver.h | C++ | 29 | 0 | 8 | 37 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\elf64.h | C++ | 32 | 0 | 9 | 41 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\elfrunner.h | C++ | 6 | 0 | 3 | 9 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\exec.h | C++ | 71 | 0 | 8 | 79 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\framebuffer.h | C++ | 26 | 0 | 6 | 32 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\fs.h | C++ | 23 | 0 | 7 | 30 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\heap.h | C++ | 15 | 0 | 4 | 19 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\interrupts.h | C++ | 6 | 0 | 3 | 9 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\kelf.h | C++ | 9 | 0 | 5 | 14 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\kernel.h | C++ | 4 | 0 | 2 | 6 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\keyboard.h | C++ | 27 | 0 | 6 | 33 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\limine.h | C++ | 132 | 0 | 24 | 156 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\log.h | C++ | 14 | 0 | 5 | 19 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\mouse.h | C++ | 20 | 0 | 6 | 26 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\panic.h | C++ | 12 | 0 | 4 | 16 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\pmm.h | C++ | 16 | 0 | 5 | 21 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\ramdisk.h | C++ | 17 | 0 | 8 | 25 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\scheduler.h | C++ | 18 | 0 | 5 | 23 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\serial.h | C++ | 6 | 0 | 2 | 8 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\service.h | C++ | 31 | 0 | 8 | 39 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\shell.h | C++ | 7 | 0 | 3 | 10 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\string.h | C++ | 9 | 0 | 3 | 12 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\syscall.h | C++ | 84 | 0 | 5 | 89 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\task.h | C++ | 24 | 0 | 7 | 31 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\tty.h | C++ | 14 | 0 | 4 | 18 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\types.h | C++ | 17 | 0 | 6 | 23 |
|
||||
| d:\Projects\C\cleonos\clks\include\clks\userland.h | C++ | 12 | 0 | 4 | 16 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\desktop.c | C | 321 | 0 | 86 | 407 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\driver.c | C | 169 | 0 | 49 | 218 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\elf64.c | C | 239 | 0 | 73 | 312 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\elfrunner.c | C | 30 | 0 | 8 | 38 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\exec.c | C | 1,522 | 1 | 435 | 1,958 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\fs.c | C | 698 | 0 | 220 | 918 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\heap.c | C | 134 | 0 | 42 | 176 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\interrupts.c | C | 317 | 0 | 44 | 361 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\kelf.c | C | 203 | 1 | 53 | 257 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\keyboard.c | C | 351 | 0 | 88 | 439 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\kmain.c | C | 200 | 1 | 52 | 253 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\limine_requests.c | C | 76 | 0 | 26 | 102 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\log.c | C | 185 | 0 | 48 | 233 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\mouse.c | C | 246 | 0 | 63 | 309 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\panic.c | C | 546 | 0 | 155 | 701 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\pmm.c | C | 82 | 0 | 23 | 105 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\ramdisk.c | C | 172 | 0 | 50 | 222 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\scheduler.c | C | 136 | 0 | 44 | 180 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\service.c | C | 113 | 0 | 34 | 147 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\shell.c | C | 1,249 | 0 | 317 | 1,566 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\syscall.c | C | 1,480 | 0 | 370 | 1,850 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\tty.c | C | 1,115 | 0 | 275 | 1,390 |
|
||||
| d:\Projects\C\cleonos\clks\kernel\userland.c | C | 124 | 0 | 35 | 159 |
|
||||
| d:\Projects\C\cleonos\clks\lib\libc_compat.c | C | 25 | 0 | 7 | 32 |
|
||||
| d:\Projects\C\cleonos\clks\lib\string.c | C | 54 | 0 | 16 | 70 |
|
||||
| d:\Projects\C\cleonos\clks\rust\src\lib.rs | Rust | 21 | 0 | 6 | 27 |
|
||||
| d:\Projects\C\cleonos\cmake\check_tools.cmake | CMake | 34 | 0 | 7 | 41 |
|
||||
| d:\Projects\C\cleonos\cmake\gen_kernel_symbols.cmake | CMake | 80 | 0 | 26 | 106 |
|
||||
| d:\Projects\C\cleonos\cmake\log.cmake | CMake | 30 | 0 | 6 | 36 |
|
||||
| d:\Projects\C\cleonos\cmake\log_emit.cmake | CMake | 23 | 0 | 6 | 29 |
|
||||
| d:\Projects\C\cleonos\cmake\setup_limine.cmake | CMake | 100 | 0 | 19 | 119 |
|
||||
| d:\Projects\C\cleonos\configs\limine.conf | Properties | 6 | 0 | 1 | 7 |
|
||||
| d:\Projects\C\cleonos\docs\README.md | Markdown | 31 | 0 | 4 | 35 |
|
||||
| d:\Projects\C\cleonos\docs\stage1.md | Markdown | 41 | 0 | 5 | 46 |
|
||||
| d:\Projects\C\cleonos\docs\stage10.md | Markdown | 34 | 0 | 6 | 40 |
|
||||
| d:\Projects\C\cleonos\docs\stage11.md | Markdown | 36 | 0 | 5 | 41 |
|
||||
| d:\Projects\C\cleonos\docs\stage12.md | Markdown | 40 | 0 | 6 | 46 |
|
||||
| d:\Projects\C\cleonos\docs\stage13.md | Markdown | 34 | 0 | 6 | 40 |
|
||||
| d:\Projects\C\cleonos\docs\stage14.md | Markdown | 44 | 0 | 8 | 52 |
|
||||
| d:\Projects\C\cleonos\docs\stage15.md | Markdown | 47 | 0 | 7 | 54 |
|
||||
| d:\Projects\C\cleonos\docs\stage2.md | Markdown | 30 | 0 | 5 | 35 |
|
||||
| d:\Projects\C\cleonos\docs\stage20.md | Markdown | 46 | 0 | 6 | 52 |
|
||||
| d:\Projects\C\cleonos\docs\stage21.md | Markdown | 72 | 0 | 7 | 79 |
|
||||
| d:\Projects\C\cleonos\docs\stage22.md | Markdown | 68 | 0 | 7 | 75 |
|
||||
| d:\Projects\C\cleonos\docs\stage23.md | Markdown | 41 | 0 | 6 | 47 |
|
||||
| d:\Projects\C\cleonos\docs\stage24.md | Markdown | 42 | 0 | 7 | 49 |
|
||||
| d:\Projects\C\cleonos\docs\stage25.md | Markdown | 58 | 0 | 7 | 65 |
|
||||
| d:\Projects\C\cleonos\docs\stage26.md | Markdown | 32 | 0 | 7 | 39 |
|
||||
| d:\Projects\C\cleonos\docs\stage27.md | Markdown | 32 | 0 | 7 | 39 |
|
||||
| d:\Projects\C\cleonos\docs\stage28.md | Markdown | 37 | 0 | 7 | 44 |
|
||||
| d:\Projects\C\cleonos\docs\stage29.md | Markdown | 33 | 0 | 7 | 40 |
|
||||
| d:\Projects\C\cleonos\docs\stage3.md | Markdown | 29 | 0 | 5 | 34 |
|
||||
| d:\Projects\C\cleonos\docs\stage4.md | Markdown | 30 | 0 | 5 | 35 |
|
||||
| d:\Projects\C\cleonos\docs\stage5.md | Markdown | 29 | 0 | 5 | 34 |
|
||||
| d:\Projects\C\cleonos\docs\stage6.md | Markdown | 30 | 0 | 6 | 36 |
|
||||
| d:\Projects\C\cleonos\docs\stage7.md | Markdown | 34 | 0 | 6 | 40 |
|
||||
| d:\Projects\C\cleonos\docs\stage8.md | Markdown | 31 | 0 | 6 | 37 |
|
||||
| d:\Projects\C\cleonos\docs\stage9.md | Markdown | 31 | 0 | 6 | 37 |
|
||||
| d:\Projects\C\cleonos\docs\syscall.md | Markdown | 453 | 0 | 192 | 645 |
|
||||
| d:\Projects\C\cleonos\ramdisk\shell\init.cmd | Batch | 4 | 0 | 2 | 6 |
|
||||
| d:\Projects\C\cleonos\scripts\gen-tty-psf.ps1 | PowerShell | 171 | 2 | 42 | 215 |
|
||||
| d:\Projects\C\cleonos\wine\README.md | Markdown | 49 | 0 | 19 | 68 |
|
||||
| d:\Projects\C\cleonos\wine\cleonos_wine.py | Python | 3 | 1 | 3 | 7 |
|
||||
| d:\Projects\C\cleonos\wine\cleonos_wine_lib\__init__.py | Python | 4 | 0 | 1 | 5 |
|
||||
| d:\Projects\C\cleonos\wine\cleonos_wine_lib\cli.py | Python | 44 | 0 | 10 | 54 |
|
||||
| d:\Projects\C\cleonos\wine\cleonos_wine_lib\constants.py | Python | 76 | 1 | 11 | 88 |
|
||||
| d:\Projects\C\cleonos\wine\cleonos_wine_lib\input_pump.py | Python | 82 | 0 | 17 | 99 |
|
||||
| d:\Projects\C\cleonos\wine\cleonos_wine_lib\platform.py | Python | 55 | 0 | 5 | 60 |
|
||||
| d:\Projects\C\cleonos\wine\cleonos_wine_lib\runner.py | Python | 990 | 0 | 175 | 1,165 |
|
||||
| d:\Projects\C\cleonos\wine\cleonos_wine_lib\state.py | Python | 164 | 0 | 40 | 204 |
|
||||
| d:\Projects\C\cleonos\wine\requirements.txt | pip requirements | 1 | 0 | 1 | 2 |
|
||||
| Total | | 26,202 | 12 | 6,631 | 32,845 |
|
||||
+---------------------------------------------------------------+------------------+------------+------------+------------+------------+
|
||||
30
.github/workflows/build-os.yml
vendored
30
.github/workflows/build-os.yml
vendored
@@ -3,6 +3,21 @@ name: Build CLeonOS
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
menuconfig_preset:
|
||||
description: "menuconfig preset (full/minimal/dev)"
|
||||
type: choice
|
||||
options:
|
||||
- full
|
||||
- minimal
|
||||
- dev
|
||||
required: false
|
||||
default: "full"
|
||||
menuconfig_overrides:
|
||||
description: "Optional extra menuconfig args, e.g. --set CLEONOS_CLKS_ENABLE_AUDIO=OFF"
|
||||
required: false
|
||||
default: ""
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
@@ -10,6 +25,9 @@ permissions:
|
||||
jobs:
|
||||
build-os:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
MENUCONFIG_PRESET: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.menuconfig_preset || 'full' }}
|
||||
MENUCONFIG_OVERRIDES: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.menuconfig_overrides || '' }}
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
@@ -39,6 +57,18 @@ jobs:
|
||||
- name: Setup Rust
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
|
||||
- name: Generate menuconfig (shared preset)
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
extra_args=()
|
||||
if [[ -n "${MENUCONFIG_OVERRIDES}" ]]; then
|
||||
# shellcheck disable=SC2206
|
||||
extra_args=(${MENUCONFIG_OVERRIDES})
|
||||
fi
|
||||
python3 scripts/menuconfig.py --defaults --non-interactive --preset "${MENUCONFIG_PRESET}" "${extra_args[@]}"
|
||||
echo "menuconfig generated with preset=${MENUCONFIG_PRESET}"
|
||||
|
||||
- name: Configure
|
||||
run: |
|
||||
cmake -S . -B build-cmake \
|
||||
|
||||
6
.gitignore
vendored
6
.gitignore
vendored
@@ -12,3 +12,9 @@ compile_commands.json
|
||||
CTestTestfile.cmake
|
||||
Testing/
|
||||
.cmake/
|
||||
|
||||
# menuconfig generated
|
||||
configs/menuconfig/.config.json
|
||||
configs/menuconfig/config.cmake
|
||||
|
||||
venv/
|
||||
|
||||
237
CMakeLists.txt
237
CMakeLists.txt
@@ -11,6 +11,8 @@ set(LD "x86_64-elf-ld" CACHE STRING "Kernel linker")
|
||||
set(USER_CC "cc" CACHE STRING "User-space C compiler")
|
||||
set(USER_LD "ld" CACHE STRING "User-space linker")
|
||||
set(RUSTC "rustc" CACHE STRING "Rust compiler")
|
||||
set(NM "nm" CACHE STRING "nm executable")
|
||||
set(ADDR2LINE "addr2line" CACHE STRING "addr2line executable")
|
||||
|
||||
set(XORRISO "xorriso" CACHE STRING "xorriso executable")
|
||||
set(TAR "tar" CACHE STRING "tar executable")
|
||||
@@ -87,6 +89,7 @@ set(RAMDISK_ROOT "${BUILD_ROOT}/ramdisk_root")
|
||||
set(KERNEL_ELF "${BUILD_ROOT}/clks_kernel.elf")
|
||||
set(RAMDISK_IMAGE "${BUILD_ROOT}/cleonos_ramdisk.tar")
|
||||
set(ISO_IMAGE "${CMAKE_SOURCE_DIR}/build/CLeonOS-x86_64.iso")
|
||||
set(KERNEL_SYMBOLS_FILE "${BUILD_ROOT}/kernel.sym")
|
||||
|
||||
set(USER_BUILD_ROOT "${BUILD_ROOT}/user")
|
||||
set(USER_OBJ_ROOT "${USER_BUILD_ROOT}/obj")
|
||||
@@ -99,6 +102,8 @@ resolve_tool_with_fallback(CC gcc cc clang)
|
||||
resolve_tool_with_fallback(LD ld.lld ld)
|
||||
resolve_tool_with_fallback(USER_CC cc gcc clang)
|
||||
resolve_tool_with_fallback(USER_LD ld.lld ld)
|
||||
resolve_tool_with_fallback(NM llvm-nm x86_64-elf-nm nm)
|
||||
resolve_tool_with_fallback(ADDR2LINE llvm-addr2line x86_64-elf-addr2line addr2line)
|
||||
resolve_tool_with_fallback(OBJCOPY_FOR_TARGET llvm-objcopy x86_64-linux-gnu-objcopy objcopy)
|
||||
resolve_tool_with_fallback(OBJDUMP_FOR_TARGET llvm-objdump x86_64-linux-gnu-objdump objdump)
|
||||
resolve_tool_with_fallback(READELF_FOR_TARGET llvm-readelf x86_64-linux-gnu-readelf readelf)
|
||||
@@ -112,12 +117,101 @@ set(CLKS_ARCH "x86_64" CACHE STRING "Target CLKS arch")
|
||||
set(LINKER_SCRIPT "${CMAKE_SOURCE_DIR}/clks/arch/${CLKS_ARCH}/linker.ld")
|
||||
set(USER_LINKER_SCRIPT "${CMAKE_SOURCE_DIR}/cleonos/c/user.ld")
|
||||
set(KELF_LINKER_SCRIPT "${CMAKE_SOURCE_DIR}/cleonos/c/kelf.ld")
|
||||
set(CLEONOS_MENUCONFIG_CMAKE "${CMAKE_SOURCE_DIR}/configs/menuconfig/config.cmake" CACHE FILEPATH "menuconfig generated CMake config")
|
||||
|
||||
if(EXISTS "${CLEONOS_MENUCONFIG_CMAKE}")
|
||||
include("${CLEONOS_MENUCONFIG_CMAKE}")
|
||||
cl_log_info("menuconfig loaded from ${CLEONOS_MENUCONFIG_CMAKE}")
|
||||
endif()
|
||||
|
||||
function(cl_set_bool_cache VAR_NAME DEFAULT_VALUE DOC_TEXT)
|
||||
if(NOT DEFINED ${VAR_NAME})
|
||||
set(${VAR_NAME} ${DEFAULT_VALUE} CACHE BOOL "${DOC_TEXT}")
|
||||
else()
|
||||
set(${VAR_NAME} ${${VAR_NAME}} CACHE BOOL "${DOC_TEXT}" FORCE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(cl_bool_to_int BOOL_VAR OUT_VAR)
|
||||
if(${BOOL_VAR})
|
||||
set(${OUT_VAR} 1 PARENT_SCOPE)
|
||||
else()
|
||||
set(${OUT_VAR} 0 PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
cl_set_bool_cache(CLEONOS_CLKS_ENABLE_AUDIO ON "Initialize kernel audio subsystem")
|
||||
cl_set_bool_cache(CLEONOS_CLKS_ENABLE_MOUSE ON "Initialize kernel mouse subsystem")
|
||||
cl_set_bool_cache(CLEONOS_CLKS_ENABLE_DESKTOP ON "Initialize desktop compositor subsystem")
|
||||
cl_set_bool_cache(CLEONOS_CLKS_ENABLE_DRIVER_MANAGER ON "Initialize kernel driver manager")
|
||||
cl_set_bool_cache(CLEONOS_CLKS_ENABLE_KELF ON "Enable KELF app dispatcher")
|
||||
cl_set_bool_cache(CLEONOS_CLKS_ENABLE_USERLAND_AUTO_EXEC ON "Auto exec /shell/shell.elf on boot")
|
||||
cl_set_bool_cache(CLEONOS_CLKS_ENABLE_HEAP_SELFTEST ON "Run heap selftest at boot")
|
||||
cl_set_bool_cache(CLEONOS_CLKS_ENABLE_EXTERNAL_PSF ON "Load /system/tty.psf external font")
|
||||
cl_set_bool_cache(CLEONOS_CLKS_ENABLE_KEYBOARD ON "Initialize keyboard input subsystem")
|
||||
cl_set_bool_cache(CLEONOS_CLKS_ENABLE_ELFRUNNER_PROBE ON "Run ELFRUNNER kernel ELF probe")
|
||||
cl_set_bool_cache(CLEONOS_CLKS_ENABLE_KLOGD_TASK ON "Enable scheduler klogd task")
|
||||
cl_set_bool_cache(CLEONOS_CLKS_ENABLE_KWORKER_TASK ON "Enable scheduler kworker task")
|
||||
cl_set_bool_cache(CLEONOS_CLKS_ENABLE_USRD_TASK ON "Enable scheduler usrd task")
|
||||
cl_set_bool_cache(CLEONOS_CLKS_ENABLE_BOOT_VIDEO_LOG ON "Print boot framebuffer geometry logs")
|
||||
cl_set_bool_cache(CLEONOS_CLKS_ENABLE_PMM_STATS_LOG ON "Print PMM stats logs")
|
||||
cl_set_bool_cache(CLEONOS_CLKS_ENABLE_HEAP_STATS_LOG ON "Print heap stats logs")
|
||||
cl_set_bool_cache(CLEONOS_CLKS_ENABLE_FS_ROOT_LOG ON "Print root children FS log")
|
||||
cl_set_bool_cache(CLEONOS_CLKS_ENABLE_SYSTEM_DIR_CHECK ON "Require /system directory sanity check")
|
||||
cl_set_bool_cache(CLEONOS_CLKS_ENABLE_ELFRUNNER_INIT ON "Initialize ELFRUNNER framework")
|
||||
cl_set_bool_cache(CLEONOS_CLKS_ENABLE_SYSCALL_TICK_QUERY ON "Query syscall timer ticks at boot")
|
||||
cl_set_bool_cache(CLEONOS_CLKS_ENABLE_TTY_READY_LOG ON "Print TTY ready logs")
|
||||
cl_set_bool_cache(CLEONOS_CLKS_ENABLE_IDLE_DEBUG_LOG ON "Print idle loop debug log")
|
||||
cl_set_bool_cache(CLEONOS_CLKS_ENABLE_PROCFS ON "Enable virtual /proc procfs syscall layer")
|
||||
cl_set_bool_cache(CLEONOS_CLKS_ENABLE_EXEC_SERIAL_LOG ON "Enable EXEC info logs on serial output")
|
||||
cl_set_bool_cache(CLEONOS_CLKS_ENABLE_KBD_TTY_SWITCH_HOTKEY ON "Enable ALT+F1..F4 TTY switch hotkey")
|
||||
cl_set_bool_cache(CLEONOS_CLKS_ENABLE_KBD_CTRL_SHORTCUTS ON "Enable Ctrl+A/C/V keyboard shortcuts")
|
||||
cl_set_bool_cache(CLEONOS_CLKS_ENABLE_KBD_FORCE_STOP_HOTKEY ON "Enable Ctrl+Alt+C force-stop hotkey")
|
||||
cl_set_bool_cache(CLEONOS_CLKS_ENABLE_USER_INIT_SCRIPT_PROBE ON "Probe /shell/init.cmd during userland init")
|
||||
cl_set_bool_cache(CLEONOS_CLKS_ENABLE_USER_SYSTEM_APP_PROBE ON "Probe /system apps (elfrunner/memc) during userland init")
|
||||
cl_set_bool_cache(CLEONOS_CLKS_ENABLE_SCHED_TASK_COUNT_LOG ON "Print scheduler task count during boot")
|
||||
cl_set_bool_cache(CLEONOS_CLKS_ENABLE_INTERRUPT_READY_LOG ON "Print interrupt ready log after IDT/PIC init")
|
||||
cl_set_bool_cache(CLEONOS_CLKS_ENABLE_SHELL_MODE_LOG ON "Print default shell mode log during boot")
|
||||
|
||||
cl_bool_to_int(CLEONOS_CLKS_ENABLE_AUDIO CLKS_CFG_AUDIO_INT)
|
||||
cl_bool_to_int(CLEONOS_CLKS_ENABLE_MOUSE CLKS_CFG_MOUSE_INT)
|
||||
cl_bool_to_int(CLEONOS_CLKS_ENABLE_DESKTOP CLKS_CFG_DESKTOP_INT)
|
||||
cl_bool_to_int(CLEONOS_CLKS_ENABLE_DRIVER_MANAGER CLKS_CFG_DRIVER_MANAGER_INT)
|
||||
cl_bool_to_int(CLEONOS_CLKS_ENABLE_KELF CLKS_CFG_KELF_INT)
|
||||
cl_bool_to_int(CLEONOS_CLKS_ENABLE_USERLAND_AUTO_EXEC CLKS_CFG_USERLAND_AUTO_EXEC_INT)
|
||||
cl_bool_to_int(CLEONOS_CLKS_ENABLE_HEAP_SELFTEST CLKS_CFG_HEAP_SELFTEST_INT)
|
||||
cl_bool_to_int(CLEONOS_CLKS_ENABLE_EXTERNAL_PSF CLKS_CFG_EXTERNAL_PSF_INT)
|
||||
cl_bool_to_int(CLEONOS_CLKS_ENABLE_KEYBOARD CLKS_CFG_KEYBOARD_INT)
|
||||
cl_bool_to_int(CLEONOS_CLKS_ENABLE_ELFRUNNER_PROBE CLKS_CFG_ELFRUNNER_PROBE_INT)
|
||||
cl_bool_to_int(CLEONOS_CLKS_ENABLE_KLOGD_TASK CLKS_CFG_KLOGD_TASK_INT)
|
||||
cl_bool_to_int(CLEONOS_CLKS_ENABLE_KWORKER_TASK CLKS_CFG_KWORKER_TASK_INT)
|
||||
cl_bool_to_int(CLEONOS_CLKS_ENABLE_USRD_TASK CLKS_CFG_USRD_TASK_INT)
|
||||
cl_bool_to_int(CLEONOS_CLKS_ENABLE_BOOT_VIDEO_LOG CLKS_CFG_BOOT_VIDEO_LOG_INT)
|
||||
cl_bool_to_int(CLEONOS_CLKS_ENABLE_PMM_STATS_LOG CLKS_CFG_PMM_STATS_LOG_INT)
|
||||
cl_bool_to_int(CLEONOS_CLKS_ENABLE_HEAP_STATS_LOG CLKS_CFG_HEAP_STATS_LOG_INT)
|
||||
cl_bool_to_int(CLEONOS_CLKS_ENABLE_FS_ROOT_LOG CLKS_CFG_FS_ROOT_LOG_INT)
|
||||
cl_bool_to_int(CLEONOS_CLKS_ENABLE_SYSTEM_DIR_CHECK CLKS_CFG_SYSTEM_DIR_CHECK_INT)
|
||||
cl_bool_to_int(CLEONOS_CLKS_ENABLE_ELFRUNNER_INIT CLKS_CFG_ELFRUNNER_INIT_INT)
|
||||
cl_bool_to_int(CLEONOS_CLKS_ENABLE_SYSCALL_TICK_QUERY CLKS_CFG_SYSCALL_TICK_QUERY_INT)
|
||||
cl_bool_to_int(CLEONOS_CLKS_ENABLE_TTY_READY_LOG CLKS_CFG_TTY_READY_LOG_INT)
|
||||
cl_bool_to_int(CLEONOS_CLKS_ENABLE_IDLE_DEBUG_LOG CLKS_CFG_IDLE_DEBUG_LOG_INT)
|
||||
cl_bool_to_int(CLEONOS_CLKS_ENABLE_PROCFS CLKS_CFG_PROCFS_INT)
|
||||
cl_bool_to_int(CLEONOS_CLKS_ENABLE_EXEC_SERIAL_LOG CLKS_CFG_EXEC_SERIAL_LOG_INT)
|
||||
cl_bool_to_int(CLEONOS_CLKS_ENABLE_KBD_TTY_SWITCH_HOTKEY CLKS_CFG_KBD_TTY_SWITCH_HOTKEY_INT)
|
||||
cl_bool_to_int(CLEONOS_CLKS_ENABLE_KBD_CTRL_SHORTCUTS CLKS_CFG_KBD_CTRL_SHORTCUTS_INT)
|
||||
cl_bool_to_int(CLEONOS_CLKS_ENABLE_KBD_FORCE_STOP_HOTKEY CLKS_CFG_KBD_FORCE_STOP_HOTKEY_INT)
|
||||
cl_bool_to_int(CLEONOS_CLKS_ENABLE_USER_INIT_SCRIPT_PROBE CLKS_CFG_USER_INIT_SCRIPT_PROBE_INT)
|
||||
cl_bool_to_int(CLEONOS_CLKS_ENABLE_USER_SYSTEM_APP_PROBE CLKS_CFG_USER_SYSTEM_APP_PROBE_INT)
|
||||
cl_bool_to_int(CLEONOS_CLKS_ENABLE_SCHED_TASK_COUNT_LOG CLKS_CFG_SCHED_TASK_COUNT_LOG_INT)
|
||||
cl_bool_to_int(CLEONOS_CLKS_ENABLE_INTERRUPT_READY_LOG CLKS_CFG_INTERRUPT_READY_LOG_INT)
|
||||
cl_bool_to_int(CLEONOS_CLKS_ENABLE_SHELL_MODE_LOG CLKS_CFG_SHELL_MODE_LOG_INT)
|
||||
|
||||
set(CFLAGS_COMMON
|
||||
-std=c11
|
||||
-ffreestanding
|
||||
-fno-stack-protector
|
||||
-fno-builtin
|
||||
-g
|
||||
-Wall
|
||||
-Wextra
|
||||
-Werror
|
||||
@@ -126,6 +220,38 @@ set(CFLAGS_COMMON
|
||||
|
||||
set(ARCH_CFLAGS
|
||||
-DCLKS_ARCH_X86_64=1
|
||||
"-DCLKS_CFG_AUDIO=${CLKS_CFG_AUDIO_INT}"
|
||||
"-DCLKS_CFG_MOUSE=${CLKS_CFG_MOUSE_INT}"
|
||||
"-DCLKS_CFG_DESKTOP=${CLKS_CFG_DESKTOP_INT}"
|
||||
"-DCLKS_CFG_DRIVER_MANAGER=${CLKS_CFG_DRIVER_MANAGER_INT}"
|
||||
"-DCLKS_CFG_KELF=${CLKS_CFG_KELF_INT}"
|
||||
"-DCLKS_CFG_USERLAND_AUTO_EXEC=${CLKS_CFG_USERLAND_AUTO_EXEC_INT}"
|
||||
"-DCLKS_CFG_HEAP_SELFTEST=${CLKS_CFG_HEAP_SELFTEST_INT}"
|
||||
"-DCLKS_CFG_EXTERNAL_PSF=${CLKS_CFG_EXTERNAL_PSF_INT}"
|
||||
"-DCLKS_CFG_KEYBOARD=${CLKS_CFG_KEYBOARD_INT}"
|
||||
"-DCLKS_CFG_ELFRUNNER_PROBE=${CLKS_CFG_ELFRUNNER_PROBE_INT}"
|
||||
"-DCLKS_CFG_KLOGD_TASK=${CLKS_CFG_KLOGD_TASK_INT}"
|
||||
"-DCLKS_CFG_KWORKER_TASK=${CLKS_CFG_KWORKER_TASK_INT}"
|
||||
"-DCLKS_CFG_USRD_TASK=${CLKS_CFG_USRD_TASK_INT}"
|
||||
"-DCLKS_CFG_BOOT_VIDEO_LOG=${CLKS_CFG_BOOT_VIDEO_LOG_INT}"
|
||||
"-DCLKS_CFG_PMM_STATS_LOG=${CLKS_CFG_PMM_STATS_LOG_INT}"
|
||||
"-DCLKS_CFG_HEAP_STATS_LOG=${CLKS_CFG_HEAP_STATS_LOG_INT}"
|
||||
"-DCLKS_CFG_FS_ROOT_LOG=${CLKS_CFG_FS_ROOT_LOG_INT}"
|
||||
"-DCLKS_CFG_SYSTEM_DIR_CHECK=${CLKS_CFG_SYSTEM_DIR_CHECK_INT}"
|
||||
"-DCLKS_CFG_ELFRUNNER_INIT=${CLKS_CFG_ELFRUNNER_INIT_INT}"
|
||||
"-DCLKS_CFG_SYSCALL_TICK_QUERY=${CLKS_CFG_SYSCALL_TICK_QUERY_INT}"
|
||||
"-DCLKS_CFG_TTY_READY_LOG=${CLKS_CFG_TTY_READY_LOG_INT}"
|
||||
"-DCLKS_CFG_IDLE_DEBUG_LOG=${CLKS_CFG_IDLE_DEBUG_LOG_INT}"
|
||||
"-DCLKS_CFG_PROCFS=${CLKS_CFG_PROCFS_INT}"
|
||||
"-DCLKS_CFG_EXEC_SERIAL_LOG=${CLKS_CFG_EXEC_SERIAL_LOG_INT}"
|
||||
"-DCLKS_CFG_KBD_TTY_SWITCH_HOTKEY=${CLKS_CFG_KBD_TTY_SWITCH_HOTKEY_INT}"
|
||||
"-DCLKS_CFG_KBD_CTRL_SHORTCUTS=${CLKS_CFG_KBD_CTRL_SHORTCUTS_INT}"
|
||||
"-DCLKS_CFG_KBD_FORCE_STOP_HOTKEY=${CLKS_CFG_KBD_FORCE_STOP_HOTKEY_INT}"
|
||||
"-DCLKS_CFG_USER_INIT_SCRIPT_PROBE=${CLKS_CFG_USER_INIT_SCRIPT_PROBE_INT}"
|
||||
"-DCLKS_CFG_USER_SYSTEM_APP_PROBE=${CLKS_CFG_USER_SYSTEM_APP_PROBE_INT}"
|
||||
"-DCLKS_CFG_SCHED_TASK_COUNT_LOG=${CLKS_CFG_SCHED_TASK_COUNT_LOG_INT}"
|
||||
"-DCLKS_CFG_INTERRUPT_READY_LOG=${CLKS_CFG_INTERRUPT_READY_LOG_INT}"
|
||||
"-DCLKS_CFG_SHELL_MODE_LOG=${CLKS_CFG_SHELL_MODE_LOG_INT}"
|
||||
-m64
|
||||
-mno-red-zone
|
||||
-mcmodel=kernel
|
||||
@@ -203,6 +329,16 @@ list(REMOVE_DUPLICATES ASM_SOURCES)
|
||||
list(SORT C_SOURCES)
|
||||
list(SORT ASM_SOURCES)
|
||||
|
||||
file(GLOB_RECURSE KERNEL_INC_SOURCES_ABS CONFIGURE_DEPENDS
|
||||
"${CMAKE_SOURCE_DIR}/clks/**/*.inc"
|
||||
)
|
||||
list(SORT KERNEL_INC_SOURCES_ABS)
|
||||
|
||||
file(GLOB_RECURSE USER_INC_SOURCES_ABS CONFIGURE_DEPENDS
|
||||
"${CMAKE_SOURCE_DIR}/cleonos/**/*.inc"
|
||||
)
|
||||
list(SORT USER_INC_SOURCES_ABS)
|
||||
|
||||
if(NOT C_SOURCES)
|
||||
cl_log_error("no kernel C sources found in clks/")
|
||||
endif()
|
||||
@@ -248,12 +384,13 @@ function(add_kernel_c_object SRC OUTPUT_LIST_VAR)
|
||||
string(REGEX REPLACE "\\.c$" ".o" OBJ_REL "${SRC}")
|
||||
set(OBJ_PATH "${OBJ_ROOT}/${OBJ_REL}")
|
||||
get_filename_component(OBJ_DIR "${OBJ_PATH}" DIRECTORY)
|
||||
set(_deps "${CMAKE_SOURCE_DIR}/${SRC}" ${KERNEL_INC_SOURCES_ABS})
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT "${OBJ_PATH}"
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${OBJ_DIR}"
|
||||
COMMAND ${CC} ${CFLAGS_COMMON} ${ARCH_CFLAGS} -c "${CMAKE_SOURCE_DIR}/${SRC}" -o "${OBJ_PATH}"
|
||||
DEPENDS "${CMAKE_SOURCE_DIR}/${SRC}"
|
||||
DEPENDS ${_deps}
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
@@ -264,12 +401,13 @@ function(add_kernel_asm_object SRC OUTPUT_LIST_VAR)
|
||||
string(REGEX REPLACE "\\.S$" ".o" OBJ_REL "${SRC}")
|
||||
set(OBJ_PATH "${OBJ_ROOT}/${OBJ_REL}")
|
||||
get_filename_component(OBJ_DIR "${OBJ_PATH}" DIRECTORY)
|
||||
set(_deps "${CMAKE_SOURCE_DIR}/${SRC}" ${KERNEL_INC_SOURCES_ABS})
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT "${OBJ_PATH}"
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${OBJ_DIR}"
|
||||
COMMAND ${CC} ${ASFLAGS_COMMON} ${ARCH_CFLAGS} -c "${CMAKE_SOURCE_DIR}/${SRC}" -o "${OBJ_PATH}"
|
||||
DEPENDS "${CMAKE_SOURCE_DIR}/${SRC}"
|
||||
DEPENDS ${_deps}
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
@@ -280,12 +418,13 @@ function(add_user_c_object SRC OUTPUT_VAR)
|
||||
string(REGEX REPLACE "\\.c$" ".o" OBJ_REL "${SRC}")
|
||||
set(OBJ_PATH "${USER_OBJ_ROOT}/${OBJ_REL}")
|
||||
get_filename_component(OBJ_DIR "${OBJ_PATH}" DIRECTORY)
|
||||
set(_deps "${CMAKE_SOURCE_DIR}/${SRC}" ${USER_INC_SOURCES_ABS})
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT "${OBJ_PATH}"
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${OBJ_DIR}"
|
||||
COMMAND ${USER_CC} ${USER_CFLAGS} -c "${CMAKE_SOURCE_DIR}/${SRC}" -o "${OBJ_PATH}"
|
||||
DEPENDS "${CMAKE_SOURCE_DIR}/${SRC}"
|
||||
DEPENDS ${_deps}
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
@@ -318,6 +457,22 @@ add_custom_command(
|
||||
|
||||
add_custom_target(kernel DEPENDS "${KERNEL_ELF}")
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT "${KERNEL_SYMBOLS_FILE}"
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${BUILD_ROOT}"
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
"-DNM_TOOL=${NM}"
|
||||
"-DADDR2LINE_TOOL=${ADDR2LINE}"
|
||||
"-DKERNEL_ELF=${KERNEL_ELF}"
|
||||
"-DOUT_SYMBOL_FILE=${KERNEL_SYMBOLS_FILE}"
|
||||
-P "${CMAKE_SOURCE_DIR}/cmake/gen_kernel_symbols.cmake"
|
||||
DEPENDS "${KERNEL_ELF}" "${CMAKE_SOURCE_DIR}/cmake/gen_kernel_symbols.cmake"
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
add_custom_target(kernel-symbols DEPENDS "${KERNEL_SYMBOLS_FILE}")
|
||||
add_dependencies(kernel-symbols kernel)
|
||||
|
||||
set(USER_COMMON_OBJECTS)
|
||||
foreach(SRC IN LISTS USER_COMMON_SOURCES)
|
||||
add_user_c_object("${SRC}" OBJ_OUT)
|
||||
@@ -348,14 +503,19 @@ set(RAMDISK_SYSTEM_APPS)
|
||||
set(RAMDISK_ROOT_APPS)
|
||||
|
||||
set(USER_SHELL_COMMAND_APPS
|
||||
help ls cat pwd cd exec pid spawn wait sleep yield
|
||||
shutdown restart exit clear ansi memstat fsstat taskstat userstat
|
||||
shstat stats tty dmesg kbdstat mkdir touch write append cp mv rm
|
||||
help args ls cat grep head tail wc cut uniq sort pwd cd exec pid spawn wait sleep yield
|
||||
bg fg jobs kill ps top
|
||||
procstat sysstat
|
||||
shutdown restart exit clear ansi ansitest wavplay fastfetch memstat fsstat taskstat userstat
|
||||
shstat stats tty dmesg kbdstat mkdir touch write append cp mv rm kdbg
|
||||
)
|
||||
|
||||
foreach(SRC IN LISTS USER_APP_MAIN_SOURCES)
|
||||
get_filename_component(_stem "${SRC}" NAME_WE)
|
||||
string(REGEX REPLACE "_main$" "" _app_name "${_stem}")
|
||||
string(TOUPPER "${_app_name}" _app_name_upper)
|
||||
string(REGEX REPLACE "[^A-Z0-9]" "_" _app_name_key "${_app_name_upper}")
|
||||
set(_app_enabled_var "CLEONOS_USER_APP_${_app_name_key}")
|
||||
|
||||
list(FIND USER_KELF_APP_NAMES "${_app_name}" _shadowed_by_kmain)
|
||||
if(NOT _shadowed_by_kmain EQUAL -1)
|
||||
@@ -363,6 +523,17 @@ foreach(SRC IN LISTS USER_APP_MAIN_SOURCES)
|
||||
continue()
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED ${_app_enabled_var})
|
||||
set(${_app_enabled_var} ON CACHE BOOL "Build user app ${_app_name}")
|
||||
else()
|
||||
set(${_app_enabled_var} ${${_app_enabled_var}} CACHE BOOL "Build user app ${_app_name}" FORCE)
|
||||
endif()
|
||||
|
||||
if(NOT ${_app_enabled_var})
|
||||
cl_log_info("menuconfig: skip disabled user app ${_app_name}")
|
||||
continue()
|
||||
endif()
|
||||
|
||||
list(FIND USER_APP_NAMES "${_app_name}" _dup_name_idx)
|
||||
if(NOT _dup_name_idx EQUAL -1)
|
||||
cl_log_error("duplicate user app name: ${_app_name}")
|
||||
@@ -379,10 +550,7 @@ foreach(SRC IN LISTS USER_APP_MAIN_SOURCES)
|
||||
|
||||
list(FIND USER_SHELL_COMMAND_APPS "${_app_name}" _shell_cmd_idx)
|
||||
if(NOT _shell_cmd_idx EQUAL -1)
|
||||
file(GLOB _shell_cmd_shared_abs CONFIGURE_DEPENDS
|
||||
"${CMAKE_SOURCE_DIR}/cleonos/c/apps/shell/*.c"
|
||||
)
|
||||
list(APPEND _app_specific_abs ${_shell_cmd_shared_abs})
|
||||
list(APPEND _app_specific_abs "${CMAKE_SOURCE_DIR}/cleonos/c/apps/cmd_runtime.c")
|
||||
endif()
|
||||
foreach(_extra_abs IN LISTS _app_specific_abs)
|
||||
file(RELATIVE_PATH _extra_rel "${CMAKE_SOURCE_DIR}" "${_extra_abs}")
|
||||
@@ -422,6 +590,20 @@ endforeach()
|
||||
foreach(SRC IN LISTS USER_APP_KMAIN_SOURCES)
|
||||
get_filename_component(_stem "${SRC}" NAME_WE)
|
||||
string(REGEX REPLACE "_kmain$" "" _app_name "${_stem}")
|
||||
string(TOUPPER "${_app_name}" _app_name_upper)
|
||||
string(REGEX REPLACE "[^A-Z0-9]" "_" _app_name_key "${_app_name_upper}")
|
||||
set(_app_enabled_var "CLEONOS_USER_APP_${_app_name_key}")
|
||||
|
||||
if(NOT DEFINED ${_app_enabled_var})
|
||||
set(${_app_enabled_var} ON CACHE BOOL "Build user app ${_app_name}")
|
||||
else()
|
||||
set(${_app_enabled_var} ${${_app_enabled_var}} CACHE BOOL "Build user app ${_app_name}" FORCE)
|
||||
endif()
|
||||
|
||||
if(NOT ${_app_enabled_var})
|
||||
cl_log_info("menuconfig: skip disabled user app ${_app_name}")
|
||||
continue()
|
||||
endif()
|
||||
|
||||
list(FIND USER_APP_NAMES "${_app_name}" _dup_name_idx)
|
||||
if(NOT _dup_name_idx EQUAL -1)
|
||||
@@ -484,10 +666,11 @@ add_custom_command(
|
||||
COMMAND ${CMAKE_COMMAND} -E rm -rf "${RAMDISK_ROOT}"
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${RAMDISK_ROOT}"
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_SOURCE_DIR}/ramdisk" "${RAMDISK_ROOT}"
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${RAMDISK_ROOT}/system" "${RAMDISK_ROOT}/shell" "${RAMDISK_ROOT}/driver"
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${RAMDISK_ROOT}/system" "${RAMDISK_ROOT}/shell" "${RAMDISK_ROOT}/driver" "${RAMDISK_ROOT}/dev"
|
||||
COMMAND ${CMAKE_COMMAND} -E copy "${KERNEL_SYMBOLS_FILE}" "${RAMDISK_ROOT}/system/kernel.sym"
|
||||
${RAMDISK_COPY_COMMANDS}
|
||||
COMMAND ${CMAKE_COMMAND} -E touch "${RAMDISK_ROOT_STAMP}"
|
||||
DEPENDS ${RAMDISK_FILES} ${USER_APP_OUTPUTS}
|
||||
DEPENDS ${RAMDISK_FILES} ${USER_APP_OUTPUTS} "${KERNEL_SYMBOLS_FILE}"
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
@@ -515,6 +698,8 @@ add_custom_target(setup-tools
|
||||
"-DOBJCOPY_TOOL=${OBJCOPY_FOR_TARGET}"
|
||||
"-DOBJDUMP_TOOL=${OBJDUMP_FOR_TARGET}"
|
||||
"-DREADELF_TOOL=${READELF_FOR_TARGET}"
|
||||
"-DNM_TOOL=${NM}"
|
||||
"-DADDR2LINE_TOOL=${ADDR2LINE}"
|
||||
"-DUSER_CC_TOOL=${USER_CC}"
|
||||
"-DUSER_LD_TOOL=${USER_LD}"
|
||||
"-DRUSTC_TOOL=${RUSTC}"
|
||||
@@ -558,13 +743,16 @@ add_custom_command(
|
||||
add_custom_command(
|
||||
OUTPUT "${ISO_IMAGE}"
|
||||
COMMAND ${CMAKE_COMMAND} -E rm -rf "${ISO_ROOT}"
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${ISO_ROOT}/boot/limine"
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${ISO_ROOT}/boot/limine" "${ISO_ROOT}/EFI/BOOT"
|
||||
COMMAND ${CMAKE_COMMAND} -E copy "${KERNEL_ELF}" "${ISO_ROOT}/boot/clks_kernel.elf"
|
||||
COMMAND ${CMAKE_COMMAND} -E copy "${RAMDISK_IMAGE}" "${ISO_ROOT}/boot/cleonos_ramdisk.tar"
|
||||
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_SOURCE_DIR}/configs/limine.conf" "${ISO_ROOT}/boot/limine/limine.conf"
|
||||
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_SOURCE_DIR}/configs/limine.conf" "${ISO_ROOT}/EFI/BOOT/limine.conf"
|
||||
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_SOURCE_DIR}/configs/limine.conf" "${ISO_ROOT}/limine.conf"
|
||||
COMMAND ${CMAKE_COMMAND} -E copy "${LIMINE_BIN_DIR_ABS}/limine-bios.sys" "${ISO_ROOT}/boot/limine/limine-bios.sys"
|
||||
COMMAND ${CMAKE_COMMAND} -E copy "${LIMINE_BIN_DIR_ABS}/limine-bios-cd.bin" "${ISO_ROOT}/boot/limine/limine-bios-cd.bin"
|
||||
COMMAND ${CMAKE_COMMAND} -E copy "${LIMINE_BIN_DIR_ABS}/limine-uefi-cd.bin" "${ISO_ROOT}/boot/limine/limine-uefi-cd.bin"
|
||||
COMMAND ${CMAKE_COMMAND} -E copy "${LIMINE_BIN_DIR_ABS}/BOOTX64.EFI" "${ISO_ROOT}/EFI/BOOT/BOOTX64.EFI"
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_SOURCE_DIR}/build"
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
"-DNO_COLOR=${NO_COLOR}"
|
||||
@@ -650,9 +838,32 @@ add_custom_target(clean-all
|
||||
-P "${CL_LOG_EMIT_SCRIPT}"
|
||||
)
|
||||
|
||||
find_package(Python3 COMPONENTS Interpreter QUIET)
|
||||
if(Python3_Interpreter_FOUND)
|
||||
add_custom_target(menuconfig
|
||||
COMMAND ${Python3_EXECUTABLE} "${CMAKE_SOURCE_DIR}/scripts/menuconfig.py"
|
||||
USES_TERMINAL
|
||||
)
|
||||
add_custom_target(menuconfig-gui
|
||||
COMMAND ${Python3_EXECUTABLE} "${CMAKE_SOURCE_DIR}/scripts/menuconfig.py" --gui
|
||||
USES_TERMINAL
|
||||
)
|
||||
else()
|
||||
add_custom_target(menuconfig
|
||||
COMMAND ${CMAKE_COMMAND} -E echo "python3 not found; run scripts/menuconfig.py manually"
|
||||
USES_TERMINAL
|
||||
)
|
||||
add_custom_target(menuconfig-gui
|
||||
COMMAND ${CMAKE_COMMAND} -E echo "python3 not found; run scripts/menuconfig.py --gui manually"
|
||||
USES_TERMINAL
|
||||
)
|
||||
endif()
|
||||
|
||||
add_custom_target(cleonos-help
|
||||
COMMAND ${CMAKE_COMMAND} -E echo "CLeonOS CMake build system (x86_64 only)"
|
||||
COMMAND ${CMAKE_COMMAND} -E echo " cmake -S . -B build-cmake"
|
||||
COMMAND ${CMAKE_COMMAND} -E echo " cmake --build build-cmake --target menuconfig"
|
||||
COMMAND ${CMAKE_COMMAND} -E echo " cmake --build build-cmake --target menuconfig-gui"
|
||||
COMMAND ${CMAKE_COMMAND} -E echo " cmake --build build-cmake --target setup"
|
||||
COMMAND ${CMAKE_COMMAND} -E echo " cmake --build build-cmake --target userapps"
|
||||
COMMAND ${CMAKE_COMMAND} -E echo " cmake --build build-cmake --target iso"
|
||||
|
||||
34
Makefile
34
Makefile
@@ -15,6 +15,9 @@ LIMINE_BIN_DIR ?=
|
||||
OBJCOPY_FOR_TARGET ?=
|
||||
OBJDUMP_FOR_TARGET ?=
|
||||
READELF_FOR_TARGET ?=
|
||||
PYTHON ?= python3
|
||||
MENUCONFIG_ARGS ?=
|
||||
MENUCONFIG_PRESET ?=
|
||||
|
||||
ifeq ($(strip $(CMAKE_GENERATOR)),)
|
||||
GEN_ARG :=
|
||||
@@ -23,6 +26,7 @@ GEN_ARG := -G "$(CMAKE_GENERATOR)"
|
||||
endif
|
||||
|
||||
CMAKE_PASSTHROUGH_ARGS :=
|
||||
MENUCONFIG_PRESET_ARG := $(if $(strip $(MENUCONFIG_PRESET)),--preset $(MENUCONFIG_PRESET),)
|
||||
|
||||
ifneq ($(strip $(LIMINE_SKIP_CONFIGURE)),)
|
||||
CMAKE_PASSTHROUGH_ARGS += -DLIMINE_SKIP_CONFIGURE=$(LIMINE_SKIP_CONFIGURE)
|
||||
@@ -49,7 +53,7 @@ ifneq ($(strip $(READELF_FOR_TARGET)),)
|
||||
CMAKE_PASSTHROUGH_ARGS += -DREADELF_FOR_TARGET=$(READELF_FOR_TARGET)
|
||||
endif
|
||||
|
||||
.PHONY: all configure reconfigure setup setup-tools setup-limine kernel userapps ramdisk-root ramdisk iso run debug clean clean-all help
|
||||
.PHONY: all configure reconfigure menuconfig menuconfig-gui setup setup-tools setup-limine kernel userapps ramdisk-root ramdisk iso run debug clean clean-all help
|
||||
|
||||
all: iso
|
||||
|
||||
@@ -60,6 +64,28 @@ reconfigure:
|
||||
> @rm -rf $(CMAKE_BUILD_DIR)
|
||||
> @$(MAKE) configure CMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE) CMAKE_GENERATOR="$(CMAKE_GENERATOR)" CMAKE_EXTRA_ARGS="$(CMAKE_EXTRA_ARGS)" NO_COLOR="$(NO_COLOR)" LIMINE_SKIP_CONFIGURE="$(LIMINE_SKIP_CONFIGURE)" LIMINE_REF="$(LIMINE_REF)" LIMINE_REPO="$(LIMINE_REPO)" LIMINE_DIR="$(LIMINE_DIR)" LIMINE_BIN_DIR="$(LIMINE_BIN_DIR)" OBJCOPY_FOR_TARGET="$(OBJCOPY_FOR_TARGET)" OBJDUMP_FOR_TARGET="$(OBJDUMP_FOR_TARGET)" READELF_FOR_TARGET="$(READELF_FOR_TARGET)"
|
||||
|
||||
menuconfig:
|
||||
> @if command -v $(PYTHON) >/dev/null 2>&1; then \
|
||||
> $(PYTHON) scripts/menuconfig.py $(MENUCONFIG_PRESET_ARG) $(MENUCONFIG_ARGS); \
|
||||
> elif command -v python >/dev/null 2>&1; then \
|
||||
> python scripts/menuconfig.py $(MENUCONFIG_PRESET_ARG) $(MENUCONFIG_ARGS); \
|
||||
> else \
|
||||
> echo "python3/python not found"; \
|
||||
> exit 1; \
|
||||
> fi
|
||||
> @$(MAKE) configure CMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE) CMAKE_GENERATOR="$(CMAKE_GENERATOR)" CMAKE_EXTRA_ARGS="$(CMAKE_EXTRA_ARGS)" NO_COLOR="$(NO_COLOR)" LIMINE_SKIP_CONFIGURE="$(LIMINE_SKIP_CONFIGURE)" LIMINE_REF="$(LIMINE_REF)" LIMINE_REPO="$(LIMINE_REPO)" LIMINE_DIR="$(LIMINE_DIR)" LIMINE_BIN_DIR="$(LIMINE_BIN_DIR)" OBJCOPY_FOR_TARGET="$(OBJCOPY_FOR_TARGET)" OBJDUMP_FOR_TARGET="$(OBJDUMP_FOR_TARGET)" READELF_FOR_TARGET="$(READELF_FOR_TARGET)"
|
||||
|
||||
menuconfig-gui:
|
||||
> @if command -v $(PYTHON) >/dev/null 2>&1; then \
|
||||
> $(PYTHON) scripts/menuconfig.py --gui $(MENUCONFIG_PRESET_ARG) $(MENUCONFIG_ARGS); \
|
||||
> elif command -v python >/dev/null 2>&1; then \
|
||||
> python scripts/menuconfig.py --gui $(MENUCONFIG_PRESET_ARG) $(MENUCONFIG_ARGS); \
|
||||
> else \
|
||||
> echo "python3/python not found"; \
|
||||
> exit 1; \
|
||||
> fi
|
||||
> @$(MAKE) configure CMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE) CMAKE_GENERATOR="$(CMAKE_GENERATOR)" CMAKE_EXTRA_ARGS="$(CMAKE_EXTRA_ARGS)" NO_COLOR="$(NO_COLOR)" LIMINE_SKIP_CONFIGURE="$(LIMINE_SKIP_CONFIGURE)" LIMINE_REF="$(LIMINE_REF)" LIMINE_REPO="$(LIMINE_REPO)" LIMINE_DIR="$(LIMINE_DIR)" LIMINE_BIN_DIR="$(LIMINE_BIN_DIR)" OBJCOPY_FOR_TARGET="$(OBJCOPY_FOR_TARGET)" OBJDUMP_FOR_TARGET="$(OBJDUMP_FOR_TARGET)" READELF_FOR_TARGET="$(READELF_FOR_TARGET)"
|
||||
|
||||
setup: configure
|
||||
> @$(CMAKE) --build $(CMAKE_BUILD_DIR) --target setup
|
||||
|
||||
@@ -107,6 +133,8 @@ clean-all:
|
||||
help:
|
||||
> @echo "CLeonOS (CMake-backed wrapper)"
|
||||
> @echo " make configure"
|
||||
> @echo " make menuconfig"
|
||||
> @echo " make menuconfig-gui"
|
||||
> @echo " make setup"
|
||||
> @echo " make userapps"
|
||||
> @echo " make iso"
|
||||
@@ -119,3 +147,7 @@ help:
|
||||
> @echo " make configure CMAKE_EXTRA_ARGS='-DLIMINE_SKIP_CONFIGURE=1 -DOBJCOPY_FOR_TARGET=objcopy'"
|
||||
> @echo "Direct passthrough is also supported:"
|
||||
> @echo " make run LIMINE_SKIP_CONFIGURE=1"
|
||||
> @echo "Preset examples:"
|
||||
> @echo " make menuconfig MENUCONFIG_PRESET=full"
|
||||
> @echo " make menuconfig MENUCONFIG_PRESET=minimal"
|
||||
> @echo " make menuconfig-gui MENUCONFIG_PRESET=dev"
|
||||
|
||||
125
README.md
Normal file
125
README.md
Normal file
@@ -0,0 +1,125 @@
|
||||
# CLeonOS
|
||||
|
||||
[English](README.md) | [简体中文](README.zh-CN.md)
|
||||
|
||||
Experimental x86_64 operating system project with a C kernel, Rust-assisted runtime pieces, user-space ELF apps, and a stage-based development history.
|
||||
|
||||
## Highlights
|
||||
|
||||
- x86_64 kernel booted by Limine
|
||||
- RAM-disk VFS layout (`/system`, `/shell`, `/temp`, `/driver`)
|
||||
- Virtual TTY subsystem (multi TTY, ANSI handling, cursor, PSF font support)
|
||||
- Keyboard and mouse input stack, plus desktop mode on TTY2
|
||||
- User-space ELF app model with syscall ABI (`int 0x80`)
|
||||
- User shell with external command apps (`ls`, `cat`, `grep`, `mkdir`, `cp`, `mv`, `rm`, etc.)
|
||||
- Pipe and redirection support in user shell (`|`, `>`, `>>`)
|
||||
- Optional host-side CLeonOS-Wine runner (Python + Unicorn) in [`wine/`](wine)
|
||||
|
||||
## Repository Layout
|
||||
|
||||
```text
|
||||
.
|
||||
|- clks/ # Kernel sources (arch, drivers, scheduler, tty, syscall, ...)
|
||||
|- cleonos/ # Userland runtime, libc-like layer, user apps, Rust user library
|
||||
|- ramdisk/ # Static files copied into runtime ramdisk
|
||||
|- configs/ # Boot configuration (Limine)
|
||||
|- cmake/ # Shared CMake scripts (tool checks, logging, limine setup)
|
||||
|- docs/ # Stage documents and syscall reference
|
||||
|- wine/ # Host runner for CLeonOS user ELF (no full VM required)
|
||||
|- CMakeLists.txt # Main build definition
|
||||
|- Makefile # Developer-friendly wrapper around CMake targets
|
||||
```
|
||||
|
||||
## Build Requirements
|
||||
|
||||
Minimum required tools:
|
||||
|
||||
- `cmake` (>= 3.20)
|
||||
- `make`
|
||||
- `git`
|
||||
- `tar`
|
||||
- `xorriso`
|
||||
- `sh` (POSIX shell)
|
||||
- `rustc`
|
||||
- Kernel/user toolchain (resolved automatically with fallback):
|
||||
- kernel: `x86_64-elf-gcc`/`x86_64-elf-ld` (or fallback `gcc`/`clang` + `ld.lld`)
|
||||
- user: `cc` + `ld`
|
||||
|
||||
For building Limine from source, install extras such as `autoconf`, `automake`, `libtool`, `pkg-config`, `mtools`, and `nasm`.
|
||||
|
||||
For runtime:
|
||||
|
||||
- `qemu-system-x86_64` (for `make run` / `make debug`)
|
||||
|
||||
## Quick Start
|
||||
|
||||
```bash
|
||||
git clone <your-repo-url>
|
||||
cd cleonos
|
||||
git submodule update --init --recursive
|
||||
make run
|
||||
```
|
||||
|
||||
If you already have Limine artifacts and want to skip configure:
|
||||
|
||||
```bash
|
||||
make run LIMINE_SKIP_CONFIGURE=1
|
||||
```
|
||||
|
||||
## Common Targets
|
||||
|
||||
- `make setup` - check tools and prepare Limine
|
||||
- `make kernel` - build kernel ELF
|
||||
- `make userapps` - build user-space ELF apps
|
||||
- `make ramdisk` - package runtime ramdisk
|
||||
- `make iso` - build bootable ISO
|
||||
- `make run` - launch QEMU
|
||||
- `make debug` - launch QEMU with `-s -S` for GDB
|
||||
- `make clean` - clean `build/x86_64`
|
||||
- `make clean-all` - clean all build output
|
||||
|
||||
## Debugging (GDB)
|
||||
|
||||
Start debug VM:
|
||||
|
||||
```bash
|
||||
make debug
|
||||
```
|
||||
|
||||
Attach in another terminal:
|
||||
|
||||
```bash
|
||||
gdb build/x86_64/clks_kernel.elf
|
||||
(gdb) target remote :1234
|
||||
```
|
||||
|
||||
## User Shell Examples
|
||||
|
||||
```sh
|
||||
help
|
||||
ls /shell
|
||||
cat /shell/init.cmd
|
||||
grep -n exec /shell/init.cmd
|
||||
cat /shell/init.cmd | grep -n exec
|
||||
ls /shell > /temp/shell_list.txt
|
||||
```
|
||||
|
||||
## Documentation
|
||||
|
||||
- Stage index: [`docs/README.md`](docs/README.md)
|
||||
- Syscall ABI reference: [`docs/syscall.md`](docs/syscall.md)
|
||||
|
||||
## CI
|
||||
|
||||
GitHub Actions workflow [`build-os.yml`](.github/workflows/build-os.yml) builds the OS ISO on push and pull request, and uploads the ISO as an artifact.
|
||||
|
||||
## Contributing
|
||||
|
||||
1. Fork and create a feature branch.
|
||||
2. Keep changes stage-oriented and update docs when behavior changes.
|
||||
3. Run at least `make iso` before opening a PR.
|
||||
4. Include boot log snippets or screenshots for kernel/user visible changes.
|
||||
|
||||
## License
|
||||
|
||||
Apache-2.0. See [`License`](License).
|
||||
125
README.zh-CN.md
Normal file
125
README.zh-CN.md
Normal file
@@ -0,0 +1,125 @@
|
||||
# CLeonOS
|
||||
|
||||
[English](README.md) | [简体中文](README.zh-CN.md)
|
||||
|
||||
一个实验性的 x86_64 操作系统项目,包含 C 内核、Rust 辅助运行时代码、用户态 ELF 应用,以及按 Stage 演进的开发历史。
|
||||
|
||||
## 项目特性
|
||||
|
||||
- 基于 Limine 启动的 x86_64 内核
|
||||
- RAM-disk VFS 目录布局(`/system`、`/shell`、`/temp`、`/driver`)
|
||||
- 虚拟 TTY 子系统(多 TTY、ANSI、光标、PSF 字体)
|
||||
- 键盘/鼠标输入栈,TTY2 提供桌面模式
|
||||
- 用户态 ELF 应用模型,syscall ABI 使用 `int 0x80`
|
||||
- 用户 Shell + 外部命令 ELF(`ls`、`cat`、`grep`、`mkdir`、`cp`、`mv`、`rm` 等)
|
||||
- Shell 管道与重定向(`|`、`>`、`>>`)
|
||||
- 可选主机侧 CLeonOS-Wine 运行器(Python + Unicorn),位于 [`wine/`](wine)
|
||||
|
||||
## 仓库结构
|
||||
|
||||
```text
|
||||
.
|
||||
|- clks/ # 内核源码(架构、驱动、调度、TTY、syscall 等)
|
||||
|- cleonos/ # 用户态运行时、基础库、用户应用、Rust 用户库
|
||||
|- ramdisk/ # 运行时 ramdisk 的静态文件
|
||||
|- configs/ # 启动配置(Limine)
|
||||
|- cmake/ # CMake 公共脚本(工具检查、日志、limine 初始化)
|
||||
|- docs/ # Stage 文档与 syscall 文档
|
||||
|- wine/ # 主机侧用户 ELF 运行器(无需完整虚拟机)
|
||||
|- CMakeLists.txt # 主构建定义
|
||||
|- Makefile # 面向开发者的 CMake 包装入口
|
||||
```
|
||||
|
||||
## 构建依赖
|
||||
|
||||
最低需要:
|
||||
|
||||
- `cmake`(>= 3.20)
|
||||
- `make`
|
||||
- `git`
|
||||
- `tar`
|
||||
- `xorriso`
|
||||
- `sh`(POSIX shell)
|
||||
- `rustc`
|
||||
- 内核/用户工具链(会自动回退查找):
|
||||
- 内核:`x86_64-elf-gcc` / `x86_64-elf-ld`(可回退到 `gcc`/`clang` + `ld.lld`)
|
||||
- 用户态:`cc` + `ld`
|
||||
|
||||
如需从源码构建 Limine,请安装额外依赖:`autoconf`、`automake`、`libtool`、`pkg-config`、`mtools`、`nasm`。
|
||||
|
||||
运行时还需要:
|
||||
|
||||
- `qemu-system-x86_64`(用于 `make run` / `make debug`)
|
||||
|
||||
## 快速开始
|
||||
|
||||
```bash
|
||||
git clone <your-repo-url>
|
||||
cd cleonos
|
||||
git submodule update --init --recursive
|
||||
make run
|
||||
```
|
||||
|
||||
如果你已经准备好 Limine 产物,可跳过 configure:
|
||||
|
||||
```bash
|
||||
make run LIMINE_SKIP_CONFIGURE=1
|
||||
```
|
||||
|
||||
## 常用目标
|
||||
|
||||
- `make setup` - 检查工具并准备 Limine
|
||||
- `make kernel` - 构建内核 ELF
|
||||
- `make userapps` - 构建用户态 ELF 应用
|
||||
- `make ramdisk` - 打包运行时 ramdisk
|
||||
- `make iso` - 生成可启动 ISO
|
||||
- `make run` - 启动 QEMU
|
||||
- `make debug` - 以 `-s -S` 启动 QEMU 供 GDB 附加
|
||||
- `make clean` - 清理 `build/x86_64`
|
||||
- `make clean-all` - 清理全部构建产物
|
||||
|
||||
## 调试(GDB)
|
||||
|
||||
先启动调试 VM:
|
||||
|
||||
```bash
|
||||
make debug
|
||||
```
|
||||
|
||||
再在另一个终端连接:
|
||||
|
||||
```bash
|
||||
gdb build/x86_64/clks_kernel.elf
|
||||
(gdb) target remote :1234
|
||||
```
|
||||
|
||||
## User Shell 示例
|
||||
|
||||
```sh
|
||||
help
|
||||
ls /shell
|
||||
cat /shell/init.cmd
|
||||
grep -n exec /shell/init.cmd
|
||||
cat /shell/init.cmd | grep -n exec
|
||||
ls /shell > /temp/shell_list.txt
|
||||
```
|
||||
|
||||
## 文档
|
||||
|
||||
- Stage 索引:[`docs/README.md`](docs/README.md)
|
||||
- Syscall ABI 文档:[`docs/syscall.md`](docs/syscall.md)
|
||||
|
||||
## CI
|
||||
|
||||
GitHub Actions 工作流 [`build-os.yml`](.github/workflows/build-os.yml) 会在 push/PR 时自动构建 ISO,并上传为 artifact。
|
||||
|
||||
## 贡献指南
|
||||
|
||||
1. Fork 仓库并创建功能分支。
|
||||
2. 尽量按 Stage 组织改动,并同步更新文档。
|
||||
3. 提交 PR 前至少执行一次 `make iso`。
|
||||
4. 涉及可见行为变化时,附上启动日志片段或截图。
|
||||
|
||||
## 许可证
|
||||
|
||||
Apache-2.0。详见 [`License`](License)。
|
||||
@@ -1,6 +1,53 @@
|
||||
#include "shell/shell_internal.h"
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
return ush_command_program_main("ansi");
|
||||
#include "cmd_runtime.h"
|
||||
static int ush_cmd_ansi(void) {
|
||||
ush_writeln("\x1B[1;36mansi color demo\x1B[0m");
|
||||
ush_writeln(" \x1B[30mblack\x1B[0m \x1B[31mred\x1B[0m \x1B[32mgreen\x1B[0m \x1B[33myellow\x1B[0m");
|
||||
ush_writeln(" \x1B[34mblue\x1B[0m \x1B[35mmagenta\x1B[0m \x1B[36mcyan\x1B[0m \x1B[37mwhite\x1B[0m");
|
||||
ush_writeln(" \x1B[90mbright-black\x1B[0m \x1B[91mbright-red\x1B[0m \x1B[92mbright-green\x1B[0m \x1B[93mbright-yellow\x1B[0m");
|
||||
ush_writeln(" \x1B[94mbright-blue\x1B[0m \x1B[95mbright-magenta\x1B[0m \x1B[96mbright-cyan\x1B[0m \x1B[97mbright-white\x1B[0m");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
ush_cmd_ctx ctx;
|
||||
ush_cmd_ret ret;
|
||||
ush_state sh;
|
||||
char initial_cwd[USH_PATH_MAX];
|
||||
int has_context = 0;
|
||||
int success = 0;
|
||||
|
||||
ush_zero(&ctx, (u64)sizeof(ctx));
|
||||
ush_zero(&ret, (u64)sizeof(ret));
|
||||
ush_init_state(&sh);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
|
||||
if (ush_command_ctx_read(&ctx) != 0) {
|
||||
if (ctx.cmd[0] != '\0' && ush_streq(ctx.cmd, "ansi") != 0) {
|
||||
has_context = 1;
|
||||
if (ctx.cwd[0] == '/') {
|
||||
ush_copy(sh.cwd, (u64)sizeof(sh.cwd), ctx.cwd);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
success = ush_cmd_ansi();
|
||||
|
||||
if (has_context != 0) {
|
||||
if (ush_streq(sh.cwd, initial_cwd) == 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_CWD;
|
||||
ush_copy(ret.cwd, (u64)sizeof(ret.cwd), sh.cwd);
|
||||
}
|
||||
|
||||
if (sh.exit_requested != 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_EXIT;
|
||||
ret.exit_code = sh.exit_code;
|
||||
}
|
||||
|
||||
(void)ush_command_ret_write(&ret);
|
||||
}
|
||||
|
||||
return (success != 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
|
||||
176
cleonos/c/apps/ansitest_main.c
Normal file
176
cleonos/c/apps/ansitest_main.c
Normal file
@@ -0,0 +1,176 @@
|
||||
#include "cmd_runtime.h"
|
||||
static int ush_cmd_ansi(void) {
|
||||
ush_writeln("\x1B[1;36mansi color demo\x1B[0m");
|
||||
ush_writeln(" \x1B[30mblack\x1B[0m \x1B[31mred\x1B[0m \x1B[32mgreen\x1B[0m \x1B[33myellow\x1B[0m");
|
||||
ush_writeln(" \x1B[34mblue\x1B[0m \x1B[35mmagenta\x1B[0m \x1B[36mcyan\x1B[0m \x1B[37mwhite\x1B[0m");
|
||||
ush_writeln(" \x1B[90mbright-black\x1B[0m \x1B[91mbright-red\x1B[0m \x1B[92mbright-green\x1B[0m \x1B[93mbright-yellow\x1B[0m");
|
||||
ush_writeln(" \x1B[94mbright-blue\x1B[0m \x1B[95mbright-magenta\x1B[0m \x1B[96mbright-cyan\x1B[0m \x1B[97mbright-white\x1B[0m");
|
||||
return 1;
|
||||
}
|
||||
|
||||
static u64 ush_ansitest_u64_to_dec(char *out, u64 out_size, u64 value) {
|
||||
char rev[10];
|
||||
u64 digits = 0ULL;
|
||||
u64 i;
|
||||
|
||||
if (out == (char *)0 || out_size == 0ULL) {
|
||||
return 0ULL;
|
||||
}
|
||||
|
||||
if (value == 0U) {
|
||||
if (out_size < 2ULL) {
|
||||
return 0ULL;
|
||||
}
|
||||
|
||||
out[0] = '0';
|
||||
out[1] = '\0';
|
||||
return 1ULL;
|
||||
}
|
||||
|
||||
while (value > 0U && digits < (u64)sizeof(rev)) {
|
||||
rev[digits++] = (char)('0' + (value % 10U));
|
||||
value /= 10U;
|
||||
}
|
||||
|
||||
if (digits + 1ULL > out_size) {
|
||||
out[0] = '\0';
|
||||
return 0ULL;
|
||||
}
|
||||
|
||||
for (i = 0ULL; i < digits; i++) {
|
||||
out[i] = rev[digits - 1ULL - i];
|
||||
}
|
||||
|
||||
out[digits] = '\0';
|
||||
return digits;
|
||||
}
|
||||
|
||||
static void ush_ansitest_emit_bg256(u64 index) {
|
||||
char num[4];
|
||||
char seq[24];
|
||||
u64 digits;
|
||||
u64 p = 0ULL;
|
||||
u64 i;
|
||||
|
||||
if (index > 255U) {
|
||||
index = 255U;
|
||||
}
|
||||
|
||||
digits = ush_ansitest_u64_to_dec(num, (u64)sizeof(num), index);
|
||||
if (digits == 0ULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
seq[p++] = '\x1B';
|
||||
seq[p++] = '[';
|
||||
seq[p++] = '4';
|
||||
seq[p++] = '8';
|
||||
seq[p++] = ';';
|
||||
seq[p++] = '5';
|
||||
seq[p++] = ';';
|
||||
|
||||
for (i = 0ULL; i < digits && p + 1ULL < (u64)sizeof(seq); i++) {
|
||||
seq[p++] = num[i];
|
||||
}
|
||||
|
||||
if (p + 7ULL >= (u64)sizeof(seq)) {
|
||||
return;
|
||||
}
|
||||
|
||||
seq[p++] = 'm';
|
||||
seq[p++] = ' ';
|
||||
seq[p++] = ' ';
|
||||
seq[p++] = '\x1B';
|
||||
seq[p++] = '[';
|
||||
seq[p++] = '0';
|
||||
seq[p++] = 'm';
|
||||
seq[p] = '\0';
|
||||
|
||||
ush_write(seq);
|
||||
}
|
||||
|
||||
static int ush_cmd_ansitest(void) {
|
||||
u64 i;
|
||||
|
||||
ush_writeln("\x1B[1;96mANSI test suite\x1B[0m");
|
||||
ush_writeln("styles: \x1B[1mbold\x1B[0m \x1B[7minverse\x1B[0m \x1B[4munderline\x1B[0m");
|
||||
ush_writeln("16-color demo:");
|
||||
(void)ush_cmd_ansi();
|
||||
|
||||
ush_writeln("256-color palette (0..255):");
|
||||
for (i = 0ULL; i < 256ULL; i++) {
|
||||
ush_ansitest_emit_bg256(i);
|
||||
if ((i % 32ULL) == 31ULL) {
|
||||
ush_write_char('\n');
|
||||
}
|
||||
}
|
||||
ush_write_char('\n');
|
||||
|
||||
ush_writeln("truecolor demo:");
|
||||
ush_writeln(" \x1B[38;2;255;64;64mRGB(255,64,64)\x1B[0m \x1B[38;2;64;255;64mRGB(64,255,64)\x1B[0m \x1B[38;2;64;128;255mRGB(64,128,255)\x1B[0m");
|
||||
|
||||
ush_writeln("cursor control demo:");
|
||||
ush_write(" 0123456789");
|
||||
ush_write("\x1B[5D");
|
||||
ush_write("\x1B[93m<OK>\x1B[0m");
|
||||
ush_write_char('\n');
|
||||
|
||||
ush_write(" save");
|
||||
ush_write("\x1B[s");
|
||||
ush_write("....");
|
||||
ush_write("\x1B[u");
|
||||
ush_write("\x1B[92m<restore>\x1B[0m");
|
||||
ush_write_char('\n');
|
||||
|
||||
ush_writeln("erase-line demo:");
|
||||
ush_write(" left|right-to-clear");
|
||||
ush_write("\x1B[14D\x1B[K");
|
||||
ush_write_char('\n');
|
||||
|
||||
ush_writeln("ansitest done");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
ush_cmd_ctx ctx;
|
||||
ush_cmd_ret ret;
|
||||
ush_state sh;
|
||||
char initial_cwd[USH_PATH_MAX];
|
||||
int has_context = 0;
|
||||
int success = 0;
|
||||
|
||||
ush_zero(&ctx, (u64)sizeof(ctx));
|
||||
ush_zero(&ret, (u64)sizeof(ret));
|
||||
ush_init_state(&sh);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
|
||||
if (ush_command_ctx_read(&ctx) != 0) {
|
||||
if (ctx.cmd[0] != '\0' && ush_streq(ctx.cmd, "ansitest") != 0) {
|
||||
has_context = 1;
|
||||
if (ctx.cwd[0] == '/') {
|
||||
ush_copy(sh.cwd, (u64)sizeof(sh.cwd), ctx.cwd);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
success = ush_cmd_ansitest();
|
||||
|
||||
if (has_context != 0) {
|
||||
if (ush_streq(sh.cwd, initial_cwd) == 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_CWD;
|
||||
ush_copy(ret.cwd, (u64)sizeof(ret.cwd), sh.cwd);
|
||||
}
|
||||
|
||||
if (sh.exit_requested != 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_EXIT;
|
||||
ret.exit_code = sh.exit_code;
|
||||
}
|
||||
|
||||
(void)ush_command_ret_write(&ret);
|
||||
}
|
||||
|
||||
return (success != 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,91 @@
|
||||
#include "shell/shell_internal.h"
|
||||
#include "cmd_runtime.h"
|
||||
static int ush_cmd_append(const ush_state *sh, const char *arg) {
|
||||
char path_arg[USH_PATH_MAX];
|
||||
char abs_path[USH_PATH_MAX];
|
||||
const char *payload = (const char *)0;
|
||||
u64 payload_len;
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
return ush_command_program_main("append");
|
||||
if (arg == (const char *)0 || arg[0] == '\0') {
|
||||
ush_writeln("append: usage append <file> <text>");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_split_first_and_rest(arg, path_arg, (u64)sizeof(path_arg), &payload) == 0) {
|
||||
ush_writeln("append: usage append <file> <text>");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_resolve_path(sh, path_arg, abs_path, (u64)sizeof(abs_path)) == 0) {
|
||||
ush_writeln("append: invalid path");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_path_is_under_temp(abs_path) == 0) {
|
||||
ush_writeln("append: target must be under /temp");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (payload == (const char *)0 || payload[0] == '\0') {
|
||||
if (ush_pipeline_stdin_text == (const char *)0) {
|
||||
ush_writeln("append: usage append <file> <text>");
|
||||
return 0;
|
||||
}
|
||||
payload = ush_pipeline_stdin_text;
|
||||
payload_len = ush_pipeline_stdin_len;
|
||||
} else {
|
||||
payload_len = ush_strlen(payload);
|
||||
}
|
||||
|
||||
if (cleonos_sys_fs_append(abs_path, payload, payload_len) == 0ULL) {
|
||||
ush_writeln("append: failed");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
ush_cmd_ctx ctx;
|
||||
ush_cmd_ret ret;
|
||||
ush_state sh;
|
||||
char initial_cwd[USH_PATH_MAX];
|
||||
int has_context = 0;
|
||||
int success = 0;
|
||||
const char *arg = "";
|
||||
|
||||
ush_zero(&ctx, (u64)sizeof(ctx));
|
||||
ush_zero(&ret, (u64)sizeof(ret));
|
||||
ush_init_state(&sh);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
|
||||
if (ush_command_ctx_read(&ctx) != 0) {
|
||||
if (ctx.cmd[0] != '\0' && ush_streq(ctx.cmd, "append") != 0) {
|
||||
has_context = 1;
|
||||
arg = ctx.arg;
|
||||
if (ctx.cwd[0] == '/') {
|
||||
ush_copy(sh.cwd, (u64)sizeof(sh.cwd), ctx.cwd);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
success = ush_cmd_append(&sh, arg);
|
||||
|
||||
if (has_context != 0) {
|
||||
if (ush_streq(sh.cwd, initial_cwd) == 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_CWD;
|
||||
ush_copy(ret.cwd, (u64)sizeof(ret.cwd), sh.cwd);
|
||||
}
|
||||
|
||||
if (sh.exit_requested != 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_EXIT;
|
||||
ret.exit_code = sh.exit_code;
|
||||
}
|
||||
|
||||
(void)ush_command_ret_write(&ret);
|
||||
}
|
||||
|
||||
return (success != 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
|
||||
61
cleonos/c/apps/args_main.c
Normal file
61
cleonos/c/apps/args_main.c
Normal file
@@ -0,0 +1,61 @@
|
||||
#include "cmd_runtime.h"
|
||||
|
||||
static void ush_args_write_u64_dec(u64 value) {
|
||||
char tmp[32];
|
||||
u64 len = 0ULL;
|
||||
|
||||
if (value == 0ULL) {
|
||||
ush_write_char('0');
|
||||
return;
|
||||
}
|
||||
|
||||
while (value > 0ULL && len < (u64)sizeof(tmp)) {
|
||||
tmp[len++] = (char)('0' + (value % 10ULL));
|
||||
value /= 10ULL;
|
||||
}
|
||||
|
||||
while (len > 0ULL) {
|
||||
len--;
|
||||
ush_write_char(tmp[len]);
|
||||
}
|
||||
}
|
||||
|
||||
int cleonos_app_main(int argc, char **argv, char **envp) {
|
||||
int i;
|
||||
int env_count = 0;
|
||||
|
||||
ush_write("argc=");
|
||||
ush_args_write_u64_dec((u64)((argc >= 0) ? argc : 0));
|
||||
ush_write_char('\n');
|
||||
|
||||
for (i = 0; i < argc; i++) {
|
||||
ush_write("argv[");
|
||||
ush_args_write_u64_dec((u64)i);
|
||||
ush_write("]=");
|
||||
|
||||
if (argv != (char **)0 && argv[i] != (char *)0) {
|
||||
ush_writeln(argv[i]);
|
||||
} else {
|
||||
ush_writeln("(null)");
|
||||
}
|
||||
}
|
||||
|
||||
if (envp != (char **)0) {
|
||||
while (envp[env_count] != (char *)0 && env_count < 64) {
|
||||
env_count++;
|
||||
}
|
||||
}
|
||||
|
||||
ush_write("envc=");
|
||||
ush_args_write_u64_dec((u64)env_count);
|
||||
ush_write_char('\n');
|
||||
|
||||
for (i = 0; i < env_count; i++) {
|
||||
ush_write("env[");
|
||||
ush_args_write_u64_dec((u64)i);
|
||||
ush_write("]=");
|
||||
ush_writeln(envp[i]);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
126
cleonos/c/apps/bg_main.c
Normal file
126
cleonos/c/apps/bg_main.c
Normal file
@@ -0,0 +1,126 @@
|
||||
#include "cmd_runtime.h"
|
||||
|
||||
static int ush_bg_resume_pid(const char *pid_text) {
|
||||
u64 pid = 0ULL;
|
||||
u64 ret;
|
||||
|
||||
if (pid_text == (const char *)0 || ush_parse_u64_dec(pid_text, &pid) == 0 || pid == 0ULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = cleonos_sys_proc_kill(pid, CLEONOS_SIGCONT);
|
||||
|
||||
if (ret == (u64)-1) {
|
||||
ush_writeln("bg: pid not found");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (ret == 0ULL) {
|
||||
ush_writeln("bg: target cannot be resumed right now");
|
||||
return 1;
|
||||
}
|
||||
|
||||
ush_write("bg: resumed [");
|
||||
ush_write_hex_u64(pid);
|
||||
ush_writeln("]");
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int ush_cmd_bg(const ush_state *sh, const char *arg) {
|
||||
char target[USH_PATH_MAX];
|
||||
char argv_line[USH_ARG_MAX];
|
||||
char env_line[USH_PATH_MAX + 32ULL];
|
||||
const char *rest = "";
|
||||
char path[USH_PATH_MAX];
|
||||
u64 pid;
|
||||
|
||||
if (sh == (const ush_state *)0 || arg == (const char *)0 || arg[0] == '\0') {
|
||||
ush_writeln("bg: usage bg <path|name> [args...]");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_split_first_and_rest(arg, target, (u64)sizeof(target), &rest) == 0) {
|
||||
ush_writeln("bg: usage bg <path|name> [args...]");
|
||||
return 0;
|
||||
}
|
||||
|
||||
argv_line[0] = '\0';
|
||||
if (rest != (const char *)0 && rest[0] != '\0') {
|
||||
ush_copy(argv_line, (u64)sizeof(argv_line), rest);
|
||||
}
|
||||
|
||||
if (argv_line[0] == '\0' && ush_bg_resume_pid(target) != 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (ush_resolve_exec_path(sh, target, path, (u64)sizeof(path)) == 0) {
|
||||
ush_writeln("bg: invalid target");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_path_is_under_system(path) != 0) {
|
||||
ush_writeln("bg: /system/*.elf is kernel-mode (KELF), not user-exec");
|
||||
return 0;
|
||||
}
|
||||
|
||||
env_line[0] = '\0';
|
||||
ush_copy(env_line, (u64)sizeof(env_line), "PWD=");
|
||||
ush_copy(env_line + 4, (u64)(sizeof(env_line) - 4ULL), sh->cwd);
|
||||
|
||||
pid = cleonos_sys_spawn_pathv(path, argv_line, env_line);
|
||||
|
||||
if (pid == (u64)-1) {
|
||||
ush_writeln("bg: request failed");
|
||||
return 0;
|
||||
}
|
||||
|
||||
ush_write("[");
|
||||
ush_write_hex_u64(pid);
|
||||
ush_write("] ");
|
||||
ush_writeln(path);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
ush_cmd_ctx ctx;
|
||||
ush_cmd_ret ret;
|
||||
ush_state sh;
|
||||
char initial_cwd[USH_PATH_MAX];
|
||||
int has_context = 0;
|
||||
int success = 0;
|
||||
const char *arg = "";
|
||||
|
||||
ush_zero(&ctx, (u64)sizeof(ctx));
|
||||
ush_zero(&ret, (u64)sizeof(ret));
|
||||
ush_init_state(&sh);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
|
||||
if (ush_command_ctx_read(&ctx) != 0) {
|
||||
if (ctx.cmd[0] != '\0' && ush_streq(ctx.cmd, "bg") != 0) {
|
||||
has_context = 1;
|
||||
arg = ctx.arg;
|
||||
if (ctx.cwd[0] == '/') {
|
||||
ush_copy(sh.cwd, (u64)sizeof(sh.cwd), ctx.cwd);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
success = ush_cmd_bg(&sh, arg);
|
||||
|
||||
if (has_context != 0) {
|
||||
if (ush_streq(sh.cwd, initial_cwd) == 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_CWD;
|
||||
ush_copy(ret.cwd, (u64)sizeof(ret.cwd), sh.cwd);
|
||||
}
|
||||
|
||||
if (sh.exit_requested != 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_EXIT;
|
||||
ret.exit_code = sh.exit_code;
|
||||
}
|
||||
|
||||
(void)ush_command_ret_write(&ret);
|
||||
}
|
||||
|
||||
return (success != 0) ? 0 : 1;
|
||||
}
|
||||
@@ -1,6 +1,108 @@
|
||||
#include "shell/shell_internal.h"
|
||||
#include "cmd_runtime.h"
|
||||
#include <stdio.h>
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
return ush_command_program_main("cat");
|
||||
static int ush_cmd_cat(const ush_state *sh, const char *arg) {
|
||||
char path[USH_PATH_MAX];
|
||||
char buf[1024];
|
||||
u64 fd;
|
||||
|
||||
if (arg == (const char *)0 || arg[0] == '\0') {
|
||||
if (ush_pipeline_stdin_text != (const char *)0) {
|
||||
(void)fputs(ush_pipeline_stdin_text, 1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
(void)puts("cat: file path required");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_resolve_path(sh, arg, path, (u64)sizeof(path)) == 0) {
|
||||
(void)puts("cat: invalid path");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (cleonos_sys_fs_stat_type(path) != 1ULL) {
|
||||
(void)puts("cat: file not found");
|
||||
return 0;
|
||||
}
|
||||
|
||||
fd = cleonos_sys_fd_open(path, CLEONOS_O_RDONLY, 0ULL);
|
||||
if (fd == (u64)-1) {
|
||||
(void)puts("cat: open failed");
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
u64 got = cleonos_sys_fd_read(fd, buf, (u64)sizeof(buf));
|
||||
u64 written_total = 0ULL;
|
||||
|
||||
if (got == (u64)-1) {
|
||||
(void)cleonos_sys_fd_close(fd);
|
||||
(void)puts("cat: read failed");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (got == 0ULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
while (written_total < got) {
|
||||
u64 written = cleonos_sys_fd_write(1ULL, buf + written_total, got - written_total);
|
||||
if (written == (u64)-1 || written == 0ULL) {
|
||||
(void)cleonos_sys_fd_close(fd);
|
||||
(void)puts("cat: write failed");
|
||||
return 0;
|
||||
}
|
||||
written_total += written;
|
||||
}
|
||||
}
|
||||
|
||||
(void)cleonos_sys_fd_close(fd);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
ush_cmd_ctx ctx;
|
||||
ush_cmd_ret ret;
|
||||
ush_state sh;
|
||||
char initial_cwd[USH_PATH_MAX];
|
||||
int has_context = 0;
|
||||
int success = 0;
|
||||
const char *arg = "";
|
||||
|
||||
ush_zero(&ctx, (u64)sizeof(ctx));
|
||||
ush_zero(&ret, (u64)sizeof(ret));
|
||||
ush_init_state(&sh);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
|
||||
if (ush_command_ctx_read(&ctx) != 0) {
|
||||
if (ctx.cmd[0] != '\0' && ush_streq(ctx.cmd, "cat") != 0) {
|
||||
has_context = 1;
|
||||
arg = ctx.arg;
|
||||
if (ctx.cwd[0] == '/') {
|
||||
ush_copy(sh.cwd, (u64)sizeof(sh.cwd), ctx.cwd);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
success = ush_cmd_cat(&sh, arg);
|
||||
|
||||
if (has_context != 0) {
|
||||
if (ush_streq(sh.cwd, initial_cwd) == 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_CWD;
|
||||
ush_copy(ret.cwd, (u64)sizeof(ret.cwd), sh.cwd);
|
||||
}
|
||||
|
||||
if (sh.exit_requested != 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_EXIT;
|
||||
ret.exit_code = sh.exit_code;
|
||||
}
|
||||
|
||||
(void)ush_command_ret_write(&ret);
|
||||
}
|
||||
|
||||
return (success != 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,68 @@
|
||||
#include "shell/shell_internal.h"
|
||||
#include "cmd_runtime.h"
|
||||
static int ush_cmd_cd(ush_state *sh, const char *arg) {
|
||||
const char *target = arg;
|
||||
char path[USH_PATH_MAX];
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
return ush_command_program_main("cd");
|
||||
if (target == (const char *)0 || target[0] == '\0') {
|
||||
target = "/";
|
||||
}
|
||||
|
||||
if (ush_resolve_path(sh, target, path, (u64)sizeof(path)) == 0) {
|
||||
ush_writeln("cd: invalid path");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (cleonos_sys_fs_stat_type(path) != 2ULL) {
|
||||
ush_writeln("cd: directory not found");
|
||||
return 0;
|
||||
}
|
||||
|
||||
ush_copy(sh->cwd, (u64)sizeof(sh->cwd), path);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
ush_cmd_ctx ctx;
|
||||
ush_cmd_ret ret;
|
||||
ush_state sh;
|
||||
char initial_cwd[USH_PATH_MAX];
|
||||
int has_context = 0;
|
||||
int success = 0;
|
||||
const char *arg = "";
|
||||
|
||||
ush_zero(&ctx, (u64)sizeof(ctx));
|
||||
ush_zero(&ret, (u64)sizeof(ret));
|
||||
ush_init_state(&sh);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
|
||||
if (ush_command_ctx_read(&ctx) != 0) {
|
||||
if (ctx.cmd[0] != '\0' && ush_streq(ctx.cmd, "cd") != 0) {
|
||||
has_context = 1;
|
||||
arg = ctx.arg;
|
||||
if (ctx.cwd[0] == '/') {
|
||||
ush_copy(sh.cwd, (u64)sizeof(sh.cwd), ctx.cwd);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
success = ush_cmd_cd(&sh, arg);
|
||||
|
||||
if (has_context != 0) {
|
||||
if (ush_streq(sh.cwd, initial_cwd) == 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_CWD;
|
||||
ush_copy(ret.cwd, (u64)sizeof(ret.cwd), sh.cwd);
|
||||
}
|
||||
|
||||
if (sh.exit_requested != 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_EXIT;
|
||||
ret.exit_code = sh.exit_code;
|
||||
}
|
||||
|
||||
(void)ush_command_ret_write(&ret);
|
||||
}
|
||||
|
||||
return (success != 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,49 @@
|
||||
#include "shell/shell_internal.h"
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
return ush_command_program_main("clear");
|
||||
#include "cmd_runtime.h"
|
||||
static int ush_cmd_clear(void) {
|
||||
ush_write("\x1B[2J\x1B[H");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
ush_cmd_ctx ctx;
|
||||
ush_cmd_ret ret;
|
||||
ush_state sh;
|
||||
char initial_cwd[USH_PATH_MAX];
|
||||
int has_context = 0;
|
||||
int success = 0;
|
||||
|
||||
ush_zero(&ctx, (u64)sizeof(ctx));
|
||||
ush_zero(&ret, (u64)sizeof(ret));
|
||||
ush_init_state(&sh);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
|
||||
if (ush_command_ctx_read(&ctx) != 0) {
|
||||
if (ctx.cmd[0] != '\0' && ush_streq(ctx.cmd, "clear") != 0) {
|
||||
has_context = 1;
|
||||
if (ctx.cwd[0] == '/') {
|
||||
ush_copy(sh.cwd, (u64)sizeof(sh.cwd), ctx.cwd);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
success = ush_cmd_clear();
|
||||
|
||||
if (has_context != 0) {
|
||||
if (ush_streq(sh.cwd, initial_cwd) == 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_CWD;
|
||||
ush_copy(ret.cwd, (u64)sizeof(ret.cwd), sh.cwd);
|
||||
}
|
||||
|
||||
if (sh.exit_requested != 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_EXIT;
|
||||
ret.exit_code = sh.exit_code;
|
||||
}
|
||||
|
||||
(void)ush_command_ret_write(&ret);
|
||||
}
|
||||
|
||||
return (success != 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
|
||||
602
cleonos/c/apps/cmd_runtime.c
Normal file
602
cleonos/c/apps/cmd_runtime.c
Normal file
@@ -0,0 +1,602 @@
|
||||
#include "cmd_runtime.h"
|
||||
|
||||
const char *ush_pipeline_stdin_text = (const char *)0;
|
||||
u64 ush_pipeline_stdin_len = 0ULL;
|
||||
static char ush_pipeline_stdin_buf[USH_COPY_MAX + 1U];
|
||||
|
||||
static int ush_cmd_runtime_has_prefix(const char *text, const char *prefix) {
|
||||
u64 i = 0ULL;
|
||||
|
||||
if (text == (const char *)0 || prefix == (const char *)0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (prefix[i] != '\0') {
|
||||
if (text[i] != prefix[i]) {
|
||||
return 0;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int ush_cmd_runtime_stdin_pipe_enabled(char **envp) {
|
||||
u64 i = 0ULL;
|
||||
|
||||
if (envp == (char **)0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (envp[i] != (char *)0) {
|
||||
const char *entry = envp[i];
|
||||
|
||||
if (ush_cmd_runtime_has_prefix(entry, "USH_STDIN_MODE=PIPE") != 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void ush_cmd_runtime_capture_stdin_pipe(void) {
|
||||
u64 total = 0ULL;
|
||||
int truncated = 0;
|
||||
char drain[256];
|
||||
|
||||
for (;;) {
|
||||
u64 got;
|
||||
|
||||
if (total < (u64)USH_COPY_MAX) {
|
||||
got = cleonos_sys_fd_read(0ULL, ush_pipeline_stdin_buf + total, (u64)USH_COPY_MAX - total);
|
||||
} else {
|
||||
got = cleonos_sys_fd_read(0ULL, drain, (u64)sizeof(drain));
|
||||
truncated = 1;
|
||||
}
|
||||
|
||||
if (got == (u64)-1 || got == 0ULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (total < (u64)USH_COPY_MAX) {
|
||||
total += got;
|
||||
}
|
||||
}
|
||||
|
||||
ush_pipeline_stdin_buf[total] = '\0';
|
||||
ush_pipeline_stdin_text = ush_pipeline_stdin_buf;
|
||||
ush_pipeline_stdin_len = total;
|
||||
|
||||
if (truncated != 0) {
|
||||
ush_writeln("[pipe] input truncated");
|
||||
}
|
||||
}
|
||||
|
||||
void cleonos_cmd_runtime_pre_main(char **envp) {
|
||||
ush_pipeline_stdin_text = (const char *)0;
|
||||
ush_pipeline_stdin_len = 0ULL;
|
||||
ush_pipeline_stdin_buf[0] = '\0';
|
||||
|
||||
if (ush_cmd_runtime_stdin_pipe_enabled(envp) != 0) {
|
||||
ush_cmd_runtime_capture_stdin_pipe();
|
||||
}
|
||||
}
|
||||
|
||||
void ush_zero(void *ptr, u64 size) {
|
||||
if (ptr == (void *)0 || size == 0ULL) {
|
||||
return;
|
||||
}
|
||||
(void)memset(ptr, 0, (size_t)size);
|
||||
}
|
||||
|
||||
void ush_init_state(ush_state *sh) {
|
||||
if (sh == (ush_state *)0) {
|
||||
return;
|
||||
}
|
||||
|
||||
ush_zero(sh, (u64)sizeof(*sh));
|
||||
ush_copy(sh->cwd, (u64)sizeof(sh->cwd), "/");
|
||||
sh->history_nav = -1;
|
||||
}
|
||||
|
||||
u64 ush_strlen(const char *str) {
|
||||
return (str == (const char *)0) ? 0ULL : (u64)strlen(str);
|
||||
}
|
||||
|
||||
int ush_streq(const char *left, const char *right) {
|
||||
if (left == (const char *)0 || right == (const char *)0) {
|
||||
return 0;
|
||||
}
|
||||
return (strcmp(left, right) == 0) ? 1 : 0;
|
||||
}
|
||||
|
||||
int ush_is_space(char ch) {
|
||||
return (isspace((unsigned char)ch) != 0) ? 1 : 0;
|
||||
}
|
||||
|
||||
int ush_is_printable(char ch) {
|
||||
return (isprint((unsigned char)ch) != 0) ? 1 : 0;
|
||||
}
|
||||
|
||||
int ush_has_suffix(const char *name, const char *suffix) {
|
||||
size_t name_len;
|
||||
size_t suffix_len;
|
||||
|
||||
if (name == (const char *)0 || suffix == (const char *)0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
name_len = strlen(name);
|
||||
suffix_len = strlen(suffix);
|
||||
|
||||
if (suffix_len > name_len) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return (strncmp(name + (name_len - suffix_len), suffix, suffix_len) == 0) ? 1 : 0;
|
||||
}
|
||||
|
||||
int ush_contains_char(const char *text, char needle) {
|
||||
if (text == (const char *)0) {
|
||||
return 0;
|
||||
}
|
||||
return (strchr(text, (int)needle) != (char *)0) ? 1 : 0;
|
||||
}
|
||||
|
||||
int ush_parse_u64_dec(const char *text, u64 *out_value) {
|
||||
u64 value = 0ULL;
|
||||
u64 i = 0ULL;
|
||||
|
||||
if (text == (const char *)0 || out_value == (u64 *)0 || text[0] == '\0') {
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (text[i] != '\0') {
|
||||
u64 digit;
|
||||
|
||||
if (isdigit((unsigned char)text[i]) == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
digit = (u64)(text[i] - '0');
|
||||
|
||||
if (value > ((0xFFFFFFFFFFFFFFFFULL - digit) / 10ULL)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
value = (value * 10ULL) + digit;
|
||||
i++;
|
||||
}
|
||||
|
||||
*out_value = value;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void ush_copy(char *dst, u64 dst_size, const char *src) {
|
||||
if (dst == (char *)0 || src == (const char *)0 || dst_size == 0ULL) {
|
||||
return;
|
||||
}
|
||||
(void)strncpy(dst, src, (size_t)(dst_size - 1ULL));
|
||||
dst[dst_size - 1ULL] = '\0';
|
||||
}
|
||||
|
||||
void ush_trim_line(char *line) {
|
||||
size_t start = 0U;
|
||||
size_t len;
|
||||
|
||||
if (line == (char *)0) {
|
||||
return;
|
||||
}
|
||||
|
||||
while (line[start] != '\0' && isspace((unsigned char)line[start]) != 0) {
|
||||
start++;
|
||||
}
|
||||
|
||||
if (start > 0U) {
|
||||
size_t remain = strlen(line + start) + 1U;
|
||||
(void)memmove(line, line + start, remain);
|
||||
}
|
||||
|
||||
len = strlen(line);
|
||||
|
||||
while (len > 0U && isspace((unsigned char)line[len - 1U]) != 0) {
|
||||
line[len - 1U] = '\0';
|
||||
len--;
|
||||
}
|
||||
}
|
||||
|
||||
void ush_parse_line(const char *line, char *out_cmd, u64 cmd_size, char *out_arg, u64 arg_size) {
|
||||
u64 i = 0ULL;
|
||||
u64 cmd_pos = 0ULL;
|
||||
u64 arg_pos = 0ULL;
|
||||
|
||||
if (line == (const char *)0 || out_cmd == (char *)0 || out_arg == (char *)0) {
|
||||
return;
|
||||
}
|
||||
|
||||
out_cmd[0] = '\0';
|
||||
out_arg[0] = '\0';
|
||||
|
||||
while (line[i] != '\0' && ush_is_space(line[i]) != 0) {
|
||||
i++;
|
||||
}
|
||||
|
||||
while (line[i] != '\0' && ush_is_space(line[i]) == 0) {
|
||||
if (cmd_pos + 1ULL < cmd_size) {
|
||||
out_cmd[cmd_pos++] = line[i];
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
out_cmd[cmd_pos] = '\0';
|
||||
|
||||
while (line[i] != '\0' && ush_is_space(line[i]) != 0) {
|
||||
i++;
|
||||
}
|
||||
|
||||
while (line[i] != '\0') {
|
||||
if (arg_pos + 1ULL < arg_size) {
|
||||
out_arg[arg_pos++] = line[i];
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
out_arg[arg_pos] = '\0';
|
||||
}
|
||||
|
||||
void ush_write(const char *text) {
|
||||
if (text == (const char *)0) {
|
||||
return;
|
||||
}
|
||||
(void)fputs(text, 1);
|
||||
}
|
||||
|
||||
void ush_write_char(char ch) {
|
||||
(void)fputc((int)(unsigned char)ch, 1);
|
||||
}
|
||||
|
||||
void ush_writeln(const char *text) {
|
||||
ush_write(text);
|
||||
ush_write_char('\n');
|
||||
}
|
||||
|
||||
void ush_write_hex_u64(u64 value) {
|
||||
i64 nibble;
|
||||
|
||||
ush_write("0X");
|
||||
|
||||
for (nibble = 15; nibble >= 0; nibble--) {
|
||||
u64 current = (value >> (u64)(nibble * 4)) & 0x0FULL;
|
||||
char out = (current < 10ULL) ? (char)('0' + current) : (char)('A' + (current - 10ULL));
|
||||
ush_write_char(out);
|
||||
}
|
||||
}
|
||||
|
||||
void ush_print_kv_hex(const char *label, u64 value) {
|
||||
ush_write(label);
|
||||
ush_write(": ");
|
||||
ush_write_hex_u64(value);
|
||||
ush_write_char('\n');
|
||||
}
|
||||
|
||||
static int ush_path_push_component(char *path, u64 path_size, u64 *io_len, const char *component, u64 comp_len) {
|
||||
u64 i;
|
||||
|
||||
if (path == (char *)0 || io_len == (u64 *)0 || component == (const char *)0 || comp_len == 0ULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (*io_len == 1ULL) {
|
||||
if (*io_len + comp_len >= path_size) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (i = 0ULL; i < comp_len; i++) {
|
||||
path[1ULL + i] = component[i];
|
||||
}
|
||||
|
||||
*io_len = 1ULL + comp_len;
|
||||
path[*io_len] = '\0';
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (*io_len + 1ULL + comp_len >= path_size) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
path[*io_len] = '/';
|
||||
for (i = 0ULL; i < comp_len; i++) {
|
||||
path[*io_len + 1ULL + i] = component[i];
|
||||
}
|
||||
|
||||
*io_len += (1ULL + comp_len);
|
||||
path[*io_len] = '\0';
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void ush_path_pop_component(char *path, u64 *io_len) {
|
||||
if (path == (char *)0 || io_len == (u64 *)0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (*io_len <= 1ULL) {
|
||||
path[0] = '/';
|
||||
path[1] = '\0';
|
||||
*io_len = 1ULL;
|
||||
return;
|
||||
}
|
||||
|
||||
while (*io_len > 1ULL && path[*io_len - 1ULL] != '/') {
|
||||
(*io_len)--;
|
||||
}
|
||||
|
||||
if (*io_len > 1ULL) {
|
||||
(*io_len)--;
|
||||
}
|
||||
|
||||
path[*io_len] = '\0';
|
||||
}
|
||||
|
||||
static int ush_path_parse_into(const char *src, char *out_path, u64 out_size, u64 *io_len) {
|
||||
u64 i = 0ULL;
|
||||
|
||||
if (src == (const char *)0 || out_path == (char *)0 || io_len == (u64 *)0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (src[0] == '/') {
|
||||
i = 1ULL;
|
||||
}
|
||||
|
||||
while (src[i] != '\0') {
|
||||
u64 start;
|
||||
u64 len;
|
||||
|
||||
while (src[i] == '/') {
|
||||
i++;
|
||||
}
|
||||
|
||||
if (src[i] == '\0') {
|
||||
break;
|
||||
}
|
||||
|
||||
start = i;
|
||||
|
||||
while (src[i] != '\0' && src[i] != '/') {
|
||||
i++;
|
||||
}
|
||||
|
||||
len = i - start;
|
||||
|
||||
if (len == 1ULL && src[start] == '.') {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (len == 2ULL && src[start] == '.' && src[start + 1ULL] == '.') {
|
||||
ush_path_pop_component(out_path, io_len);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ush_path_push_component(out_path, out_size, io_len, src + start, len) == 0) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int ush_resolve_path(const ush_state *sh, const char *arg, char *out_path, u64 out_size) {
|
||||
u64 len = 1ULL;
|
||||
|
||||
if (sh == (const ush_state *)0 || out_path == (char *)0 || out_size < 2ULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
out_path[0] = '/';
|
||||
out_path[1] = '\0';
|
||||
|
||||
if (arg == (const char *)0 || arg[0] == '\0') {
|
||||
return ush_path_parse_into(sh->cwd, out_path, out_size, &len);
|
||||
}
|
||||
|
||||
if (arg[0] != '/') {
|
||||
if (ush_path_parse_into(sh->cwd, out_path, out_size, &len) == 0) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return ush_path_parse_into(arg, out_path, out_size, &len);
|
||||
}
|
||||
|
||||
int ush_resolve_exec_path(const ush_state *sh, const char *arg, char *out_path, u64 out_size) {
|
||||
u64 i;
|
||||
u64 cursor = 0ULL;
|
||||
|
||||
if (sh == (const ush_state *)0 || arg == (const char *)0 || out_path == (char *)0 || out_size == 0ULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (arg[0] == '\0') {
|
||||
return 0;
|
||||
}
|
||||
|
||||
out_path[0] = '\0';
|
||||
|
||||
if (arg[0] == '/') {
|
||||
ush_copy(out_path, out_size, arg);
|
||||
} else if (ush_contains_char(arg, '/') != 0) {
|
||||
if (ush_resolve_path(sh, arg, out_path, out_size) == 0) {
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
static const char prefix[] = "/shell/";
|
||||
u64 prefix_len = (u64)(sizeof(prefix) - 1U);
|
||||
|
||||
if (prefix_len + 1ULL >= out_size) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (i = 0ULL; i < prefix_len; i++) {
|
||||
out_path[cursor++] = prefix[i];
|
||||
}
|
||||
|
||||
for (i = 0ULL; arg[i] != '\0'; i++) {
|
||||
if (cursor + 1ULL >= out_size) {
|
||||
return 0;
|
||||
}
|
||||
out_path[cursor++] = arg[i];
|
||||
}
|
||||
|
||||
out_path[cursor] = '\0';
|
||||
}
|
||||
|
||||
if (ush_has_suffix(out_path, ".elf") == 0) {
|
||||
static const char suffix[] = ".elf";
|
||||
|
||||
cursor = ush_strlen(out_path);
|
||||
|
||||
for (i = 0ULL; suffix[i] != '\0'; i++) {
|
||||
if (cursor + 1ULL >= out_size) {
|
||||
return 0;
|
||||
}
|
||||
out_path[cursor++] = suffix[i];
|
||||
}
|
||||
|
||||
out_path[cursor] = '\0';
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int ush_path_is_under_system(const char *path) {
|
||||
if (path == (const char *)0) {
|
||||
return 0;
|
||||
}
|
||||
if (strncmp(path, "/system", 7U) != 0) {
|
||||
return 0;
|
||||
}
|
||||
return (path[7] == '\0' || path[7] == '/') ? 1 : 0;
|
||||
}
|
||||
|
||||
int ush_path_is_under_temp(const char *path) {
|
||||
if (path == (const char *)0) {
|
||||
return 0;
|
||||
}
|
||||
if (strncmp(path, "/temp", 5U) != 0) {
|
||||
return 0;
|
||||
}
|
||||
return (path[5] == '\0' || path[5] == '/') ? 1 : 0;
|
||||
}
|
||||
|
||||
int ush_split_first_and_rest(const char *arg, char *out_first, u64 out_first_size, const char **out_rest) {
|
||||
u64 i = 0ULL;
|
||||
u64 p = 0ULL;
|
||||
|
||||
if (arg == (const char *)0 || out_first == (char *)0 || out_first_size == 0ULL || out_rest == (const char **)0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
out_first[0] = '\0';
|
||||
*out_rest = "";
|
||||
|
||||
while (arg[i] != '\0' && ush_is_space(arg[i]) != 0) {
|
||||
i++;
|
||||
}
|
||||
|
||||
if (arg[i] == '\0') {
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (arg[i] != '\0' && ush_is_space(arg[i]) == 0) {
|
||||
if (p + 1ULL < out_first_size) {
|
||||
out_first[p++] = arg[i];
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
out_first[p] = '\0';
|
||||
|
||||
while (arg[i] != '\0' && ush_is_space(arg[i]) != 0) {
|
||||
i++;
|
||||
}
|
||||
|
||||
*out_rest = &arg[i];
|
||||
return 1;
|
||||
}
|
||||
|
||||
int ush_split_two_args(const char *arg,
|
||||
char *out_first,
|
||||
u64 out_first_size,
|
||||
char *out_second,
|
||||
u64 out_second_size) {
|
||||
u64 i = 0ULL;
|
||||
u64 p = 0ULL;
|
||||
|
||||
if (arg == (const char *)0 ||
|
||||
out_first == (char *)0 || out_first_size == 0ULL ||
|
||||
out_second == (char *)0 || out_second_size == 0ULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
out_first[0] = '\0';
|
||||
out_second[0] = '\0';
|
||||
|
||||
while (arg[i] != '\0' && ush_is_space(arg[i]) != 0) {
|
||||
i++;
|
||||
}
|
||||
|
||||
if (arg[i] == '\0') {
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (arg[i] != '\0' && ush_is_space(arg[i]) == 0) {
|
||||
if (p + 1ULL < out_first_size) {
|
||||
out_first[p++] = arg[i];
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
out_first[p] = '\0';
|
||||
|
||||
while (arg[i] != '\0' && ush_is_space(arg[i]) != 0) {
|
||||
i++;
|
||||
}
|
||||
|
||||
if (arg[i] == '\0') {
|
||||
return 0;
|
||||
}
|
||||
|
||||
p = 0ULL;
|
||||
while (arg[i] != '\0' && ush_is_space(arg[i]) == 0) {
|
||||
if (p + 1ULL < out_second_size) {
|
||||
out_second[p++] = arg[i];
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
out_second[p] = '\0';
|
||||
|
||||
return (out_first[0] != '\0' && out_second[0] != '\0') ? 1 : 0;
|
||||
}
|
||||
|
||||
int ush_command_ctx_read(ush_cmd_ctx *out_ctx) {
|
||||
u64 got;
|
||||
|
||||
if (out_ctx == (ush_cmd_ctx *)0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
ush_zero(out_ctx, (u64)sizeof(*out_ctx));
|
||||
got = cleonos_sys_fs_read(USH_CMD_CTX_PATH, (char *)out_ctx, (u64)sizeof(*out_ctx));
|
||||
return (got == (u64)sizeof(*out_ctx)) ? 1 : 0;
|
||||
}
|
||||
|
||||
int ush_command_ret_write(const ush_cmd_ret *ret) {
|
||||
if (ret == (const ush_cmd_ret *)0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return (cleonos_sys_fs_write(USH_CMD_RET_PATH, (const char *)ret, (u64)sizeof(*ret)) != 0ULL) ? 1 : 0;
|
||||
}
|
||||
102
cleonos/c/apps/cmd_runtime.h
Normal file
102
cleonos/c/apps/cmd_runtime.h
Normal file
@@ -0,0 +1,102 @@
|
||||
#ifndef CLEONOS_CMD_RUNTIME_H
|
||||
#define CLEONOS_CMD_RUNTIME_H
|
||||
|
||||
#include <cleonos_syscall.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
typedef long long i64;
|
||||
|
||||
#define USH_CMD_MAX 32ULL
|
||||
#define USH_ARG_MAX 160ULL
|
||||
#define USH_LINE_MAX 192ULL
|
||||
#define USH_PATH_MAX 192ULL
|
||||
#define USH_CAT_MAX 512ULL
|
||||
#define USH_SCRIPT_MAX 1024ULL
|
||||
#define USH_CLEAR_LINES 56ULL
|
||||
#define USH_HISTORY_MAX 16ULL
|
||||
#define USH_DMESG_DEFAULT 64ULL
|
||||
#define USH_DMESG_LINE_MAX 256ULL
|
||||
#define USH_COPY_MAX 65536U
|
||||
|
||||
#define USH_CMD_CTX_PATH "/temp/.ush_cmd_ctx.bin"
|
||||
#define USH_CMD_RET_PATH "/temp/.ush_cmd_ret.bin"
|
||||
#define USH_CMD_RET_FLAG_CWD 0x1ULL
|
||||
#define USH_CMD_RET_FLAG_EXIT 0x2ULL
|
||||
|
||||
typedef struct ush_state {
|
||||
char line[USH_LINE_MAX];
|
||||
u64 line_len;
|
||||
u64 cursor;
|
||||
u64 rendered_len;
|
||||
|
||||
char cwd[USH_PATH_MAX];
|
||||
|
||||
char history[USH_HISTORY_MAX][USH_LINE_MAX];
|
||||
u64 history_count;
|
||||
i64 history_nav;
|
||||
char nav_saved_line[USH_LINE_MAX];
|
||||
u64 nav_saved_len;
|
||||
u64 nav_saved_cursor;
|
||||
|
||||
u64 cmd_total;
|
||||
u64 cmd_ok;
|
||||
u64 cmd_fail;
|
||||
u64 cmd_unknown;
|
||||
int exit_requested;
|
||||
u64 exit_code;
|
||||
} ush_state;
|
||||
|
||||
typedef struct ush_cmd_ctx {
|
||||
char cmd[USH_CMD_MAX];
|
||||
char arg[USH_ARG_MAX];
|
||||
char cwd[USH_PATH_MAX];
|
||||
} ush_cmd_ctx;
|
||||
|
||||
typedef struct ush_cmd_ret {
|
||||
u64 flags;
|
||||
u64 exit_code;
|
||||
char cwd[USH_PATH_MAX];
|
||||
} ush_cmd_ret;
|
||||
|
||||
extern const char *ush_pipeline_stdin_text;
|
||||
extern u64 ush_pipeline_stdin_len;
|
||||
|
||||
void ush_zero(void *ptr, u64 size);
|
||||
void ush_init_state(ush_state *sh);
|
||||
|
||||
u64 ush_strlen(const char *str);
|
||||
int ush_streq(const char *left, const char *right);
|
||||
int ush_is_space(char ch);
|
||||
int ush_is_printable(char ch);
|
||||
int ush_has_suffix(const char *name, const char *suffix);
|
||||
int ush_contains_char(const char *text, char needle);
|
||||
int ush_parse_u64_dec(const char *text, u64 *out_value);
|
||||
void ush_copy(char *dst, u64 dst_size, const char *src);
|
||||
void ush_trim_line(char *line);
|
||||
void ush_parse_line(const char *line, char *out_cmd, u64 cmd_size, char *out_arg, u64 arg_size);
|
||||
|
||||
void ush_write(const char *text);
|
||||
void ush_write_char(char ch);
|
||||
void ush_writeln(const char *text);
|
||||
void ush_write_hex_u64(u64 value);
|
||||
void ush_print_kv_hex(const char *label, u64 value);
|
||||
|
||||
int ush_resolve_path(const ush_state *sh, const char *arg, char *out_path, u64 out_size);
|
||||
int ush_resolve_exec_path(const ush_state *sh, const char *arg, char *out_path, u64 out_size);
|
||||
int ush_path_is_under_system(const char *path);
|
||||
int ush_path_is_under_temp(const char *path);
|
||||
|
||||
int ush_split_first_and_rest(const char *arg, char *out_first, u64 out_first_size, const char **out_rest);
|
||||
int ush_split_two_args(const char *arg,
|
||||
char *out_first,
|
||||
u64 out_first_size,
|
||||
char *out_second,
|
||||
u64 out_second_size);
|
||||
|
||||
int ush_command_ctx_read(ush_cmd_ctx *out_ctx);
|
||||
int ush_command_ret_write(const ush_cmd_ret *ret);
|
||||
|
||||
#endif
|
||||
@@ -1,6 +1,135 @@
|
||||
#include "shell/shell_internal.h"
|
||||
#include "cmd_runtime.h"
|
||||
static int ush_copy_file(const char *src_path, const char *dst_path) {
|
||||
static char copy_buf[4096];
|
||||
u64 src_fd;
|
||||
u64 dst_fd;
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
return ush_command_program_main("cp");
|
||||
if (cleonos_sys_fs_stat_type(src_path) != 1ULL) {
|
||||
ush_writeln("cp: source file not found");
|
||||
return 0;
|
||||
}
|
||||
|
||||
src_fd = cleonos_sys_fd_open(src_path, CLEONOS_O_RDONLY, 0ULL);
|
||||
if (src_fd == (u64)-1) {
|
||||
ush_writeln("cp: failed to open source");
|
||||
return 0;
|
||||
}
|
||||
|
||||
dst_fd = cleonos_sys_fd_open(dst_path, CLEONOS_O_WRONLY | CLEONOS_O_CREAT | CLEONOS_O_TRUNC, 0ULL);
|
||||
if (dst_fd == (u64)-1) {
|
||||
(void)cleonos_sys_fd_close(src_fd);
|
||||
ush_writeln("cp: failed to open destination");
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
u64 got = cleonos_sys_fd_read(src_fd, copy_buf, (u64)sizeof(copy_buf));
|
||||
|
||||
if (got == (u64)-1) {
|
||||
(void)cleonos_sys_fd_close(dst_fd);
|
||||
(void)cleonos_sys_fd_close(src_fd);
|
||||
ush_writeln("cp: read failed");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (got == 0ULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
{
|
||||
u64 written_total = 0ULL;
|
||||
while (written_total < got) {
|
||||
u64 written = cleonos_sys_fd_write(dst_fd,
|
||||
copy_buf + written_total,
|
||||
got - written_total);
|
||||
if (written == (u64)-1 || written == 0ULL) {
|
||||
(void)cleonos_sys_fd_close(dst_fd);
|
||||
(void)cleonos_sys_fd_close(src_fd);
|
||||
ush_writeln("cp: write failed");
|
||||
return 0;
|
||||
}
|
||||
written_total += written;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
(void)cleonos_sys_fd_close(dst_fd);
|
||||
(void)cleonos_sys_fd_close(src_fd);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int ush_cmd_cp(const ush_state *sh, const char *arg) {
|
||||
char src_arg[USH_PATH_MAX];
|
||||
char dst_arg[USH_PATH_MAX];
|
||||
char src_path[USH_PATH_MAX];
|
||||
char dst_path[USH_PATH_MAX];
|
||||
|
||||
if (arg == (const char *)0 || arg[0] == '\0') {
|
||||
ush_writeln("cp: usage cp <src> <dst>");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_split_two_args(arg, src_arg, (u64)sizeof(src_arg), dst_arg, (u64)sizeof(dst_arg)) == 0) {
|
||||
ush_writeln("cp: usage cp <src> <dst>");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_resolve_path(sh, src_arg, src_path, (u64)sizeof(src_path)) == 0 ||
|
||||
ush_resolve_path(sh, dst_arg, dst_path, (u64)sizeof(dst_path)) == 0) {
|
||||
ush_writeln("cp: invalid path");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_path_is_under_temp(dst_path) == 0) {
|
||||
ush_writeln("cp: destination must be under /temp");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ush_copy_file(src_path, dst_path);
|
||||
}
|
||||
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
ush_cmd_ctx ctx;
|
||||
ush_cmd_ret ret;
|
||||
ush_state sh;
|
||||
char initial_cwd[USH_PATH_MAX];
|
||||
int has_context = 0;
|
||||
int success = 0;
|
||||
const char *arg = "";
|
||||
|
||||
ush_zero(&ctx, (u64)sizeof(ctx));
|
||||
ush_zero(&ret, (u64)sizeof(ret));
|
||||
ush_init_state(&sh);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
|
||||
if (ush_command_ctx_read(&ctx) != 0) {
|
||||
if (ctx.cmd[0] != '\0' && ush_streq(ctx.cmd, "cp") != 0) {
|
||||
has_context = 1;
|
||||
arg = ctx.arg;
|
||||
if (ctx.cwd[0] == '/') {
|
||||
ush_copy(sh.cwd, (u64)sizeof(sh.cwd), ctx.cwd);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
success = ush_cmd_cp(&sh, arg);
|
||||
|
||||
if (has_context != 0) {
|
||||
if (ush_streq(sh.cwd, initial_cwd) == 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_CWD;
|
||||
ush_copy(ret.cwd, (u64)sizeof(ret.cwd), sh.cwd);
|
||||
}
|
||||
|
||||
if (sh.exit_requested != 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_EXIT;
|
||||
ret.exit_code = sh.exit_code;
|
||||
}
|
||||
|
||||
(void)ush_command_ret_write(&ret);
|
||||
}
|
||||
|
||||
return (success != 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
|
||||
269
cleonos/c/apps/cut_main.c
Normal file
269
cleonos/c/apps/cut_main.c
Normal file
@@ -0,0 +1,269 @@
|
||||
#include "cmd_runtime.h"
|
||||
|
||||
static int ush_cut_parse_delim(const char *token, char *out_delim) {
|
||||
if (token == (const char *)0 || out_delim == (char *)0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (token[0] == '\\' && token[1] == 't' && token[2] == '\0') {
|
||||
*out_delim = '\t';
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (token[0] == '\0' || token[1] != '\0') {
|
||||
return 0;
|
||||
}
|
||||
|
||||
*out_delim = token[0];
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int ush_cut_parse_args(const char *arg,
|
||||
char *out_delim,
|
||||
u64 *out_field,
|
||||
char *out_file,
|
||||
u64 out_file_size) {
|
||||
char token[USH_PATH_MAX];
|
||||
char value[USH_PATH_MAX];
|
||||
const char *cursor = arg;
|
||||
const char *rest = "";
|
||||
int delim_set = 0;
|
||||
int field_set = 0;
|
||||
int file_set = 0;
|
||||
u64 parsed_field = 0ULL;
|
||||
|
||||
if (out_delim == (char *)0 || out_field == (u64 *)0 || out_file == (char *)0 || out_file_size == 0ULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
*out_delim = ',';
|
||||
*out_field = 1ULL;
|
||||
out_file[0] = '\0';
|
||||
|
||||
if (cursor == (const char *)0 || cursor[0] == '\0') {
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (cursor != (const char *)0 && cursor[0] != '\0') {
|
||||
if (ush_split_first_and_rest(cursor, token, (u64)sizeof(token), &rest) == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_streq(token, "-d") != 0) {
|
||||
if (ush_split_first_and_rest(rest, value, (u64)sizeof(value), &cursor) == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_cut_parse_delim(value, out_delim) == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
delim_set = 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ush_streq(token, "-f") != 0) {
|
||||
if (ush_split_first_and_rest(rest, value, (u64)sizeof(value), &cursor) == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_parse_u64_dec(value, &parsed_field) == 0 || parsed_field == 0ULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
*out_field = parsed_field;
|
||||
field_set = 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (token[0] == '-') {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (file_set != 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
ush_copy(out_file, out_file_size, token);
|
||||
file_set = 1;
|
||||
cursor = rest;
|
||||
}
|
||||
|
||||
return (delim_set != 0 && field_set != 0) ? 1 : 0;
|
||||
}
|
||||
|
||||
static int ush_cut_load_input(const ush_state *sh, const char *file_arg, const char **out_input, u64 *out_input_len) {
|
||||
static char file_buf[USH_COPY_MAX + 1U];
|
||||
char path[USH_PATH_MAX];
|
||||
u64 size;
|
||||
u64 got;
|
||||
|
||||
if (sh == (const ush_state *)0 || out_input == (const char **)0 || out_input_len == (u64 *)0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
*out_input = (const char *)0;
|
||||
*out_input_len = 0ULL;
|
||||
|
||||
if (file_arg != (const char *)0 && file_arg[0] != '\0') {
|
||||
if (ush_resolve_path(sh, file_arg, path, (u64)sizeof(path)) == 0) {
|
||||
ush_writeln("cut: invalid path");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (cleonos_sys_fs_stat_type(path) != 1ULL) {
|
||||
ush_writeln("cut: file not found");
|
||||
return 0;
|
||||
}
|
||||
|
||||
size = cleonos_sys_fs_stat_size(path);
|
||||
|
||||
if (size == (u64)-1) {
|
||||
ush_writeln("cut: failed to stat file");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (size > (u64)USH_COPY_MAX) {
|
||||
ush_writeln("cut: file too large for user buffer");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (size == 0ULL) {
|
||||
file_buf[0] = '\0';
|
||||
*out_input = file_buf;
|
||||
*out_input_len = 0ULL;
|
||||
return 1;
|
||||
}
|
||||
|
||||
got = cleonos_sys_fs_read(path, file_buf, size);
|
||||
|
||||
if (got == 0ULL || got != size) {
|
||||
ush_writeln("cut: read failed");
|
||||
return 0;
|
||||
}
|
||||
|
||||
file_buf[got] = '\0';
|
||||
*out_input = file_buf;
|
||||
*out_input_len = got;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (ush_pipeline_stdin_text == (const char *)0) {
|
||||
ush_writeln("cut: file path required (or pipeline input)");
|
||||
return 0;
|
||||
}
|
||||
|
||||
*out_input = ush_pipeline_stdin_text;
|
||||
*out_input_len = ush_pipeline_stdin_len;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void ush_cut_emit_field(const char *line, u64 line_len, char delim, u64 field_index) {
|
||||
u64 pos;
|
||||
u64 current_field = 1ULL;
|
||||
u64 field_start = 0ULL;
|
||||
int emitted = 0;
|
||||
|
||||
for (pos = 0ULL; pos <= line_len; pos++) {
|
||||
if (pos == line_len || line[pos] == delim) {
|
||||
if (current_field == field_index) {
|
||||
u64 j;
|
||||
for (j = field_start; j < pos; j++) {
|
||||
ush_write_char(line[j]);
|
||||
}
|
||||
emitted = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
current_field++;
|
||||
field_start = pos + 1ULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (emitted == 0) {
|
||||
/* keep empty line */
|
||||
}
|
||||
|
||||
ush_write_char('\n');
|
||||
}
|
||||
|
||||
static int ush_cmd_cut(const ush_state *sh, const char *arg) {
|
||||
char file_arg[USH_PATH_MAX];
|
||||
const char *input = (const char *)0;
|
||||
u64 input_len = 0ULL;
|
||||
char delim = ',';
|
||||
u64 field_index = 1ULL;
|
||||
u64 i;
|
||||
u64 start = 0ULL;
|
||||
|
||||
if (sh == (const ush_state *)0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_cut_parse_args(arg, &delim, &field_index, file_arg, (u64)sizeof(file_arg)) == 0) {
|
||||
ush_writeln("cut: usage cut -d <char> -f <N> [file]");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_cut_load_input(sh, file_arg, &input, &input_len) == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (i = 0ULL; i < input_len; i++) {
|
||||
if (input[i] == '\n') {
|
||||
ush_cut_emit_field(&input[start], i - start, delim, field_index);
|
||||
start = i + 1ULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (start < input_len) {
|
||||
ush_cut_emit_field(&input[start], input_len - start, delim, field_index);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
ush_cmd_ctx ctx;
|
||||
ush_cmd_ret ret;
|
||||
ush_state sh;
|
||||
char initial_cwd[USH_PATH_MAX];
|
||||
int has_context = 0;
|
||||
int success = 0;
|
||||
const char *arg = "";
|
||||
|
||||
ush_zero(&ctx, (u64)sizeof(ctx));
|
||||
ush_zero(&ret, (u64)sizeof(ret));
|
||||
ush_init_state(&sh);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
|
||||
if (ush_command_ctx_read(&ctx) != 0) {
|
||||
if (ctx.cmd[0] != '\0' && ush_streq(ctx.cmd, "cut") != 0) {
|
||||
has_context = 1;
|
||||
arg = ctx.arg;
|
||||
if (ctx.cwd[0] == '/') {
|
||||
ush_copy(sh.cwd, (u64)sizeof(sh.cwd), ctx.cwd);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
success = ush_cmd_cut(&sh, arg);
|
||||
|
||||
if (has_context != 0) {
|
||||
if (ush_streq(sh.cwd, initial_cwd) == 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_CWD;
|
||||
ush_copy(ret.cwd, (u64)sizeof(ret.cwd), sh.cwd);
|
||||
}
|
||||
|
||||
if (sh.exit_requested != 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_EXIT;
|
||||
ret.exit_code = sh.exit_code;
|
||||
}
|
||||
|
||||
(void)ush_command_ret_write(&ret);
|
||||
}
|
||||
|
||||
return (success != 0) ? 0 : 1;
|
||||
}
|
||||
48
cleonos/c/apps/dltest_main.c
Normal file
48
cleonos/c/apps/dltest_main.c
Normal file
@@ -0,0 +1,48 @@
|
||||
#include <dlfcn.h>
|
||||
#include <stdio.h>
|
||||
|
||||
typedef unsigned long long u64;
|
||||
typedef u64 (*dl_math2_fn)(u64, u64);
|
||||
typedef u64 (*dl_void_fn)(void);
|
||||
|
||||
int cleonos_app_main(int argc, char **argv, char **envp) {
|
||||
const char *lib_path = "/shell/libdemo.elf";
|
||||
void *handle;
|
||||
dl_math2_fn add_fn;
|
||||
dl_math2_fn mul_fn;
|
||||
dl_void_fn hello_fn;
|
||||
|
||||
(void)envp;
|
||||
|
||||
if (argc > 1 && argv != (char **)0 && argv[1] != (char *)0 && argv[1][0] != '\0') {
|
||||
lib_path = argv[1];
|
||||
}
|
||||
|
||||
handle = dlopen(lib_path, 0);
|
||||
if (handle == (void *)0) {
|
||||
(void)printf("[dltest] dlopen failed: %s\n", lib_path);
|
||||
return 1;
|
||||
}
|
||||
|
||||
add_fn = (dl_math2_fn)dlsym(handle, "cleonos_libdemo_add");
|
||||
mul_fn = (dl_math2_fn)dlsym(handle, "cleonos_libdemo_mul");
|
||||
hello_fn = (dl_void_fn)dlsym(handle, "cleonos_libdemo_hello");
|
||||
|
||||
if (add_fn == (dl_math2_fn)0 || mul_fn == (dl_math2_fn)0 || hello_fn == (dl_void_fn)0) {
|
||||
(void)puts("[dltest] dlsym failed");
|
||||
(void)dlclose(handle);
|
||||
return 2;
|
||||
}
|
||||
|
||||
(void)hello_fn();
|
||||
(void)printf("[dltest] add(7, 35) = %llu\n", add_fn(7ULL, 35ULL));
|
||||
(void)printf("[dltest] mul(6, 9) = %llu\n", mul_fn(6ULL, 9ULL));
|
||||
|
||||
if (dlclose(handle) != 0) {
|
||||
(void)puts("[dltest] dlclose failed");
|
||||
return 3;
|
||||
}
|
||||
|
||||
(void)puts("[dltest] PASS");
|
||||
return 0;
|
||||
}
|
||||
@@ -1,6 +1,81 @@
|
||||
#include "shell/shell_internal.h"
|
||||
#include "cmd_runtime.h"
|
||||
static int ush_cmd_dmesg(const char *arg) {
|
||||
u64 total = cleonos_sys_log_journal_count();
|
||||
u64 limit = USH_DMESG_DEFAULT;
|
||||
u64 start;
|
||||
u64 i;
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
return ush_command_program_main("dmesg");
|
||||
if (arg != (const char *)0 && arg[0] != '\0') {
|
||||
if (ush_parse_u64_dec(arg, &limit) == 0 || limit == 0ULL) {
|
||||
ush_writeln("dmesg: usage dmesg [positive_count]");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (total == 0ULL) {
|
||||
ush_writeln("(journal empty)");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (limit > total) {
|
||||
limit = total;
|
||||
}
|
||||
|
||||
start = total - limit;
|
||||
|
||||
for (i = start; i < total; i++) {
|
||||
char line[USH_DMESG_LINE_MAX];
|
||||
|
||||
if (cleonos_sys_log_journal_read(i, line, (u64)sizeof(line)) != 0ULL) {
|
||||
ush_writeln(line);
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
ush_cmd_ctx ctx;
|
||||
ush_cmd_ret ret;
|
||||
ush_state sh;
|
||||
char initial_cwd[USH_PATH_MAX];
|
||||
int has_context = 0;
|
||||
int success = 0;
|
||||
const char *arg = "";
|
||||
|
||||
ush_zero(&ctx, (u64)sizeof(ctx));
|
||||
ush_zero(&ret, (u64)sizeof(ret));
|
||||
ush_init_state(&sh);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
|
||||
if (ush_command_ctx_read(&ctx) != 0) {
|
||||
if (ctx.cmd[0] != '\0' && ush_streq(ctx.cmd, "dmesg") != 0) {
|
||||
has_context = 1;
|
||||
arg = ctx.arg;
|
||||
if (ctx.cwd[0] == '/') {
|
||||
ush_copy(sh.cwd, (u64)sizeof(sh.cwd), ctx.cwd);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
success = ush_cmd_dmesg(arg);
|
||||
|
||||
if (has_context != 0) {
|
||||
if (ush_streq(sh.cwd, initial_cwd) == 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_CWD;
|
||||
ush_copy(ret.cwd, (u64)sizeof(ret.cwd), sh.cwd);
|
||||
}
|
||||
|
||||
if (sh.exit_requested != 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_EXIT;
|
||||
ret.exit_code = sh.exit_code;
|
||||
}
|
||||
|
||||
(void)ush_command_ret_write(&ret);
|
||||
}
|
||||
|
||||
return (success != 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,108 @@
|
||||
#include "shell/shell_internal.h"
|
||||
#include "cmd_runtime.h"
|
||||
static int ush_cmd_exec(const ush_state *sh, const char *arg) {
|
||||
char target[USH_PATH_MAX];
|
||||
char argv_line[USH_ARG_MAX];
|
||||
char env_line[USH_PATH_MAX + 32ULL];
|
||||
const char *rest = "";
|
||||
char path[USH_PATH_MAX];
|
||||
u64 status;
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
return ush_command_program_main("exec");
|
||||
if (sh == (const ush_state *)0 || arg == (const char *)0 || arg[0] == '\0') {
|
||||
ush_writeln("exec: usage exec <path|name> [args...]");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_split_first_and_rest(arg, target, (u64)sizeof(target), &rest) == 0) {
|
||||
ush_writeln("exec: usage exec <path|name> [args...]");
|
||||
return 0;
|
||||
}
|
||||
|
||||
argv_line[0] = '\0';
|
||||
if (rest != (const char *)0 && rest[0] != '\0') {
|
||||
ush_copy(argv_line, (u64)sizeof(argv_line), rest);
|
||||
}
|
||||
|
||||
if (ush_resolve_exec_path(sh, target, path, (u64)sizeof(path)) == 0) {
|
||||
ush_writeln("exec: invalid target");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_path_is_under_system(path) != 0) {
|
||||
ush_writeln("exec: /system/*.elf is kernel-mode (KELF), not user-exec");
|
||||
return 0;
|
||||
}
|
||||
|
||||
env_line[0] = '\0';
|
||||
ush_copy(env_line, (u64)sizeof(env_line), "PWD=");
|
||||
ush_copy(env_line + 4, (u64)(sizeof(env_line) - 4ULL), sh->cwd);
|
||||
|
||||
status = cleonos_sys_exec_pathv(path, argv_line, env_line);
|
||||
|
||||
if (status == (u64)-1) {
|
||||
ush_writeln("exec: request failed");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (status == 0ULL) {
|
||||
ush_writeln("exec: request accepted");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ((status & (1ULL << 63)) != 0ULL) {
|
||||
ush_writeln("exec: terminated by signal");
|
||||
ush_print_kv_hex(" SIGNAL", status & 0xFFULL);
|
||||
ush_print_kv_hex(" VECTOR", (status >> 8) & 0xFFULL);
|
||||
ush_print_kv_hex(" ERROR", (status >> 16) & 0xFFFFULL);
|
||||
} else {
|
||||
ush_writeln("exec: returned non-zero status");
|
||||
ush_print_kv_hex(" STATUS", status);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
ush_cmd_ctx ctx;
|
||||
ush_cmd_ret ret;
|
||||
ush_state sh;
|
||||
char initial_cwd[USH_PATH_MAX];
|
||||
int has_context = 0;
|
||||
int success = 0;
|
||||
const char *arg = "";
|
||||
|
||||
ush_zero(&ctx, (u64)sizeof(ctx));
|
||||
ush_zero(&ret, (u64)sizeof(ret));
|
||||
ush_init_state(&sh);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
|
||||
if (ush_command_ctx_read(&ctx) != 0) {
|
||||
if (ctx.cmd[0] != '\0' && ush_streq(ctx.cmd, "exec") != 0) {
|
||||
has_context = 1;
|
||||
arg = ctx.arg;
|
||||
if (ctx.cwd[0] == '/') {
|
||||
ush_copy(sh.cwd, (u64)sizeof(sh.cwd), ctx.cwd);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
success = ush_cmd_exec(&sh, arg);
|
||||
|
||||
if (has_context != 0) {
|
||||
if (ush_streq(sh.cwd, initial_cwd) == 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_CWD;
|
||||
ush_copy(ret.cwd, (u64)sizeof(ret.cwd), sh.cwd);
|
||||
}
|
||||
|
||||
if (sh.exit_requested != 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_EXIT;
|
||||
ret.exit_code = sh.exit_code;
|
||||
}
|
||||
|
||||
(void)ush_command_ret_write(&ret);
|
||||
}
|
||||
|
||||
return (success != 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,67 @@
|
||||
#include "shell/shell_internal.h"
|
||||
#include "cmd_runtime.h"
|
||||
static int ush_cmd_exit(ush_state *sh, const char *arg) {
|
||||
u64 code = 0ULL;
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
return ush_command_program_main("exit");
|
||||
if (sh == (ush_state *)0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (arg != (const char *)0 && arg[0] != '\0') {
|
||||
if (ush_parse_u64_dec(arg, &code) == 0) {
|
||||
ush_writeln("exit: usage exit [code]");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
sh->exit_requested = 1;
|
||||
sh->exit_code = code;
|
||||
(void)cleonos_sys_exit(code);
|
||||
ush_writeln("exit: shell stopping");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
ush_cmd_ctx ctx;
|
||||
ush_cmd_ret ret;
|
||||
ush_state sh;
|
||||
char initial_cwd[USH_PATH_MAX];
|
||||
int has_context = 0;
|
||||
int success = 0;
|
||||
const char *arg = "";
|
||||
|
||||
ush_zero(&ctx, (u64)sizeof(ctx));
|
||||
ush_zero(&ret, (u64)sizeof(ret));
|
||||
ush_init_state(&sh);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
|
||||
if (ush_command_ctx_read(&ctx) != 0) {
|
||||
if (ctx.cmd[0] != '\0' && ush_streq(ctx.cmd, "exit") != 0) {
|
||||
has_context = 1;
|
||||
arg = ctx.arg;
|
||||
if (ctx.cwd[0] == '/') {
|
||||
ush_copy(sh.cwd, (u64)sizeof(sh.cwd), ctx.cwd);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
success = ush_cmd_exit(&sh, arg);
|
||||
|
||||
if (has_context != 0) {
|
||||
if (ush_streq(sh.cwd, initial_cwd) == 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_CWD;
|
||||
ush_copy(ret.cwd, (u64)sizeof(ret.cwd), sh.cwd);
|
||||
}
|
||||
|
||||
if (sh.exit_requested != 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_EXIT;
|
||||
ret.exit_code = sh.exit_code;
|
||||
}
|
||||
|
||||
(void)ush_command_ret_write(&ret);
|
||||
}
|
||||
|
||||
return (success != 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
|
||||
213
cleonos/c/apps/fastfetch_main.c
Normal file
213
cleonos/c/apps/fastfetch_main.c
Normal file
@@ -0,0 +1,213 @@
|
||||
#include "cmd_runtime.h"
|
||||
static u64 ush_fastfetch_u64_to_dec(char *out, u64 out_size, u64 value) {
|
||||
char rev[32];
|
||||
u64 digits = 0ULL;
|
||||
u64 i;
|
||||
|
||||
if (out == (char *)0 || out_size == 0ULL) {
|
||||
return 0ULL;
|
||||
}
|
||||
|
||||
if (value == 0ULL) {
|
||||
if (out_size < 2ULL) {
|
||||
return 0ULL;
|
||||
}
|
||||
out[0] = '0';
|
||||
out[1] = '\0';
|
||||
return 1ULL;
|
||||
}
|
||||
|
||||
while (value > 0ULL && digits < (u64)sizeof(rev)) {
|
||||
rev[digits++] = (char)('0' + (value % 10ULL));
|
||||
value /= 10ULL;
|
||||
}
|
||||
|
||||
if (digits + 1ULL > out_size) {
|
||||
out[0] = '\0';
|
||||
return 0ULL;
|
||||
}
|
||||
|
||||
for (i = 0ULL; i < digits; i++) {
|
||||
out[i] = rev[digits - 1ULL - i];
|
||||
}
|
||||
out[digits] = '\0';
|
||||
return digits;
|
||||
}
|
||||
|
||||
static void ush_fastfetch_write_u64_dec(u64 value) {
|
||||
char text[32];
|
||||
|
||||
if (ush_fastfetch_u64_to_dec(text, (u64)sizeof(text), value) == 0ULL) {
|
||||
ush_write("0");
|
||||
return;
|
||||
}
|
||||
|
||||
ush_write(text);
|
||||
}
|
||||
|
||||
static void ush_fastfetch_write_key(int plain, const char *key) {
|
||||
ush_write(" ");
|
||||
if (plain == 0) {
|
||||
ush_write("\x1B[1;96m");
|
||||
}
|
||||
ush_write(key);
|
||||
if (plain == 0) {
|
||||
ush_write("\x1B[0m");
|
||||
}
|
||||
ush_write(": ");
|
||||
}
|
||||
|
||||
static void ush_fastfetch_print_text(int plain, const char *key, const char *value) {
|
||||
ush_fastfetch_write_key(plain, key);
|
||||
ush_writeln(value);
|
||||
}
|
||||
|
||||
static void ush_fastfetch_print_u64(int plain, const char *key, u64 value) {
|
||||
ush_fastfetch_write_key(plain, key);
|
||||
ush_fastfetch_write_u64_dec(value);
|
||||
ush_write_char('\n');
|
||||
}
|
||||
|
||||
static void ush_fastfetch_print_logo(int plain) {
|
||||
if (plain == 0) {
|
||||
ush_writeln("\x1B[1;34m $$$$$$\\ $$\\ $$$$$$\\ $$$$$$\\ \x1B[0m");
|
||||
ush_writeln("\x1B[1;36m$$ __$$\\ $$ | $$ __$$\\ $$ __$$\\ \x1B[0m");
|
||||
ush_writeln("\x1B[1;32m$$ / \\__|$$ | $$$$$$\\ $$$$$$\\ $$$$$$$\\ $$ / $$ |$$ / \\__|\x1B[0m");
|
||||
ush_writeln("\x1B[1;33m$$ | $$ | $$ __$$\\ $$ __$$\\ $$ __$$\\ $$ | $$ |\\$$$$$$\\ \x1B[0m");
|
||||
ush_writeln("\x1B[1;31m$$ | $$ | $$$$$$$$ |$$ / $$ |$$ | $$ |$$ | $$ | \\____$$\\ \x1B[0m");
|
||||
ush_writeln("\x1B[1;35m$$ | $$\\ $$ | $$ ____|$$ | $$ |$$ | $$ |$$ | $$ |$$\\ $$ |\x1B[0m");
|
||||
ush_writeln("\x1B[1;94m\\$$$$$$ |$$$$$$$$\\ \\$$$$$$$\\ \\$$$$$$ |$$ | $$ | $$$$$$ |\\$$$$$$ |\x1B[0m");
|
||||
ush_writeln("\x1B[1;96m \\______/ \\________| \\_______| \\______/ \\__| \\__| \\______/ \\______/ \x1B[0m");
|
||||
ush_writeln(" ");
|
||||
ush_writeln(" ");
|
||||
} else {
|
||||
ush_writeln(" $$$$$$\\ $$\\ $$$$$$\\ $$$$$$\\ ");
|
||||
ush_writeln("$$ __$$\\ $$ | $$ __$$\\ $$ __$$\\ ");
|
||||
ush_writeln("$$ / \\__|$$ | $$$$$$\\ $$$$$$\\ $$$$$$$\\ $$ / $$ |$$ / \\__|");
|
||||
ush_writeln("$$ | $$ | $$ __$$\\ $$ __$$\\ $$ __$$\\ $$ | $$ |\\$$$$$$\\ ");
|
||||
ush_writeln("$$ | $$ | $$$$$$$$ |$$ / $$ |$$ | $$ |$$ | $$ | \\____$$\\ ");
|
||||
ush_writeln("$$ | $$\\ $$ | $$ ____|$$ | $$ |$$ | $$ |$$ | $$ |$$\\ $$ |");
|
||||
ush_writeln("\\$$$$$$ |$$$$$$$$\\ \\$$$$$$$\\ \\$$$$$$ |$$ | $$ | $$$$$$ |\\$$$$$$ |");
|
||||
ush_writeln(" \\______/ \\________| \\_______| \\______/ \\__| \\__| \\______/ \\______/ ");
|
||||
ush_writeln(" ");
|
||||
ush_writeln(" ");
|
||||
}
|
||||
}
|
||||
|
||||
static void ush_fastfetch_print_palette(int plain) {
|
||||
ush_fastfetch_write_key(plain, "Palette");
|
||||
|
||||
if (plain != 0) {
|
||||
ush_writeln("ANSI16");
|
||||
return;
|
||||
}
|
||||
|
||||
ush_write("\x1B[40m \x1B[0m\x1B[41m \x1B[0m\x1B[42m \x1B[0m\x1B[43m \x1B[0m");
|
||||
ush_write("\x1B[44m \x1B[0m\x1B[45m \x1B[0m\x1B[46m \x1B[0m\x1B[47m \x1B[0m ");
|
||||
ush_write("\x1B[100m \x1B[0m\x1B[101m \x1B[0m\x1B[102m \x1B[0m\x1B[103m \x1B[0m");
|
||||
ush_write("\x1B[104m \x1B[0m\x1B[105m \x1B[0m\x1B[106m \x1B[0m\x1B[107m \x1B[0m");
|
||||
ush_write_char('\n');
|
||||
}
|
||||
|
||||
static int ush_cmd_fastfetch(const char *arg) {
|
||||
int plain = 0;
|
||||
u64 tty_active;
|
||||
u64 tty_count;
|
||||
u64 exec_req;
|
||||
u64 exec_ok;
|
||||
|
||||
if (arg != (const char *)0 && arg[0] != '\0') {
|
||||
if (ush_streq(arg, "--plain") != 0) {
|
||||
plain = 1;
|
||||
} else if (ush_streq(arg, "--help") != 0 || ush_streq(arg, "-h") != 0) {
|
||||
ush_writeln("usage: fastfetch [--plain]");
|
||||
return 1;
|
||||
} else {
|
||||
ush_writeln("fastfetch: usage fastfetch [--plain]");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
tty_active = cleonos_sys_tty_active();
|
||||
tty_count = cleonos_sys_tty_count();
|
||||
exec_req = cleonos_sys_exec_request_count();
|
||||
exec_ok = cleonos_sys_exec_success_count();
|
||||
|
||||
ush_fastfetch_print_logo(plain);
|
||||
ush_write_char('\n');
|
||||
|
||||
ush_fastfetch_print_text(plain, "OS", "CLeonOS x86_64");
|
||||
ush_fastfetch_print_text(plain, "Shell", "User Shell (/shell/shell.elf)");
|
||||
ush_fastfetch_print_u64(plain, "PID", cleonos_sys_getpid());
|
||||
ush_fastfetch_print_u64(plain, "UptimeTicks", cleonos_sys_timer_ticks());
|
||||
ush_fastfetch_print_u64(plain, "Tasks", cleonos_sys_task_count());
|
||||
ush_fastfetch_print_u64(plain, "Services", cleonos_sys_service_count());
|
||||
ush_fastfetch_print_u64(plain, "SvcReady", cleonos_sys_service_ready_count());
|
||||
ush_fastfetch_print_u64(plain, "CtxSwitches", cleonos_sys_context_switches());
|
||||
ush_fastfetch_print_u64(plain, "KELFApps", cleonos_sys_kelf_count());
|
||||
ush_fastfetch_print_u64(plain, "KELFRuns", cleonos_sys_kelf_runs());
|
||||
ush_fastfetch_print_u64(plain, "FSNodes", cleonos_sys_fs_node_count());
|
||||
ush_fastfetch_print_u64(plain, "RootChildren", cleonos_sys_fs_child_count("/"));
|
||||
|
||||
ush_fastfetch_write_key(plain, "TTY");
|
||||
ush_fastfetch_write_u64_dec(tty_active);
|
||||
ush_write(" / ");
|
||||
ush_fastfetch_write_u64_dec(tty_count);
|
||||
ush_write_char('\n');
|
||||
|
||||
ush_fastfetch_write_key(plain, "ExecSuccess");
|
||||
ush_fastfetch_write_u64_dec(exec_ok);
|
||||
ush_write(" / ");
|
||||
ush_fastfetch_write_u64_dec(exec_req);
|
||||
ush_write_char('\n');
|
||||
|
||||
ush_fastfetch_print_u64(plain, "KbdBuffered", cleonos_sys_kbd_buffered());
|
||||
ush_fastfetch_print_palette(plain);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
ush_cmd_ctx ctx;
|
||||
ush_cmd_ret ret;
|
||||
ush_state sh;
|
||||
char initial_cwd[USH_PATH_MAX];
|
||||
int has_context = 0;
|
||||
int success = 0;
|
||||
const char *arg = "";
|
||||
|
||||
ush_zero(&ctx, (u64)sizeof(ctx));
|
||||
ush_zero(&ret, (u64)sizeof(ret));
|
||||
ush_init_state(&sh);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
|
||||
if (ush_command_ctx_read(&ctx) != 0) {
|
||||
if (ctx.cmd[0] != '\0' && ush_streq(ctx.cmd, "fastfetch") != 0) {
|
||||
has_context = 1;
|
||||
arg = ctx.arg;
|
||||
if (ctx.cwd[0] == '/') {
|
||||
ush_copy(sh.cwd, (u64)sizeof(sh.cwd), ctx.cwd);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
success = ush_cmd_fastfetch(arg);
|
||||
|
||||
if (has_context != 0) {
|
||||
if (ush_streq(sh.cwd, initial_cwd) == 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_CWD;
|
||||
ush_copy(ret.cwd, (u64)sizeof(ret.cwd), sh.cwd);
|
||||
}
|
||||
|
||||
if (sh.exit_requested != 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_EXIT;
|
||||
ret.exit_code = sh.exit_code;
|
||||
}
|
||||
|
||||
(void)ush_command_ret_write(&ret);
|
||||
}
|
||||
|
||||
return (success != 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
185
cleonos/c/apps/fg_main.c
Normal file
185
cleonos/c/apps/fg_main.c
Normal file
@@ -0,0 +1,185 @@
|
||||
#include "cmd_runtime.h"
|
||||
|
||||
static int ush_fg_is_user_path(const char *path) {
|
||||
if (path == (const char *)0 || path[0] != '/') {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (path[1] == 's' && path[2] == 'y' && path[3] == 's' && path[4] == 't' && path[5] == 'e' && path[6] == 'm' &&
|
||||
(path[7] == '/' || path[7] == '\0')) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (path[1] == 'd' && path[2] == 'r' && path[3] == 'i' && path[4] == 'v' && path[5] == 'e' && path[6] == 'r' &&
|
||||
(path[7] == '/' || path[7] == '\0')) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int ush_fg_pick_latest_job(u64 *out_pid) {
|
||||
u64 proc_count;
|
||||
u64 tty_active;
|
||||
u64 i;
|
||||
u64 best = 0ULL;
|
||||
|
||||
if (out_pid == (u64 *)0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
*out_pid = 0ULL;
|
||||
proc_count = cleonos_sys_proc_count();
|
||||
tty_active = cleonos_sys_tty_active();
|
||||
|
||||
for (i = 0ULL; i < proc_count; i++) {
|
||||
u64 pid = 0ULL;
|
||||
cleonos_proc_snapshot snap;
|
||||
|
||||
if (cleonos_sys_proc_pid_at(i, &pid) == 0ULL || pid == 0ULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (cleonos_sys_proc_snapshot(pid, &snap, (u64)sizeof(snap)) == 0ULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (snap.tty_index != tty_active) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ush_fg_is_user_path(snap.path) == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (snap.state != CLEONOS_PROC_STATE_PENDING &&
|
||||
snap.state != CLEONOS_PROC_STATE_RUNNING &&
|
||||
snap.state != CLEONOS_PROC_STATE_STOPPED) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (best == 0ULL || snap.pid > best) {
|
||||
best = snap.pid;
|
||||
}
|
||||
}
|
||||
|
||||
if (best == 0ULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
*out_pid = best;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int ush_fg_wait_pid(u64 pid) {
|
||||
for (;;) {
|
||||
u64 status = (u64)-1;
|
||||
u64 wait_ret = cleonos_sys_wait_pid(pid, &status);
|
||||
|
||||
if (wait_ret == (u64)-1) {
|
||||
ush_writeln("fg: pid not found");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (wait_ret == 1ULL) {
|
||||
ush_write("fg: done [");
|
||||
ush_write_hex_u64(pid);
|
||||
ush_writeln("]");
|
||||
if ((status & (1ULL << 63)) != 0ULL) {
|
||||
ush_print_kv_hex(" SIGNAL", status & 0xFFULL);
|
||||
ush_print_kv_hex(" VECTOR", (status >> 8) & 0xFFULL);
|
||||
ush_print_kv_hex(" ERROR", (status >> 16) & 0xFFFFULL);
|
||||
} else {
|
||||
ush_print_kv_hex(" STATUS", status);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
(void)cleonos_sys_sleep_ticks(1ULL);
|
||||
}
|
||||
}
|
||||
|
||||
static int ush_cmd_fg(const char *arg) {
|
||||
u64 pid = 0ULL;
|
||||
cleonos_proc_snapshot snap;
|
||||
|
||||
if (arg != (const char *)0 && arg[0] != '\0') {
|
||||
if (ush_parse_u64_dec(arg, &pid) == 0 || pid == 0ULL) {
|
||||
ush_writeln("fg: usage fg [pid]");
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
if (ush_fg_pick_latest_job(&pid) == 0) {
|
||||
ush_writeln("fg: no active background job");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (cleonos_sys_proc_snapshot(pid, &snap, (u64)sizeof(snap)) == 0ULL) {
|
||||
ush_writeln("fg: pid not found");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (snap.state == CLEONOS_PROC_STATE_STOPPED) {
|
||||
u64 ret = cleonos_sys_proc_kill(pid, CLEONOS_SIGCONT);
|
||||
|
||||
if (ret == (u64)-1) {
|
||||
ush_writeln("fg: pid not found");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ret == 0ULL) {
|
||||
ush_writeln("fg: failed to continue job");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
ush_write("fg: waiting [");
|
||||
ush_write_hex_u64(pid);
|
||||
ush_writeln("]");
|
||||
return ush_fg_wait_pid(pid);
|
||||
}
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
ush_cmd_ctx ctx;
|
||||
ush_cmd_ret ret;
|
||||
ush_state sh;
|
||||
char initial_cwd[USH_PATH_MAX];
|
||||
int has_context = 0;
|
||||
int success = 0;
|
||||
const char *arg = "";
|
||||
|
||||
ush_zero(&ctx, (u64)sizeof(ctx));
|
||||
ush_zero(&ret, (u64)sizeof(ret));
|
||||
ush_init_state(&sh);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
|
||||
if (ush_command_ctx_read(&ctx) != 0) {
|
||||
if (ctx.cmd[0] != '\0' && ush_streq(ctx.cmd, "fg") != 0) {
|
||||
has_context = 1;
|
||||
arg = ctx.arg;
|
||||
if (ctx.cwd[0] == '/') {
|
||||
ush_copy(sh.cwd, (u64)sizeof(sh.cwd), ctx.cwd);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
success = ush_cmd_fg(arg);
|
||||
|
||||
if (has_context != 0) {
|
||||
if (ush_streq(sh.cwd, initial_cwd) == 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_CWD;
|
||||
ush_copy(ret.cwd, (u64)sizeof(ret.cwd), sh.cwd);
|
||||
}
|
||||
|
||||
if (sh.exit_requested != 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_EXIT;
|
||||
ret.exit_code = sh.exit_code;
|
||||
}
|
||||
|
||||
(void)ush_command_ret_write(&ret);
|
||||
}
|
||||
|
||||
return (success != 0) ? 0 : 1;
|
||||
}
|
||||
@@ -1,6 +1,56 @@
|
||||
#include "shell/shell_internal.h"
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
return ush_command_program_main("fsstat");
|
||||
#include "cmd_runtime.h"
|
||||
static int ush_cmd_fsstat(void) {
|
||||
ush_writeln("fsstat:");
|
||||
ush_print_kv_hex(" NODE_COUNT", cleonos_sys_fs_node_count());
|
||||
ush_print_kv_hex(" ROOT_CHILDREN", cleonos_sys_fs_child_count("/"));
|
||||
ush_print_kv_hex(" SYSTEM_CHILDREN", cleonos_sys_fs_child_count("/system"));
|
||||
ush_print_kv_hex(" SHELL_CHILDREN", cleonos_sys_fs_child_count("/shell"));
|
||||
ush_print_kv_hex(" TEMP_CHILDREN", cleonos_sys_fs_child_count("/temp"));
|
||||
ush_print_kv_hex(" DRIVER_CHILDREN", cleonos_sys_fs_child_count("/driver"));
|
||||
ush_print_kv_hex(" DEV_CHILDREN", cleonos_sys_fs_child_count("/dev"));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
ush_cmd_ctx ctx;
|
||||
ush_cmd_ret ret;
|
||||
ush_state sh;
|
||||
char initial_cwd[USH_PATH_MAX];
|
||||
int has_context = 0;
|
||||
int success = 0;
|
||||
|
||||
ush_zero(&ctx, (u64)sizeof(ctx));
|
||||
ush_zero(&ret, (u64)sizeof(ret));
|
||||
ush_init_state(&sh);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
|
||||
if (ush_command_ctx_read(&ctx) != 0) {
|
||||
if (ctx.cmd[0] != '\0' && ush_streq(ctx.cmd, "fsstat") != 0) {
|
||||
has_context = 1;
|
||||
if (ctx.cwd[0] == '/') {
|
||||
ush_copy(sh.cwd, (u64)sizeof(sh.cwd), ctx.cwd);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
success = ush_cmd_fsstat();
|
||||
|
||||
if (has_context != 0) {
|
||||
if (ush_streq(sh.cwd, initial_cwd) == 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_CWD;
|
||||
ush_copy(ret.cwd, (u64)sizeof(ret.cwd), sh.cwd);
|
||||
}
|
||||
|
||||
if (sh.exit_requested != 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_EXIT;
|
||||
ret.exit_code = sh.exit_code;
|
||||
}
|
||||
|
||||
(void)ush_command_ret_write(&ret);
|
||||
}
|
||||
|
||||
return (success != 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
|
||||
250
cleonos/c/apps/grep_main.c
Normal file
250
cleonos/c/apps/grep_main.c
Normal file
@@ -0,0 +1,250 @@
|
||||
#include "cmd_runtime.h"
|
||||
#include <stdio.h>
|
||||
|
||||
static void ush_grep_write_u64_dec(u64 value) {
|
||||
char tmp[32];
|
||||
u64 len = 0ULL;
|
||||
|
||||
if (value == 0ULL) {
|
||||
(void)putchar('0');
|
||||
return;
|
||||
}
|
||||
|
||||
while (value > 0ULL && len < (u64)sizeof(tmp)) {
|
||||
tmp[len++] = (char)('0' + (value % 10ULL));
|
||||
value /= 10ULL;
|
||||
}
|
||||
|
||||
while (len > 0ULL) {
|
||||
len--;
|
||||
(void)putchar((unsigned char)tmp[len]);
|
||||
}
|
||||
}
|
||||
|
||||
static int ush_grep_line_has_pattern(const char *line, u64 line_len, const char *pattern, u64 pattern_len) {
|
||||
u64 i;
|
||||
|
||||
if (line == (const char *)0 || pattern == (const char *)0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (pattern_len == 0ULL) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (pattern_len > line_len) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (i = 0ULL; i + pattern_len <= line_len; i++) {
|
||||
u64 j = 0ULL;
|
||||
|
||||
while (j < pattern_len && line[i + j] == pattern[j]) {
|
||||
j++;
|
||||
}
|
||||
|
||||
if (j == pattern_len) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static u64 ush_grep_emit_matches(const char *input, u64 input_len, const char *pattern, int with_line_number) {
|
||||
u64 matches = 0ULL;
|
||||
u64 line_no = 1ULL;
|
||||
u64 start = 0ULL;
|
||||
u64 i;
|
||||
u64 pattern_len;
|
||||
|
||||
if (input == (const char *)0 || pattern == (const char *)0) {
|
||||
return 0ULL;
|
||||
}
|
||||
|
||||
pattern_len = ush_strlen(pattern);
|
||||
|
||||
for (i = 0ULL; i <= input_len; i++) {
|
||||
if (i == input_len || input[i] == '\n') {
|
||||
u64 line_len = i - start;
|
||||
|
||||
if (ush_grep_line_has_pattern(&input[start], line_len, pattern, pattern_len) != 0) {
|
||||
u64 j;
|
||||
|
||||
matches++;
|
||||
|
||||
if (with_line_number != 0) {
|
||||
ush_grep_write_u64_dec(line_no);
|
||||
(void)fputs(":", 1);
|
||||
}
|
||||
|
||||
for (j = 0ULL; j < line_len; j++) {
|
||||
(void)putchar((unsigned char)input[start + j]);
|
||||
}
|
||||
|
||||
(void)putchar('\n');
|
||||
}
|
||||
|
||||
start = i + 1ULL;
|
||||
line_no++;
|
||||
}
|
||||
}
|
||||
|
||||
return matches;
|
||||
}
|
||||
|
||||
static int ush_cmd_grep(const ush_state *sh, const char *arg) {
|
||||
char first[USH_PATH_MAX];
|
||||
char second[USH_PATH_MAX];
|
||||
char third[USH_PATH_MAX];
|
||||
char path[USH_PATH_MAX];
|
||||
const char *rest = "";
|
||||
const char *rest2 = "";
|
||||
const char *pattern = (const char *)0;
|
||||
const char *file_arg = (const char *)0;
|
||||
const char *input = (const char *)0;
|
||||
u64 input_len = 0ULL;
|
||||
u64 size;
|
||||
u64 got;
|
||||
int with_line_number = 0;
|
||||
static char file_buf[USH_COPY_MAX + 1U];
|
||||
|
||||
if (sh == (const ush_state *)0 || arg == (const char *)0 || arg[0] == '\0') {
|
||||
(void)puts("grep: usage grep [-n] <pattern> [file]");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_split_first_and_rest(arg, first, (u64)sizeof(first), &rest) == 0) {
|
||||
(void)puts("grep: usage grep [-n] <pattern> [file]");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_streq(first, "-n") != 0) {
|
||||
with_line_number = 1;
|
||||
|
||||
if (ush_split_first_and_rest(rest, second, (u64)sizeof(second), &rest2) == 0) {
|
||||
(void)puts("grep: usage grep [-n] <pattern> [file]");
|
||||
return 0;
|
||||
}
|
||||
|
||||
pattern = second;
|
||||
rest = rest2;
|
||||
} else {
|
||||
pattern = first;
|
||||
}
|
||||
|
||||
if (rest != (const char *)0 && rest[0] != '\0') {
|
||||
if (ush_split_first_and_rest(rest, third, (u64)sizeof(third), &rest2) == 0) {
|
||||
(void)puts("grep: usage grep [-n] <pattern> [file]");
|
||||
return 0;
|
||||
}
|
||||
|
||||
file_arg = third;
|
||||
|
||||
if (rest2 != (const char *)0 && rest2[0] != '\0') {
|
||||
(void)puts("grep: usage grep [-n] <pattern> [file]");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (pattern == (const char *)0 || pattern[0] == '\0') {
|
||||
(void)puts("grep: pattern required");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (file_arg != (const char *)0) {
|
||||
if (ush_resolve_path(sh, file_arg, path, (u64)sizeof(path)) == 0) {
|
||||
(void)puts("grep: invalid path");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (cleonos_sys_fs_stat_type(path) != 1ULL) {
|
||||
(void)puts("grep: file not found");
|
||||
return 0;
|
||||
}
|
||||
|
||||
size = cleonos_sys_fs_stat_size(path);
|
||||
|
||||
if (size == (u64)-1) {
|
||||
(void)puts("grep: failed to stat file");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (size > (u64)USH_COPY_MAX) {
|
||||
(void)puts("grep: file too large for user buffer");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (size == 0ULL) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
got = cleonos_sys_fs_read(path, file_buf, size);
|
||||
|
||||
if (got == 0ULL || got != size) {
|
||||
(void)puts("grep: read failed");
|
||||
return 0;
|
||||
}
|
||||
|
||||
file_buf[got] = '\0';
|
||||
input = file_buf;
|
||||
input_len = got;
|
||||
} else {
|
||||
if (ush_pipeline_stdin_text == (const char *)0) {
|
||||
(void)puts("grep: file path required (or pipeline input)");
|
||||
return 0;
|
||||
}
|
||||
|
||||
input = ush_pipeline_stdin_text;
|
||||
input_len = ush_pipeline_stdin_len;
|
||||
}
|
||||
|
||||
(void)ush_grep_emit_matches(input, input_len, pattern, with_line_number);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
ush_cmd_ctx ctx;
|
||||
ush_cmd_ret ret;
|
||||
ush_state sh;
|
||||
char initial_cwd[USH_PATH_MAX];
|
||||
int has_context = 0;
|
||||
int success = 0;
|
||||
const char *arg = "";
|
||||
|
||||
ush_zero(&ctx, (u64)sizeof(ctx));
|
||||
ush_zero(&ret, (u64)sizeof(ret));
|
||||
ush_init_state(&sh);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
|
||||
if (ush_command_ctx_read(&ctx) != 0) {
|
||||
if (ctx.cmd[0] != '\0' && ush_streq(ctx.cmd, "grep") != 0) {
|
||||
has_context = 1;
|
||||
arg = ctx.arg;
|
||||
if (ctx.cwd[0] == '/') {
|
||||
ush_copy(sh.cwd, (u64)sizeof(sh.cwd), ctx.cwd);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
success = ush_cmd_grep(&sh, arg);
|
||||
|
||||
if (has_context != 0) {
|
||||
if (ush_streq(sh.cwd, initial_cwd) == 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_CWD;
|
||||
ush_copy(ret.cwd, (u64)sizeof(ret.cwd), sh.cwd);
|
||||
}
|
||||
|
||||
if (sh.exit_requested != 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_EXIT;
|
||||
ret.exit_code = sh.exit_code;
|
||||
}
|
||||
|
||||
(void)ush_command_ret_write(&ret);
|
||||
}
|
||||
|
||||
return (success != 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
211
cleonos/c/apps/head_main.c
Normal file
211
cleonos/c/apps/head_main.c
Normal file
@@ -0,0 +1,211 @@
|
||||
#include "cmd_runtime.h"
|
||||
#include <stdio.h>
|
||||
|
||||
static int ush_head_parse_args(const char *arg, u64 *out_line_count, char *out_file, u64 out_file_size) {
|
||||
char first[USH_PATH_MAX];
|
||||
char second[USH_PATH_MAX];
|
||||
char third[USH_PATH_MAX];
|
||||
const char *rest = "";
|
||||
const char *rest2 = "";
|
||||
|
||||
if (out_line_count == (u64 *)0 || out_file == (char *)0 || out_file_size == 0ULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
*out_line_count = 10ULL;
|
||||
out_file[0] = '\0';
|
||||
|
||||
if (arg == (const char *)0 || arg[0] == '\0') {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (ush_split_first_and_rest(arg, first, (u64)sizeof(first), &rest) == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_streq(first, "-n") != 0) {
|
||||
if (ush_split_first_and_rest(rest, second, (u64)sizeof(second), &rest2) == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_parse_u64_dec(second, out_line_count) == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (rest2 != (const char *)0 && rest2[0] != '\0') {
|
||||
if (ush_split_first_and_rest(rest2, third, (u64)sizeof(third), &rest) == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (rest != (const char *)0 && rest[0] != '\0') {
|
||||
return 0;
|
||||
}
|
||||
|
||||
ush_copy(out_file, out_file_size, third);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (rest != (const char *)0 && rest[0] != '\0') {
|
||||
return 0;
|
||||
}
|
||||
|
||||
ush_copy(out_file, out_file_size, first);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int ush_head_load_input(const ush_state *sh, const char *file_arg, const char **out_input, u64 *out_input_len) {
|
||||
static char file_buf[USH_COPY_MAX + 1U];
|
||||
char path[USH_PATH_MAX];
|
||||
u64 size;
|
||||
u64 got;
|
||||
|
||||
if (sh == (const ush_state *)0 || out_input == (const char **)0 || out_input_len == (u64 *)0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
*out_input = (const char *)0;
|
||||
*out_input_len = 0ULL;
|
||||
|
||||
if (file_arg != (const char *)0 && file_arg[0] != '\0') {
|
||||
if (ush_resolve_path(sh, file_arg, path, (u64)sizeof(path)) == 0) {
|
||||
(void)puts("head: invalid path");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (cleonos_sys_fs_stat_type(path) != 1ULL) {
|
||||
(void)puts("head: file not found");
|
||||
return 0;
|
||||
}
|
||||
|
||||
size = cleonos_sys_fs_stat_size(path);
|
||||
|
||||
if (size == (u64)-1) {
|
||||
(void)puts("head: failed to stat file");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (size > (u64)USH_COPY_MAX) {
|
||||
(void)puts("head: file too large for user buffer");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (size == 0ULL) {
|
||||
file_buf[0] = '\0';
|
||||
*out_input = file_buf;
|
||||
*out_input_len = 0ULL;
|
||||
return 1;
|
||||
}
|
||||
|
||||
got = cleonos_sys_fs_read(path, file_buf, size);
|
||||
|
||||
if (got == 0ULL || got != size) {
|
||||
(void)puts("head: read failed");
|
||||
return 0;
|
||||
}
|
||||
|
||||
file_buf[got] = '\0';
|
||||
*out_input = file_buf;
|
||||
*out_input_len = got;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (ush_pipeline_stdin_text == (const char *)0) {
|
||||
(void)puts("head: file path required (or pipeline input)");
|
||||
return 0;
|
||||
}
|
||||
|
||||
*out_input = ush_pipeline_stdin_text;
|
||||
*out_input_len = ush_pipeline_stdin_len;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void ush_head_emit(const char *input, u64 input_len, u64 line_count) {
|
||||
u64 i;
|
||||
u64 emitted = 0ULL;
|
||||
|
||||
if (input == (const char *)0 || line_count == 0ULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0ULL; i < input_len; i++) {
|
||||
if (emitted >= line_count) {
|
||||
break;
|
||||
}
|
||||
|
||||
(void)putchar((unsigned char)input[i]);
|
||||
|
||||
if (input[i] == '\n') {
|
||||
emitted++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int ush_cmd_head(const ush_state *sh, const char *arg) {
|
||||
char file_arg[USH_PATH_MAX];
|
||||
const char *input = (const char *)0;
|
||||
u64 input_len = 0ULL;
|
||||
u64 line_count;
|
||||
|
||||
if (sh == (const ush_state *)0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_head_parse_args(arg, &line_count, file_arg, (u64)sizeof(file_arg)) == 0) {
|
||||
(void)puts("head: usage head [-n N] [file]");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_head_load_input(sh, file_arg, &input, &input_len) == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
ush_head_emit(input, input_len, line_count);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
ush_cmd_ctx ctx;
|
||||
ush_cmd_ret ret;
|
||||
ush_state sh;
|
||||
char initial_cwd[USH_PATH_MAX];
|
||||
int has_context = 0;
|
||||
int success = 0;
|
||||
const char *arg = "";
|
||||
|
||||
ush_zero(&ctx, (u64)sizeof(ctx));
|
||||
ush_zero(&ret, (u64)sizeof(ret));
|
||||
ush_init_state(&sh);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
|
||||
if (ush_command_ctx_read(&ctx) != 0) {
|
||||
if (ctx.cmd[0] != '\0' && ush_streq(ctx.cmd, "head") != 0) {
|
||||
has_context = 1;
|
||||
arg = ctx.arg;
|
||||
if (ctx.cwd[0] == '/') {
|
||||
ush_copy(sh.cwd, (u64)sizeof(sh.cwd), ctx.cwd);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
success = ush_cmd_head(&sh, arg);
|
||||
|
||||
if (has_context != 0) {
|
||||
if (ush_streq(sh.cwd, initial_cwd) == 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_CWD;
|
||||
ush_copy(ret.cwd, (u64)sizeof(ret.cwd), sh.cwd);
|
||||
}
|
||||
|
||||
if (sh.exit_requested != 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_EXIT;
|
||||
ret.exit_code = sh.exit_code;
|
||||
}
|
||||
|
||||
(void)ush_command_ret_write(&ret);
|
||||
}
|
||||
|
||||
return (success != 0) ? 0 : 1;
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
#include <cleonos_syscall.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
static const char msg[] = "[USER][HELLO] Hello world from /hello.elf\n";
|
||||
(void)cleonos_sys_tty_write(msg, (u64)(sizeof(msg) - 1U));
|
||||
(void)printf("[USER][HELLO] Hello world from %s\n", "/hello.elf");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,89 @@
|
||||
#include "shell/shell_internal.h"
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
return ush_command_program_main("help");
|
||||
#include "cmd_runtime.h"
|
||||
static int ush_cmd_help(void) {
|
||||
ush_writeln("commands:");
|
||||
ush_writeln(" help");
|
||||
ush_writeln(" args [a b c] (print argc/argv/envp)");
|
||||
ush_writeln(" ls [-l] [-R] [path]");
|
||||
ush_writeln(" cat [file] (reads pipeline input when file omitted)");
|
||||
ush_writeln(" grep [-n] <pattern> [file]");
|
||||
ush_writeln(" head [-n N] [file] / tail [-n N] [file]");
|
||||
ush_writeln(" wc [file] / cut -d <char> -f <N> [file] / uniq [file] / sort [file]");
|
||||
ush_writeln(" pwd");
|
||||
ush_writeln(" cd [dir]");
|
||||
ush_writeln(" exec|run <path|name> [args...]");
|
||||
ush_writeln(" clear");
|
||||
ush_writeln(" ansi / ansitest / color");
|
||||
ush_writeln(" wavplay <file.wav> [steps] [ticks] / wavplay --stop");
|
||||
ush_writeln(" fastfetch [--plain]");
|
||||
ush_writeln(" memstat / fsstat / taskstat / userstat / shstat / stats");
|
||||
ush_writeln(" tty [index]");
|
||||
ush_writeln(" dmesg [n]");
|
||||
ush_writeln(" kbdstat");
|
||||
ush_writeln(" mkdir <dir> (/temp only)");
|
||||
ush_writeln(" touch <file> (/temp only)");
|
||||
ush_writeln(" write <file> <text> (/temp only, or from pipeline)");
|
||||
ush_writeln(" append <file> <text> (/temp only, or from pipeline)");
|
||||
ush_writeln(" cp <src> <dst> (dst /temp only)");
|
||||
ush_writeln(" mv <src> <dst> (/temp only)");
|
||||
ush_writeln(" rm <path> (/temp only)");
|
||||
ush_writeln(" pid");
|
||||
ush_writeln(" spawn <path|name> [args...] / bg <path|name> [args...]");
|
||||
ush_writeln(" wait <pid> / fg [pid]");
|
||||
ush_writeln(" kill <pid> [signal]");
|
||||
ush_writeln(" jobs [-a] / ps [-a] [-u] / procstat [pid|self] [-a]");
|
||||
ush_writeln(" top [--once] [-n loops] [-d ticks] / sysstat [-a] [-n N]");
|
||||
ush_writeln(" kdbg sym <addr> / kdbg bt <rbp> <rip> / kdbg regs");
|
||||
ush_writeln(" sleep <ticks>");
|
||||
ush_writeln(" spin (busy loop test for Alt+Ctrl+C)");
|
||||
ush_writeln(" yield");
|
||||
ush_writeln(" shutdown / restart");
|
||||
ush_writeln(" exit [code]");
|
||||
ush_writeln(" rusttest / panic / elfloader (kernel shell only)");
|
||||
ush_writeln("pipeline/redirection: cmd1 | cmd2 | cmd3 > /temp/out.txt");
|
||||
ush_writeln("redirection append: cmd >> /temp/out.txt");
|
||||
ush_writeln("edit keys: Left/Right, Home/End, Up/Down history");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
ush_cmd_ctx ctx;
|
||||
ush_cmd_ret ret;
|
||||
ush_state sh;
|
||||
char initial_cwd[USH_PATH_MAX];
|
||||
int has_context = 0;
|
||||
int success = 0;
|
||||
|
||||
ush_zero(&ctx, (u64)sizeof(ctx));
|
||||
ush_zero(&ret, (u64)sizeof(ret));
|
||||
ush_init_state(&sh);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
|
||||
if (ush_command_ctx_read(&ctx) != 0) {
|
||||
if (ctx.cmd[0] != '\0' && ush_streq(ctx.cmd, "help") != 0) {
|
||||
has_context = 1;
|
||||
if (ctx.cwd[0] == '/') {
|
||||
ush_copy(sh.cwd, (u64)sizeof(sh.cwd), ctx.cwd);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
success = ush_cmd_help();
|
||||
|
||||
if (has_context != 0) {
|
||||
if (ush_streq(sh.cwd, initial_cwd) == 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_CWD;
|
||||
ush_copy(ret.cwd, (u64)sizeof(ret.cwd), sh.cwd);
|
||||
}
|
||||
|
||||
if (sh.exit_requested != 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_EXIT;
|
||||
ret.exit_code = sh.exit_code;
|
||||
}
|
||||
|
||||
(void)ush_command_ret_write(&ret);
|
||||
}
|
||||
|
||||
return (success != 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
145
cleonos/c/apps/jobs_main.c
Normal file
145
cleonos/c/apps/jobs_main.c
Normal file
@@ -0,0 +1,145 @@
|
||||
#include "cmd_runtime.h"
|
||||
|
||||
static int ush_jobs_is_user_path(const char *path) {
|
||||
if (path == (const char *)0 || path[0] != '/') {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (path[1] == 's' && path[2] == 'y' && path[3] == 's' && path[4] == 't' && path[5] == 'e' && path[6] == 'm' &&
|
||||
(path[7] == '/' || path[7] == '\0')) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (path[1] == 'd' && path[2] == 'r' && path[3] == 'i' && path[4] == 'v' && path[5] == 'e' && path[6] == 'r' &&
|
||||
(path[7] == '/' || path[7] == '\0')) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static const char *ush_jobs_state_name(u64 state) {
|
||||
if (state == CLEONOS_PROC_STATE_PENDING) {
|
||||
return "PENDING";
|
||||
}
|
||||
if (state == CLEONOS_PROC_STATE_RUNNING) {
|
||||
return "RUNNING";
|
||||
}
|
||||
if (state == CLEONOS_PROC_STATE_STOPPED) {
|
||||
return "STOPPED";
|
||||
}
|
||||
if (state == CLEONOS_PROC_STATE_EXITED) {
|
||||
return "EXITED ";
|
||||
}
|
||||
return "UNUSED ";
|
||||
}
|
||||
|
||||
static int ush_cmd_jobs(const char *arg) {
|
||||
u64 proc_count;
|
||||
u64 tty_active = cleonos_sys_tty_active();
|
||||
u64 i;
|
||||
u64 shown = 0ULL;
|
||||
int include_exited = 0;
|
||||
|
||||
if (arg != (const char *)0 && arg[0] != '\0') {
|
||||
if (ush_streq(arg, "-a") != 0 || ush_streq(arg, "--all") != 0) {
|
||||
include_exited = 1;
|
||||
} else {
|
||||
ush_writeln("jobs: usage jobs [-a|--all]");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
proc_count = cleonos_sys_proc_count();
|
||||
ush_writeln("jobs:");
|
||||
|
||||
for (i = 0ULL; i < proc_count; i++) {
|
||||
u64 pid = 0ULL;
|
||||
cleonos_proc_snapshot snap;
|
||||
const char *state_name;
|
||||
|
||||
if (cleonos_sys_proc_pid_at(i, &pid) == 0ULL || pid == 0ULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (cleonos_sys_proc_snapshot(pid, &snap, (u64)sizeof(snap)) == 0ULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ush_jobs_is_user_path(snap.path) == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (snap.tty_index != tty_active) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (include_exited == 0 && snap.state == CLEONOS_PROC_STATE_EXITED) {
|
||||
continue;
|
||||
}
|
||||
|
||||
state_name = ush_jobs_state_name(snap.state);
|
||||
ush_write("[");
|
||||
ush_write_hex_u64(snap.pid);
|
||||
ush_write("] ");
|
||||
ush_write(state_name);
|
||||
ush_write(" ");
|
||||
ush_write(snap.path);
|
||||
if (snap.state == CLEONOS_PROC_STATE_EXITED) {
|
||||
ush_write(" status=");
|
||||
ush_write_hex_u64(snap.exit_status);
|
||||
}
|
||||
ush_write_char('\n');
|
||||
shown++;
|
||||
}
|
||||
|
||||
if (shown == 0ULL) {
|
||||
ush_writeln("(no jobs)");
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
ush_cmd_ctx ctx;
|
||||
ush_cmd_ret ret;
|
||||
ush_state sh;
|
||||
char initial_cwd[USH_PATH_MAX];
|
||||
int has_context = 0;
|
||||
int success = 0;
|
||||
const char *arg = "";
|
||||
|
||||
ush_zero(&ctx, (u64)sizeof(ctx));
|
||||
ush_zero(&ret, (u64)sizeof(ret));
|
||||
ush_init_state(&sh);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
|
||||
if (ush_command_ctx_read(&ctx) != 0) {
|
||||
if (ctx.cmd[0] != '\0' && ush_streq(ctx.cmd, "jobs") != 0) {
|
||||
has_context = 1;
|
||||
arg = ctx.arg;
|
||||
if (ctx.cwd[0] == '/') {
|
||||
ush_copy(sh.cwd, (u64)sizeof(sh.cwd), ctx.cwd);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
success = ush_cmd_jobs(arg);
|
||||
|
||||
if (has_context != 0) {
|
||||
if (ush_streq(sh.cwd, initial_cwd) == 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_CWD;
|
||||
ush_copy(ret.cwd, (u64)sizeof(ret.cwd), sh.cwd);
|
||||
}
|
||||
|
||||
if (sh.exit_requested != 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_EXIT;
|
||||
ret.exit_code = sh.exit_code;
|
||||
}
|
||||
|
||||
(void)ush_command_ret_write(&ret);
|
||||
}
|
||||
|
||||
return (success != 0) ? 0 : 1;
|
||||
}
|
||||
@@ -1,6 +1,54 @@
|
||||
#include "shell/shell_internal.h"
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
return ush_command_program_main("kbdstat");
|
||||
#include "cmd_runtime.h"
|
||||
static int ush_cmd_kbdstat(void) {
|
||||
ush_writeln("kbdstat:");
|
||||
ush_print_kv_hex(" BUFFERED", cleonos_sys_kbd_buffered());
|
||||
ush_print_kv_hex(" PUSHED", cleonos_sys_kbd_pushed());
|
||||
ush_print_kv_hex(" POPPED", cleonos_sys_kbd_popped());
|
||||
ush_print_kv_hex(" DROPPED", cleonos_sys_kbd_dropped());
|
||||
ush_print_kv_hex(" HOTKEY_SWITCHES", cleonos_sys_kbd_hotkey_switches());
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
ush_cmd_ctx ctx;
|
||||
ush_cmd_ret ret;
|
||||
ush_state sh;
|
||||
char initial_cwd[USH_PATH_MAX];
|
||||
int has_context = 0;
|
||||
int success = 0;
|
||||
|
||||
ush_zero(&ctx, (u64)sizeof(ctx));
|
||||
ush_zero(&ret, (u64)sizeof(ret));
|
||||
ush_init_state(&sh);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
|
||||
if (ush_command_ctx_read(&ctx) != 0) {
|
||||
if (ctx.cmd[0] != '\0' && ush_streq(ctx.cmd, "kbdstat") != 0) {
|
||||
has_context = 1;
|
||||
if (ctx.cwd[0] == '/') {
|
||||
ush_copy(sh.cwd, (u64)sizeof(sh.cwd), ctx.cwd);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
success = ush_cmd_kbdstat();
|
||||
|
||||
if (has_context != 0) {
|
||||
if (ush_streq(sh.cwd, initial_cwd) == 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_CWD;
|
||||
ush_copy(ret.cwd, (u64)sizeof(ret.cwd), sh.cwd);
|
||||
}
|
||||
|
||||
if (sh.exit_requested != 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_EXIT;
|
||||
ret.exit_code = sh.exit_code;
|
||||
}
|
||||
|
||||
(void)ush_command_ret_write(&ret);
|
||||
}
|
||||
|
||||
return (success != 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
|
||||
269
cleonos/c/apps/kdbg_main.c
Normal file
269
cleonos/c/apps/kdbg_main.c
Normal file
@@ -0,0 +1,269 @@
|
||||
#include "cmd_runtime.h"
|
||||
|
||||
#define USH_KDBG_TEXT_MAX 2048ULL
|
||||
|
||||
static int ush_kdbg_is_hex(char ch) {
|
||||
if ((ch >= '0' && ch <= '9') || (ch >= 'a' && ch <= 'f') || (ch >= 'A' && ch <= 'F')) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static u64 ush_kdbg_hex_value(char ch) {
|
||||
if (ch >= '0' && ch <= '9') {
|
||||
return (u64)(ch - '0');
|
||||
}
|
||||
|
||||
if (ch >= 'a' && ch <= 'f') {
|
||||
return 10ULL + (u64)(ch - 'a');
|
||||
}
|
||||
|
||||
return 10ULL + (u64)(ch - 'A');
|
||||
}
|
||||
|
||||
static int ush_kdbg_parse_u64(const char *text, u64 *out_value) {
|
||||
u64 value = 0ULL;
|
||||
u64 i = 0ULL;
|
||||
int is_hex = 0;
|
||||
|
||||
if (text == (const char *)0 || out_value == (u64 *)0 || text[0] == '\0') {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (text[0] == '0' && (text[1] == 'x' || text[1] == 'X')) {
|
||||
i = 2ULL;
|
||||
is_hex = 1;
|
||||
} else if (text[0] == 'x' || text[0] == 'X') {
|
||||
i = 1ULL;
|
||||
is_hex = 1;
|
||||
}
|
||||
|
||||
if (is_hex != 0) {
|
||||
if (text[i] == '\0') {
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (text[i] != '\0') {
|
||||
u64 digit;
|
||||
|
||||
if (ush_kdbg_is_hex(text[i]) == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
digit = ush_kdbg_hex_value(text[i]);
|
||||
|
||||
if (value > ((0xFFFFFFFFFFFFFFFFULL - digit) >> 4U)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
value = (value << 4U) | digit;
|
||||
i++;
|
||||
}
|
||||
|
||||
*out_value = value;
|
||||
return 1;
|
||||
}
|
||||
|
||||
return ush_parse_u64_dec(text, out_value);
|
||||
}
|
||||
|
||||
static int ush_kdbg_next_token(const char **io_cursor, char *out, u64 out_size) {
|
||||
const char *p;
|
||||
u64 n = 0ULL;
|
||||
|
||||
if (io_cursor == (const char **)0 || out == (char *)0 || out_size == 0ULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
p = *io_cursor;
|
||||
out[0] = '\0';
|
||||
|
||||
if (p == (const char *)0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (*p != '\0' && ush_is_space(*p) != 0) {
|
||||
p++;
|
||||
}
|
||||
|
||||
if (*p == '\0') {
|
||||
*io_cursor = p;
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (*p != '\0' && ush_is_space(*p) == 0) {
|
||||
if (n + 1ULL < out_size) {
|
||||
out[n++] = *p;
|
||||
}
|
||||
p++;
|
||||
}
|
||||
|
||||
out[n] = '\0';
|
||||
*io_cursor = p;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int ush_kdbg_has_more_tokens(const char *cursor) {
|
||||
if (cursor == (const char *)0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (*cursor != '\0') {
|
||||
if (ush_is_space(*cursor) == 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
cursor++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void ush_kdbg_usage(void) {
|
||||
ush_writeln("usage:");
|
||||
ush_writeln(" kdbg sym <addr>");
|
||||
ush_writeln(" kdbg bt <rbp> <rip>");
|
||||
ush_writeln(" kdbg regs");
|
||||
}
|
||||
|
||||
static int ush_cmd_kdbg(const char *arg) {
|
||||
const char *cursor = arg;
|
||||
char subcmd[USH_CMD_MAX];
|
||||
char tok0[USH_PATH_MAX];
|
||||
char tok1[USH_PATH_MAX];
|
||||
char out[USH_KDBG_TEXT_MAX];
|
||||
u64 got;
|
||||
u64 value0;
|
||||
u64 value1;
|
||||
|
||||
if (ush_kdbg_next_token(&cursor, subcmd, (u64)sizeof(subcmd)) == 0) {
|
||||
ush_kdbg_usage();
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_streq(subcmd, "sym") != 0) {
|
||||
if (ush_kdbg_next_token(&cursor, tok0, (u64)sizeof(tok0)) == 0 || ush_kdbg_has_more_tokens(cursor) != 0) {
|
||||
ush_kdbg_usage();
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_kdbg_parse_u64(tok0, &value0) == 0) {
|
||||
ush_writeln("kdbg: invalid addr");
|
||||
return 0;
|
||||
}
|
||||
|
||||
got = cleonos_sys_kdbg_sym(value0, out, (u64)sizeof(out));
|
||||
|
||||
if (got == 0ULL) {
|
||||
ush_writeln("kdbg: sym failed");
|
||||
return 0;
|
||||
}
|
||||
|
||||
out[(u64)sizeof(out) - 1ULL] = '\0';
|
||||
ush_writeln(out);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (ush_streq(subcmd, "bt") != 0) {
|
||||
if (ush_kdbg_next_token(&cursor, tok0, (u64)sizeof(tok0)) == 0 ||
|
||||
ush_kdbg_next_token(&cursor, tok1, (u64)sizeof(tok1)) == 0 ||
|
||||
ush_kdbg_has_more_tokens(cursor) != 0) {
|
||||
ush_kdbg_usage();
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_kdbg_parse_u64(tok0, &value0) == 0 || ush_kdbg_parse_u64(tok1, &value1) == 0) {
|
||||
ush_writeln("kdbg: invalid rbp/rip");
|
||||
return 0;
|
||||
}
|
||||
|
||||
got = cleonos_sys_kdbg_bt(value0, value1, out, (u64)sizeof(out));
|
||||
|
||||
if (got == 0ULL) {
|
||||
ush_writeln("kdbg: bt failed");
|
||||
return 0;
|
||||
}
|
||||
|
||||
out[(u64)sizeof(out) - 1ULL] = '\0';
|
||||
ush_write(out);
|
||||
if (got > (u64)sizeof(out) - 1ULL) {
|
||||
got = (u64)sizeof(out) - 1ULL;
|
||||
}
|
||||
if (got > 0ULL && out[got - 1ULL] != '\n') {
|
||||
ush_write_char('\n');
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (ush_streq(subcmd, "regs") != 0) {
|
||||
if (ush_kdbg_has_more_tokens(cursor) != 0) {
|
||||
ush_kdbg_usage();
|
||||
return 0;
|
||||
}
|
||||
|
||||
got = cleonos_sys_kdbg_regs(out, (u64)sizeof(out));
|
||||
|
||||
if (got == 0ULL) {
|
||||
ush_writeln("kdbg: regs failed");
|
||||
return 0;
|
||||
}
|
||||
|
||||
out[(u64)sizeof(out) - 1ULL] = '\0';
|
||||
ush_write(out);
|
||||
if (got > (u64)sizeof(out) - 1ULL) {
|
||||
got = (u64)sizeof(out) - 1ULL;
|
||||
}
|
||||
if (got > 0ULL && out[got - 1ULL] != '\n') {
|
||||
ush_write_char('\n');
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
ush_kdbg_usage();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
ush_cmd_ctx ctx;
|
||||
ush_cmd_ret ret;
|
||||
ush_state sh;
|
||||
char initial_cwd[USH_PATH_MAX];
|
||||
int has_context = 0;
|
||||
int success = 0;
|
||||
const char *arg = "";
|
||||
|
||||
ush_zero(&ctx, (u64)sizeof(ctx));
|
||||
ush_zero(&ret, (u64)sizeof(ret));
|
||||
ush_init_state(&sh);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
|
||||
if (ush_command_ctx_read(&ctx) != 0) {
|
||||
if (ctx.cmd[0] != '\0' && ush_streq(ctx.cmd, "kdbg") != 0) {
|
||||
has_context = 1;
|
||||
arg = ctx.arg;
|
||||
if (ctx.cwd[0] == '/') {
|
||||
ush_copy(sh.cwd, (u64)sizeof(sh.cwd), ctx.cwd);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
success = ush_cmd_kdbg(arg);
|
||||
|
||||
if (has_context != 0) {
|
||||
if (ush_streq(sh.cwd, initial_cwd) == 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_CWD;
|
||||
ush_copy(ret.cwd, (u64)sizeof(ret.cwd), sh.cwd);
|
||||
}
|
||||
|
||||
if (sh.exit_requested != 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_EXIT;
|
||||
ret.exit_code = sh.exit_code;
|
||||
}
|
||||
|
||||
(void)ush_command_ret_write(&ret);
|
||||
}
|
||||
|
||||
return (success != 0) ? 0 : 1;
|
||||
}
|
||||
182
cleonos/c/apps/kill_main.c
Normal file
182
cleonos/c/apps/kill_main.c
Normal file
@@ -0,0 +1,182 @@
|
||||
#include "cmd_runtime.h"
|
||||
|
||||
static void ush_kill_upper_copy(char *dst, u64 dst_size, const char *src) {
|
||||
u64 i = 0ULL;
|
||||
|
||||
if (dst == (char *)0 || dst_size == 0ULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
dst[0] = '\0';
|
||||
|
||||
if (src == (const char *)0) {
|
||||
return;
|
||||
}
|
||||
|
||||
while (src[i] != '\0' && i + 1ULL < dst_size) {
|
||||
char ch = src[i];
|
||||
if (ch >= 'a' && ch <= 'z') {
|
||||
ch = (char)(ch - ('a' - 'A'));
|
||||
}
|
||||
dst[i] = ch;
|
||||
i++;
|
||||
}
|
||||
|
||||
dst[i] = '\0';
|
||||
}
|
||||
|
||||
static int ush_kill_parse_signal_name(const char *text, u64 *out_signal) {
|
||||
char name[32];
|
||||
u64 start = 0ULL;
|
||||
|
||||
if (text == (const char *)0 || out_signal == (u64 *)0 || text[0] == '\0') {
|
||||
return 0;
|
||||
}
|
||||
|
||||
ush_kill_upper_copy(name, (u64)sizeof(name), text);
|
||||
|
||||
if (name[0] == '-') {
|
||||
start = 1ULL;
|
||||
}
|
||||
|
||||
if (name[start] == 'S' && name[start + 1ULL] == 'I' && name[start + 2ULL] == 'G') {
|
||||
start += 3ULL;
|
||||
}
|
||||
|
||||
if (name[start] == '\0') {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_streq(&name[start], "TERM") != 0) {
|
||||
*out_signal = CLEONOS_SIGTERM;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (ush_streq(&name[start], "KILL") != 0) {
|
||||
*out_signal = CLEONOS_SIGKILL;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (ush_streq(&name[start], "STOP") != 0) {
|
||||
*out_signal = CLEONOS_SIGSTOP;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (ush_streq(&name[start], "CONT") != 0) {
|
||||
*out_signal = CLEONOS_SIGCONT;
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ush_kill_parse_signal(const char *text, u64 *out_signal) {
|
||||
u64 parsed = 0ULL;
|
||||
|
||||
if (text == (const char *)0 || out_signal == (u64 *)0 || text[0] == '\0') {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_parse_u64_dec(text, &parsed) != 0 && parsed <= 255ULL) {
|
||||
*out_signal = parsed;
|
||||
return 1;
|
||||
}
|
||||
|
||||
return ush_kill_parse_signal_name(text, out_signal);
|
||||
}
|
||||
|
||||
static int ush_cmd_kill(const char *arg) {
|
||||
char pid_text[USH_PATH_MAX];
|
||||
char signal_text[USH_PATH_MAX];
|
||||
const char *rest = "";
|
||||
u64 pid;
|
||||
u64 signal = CLEONOS_SIGTERM;
|
||||
u64 ret;
|
||||
|
||||
if (arg == (const char *)0 || arg[0] == '\0') {
|
||||
ush_writeln("kill: usage kill <pid> [TERM|KILL|STOP|CONT|signal]");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_split_first_and_rest(arg, pid_text, (u64)sizeof(pid_text), &rest) == 0) {
|
||||
ush_writeln("kill: usage kill <pid> [TERM|KILL|STOP|CONT|signal]");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_parse_u64_dec(pid_text, &pid) == 0 || pid == 0ULL) {
|
||||
ush_writeln("kill: invalid pid");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (rest != (const char *)0 && rest[0] != '\0') {
|
||||
ush_copy(signal_text, (u64)sizeof(signal_text), rest);
|
||||
ush_trim_line(signal_text);
|
||||
if (ush_kill_parse_signal(signal_text, &signal) == 0) {
|
||||
ush_writeln("kill: invalid signal");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
ret = cleonos_sys_proc_kill(pid, signal);
|
||||
|
||||
if (ret == (u64)-1) {
|
||||
ush_writeln("kill: pid not found");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ret == 0ULL) {
|
||||
ush_writeln("kill: target cannot be terminated right now");
|
||||
return 0;
|
||||
}
|
||||
|
||||
ush_write("kill: sent signal ");
|
||||
ush_write_hex_u64(signal);
|
||||
ush_write(" to ");
|
||||
ush_write_hex_u64(pid);
|
||||
ush_write_char('\n');
|
||||
return 1;
|
||||
}
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
ush_cmd_ctx ctx;
|
||||
ush_cmd_ret ret;
|
||||
ush_state sh;
|
||||
char initial_cwd[USH_PATH_MAX];
|
||||
int has_context = 0;
|
||||
int success = 0;
|
||||
const char *arg = "";
|
||||
|
||||
ush_zero(&ctx, (u64)sizeof(ctx));
|
||||
ush_zero(&ret, (u64)sizeof(ret));
|
||||
ush_init_state(&sh);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
|
||||
if (ush_command_ctx_read(&ctx) != 0) {
|
||||
if (ctx.cmd[0] != '\0' && ush_streq(ctx.cmd, "kill") != 0) {
|
||||
has_context = 1;
|
||||
arg = ctx.arg;
|
||||
if (ctx.cwd[0] == '/') {
|
||||
ush_copy(sh.cwd, (u64)sizeof(sh.cwd), ctx.cwd);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
success = ush_cmd_kill(arg);
|
||||
|
||||
if (has_context != 0) {
|
||||
if (ush_streq(sh.cwd, initial_cwd) == 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_CWD;
|
||||
ush_copy(ret.cwd, (u64)sizeof(ret.cwd), sh.cwd);
|
||||
}
|
||||
|
||||
if (sh.exit_requested != 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_EXIT;
|
||||
ret.exit_code = sh.exit_code;
|
||||
}
|
||||
|
||||
(void)ush_command_ret_write(&ret);
|
||||
}
|
||||
|
||||
return (success != 0) ? 0 : 1;
|
||||
}
|
||||
257
cleonos/c/apps/libctest_main.c
Normal file
257
cleonos/c/apps/libctest_main.c
Normal file
@@ -0,0 +1,257 @@
|
||||
#include <ctype.h>
|
||||
#include <limits.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
static int g_total = 0;
|
||||
static int g_failed = 0;
|
||||
|
||||
static int test_vsnprintf(char *out, unsigned long out_size, const char *fmt, ...) {
|
||||
va_list args;
|
||||
int rc;
|
||||
|
||||
va_start(args, fmt);
|
||||
rc = vsnprintf(out, out_size, fmt, args);
|
||||
va_end(args);
|
||||
return rc;
|
||||
}
|
||||
|
||||
static void test_fail(const char *group, int line, const char *expr) {
|
||||
g_failed++;
|
||||
(void)printf("[libctest][FAIL] %s:%d %s\n", group, line, expr);
|
||||
}
|
||||
|
||||
#define TEST_ASSERT(group, expr) \
|
||||
do { \
|
||||
g_total++; \
|
||||
if (!(expr)) { \
|
||||
test_fail((group), __LINE__, #expr); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
static void test_string_lib(void) {
|
||||
char buf[32];
|
||||
char src[16];
|
||||
char tok_text[32];
|
||||
char tok_text2[32];
|
||||
char *save = (char *)0;
|
||||
char *tok;
|
||||
void *ptr;
|
||||
|
||||
(void)memset(buf, 0xAA, sizeof(buf));
|
||||
ptr = memset(buf, 'x', 5U);
|
||||
TEST_ASSERT("string", ptr == buf);
|
||||
TEST_ASSERT("string", buf[0] == 'x' && buf[4] == 'x');
|
||||
TEST_ASSERT("string", memset((void *)0, 1, 4U) == (void *)0);
|
||||
|
||||
(void)memset(buf, 0, sizeof(buf));
|
||||
(void)strcpy(src, "abcdef");
|
||||
ptr = memcpy(buf, src, 6U);
|
||||
TEST_ASSERT("string", ptr == buf);
|
||||
TEST_ASSERT("string", memcmp(buf, "abcdef", 6U) == 0);
|
||||
TEST_ASSERT("string", memcpy((void *)0, src, 3U) == (void *)0);
|
||||
|
||||
(void)strcpy(buf, "abcdef");
|
||||
(void)memmove(buf + 2, buf, 4U);
|
||||
TEST_ASSERT("string", memcmp(buf, "ababcd", 6U) == 0);
|
||||
(void)strcpy(buf, "abcdef");
|
||||
(void)memmove(buf, buf + 2, 4U);
|
||||
TEST_ASSERT("string", memcmp(buf, "cdef", 4U) == 0);
|
||||
TEST_ASSERT("string", memmove((void *)0, src, 3U) == (void *)0);
|
||||
|
||||
TEST_ASSERT("string", memcmp("abc", "abc", 3U) == 0);
|
||||
TEST_ASSERT("string", memcmp("abc", "abd", 3U) < 0);
|
||||
TEST_ASSERT("string", memcmp("abe", "abd", 3U) > 0);
|
||||
TEST_ASSERT("string", memcmp((const void *)0, "a", 1U) < 0);
|
||||
TEST_ASSERT("string", memcmp("a", (const void *)0, 1U) > 0);
|
||||
|
||||
TEST_ASSERT("string", memchr("abc", 'b', 3U) == (const void *)("abc" + 1));
|
||||
TEST_ASSERT("string", memchr("abc", 'z', 3U) == (void *)0);
|
||||
TEST_ASSERT("string", memchr((const void *)0, 'a', 1U) == (void *)0);
|
||||
|
||||
TEST_ASSERT("string", strlen("abc") == 3U);
|
||||
TEST_ASSERT("string", strlen("") == 0U);
|
||||
TEST_ASSERT("string", strlen((const char *)0) == 0U);
|
||||
TEST_ASSERT("string", strnlen("abcdef", 3U) == 3U);
|
||||
TEST_ASSERT("string", strnlen("ab", 8U) == 2U);
|
||||
|
||||
(void)strcpy(buf, "hello");
|
||||
TEST_ASSERT("string", strcmp(buf, "hello") == 0);
|
||||
TEST_ASSERT("string", strcpy((char *)0, "x") == (char *)0);
|
||||
TEST_ASSERT("string", strcmp((const char *)0, "x") < 0);
|
||||
TEST_ASSERT("string", strcmp("x", (const char *)0) > 0);
|
||||
TEST_ASSERT("string", strcmp((const char *)0, (const char *)0) == 0);
|
||||
|
||||
(void)memset(buf, 'Z', 8U);
|
||||
(void)strncpy(buf, "hi", 6U);
|
||||
TEST_ASSERT("string", buf[0] == 'h' && buf[1] == 'i');
|
||||
TEST_ASSERT("string", buf[2] == '\0' && buf[5] == '\0');
|
||||
(void)strncpy(buf, "abcdef", 3U);
|
||||
TEST_ASSERT("string", buf[0] == 'a' && buf[1] == 'b' && buf[2] == 'c');
|
||||
TEST_ASSERT("string", strncmp("abc", "abd", 2U) == 0);
|
||||
TEST_ASSERT("string", strncmp("abc", "abd", 3U) < 0);
|
||||
TEST_ASSERT("string", strncmp((const char *)0, "a", 1U) < 0);
|
||||
|
||||
TEST_ASSERT("string", strchr("abc", 'b') == (char *)("abc" + 1));
|
||||
TEST_ASSERT("string", strchr("abc", '\0') == (char *)("abc" + 3));
|
||||
TEST_ASSERT("string", strchr((const char *)0, 'a') == (char *)0);
|
||||
TEST_ASSERT("string", strrchr("abca", 'a') == (char *)("abca" + 3));
|
||||
TEST_ASSERT("string", strrchr("abc", 'z') == (char *)0);
|
||||
|
||||
TEST_ASSERT("string", strstr("hello world", "world") == (char *)("hello world" + 6));
|
||||
TEST_ASSERT("string", strstr("abc", "") == (char *)"abc");
|
||||
TEST_ASSERT("string", strstr((const char *)0, "a") == (char *)0);
|
||||
TEST_ASSERT("string", strspn("abc123", "abc") == 3U);
|
||||
TEST_ASSERT("string", strspn((const char *)0, "abc") == 0U);
|
||||
TEST_ASSERT("string", strcspn("abc123", "123") == 3U);
|
||||
TEST_ASSERT("string", strcspn("abcdef", (const char *)0) == 0U);
|
||||
TEST_ASSERT("string", strpbrk("abcdef", "xzde") == (char *)("abcdef" + 3));
|
||||
TEST_ASSERT("string", strpbrk("abcdef", "XYZ") == (char *)0);
|
||||
|
||||
(void)strcpy(buf, "ab");
|
||||
(void)strcat(buf, "cd");
|
||||
TEST_ASSERT("string", strcmp(buf, "abcd") == 0);
|
||||
(void)strncat(buf, "efgh", 2U);
|
||||
TEST_ASSERT("string", strcmp(buf, "abcdef") == 0);
|
||||
TEST_ASSERT("string", strcat((char *)0, "x") == (char *)0);
|
||||
TEST_ASSERT("string", strncat((char *)0, "x", 1U) == (char *)0);
|
||||
|
||||
(void)strcpy(tok_text, "a,,b;c");
|
||||
tok = strtok_r(tok_text, ",;", &save);
|
||||
TEST_ASSERT("string", tok != (char *)0 && strcmp(tok, "a") == 0);
|
||||
tok = strtok_r((char *)0, ",;", &save);
|
||||
TEST_ASSERT("string", tok != (char *)0 && strcmp(tok, "b") == 0);
|
||||
tok = strtok_r((char *)0, ",;", &save);
|
||||
TEST_ASSERT("string", tok != (char *)0 && strcmp(tok, "c") == 0);
|
||||
tok = strtok_r((char *)0, ",;", &save);
|
||||
TEST_ASSERT("string", tok == (char *)0);
|
||||
TEST_ASSERT("string", strtok_r(tok_text, (const char *)0, &save) == (char *)0);
|
||||
TEST_ASSERT("string", strtok_r(tok_text, ",", (char **)0) == (char *)0);
|
||||
|
||||
(void)strcpy(tok_text2, "x y");
|
||||
tok = strtok(tok_text2, " ");
|
||||
TEST_ASSERT("string", tok != (char *)0 && strcmp(tok, "x") == 0);
|
||||
tok = strtok((char *)0, " ");
|
||||
TEST_ASSERT("string", tok != (char *)0 && strcmp(tok, "y") == 0);
|
||||
tok = strtok((char *)0, " ");
|
||||
TEST_ASSERT("string", tok == (char *)0);
|
||||
}
|
||||
|
||||
static void test_ctype_lib(void) {
|
||||
TEST_ASSERT("ctype", isspace(' ') != 0);
|
||||
TEST_ASSERT("ctype", isspace('\n') != 0);
|
||||
TEST_ASSERT("ctype", isspace('A') == 0);
|
||||
TEST_ASSERT("ctype", isdigit('0') != 0 && isdigit('9') != 0);
|
||||
TEST_ASSERT("ctype", isdigit('x') == 0);
|
||||
TEST_ASSERT("ctype", isalpha('a') != 0 && isalpha('Z') != 0);
|
||||
TEST_ASSERT("ctype", isalpha('1') == 0);
|
||||
TEST_ASSERT("ctype", isalnum('b') != 0 && isalnum('8') != 0);
|
||||
TEST_ASSERT("ctype", isalnum('#') == 0);
|
||||
TEST_ASSERT("ctype", isxdigit('f') != 0 && isxdigit('A') != 0 && isxdigit('9') != 0);
|
||||
TEST_ASSERT("ctype", isxdigit('g') == 0);
|
||||
TEST_ASSERT("ctype", isupper('Q') != 0 && isupper('q') == 0);
|
||||
TEST_ASSERT("ctype", islower('q') != 0 && islower('Q') == 0);
|
||||
TEST_ASSERT("ctype", isprint(' ') != 0 && isprint('~') != 0);
|
||||
TEST_ASSERT("ctype", isprint('\x1F') == 0);
|
||||
TEST_ASSERT("ctype", iscntrl('\n') != 0 && iscntrl(0x7F) != 0);
|
||||
TEST_ASSERT("ctype", iscntrl('A') == 0);
|
||||
TEST_ASSERT("ctype", tolower('A') == 'a');
|
||||
TEST_ASSERT("ctype", tolower('z') == 'z');
|
||||
TEST_ASSERT("ctype", toupper('a') == 'A');
|
||||
TEST_ASSERT("ctype", toupper('Z') == 'Z');
|
||||
}
|
||||
|
||||
static void test_stdlib_lib(void) {
|
||||
char *end = (char *)0;
|
||||
static const char no_digits[] = "xyz";
|
||||
int r1;
|
||||
int r2;
|
||||
|
||||
TEST_ASSERT("stdlib", abs(-7) == 7 && abs(5) == 5);
|
||||
TEST_ASSERT("stdlib", labs(-9L) == 9L && labs(6L) == 6L);
|
||||
TEST_ASSERT("stdlib", llabs(-11LL) == 11LL && llabs(4LL) == 4LL);
|
||||
TEST_ASSERT("stdlib", atoi("123") == 123);
|
||||
TEST_ASSERT("stdlib", atol("-456") == -456L);
|
||||
TEST_ASSERT("stdlib", atoll("789") == 789LL);
|
||||
|
||||
TEST_ASSERT("stdlib", strtol(" -42", &end, 10) == -42L && *end == '\0');
|
||||
TEST_ASSERT("stdlib", strtol("0x10", &end, 0) == 16L && *end == '\0');
|
||||
TEST_ASSERT("stdlib", strtol("077", &end, 0) == 63L && *end == '\0');
|
||||
TEST_ASSERT("stdlib", strtol(no_digits, &end, 10) == 0L && end == no_digits);
|
||||
TEST_ASSERT("stdlib", strtol("9999999999999999999999999", &end, 10) == LONG_MAX);
|
||||
TEST_ASSERT("stdlib", strtol("-9999999999999999999999999", &end, 10) == LONG_MIN);
|
||||
|
||||
TEST_ASSERT("stdlib", strtoul("42", &end, 10) == 42UL && *end == '\0');
|
||||
TEST_ASSERT("stdlib", strtoul("0x20", &end, 0) == 32UL && *end == '\0');
|
||||
TEST_ASSERT("stdlib", strtoul("-1", &end, 10) == ULONG_MAX);
|
||||
TEST_ASSERT("stdlib", strtoull("1234", &end, 10) == 1234ULL && *end == '\0');
|
||||
TEST_ASSERT("stdlib", strtoll("-1234", &end, 10) == -1234LL && *end == '\0');
|
||||
|
||||
srand(12345U);
|
||||
r1 = rand();
|
||||
r2 = rand();
|
||||
TEST_ASSERT("stdlib", r1 >= 0 && r1 <= RAND_MAX);
|
||||
TEST_ASSERT("stdlib", r2 >= 0 && r2 <= RAND_MAX);
|
||||
srand(12345U);
|
||||
TEST_ASSERT("stdlib", rand() == r1);
|
||||
TEST_ASSERT("stdlib", rand() == r2);
|
||||
}
|
||||
|
||||
static void test_stdio_lib(void) {
|
||||
char buf[64];
|
||||
int rc;
|
||||
int c;
|
||||
|
||||
rc = snprintf(buf, sizeof(buf), "A:%d B:%u C:%X %s", -7, 9U, 0x2AU, "ok");
|
||||
TEST_ASSERT("stdio", rc > 0);
|
||||
TEST_ASSERT("stdio", strcmp(buf, "A:-7 B:9 C:2A ok") == 0);
|
||||
|
||||
rc = snprintf(buf, 5UL, "abcdef");
|
||||
TEST_ASSERT("stdio", rc == 6);
|
||||
TEST_ASSERT("stdio", strcmp(buf, "abcd") == 0);
|
||||
|
||||
rc = snprintf(buf, sizeof(buf), "ptr=%p", (void *)buf);
|
||||
TEST_ASSERT("stdio", rc > 4);
|
||||
TEST_ASSERT("stdio", strstr(buf, "ptr=0x") == buf);
|
||||
|
||||
rc = snprintf(buf, sizeof(buf), "%s", (const char *)0);
|
||||
TEST_ASSERT("stdio", rc == 6);
|
||||
TEST_ASSERT("stdio", strcmp(buf, "(null)") == 0);
|
||||
|
||||
rc = test_vsnprintf(buf, sizeof(buf), "%lld/%llu", -12LL, 34ULL);
|
||||
TEST_ASSERT("stdio", rc == 6);
|
||||
TEST_ASSERT("stdio", strcmp(buf, "-12/34") == 0);
|
||||
|
||||
rc = snprintf((char *)0, 0UL, "abc");
|
||||
TEST_ASSERT("stdio", rc == 3);
|
||||
|
||||
rc = fputs("", 1);
|
||||
TEST_ASSERT("stdio", rc == 0);
|
||||
c = fputc('Z', 1);
|
||||
TEST_ASSERT("stdio", c == 'Z');
|
||||
rc = fprintf(1, "");
|
||||
TEST_ASSERT("stdio", rc == 0);
|
||||
rc = dprintf(-1, "x");
|
||||
TEST_ASSERT("stdio", rc == EOF);
|
||||
}
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
(void)puts("[libctest] start");
|
||||
|
||||
test_string_lib();
|
||||
test_ctype_lib();
|
||||
test_stdlib_lib();
|
||||
test_stdio_lib();
|
||||
|
||||
(void)printf("[libctest] total=%d failed=%d\n", g_total, g_failed);
|
||||
|
||||
if (g_failed == 0) {
|
||||
(void)puts("[libctest] PASS");
|
||||
return 0;
|
||||
}
|
||||
|
||||
(void)puts("[libctest] FAIL");
|
||||
return 1;
|
||||
}
|
||||
24
cleonos/c/apps/libdemo_main.c
Normal file
24
cleonos/c/apps/libdemo_main.c
Normal file
@@ -0,0 +1,24 @@
|
||||
#include <stdio.h>
|
||||
|
||||
typedef unsigned long long u64;
|
||||
|
||||
u64 cleonos_libdemo_add(u64 left, u64 right) {
|
||||
return left + right;
|
||||
}
|
||||
|
||||
u64 cleonos_libdemo_mul(u64 left, u64 right) {
|
||||
return left * right;
|
||||
}
|
||||
|
||||
u64 cleonos_libdemo_hello(void) {
|
||||
(void)puts("[libdemo] hello from libdemo.elf");
|
||||
return 0ULL;
|
||||
}
|
||||
|
||||
int cleonos_app_main(int argc, char **argv, char **envp) {
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
(void)envp;
|
||||
(void)puts("[libdemo] dynamic library image ready");
|
||||
return 0;
|
||||
}
|
||||
@@ -1,6 +1,356 @@
|
||||
#include "shell/shell_internal.h"
|
||||
#include "cmd_runtime.h"
|
||||
#include <stdio.h>
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
return ush_command_program_main("ls");
|
||||
static void clio_write(const char *text) {
|
||||
(void)fputs(text, 1);
|
||||
}
|
||||
|
||||
static void clio_writeln(const char *text) {
|
||||
(void)fputs(text, 1);
|
||||
(void)putchar('\n');
|
||||
}
|
||||
|
||||
static void clio_write_char(char ch) {
|
||||
(void)putchar((unsigned char)ch);
|
||||
}
|
||||
|
||||
static void clio_write_hex_u64(u64 value) {
|
||||
(void)printf("0X%llX", (unsigned long long)value);
|
||||
}
|
||||
|
||||
static int ush_ls_join_path(const char *dir_path, const char *name, char *out_path, u64 out_size) {
|
||||
u64 p = 0ULL;
|
||||
u64 i;
|
||||
|
||||
if (dir_path == (const char *)0 || name == (const char *)0 || out_path == (char *)0 || out_size == 0ULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (dir_path[0] == '/' && dir_path[1] == '\0') {
|
||||
if (out_size < 2ULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
out_path[p++] = '/';
|
||||
} else {
|
||||
for (i = 0ULL; dir_path[i] != '\0'; i++) {
|
||||
if (p + 1ULL >= out_size) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
out_path[p++] = dir_path[i];
|
||||
}
|
||||
|
||||
if (p == 0ULL || out_path[p - 1ULL] != '/') {
|
||||
if (p + 1ULL >= out_size) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
out_path[p++] = '/';
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0ULL; name[i] != '\0'; i++) {
|
||||
if (p + 1ULL >= out_size) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
out_path[p++] = name[i];
|
||||
}
|
||||
|
||||
out_path[p] = '\0';
|
||||
return 1;
|
||||
}
|
||||
|
||||
static const char *ush_ls_basename(const char *path) {
|
||||
const char *name = path;
|
||||
u64 i = 0ULL;
|
||||
|
||||
if (path == (const char *)0 || path[0] == '\0') {
|
||||
return "";
|
||||
}
|
||||
|
||||
while (path[i] != '\0') {
|
||||
if (path[i] == '/' && path[i + 1ULL] != '\0') {
|
||||
name = &path[i + 1ULL];
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
static int ush_ls_is_dot_entry(const char *name) {
|
||||
if (name == (const char *)0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (name[0] == '.' && name[1] == '\0') {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (name[0] == '.' && name[1] == '.' && name[2] == '\0') {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void ush_ls_print_one(const char *name, u64 type, u64 size, int long_mode) {
|
||||
if (long_mode == 0) {
|
||||
clio_writeln(name);
|
||||
return;
|
||||
}
|
||||
|
||||
if (type == 2ULL) {
|
||||
clio_write("d ");
|
||||
} else if (type == 1ULL) {
|
||||
clio_write("f ");
|
||||
} else {
|
||||
clio_write("? ");
|
||||
}
|
||||
|
||||
clio_write(name);
|
||||
|
||||
if (type == 1ULL) {
|
||||
clio_write(" size=");
|
||||
clio_write_hex_u64(size);
|
||||
} else if (type == 2ULL) {
|
||||
clio_write(" <DIR>");
|
||||
} else {
|
||||
clio_write(" <UNKNOWN>");
|
||||
}
|
||||
|
||||
clio_write_char('\n');
|
||||
}
|
||||
|
||||
static int ush_ls_parse_args(const char *arg,
|
||||
int *out_long_mode,
|
||||
int *out_recursive,
|
||||
char *out_target,
|
||||
u64 out_target_size) {
|
||||
char token[USH_PATH_MAX];
|
||||
u64 i = 0ULL;
|
||||
int path_set = 0;
|
||||
|
||||
if (out_long_mode == (int *)0 ||
|
||||
out_recursive == (int *)0 ||
|
||||
out_target == (char *)0 ||
|
||||
out_target_size == 0ULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
*out_long_mode = 0;
|
||||
*out_recursive = 0;
|
||||
ush_copy(out_target, out_target_size, ".");
|
||||
|
||||
if (arg == (const char *)0 || arg[0] == '\0') {
|
||||
return 1;
|
||||
}
|
||||
|
||||
while (arg[i] != '\0') {
|
||||
u64 p = 0ULL;
|
||||
u64 j;
|
||||
|
||||
while (arg[i] != '\0' && ush_is_space(arg[i]) != 0) {
|
||||
i++;
|
||||
}
|
||||
|
||||
if (arg[i] == '\0') {
|
||||
break;
|
||||
}
|
||||
|
||||
while (arg[i] != '\0' && ush_is_space(arg[i]) == 0) {
|
||||
if (p + 1ULL < (u64)sizeof(token)) {
|
||||
token[p++] = arg[i];
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
token[p] = '\0';
|
||||
|
||||
if (token[0] == '-' && token[1] != '\0') {
|
||||
for (j = 1ULL; token[j] != '\0'; j++) {
|
||||
if (token[j] == 'l') {
|
||||
*out_long_mode = 1;
|
||||
} else if (token[j] == 'R') {
|
||||
*out_recursive = 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (path_set != 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
ush_copy(out_target, out_target_size, token);
|
||||
path_set = 1;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int ush_ls_dir(const char *path,
|
||||
int long_mode,
|
||||
int recursive,
|
||||
int print_header,
|
||||
u64 depth) {
|
||||
u64 count;
|
||||
u64 i;
|
||||
|
||||
if (depth > 16ULL) {
|
||||
clio_writeln("ls: recursion depth limit reached");
|
||||
return 0;
|
||||
}
|
||||
|
||||
count = cleonos_sys_fs_child_count(path);
|
||||
|
||||
if (print_header != 0) {
|
||||
clio_write(path);
|
||||
clio_writeln(":");
|
||||
}
|
||||
|
||||
if (count == 0ULL) {
|
||||
clio_writeln("(empty)");
|
||||
}
|
||||
|
||||
for (i = 0ULL; i < count; i++) {
|
||||
char name[CLEONOS_FS_NAME_MAX];
|
||||
char child_path[USH_PATH_MAX];
|
||||
u64 type;
|
||||
u64 size = 0ULL;
|
||||
|
||||
name[0] = '\0';
|
||||
|
||||
if (cleonos_sys_fs_get_child_name(path, i, name) == 0ULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ush_ls_join_path(path, name, child_path, (u64)sizeof(child_path)) == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
type = cleonos_sys_fs_stat_type(child_path);
|
||||
|
||||
if (type == 1ULL) {
|
||||
size = cleonos_sys_fs_stat_size(child_path);
|
||||
}
|
||||
|
||||
ush_ls_print_one(name, type, size, long_mode);
|
||||
}
|
||||
|
||||
if (recursive == 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
for (i = 0ULL; i < count; i++) {
|
||||
char name[CLEONOS_FS_NAME_MAX];
|
||||
char child_path[USH_PATH_MAX];
|
||||
|
||||
name[0] = '\0';
|
||||
|
||||
if (cleonos_sys_fs_get_child_name(path, i, name) == 0ULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ush_ls_is_dot_entry(name) != 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ush_ls_join_path(path, name, child_path, (u64)sizeof(child_path)) == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (cleonos_sys_fs_stat_type(child_path) == 2ULL) {
|
||||
clio_write_char('\n');
|
||||
(void)ush_ls_dir(child_path, long_mode, recursive, 1, depth + 1ULL);
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int ush_cmd_ls(const ush_state *sh, const char *arg) {
|
||||
char target[USH_PATH_MAX];
|
||||
char path[USH_PATH_MAX];
|
||||
u64 type;
|
||||
int long_mode;
|
||||
int recursive;
|
||||
|
||||
if (ush_ls_parse_args(arg, &long_mode, &recursive, target, (u64)sizeof(target)) == 0) {
|
||||
clio_writeln("ls: usage ls [-l] [-R] [path]");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_resolve_path(sh, target, path, (u64)sizeof(path)) == 0) {
|
||||
clio_writeln("ls: invalid path");
|
||||
return 0;
|
||||
}
|
||||
|
||||
type = cleonos_sys_fs_stat_type(path);
|
||||
|
||||
if (type == 1ULL) {
|
||||
u64 size = cleonos_sys_fs_stat_size(path);
|
||||
ush_ls_print_one(ush_ls_basename(path), type, size, long_mode);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (type != 2ULL) {
|
||||
clio_writeln("ls: path not found");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ush_ls_dir(path, long_mode, recursive, recursive, 0ULL);
|
||||
}
|
||||
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
ush_cmd_ctx ctx;
|
||||
ush_cmd_ret ret;
|
||||
ush_state sh;
|
||||
char initial_cwd[USH_PATH_MAX];
|
||||
int has_context = 0;
|
||||
int success = 0;
|
||||
const char *arg = "";
|
||||
|
||||
ush_zero(&ctx, (u64)sizeof(ctx));
|
||||
ush_zero(&ret, (u64)sizeof(ret));
|
||||
ush_init_state(&sh);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
|
||||
if (ush_command_ctx_read(&ctx) != 0) {
|
||||
if (ctx.cmd[0] != '\0' && ush_streq(ctx.cmd, "ls") != 0) {
|
||||
has_context = 1;
|
||||
arg = ctx.arg;
|
||||
if (ctx.cwd[0] == '/') {
|
||||
ush_copy(sh.cwd, (u64)sizeof(sh.cwd), ctx.cwd);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
success = ush_cmd_ls(&sh, arg);
|
||||
|
||||
if (has_context != 0) {
|
||||
if (ush_streq(sh.cwd, initial_cwd) == 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_CWD;
|
||||
ush_copy(ret.cwd, (u64)sizeof(ret.cwd), sh.cwd);
|
||||
}
|
||||
|
||||
if (sh.exit_requested != 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_EXIT;
|
||||
ret.exit_code = sh.exit_code;
|
||||
}
|
||||
|
||||
(void)ush_command_ret_write(&ret);
|
||||
}
|
||||
|
||||
return (success != 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,53 @@
|
||||
#include "shell/shell_internal.h"
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
return ush_command_program_main("memstat");
|
||||
#include "cmd_runtime.h"
|
||||
static int ush_cmd_memstat(void) {
|
||||
ush_writeln("memstat (user ABI limited):");
|
||||
ush_print_kv_hex(" SERVICE_COUNT", cleonos_sys_service_count());
|
||||
ush_print_kv_hex(" SERVICE_READY_COUNT", cleonos_sys_service_ready_count());
|
||||
ush_print_kv_hex(" KELF_COUNT", cleonos_sys_kelf_count());
|
||||
ush_print_kv_hex(" KELF_RUNS", cleonos_sys_kelf_runs());
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
ush_cmd_ctx ctx;
|
||||
ush_cmd_ret ret;
|
||||
ush_state sh;
|
||||
char initial_cwd[USH_PATH_MAX];
|
||||
int has_context = 0;
|
||||
int success = 0;
|
||||
|
||||
ush_zero(&ctx, (u64)sizeof(ctx));
|
||||
ush_zero(&ret, (u64)sizeof(ret));
|
||||
ush_init_state(&sh);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
|
||||
if (ush_command_ctx_read(&ctx) != 0) {
|
||||
if (ctx.cmd[0] != '\0' && ush_streq(ctx.cmd, "memstat") != 0) {
|
||||
has_context = 1;
|
||||
if (ctx.cwd[0] == '/') {
|
||||
ush_copy(sh.cwd, (u64)sizeof(sh.cwd), ctx.cwd);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
success = ush_cmd_memstat();
|
||||
|
||||
if (has_context != 0) {
|
||||
if (ush_streq(sh.cwd, initial_cwd) == 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_CWD;
|
||||
ush_copy(ret.cwd, (u64)sizeof(ret.cwd), sh.cwd);
|
||||
}
|
||||
|
||||
if (sh.exit_requested != 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_EXIT;
|
||||
ret.exit_code = sh.exit_code;
|
||||
}
|
||||
|
||||
(void)ush_command_ret_write(&ret);
|
||||
}
|
||||
|
||||
return (success != 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,72 @@
|
||||
#include "shell/shell_internal.h"
|
||||
#include "cmd_runtime.h"
|
||||
static int ush_cmd_mkdir(const ush_state *sh, const char *arg) {
|
||||
char path[USH_PATH_MAX];
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
return ush_command_program_main("mkdir");
|
||||
if (arg == (const char *)0 || arg[0] == '\0') {
|
||||
ush_writeln("mkdir: directory path required");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_resolve_path(sh, arg, path, (u64)sizeof(path)) == 0) {
|
||||
ush_writeln("mkdir: invalid path");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_path_is_under_temp(path) == 0) {
|
||||
ush_writeln("mkdir: target must be under /temp");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (cleonos_sys_fs_mkdir(path) == 0ULL) {
|
||||
ush_writeln("mkdir: failed");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
ush_cmd_ctx ctx;
|
||||
ush_cmd_ret ret;
|
||||
ush_state sh;
|
||||
char initial_cwd[USH_PATH_MAX];
|
||||
int has_context = 0;
|
||||
int success = 0;
|
||||
const char *arg = "";
|
||||
|
||||
ush_zero(&ctx, (u64)sizeof(ctx));
|
||||
ush_zero(&ret, (u64)sizeof(ret));
|
||||
ush_init_state(&sh);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
|
||||
if (ush_command_ctx_read(&ctx) != 0) {
|
||||
if (ctx.cmd[0] != '\0' && ush_streq(ctx.cmd, "mkdir") != 0) {
|
||||
has_context = 1;
|
||||
arg = ctx.arg;
|
||||
if (ctx.cwd[0] == '/') {
|
||||
ush_copy(sh.cwd, (u64)sizeof(sh.cwd), ctx.cwd);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
success = ush_cmd_mkdir(&sh, arg);
|
||||
|
||||
if (has_context != 0) {
|
||||
if (ush_streq(sh.cwd, initial_cwd) == 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_CWD;
|
||||
ush_copy(ret.cwd, (u64)sizeof(ret.cwd), sh.cwd);
|
||||
}
|
||||
|
||||
if (sh.exit_requested != 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_EXIT;
|
||||
ret.exit_code = sh.exit_code;
|
||||
}
|
||||
|
||||
(void)ush_command_ret_write(&ret);
|
||||
}
|
||||
|
||||
return (success != 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,129 @@
|
||||
#include "shell/shell_internal.h"
|
||||
#include "cmd_runtime.h"
|
||||
static int ush_copy_file(const char *src_path, const char *dst_path) {
|
||||
static char copy_buf[USH_COPY_MAX];
|
||||
u64 src_type;
|
||||
u64 src_size;
|
||||
u64 got;
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
return ush_command_program_main("mv");
|
||||
src_type = cleonos_sys_fs_stat_type(src_path);
|
||||
|
||||
if (src_type != 1ULL) {
|
||||
ush_writeln("cp: source file not found");
|
||||
return 0;
|
||||
}
|
||||
|
||||
src_size = cleonos_sys_fs_stat_size(src_path);
|
||||
|
||||
if (src_size == (u64)-1) {
|
||||
ush_writeln("cp: failed to stat source");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (src_size > (u64)USH_COPY_MAX) {
|
||||
ush_writeln("cp: source too large for user shell buffer");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (src_size == 0ULL) {
|
||||
got = 0ULL;
|
||||
} else {
|
||||
got = cleonos_sys_fs_read(src_path, copy_buf, src_size);
|
||||
|
||||
if (got == 0ULL || got != src_size) {
|
||||
ush_writeln("cp: failed to read source");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (cleonos_sys_fs_write(dst_path, copy_buf, got) == 0ULL) {
|
||||
ush_writeln("cp: failed to write destination");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int ush_cmd_mv(const ush_state *sh, const char *arg) {
|
||||
char src_arg[USH_PATH_MAX];
|
||||
char dst_arg[USH_PATH_MAX];
|
||||
char src_path[USH_PATH_MAX];
|
||||
char dst_path[USH_PATH_MAX];
|
||||
|
||||
if (arg == (const char *)0 || arg[0] == '\0') {
|
||||
ush_writeln("mv: usage mv <src> <dst>");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_split_two_args(arg, src_arg, (u64)sizeof(src_arg), dst_arg, (u64)sizeof(dst_arg)) == 0) {
|
||||
ush_writeln("mv: usage mv <src> <dst>");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_resolve_path(sh, src_arg, src_path, (u64)sizeof(src_path)) == 0 ||
|
||||
ush_resolve_path(sh, dst_arg, dst_path, (u64)sizeof(dst_path)) == 0) {
|
||||
ush_writeln("mv: invalid path");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_path_is_under_temp(src_path) == 0 || ush_path_is_under_temp(dst_path) == 0) {
|
||||
ush_writeln("mv: source and destination must be under /temp");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_copy_file(src_path, dst_path) == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (cleonos_sys_fs_remove(src_path) == 0ULL) {
|
||||
ush_writeln("mv: source remove failed");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
ush_cmd_ctx ctx;
|
||||
ush_cmd_ret ret;
|
||||
ush_state sh;
|
||||
char initial_cwd[USH_PATH_MAX];
|
||||
int has_context = 0;
|
||||
int success = 0;
|
||||
const char *arg = "";
|
||||
|
||||
ush_zero(&ctx, (u64)sizeof(ctx));
|
||||
ush_zero(&ret, (u64)sizeof(ret));
|
||||
ush_init_state(&sh);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
|
||||
if (ush_command_ctx_read(&ctx) != 0) {
|
||||
if (ctx.cmd[0] != '\0' && ush_streq(ctx.cmd, "mv") != 0) {
|
||||
has_context = 1;
|
||||
arg = ctx.arg;
|
||||
if (ctx.cwd[0] == '/') {
|
||||
ush_copy(sh.cwd, (u64)sizeof(sh.cwd), ctx.cwd);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
success = ush_cmd_mv(&sh, arg);
|
||||
|
||||
if (has_context != 0) {
|
||||
if (ush_streq(sh.cwd, initial_cwd) == 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_CWD;
|
||||
ush_copy(ret.cwd, (u64)sizeof(ret.cwd), sh.cwd);
|
||||
}
|
||||
|
||||
if (sh.exit_requested != 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_EXIT;
|
||||
ret.exit_code = sh.exit_code;
|
||||
}
|
||||
|
||||
(void)ush_command_ret_write(&ret);
|
||||
}
|
||||
|
||||
return (success != 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,49 @@
|
||||
#include "shell/shell_internal.h"
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
return ush_command_program_main("pid");
|
||||
#include "cmd_runtime.h"
|
||||
static int ush_cmd_pid(void) {
|
||||
ush_print_kv_hex("PID", cleonos_sys_getpid());
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
ush_cmd_ctx ctx;
|
||||
ush_cmd_ret ret;
|
||||
ush_state sh;
|
||||
char initial_cwd[USH_PATH_MAX];
|
||||
int has_context = 0;
|
||||
int success = 0;
|
||||
|
||||
ush_zero(&ctx, (u64)sizeof(ctx));
|
||||
ush_zero(&ret, (u64)sizeof(ret));
|
||||
ush_init_state(&sh);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
|
||||
if (ush_command_ctx_read(&ctx) != 0) {
|
||||
if (ctx.cmd[0] != '\0' && ush_streq(ctx.cmd, "pid") != 0) {
|
||||
has_context = 1;
|
||||
if (ctx.cwd[0] == '/') {
|
||||
ush_copy(sh.cwd, (u64)sizeof(sh.cwd), ctx.cwd);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
success = ush_cmd_pid();
|
||||
|
||||
if (has_context != 0) {
|
||||
if (ush_streq(sh.cwd, initial_cwd) == 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_CWD;
|
||||
ush_copy(ret.cwd, (u64)sizeof(ret.cwd), sh.cwd);
|
||||
}
|
||||
|
||||
if (sh.exit_requested != 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_EXIT;
|
||||
ret.exit_code = sh.exit_code;
|
||||
}
|
||||
|
||||
(void)ush_command_ret_write(&ret);
|
||||
}
|
||||
|
||||
return (success != 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
|
||||
244
cleonos/c/apps/procstat_main.c
Normal file
244
cleonos/c/apps/procstat_main.c
Normal file
@@ -0,0 +1,244 @@
|
||||
#include "cmd_runtime.h"
|
||||
|
||||
static const char *ush_procstat_state_name(u64 state) {
|
||||
if (state == CLEONOS_PROC_STATE_PENDING) {
|
||||
return "PEND";
|
||||
}
|
||||
if (state == CLEONOS_PROC_STATE_RUNNING) {
|
||||
return "RUN ";
|
||||
}
|
||||
if (state == CLEONOS_PROC_STATE_STOPPED) {
|
||||
return "STOP";
|
||||
}
|
||||
if (state == CLEONOS_PROC_STATE_EXITED) {
|
||||
return "EXIT";
|
||||
}
|
||||
return "UNKN";
|
||||
}
|
||||
|
||||
static int ush_procstat_next_token(const char **io_cursor, char *out, u64 out_size) {
|
||||
const char *p;
|
||||
u64 n = 0ULL;
|
||||
|
||||
if (io_cursor == (const char **)0 || out == (char *)0 || out_size == 0ULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
out[0] = '\0';
|
||||
p = *io_cursor;
|
||||
|
||||
if (p == (const char *)0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (*p != '\0' && ush_is_space(*p) != 0) {
|
||||
p++;
|
||||
}
|
||||
|
||||
if (*p == '\0') {
|
||||
*io_cursor = p;
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (*p != '\0' && ush_is_space(*p) == 0) {
|
||||
if (n + 1ULL < out_size) {
|
||||
out[n++] = *p;
|
||||
}
|
||||
p++;
|
||||
}
|
||||
|
||||
out[n] = '\0';
|
||||
*io_cursor = p;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void ush_procstat_print_line(const cleonos_proc_snapshot *snap) {
|
||||
if (snap == (const cleonos_proc_snapshot *)0) {
|
||||
return;
|
||||
}
|
||||
|
||||
ush_write("PID=");
|
||||
ush_write_hex_u64(snap->pid);
|
||||
ush_write(" ST=");
|
||||
ush_write(ush_procstat_state_name(snap->state));
|
||||
ush_write(" TTY=");
|
||||
ush_write_hex_u64(snap->tty_index);
|
||||
ush_write(" RT=");
|
||||
ush_write_hex_u64(snap->runtime_ticks);
|
||||
ush_write(" MEM=");
|
||||
ush_write_hex_u64(snap->mem_bytes);
|
||||
ush_write(" SIG=");
|
||||
ush_write_hex_u64(snap->last_signal);
|
||||
ush_write(" PATH=");
|
||||
ush_writeln(snap->path);
|
||||
}
|
||||
|
||||
static void ush_procstat_print_detail(const cleonos_proc_snapshot *snap) {
|
||||
if (snap == (const cleonos_proc_snapshot *)0) {
|
||||
return;
|
||||
}
|
||||
|
||||
ush_writeln("procstat:");
|
||||
ush_print_kv_hex(" PID", snap->pid);
|
||||
ush_print_kv_hex(" PPID", snap->ppid);
|
||||
ush_write(" STATE: ");
|
||||
ush_write(ush_procstat_state_name(snap->state));
|
||||
ush_write_char('\n');
|
||||
ush_print_kv_hex(" STATE_ID", snap->state);
|
||||
ush_print_kv_hex(" TTY", snap->tty_index);
|
||||
ush_print_kv_hex(" STARTED_TICK", snap->started_tick);
|
||||
ush_print_kv_hex(" EXITED_TICK", snap->exited_tick);
|
||||
ush_print_kv_hex(" RUNTIME_TICKS", snap->runtime_ticks);
|
||||
ush_print_kv_hex(" MEM_BYTES", snap->mem_bytes);
|
||||
ush_print_kv_hex(" EXIT_STATUS", snap->exit_status);
|
||||
ush_print_kv_hex(" LAST_SIGNAL", snap->last_signal);
|
||||
ush_print_kv_hex(" LAST_FAULT_VECTOR", snap->last_fault_vector);
|
||||
ush_print_kv_hex(" LAST_FAULT_ERROR", snap->last_fault_error);
|
||||
ush_print_kv_hex(" LAST_FAULT_RIP", snap->last_fault_rip);
|
||||
ush_write(" PATH: ");
|
||||
ush_writeln(snap->path);
|
||||
}
|
||||
|
||||
static int ush_procstat_parse_args(const char *arg, u64 *out_pid, int *out_has_pid, int *out_include_exited) {
|
||||
const char *cursor = arg;
|
||||
char token[USH_PATH_MAX];
|
||||
u64 parsed_pid = 0ULL;
|
||||
int has_pid = 0;
|
||||
int include_exited = 0;
|
||||
|
||||
if (out_pid == (u64 *)0 || out_has_pid == (int *)0 || out_include_exited == (int *)0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (ush_procstat_next_token(&cursor, token, (u64)sizeof(token)) != 0) {
|
||||
if (ush_streq(token, "-a") != 0 || ush_streq(token, "--all") != 0) {
|
||||
include_exited = 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ush_streq(token, "self") != 0) {
|
||||
if (has_pid != 0) {
|
||||
return 0;
|
||||
}
|
||||
parsed_pid = cleonos_sys_getpid();
|
||||
has_pid = 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ush_parse_u64_dec(token, &parsed_pid) != 0 && parsed_pid != 0ULL) {
|
||||
if (has_pid != 0) {
|
||||
return 0;
|
||||
}
|
||||
has_pid = 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
*out_pid = parsed_pid;
|
||||
*out_has_pid = has_pid;
|
||||
*out_include_exited = include_exited;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int ush_cmd_procstat(const char *arg) {
|
||||
u64 target_pid = 0ULL;
|
||||
int has_pid = 0;
|
||||
int include_exited = 0;
|
||||
|
||||
if (ush_procstat_parse_args(arg, &target_pid, &has_pid, &include_exited) == 0) {
|
||||
ush_writeln("procstat: usage procstat [pid|self] [-a|--all]");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (has_pid != 0) {
|
||||
cleonos_proc_snapshot snap;
|
||||
|
||||
if (cleonos_sys_proc_snapshot(target_pid, &snap, (u64)sizeof(snap)) == 0ULL) {
|
||||
ush_writeln("procstat: pid not found");
|
||||
return 0;
|
||||
}
|
||||
|
||||
ush_procstat_print_detail(&snap);
|
||||
return 1;
|
||||
}
|
||||
|
||||
{
|
||||
u64 proc_count = cleonos_sys_proc_count();
|
||||
u64 i;
|
||||
u64 shown = 0ULL;
|
||||
|
||||
ush_writeln("procstat:");
|
||||
|
||||
for (i = 0ULL; i < proc_count; i++) {
|
||||
u64 pid = 0ULL;
|
||||
cleonos_proc_snapshot snap;
|
||||
|
||||
if (cleonos_sys_proc_pid_at(i, &pid) == 0ULL || pid == 0ULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (cleonos_sys_proc_snapshot(pid, &snap, (u64)sizeof(snap)) == 0ULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (include_exited == 0 && snap.state == CLEONOS_PROC_STATE_EXITED) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ush_procstat_print_line(&snap);
|
||||
shown++;
|
||||
}
|
||||
|
||||
if (shown == 0ULL) {
|
||||
ush_writeln("(no process)");
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
ush_cmd_ctx ctx;
|
||||
ush_cmd_ret ret;
|
||||
ush_state sh;
|
||||
char initial_cwd[USH_PATH_MAX];
|
||||
int has_context = 0;
|
||||
int success = 0;
|
||||
const char *arg = "";
|
||||
|
||||
ush_zero(&ctx, (u64)sizeof(ctx));
|
||||
ush_zero(&ret, (u64)sizeof(ret));
|
||||
ush_init_state(&sh);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
|
||||
if (ush_command_ctx_read(&ctx) != 0) {
|
||||
if (ctx.cmd[0] != '\0' && ush_streq(ctx.cmd, "procstat") != 0) {
|
||||
has_context = 1;
|
||||
arg = ctx.arg;
|
||||
if (ctx.cwd[0] == '/') {
|
||||
ush_copy(sh.cwd, (u64)sizeof(sh.cwd), ctx.cwd);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
success = ush_cmd_procstat(arg);
|
||||
|
||||
if (has_context != 0) {
|
||||
if (ush_streq(sh.cwd, initial_cwd) == 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_CWD;
|
||||
ush_copy(ret.cwd, (u64)sizeof(ret.cwd), sh.cwd);
|
||||
}
|
||||
|
||||
if (sh.exit_requested != 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_EXIT;
|
||||
ret.exit_code = sh.exit_code;
|
||||
}
|
||||
|
||||
(void)ush_command_ret_write(&ret);
|
||||
}
|
||||
|
||||
return (success != 0) ? 0 : 1;
|
||||
}
|
||||
194
cleonos/c/apps/ps_main.c
Normal file
194
cleonos/c/apps/ps_main.c
Normal file
@@ -0,0 +1,194 @@
|
||||
#include "cmd_runtime.h"
|
||||
|
||||
static int ush_ps_is_user_path(const char *path) {
|
||||
if (path == (const char *)0 || path[0] != '/') {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (path[1] == 's' && path[2] == 'y' && path[3] == 's' && path[4] == 't' && path[5] == 'e' && path[6] == 'm' &&
|
||||
(path[7] == '/' || path[7] == '\0')) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (path[1] == 'd' && path[2] == 'r' && path[3] == 'i' && path[4] == 'v' && path[5] == 'e' && path[6] == 'r' &&
|
||||
(path[7] == '/' || path[7] == '\0')) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static const char *ush_ps_state_name(u64 state) {
|
||||
if (state == CLEONOS_PROC_STATE_PENDING) {
|
||||
return "PEND";
|
||||
}
|
||||
if (state == CLEONOS_PROC_STATE_RUNNING) {
|
||||
return "RUN ";
|
||||
}
|
||||
if (state == CLEONOS_PROC_STATE_STOPPED) {
|
||||
return "STOP";
|
||||
}
|
||||
if (state == CLEONOS_PROC_STATE_EXITED) {
|
||||
return "EXIT";
|
||||
}
|
||||
return "UNKN";
|
||||
}
|
||||
|
||||
static int ush_ps_next_token(const char **io_cursor, char *out, u64 out_size) {
|
||||
const char *p;
|
||||
u64 n = 0ULL;
|
||||
|
||||
if (io_cursor == (const char **)0 || out == (char *)0 || out_size == 0ULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
out[0] = '\0';
|
||||
p = *io_cursor;
|
||||
|
||||
if (p == (const char *)0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (*p != '\0' && ush_is_space(*p) != 0) {
|
||||
p++;
|
||||
}
|
||||
|
||||
if (*p == '\0') {
|
||||
*io_cursor = p;
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (*p != '\0' && ush_is_space(*p) == 0) {
|
||||
if (n + 1ULL < out_size) {
|
||||
out[n++] = *p;
|
||||
}
|
||||
p++;
|
||||
}
|
||||
|
||||
out[n] = '\0';
|
||||
*io_cursor = p;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void ush_ps_print_one(const cleonos_proc_snapshot *snap) {
|
||||
if (snap == (const cleonos_proc_snapshot *)0) {
|
||||
return;
|
||||
}
|
||||
|
||||
ush_write("PID=");
|
||||
ush_write_hex_u64(snap->pid);
|
||||
ush_write(" PPID=");
|
||||
ush_write_hex_u64(snap->ppid);
|
||||
ush_write(" ST=");
|
||||
ush_write(ush_ps_state_name(snap->state));
|
||||
ush_write(" TTY=");
|
||||
ush_write_hex_u64(snap->tty_index);
|
||||
ush_write(" RT=");
|
||||
ush_write_hex_u64(snap->runtime_ticks);
|
||||
ush_write(" MEM=");
|
||||
ush_write_hex_u64(snap->mem_bytes);
|
||||
if (snap->state == CLEONOS_PROC_STATE_EXITED) {
|
||||
ush_write(" EXIT=");
|
||||
ush_write_hex_u64(snap->exit_status);
|
||||
}
|
||||
ush_write(" PATH=");
|
||||
ush_writeln(snap->path);
|
||||
}
|
||||
|
||||
static int ush_cmd_ps(const char *arg) {
|
||||
u64 proc_count;
|
||||
u64 i;
|
||||
u64 shown = 0ULL;
|
||||
int include_exited = 0;
|
||||
int only_user = 0;
|
||||
const char *cursor = arg;
|
||||
char token[USH_PATH_MAX];
|
||||
|
||||
while (ush_ps_next_token(&cursor, token, (u64)sizeof(token)) != 0) {
|
||||
if (ush_streq(token, "-a") != 0 || ush_streq(token, "--all") != 0) {
|
||||
include_exited = 1;
|
||||
} else if (ush_streq(token, "-u") != 0 || ush_streq(token, "--user") != 0) {
|
||||
only_user = 1;
|
||||
} else {
|
||||
ush_writeln("ps: usage ps [-a|--all] [-u|--user]");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
proc_count = cleonos_sys_proc_count();
|
||||
ush_writeln("ps:");
|
||||
|
||||
for (i = 0ULL; i < proc_count; i++) {
|
||||
u64 pid = 0ULL;
|
||||
cleonos_proc_snapshot snap;
|
||||
|
||||
if (cleonos_sys_proc_pid_at(i, &pid) == 0ULL || pid == 0ULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (cleonos_sys_proc_snapshot(pid, &snap, (u64)sizeof(snap)) == 0ULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (include_exited == 0 && snap.state == CLEONOS_PROC_STATE_EXITED) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (only_user != 0 && ush_ps_is_user_path(snap.path) == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ush_ps_print_one(&snap);
|
||||
shown++;
|
||||
}
|
||||
|
||||
if (shown == 0ULL) {
|
||||
ush_writeln("(no process)");
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
ush_cmd_ctx ctx;
|
||||
ush_cmd_ret ret;
|
||||
ush_state sh;
|
||||
char initial_cwd[USH_PATH_MAX];
|
||||
int has_context = 0;
|
||||
int success = 0;
|
||||
const char *arg = "";
|
||||
|
||||
ush_zero(&ctx, (u64)sizeof(ctx));
|
||||
ush_zero(&ret, (u64)sizeof(ret));
|
||||
ush_init_state(&sh);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
|
||||
if (ush_command_ctx_read(&ctx) != 0) {
|
||||
if (ctx.cmd[0] != '\0' && ush_streq(ctx.cmd, "ps") != 0) {
|
||||
has_context = 1;
|
||||
arg = ctx.arg;
|
||||
if (ctx.cwd[0] == '/') {
|
||||
ush_copy(sh.cwd, (u64)sizeof(sh.cwd), ctx.cwd);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
success = ush_cmd_ps(arg);
|
||||
|
||||
if (has_context != 0) {
|
||||
if (ush_streq(sh.cwd, initial_cwd) == 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_CWD;
|
||||
ush_copy(ret.cwd, (u64)sizeof(ret.cwd), sh.cwd);
|
||||
}
|
||||
|
||||
if (sh.exit_requested != 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_EXIT;
|
||||
ret.exit_code = sh.exit_code;
|
||||
}
|
||||
|
||||
(void)ush_command_ret_write(&ret);
|
||||
}
|
||||
|
||||
return (success != 0) ? 0 : 1;
|
||||
}
|
||||
@@ -1,6 +1,49 @@
|
||||
#include "shell/shell_internal.h"
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
return ush_command_program_main("pwd");
|
||||
#include "cmd_runtime.h"
|
||||
static int ush_cmd_pwd(const ush_state *sh) {
|
||||
ush_writeln(sh->cwd);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
ush_cmd_ctx ctx;
|
||||
ush_cmd_ret ret;
|
||||
ush_state sh;
|
||||
char initial_cwd[USH_PATH_MAX];
|
||||
int has_context = 0;
|
||||
int success = 0;
|
||||
|
||||
ush_zero(&ctx, (u64)sizeof(ctx));
|
||||
ush_zero(&ret, (u64)sizeof(ret));
|
||||
ush_init_state(&sh);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
|
||||
if (ush_command_ctx_read(&ctx) != 0) {
|
||||
if (ctx.cmd[0] != '\0' && ush_streq(ctx.cmd, "pwd") != 0) {
|
||||
has_context = 1;
|
||||
if (ctx.cwd[0] == '/') {
|
||||
ush_copy(sh.cwd, (u64)sizeof(sh.cwd), ctx.cwd);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
success = ush_cmd_pwd(&sh);
|
||||
|
||||
if (has_context != 0) {
|
||||
if (ush_streq(sh.cwd, initial_cwd) == 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_CWD;
|
||||
ush_copy(ret.cwd, (u64)sizeof(ret.cwd), sh.cwd);
|
||||
}
|
||||
|
||||
if (sh.exit_requested != 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_EXIT;
|
||||
ret.exit_code = sh.exit_code;
|
||||
}
|
||||
|
||||
(void)ush_command_ret_write(&ret);
|
||||
}
|
||||
|
||||
return (success != 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,50 @@
|
||||
#include "shell/shell_internal.h"
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
return ush_command_program_main("restart");
|
||||
#include "cmd_runtime.h"
|
||||
static int ush_cmd_restart(void) {
|
||||
ush_writeln("restart: rebooting...");
|
||||
(void)cleonos_sys_restart();
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
ush_cmd_ctx ctx;
|
||||
ush_cmd_ret ret;
|
||||
ush_state sh;
|
||||
char initial_cwd[USH_PATH_MAX];
|
||||
int has_context = 0;
|
||||
int success = 0;
|
||||
|
||||
ush_zero(&ctx, (u64)sizeof(ctx));
|
||||
ush_zero(&ret, (u64)sizeof(ret));
|
||||
ush_init_state(&sh);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
|
||||
if (ush_command_ctx_read(&ctx) != 0) {
|
||||
if (ctx.cmd[0] != '\0' && ush_streq(ctx.cmd, "restart") != 0) {
|
||||
has_context = 1;
|
||||
if (ctx.cwd[0] == '/') {
|
||||
ush_copy(sh.cwd, (u64)sizeof(sh.cwd), ctx.cwd);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
success = ush_cmd_restart();
|
||||
|
||||
if (has_context != 0) {
|
||||
if (ush_streq(sh.cwd, initial_cwd) == 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_CWD;
|
||||
ush_copy(ret.cwd, (u64)sizeof(ret.cwd), sh.cwd);
|
||||
}
|
||||
|
||||
if (sh.exit_requested != 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_EXIT;
|
||||
ret.exit_code = sh.exit_code;
|
||||
}
|
||||
|
||||
(void)ush_command_ret_write(&ret);
|
||||
}
|
||||
|
||||
return (success != 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,72 @@
|
||||
#include "shell/shell_internal.h"
|
||||
#include "cmd_runtime.h"
|
||||
static int ush_cmd_rm(const ush_state *sh, const char *arg) {
|
||||
char path[USH_PATH_MAX];
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
return ush_command_program_main("rm");
|
||||
if (arg == (const char *)0 || arg[0] == '\0') {
|
||||
ush_writeln("rm: path required");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_resolve_path(sh, arg, path, (u64)sizeof(path)) == 0) {
|
||||
ush_writeln("rm: invalid path");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_path_is_under_temp(path) == 0) {
|
||||
ush_writeln("rm: target must be under /temp");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (cleonos_sys_fs_remove(path) == 0ULL) {
|
||||
ush_writeln("rm: failed (directory must be empty)");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
ush_cmd_ctx ctx;
|
||||
ush_cmd_ret ret;
|
||||
ush_state sh;
|
||||
char initial_cwd[USH_PATH_MAX];
|
||||
int has_context = 0;
|
||||
int success = 0;
|
||||
const char *arg = "";
|
||||
|
||||
ush_zero(&ctx, (u64)sizeof(ctx));
|
||||
ush_zero(&ret, (u64)sizeof(ret));
|
||||
ush_init_state(&sh);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
|
||||
if (ush_command_ctx_read(&ctx) != 0) {
|
||||
if (ctx.cmd[0] != '\0' && ush_streq(ctx.cmd, "rm") != 0) {
|
||||
has_context = 1;
|
||||
arg = ctx.arg;
|
||||
if (ctx.cwd[0] == '/') {
|
||||
ush_copy(sh.cwd, (u64)sizeof(sh.cwd), ctx.cwd);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
success = ush_cmd_rm(&sh, arg);
|
||||
|
||||
if (has_context != 0) {
|
||||
if (ush_streq(sh.cwd, initial_cwd) == 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_CWD;
|
||||
ush_copy(ret.cwd, (u64)sizeof(ret.cwd), sh.cwd);
|
||||
}
|
||||
|
||||
if (sh.exit_requested != 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_EXIT;
|
||||
ret.exit_code = sh.exit_code;
|
||||
}
|
||||
|
||||
(void)ush_command_ret_write(&ret);
|
||||
}
|
||||
|
||||
return (success != 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,5 @@
|
||||
#include "shell_internal.h"
|
||||
|
||||
static int ush_dispatch_external_enabled = 1;
|
||||
|
||||
static void ush_zero(void *ptr, u64 size) {
|
||||
u64 i;
|
||||
char *bytes = (char *)ptr;
|
||||
@@ -15,6 +13,25 @@ static void ush_zero(void *ptr, u64 size) {
|
||||
}
|
||||
}
|
||||
|
||||
static void ush_append_text(char *dst, u64 dst_size, const char *text) {
|
||||
u64 p = 0ULL;
|
||||
u64 i = 0ULL;
|
||||
|
||||
if (dst == (char *)0 || dst_size == 0ULL || text == (const char *)0) {
|
||||
return;
|
||||
}
|
||||
|
||||
while (dst[p] != '\0' && p + 1ULL < dst_size) {
|
||||
p++;
|
||||
}
|
||||
|
||||
while (text[i] != '\0' && p + 1ULL < dst_size) {
|
||||
dst[p++] = text[i++];
|
||||
}
|
||||
|
||||
dst[p] = '\0';
|
||||
}
|
||||
|
||||
static const char *ush_alias_command(const char *cmd) {
|
||||
if (cmd == (const char *)0) {
|
||||
return (const char *)0;
|
||||
@@ -47,44 +64,6 @@ static const char *ush_alias_command(const char *cmd) {
|
||||
return cmd;
|
||||
}
|
||||
|
||||
static int ush_build_command_line(const char *cmd, const char *arg, char *out_line, u64 out_size) {
|
||||
u64 p = 0ULL;
|
||||
u64 i;
|
||||
|
||||
if (cmd == (const char *)0 || out_line == (char *)0 || out_size == 0ULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
out_line[0] = '\0';
|
||||
|
||||
for (i = 0ULL; cmd[i] != '\0'; i++) {
|
||||
if (p + 1ULL >= out_size) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
out_line[p++] = cmd[i];
|
||||
}
|
||||
|
||||
if (arg != (const char *)0 && arg[0] != '\0') {
|
||||
if (p + 1ULL >= out_size) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
out_line[p++] = ' ';
|
||||
|
||||
for (i = 0ULL; arg[i] != '\0'; i++) {
|
||||
if (p + 1ULL >= out_size) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
out_line[p++] = arg[i];
|
||||
}
|
||||
}
|
||||
|
||||
out_line[p] = '\0';
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int ush_cmd_ret_apply(ush_state *sh, const ush_cmd_ret *ret) {
|
||||
if (sh == (ush_state *)0 || ret == (const ush_cmd_ret *)0) {
|
||||
return 0;
|
||||
@@ -102,10 +81,6 @@ static int ush_cmd_ret_apply(ush_state *sh, const ush_cmd_ret *ret) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
void ush_set_external_dispatch(int enabled) {
|
||||
ush_dispatch_external_enabled = (enabled != 0) ? 1 : 0;
|
||||
}
|
||||
|
||||
int ush_command_ctx_write(const char *cmd, const char *arg, const char *cwd) {
|
||||
ush_cmd_ctx ctx;
|
||||
|
||||
@@ -162,9 +137,16 @@ int ush_command_ret_read(ush_cmd_ret *out_ret) {
|
||||
return (got == (u64)sizeof(*out_ret)) ? 1 : 0;
|
||||
}
|
||||
|
||||
int ush_try_exec_external(ush_state *sh, const char *cmd, const char *arg, int *out_success) {
|
||||
int ush_try_exec_external_with_fds(ush_state *sh,
|
||||
const char *cmd,
|
||||
const char *arg,
|
||||
u64 stdin_fd,
|
||||
u64 stdout_fd,
|
||||
u64 stderr_fd,
|
||||
int *out_success) {
|
||||
const char *canonical;
|
||||
char path[USH_PATH_MAX];
|
||||
char env_line[USH_PATH_MAX + USH_CMD_MAX + 96ULL];
|
||||
u64 status;
|
||||
ush_cmd_ret ret;
|
||||
|
||||
@@ -176,10 +158,6 @@ int ush_try_exec_external(ush_state *sh, const char *cmd, const char *arg, int *
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_dispatch_external_enabled == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
canonical = ush_alias_command(cmd);
|
||||
|
||||
if (canonical == (const char *)0) {
|
||||
@@ -201,7 +179,17 @@ int ush_try_exec_external(ush_state *sh, const char *cmd, const char *arg, int *
|
||||
return 1;
|
||||
}
|
||||
|
||||
status = cleonos_sys_exec_path(path);
|
||||
env_line[0] = '\0';
|
||||
ush_append_text(env_line, (u64)sizeof(env_line), "PWD=");
|
||||
ush_append_text(env_line, (u64)sizeof(env_line), sh->cwd);
|
||||
ush_append_text(env_line, (u64)sizeof(env_line), ";CMD=");
|
||||
ush_append_text(env_line, (u64)sizeof(env_line), canonical);
|
||||
|
||||
if (stdin_fd != CLEONOS_FD_INHERIT) {
|
||||
ush_append_text(env_line, (u64)sizeof(env_line), ";USH_STDIN_MODE=PIPE");
|
||||
}
|
||||
|
||||
status = cleonos_sys_exec_pathv_io(path, arg, env_line, stdin_fd, stdout_fd, stderr_fd);
|
||||
|
||||
if (status == (u64)-1) {
|
||||
ush_writeln("exec: request failed");
|
||||
@@ -217,7 +205,15 @@ int ush_try_exec_external(ush_state *sh, const char *cmd, const char *arg, int *
|
||||
(void)cleonos_sys_fs_remove(USH_CMD_RET_PATH);
|
||||
|
||||
if (status != 0ULL) {
|
||||
ush_writeln("exec: returned non-zero status");
|
||||
if ((status & (1ULL << 63)) != 0ULL) {
|
||||
ush_writeln("exec: terminated by signal");
|
||||
ush_print_kv_hex(" SIGNAL", status & 0xFFULL);
|
||||
ush_print_kv_hex(" VECTOR", (status >> 8) & 0xFFULL);
|
||||
ush_print_kv_hex(" ERROR", (status >> 16) & 0xFFFFULL);
|
||||
} else {
|
||||
ush_writeln("exec: returned non-zero status");
|
||||
ush_print_kv_hex(" STATUS", status);
|
||||
}
|
||||
|
||||
if (out_success != (int *)0) {
|
||||
*out_success = 0;
|
||||
@@ -233,65 +229,12 @@ int ush_try_exec_external(ush_state *sh, const char *cmd, const char *arg, int *
|
||||
return 1;
|
||||
}
|
||||
|
||||
int ush_command_program_main(const char *command_name) {
|
||||
ush_cmd_ctx ctx;
|
||||
ush_state sh;
|
||||
ush_cmd_ret ret;
|
||||
char line[USH_LINE_MAX];
|
||||
u64 ok_before;
|
||||
int success;
|
||||
int has_context = 0;
|
||||
int use_ctx_cwd = 0;
|
||||
|
||||
if (command_name == (const char *)0 || command_name[0] == '\0') {
|
||||
return 1;
|
||||
}
|
||||
|
||||
ush_zero(&ctx, (u64)sizeof(ctx));
|
||||
|
||||
if (ush_command_ctx_read(&ctx) != 0) {
|
||||
if (ush_streq(ctx.cmd, command_name) != 0) {
|
||||
has_context = 1;
|
||||
use_ctx_cwd = 1;
|
||||
} else if (ctx.cwd[0] == '/') {
|
||||
use_ctx_cwd = 1;
|
||||
ctx.arg[0] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
ush_init_state(&sh);
|
||||
ush_set_external_dispatch(0);
|
||||
|
||||
if (use_ctx_cwd != 0 && ctx.cwd[0] == '/') {
|
||||
ush_copy(sh.cwd, (u64)sizeof(sh.cwd), ctx.cwd);
|
||||
}
|
||||
|
||||
if (ush_build_command_line(command_name, ctx.arg, line, (u64)sizeof(line)) == 0) {
|
||||
ush_set_external_dispatch(1);
|
||||
ush_writeln("command line too long");
|
||||
return 1;
|
||||
}
|
||||
|
||||
ok_before = sh.cmd_ok;
|
||||
ush_execute_line(&sh, line);
|
||||
success = (sh.cmd_ok > ok_before) ? 1 : 0;
|
||||
|
||||
if (has_context != 0) {
|
||||
ush_zero(&ret, (u64)sizeof(ret));
|
||||
|
||||
if (ush_streq(sh.cwd, ctx.cwd) == 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_CWD;
|
||||
ush_copy(ret.cwd, (u64)sizeof(ret.cwd), sh.cwd);
|
||||
}
|
||||
|
||||
if (sh.exit_requested != 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_EXIT;
|
||||
ret.exit_code = sh.exit_code;
|
||||
}
|
||||
|
||||
(void)ush_command_ret_write(&ret);
|
||||
}
|
||||
|
||||
ush_set_external_dispatch(1);
|
||||
return (success != 0) ? 0 : 1;
|
||||
int ush_try_exec_external(ush_state *sh, const char *cmd, const char *arg, int *out_success) {
|
||||
return ush_try_exec_external_with_fds(sh,
|
||||
cmd,
|
||||
arg,
|
||||
CLEONOS_FD_INHERIT,
|
||||
CLEONOS_FD_INHERIT,
|
||||
CLEONOS_FD_INHERIT,
|
||||
out_success);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,208 @@
|
||||
#include "shell_internal.h"
|
||||
|
||||
static char ush_input_clipboard[USH_LINE_MAX];
|
||||
static u64 ush_input_clipboard_len = 0ULL;
|
||||
static u64 ush_input_sel_start = 0ULL;
|
||||
static u64 ush_input_sel_end = 0ULL;
|
||||
static int ush_input_sel_active = 0;
|
||||
static u64 ush_input_sel_anchor = 0ULL;
|
||||
static int ush_input_sel_anchor_valid = 0;
|
||||
#define USH_RENDER_BUF_MAX 4096ULL
|
||||
#define USH_RENDER_EMIT_CHUNK 2000ULL
|
||||
|
||||
static void ush_input_selection_clear(void) {
|
||||
ush_input_sel_active = 0;
|
||||
ush_input_sel_start = 0ULL;
|
||||
ush_input_sel_end = 0ULL;
|
||||
ush_input_sel_anchor = 0ULL;
|
||||
ush_input_sel_anchor_valid = 0;
|
||||
}
|
||||
|
||||
static void ush_input_selection_select_all(const ush_state *sh) {
|
||||
if (sh == (const ush_state *)0 || sh->line_len == 0ULL) {
|
||||
ush_input_selection_clear();
|
||||
return;
|
||||
}
|
||||
|
||||
ush_input_sel_active = 1;
|
||||
ush_input_sel_start = 0ULL;
|
||||
ush_input_sel_end = sh->line_len;
|
||||
ush_input_sel_anchor = 0ULL;
|
||||
ush_input_sel_anchor_valid = 1;
|
||||
}
|
||||
|
||||
static void ush_input_selection_update_from_anchor(const ush_state *sh) {
|
||||
u64 anchor;
|
||||
|
||||
if (sh == (const ush_state *)0 || ush_input_sel_anchor_valid == 0) {
|
||||
ush_input_sel_active = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
anchor = ush_input_sel_anchor;
|
||||
if (anchor > sh->line_len) {
|
||||
anchor = sh->line_len;
|
||||
}
|
||||
|
||||
if (sh->cursor == anchor) {
|
||||
ush_input_sel_active = 0;
|
||||
ush_input_sel_start = anchor;
|
||||
ush_input_sel_end = anchor;
|
||||
return;
|
||||
}
|
||||
|
||||
ush_input_sel_active = 1;
|
||||
|
||||
if (sh->cursor < anchor) {
|
||||
ush_input_sel_start = sh->cursor;
|
||||
ush_input_sel_end = anchor;
|
||||
} else {
|
||||
ush_input_sel_start = anchor;
|
||||
ush_input_sel_end = sh->cursor;
|
||||
}
|
||||
}
|
||||
static int ush_input_selection_has_range(const ush_state *sh, u64 *out_start, u64 *out_end) {
|
||||
u64 start;
|
||||
u64 end;
|
||||
|
||||
if (sh == (const ush_state *)0 || ush_input_sel_active == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
start = ush_input_sel_start;
|
||||
end = ush_input_sel_end;
|
||||
|
||||
if (start > sh->line_len) {
|
||||
start = sh->line_len;
|
||||
}
|
||||
|
||||
if (end > sh->line_len) {
|
||||
end = sh->line_len;
|
||||
}
|
||||
|
||||
if (start > end) {
|
||||
u64 tmp = start;
|
||||
start = end;
|
||||
end = tmp;
|
||||
}
|
||||
|
||||
if (start == end) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (out_start != (u64 *)0) {
|
||||
*out_start = start;
|
||||
}
|
||||
|
||||
if (out_end != (u64 *)0) {
|
||||
*out_end = end;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void ush_input_delete_range(ush_state *sh, u64 start, u64 end) {
|
||||
u64 delta;
|
||||
u64 i;
|
||||
|
||||
if (sh == (ush_state *)0 || start >= end || start >= sh->line_len) {
|
||||
ush_input_selection_clear();
|
||||
return;
|
||||
}
|
||||
|
||||
if (end > sh->line_len) {
|
||||
end = sh->line_len;
|
||||
}
|
||||
|
||||
delta = end - start;
|
||||
|
||||
for (i = start; i + delta <= sh->line_len; i++) {
|
||||
sh->line[i] = sh->line[i + delta];
|
||||
}
|
||||
|
||||
sh->line_len -= delta;
|
||||
|
||||
if (sh->cursor > end) {
|
||||
sh->cursor -= delta;
|
||||
} else if (sh->cursor > start) {
|
||||
sh->cursor = start;
|
||||
}
|
||||
|
||||
if (sh->cursor > sh->line_len) {
|
||||
sh->cursor = sh->line_len;
|
||||
}
|
||||
|
||||
ush_input_selection_clear();
|
||||
}
|
||||
|
||||
static int ush_input_delete_selection(ush_state *sh) {
|
||||
u64 start;
|
||||
u64 end;
|
||||
|
||||
if (ush_input_selection_has_range(sh, &start, &end) == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
ush_input_delete_range(sh, start, end);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void ush_input_copy_selection(const ush_state *sh) {
|
||||
u64 start;
|
||||
u64 end;
|
||||
u64 len;
|
||||
u64 i;
|
||||
|
||||
if (ush_input_selection_has_range(sh, &start, &end) == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
len = end - start;
|
||||
if (len > USH_LINE_MAX - 1ULL) {
|
||||
len = USH_LINE_MAX - 1ULL;
|
||||
}
|
||||
|
||||
for (i = 0ULL; i < len; i++) {
|
||||
ush_input_clipboard[i] = sh->line[start + i];
|
||||
}
|
||||
|
||||
ush_input_clipboard[len] = '\0';
|
||||
ush_input_clipboard_len = len;
|
||||
}
|
||||
|
||||
static void ush_input_insert_text(ush_state *sh, const char *text, u64 text_len) {
|
||||
u64 available;
|
||||
u64 i;
|
||||
|
||||
if (sh == (ush_state *)0 || text == (const char *)0 || text_len == 0ULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (sh->cursor > sh->line_len) {
|
||||
sh->cursor = sh->line_len;
|
||||
}
|
||||
|
||||
available = (USH_LINE_MAX - 1ULL) - sh->line_len;
|
||||
if (text_len > available) {
|
||||
text_len = available;
|
||||
}
|
||||
|
||||
if (text_len == 0ULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = sh->line_len + 1ULL; i > sh->cursor; i--) {
|
||||
sh->line[i + text_len - 1ULL] = sh->line[i - 1ULL];
|
||||
}
|
||||
|
||||
for (i = 0ULL; i < text_len; i++) {
|
||||
sh->line[sh->cursor + i] = text[i];
|
||||
}
|
||||
|
||||
sh->line_len += text_len;
|
||||
sh->cursor += text_len;
|
||||
}
|
||||
|
||||
static void ush_history_cancel_nav(ush_state *sh) {
|
||||
if (sh == (ush_state *)0) {
|
||||
return;
|
||||
@@ -20,6 +223,7 @@ static void ush_reset_line(ush_state *sh) {
|
||||
sh->cursor = 0ULL;
|
||||
sh->rendered_len = 0ULL;
|
||||
sh->line[0] = '\0';
|
||||
ush_input_selection_clear();
|
||||
}
|
||||
|
||||
static void ush_load_line(ush_state *sh, const char *line) {
|
||||
@@ -35,32 +239,131 @@ static void ush_load_line(ush_state *sh, const char *line) {
|
||||
ush_copy(sh->line, (u64)sizeof(sh->line), line);
|
||||
sh->line_len = ush_strlen(sh->line);
|
||||
sh->cursor = sh->line_len;
|
||||
ush_input_selection_clear();
|
||||
}
|
||||
|
||||
static void ush_render_buf_append_char(char *out, u64 out_size, u64 *io_len, char ch) {
|
||||
if (out == (char *)0 || io_len == (u64 *)0 || out_size == 0ULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (*io_len + 1ULL >= out_size) {
|
||||
return;
|
||||
}
|
||||
|
||||
out[*io_len] = ch;
|
||||
*io_len += 1ULL;
|
||||
}
|
||||
|
||||
static void ush_render_buf_append_text(char *out, u64 out_size, u64 *io_len, const char *text) {
|
||||
u64 i = 0ULL;
|
||||
|
||||
if (text == (const char *)0) {
|
||||
return;
|
||||
}
|
||||
|
||||
while (text[i] != '\0') {
|
||||
ush_render_buf_append_char(out, out_size, io_len, text[i]);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
static void ush_render_buf_append_prompt(const ush_state *sh, char *out, u64 out_size, u64 *io_len) {
|
||||
ush_render_buf_append_text(out, out_size, io_len, "\x1B[96mcleonos\x1B[0m(\x1B[92muser\x1B[0m");
|
||||
|
||||
if (sh == (const ush_state *)0) {
|
||||
ush_render_buf_append_text(out, out_size, io_len, ")> ");
|
||||
return;
|
||||
}
|
||||
|
||||
ush_render_buf_append_text(out, out_size, io_len, ":\x1B[93m");
|
||||
ush_render_buf_append_text(out, out_size, io_len, sh->cwd);
|
||||
ush_render_buf_append_text(out, out_size, io_len, "\x1B[0m)> ");
|
||||
}
|
||||
|
||||
static void ush_render_buf_append_line_segment(const ush_state *sh, u64 limit, char *out, u64 out_size, u64 *io_len) {
|
||||
u64 i;
|
||||
u64 sel_start = 0ULL;
|
||||
u64 sel_end = 0ULL;
|
||||
int has_sel;
|
||||
int inverse_on = 0;
|
||||
|
||||
if (sh == (const ush_state *)0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (limit > sh->line_len) {
|
||||
limit = sh->line_len;
|
||||
}
|
||||
|
||||
has_sel = ush_input_selection_has_range(sh, &sel_start, &sel_end);
|
||||
|
||||
for (i = 0ULL; i < limit; i++) {
|
||||
if (has_sel != 0 && inverse_on == 0 && i == sel_start) {
|
||||
ush_render_buf_append_text(out, out_size, io_len, "\x1B[7m");
|
||||
inverse_on = 1;
|
||||
}
|
||||
|
||||
if (has_sel != 0 && inverse_on != 0 && i == sel_end) {
|
||||
ush_render_buf_append_text(out, out_size, io_len, "\x1B[27m");
|
||||
inverse_on = 0;
|
||||
}
|
||||
|
||||
ush_render_buf_append_char(out, out_size, io_len, sh->line[i]);
|
||||
}
|
||||
|
||||
if (inverse_on != 0) {
|
||||
ush_render_buf_append_text(out, out_size, io_len, "\x1B[27m");
|
||||
}
|
||||
}
|
||||
|
||||
static void ush_render_emit(const char *buffer, u64 length) {
|
||||
u64 offset = 0ULL;
|
||||
|
||||
if (buffer == (const char *)0 || length == 0ULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
while (offset < length) {
|
||||
u64 chunk = length - offset;
|
||||
u64 written;
|
||||
|
||||
if (chunk > USH_RENDER_EMIT_CHUNK) {
|
||||
chunk = USH_RENDER_EMIT_CHUNK;
|
||||
}
|
||||
|
||||
written = cleonos_sys_fd_write(1ULL, buffer + offset, chunk);
|
||||
|
||||
if (written == 0ULL || written == (u64)-1) {
|
||||
break;
|
||||
}
|
||||
|
||||
offset += written;
|
||||
}
|
||||
}
|
||||
|
||||
static void ush_render_line(ush_state *sh) {
|
||||
char render[USH_RENDER_BUF_MAX];
|
||||
u64 out_len = 0ULL;
|
||||
u64 i;
|
||||
|
||||
if (sh == (ush_state *)0) {
|
||||
return;
|
||||
}
|
||||
|
||||
ush_write_char('\r');
|
||||
ush_prompt(sh);
|
||||
|
||||
for (i = 0ULL; i < sh->line_len; i++) {
|
||||
ush_write_char(sh->line[i]);
|
||||
}
|
||||
ush_render_buf_append_char(render, (u64)sizeof(render), &out_len, '\r');
|
||||
ush_render_buf_append_prompt(sh, render, (u64)sizeof(render), &out_len);
|
||||
ush_render_buf_append_line_segment(sh, sh->line_len, render, (u64)sizeof(render), &out_len);
|
||||
|
||||
for (i = sh->line_len; i < sh->rendered_len; i++) {
|
||||
ush_write_char(' ');
|
||||
ush_render_buf_append_char(render, (u64)sizeof(render), &out_len, ' ');
|
||||
}
|
||||
|
||||
ush_write_char('\r');
|
||||
ush_prompt(sh);
|
||||
ush_render_buf_append_char(render, (u64)sizeof(render), &out_len, '\r');
|
||||
ush_render_buf_append_prompt(sh, render, (u64)sizeof(render), &out_len);
|
||||
ush_render_buf_append_line_segment(sh, sh->cursor, render, (u64)sizeof(render), &out_len);
|
||||
|
||||
for (i = 0ULL; i < sh->cursor; i++) {
|
||||
ush_write_char(sh->line[i]);
|
||||
}
|
||||
ush_render_emit(render, out_len);
|
||||
|
||||
sh->rendered_len = sh->line_len;
|
||||
}
|
||||
@@ -131,6 +434,7 @@ static void ush_history_apply_current(ush_state *sh) {
|
||||
if (sh->cursor > sh->line_len) {
|
||||
sh->cursor = sh->line_len;
|
||||
}
|
||||
ush_input_selection_clear();
|
||||
}
|
||||
|
||||
ush_render_line(sh);
|
||||
@@ -168,11 +472,11 @@ static void ush_history_down(ush_state *sh) {
|
||||
}
|
||||
|
||||
static char ush_read_char_blocking(void) {
|
||||
for (;;) {
|
||||
u64 ch = cleonos_sys_kbd_get_char();
|
||||
char ch = '\0';
|
||||
|
||||
if (ch != (u64)-1) {
|
||||
return (char)(ch & 0xFFULL);
|
||||
for (;;) {
|
||||
if (cleonos_sys_fd_read(0ULL, &ch, 1ULL) == 1ULL) {
|
||||
return ch;
|
||||
}
|
||||
|
||||
__asm__ volatile("pause");
|
||||
@@ -207,17 +511,95 @@ void ush_read_line(ush_state *sh, char *out_line, u64 out_size) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ch == USH_KEY_SELECT_ALL) {
|
||||
ush_input_selection_select_all(sh);
|
||||
sh->cursor = sh->line_len;
|
||||
ush_render_line(sh);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ch == USH_KEY_COPY) {
|
||||
ush_input_copy_selection(sh);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ch == USH_KEY_PASTE) {
|
||||
if (ush_input_clipboard_len > 0ULL) {
|
||||
ush_history_cancel_nav(sh);
|
||||
(void)ush_input_delete_selection(sh);
|
||||
ush_input_insert_text(sh, ush_input_clipboard, ush_input_clipboard_len);
|
||||
ush_render_line(sh);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ch == USH_KEY_SHIFT_LEFT) {
|
||||
if (ush_input_sel_anchor_valid == 0) {
|
||||
ush_input_sel_anchor = sh->cursor;
|
||||
ush_input_sel_anchor_valid = 1;
|
||||
}
|
||||
|
||||
if (sh->cursor > 0ULL) {
|
||||
sh->cursor--;
|
||||
}
|
||||
|
||||
ush_input_selection_update_from_anchor(sh);
|
||||
ush_render_line(sh);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ch == USH_KEY_SHIFT_RIGHT) {
|
||||
if (ush_input_sel_anchor_valid == 0) {
|
||||
ush_input_sel_anchor = sh->cursor;
|
||||
ush_input_sel_anchor_valid = 1;
|
||||
}
|
||||
|
||||
if (sh->cursor < sh->line_len) {
|
||||
sh->cursor++;
|
||||
}
|
||||
|
||||
ush_input_selection_update_from_anchor(sh);
|
||||
ush_render_line(sh);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ch == USH_KEY_SHIFT_HOME) {
|
||||
if (ush_input_sel_anchor_valid == 0) {
|
||||
ush_input_sel_anchor = sh->cursor;
|
||||
ush_input_sel_anchor_valid = 1;
|
||||
}
|
||||
|
||||
sh->cursor = 0ULL;
|
||||
ush_input_selection_update_from_anchor(sh);
|
||||
ush_render_line(sh);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ch == USH_KEY_SHIFT_END) {
|
||||
if (ush_input_sel_anchor_valid == 0) {
|
||||
ush_input_sel_anchor = sh->cursor;
|
||||
ush_input_sel_anchor_valid = 1;
|
||||
}
|
||||
|
||||
sh->cursor = sh->line_len;
|
||||
ush_input_selection_update_from_anchor(sh);
|
||||
ush_render_line(sh);
|
||||
continue;
|
||||
}
|
||||
if (ch == USH_KEY_UP) {
|
||||
ush_input_selection_clear();
|
||||
ush_history_up(sh);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ch == USH_KEY_DOWN) {
|
||||
ush_input_selection_clear();
|
||||
ush_history_down(sh);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ch == USH_KEY_LEFT) {
|
||||
ush_input_selection_clear();
|
||||
if (sh->cursor > 0ULL) {
|
||||
sh->cursor--;
|
||||
ush_render_line(sh);
|
||||
@@ -226,6 +608,7 @@ void ush_read_line(ush_state *sh, char *out_line, u64 out_size) {
|
||||
}
|
||||
|
||||
if (ch == USH_KEY_RIGHT) {
|
||||
ush_input_selection_clear();
|
||||
if (sh->cursor < sh->line_len) {
|
||||
sh->cursor++;
|
||||
ush_render_line(sh);
|
||||
@@ -234,6 +617,7 @@ void ush_read_line(ush_state *sh, char *out_line, u64 out_size) {
|
||||
}
|
||||
|
||||
if (ch == USH_KEY_HOME) {
|
||||
ush_input_selection_clear();
|
||||
if (sh->cursor != 0ULL) {
|
||||
sh->cursor = 0ULL;
|
||||
ush_render_line(sh);
|
||||
@@ -242,6 +626,7 @@ void ush_read_line(ush_state *sh, char *out_line, u64 out_size) {
|
||||
}
|
||||
|
||||
if (ch == USH_KEY_END) {
|
||||
ush_input_selection_clear();
|
||||
if (sh->cursor != sh->line_len) {
|
||||
sh->cursor = sh->line_len;
|
||||
ush_render_line(sh);
|
||||
@@ -250,10 +635,17 @@ void ush_read_line(ush_state *sh, char *out_line, u64 out_size) {
|
||||
}
|
||||
|
||||
if (ch == '\b' || ch == 127) {
|
||||
if (ush_input_delete_selection(sh) != 0) {
|
||||
ush_history_cancel_nav(sh);
|
||||
ush_render_line(sh);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (sh->cursor > 0ULL && sh->line_len > 0ULL) {
|
||||
u64 i;
|
||||
|
||||
ush_history_cancel_nav(sh);
|
||||
ush_input_selection_clear();
|
||||
|
||||
for (i = sh->cursor - 1ULL; i < sh->line_len; i++) {
|
||||
sh->line[i] = sh->line[i + 1ULL];
|
||||
@@ -267,10 +659,17 @@ void ush_read_line(ush_state *sh, char *out_line, u64 out_size) {
|
||||
}
|
||||
|
||||
if (ch == USH_KEY_DELETE) {
|
||||
if (ush_input_delete_selection(sh) != 0) {
|
||||
ush_history_cancel_nav(sh);
|
||||
ush_render_line(sh);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (sh->cursor < sh->line_len) {
|
||||
u64 i;
|
||||
|
||||
ush_history_cancel_nav(sh);
|
||||
ush_input_selection_clear();
|
||||
|
||||
for (i = sh->cursor; i < sh->line_len; i++) {
|
||||
sh->line[i] = sh->line[i + 1ULL];
|
||||
@@ -290,33 +689,27 @@ void ush_read_line(ush_state *sh, char *out_line, u64 out_size) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (sh->line_len + 1ULL >= USH_LINE_MAX) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ush_history_cancel_nav(sh);
|
||||
|
||||
if (sh->cursor == sh->line_len) {
|
||||
sh->line[sh->line_len++] = ch;
|
||||
sh->line[sh->line_len] = '\0';
|
||||
sh->cursor = sh->line_len;
|
||||
ush_write_char(ch);
|
||||
sh->rendered_len = sh->line_len;
|
||||
continue;
|
||||
}
|
||||
|
||||
{
|
||||
u64 i;
|
||||
int replaced_selection = ush_input_delete_selection(sh);
|
||||
|
||||
for (i = sh->line_len; i > sh->cursor; i--) {
|
||||
sh->line[i] = sh->line[i - 1ULL];
|
||||
if (sh->line_len + 1ULL >= USH_LINE_MAX) {
|
||||
continue;
|
||||
}
|
||||
|
||||
sh->line[sh->cursor] = ch;
|
||||
sh->line_len++;
|
||||
sh->cursor++;
|
||||
sh->line[sh->line_len] = '\0';
|
||||
if (replaced_selection == 0 && sh->cursor == sh->line_len) {
|
||||
sh->line[sh->line_len++] = ch;
|
||||
sh->line[sh->line_len] = '\0';
|
||||
sh->cursor = sh->line_len;
|
||||
ush_write_char(ch);
|
||||
sh->rendered_len = sh->line_len;
|
||||
continue;
|
||||
}
|
||||
|
||||
ush_input_insert_text(sh, &ch, 1ULL);
|
||||
ush_render_line(sh);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
#define CLEONOS_USER_SHELL_INTERNAL_H
|
||||
|
||||
#include <cleonos_syscall.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
typedef long long i64;
|
||||
|
||||
@@ -21,6 +25,13 @@ typedef long long i64;
|
||||
#define USH_KEY_HOME ((char)0x05)
|
||||
#define USH_KEY_END ((char)0x06)
|
||||
#define USH_KEY_DELETE ((char)0x07)
|
||||
#define USH_KEY_SELECT_ALL ((char)0x10)
|
||||
#define USH_KEY_COPY ((char)0x11)
|
||||
#define USH_KEY_PASTE ((char)0x12)
|
||||
#define USH_KEY_SHIFT_LEFT ((char)0x13)
|
||||
#define USH_KEY_SHIFT_RIGHT ((char)0x14)
|
||||
#define USH_KEY_SHIFT_HOME ((char)0x15)
|
||||
#define USH_KEY_SHIFT_END ((char)0x16)
|
||||
|
||||
#define USH_CMD_CTX_PATH "/temp/.ush_cmd_ctx.bin"
|
||||
#define USH_CMD_RET_PATH "/temp/.ush_cmd_ret.bin"
|
||||
@@ -78,6 +89,11 @@ void ush_parse_line(const char *line, char *out_cmd, u64 cmd_size, char *out_arg
|
||||
void ush_write(const char *text);
|
||||
void ush_write_char(char ch);
|
||||
void ush_writeln(const char *text);
|
||||
void ush_output_capture_begin(char *buffer, u64 buffer_size, int mirror_to_tty);
|
||||
u64 ush_output_capture_end(void);
|
||||
int ush_output_capture_truncated(void);
|
||||
void ush_output_fd_begin(u64 fd, int mirror_to_tty);
|
||||
void ush_output_fd_end(void);
|
||||
void ush_prompt(const ush_state *sh);
|
||||
void ush_write_hex_u64(u64 value);
|
||||
void ush_print_kv_hex(const char *label, u64 value);
|
||||
@@ -89,14 +105,20 @@ int ush_path_is_under_system(const char *path);
|
||||
void ush_read_line(ush_state *sh, char *out_line, u64 out_size);
|
||||
int ush_run_script_file(ush_state *sh, const char *path);
|
||||
void ush_execute_line(ush_state *sh, const char *line);
|
||||
void ush_set_external_dispatch(int enabled);
|
||||
|
||||
int ush_command_ctx_write(const char *cmd, const char *arg, const char *cwd);
|
||||
int ush_command_ctx_read(ush_cmd_ctx *out_ctx);
|
||||
void ush_command_ret_reset(void);
|
||||
int ush_command_ret_write(const ush_cmd_ret *ret);
|
||||
int ush_command_ret_read(ush_cmd_ret *out_ret);
|
||||
int ush_command_program_main(const char *command_name);
|
||||
int ush_try_exec_external(ush_state *sh, const char *cmd, const char *arg, int *out_success);
|
||||
int ush_try_exec_external_with_fds(ush_state *sh,
|
||||
const char *cmd,
|
||||
const char *arg,
|
||||
u64 stdin_fd,
|
||||
u64 stdout_fd,
|
||||
u64 stderr_fd,
|
||||
int *out_success);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,106 +5,53 @@ void ush_init_state(ush_state *sh) {
|
||||
return;
|
||||
}
|
||||
|
||||
sh->line[0] = '\0';
|
||||
sh->line_len = 0ULL;
|
||||
sh->cursor = 0ULL;
|
||||
sh->rendered_len = 0ULL;
|
||||
(void)memset(sh, 0, sizeof(*sh));
|
||||
|
||||
ush_copy(sh->cwd, (u64)sizeof(sh->cwd), "/");
|
||||
|
||||
sh->history_count = 0ULL;
|
||||
sh->history_nav = -1;
|
||||
sh->nav_saved_line[0] = '\0';
|
||||
sh->nav_saved_len = 0ULL;
|
||||
sh->nav_saved_cursor = 0ULL;
|
||||
|
||||
sh->cmd_total = 0ULL;
|
||||
sh->cmd_ok = 0ULL;
|
||||
sh->cmd_fail = 0ULL;
|
||||
sh->cmd_unknown = 0ULL;
|
||||
sh->exit_requested = 0;
|
||||
sh->exit_code = 0ULL;
|
||||
}
|
||||
|
||||
u64 ush_strlen(const char *str) {
|
||||
u64 len = 0ULL;
|
||||
|
||||
if (str == (const char *)0) {
|
||||
return 0ULL;
|
||||
}
|
||||
|
||||
while (str[len] != '\0') {
|
||||
len++;
|
||||
}
|
||||
|
||||
return len;
|
||||
return (str == (const char *)0) ? 0ULL : (u64)strlen(str);
|
||||
}
|
||||
|
||||
int ush_streq(const char *left, const char *right) {
|
||||
u64 i = 0ULL;
|
||||
|
||||
if (left == (const char *)0 || right == (const char *)0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (left[i] != '\0' && right[i] != '\0') {
|
||||
if (left[i] != right[i]) {
|
||||
return 0;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
return (left[i] == right[i]) ? 1 : 0;
|
||||
return (strcmp(left, right) == 0) ? 1 : 0;
|
||||
}
|
||||
|
||||
int ush_is_space(char ch) {
|
||||
return (ch == ' ' || ch == '\t' || ch == '\r' || ch == '\n') ? 1 : 0;
|
||||
return (isspace((unsigned char)ch) != 0) ? 1 : 0;
|
||||
}
|
||||
|
||||
int ush_is_printable(char ch) {
|
||||
return (ch >= 32 && ch <= 126) ? 1 : 0;
|
||||
return (isprint((unsigned char)ch) != 0) ? 1 : 0;
|
||||
}
|
||||
|
||||
int ush_has_suffix(const char *name, const char *suffix) {
|
||||
u64 name_len;
|
||||
u64 suffix_len;
|
||||
u64 i;
|
||||
size_t name_len;
|
||||
size_t suffix_len;
|
||||
|
||||
if (name == (const char *)0 || suffix == (const char *)0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
name_len = ush_strlen(name);
|
||||
suffix_len = ush_strlen(suffix);
|
||||
name_len = strlen(name);
|
||||
suffix_len = strlen(suffix);
|
||||
|
||||
if (suffix_len > name_len) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (i = 0ULL; i < suffix_len; i++) {
|
||||
if (name[name_len - suffix_len + i] != suffix[i]) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
return (strncmp(name + (name_len - suffix_len), suffix, suffix_len) == 0) ? 1 : 0;
|
||||
}
|
||||
|
||||
int ush_contains_char(const char *text, char needle) {
|
||||
u64 i = 0ULL;
|
||||
|
||||
if (text == (const char *)0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (text[i] != '\0') {
|
||||
if (text[i] == needle) {
|
||||
return 1;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return (strchr(text, (int)needle) != (char *)0) ? 1 : 0;
|
||||
}
|
||||
|
||||
int ush_parse_u64_dec(const char *text, u64 *out_value) {
|
||||
@@ -118,7 +65,7 @@ int ush_parse_u64_dec(const char *text, u64 *out_value) {
|
||||
while (text[i] != '\0') {
|
||||
u64 digit;
|
||||
|
||||
if (text[i] < '0' || text[i] > '9') {
|
||||
if (isdigit((unsigned char)text[i]) == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -137,45 +84,34 @@ int ush_parse_u64_dec(const char *text, u64 *out_value) {
|
||||
}
|
||||
|
||||
void ush_copy(char *dst, u64 dst_size, const char *src) {
|
||||
u64 i = 0ULL;
|
||||
|
||||
if (dst == (char *)0 || src == (const char *)0 || dst_size == 0ULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
while (src[i] != '\0' && i + 1ULL < dst_size) {
|
||||
dst[i] = src[i];
|
||||
i++;
|
||||
}
|
||||
|
||||
dst[i] = '\0';
|
||||
(void)strncpy(dst, src, (size_t)(dst_size - 1ULL));
|
||||
dst[dst_size - 1ULL] = '\0';
|
||||
}
|
||||
|
||||
void ush_trim_line(char *line) {
|
||||
u64 start = 0ULL;
|
||||
u64 i = 0ULL;
|
||||
u64 len;
|
||||
size_t start = 0U;
|
||||
size_t len;
|
||||
|
||||
if (line == (char *)0) {
|
||||
return;
|
||||
}
|
||||
|
||||
while (line[start] != '\0' && ush_is_space(line[start]) != 0) {
|
||||
while (line[start] != '\0' && isspace((unsigned char)line[start]) != 0) {
|
||||
start++;
|
||||
}
|
||||
|
||||
if (start > 0ULL) {
|
||||
while (line[start + i] != '\0') {
|
||||
line[i] = line[start + i];
|
||||
i++;
|
||||
}
|
||||
line[i] = '\0';
|
||||
if (start > 0U) {
|
||||
size_t remain = strlen(line + start) + 1U;
|
||||
(void)memmove(line, line + start, remain);
|
||||
}
|
||||
|
||||
len = ush_strlen(line);
|
||||
len = strlen(line);
|
||||
|
||||
while (len > 0ULL && ush_is_space(line[len - 1ULL]) != 0) {
|
||||
line[len - 1ULL] = '\0';
|
||||
while (len > 0U && isspace((unsigned char)line[len - 1U]) != 0) {
|
||||
line[len - 1U] = '\0';
|
||||
len--;
|
||||
}
|
||||
}
|
||||
@@ -219,8 +155,97 @@ void ush_parse_line(const char *line, char *out_cmd, u64 cmd_size, char *out_arg
|
||||
out_arg[arg_pos] = '\0';
|
||||
}
|
||||
|
||||
static char *ush_out_capture_buffer = (char *)0;
|
||||
static u64 ush_out_capture_capacity = 0ULL;
|
||||
static u64 ush_out_capture_length = 0ULL;
|
||||
static int ush_out_capture_active = 0;
|
||||
static int ush_out_capture_mirror_tty = 1;
|
||||
static int ush_out_capture_truncated = 0;
|
||||
static u64 ush_out_fd = (u64)-1;
|
||||
static int ush_out_fd_active = 0;
|
||||
static int ush_out_fd_mirror_tty = 1;
|
||||
|
||||
static void ush_output_capture_append(const char *text, u64 len) {
|
||||
u64 writable;
|
||||
|
||||
if (ush_out_capture_active == 0 || text == (const char *)0 || len == 0ULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ush_out_capture_buffer == (char *)0 || ush_out_capture_capacity == 0ULL) {
|
||||
ush_out_capture_truncated = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
if (ush_out_capture_length + 1ULL >= ush_out_capture_capacity) {
|
||||
ush_out_capture_truncated = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
writable = (ush_out_capture_capacity - 1ULL) - ush_out_capture_length;
|
||||
|
||||
if (len > writable) {
|
||||
len = writable;
|
||||
ush_out_capture_truncated = 1;
|
||||
}
|
||||
|
||||
(void)memcpy(ush_out_capture_buffer + ush_out_capture_length, text, (size_t)len);
|
||||
|
||||
ush_out_capture_length += len;
|
||||
ush_out_capture_buffer[ush_out_capture_length] = '\0';
|
||||
}
|
||||
|
||||
void ush_output_capture_begin(char *buffer, u64 buffer_size, int mirror_to_tty) {
|
||||
ush_out_capture_buffer = buffer;
|
||||
ush_out_capture_capacity = buffer_size;
|
||||
ush_out_capture_length = 0ULL;
|
||||
ush_out_capture_active = 1;
|
||||
ush_out_capture_mirror_tty = (mirror_to_tty != 0) ? 1 : 0;
|
||||
ush_out_capture_truncated = 0;
|
||||
|
||||
if (ush_out_capture_buffer != (char *)0 && ush_out_capture_capacity > 0ULL) {
|
||||
ush_out_capture_buffer[0] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
u64 ush_output_capture_end(void) {
|
||||
u64 captured = ush_out_capture_length;
|
||||
|
||||
if (ush_out_capture_buffer != (char *)0 && ush_out_capture_capacity > 0ULL) {
|
||||
if (ush_out_capture_length >= ush_out_capture_capacity) {
|
||||
ush_out_capture_length = ush_out_capture_capacity - 1ULL;
|
||||
}
|
||||
ush_out_capture_buffer[ush_out_capture_length] = '\0';
|
||||
}
|
||||
|
||||
ush_out_capture_buffer = (char *)0;
|
||||
ush_out_capture_capacity = 0ULL;
|
||||
ush_out_capture_length = 0ULL;
|
||||
ush_out_capture_active = 0;
|
||||
ush_out_capture_mirror_tty = 1;
|
||||
|
||||
return captured;
|
||||
}
|
||||
|
||||
int ush_output_capture_truncated(void) {
|
||||
return ush_out_capture_truncated;
|
||||
}
|
||||
|
||||
void ush_output_fd_begin(u64 fd, int mirror_to_tty) {
|
||||
ush_out_fd = fd;
|
||||
ush_out_fd_active = 1;
|
||||
ush_out_fd_mirror_tty = (mirror_to_tty != 0) ? 1 : 0;
|
||||
}
|
||||
|
||||
void ush_output_fd_end(void) {
|
||||
ush_out_fd = (u64)-1;
|
||||
ush_out_fd_active = 0;
|
||||
ush_out_fd_mirror_tty = 1;
|
||||
}
|
||||
|
||||
void ush_write(const char *text) {
|
||||
u64 len;
|
||||
int should_write_tty = 1;
|
||||
|
||||
if (text == (const char *)0) {
|
||||
return;
|
||||
@@ -232,11 +257,49 @@ void ush_write(const char *text) {
|
||||
return;
|
||||
}
|
||||
|
||||
(void)cleonos_sys_tty_write(text, len);
|
||||
if (ush_out_capture_active != 0) {
|
||||
ush_output_capture_append(text, len);
|
||||
|
||||
if (ush_out_capture_mirror_tty == 0) {
|
||||
should_write_tty = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (ush_out_fd_active != 0 && ush_out_fd != (u64)-1) {
|
||||
(void)cleonos_sys_fd_write(ush_out_fd, text, len);
|
||||
|
||||
if (ush_out_fd_mirror_tty == 0) {
|
||||
should_write_tty = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (should_write_tty != 0) {
|
||||
(void)fputs(text, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void ush_write_char(char ch) {
|
||||
(void)cleonos_sys_tty_write_char(ch);
|
||||
int should_write_tty = 1;
|
||||
|
||||
if (ush_out_capture_active != 0) {
|
||||
ush_output_capture_append(&ch, 1ULL);
|
||||
|
||||
if (ush_out_capture_mirror_tty == 0) {
|
||||
should_write_tty = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (ush_out_fd_active != 0 && ush_out_fd != (u64)-1) {
|
||||
(void)cleonos_sys_fd_write(ush_out_fd, &ch, 1ULL);
|
||||
|
||||
if (ush_out_fd_mirror_tty == 0) {
|
||||
should_write_tty = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (should_write_tty != 0) {
|
||||
(void)fputc((int)(unsigned char)ch, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void ush_writeln(const char *text) {
|
||||
|
||||
@@ -1,6 +1,55 @@
|
||||
#include "shell/shell_internal.h"
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
return ush_command_program_main("shstat");
|
||||
#include "cmd_runtime.h"
|
||||
static int ush_cmd_shstat(const ush_state *sh) {
|
||||
ush_writeln("shstat:");
|
||||
ush_print_kv_hex(" CMD_TOTAL", sh->cmd_total);
|
||||
ush_print_kv_hex(" CMD_OK", sh->cmd_ok);
|
||||
ush_print_kv_hex(" CMD_FAIL", sh->cmd_fail);
|
||||
ush_print_kv_hex(" CMD_UNKNOWN", sh->cmd_unknown);
|
||||
ush_print_kv_hex(" EXIT_REQUESTED", (sh->exit_requested != 0) ? 1ULL : 0ULL);
|
||||
ush_print_kv_hex(" EXIT_CODE", sh->exit_code);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
ush_cmd_ctx ctx;
|
||||
ush_cmd_ret ret;
|
||||
ush_state sh;
|
||||
char initial_cwd[USH_PATH_MAX];
|
||||
int has_context = 0;
|
||||
int success = 0;
|
||||
|
||||
ush_zero(&ctx, (u64)sizeof(ctx));
|
||||
ush_zero(&ret, (u64)sizeof(ret));
|
||||
ush_init_state(&sh);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
|
||||
if (ush_command_ctx_read(&ctx) != 0) {
|
||||
if (ctx.cmd[0] != '\0' && ush_streq(ctx.cmd, "shstat") != 0) {
|
||||
has_context = 1;
|
||||
if (ctx.cwd[0] == '/') {
|
||||
ush_copy(sh.cwd, (u64)sizeof(sh.cwd), ctx.cwd);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
success = ush_cmd_shstat(&sh);
|
||||
|
||||
if (has_context != 0) {
|
||||
if (ush_streq(sh.cwd, initial_cwd) == 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_CWD;
|
||||
ush_copy(ret.cwd, (u64)sizeof(ret.cwd), sh.cwd);
|
||||
}
|
||||
|
||||
if (sh.exit_requested != 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_EXIT;
|
||||
ret.exit_code = sh.exit_code;
|
||||
}
|
||||
|
||||
(void)ush_command_ret_write(&ret);
|
||||
}
|
||||
|
||||
return (success != 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,50 @@
|
||||
#include "shell/shell_internal.h"
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
return ush_command_program_main("shutdown");
|
||||
#include "cmd_runtime.h"
|
||||
static int ush_cmd_shutdown(void) {
|
||||
ush_writeln("shutdown: powering off...");
|
||||
(void)cleonos_sys_shutdown();
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
ush_cmd_ctx ctx;
|
||||
ush_cmd_ret ret;
|
||||
ush_state sh;
|
||||
char initial_cwd[USH_PATH_MAX];
|
||||
int has_context = 0;
|
||||
int success = 0;
|
||||
|
||||
ush_zero(&ctx, (u64)sizeof(ctx));
|
||||
ush_zero(&ret, (u64)sizeof(ret));
|
||||
ush_init_state(&sh);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
|
||||
if (ush_command_ctx_read(&ctx) != 0) {
|
||||
if (ctx.cmd[0] != '\0' && ush_streq(ctx.cmd, "shutdown") != 0) {
|
||||
has_context = 1;
|
||||
if (ctx.cwd[0] == '/') {
|
||||
ush_copy(sh.cwd, (u64)sizeof(sh.cwd), ctx.cwd);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
success = ush_cmd_shutdown();
|
||||
|
||||
if (has_context != 0) {
|
||||
if (ush_streq(sh.cwd, initial_cwd) == 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_CWD;
|
||||
ush_copy(ret.cwd, (u64)sizeof(ret.cwd), sh.cwd);
|
||||
}
|
||||
|
||||
if (sh.exit_requested != 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_EXIT;
|
||||
ret.exit_code = sh.exit_code;
|
||||
}
|
||||
|
||||
(void)ush_command_ret_write(&ret);
|
||||
}
|
||||
|
||||
return (success != 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,65 @@
|
||||
#include "shell/shell_internal.h"
|
||||
#include "cmd_runtime.h"
|
||||
static int ush_cmd_sleep(const char *arg) {
|
||||
u64 ticks;
|
||||
u64 elapsed;
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
return ush_command_program_main("sleep");
|
||||
if (arg == (const char *)0 || arg[0] == '\0') {
|
||||
ush_writeln("sleep: usage sleep <ticks>");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_parse_u64_dec(arg, &ticks) == 0) {
|
||||
ush_writeln("sleep: invalid ticks");
|
||||
return 0;
|
||||
}
|
||||
|
||||
elapsed = cleonos_sys_sleep_ticks(ticks);
|
||||
ush_print_kv_hex("SLEPT_TICKS", elapsed);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
ush_cmd_ctx ctx;
|
||||
ush_cmd_ret ret;
|
||||
ush_state sh;
|
||||
char initial_cwd[USH_PATH_MAX];
|
||||
int has_context = 0;
|
||||
int success = 0;
|
||||
const char *arg = "";
|
||||
|
||||
ush_zero(&ctx, (u64)sizeof(ctx));
|
||||
ush_zero(&ret, (u64)sizeof(ret));
|
||||
ush_init_state(&sh);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
|
||||
if (ush_command_ctx_read(&ctx) != 0) {
|
||||
if (ctx.cmd[0] != '\0' && ush_streq(ctx.cmd, "sleep") != 0) {
|
||||
has_context = 1;
|
||||
arg = ctx.arg;
|
||||
if (ctx.cwd[0] == '/') {
|
||||
ush_copy(sh.cwd, (u64)sizeof(sh.cwd), ctx.cwd);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
success = ush_cmd_sleep(arg);
|
||||
|
||||
if (has_context != 0) {
|
||||
if (ush_streq(sh.cwd, initial_cwd) == 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_CWD;
|
||||
ush_copy(ret.cwd, (u64)sizeof(ret.cwd), sh.cwd);
|
||||
}
|
||||
|
||||
if (sh.exit_requested != 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_EXIT;
|
||||
ret.exit_code = sh.exit_code;
|
||||
}
|
||||
|
||||
(void)ush_command_ret_write(&ret);
|
||||
}
|
||||
|
||||
return (success != 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
|
||||
267
cleonos/c/apps/sort_main.c
Normal file
267
cleonos/c/apps/sort_main.c
Normal file
@@ -0,0 +1,267 @@
|
||||
#include "cmd_runtime.h"
|
||||
|
||||
#define USH_SORT_MAX_LINES 4096ULL
|
||||
|
||||
static int ush_sort_parse_args(const char *arg, char *out_file, u64 out_file_size) {
|
||||
char first[USH_PATH_MAX];
|
||||
const char *rest = "";
|
||||
|
||||
if (out_file == (char *)0 || out_file_size == 0ULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
out_file[0] = '\0';
|
||||
|
||||
if (arg == (const char *)0 || arg[0] == '\0') {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (ush_split_first_and_rest(arg, first, (u64)sizeof(first), &rest) == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (rest != (const char *)0 && rest[0] != '\0') {
|
||||
return 0;
|
||||
}
|
||||
|
||||
ush_copy(out_file, out_file_size, first);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int ush_sort_load_input(const ush_state *sh, const char *file_arg, char *out_buf, u64 out_buf_size, u64 *out_len) {
|
||||
char path[USH_PATH_MAX];
|
||||
u64 size;
|
||||
u64 got;
|
||||
u64 i;
|
||||
|
||||
if (sh == (const ush_state *)0 || out_buf == (char *)0 || out_buf_size == 0ULL || out_len == (u64 *)0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
*out_len = 0ULL;
|
||||
out_buf[0] = '\0';
|
||||
|
||||
if (file_arg != (const char *)0 && file_arg[0] != '\0') {
|
||||
if (ush_resolve_path(sh, file_arg, path, (u64)sizeof(path)) == 0) {
|
||||
ush_writeln("sort: invalid path");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (cleonos_sys_fs_stat_type(path) != 1ULL) {
|
||||
ush_writeln("sort: file not found");
|
||||
return 0;
|
||||
}
|
||||
|
||||
size = cleonos_sys_fs_stat_size(path);
|
||||
|
||||
if (size == (u64)-1) {
|
||||
ush_writeln("sort: failed to stat file");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (size + 1ULL > out_buf_size) {
|
||||
ush_writeln("sort: file too large for user buffer");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (size == 0ULL) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
got = cleonos_sys_fs_read(path, out_buf, size);
|
||||
|
||||
if (got == 0ULL || got != size) {
|
||||
ush_writeln("sort: read failed");
|
||||
return 0;
|
||||
}
|
||||
|
||||
out_buf[got] = '\0';
|
||||
*out_len = got;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (ush_pipeline_stdin_text == (const char *)0) {
|
||||
ush_writeln("sort: file path required (or pipeline input)");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_pipeline_stdin_len + 1ULL > out_buf_size) {
|
||||
ush_writeln("sort: pipeline input too large");
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (i = 0ULL; i < ush_pipeline_stdin_len; i++) {
|
||||
out_buf[i] = ush_pipeline_stdin_text[i];
|
||||
}
|
||||
|
||||
out_buf[ush_pipeline_stdin_len] = '\0';
|
||||
*out_len = ush_pipeline_stdin_len;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int ush_sort_compare_line(const char *left, const char *right) {
|
||||
u64 i = 0ULL;
|
||||
|
||||
while (left[i] != '\0' && right[i] != '\0') {
|
||||
if (left[i] < right[i]) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (left[i] > right[i]) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
if (left[i] == right[i]) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return (left[i] == '\0') ? -1 : 1;
|
||||
}
|
||||
|
||||
static int ush_sort_collect_lines(char *buf, u64 len, char **out_lines, u64 max_lines, u64 *out_count) {
|
||||
u64 start = 0ULL;
|
||||
u64 i;
|
||||
u64 count = 0ULL;
|
||||
int truncated = 0;
|
||||
|
||||
if (buf == (char *)0 || out_lines == (char **)0 || out_count == (u64 *)0 || max_lines == 0ULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
*out_count = 0ULL;
|
||||
|
||||
for (i = 0ULL; i < len; i++) {
|
||||
if (buf[i] == '\n') {
|
||||
buf[i] = '\0';
|
||||
|
||||
if (count < max_lines) {
|
||||
out_lines[count++] = &buf[start];
|
||||
} else {
|
||||
truncated = 1;
|
||||
}
|
||||
|
||||
start = i + 1ULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (start < len) {
|
||||
if (count < max_lines) {
|
||||
out_lines[count++] = &buf[start];
|
||||
} else {
|
||||
truncated = 1;
|
||||
}
|
||||
}
|
||||
|
||||
*out_count = count;
|
||||
return (truncated == 0) ? 1 : 2;
|
||||
}
|
||||
|
||||
static void ush_sort_lines(char **lines, u64 count) {
|
||||
u64 i;
|
||||
|
||||
if (lines == (char **)0 || count == 0ULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 1ULL; i < count; i++) {
|
||||
char *key = lines[i];
|
||||
u64 j = i;
|
||||
|
||||
while (j > 0ULL && ush_sort_compare_line(lines[j - 1ULL], key) > 0) {
|
||||
lines[j] = lines[j - 1ULL];
|
||||
j--;
|
||||
}
|
||||
|
||||
lines[j] = key;
|
||||
}
|
||||
}
|
||||
|
||||
static int ush_cmd_sort(const ush_state *sh, const char *arg) {
|
||||
char file_arg[USH_PATH_MAX];
|
||||
static char sort_buf[USH_COPY_MAX + 1U];
|
||||
char *lines[USH_SORT_MAX_LINES];
|
||||
u64 len = 0ULL;
|
||||
u64 line_count = 0ULL;
|
||||
u64 i;
|
||||
int collect_status;
|
||||
|
||||
if (sh == (const ush_state *)0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_sort_parse_args(arg, file_arg, (u64)sizeof(file_arg)) == 0) {
|
||||
ush_writeln("sort: usage sort [file]");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_sort_load_input(sh, file_arg, sort_buf, (u64)sizeof(sort_buf), &len) == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
collect_status = ush_sort_collect_lines(sort_buf, len, lines, (u64)USH_SORT_MAX_LINES, &line_count);
|
||||
|
||||
if (collect_status == 0) {
|
||||
ush_writeln("sort: internal parse error");
|
||||
return 0;
|
||||
}
|
||||
|
||||
ush_sort_lines(lines, line_count);
|
||||
|
||||
for (i = 0ULL; i < line_count; i++) {
|
||||
ush_writeln(lines[i]);
|
||||
}
|
||||
|
||||
if (collect_status == 2) {
|
||||
ush_writeln("[sort] line count truncated");
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
ush_cmd_ctx ctx;
|
||||
ush_cmd_ret ret;
|
||||
ush_state sh;
|
||||
char initial_cwd[USH_PATH_MAX];
|
||||
int has_context = 0;
|
||||
int success = 0;
|
||||
const char *arg = "";
|
||||
|
||||
ush_zero(&ctx, (u64)sizeof(ctx));
|
||||
ush_zero(&ret, (u64)sizeof(ret));
|
||||
ush_init_state(&sh);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
|
||||
if (ush_command_ctx_read(&ctx) != 0) {
|
||||
if (ctx.cmd[0] != '\0' && ush_streq(ctx.cmd, "sort") != 0) {
|
||||
has_context = 1;
|
||||
arg = ctx.arg;
|
||||
if (ctx.cwd[0] == '/') {
|
||||
ush_copy(sh.cwd, (u64)sizeof(sh.cwd), ctx.cwd);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
success = ush_cmd_sort(&sh, arg);
|
||||
|
||||
if (has_context != 0) {
|
||||
if (ush_streq(sh.cwd, initial_cwd) == 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_CWD;
|
||||
ush_copy(ret.cwd, (u64)sizeof(ret.cwd), sh.cwd);
|
||||
}
|
||||
|
||||
if (sh.exit_requested != 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_EXIT;
|
||||
ret.exit_code = sh.exit_code;
|
||||
}
|
||||
|
||||
(void)ush_command_ret_write(&ret);
|
||||
}
|
||||
|
||||
return (success != 0) ? 0 : 1;
|
||||
}
|
||||
@@ -1,6 +1,95 @@
|
||||
#include "shell/shell_internal.h"
|
||||
#include "cmd_runtime.h"
|
||||
static int ush_cmd_spawn(const ush_state *sh, const char *arg) {
|
||||
char target[USH_PATH_MAX];
|
||||
char argv_line[USH_ARG_MAX];
|
||||
char env_line[USH_PATH_MAX + 32ULL];
|
||||
const char *rest = "";
|
||||
char path[USH_PATH_MAX];
|
||||
u64 pid;
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
return ush_command_program_main("spawn");
|
||||
if (sh == (const ush_state *)0 || arg == (const char *)0 || arg[0] == '\0') {
|
||||
ush_writeln("spawn: usage spawn <path|name> [args...]");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_split_first_and_rest(arg, target, (u64)sizeof(target), &rest) == 0) {
|
||||
ush_writeln("spawn: usage spawn <path|name> [args...]");
|
||||
return 0;
|
||||
}
|
||||
|
||||
argv_line[0] = '\0';
|
||||
if (rest != (const char *)0 && rest[0] != '\0') {
|
||||
ush_copy(argv_line, (u64)sizeof(argv_line), rest);
|
||||
}
|
||||
|
||||
if (ush_resolve_exec_path(sh, target, path, (u64)sizeof(path)) == 0) {
|
||||
ush_writeln("spawn: invalid target");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_path_is_under_system(path) != 0) {
|
||||
ush_writeln("spawn: /system/*.elf is kernel-mode (KELF), not user-exec");
|
||||
return 0;
|
||||
}
|
||||
|
||||
env_line[0] = '\0';
|
||||
ush_copy(env_line, (u64)sizeof(env_line), "PWD=");
|
||||
ush_copy(env_line + 4, (u64)(sizeof(env_line) - 4ULL), sh->cwd);
|
||||
|
||||
pid = cleonos_sys_spawn_pathv(path, argv_line, env_line);
|
||||
|
||||
if (pid == (u64)-1) {
|
||||
ush_writeln("spawn: request failed");
|
||||
return 0;
|
||||
}
|
||||
|
||||
ush_writeln("spawn: completed");
|
||||
ush_print_kv_hex(" PID", pid);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
ush_cmd_ctx ctx;
|
||||
ush_cmd_ret ret;
|
||||
ush_state sh;
|
||||
char initial_cwd[USH_PATH_MAX];
|
||||
int has_context = 0;
|
||||
int success = 0;
|
||||
const char *arg = "";
|
||||
|
||||
ush_zero(&ctx, (u64)sizeof(ctx));
|
||||
ush_zero(&ret, (u64)sizeof(ret));
|
||||
ush_init_state(&sh);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
|
||||
if (ush_command_ctx_read(&ctx) != 0) {
|
||||
if (ctx.cmd[0] != '\0' && ush_streq(ctx.cmd, "spawn") != 0) {
|
||||
has_context = 1;
|
||||
arg = ctx.arg;
|
||||
if (ctx.cwd[0] == '/') {
|
||||
ush_copy(sh.cwd, (u64)sizeof(sh.cwd), ctx.cwd);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
success = ush_cmd_spawn(&sh, arg);
|
||||
|
||||
if (has_context != 0) {
|
||||
if (ush_streq(sh.cwd, initial_cwd) == 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_CWD;
|
||||
ush_copy(ret.cwd, (u64)sizeof(ret.cwd), sh.cwd);
|
||||
}
|
||||
|
||||
if (sh.exit_requested != 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_EXIT;
|
||||
ret.exit_code = sh.exit_code;
|
||||
}
|
||||
|
||||
(void)ush_command_ret_write(&ret);
|
||||
}
|
||||
|
||||
return (success != 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
|
||||
16
cleonos/c/apps/spin_main.c
Normal file
16
cleonos/c/apps/spin_main.c
Normal file
@@ -0,0 +1,16 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
static const char banner[] =
|
||||
"spin: busy loop started (test Alt+Ctrl+C force stop)\n";
|
||||
volatile unsigned long long noise = 0xC1E0C1E0ULL;
|
||||
|
||||
(void)fputs(banner, 1);
|
||||
|
||||
for (;;) {
|
||||
noise ^= (noise << 7);
|
||||
noise ^= (noise >> 9);
|
||||
noise ^= 0x9E3779B97F4A7C15ULL;
|
||||
noise += 0xA5A5A5A5A5A5A5A5ULL;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,119 @@
|
||||
#include "shell/shell_internal.h"
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
return ush_command_program_main("stats");
|
||||
#include "cmd_runtime.h"
|
||||
static int ush_cmd_memstat(void) {
|
||||
ush_writeln("memstat (user ABI limited):");
|
||||
ush_print_kv_hex(" SERVICE_COUNT", cleonos_sys_service_count());
|
||||
ush_print_kv_hex(" SERVICE_READY_COUNT", cleonos_sys_service_ready_count());
|
||||
ush_print_kv_hex(" KELF_COUNT", cleonos_sys_kelf_count());
|
||||
ush_print_kv_hex(" KELF_RUNS", cleonos_sys_kelf_runs());
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int ush_cmd_fsstat(void) {
|
||||
ush_writeln("fsstat:");
|
||||
ush_print_kv_hex(" NODE_COUNT", cleonos_sys_fs_node_count());
|
||||
ush_print_kv_hex(" ROOT_CHILDREN", cleonos_sys_fs_child_count("/"));
|
||||
ush_print_kv_hex(" SYSTEM_CHILDREN", cleonos_sys_fs_child_count("/system"));
|
||||
ush_print_kv_hex(" SHELL_CHILDREN", cleonos_sys_fs_child_count("/shell"));
|
||||
ush_print_kv_hex(" TEMP_CHILDREN", cleonos_sys_fs_child_count("/temp"));
|
||||
ush_print_kv_hex(" DRIVER_CHILDREN", cleonos_sys_fs_child_count("/driver"));
|
||||
ush_print_kv_hex(" DEV_CHILDREN", cleonos_sys_fs_child_count("/dev"));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int ush_cmd_taskstat(void) {
|
||||
ush_writeln("taskstat:");
|
||||
ush_print_kv_hex(" TASK_COUNT", cleonos_sys_task_count());
|
||||
ush_print_kv_hex(" CURRENT_TASK", cleonos_syscall(CLEONOS_SYSCALL_CUR_TASK, 0ULL, 0ULL, 0ULL));
|
||||
ush_print_kv_hex(" TIMER_TICKS", cleonos_sys_timer_ticks());
|
||||
ush_print_kv_hex(" CONTEXT_SWITCHES", cleonos_sys_context_switches());
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int ush_cmd_userstat(void) {
|
||||
ush_writeln("userstat:");
|
||||
ush_print_kv_hex(" USER_SHELL_READY", cleonos_sys_user_shell_ready());
|
||||
ush_print_kv_hex(" USER_EXEC_REQUESTED", cleonos_sys_user_exec_requested());
|
||||
ush_print_kv_hex(" USER_LAUNCH_TRIES", cleonos_sys_user_launch_tries());
|
||||
ush_print_kv_hex(" USER_LAUNCH_OK", cleonos_sys_user_launch_ok());
|
||||
ush_print_kv_hex(" USER_LAUNCH_FAIL", cleonos_sys_user_launch_fail());
|
||||
ush_print_kv_hex(" EXEC_REQUESTS", cleonos_sys_exec_request_count());
|
||||
ush_print_kv_hex(" EXEC_SUCCESS", cleonos_sys_exec_success_count());
|
||||
ush_print_kv_hex(" TTY_COUNT", cleonos_sys_tty_count());
|
||||
ush_print_kv_hex(" TTY_ACTIVE", cleonos_sys_tty_active());
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int ush_cmd_kbdstat(void) {
|
||||
ush_writeln("kbdstat:");
|
||||
ush_print_kv_hex(" BUFFERED", cleonos_sys_kbd_buffered());
|
||||
ush_print_kv_hex(" PUSHED", cleonos_sys_kbd_pushed());
|
||||
ush_print_kv_hex(" POPPED", cleonos_sys_kbd_popped());
|
||||
ush_print_kv_hex(" DROPPED", cleonos_sys_kbd_dropped());
|
||||
ush_print_kv_hex(" HOTKEY_SWITCHES", cleonos_sys_kbd_hotkey_switches());
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int ush_cmd_shstat(const ush_state *sh) {
|
||||
ush_writeln("shstat:");
|
||||
ush_print_kv_hex(" CMD_TOTAL", sh->cmd_total);
|
||||
ush_print_kv_hex(" CMD_OK", sh->cmd_ok);
|
||||
ush_print_kv_hex(" CMD_FAIL", sh->cmd_fail);
|
||||
ush_print_kv_hex(" CMD_UNKNOWN", sh->cmd_unknown);
|
||||
ush_print_kv_hex(" EXIT_REQUESTED", (sh->exit_requested != 0) ? 1ULL : 0ULL);
|
||||
ush_print_kv_hex(" EXIT_CODE", sh->exit_code);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int ush_cmd_stats(const ush_state *sh) {
|
||||
(void)ush_cmd_memstat();
|
||||
(void)ush_cmd_fsstat();
|
||||
(void)ush_cmd_taskstat();
|
||||
(void)ush_cmd_userstat();
|
||||
(void)ush_cmd_kbdstat();
|
||||
(void)ush_cmd_shstat(sh);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
ush_cmd_ctx ctx;
|
||||
ush_cmd_ret ret;
|
||||
ush_state sh;
|
||||
char initial_cwd[USH_PATH_MAX];
|
||||
int has_context = 0;
|
||||
int success = 0;
|
||||
|
||||
ush_zero(&ctx, (u64)sizeof(ctx));
|
||||
ush_zero(&ret, (u64)sizeof(ret));
|
||||
ush_init_state(&sh);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
|
||||
if (ush_command_ctx_read(&ctx) != 0) {
|
||||
if (ctx.cmd[0] != '\0' && ush_streq(ctx.cmd, "stats") != 0) {
|
||||
has_context = 1;
|
||||
if (ctx.cwd[0] == '/') {
|
||||
ush_copy(sh.cwd, (u64)sizeof(sh.cwd), ctx.cwd);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
success = ush_cmd_stats(&sh);
|
||||
|
||||
if (has_context != 0) {
|
||||
if (ush_streq(sh.cwd, initial_cwd) == 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_CWD;
|
||||
ush_copy(ret.cwd, (u64)sizeof(ret.cwd), sh.cwd);
|
||||
}
|
||||
|
||||
if (sh.exit_requested != 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_EXIT;
|
||||
ret.exit_code = sh.exit_code;
|
||||
}
|
||||
|
||||
(void)ush_command_ret_write(&ret);
|
||||
}
|
||||
|
||||
return (success != 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
|
||||
311
cleonos/c/apps/sysstat_main.c
Normal file
311
cleonos/c/apps/sysstat_main.c
Normal file
@@ -0,0 +1,311 @@
|
||||
#include "cmd_runtime.h"
|
||||
|
||||
#define USH_SYSSTAT_MAX_IDS (CLEONOS_SYSCALL_STATS_RECENT_ID + 1ULL)
|
||||
#define USH_SYSSTAT_DEFAULT_TOP 12ULL
|
||||
|
||||
typedef struct ush_sysstat_entry {
|
||||
u64 id;
|
||||
u64 recent;
|
||||
u64 total;
|
||||
const char *name;
|
||||
} ush_sysstat_entry;
|
||||
|
||||
static const char *ush_sysstat_name_for_id(u64 id) {
|
||||
switch (id) {
|
||||
case CLEONOS_SYSCALL_LOG_WRITE: return "LOG_WRITE";
|
||||
case CLEONOS_SYSCALL_TIMER_TICKS: return "TIMER_TICKS";
|
||||
case CLEONOS_SYSCALL_TASK_COUNT: return "TASK_COUNT";
|
||||
case CLEONOS_SYSCALL_CUR_TASK: return "CUR_TASK";
|
||||
case CLEONOS_SYSCALL_SERVICE_COUNT: return "SERVICE_COUNT";
|
||||
case CLEONOS_SYSCALL_SERVICE_READY_COUNT: return "SERVICE_READY";
|
||||
case CLEONOS_SYSCALL_CONTEXT_SWITCHES: return "CONTEXT_SWITCH";
|
||||
case CLEONOS_SYSCALL_KELF_COUNT: return "KELF_COUNT";
|
||||
case CLEONOS_SYSCALL_KELF_RUNS: return "KELF_RUNS";
|
||||
case CLEONOS_SYSCALL_FS_NODE_COUNT: return "FS_NODE_COUNT";
|
||||
case CLEONOS_SYSCALL_FS_CHILD_COUNT: return "FS_CHILD_COUNT";
|
||||
case CLEONOS_SYSCALL_FS_GET_CHILD_NAME: return "FS_CHILD_NAME";
|
||||
case CLEONOS_SYSCALL_FS_READ: return "FS_READ";
|
||||
case CLEONOS_SYSCALL_EXEC_PATH: return "EXEC_PATH";
|
||||
case CLEONOS_SYSCALL_EXEC_REQUESTS: return "EXEC_REQUESTS";
|
||||
case CLEONOS_SYSCALL_EXEC_SUCCESS: return "EXEC_SUCCESS";
|
||||
case CLEONOS_SYSCALL_USER_SHELL_READY: return "USER_SHELL_READY";
|
||||
case CLEONOS_SYSCALL_USER_EXEC_REQUESTED: return "USER_EXEC_REQ";
|
||||
case CLEONOS_SYSCALL_USER_LAUNCH_TRIES: return "USER_LAUNCH_TRY";
|
||||
case CLEONOS_SYSCALL_USER_LAUNCH_OK: return "USER_LAUNCH_OK";
|
||||
case CLEONOS_SYSCALL_USER_LAUNCH_FAIL: return "USER_LAUNCH_FAIL";
|
||||
case CLEONOS_SYSCALL_TTY_COUNT: return "TTY_COUNT";
|
||||
case CLEONOS_SYSCALL_TTY_ACTIVE: return "TTY_ACTIVE";
|
||||
case CLEONOS_SYSCALL_TTY_SWITCH: return "TTY_SWITCH";
|
||||
case CLEONOS_SYSCALL_TTY_WRITE: return "TTY_WRITE";
|
||||
case CLEONOS_SYSCALL_TTY_WRITE_CHAR: return "TTY_WRITE_CHAR";
|
||||
case CLEONOS_SYSCALL_KBD_GET_CHAR: return "KBD_GET_CHAR";
|
||||
case CLEONOS_SYSCALL_FS_STAT_TYPE: return "FS_STAT_TYPE";
|
||||
case CLEONOS_SYSCALL_FS_STAT_SIZE: return "FS_STAT_SIZE";
|
||||
case CLEONOS_SYSCALL_FS_MKDIR: return "FS_MKDIR";
|
||||
case CLEONOS_SYSCALL_FS_WRITE: return "FS_WRITE";
|
||||
case CLEONOS_SYSCALL_FS_APPEND: return "FS_APPEND";
|
||||
case CLEONOS_SYSCALL_FS_REMOVE: return "FS_REMOVE";
|
||||
case CLEONOS_SYSCALL_LOG_JOURNAL_COUNT: return "LOG_JCOUNT";
|
||||
case CLEONOS_SYSCALL_LOG_JOURNAL_READ: return "LOG_JREAD";
|
||||
case CLEONOS_SYSCALL_KBD_BUFFERED: return "KBD_BUFFERED";
|
||||
case CLEONOS_SYSCALL_KBD_PUSHED: return "KBD_PUSHED";
|
||||
case CLEONOS_SYSCALL_KBD_POPPED: return "KBD_POPPED";
|
||||
case CLEONOS_SYSCALL_KBD_DROPPED: return "KBD_DROPPED";
|
||||
case CLEONOS_SYSCALL_KBD_HOTKEY_SWITCHES: return "KBD_HOTKEYS";
|
||||
case CLEONOS_SYSCALL_GETPID: return "GETPID";
|
||||
case CLEONOS_SYSCALL_SPAWN_PATH: return "SPAWN_PATH";
|
||||
case CLEONOS_SYSCALL_WAITPID: return "WAITPID";
|
||||
case CLEONOS_SYSCALL_EXIT: return "EXIT";
|
||||
case CLEONOS_SYSCALL_SLEEP_TICKS: return "SLEEP_TICKS";
|
||||
case CLEONOS_SYSCALL_YIELD: return "YIELD";
|
||||
case CLEONOS_SYSCALL_SHUTDOWN: return "SHUTDOWN";
|
||||
case CLEONOS_SYSCALL_RESTART: return "RESTART";
|
||||
case CLEONOS_SYSCALL_AUDIO_AVAILABLE: return "AUDIO_AVAIL";
|
||||
case CLEONOS_SYSCALL_AUDIO_PLAY_TONE: return "AUDIO_TONE";
|
||||
case CLEONOS_SYSCALL_AUDIO_STOP: return "AUDIO_STOP";
|
||||
case CLEONOS_SYSCALL_EXEC_PATHV: return "EXEC_PATHV";
|
||||
case CLEONOS_SYSCALL_SPAWN_PATHV: return "SPAWN_PATHV";
|
||||
case CLEONOS_SYSCALL_PROC_ARGC: return "PROC_ARGC";
|
||||
case CLEONOS_SYSCALL_PROC_ARGV: return "PROC_ARGV";
|
||||
case CLEONOS_SYSCALL_PROC_ENVC: return "PROC_ENVC";
|
||||
case CLEONOS_SYSCALL_PROC_ENV: return "PROC_ENV";
|
||||
case CLEONOS_SYSCALL_PROC_LAST_SIGNAL: return "PROC_LAST_SIG";
|
||||
case CLEONOS_SYSCALL_PROC_FAULT_VECTOR: return "PROC_FAULT_VEC";
|
||||
case CLEONOS_SYSCALL_PROC_FAULT_ERROR: return "PROC_FAULT_ERR";
|
||||
case CLEONOS_SYSCALL_PROC_FAULT_RIP: return "PROC_FAULT_RIP";
|
||||
case CLEONOS_SYSCALL_PROC_COUNT: return "PROC_COUNT";
|
||||
case CLEONOS_SYSCALL_PROC_PID_AT: return "PROC_PID_AT";
|
||||
case CLEONOS_SYSCALL_PROC_SNAPSHOT: return "PROC_SNAPSHOT";
|
||||
case CLEONOS_SYSCALL_PROC_KILL: return "PROC_KILL";
|
||||
case CLEONOS_SYSCALL_KDBG_SYM: return "KDBG_SYM";
|
||||
case CLEONOS_SYSCALL_KDBG_BT: return "KDBG_BT";
|
||||
case CLEONOS_SYSCALL_KDBG_REGS: return "KDBG_REGS";
|
||||
case CLEONOS_SYSCALL_STATS_TOTAL: return "STATS_TOTAL";
|
||||
case CLEONOS_SYSCALL_STATS_ID_COUNT: return "STATS_ID_COUNT";
|
||||
case CLEONOS_SYSCALL_STATS_RECENT_WINDOW: return "STATS_RECENT_WIN";
|
||||
case CLEONOS_SYSCALL_STATS_RECENT_ID: return "STATS_RECENT_ID";
|
||||
default: return "UNKNOWN";
|
||||
}
|
||||
}
|
||||
|
||||
static int ush_sysstat_next_token(const char **io_cursor, char *out, u64 out_size) {
|
||||
const char *p;
|
||||
u64 n = 0ULL;
|
||||
|
||||
if (io_cursor == (const char **)0 || out == (char *)0 || out_size == 0ULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
out[0] = '\0';
|
||||
p = *io_cursor;
|
||||
|
||||
if (p == (const char *)0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (*p != '\0' && ush_is_space(*p) != 0) {
|
||||
p++;
|
||||
}
|
||||
|
||||
if (*p == '\0') {
|
||||
*io_cursor = p;
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (*p != '\0' && ush_is_space(*p) == 0) {
|
||||
if (n + 1ULL < out_size) {
|
||||
out[n++] = *p;
|
||||
}
|
||||
p++;
|
||||
}
|
||||
|
||||
out[n] = '\0';
|
||||
*io_cursor = p;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int ush_sysstat_parse_args(const char *arg, int *out_show_all, u64 *out_limit) {
|
||||
const char *cursor = arg;
|
||||
char token[USH_PATH_MAX];
|
||||
int show_all = 0;
|
||||
u64 limit = USH_SYSSTAT_DEFAULT_TOP;
|
||||
|
||||
if (out_show_all == (int *)0 || out_limit == (u64 *)0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (ush_sysstat_next_token(&cursor, token, (u64)sizeof(token)) != 0) {
|
||||
if (ush_streq(token, "-a") != 0 || ush_streq(token, "--all") != 0) {
|
||||
show_all = 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ush_streq(token, "-n") != 0 || ush_streq(token, "--top") != 0) {
|
||||
if (ush_sysstat_next_token(&cursor, token, (u64)sizeof(token)) == 0 || ush_parse_u64_dec(token, &limit) == 0) {
|
||||
return 0;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (limit == 0ULL) {
|
||||
limit = 1ULL;
|
||||
}
|
||||
|
||||
*out_show_all = show_all;
|
||||
*out_limit = limit;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void ush_sysstat_sort_recent(ush_sysstat_entry *entries, u64 count) {
|
||||
u64 i;
|
||||
|
||||
if (entries == (ush_sysstat_entry *)0) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0ULL; i + 1ULL < count; i++) {
|
||||
u64 j;
|
||||
|
||||
for (j = i + 1ULL; j < count; j++) {
|
||||
int swap = 0;
|
||||
|
||||
if (entries[j].recent > entries[i].recent) {
|
||||
swap = 1;
|
||||
} else if (entries[j].recent == entries[i].recent && entries[j].total > entries[i].total) {
|
||||
swap = 1;
|
||||
} else if (entries[j].recent == entries[i].recent && entries[j].total == entries[i].total &&
|
||||
entries[j].id < entries[i].id) {
|
||||
swap = 1;
|
||||
}
|
||||
|
||||
if (swap != 0) {
|
||||
ush_sysstat_entry tmp = entries[i];
|
||||
entries[i] = entries[j];
|
||||
entries[j] = tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int ush_cmd_sysstat(const char *arg) {
|
||||
int show_all = 0;
|
||||
u64 limit = USH_SYSSTAT_DEFAULT_TOP;
|
||||
ush_sysstat_entry entries[USH_SYSSTAT_MAX_IDS];
|
||||
u64 entry_count = 0ULL;
|
||||
u64 id;
|
||||
u64 total = cleonos_sys_stats_total();
|
||||
u64 recent_window = cleonos_sys_stats_recent_window();
|
||||
u64 to_show;
|
||||
|
||||
if (ush_sysstat_parse_args(arg, &show_all, &limit) == 0) {
|
||||
ush_writeln("sysstat: usage sysstat [-a|--all] [-n N]");
|
||||
return 0;
|
||||
}
|
||||
|
||||
ush_writeln("sysstat:");
|
||||
ush_print_kv_hex(" TIMER_TICKS", cleonos_sys_timer_ticks());
|
||||
ush_print_kv_hex(" TASK_COUNT", cleonos_sys_task_count());
|
||||
ush_print_kv_hex(" CURRENT_TASK", cleonos_syscall(CLEONOS_SYSCALL_CUR_TASK, 0ULL, 0ULL, 0ULL));
|
||||
ush_print_kv_hex(" CONTEXT_SWITCHES", cleonos_sys_context_switches());
|
||||
ush_print_kv_hex(" PROC_COUNT", cleonos_sys_proc_count());
|
||||
ush_print_kv_hex(" EXEC_REQUESTS", cleonos_sys_exec_request_count());
|
||||
ush_print_kv_hex(" EXEC_SUCCESS", cleonos_sys_exec_success_count());
|
||||
ush_print_kv_hex(" SYSCALL_TOTAL", total);
|
||||
ush_print_kv_hex(" SYSCALL_RECENT_WINDOW", recent_window);
|
||||
ush_writeln("");
|
||||
|
||||
for (id = 0ULL; id < USH_SYSSTAT_MAX_IDS; id++) {
|
||||
u64 id_total = cleonos_sys_stats_id_count(id);
|
||||
u64 id_recent = cleonos_sys_stats_recent_id(id);
|
||||
|
||||
if (show_all == 0 && id_total == 0ULL && id_recent == 0ULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
entries[entry_count].id = id;
|
||||
entries[entry_count].recent = id_recent;
|
||||
entries[entry_count].total = id_total;
|
||||
entries[entry_count].name = ush_sysstat_name_for_id(id);
|
||||
entry_count++;
|
||||
}
|
||||
|
||||
if (entry_count == 0ULL) {
|
||||
ush_writeln("(no syscall activity yet)");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (show_all == 0) {
|
||||
ush_sysstat_sort_recent(entries, entry_count);
|
||||
}
|
||||
|
||||
to_show = entry_count;
|
||||
if (show_all == 0 && to_show > limit) {
|
||||
to_show = limit;
|
||||
}
|
||||
|
||||
for (id = 0ULL; id < to_show; id++) {
|
||||
ush_write("ID=");
|
||||
ush_write_hex_u64(entries[id].id);
|
||||
ush_write(" RECENT=");
|
||||
ush_write_hex_u64(entries[id].recent);
|
||||
ush_write(" TOTAL=");
|
||||
ush_write_hex_u64(entries[id].total);
|
||||
ush_write(" NAME=");
|
||||
ush_writeln(entries[id].name);
|
||||
}
|
||||
|
||||
if (show_all == 0 && entry_count > to_show) {
|
||||
ush_write("... truncated, use ");
|
||||
ush_write("sysstat -a");
|
||||
ush_writeln(" to show all syscall IDs");
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
ush_cmd_ctx ctx;
|
||||
ush_cmd_ret ret;
|
||||
ush_state sh;
|
||||
char initial_cwd[USH_PATH_MAX];
|
||||
int has_context = 0;
|
||||
int success = 0;
|
||||
const char *arg = "";
|
||||
|
||||
ush_zero(&ctx, (u64)sizeof(ctx));
|
||||
ush_zero(&ret, (u64)sizeof(ret));
|
||||
ush_init_state(&sh);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
|
||||
if (ush_command_ctx_read(&ctx) != 0) {
|
||||
if (ctx.cmd[0] != '\0' && ush_streq(ctx.cmd, "sysstat") != 0) {
|
||||
has_context = 1;
|
||||
arg = ctx.arg;
|
||||
if (ctx.cwd[0] == '/') {
|
||||
ush_copy(sh.cwd, (u64)sizeof(sh.cwd), ctx.cwd);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
success = ush_cmd_sysstat(arg);
|
||||
|
||||
if (has_context != 0) {
|
||||
if (ush_streq(sh.cwd, initial_cwd) == 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_CWD;
|
||||
ush_copy(ret.cwd, (u64)sizeof(ret.cwd), sh.cwd);
|
||||
}
|
||||
|
||||
if (sh.exit_requested != 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_EXIT;
|
||||
ret.exit_code = sh.exit_code;
|
||||
}
|
||||
|
||||
(void)ush_command_ret_write(&ret);
|
||||
}
|
||||
|
||||
return (success != 0) ? 0 : 1;
|
||||
}
|
||||
244
cleonos/c/apps/tail_main.c
Normal file
244
cleonos/c/apps/tail_main.c
Normal file
@@ -0,0 +1,244 @@
|
||||
#include "cmd_runtime.h"
|
||||
#include <stdio.h>
|
||||
|
||||
static int ush_tail_parse_args(const char *arg, u64 *out_line_count, char *out_file, u64 out_file_size) {
|
||||
char first[USH_PATH_MAX];
|
||||
char second[USH_PATH_MAX];
|
||||
char third[USH_PATH_MAX];
|
||||
const char *rest = "";
|
||||
const char *rest2 = "";
|
||||
|
||||
if (out_line_count == (u64 *)0 || out_file == (char *)0 || out_file_size == 0ULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
*out_line_count = 10ULL;
|
||||
out_file[0] = '\0';
|
||||
|
||||
if (arg == (const char *)0 || arg[0] == '\0') {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (ush_split_first_and_rest(arg, first, (u64)sizeof(first), &rest) == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_streq(first, "-n") != 0) {
|
||||
if (ush_split_first_and_rest(rest, second, (u64)sizeof(second), &rest2) == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_parse_u64_dec(second, out_line_count) == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (rest2 != (const char *)0 && rest2[0] != '\0') {
|
||||
if (ush_split_first_and_rest(rest2, third, (u64)sizeof(third), &rest) == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (rest != (const char *)0 && rest[0] != '\0') {
|
||||
return 0;
|
||||
}
|
||||
|
||||
ush_copy(out_file, out_file_size, third);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (rest != (const char *)0 && rest[0] != '\0') {
|
||||
return 0;
|
||||
}
|
||||
|
||||
ush_copy(out_file, out_file_size, first);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int ush_tail_load_input(const ush_state *sh, const char *file_arg, const char **out_input, u64 *out_input_len) {
|
||||
static char file_buf[USH_COPY_MAX + 1U];
|
||||
char path[USH_PATH_MAX];
|
||||
u64 size;
|
||||
u64 got;
|
||||
|
||||
if (sh == (const ush_state *)0 || out_input == (const char **)0 || out_input_len == (u64 *)0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
*out_input = (const char *)0;
|
||||
*out_input_len = 0ULL;
|
||||
|
||||
if (file_arg != (const char *)0 && file_arg[0] != '\0') {
|
||||
if (ush_resolve_path(sh, file_arg, path, (u64)sizeof(path)) == 0) {
|
||||
(void)puts("tail: invalid path");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (cleonos_sys_fs_stat_type(path) != 1ULL) {
|
||||
(void)puts("tail: file not found");
|
||||
return 0;
|
||||
}
|
||||
|
||||
size = cleonos_sys_fs_stat_size(path);
|
||||
|
||||
if (size == (u64)-1) {
|
||||
(void)puts("tail: failed to stat file");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (size > (u64)USH_COPY_MAX) {
|
||||
(void)puts("tail: file too large for user buffer");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (size == 0ULL) {
|
||||
file_buf[0] = '\0';
|
||||
*out_input = file_buf;
|
||||
*out_input_len = 0ULL;
|
||||
return 1;
|
||||
}
|
||||
|
||||
got = cleonos_sys_fs_read(path, file_buf, size);
|
||||
|
||||
if (got == 0ULL || got != size) {
|
||||
(void)puts("tail: read failed");
|
||||
return 0;
|
||||
}
|
||||
|
||||
file_buf[got] = '\0';
|
||||
*out_input = file_buf;
|
||||
*out_input_len = got;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (ush_pipeline_stdin_text == (const char *)0) {
|
||||
(void)puts("tail: file path required (or pipeline input)");
|
||||
return 0;
|
||||
}
|
||||
|
||||
*out_input = ush_pipeline_stdin_text;
|
||||
*out_input_len = ush_pipeline_stdin_len;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static u64 ush_tail_count_lines(const char *input, u64 input_len) {
|
||||
u64 i;
|
||||
u64 lines = 0ULL;
|
||||
|
||||
if (input == (const char *)0 || input_len == 0ULL) {
|
||||
return 0ULL;
|
||||
}
|
||||
|
||||
lines = 1ULL;
|
||||
|
||||
for (i = 0ULL; i < input_len; i++) {
|
||||
if (input[i] == '\n' && i + 1ULL < input_len) {
|
||||
lines++;
|
||||
}
|
||||
}
|
||||
|
||||
return lines;
|
||||
}
|
||||
|
||||
static u64 ush_tail_find_start_offset(const char *input, u64 input_len, u64 skip_lines) {
|
||||
u64 i;
|
||||
u64 lines_seen = 0ULL;
|
||||
|
||||
if (input == (const char *)0 || input_len == 0ULL || skip_lines == 0ULL) {
|
||||
return 0ULL;
|
||||
}
|
||||
|
||||
for (i = 0ULL; i < input_len; i++) {
|
||||
if (input[i] == '\n' && i + 1ULL < input_len) {
|
||||
lines_seen++;
|
||||
if (lines_seen == skip_lines) {
|
||||
return i + 1ULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return input_len;
|
||||
}
|
||||
|
||||
static int ush_cmd_tail(const ush_state *sh, const char *arg) {
|
||||
char file_arg[USH_PATH_MAX];
|
||||
const char *input = (const char *)0;
|
||||
u64 input_len = 0ULL;
|
||||
u64 line_count;
|
||||
u64 total_lines;
|
||||
u64 skip_lines;
|
||||
u64 start_offset;
|
||||
u64 i;
|
||||
|
||||
if (sh == (const ush_state *)0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_tail_parse_args(arg, &line_count, file_arg, (u64)sizeof(file_arg)) == 0) {
|
||||
(void)puts("tail: usage tail [-n N] [file]");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_tail_load_input(sh, file_arg, &input, &input_len) == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (line_count == 0ULL || input_len == 0ULL) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
total_lines = ush_tail_count_lines(input, input_len);
|
||||
skip_lines = (total_lines > line_count) ? (total_lines - line_count) : 0ULL;
|
||||
start_offset = ush_tail_find_start_offset(input, input_len, skip_lines);
|
||||
|
||||
for (i = start_offset; i < input_len; i++) {
|
||||
(void)putchar((unsigned char)input[i]);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
ush_cmd_ctx ctx;
|
||||
ush_cmd_ret ret;
|
||||
ush_state sh;
|
||||
char initial_cwd[USH_PATH_MAX];
|
||||
int has_context = 0;
|
||||
int success = 0;
|
||||
const char *arg = "";
|
||||
|
||||
ush_zero(&ctx, (u64)sizeof(ctx));
|
||||
ush_zero(&ret, (u64)sizeof(ret));
|
||||
ush_init_state(&sh);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
|
||||
if (ush_command_ctx_read(&ctx) != 0) {
|
||||
if (ctx.cmd[0] != '\0' && ush_streq(ctx.cmd, "tail") != 0) {
|
||||
has_context = 1;
|
||||
arg = ctx.arg;
|
||||
if (ctx.cwd[0] == '/') {
|
||||
ush_copy(sh.cwd, (u64)sizeof(sh.cwd), ctx.cwd);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
success = ush_cmd_tail(&sh, arg);
|
||||
|
||||
if (has_context != 0) {
|
||||
if (ush_streq(sh.cwd, initial_cwd) == 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_CWD;
|
||||
ush_copy(ret.cwd, (u64)sizeof(ret.cwd), sh.cwd);
|
||||
}
|
||||
|
||||
if (sh.exit_requested != 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_EXIT;
|
||||
ret.exit_code = sh.exit_code;
|
||||
}
|
||||
|
||||
(void)ush_command_ret_write(&ret);
|
||||
}
|
||||
|
||||
return (success != 0) ? 0 : 1;
|
||||
}
|
||||
@@ -1,6 +1,53 @@
|
||||
#include "shell/shell_internal.h"
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
return ush_command_program_main("taskstat");
|
||||
#include "cmd_runtime.h"
|
||||
static int ush_cmd_taskstat(void) {
|
||||
ush_writeln("taskstat:");
|
||||
ush_print_kv_hex(" TASK_COUNT", cleonos_sys_task_count());
|
||||
ush_print_kv_hex(" CURRENT_TASK", cleonos_syscall(CLEONOS_SYSCALL_CUR_TASK, 0ULL, 0ULL, 0ULL));
|
||||
ush_print_kv_hex(" TIMER_TICKS", cleonos_sys_timer_ticks());
|
||||
ush_print_kv_hex(" CONTEXT_SWITCHES", cleonos_sys_context_switches());
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
ush_cmd_ctx ctx;
|
||||
ush_cmd_ret ret;
|
||||
ush_state sh;
|
||||
char initial_cwd[USH_PATH_MAX];
|
||||
int has_context = 0;
|
||||
int success = 0;
|
||||
|
||||
ush_zero(&ctx, (u64)sizeof(ctx));
|
||||
ush_zero(&ret, (u64)sizeof(ret));
|
||||
ush_init_state(&sh);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
|
||||
if (ush_command_ctx_read(&ctx) != 0) {
|
||||
if (ctx.cmd[0] != '\0' && ush_streq(ctx.cmd, "taskstat") != 0) {
|
||||
has_context = 1;
|
||||
if (ctx.cwd[0] == '/') {
|
||||
ush_copy(sh.cwd, (u64)sizeof(sh.cwd), ctx.cwd);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
success = ush_cmd_taskstat();
|
||||
|
||||
if (has_context != 0) {
|
||||
if (ush_streq(sh.cwd, initial_cwd) == 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_CWD;
|
||||
ush_copy(ret.cwd, (u64)sizeof(ret.cwd), sh.cwd);
|
||||
}
|
||||
|
||||
if (sh.exit_requested != 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_EXIT;
|
||||
ret.exit_code = sh.exit_code;
|
||||
}
|
||||
|
||||
(void)ush_command_ret_write(&ret);
|
||||
}
|
||||
|
||||
return (success != 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
|
||||
238
cleonos/c/apps/top_main.c
Normal file
238
cleonos/c/apps/top_main.c
Normal file
@@ -0,0 +1,238 @@
|
||||
#include "cmd_runtime.h"
|
||||
|
||||
static const char *ush_top_state_name(u64 state) {
|
||||
if (state == CLEONOS_PROC_STATE_PENDING) {
|
||||
return "PEND";
|
||||
}
|
||||
if (state == CLEONOS_PROC_STATE_RUNNING) {
|
||||
return "RUN ";
|
||||
}
|
||||
if (state == CLEONOS_PROC_STATE_STOPPED) {
|
||||
return "STOP";
|
||||
}
|
||||
if (state == CLEONOS_PROC_STATE_EXITED) {
|
||||
return "EXIT";
|
||||
}
|
||||
return "UNKN";
|
||||
}
|
||||
|
||||
static int ush_top_next_token(const char **io_cursor, char *out, u64 out_size) {
|
||||
const char *p;
|
||||
u64 n = 0ULL;
|
||||
|
||||
if (io_cursor == (const char **)0 || out == (char *)0 || out_size == 0ULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
out[0] = '\0';
|
||||
p = *io_cursor;
|
||||
|
||||
if (p == (const char *)0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (*p != '\0' && ush_is_space(*p) != 0) {
|
||||
p++;
|
||||
}
|
||||
|
||||
if (*p == '\0') {
|
||||
*io_cursor = p;
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (*p != '\0' && ush_is_space(*p) == 0) {
|
||||
if (n + 1ULL < out_size) {
|
||||
out[n++] = *p;
|
||||
}
|
||||
p++;
|
||||
}
|
||||
|
||||
out[n] = '\0';
|
||||
*io_cursor = p;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int ush_top_parse(const char *arg, u64 *out_loops, u64 *out_delay) {
|
||||
const char *cursor = arg;
|
||||
char token[USH_PATH_MAX];
|
||||
u64 loops = 0ULL;
|
||||
u64 delay = 5ULL;
|
||||
|
||||
if (out_loops == (u64 *)0 || out_delay == (u64 *)0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (ush_top_next_token(&cursor, token, (u64)sizeof(token)) != 0) {
|
||||
if (ush_streq(token, "--once") != 0) {
|
||||
loops = 1ULL;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ush_streq(token, "-n") != 0) {
|
||||
if (ush_top_next_token(&cursor, token, (u64)sizeof(token)) == 0 || ush_parse_u64_dec(token, &loops) == 0) {
|
||||
return 0;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ush_streq(token, "-d") != 0) {
|
||||
if (ush_top_next_token(&cursor, token, (u64)sizeof(token)) == 0 || ush_parse_u64_dec(token, &delay) == 0) {
|
||||
return 0;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
*out_loops = loops;
|
||||
*out_delay = delay;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void ush_top_render_frame(u64 frame_index, u64 delay_ticks) {
|
||||
u64 proc_count = cleonos_sys_proc_count();
|
||||
u64 i;
|
||||
u64 shown = 0ULL;
|
||||
|
||||
ush_write("\x1B[2J\x1B[H");
|
||||
ush_write("top frame=");
|
||||
ush_write_hex_u64(frame_index);
|
||||
ush_write(" ticks=");
|
||||
ush_write_hex_u64(cleonos_sys_timer_ticks());
|
||||
ush_write(" delay=");
|
||||
ush_write_hex_u64(delay_ticks);
|
||||
ush_write_char('\n');
|
||||
ush_writeln("PID ST TTY RTICKS MEM PATH");
|
||||
|
||||
for (i = 0ULL; i < proc_count; i++) {
|
||||
u64 pid = 0ULL;
|
||||
cleonos_proc_snapshot snap;
|
||||
|
||||
if (cleonos_sys_proc_pid_at(i, &pid) == 0ULL || pid == 0ULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (cleonos_sys_proc_snapshot(pid, &snap, (u64)sizeof(snap)) == 0ULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (snap.state != CLEONOS_PROC_STATE_PENDING &&
|
||||
snap.state != CLEONOS_PROC_STATE_RUNNING &&
|
||||
snap.state != CLEONOS_PROC_STATE_STOPPED) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ush_write_hex_u64(snap.pid);
|
||||
ush_write(" ");
|
||||
ush_write(ush_top_state_name(snap.state));
|
||||
ush_write(" ");
|
||||
ush_write_hex_u64(snap.tty_index);
|
||||
ush_write(" ");
|
||||
ush_write_hex_u64(snap.runtime_ticks);
|
||||
ush_write(" ");
|
||||
ush_write_hex_u64(snap.mem_bytes);
|
||||
ush_write(" ");
|
||||
ush_writeln(snap.path);
|
||||
shown++;
|
||||
}
|
||||
|
||||
if (shown == 0ULL) {
|
||||
ush_writeln("(no active process)");
|
||||
}
|
||||
|
||||
ush_writeln("");
|
||||
ush_writeln("press q to quit");
|
||||
}
|
||||
|
||||
static int ush_top_sleep_or_quit(u64 delay_ticks) {
|
||||
u64 i;
|
||||
char ch = '\0';
|
||||
|
||||
if (delay_ticks == 0ULL) {
|
||||
delay_ticks = 1ULL;
|
||||
}
|
||||
|
||||
for (i = 0ULL; i < delay_ticks; i++) {
|
||||
if (cleonos_sys_fd_read(0ULL, &ch, 1ULL) == 1ULL) {
|
||||
if (ch == 'q' || ch == 'Q') {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
(void)cleonos_sys_sleep_ticks(1ULL);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ush_cmd_top(const char *arg) {
|
||||
u64 loops;
|
||||
u64 delay_ticks;
|
||||
u64 frame = 0ULL;
|
||||
|
||||
if (ush_top_parse(arg, &loops, &delay_ticks) == 0) {
|
||||
ush_writeln("top: usage top [--once] [-n loops] [-d ticks]");
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
frame++;
|
||||
ush_top_render_frame(frame, delay_ticks);
|
||||
|
||||
if (loops != 0ULL && frame >= loops) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (ush_top_sleep_or_quit(delay_ticks) != 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ush_write("\x1B[0m");
|
||||
return 1;
|
||||
}
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
ush_cmd_ctx ctx;
|
||||
ush_cmd_ret ret;
|
||||
ush_state sh;
|
||||
char initial_cwd[USH_PATH_MAX];
|
||||
int has_context = 0;
|
||||
int success = 0;
|
||||
const char *arg = "";
|
||||
|
||||
ush_zero(&ctx, (u64)sizeof(ctx));
|
||||
ush_zero(&ret, (u64)sizeof(ret));
|
||||
ush_init_state(&sh);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
|
||||
if (ush_command_ctx_read(&ctx) != 0) {
|
||||
if (ctx.cmd[0] != '\0' && ush_streq(ctx.cmd, "top") != 0) {
|
||||
has_context = 1;
|
||||
arg = ctx.arg;
|
||||
if (ctx.cwd[0] == '/') {
|
||||
ush_copy(sh.cwd, (u64)sizeof(sh.cwd), ctx.cwd);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
success = ush_cmd_top(arg);
|
||||
|
||||
if (has_context != 0) {
|
||||
if (ush_streq(sh.cwd, initial_cwd) == 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_CWD;
|
||||
ush_copy(ret.cwd, (u64)sizeof(ret.cwd), sh.cwd);
|
||||
}
|
||||
|
||||
if (sh.exit_requested != 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_EXIT;
|
||||
ret.exit_code = sh.exit_code;
|
||||
}
|
||||
|
||||
(void)ush_command_ret_write(&ret);
|
||||
}
|
||||
|
||||
return (success != 0) ? 0 : 1;
|
||||
}
|
||||
@@ -1,6 +1,73 @@
|
||||
#include "shell/shell_internal.h"
|
||||
#include "cmd_runtime.h"
|
||||
static int ush_cmd_touch(const ush_state *sh, const char *arg) {
|
||||
static const char empty_data[1] = {'\0'};
|
||||
char path[USH_PATH_MAX];
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
return ush_command_program_main("touch");
|
||||
if (arg == (const char *)0 || arg[0] == '\0') {
|
||||
ush_writeln("touch: file path required");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_resolve_path(sh, arg, path, (u64)sizeof(path)) == 0) {
|
||||
ush_writeln("touch: invalid path");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_path_is_under_temp(path) == 0) {
|
||||
ush_writeln("touch: target must be under /temp");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (cleonos_sys_fs_write(path, empty_data, 0ULL) == 0ULL) {
|
||||
ush_writeln("touch: failed");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
ush_cmd_ctx ctx;
|
||||
ush_cmd_ret ret;
|
||||
ush_state sh;
|
||||
char initial_cwd[USH_PATH_MAX];
|
||||
int has_context = 0;
|
||||
int success = 0;
|
||||
const char *arg = "";
|
||||
|
||||
ush_zero(&ctx, (u64)sizeof(ctx));
|
||||
ush_zero(&ret, (u64)sizeof(ret));
|
||||
ush_init_state(&sh);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
|
||||
if (ush_command_ctx_read(&ctx) != 0) {
|
||||
if (ctx.cmd[0] != '\0' && ush_streq(ctx.cmd, "touch") != 0) {
|
||||
has_context = 1;
|
||||
arg = ctx.arg;
|
||||
if (ctx.cwd[0] == '/') {
|
||||
ush_copy(sh.cwd, (u64)sizeof(sh.cwd), ctx.cwd);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
success = ush_cmd_touch(&sh, arg);
|
||||
|
||||
if (has_context != 0) {
|
||||
if (ush_streq(sh.cwd, initial_cwd) == 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_CWD;
|
||||
ush_copy(ret.cwd, (u64)sizeof(ret.cwd), sh.cwd);
|
||||
}
|
||||
|
||||
if (sh.exit_requested != 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_EXIT;
|
||||
ret.exit_code = sh.exit_code;
|
||||
}
|
||||
|
||||
(void)ush_command_ret_write(&ret);
|
||||
}
|
||||
|
||||
return (success != 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,80 @@
|
||||
#include "shell/shell_internal.h"
|
||||
#include "cmd_runtime.h"
|
||||
static int ush_cmd_tty(const char *arg) {
|
||||
u64 tty_count = cleonos_sys_tty_count();
|
||||
u64 active = cleonos_sys_tty_active();
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
return ush_command_program_main("tty");
|
||||
if (arg == (const char *)0 || arg[0] == '\0') {
|
||||
ush_print_kv_hex("TTY_COUNT", tty_count);
|
||||
ush_print_kv_hex("TTY_ACTIVE", active);
|
||||
return 1;
|
||||
}
|
||||
|
||||
{
|
||||
u64 idx;
|
||||
|
||||
if (ush_parse_u64_dec(arg, &idx) == 0) {
|
||||
ush_writeln("tty: usage tty [index]");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (idx >= tty_count) {
|
||||
ush_writeln("tty: index out of range");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (cleonos_sys_tty_switch(idx) == (u64)-1) {
|
||||
ush_writeln("tty: switch failed");
|
||||
return 0;
|
||||
}
|
||||
|
||||
ush_writeln("tty: switched");
|
||||
ush_print_kv_hex("TTY_ACTIVE", cleonos_sys_tty_active());
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
ush_cmd_ctx ctx;
|
||||
ush_cmd_ret ret;
|
||||
ush_state sh;
|
||||
char initial_cwd[USH_PATH_MAX];
|
||||
int has_context = 0;
|
||||
int success = 0;
|
||||
const char *arg = "";
|
||||
|
||||
ush_zero(&ctx, (u64)sizeof(ctx));
|
||||
ush_zero(&ret, (u64)sizeof(ret));
|
||||
ush_init_state(&sh);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
|
||||
if (ush_command_ctx_read(&ctx) != 0) {
|
||||
if (ctx.cmd[0] != '\0' && ush_streq(ctx.cmd, "tty") != 0) {
|
||||
has_context = 1;
|
||||
arg = ctx.arg;
|
||||
if (ctx.cwd[0] == '/') {
|
||||
ush_copy(sh.cwd, (u64)sizeof(sh.cwd), ctx.cwd);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
success = ush_cmd_tty(arg);
|
||||
|
||||
if (has_context != 0) {
|
||||
if (ush_streq(sh.cwd, initial_cwd) == 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_CWD;
|
||||
ush_copy(ret.cwd, (u64)sizeof(ret.cwd), sh.cwd);
|
||||
}
|
||||
|
||||
if (sh.exit_requested != 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_EXIT;
|
||||
ret.exit_code = sh.exit_code;
|
||||
}
|
||||
|
||||
(void)ush_command_ret_write(&ret);
|
||||
}
|
||||
|
||||
return (success != 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
|
||||
215
cleonos/c/apps/uniq_main.c
Normal file
215
cleonos/c/apps/uniq_main.c
Normal file
@@ -0,0 +1,215 @@
|
||||
#include "cmd_runtime.h"
|
||||
|
||||
static int ush_uniq_parse_args(const char *arg, char *out_file, u64 out_file_size) {
|
||||
char first[USH_PATH_MAX];
|
||||
const char *rest = "";
|
||||
|
||||
if (out_file == (char *)0 || out_file_size == 0ULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
out_file[0] = '\0';
|
||||
|
||||
if (arg == (const char *)0 || arg[0] == '\0') {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (ush_split_first_and_rest(arg, first, (u64)sizeof(first), &rest) == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (rest != (const char *)0 && rest[0] != '\0') {
|
||||
return 0;
|
||||
}
|
||||
|
||||
ush_copy(out_file, out_file_size, first);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int ush_uniq_load_input(const ush_state *sh, const char *file_arg, const char **out_input, u64 *out_input_len) {
|
||||
static char file_buf[USH_COPY_MAX + 1U];
|
||||
char path[USH_PATH_MAX];
|
||||
u64 size;
|
||||
u64 got;
|
||||
|
||||
if (sh == (const ush_state *)0 || out_input == (const char **)0 || out_input_len == (u64 *)0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
*out_input = (const char *)0;
|
||||
*out_input_len = 0ULL;
|
||||
|
||||
if (file_arg != (const char *)0 && file_arg[0] != '\0') {
|
||||
if (ush_resolve_path(sh, file_arg, path, (u64)sizeof(path)) == 0) {
|
||||
ush_writeln("uniq: invalid path");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (cleonos_sys_fs_stat_type(path) != 1ULL) {
|
||||
ush_writeln("uniq: file not found");
|
||||
return 0;
|
||||
}
|
||||
|
||||
size = cleonos_sys_fs_stat_size(path);
|
||||
|
||||
if (size == (u64)-1) {
|
||||
ush_writeln("uniq: failed to stat file");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (size > (u64)USH_COPY_MAX) {
|
||||
ush_writeln("uniq: file too large for user buffer");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (size == 0ULL) {
|
||||
file_buf[0] = '\0';
|
||||
*out_input = file_buf;
|
||||
*out_input_len = 0ULL;
|
||||
return 1;
|
||||
}
|
||||
|
||||
got = cleonos_sys_fs_read(path, file_buf, size);
|
||||
|
||||
if (got == 0ULL || got != size) {
|
||||
ush_writeln("uniq: read failed");
|
||||
return 0;
|
||||
}
|
||||
|
||||
file_buf[got] = '\0';
|
||||
*out_input = file_buf;
|
||||
*out_input_len = got;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (ush_pipeline_stdin_text == (const char *)0) {
|
||||
ush_writeln("uniq: file path required (or pipeline input)");
|
||||
return 0;
|
||||
}
|
||||
|
||||
*out_input = ush_pipeline_stdin_text;
|
||||
*out_input_len = ush_pipeline_stdin_len;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int ush_uniq_line_equal(const char *left, u64 left_len, const char *right, u64 right_len) {
|
||||
u64 i;
|
||||
|
||||
if (left_len != right_len) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (i = 0ULL; i < left_len; i++) {
|
||||
if (left[i] != right[i]) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void ush_uniq_emit_line(const char *line, u64 line_len) {
|
||||
u64 i;
|
||||
|
||||
for (i = 0ULL; i < line_len; i++) {
|
||||
ush_write_char(line[i]);
|
||||
}
|
||||
|
||||
ush_write_char('\n');
|
||||
}
|
||||
|
||||
static int ush_cmd_uniq(const ush_state *sh, const char *arg) {
|
||||
char file_arg[USH_PATH_MAX];
|
||||
const char *input = (const char *)0;
|
||||
u64 input_len = 0ULL;
|
||||
const char *prev_line = (const char *)0;
|
||||
u64 prev_len = 0ULL;
|
||||
u64 start = 0ULL;
|
||||
u64 i;
|
||||
int first = 1;
|
||||
|
||||
if (sh == (const ush_state *)0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_uniq_parse_args(arg, file_arg, (u64)sizeof(file_arg)) == 0) {
|
||||
ush_writeln("uniq: usage uniq [file]");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_uniq_load_input(sh, file_arg, &input, &input_len) == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (i = 0ULL; i < input_len; i++) {
|
||||
if (input[i] == '\n') {
|
||||
u64 line_len = i - start;
|
||||
const char *line = &input[start];
|
||||
|
||||
if (first != 0 || ush_uniq_line_equal(prev_line, prev_len, line, line_len) == 0) {
|
||||
ush_uniq_emit_line(line, line_len);
|
||||
prev_line = line;
|
||||
prev_len = line_len;
|
||||
first = 0;
|
||||
}
|
||||
|
||||
start = i + 1ULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (start < input_len) {
|
||||
u64 line_len = input_len - start;
|
||||
const char *line = &input[start];
|
||||
|
||||
if (first != 0 || ush_uniq_line_equal(prev_line, prev_len, line, line_len) == 0) {
|
||||
ush_uniq_emit_line(line, line_len);
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
ush_cmd_ctx ctx;
|
||||
ush_cmd_ret ret;
|
||||
ush_state sh;
|
||||
char initial_cwd[USH_PATH_MAX];
|
||||
int has_context = 0;
|
||||
int success = 0;
|
||||
const char *arg = "";
|
||||
|
||||
ush_zero(&ctx, (u64)sizeof(ctx));
|
||||
ush_zero(&ret, (u64)sizeof(ret));
|
||||
ush_init_state(&sh);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
|
||||
if (ush_command_ctx_read(&ctx) != 0) {
|
||||
if (ctx.cmd[0] != '\0' && ush_streq(ctx.cmd, "uniq") != 0) {
|
||||
has_context = 1;
|
||||
arg = ctx.arg;
|
||||
if (ctx.cwd[0] == '/') {
|
||||
ush_copy(sh.cwd, (u64)sizeof(sh.cwd), ctx.cwd);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
success = ush_cmd_uniq(&sh, arg);
|
||||
|
||||
if (has_context != 0) {
|
||||
if (ush_streq(sh.cwd, initial_cwd) == 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_CWD;
|
||||
ush_copy(ret.cwd, (u64)sizeof(ret.cwd), sh.cwd);
|
||||
}
|
||||
|
||||
if (sh.exit_requested != 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_EXIT;
|
||||
ret.exit_code = sh.exit_code;
|
||||
}
|
||||
|
||||
(void)ush_command_ret_write(&ret);
|
||||
}
|
||||
|
||||
return (success != 0) ? 0 : 1;
|
||||
}
|
||||
@@ -1,6 +1,58 @@
|
||||
#include "shell/shell_internal.h"
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
return ush_command_program_main("userstat");
|
||||
#include "cmd_runtime.h"
|
||||
static int ush_cmd_userstat(void) {
|
||||
ush_writeln("userstat:");
|
||||
ush_print_kv_hex(" USER_SHELL_READY", cleonos_sys_user_shell_ready());
|
||||
ush_print_kv_hex(" USER_EXEC_REQUESTED", cleonos_sys_user_exec_requested());
|
||||
ush_print_kv_hex(" USER_LAUNCH_TRIES", cleonos_sys_user_launch_tries());
|
||||
ush_print_kv_hex(" USER_LAUNCH_OK", cleonos_sys_user_launch_ok());
|
||||
ush_print_kv_hex(" USER_LAUNCH_FAIL", cleonos_sys_user_launch_fail());
|
||||
ush_print_kv_hex(" EXEC_REQUESTS", cleonos_sys_exec_request_count());
|
||||
ush_print_kv_hex(" EXEC_SUCCESS", cleonos_sys_exec_success_count());
|
||||
ush_print_kv_hex(" TTY_COUNT", cleonos_sys_tty_count());
|
||||
ush_print_kv_hex(" TTY_ACTIVE", cleonos_sys_tty_active());
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
ush_cmd_ctx ctx;
|
||||
ush_cmd_ret ret;
|
||||
ush_state sh;
|
||||
char initial_cwd[USH_PATH_MAX];
|
||||
int has_context = 0;
|
||||
int success = 0;
|
||||
|
||||
ush_zero(&ctx, (u64)sizeof(ctx));
|
||||
ush_zero(&ret, (u64)sizeof(ret));
|
||||
ush_init_state(&sh);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
|
||||
if (ush_command_ctx_read(&ctx) != 0) {
|
||||
if (ctx.cmd[0] != '\0' && ush_streq(ctx.cmd, "userstat") != 0) {
|
||||
has_context = 1;
|
||||
if (ctx.cwd[0] == '/') {
|
||||
ush_copy(sh.cwd, (u64)sizeof(sh.cwd), ctx.cwd);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
success = ush_cmd_userstat();
|
||||
|
||||
if (has_context != 0) {
|
||||
if (ush_streq(sh.cwd, initial_cwd) == 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_CWD;
|
||||
ush_copy(ret.cwd, (u64)sizeof(ret.cwd), sh.cwd);
|
||||
}
|
||||
|
||||
if (sh.exit_requested != 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_EXIT;
|
||||
ret.exit_code = sh.exit_code;
|
||||
}
|
||||
|
||||
(void)ush_command_ret_write(&ret);
|
||||
}
|
||||
|
||||
return (success != 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,84 @@
|
||||
#include "shell/shell_internal.h"
|
||||
#include "cmd_runtime.h"
|
||||
static int ush_cmd_wait(const char *arg) {
|
||||
u64 pid;
|
||||
u64 status = (u64)-1;
|
||||
u64 wait_ret;
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
return ush_command_program_main("wait");
|
||||
if (arg == (const char *)0 || arg[0] == '\0') {
|
||||
ush_writeln("wait: usage wait <pid>");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_parse_u64_dec(arg, &pid) == 0) {
|
||||
ush_writeln("wait: invalid pid");
|
||||
return 0;
|
||||
}
|
||||
|
||||
wait_ret = cleonos_sys_wait_pid(pid, &status);
|
||||
|
||||
if (wait_ret == (u64)-1) {
|
||||
ush_writeln("wait: pid not found");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (wait_ret == 0ULL) {
|
||||
ush_writeln("wait: still running");
|
||||
return 1;
|
||||
}
|
||||
|
||||
ush_writeln("wait: exited");
|
||||
if ((status & (1ULL << 63)) != 0ULL) {
|
||||
ush_print_kv_hex(" SIGNAL", status & 0xFFULL);
|
||||
ush_print_kv_hex(" VECTOR", (status >> 8) & 0xFFULL);
|
||||
ush_print_kv_hex(" ERROR", (status >> 16) & 0xFFFFULL);
|
||||
} else {
|
||||
ush_print_kv_hex(" STATUS", status);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
ush_cmd_ctx ctx;
|
||||
ush_cmd_ret ret;
|
||||
ush_state sh;
|
||||
char initial_cwd[USH_PATH_MAX];
|
||||
int has_context = 0;
|
||||
int success = 0;
|
||||
const char *arg = "";
|
||||
|
||||
ush_zero(&ctx, (u64)sizeof(ctx));
|
||||
ush_zero(&ret, (u64)sizeof(ret));
|
||||
ush_init_state(&sh);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
|
||||
if (ush_command_ctx_read(&ctx) != 0) {
|
||||
if (ctx.cmd[0] != '\0' && ush_streq(ctx.cmd, "wait") != 0) {
|
||||
has_context = 1;
|
||||
arg = ctx.arg;
|
||||
if (ctx.cwd[0] == '/') {
|
||||
ush_copy(sh.cwd, (u64)sizeof(sh.cwd), ctx.cwd);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
success = ush_cmd_wait(arg);
|
||||
|
||||
if (has_context != 0) {
|
||||
if (ush_streq(sh.cwd, initial_cwd) == 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_CWD;
|
||||
ush_copy(ret.cwd, (u64)sizeof(ret.cwd), sh.cwd);
|
||||
}
|
||||
|
||||
if (sh.exit_requested != 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_EXIT;
|
||||
ret.exit_code = sh.exit_code;
|
||||
}
|
||||
|
||||
(void)ush_command_ret_write(&ret);
|
||||
}
|
||||
|
||||
return (success != 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
|
||||
564
cleonos/c/apps/wavplay_main.c
Normal file
564
cleonos/c/apps/wavplay_main.c
Normal file
@@ -0,0 +1,564 @@
|
||||
#include "cmd_runtime.h"
|
||||
|
||||
#define USH_WAVPLAY_DEFAULT_STEPS 256ULL
|
||||
#define USH_WAVPLAY_MAX_STEPS 4096ULL
|
||||
#define USH_WAVPLAY_DEFAULT_TICKS 1ULL
|
||||
#define USH_WAVPLAY_MAX_TICKS 64ULL
|
||||
#define USH_WAVPLAY_RUN_TICK_MAX 512ULL
|
||||
|
||||
typedef struct ush_wav_info {
|
||||
u64 data_size;
|
||||
u64 frame_count;
|
||||
u64 sample_rate;
|
||||
u64 channels;
|
||||
u64 bits_per_sample;
|
||||
u64 block_align;
|
||||
} ush_wav_info;
|
||||
|
||||
static unsigned int ush_wav_le16(const unsigned char *ptr) {
|
||||
return (unsigned int)ptr[0] | ((unsigned int)ptr[1] << 8U);
|
||||
}
|
||||
|
||||
static unsigned int ush_wav_le32(const unsigned char *ptr) {
|
||||
return (unsigned int)ptr[0] |
|
||||
((unsigned int)ptr[1] << 8U) |
|
||||
((unsigned int)ptr[2] << 16U) |
|
||||
((unsigned int)ptr[3] << 24U);
|
||||
}
|
||||
|
||||
static int ush_wav_tag_eq(const unsigned char *tag, const char *lit4) {
|
||||
if (tag == (const unsigned char *)0 || lit4 == (const char *)0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return (tag[0] == (unsigned char)lit4[0] &&
|
||||
tag[1] == (unsigned char)lit4[1] &&
|
||||
tag[2] == (unsigned char)lit4[2] &&
|
||||
tag[3] == (unsigned char)lit4[3])
|
||||
? 1
|
||||
: 0;
|
||||
}
|
||||
|
||||
static int ush_wav_read_exact(u64 fd, unsigned char *out, u64 size) {
|
||||
u64 done = 0ULL;
|
||||
|
||||
if (out == (unsigned char *)0 || size == 0ULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (done < size) {
|
||||
u64 got = cleonos_sys_fd_read(fd, out + done, size - done);
|
||||
|
||||
if (got == (u64)-1 || got == 0ULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
done += got;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int ush_wav_skip_bytes(u64 fd, u64 size) {
|
||||
unsigned char scratch[256];
|
||||
u64 remaining = size;
|
||||
|
||||
while (remaining > 0ULL) {
|
||||
u64 req = remaining;
|
||||
u64 got;
|
||||
|
||||
if (req > (u64)sizeof(scratch)) {
|
||||
req = (u64)sizeof(scratch);
|
||||
}
|
||||
|
||||
got = cleonos_sys_fd_read(fd, scratch, req);
|
||||
|
||||
if (got == (u64)-1 || got == 0ULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
remaining -= got;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void ush_wavplay_write_u64_dec(u64 value) {
|
||||
char rev[32];
|
||||
u64 len = 0ULL;
|
||||
|
||||
if (value == 0ULL) {
|
||||
ush_write_char('0');
|
||||
return;
|
||||
}
|
||||
|
||||
while (value > 0ULL && len < (u64)sizeof(rev)) {
|
||||
rev[len++] = (char)('0' + (value % 10ULL));
|
||||
value /= 10ULL;
|
||||
}
|
||||
|
||||
while (len > 0ULL) {
|
||||
len--;
|
||||
ush_write_char(rev[len]);
|
||||
}
|
||||
}
|
||||
|
||||
static void ush_wavplay_print_meta(const char *path, const ush_wav_info *info, u64 steps, u64 ticks) {
|
||||
ush_write("wavplay: ");
|
||||
ush_writeln(path);
|
||||
|
||||
ush_write(" sample_rate=");
|
||||
ush_wavplay_write_u64_dec(info->sample_rate);
|
||||
ush_write("Hz channels=");
|
||||
ush_wavplay_write_u64_dec(info->channels);
|
||||
ush_write(" bits=");
|
||||
ush_wavplay_write_u64_dec(info->bits_per_sample);
|
||||
ush_write(" frames=");
|
||||
ush_wavplay_write_u64_dec(info->frame_count);
|
||||
ush_write_char('\n');
|
||||
|
||||
ush_write(" play_steps=");
|
||||
ush_wavplay_write_u64_dec(steps);
|
||||
ush_write(" ticks_per_step=");
|
||||
ush_wavplay_write_u64_dec(ticks);
|
||||
ush_write_char('\n');
|
||||
}
|
||||
|
||||
static int ush_wav_parse_stream(u64 fd, ush_wav_info *out_info) {
|
||||
unsigned char riff_header[12];
|
||||
unsigned char chunk_header[8];
|
||||
unsigned char fmt_min[16];
|
||||
int found_fmt = 0;
|
||||
int found_data = 0;
|
||||
u64 sample_rate = 0ULL;
|
||||
u64 channels = 0ULL;
|
||||
u64 bits = 0ULL;
|
||||
u64 block_align = 0ULL;
|
||||
u64 data_size = 0ULL;
|
||||
|
||||
if (out_info == (ush_wav_info *)0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_wav_read_exact(fd, riff_header, (u64)sizeof(riff_header)) == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_wav_tag_eq(&riff_header[0], "RIFF") == 0 || ush_wav_tag_eq(&riff_header[8], "WAVE") == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (found_data == 0) {
|
||||
const unsigned char *chunk_tag;
|
||||
u64 chunk_size;
|
||||
|
||||
if (ush_wav_read_exact(fd, chunk_header, (u64)sizeof(chunk_header)) == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
chunk_tag = &chunk_header[0];
|
||||
chunk_size = (u64)ush_wav_le32(&chunk_header[4]);
|
||||
|
||||
if (ush_wav_tag_eq(chunk_tag, "fmt ") != 0) {
|
||||
if (chunk_size < 16ULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_wav_read_exact(fd, fmt_min, (u64)sizeof(fmt_min)) == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_wav_le16(&fmt_min[0]) != 1U) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
channels = (u64)ush_wav_le16(&fmt_min[2]);
|
||||
sample_rate = (u64)ush_wav_le32(&fmt_min[4]);
|
||||
block_align = (u64)ush_wav_le16(&fmt_min[12]);
|
||||
bits = (u64)ush_wav_le16(&fmt_min[14]);
|
||||
found_fmt = 1;
|
||||
|
||||
if (chunk_size > 16ULL) {
|
||||
if (ush_wav_skip_bytes(fd, chunk_size - 16ULL) == 0) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
} else if (ush_wav_tag_eq(chunk_tag, "data") != 0) {
|
||||
data_size = chunk_size;
|
||||
found_data = 1;
|
||||
} else {
|
||||
if (ush_wav_skip_bytes(fd, chunk_size) == 0) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if ((chunk_size & 1ULL) != 0ULL && found_data == 0) {
|
||||
if (ush_wav_skip_bytes(fd, 1ULL) == 0) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (found_fmt == 0 || found_data == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((channels != 1ULL && channels != 2ULL) || (bits != 8ULL && bits != 16ULL)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (sample_rate == 0ULL || block_align == 0ULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (data_size < block_align) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
out_info->data_size = data_size;
|
||||
out_info->sample_rate = sample_rate;
|
||||
out_info->channels = channels;
|
||||
out_info->bits_per_sample = bits;
|
||||
out_info->block_align = block_align;
|
||||
out_info->frame_count = data_size / block_align;
|
||||
|
||||
return (out_info->frame_count > 0ULL) ? 1 : 0;
|
||||
}
|
||||
|
||||
static u64 ush_wav_frame_deviation(const ush_wav_info *info, const unsigned char *frame) {
|
||||
if (info == (const ush_wav_info *)0 || frame == (const unsigned char *)0) {
|
||||
return 0ULL;
|
||||
}
|
||||
|
||||
if (info->bits_per_sample == 8ULL) {
|
||||
unsigned int left = (unsigned int)frame[0];
|
||||
unsigned int dev_left = (left >= 128U) ? (left - 128U) : (128U - left);
|
||||
|
||||
if (info->channels == 2ULL && info->block_align >= 2ULL) {
|
||||
unsigned int right = (unsigned int)frame[1];
|
||||
unsigned int dev_right = (right >= 128U) ? (right - 128U) : (128U - right);
|
||||
return (u64)((dev_left + dev_right) / 2U);
|
||||
}
|
||||
|
||||
return (u64)dev_left;
|
||||
}
|
||||
|
||||
if (info->bits_per_sample == 16ULL) {
|
||||
unsigned int raw_left;
|
||||
int sample_left;
|
||||
unsigned int dev_left;
|
||||
|
||||
if (info->block_align < 2ULL) {
|
||||
return 0ULL;
|
||||
}
|
||||
|
||||
raw_left = ush_wav_le16(frame);
|
||||
sample_left = (raw_left >= 32768U) ? ((int)raw_left - 65536) : (int)raw_left;
|
||||
if (sample_left < 0) {
|
||||
sample_left = -sample_left;
|
||||
}
|
||||
dev_left = (unsigned int)((unsigned int)sample_left >> 8U);
|
||||
|
||||
if (info->channels == 2ULL && info->block_align >= 4ULL) {
|
||||
unsigned int raw_right = ush_wav_le16(frame + 2ULL);
|
||||
int sample_right = (raw_right >= 32768U) ? ((int)raw_right - 65536) : (int)raw_right;
|
||||
unsigned int dev_right;
|
||||
|
||||
if (sample_right < 0) {
|
||||
sample_right = -sample_right;
|
||||
}
|
||||
|
||||
dev_right = (unsigned int)((unsigned int)sample_right >> 8U);
|
||||
return (u64)((dev_left + dev_right) / 2U);
|
||||
}
|
||||
|
||||
return (u64)dev_left;
|
||||
}
|
||||
|
||||
return 0ULL;
|
||||
}
|
||||
|
||||
static int ush_wavplay_parse_args(const char *arg,
|
||||
char *out_path,
|
||||
u64 out_path_size,
|
||||
u64 *out_steps,
|
||||
u64 *out_ticks,
|
||||
int *out_stop) {
|
||||
char first[USH_PATH_MAX];
|
||||
char second[32];
|
||||
char third[32];
|
||||
const char *rest = "";
|
||||
const char *rest2 = "";
|
||||
const char *rest3 = "";
|
||||
|
||||
if (out_path == (char *)0 || out_steps == (u64 *)0 || out_ticks == (u64 *)0 || out_stop == (int *)0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
*out_steps = USH_WAVPLAY_DEFAULT_STEPS;
|
||||
*out_ticks = USH_WAVPLAY_DEFAULT_TICKS;
|
||||
*out_stop = 0;
|
||||
out_path[0] = '\0';
|
||||
|
||||
if (arg == (const char *)0 || arg[0] == '\0') {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_split_first_and_rest(arg, first, (u64)sizeof(first), &rest) == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_streq(first, "--stop") != 0 || ush_streq(first, "stop") != 0) {
|
||||
if (rest != (const char *)0 && rest[0] != '\0') {
|
||||
return 0;
|
||||
}
|
||||
|
||||
*out_stop = 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
ush_copy(out_path, out_path_size, first);
|
||||
|
||||
if (rest != (const char *)0 && rest[0] != '\0') {
|
||||
if (ush_split_first_and_rest(rest, second, (u64)sizeof(second), &rest2) == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_parse_u64_dec(second, out_steps) == 0 || *out_steps == 0ULL || *out_steps > USH_WAVPLAY_MAX_STEPS) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (rest2 != (const char *)0 && rest2[0] != '\0') {
|
||||
if (ush_split_first_and_rest(rest2, third, (u64)sizeof(third), &rest3) == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_parse_u64_dec(third, out_ticks) == 0 || *out_ticks == 0ULL || *out_ticks > USH_WAVPLAY_MAX_TICKS) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (rest3 != (const char *)0 && rest3[0] != '\0') {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int ush_cmd_wavplay(const ush_state *sh, const char *arg) {
|
||||
char path_arg[USH_PATH_MAX];
|
||||
char abs_path[USH_PATH_MAX];
|
||||
unsigned char frame_buf[8];
|
||||
ush_wav_info info;
|
||||
u64 fd;
|
||||
u64 steps;
|
||||
u64 ticks_per_step;
|
||||
u64 stride;
|
||||
u64 current_frame = 0ULL;
|
||||
u64 i;
|
||||
u64 run_freq = 0ULL;
|
||||
u64 run_ticks = 0ULL;
|
||||
int stop_only;
|
||||
|
||||
if (sh == (const ush_state *)0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_wavplay_parse_args(arg, path_arg, (u64)sizeof(path_arg), &steps, &ticks_per_step, &stop_only) == 0) {
|
||||
ush_writeln("wavplay: usage wavplay <file.wav> [steps<=4096] [ticks<=64]");
|
||||
ush_writeln("wavplay: usage wavplay --stop");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (stop_only != 0) {
|
||||
(void)cleonos_sys_audio_stop();
|
||||
ush_writeln("wavplay: stopped");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (cleonos_sys_audio_available() == 0ULL) {
|
||||
ush_writeln("wavplay: audio device unavailable");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_resolve_path(sh, path_arg, abs_path, (u64)sizeof(abs_path)) == 0) {
|
||||
ush_writeln("wavplay: invalid path");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (cleonos_sys_fs_stat_type(abs_path) != 1ULL) {
|
||||
ush_writeln("wavplay: file not found");
|
||||
return 0;
|
||||
}
|
||||
|
||||
fd = cleonos_sys_fd_open(abs_path, CLEONOS_O_RDONLY, 0ULL);
|
||||
if (fd == (u64)-1) {
|
||||
ush_writeln("wavplay: open failed");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_wav_parse_stream(fd, &info) == 0) {
|
||||
(void)cleonos_sys_fd_close(fd);
|
||||
ush_writeln("wavplay: unsupported wav (need PCM 8/16-bit, mono/stereo)");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (info.block_align > (u64)sizeof(frame_buf)) {
|
||||
(void)cleonos_sys_fd_close(fd);
|
||||
ush_writeln("wavplay: unsupported block align");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (steps > info.frame_count) {
|
||||
steps = info.frame_count;
|
||||
}
|
||||
|
||||
if (steps == 0ULL) {
|
||||
(void)cleonos_sys_fd_close(fd);
|
||||
ush_writeln("wavplay: nothing to play");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (steps < 8ULL) {
|
||||
steps = 8ULL;
|
||||
|
||||
if (steps > info.frame_count) {
|
||||
steps = info.frame_count;
|
||||
}
|
||||
}
|
||||
|
||||
ush_wavplay_print_meta(abs_path, &info, steps, ticks_per_step);
|
||||
|
||||
stride = info.frame_count / steps;
|
||||
if (stride == 0ULL) {
|
||||
stride = 1ULL;
|
||||
}
|
||||
|
||||
for (i = 0ULL; i < steps; i++) {
|
||||
u64 frame_index = i * stride;
|
||||
u64 deviation;
|
||||
u64 freq;
|
||||
u64 skip_frames;
|
||||
|
||||
if (frame_index >= info.frame_count) {
|
||||
frame_index = info.frame_count - 1ULL;
|
||||
}
|
||||
|
||||
if (frame_index < current_frame) {
|
||||
(void)cleonos_sys_fd_close(fd);
|
||||
ush_writeln("wavplay: internal frame order error");
|
||||
return 0;
|
||||
}
|
||||
|
||||
skip_frames = frame_index - current_frame;
|
||||
if (skip_frames > 0ULL) {
|
||||
if (skip_frames > (0xFFFFFFFFFFFFFFFFULL / info.block_align)) {
|
||||
(void)cleonos_sys_fd_close(fd);
|
||||
ush_writeln("wavplay: frame skip overflow");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_wav_skip_bytes(fd, skip_frames * info.block_align) == 0) {
|
||||
(void)cleonos_sys_fd_close(fd);
|
||||
ush_writeln("wavplay: seek/read failed");
|
||||
return 0;
|
||||
}
|
||||
current_frame = frame_index;
|
||||
}
|
||||
|
||||
if (ush_wav_read_exact(fd, frame_buf, info.block_align) == 0) {
|
||||
(void)cleonos_sys_fd_close(fd);
|
||||
ush_writeln("wavplay: read failed");
|
||||
return 0;
|
||||
}
|
||||
current_frame++;
|
||||
|
||||
deviation = ush_wav_frame_deviation(&info, frame_buf);
|
||||
|
||||
if (deviation < 4ULL) {
|
||||
freq = 0ULL;
|
||||
} else {
|
||||
freq = 180ULL + (deviation * 12ULL);
|
||||
}
|
||||
|
||||
if (run_ticks == 0ULL) {
|
||||
run_freq = freq;
|
||||
run_ticks = ticks_per_step;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (freq == run_freq && (run_ticks + ticks_per_step) <= USH_WAVPLAY_RUN_TICK_MAX) {
|
||||
run_ticks += ticks_per_step;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (cleonos_sys_audio_play_tone(run_freq, run_ticks) == 0ULL) {
|
||||
(void)cleonos_sys_fd_close(fd);
|
||||
ush_writeln("wavplay: playback failed");
|
||||
(void)cleonos_sys_audio_stop();
|
||||
return 0;
|
||||
}
|
||||
|
||||
run_freq = freq;
|
||||
run_ticks = ticks_per_step;
|
||||
}
|
||||
|
||||
if (run_ticks > 0ULL) {
|
||||
if (cleonos_sys_audio_play_tone(run_freq, run_ticks) == 0ULL) {
|
||||
(void)cleonos_sys_fd_close(fd);
|
||||
ush_writeln("wavplay: playback failed");
|
||||
(void)cleonos_sys_audio_stop();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
(void)cleonos_sys_fd_close(fd);
|
||||
(void)cleonos_sys_audio_stop();
|
||||
ush_writeln("wavplay: done");
|
||||
return 1;
|
||||
}
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
ush_cmd_ctx ctx;
|
||||
ush_cmd_ret ret;
|
||||
ush_state sh;
|
||||
char initial_cwd[USH_PATH_MAX];
|
||||
int has_context = 0;
|
||||
int success = 0;
|
||||
const char *arg = "";
|
||||
|
||||
ush_zero(&ctx, (u64)sizeof(ctx));
|
||||
ush_zero(&ret, (u64)sizeof(ret));
|
||||
ush_init_state(&sh);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
|
||||
if (ush_command_ctx_read(&ctx) != 0) {
|
||||
if (ctx.cmd[0] != '\0' && ush_streq(ctx.cmd, "wavplay") != 0) {
|
||||
has_context = 1;
|
||||
arg = ctx.arg;
|
||||
if (ctx.cwd[0] == '/') {
|
||||
ush_copy(sh.cwd, (u64)sizeof(sh.cwd), ctx.cwd);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
success = ush_cmd_wavplay(&sh, arg);
|
||||
|
||||
if (has_context != 0) {
|
||||
if (ush_streq(sh.cwd, initial_cwd) == 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_CWD;
|
||||
ush_copy(ret.cwd, (u64)sizeof(ret.cwd), sh.cwd);
|
||||
}
|
||||
|
||||
if (sh.exit_requested != 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_EXIT;
|
||||
ret.exit_code = sh.exit_code;
|
||||
}
|
||||
|
||||
(void)ush_command_ret_write(&ret);
|
||||
}
|
||||
|
||||
return (success != 0) ? 0 : 1;
|
||||
}
|
||||
209
cleonos/c/apps/wc_main.c
Normal file
209
cleonos/c/apps/wc_main.c
Normal file
@@ -0,0 +1,209 @@
|
||||
#include "cmd_runtime.h"
|
||||
#include <stdio.h>
|
||||
|
||||
static void ush_wc_write_u64_dec(u64 value) {
|
||||
char tmp[32];
|
||||
u64 len = 0ULL;
|
||||
|
||||
if (value == 0ULL) {
|
||||
(void)putchar('0');
|
||||
return;
|
||||
}
|
||||
|
||||
while (value > 0ULL && len < (u64)sizeof(tmp)) {
|
||||
tmp[len++] = (char)('0' + (value % 10ULL));
|
||||
value /= 10ULL;
|
||||
}
|
||||
|
||||
while (len > 0ULL) {
|
||||
len--;
|
||||
(void)putchar((unsigned char)tmp[len]);
|
||||
}
|
||||
}
|
||||
|
||||
static int ush_wc_parse_args(const char *arg, char *out_file, u64 out_file_size) {
|
||||
char first[USH_PATH_MAX];
|
||||
const char *rest = "";
|
||||
|
||||
if (out_file == (char *)0 || out_file_size == 0ULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
out_file[0] = '\0';
|
||||
|
||||
if (arg == (const char *)0 || arg[0] == '\0') {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (ush_split_first_and_rest(arg, first, (u64)sizeof(first), &rest) == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (rest != (const char *)0 && rest[0] != '\0') {
|
||||
return 0;
|
||||
}
|
||||
|
||||
ush_copy(out_file, out_file_size, first);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int ush_wc_load_input(const ush_state *sh, const char *file_arg, const char **out_input, u64 *out_input_len) {
|
||||
static char file_buf[USH_COPY_MAX + 1U];
|
||||
char path[USH_PATH_MAX];
|
||||
u64 size;
|
||||
u64 got;
|
||||
|
||||
if (sh == (const ush_state *)0 || out_input == (const char **)0 || out_input_len == (u64 *)0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
*out_input = (const char *)0;
|
||||
*out_input_len = 0ULL;
|
||||
|
||||
if (file_arg != (const char *)0 && file_arg[0] != '\0') {
|
||||
if (ush_resolve_path(sh, file_arg, path, (u64)sizeof(path)) == 0) {
|
||||
(void)puts("wc: invalid path");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (cleonos_sys_fs_stat_type(path) != 1ULL) {
|
||||
(void)puts("wc: file not found");
|
||||
return 0;
|
||||
}
|
||||
|
||||
size = cleonos_sys_fs_stat_size(path);
|
||||
|
||||
if (size == (u64)-1) {
|
||||
(void)puts("wc: failed to stat file");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (size > (u64)USH_COPY_MAX) {
|
||||
(void)puts("wc: file too large for user buffer");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (size == 0ULL) {
|
||||
file_buf[0] = '\0';
|
||||
*out_input = file_buf;
|
||||
*out_input_len = 0ULL;
|
||||
return 1;
|
||||
}
|
||||
|
||||
got = cleonos_sys_fs_read(path, file_buf, size);
|
||||
|
||||
if (got == 0ULL || got != size) {
|
||||
(void)puts("wc: read failed");
|
||||
return 0;
|
||||
}
|
||||
|
||||
file_buf[got] = '\0';
|
||||
*out_input = file_buf;
|
||||
*out_input_len = got;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (ush_pipeline_stdin_text == (const char *)0) {
|
||||
(void)puts("wc: file path required (or pipeline input)");
|
||||
return 0;
|
||||
}
|
||||
|
||||
*out_input = ush_pipeline_stdin_text;
|
||||
*out_input_len = ush_pipeline_stdin_len;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int ush_cmd_wc(const ush_state *sh, const char *arg) {
|
||||
char file_arg[USH_PATH_MAX];
|
||||
const char *input = (const char *)0;
|
||||
u64 input_len = 0ULL;
|
||||
u64 bytes = 0ULL;
|
||||
u64 lines = 0ULL;
|
||||
u64 words = 0ULL;
|
||||
u64 i;
|
||||
int in_word = 0;
|
||||
|
||||
if (sh == (const ush_state *)0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_wc_parse_args(arg, file_arg, (u64)sizeof(file_arg)) == 0) {
|
||||
(void)puts("wc: usage wc [file]");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_wc_load_input(sh, file_arg, &input, &input_len) == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
bytes = input_len;
|
||||
|
||||
for (i = 0ULL; i < input_len; i++) {
|
||||
char ch = input[i];
|
||||
|
||||
if (ch == '\n') {
|
||||
lines++;
|
||||
}
|
||||
|
||||
if (ush_is_space(ch) != 0) {
|
||||
in_word = 0;
|
||||
} else if (in_word == 0) {
|
||||
words++;
|
||||
in_word = 1;
|
||||
}
|
||||
}
|
||||
|
||||
ush_wc_write_u64_dec(lines);
|
||||
(void)putchar(' ');
|
||||
ush_wc_write_u64_dec(words);
|
||||
(void)putchar(' ');
|
||||
ush_wc_write_u64_dec(bytes);
|
||||
(void)putchar('\n');
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
ush_cmd_ctx ctx;
|
||||
ush_cmd_ret ret;
|
||||
ush_state sh;
|
||||
char initial_cwd[USH_PATH_MAX];
|
||||
int has_context = 0;
|
||||
int success = 0;
|
||||
const char *arg = "";
|
||||
|
||||
ush_zero(&ctx, (u64)sizeof(ctx));
|
||||
ush_zero(&ret, (u64)sizeof(ret));
|
||||
ush_init_state(&sh);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
|
||||
if (ush_command_ctx_read(&ctx) != 0) {
|
||||
if (ctx.cmd[0] != '\0' && ush_streq(ctx.cmd, "wc") != 0) {
|
||||
has_context = 1;
|
||||
arg = ctx.arg;
|
||||
if (ctx.cwd[0] == '/') {
|
||||
ush_copy(sh.cwd, (u64)sizeof(sh.cwd), ctx.cwd);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
success = ush_cmd_wc(&sh, arg);
|
||||
|
||||
if (has_context != 0) {
|
||||
if (ush_streq(sh.cwd, initial_cwd) == 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_CWD;
|
||||
ush_copy(ret.cwd, (u64)sizeof(ret.cwd), sh.cwd);
|
||||
}
|
||||
|
||||
if (sh.exit_requested != 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_EXIT;
|
||||
ret.exit_code = sh.exit_code;
|
||||
}
|
||||
|
||||
(void)ush_command_ret_write(&ret);
|
||||
}
|
||||
|
||||
return (success != 0) ? 0 : 1;
|
||||
}
|
||||
@@ -1,6 +1,91 @@
|
||||
#include "shell/shell_internal.h"
|
||||
#include "cmd_runtime.h"
|
||||
static int ush_cmd_write(const ush_state *sh, const char *arg) {
|
||||
char path_arg[USH_PATH_MAX];
|
||||
char abs_path[USH_PATH_MAX];
|
||||
const char *payload = (const char *)0;
|
||||
u64 payload_len;
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
return ush_command_program_main("write");
|
||||
if (arg == (const char *)0 || arg[0] == '\0') {
|
||||
ush_writeln("write: usage write <file> <text>");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_split_first_and_rest(arg, path_arg, (u64)sizeof(path_arg), &payload) == 0) {
|
||||
ush_writeln("write: usage write <file> <text>");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_resolve_path(sh, path_arg, abs_path, (u64)sizeof(abs_path)) == 0) {
|
||||
ush_writeln("write: invalid path");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ush_path_is_under_temp(abs_path) == 0) {
|
||||
ush_writeln("write: target must be under /temp");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (payload == (const char *)0 || payload[0] == '\0') {
|
||||
if (ush_pipeline_stdin_text == (const char *)0) {
|
||||
ush_writeln("write: usage write <file> <text>");
|
||||
return 0;
|
||||
}
|
||||
payload = ush_pipeline_stdin_text;
|
||||
payload_len = ush_pipeline_stdin_len;
|
||||
} else {
|
||||
payload_len = ush_strlen(payload);
|
||||
}
|
||||
|
||||
if (cleonos_sys_fs_write(abs_path, payload, payload_len) == 0ULL) {
|
||||
ush_writeln("write: failed");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
ush_cmd_ctx ctx;
|
||||
ush_cmd_ret ret;
|
||||
ush_state sh;
|
||||
char initial_cwd[USH_PATH_MAX];
|
||||
int has_context = 0;
|
||||
int success = 0;
|
||||
const char *arg = "";
|
||||
|
||||
ush_zero(&ctx, (u64)sizeof(ctx));
|
||||
ush_zero(&ret, (u64)sizeof(ret));
|
||||
ush_init_state(&sh);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
|
||||
if (ush_command_ctx_read(&ctx) != 0) {
|
||||
if (ctx.cmd[0] != '\0' && ush_streq(ctx.cmd, "write") != 0) {
|
||||
has_context = 1;
|
||||
arg = ctx.arg;
|
||||
if (ctx.cwd[0] == '/') {
|
||||
ush_copy(sh.cwd, (u64)sizeof(sh.cwd), ctx.cwd);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
success = ush_cmd_write(&sh, arg);
|
||||
|
||||
if (has_context != 0) {
|
||||
if (ush_streq(sh.cwd, initial_cwd) == 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_CWD;
|
||||
ush_copy(ret.cwd, (u64)sizeof(ret.cwd), sh.cwd);
|
||||
}
|
||||
|
||||
if (sh.exit_requested != 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_EXIT;
|
||||
ret.exit_code = sh.exit_code;
|
||||
}
|
||||
|
||||
(void)ush_command_ret_write(&ret);
|
||||
}
|
||||
|
||||
return (success != 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,49 @@
|
||||
#include "shell/shell_internal.h"
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
return ush_command_program_main("yield");
|
||||
#include "cmd_runtime.h"
|
||||
static int ush_cmd_yield(void) {
|
||||
ush_print_kv_hex("YIELD_TICK", cleonos_sys_yield());
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
ush_cmd_ctx ctx;
|
||||
ush_cmd_ret ret;
|
||||
ush_state sh;
|
||||
char initial_cwd[USH_PATH_MAX];
|
||||
int has_context = 0;
|
||||
int success = 0;
|
||||
|
||||
ush_zero(&ctx, (u64)sizeof(ctx));
|
||||
ush_zero(&ret, (u64)sizeof(ret));
|
||||
ush_init_state(&sh);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
|
||||
if (ush_command_ctx_read(&ctx) != 0) {
|
||||
if (ctx.cmd[0] != '\0' && ush_streq(ctx.cmd, "yield") != 0) {
|
||||
has_context = 1;
|
||||
if (ctx.cwd[0] == '/') {
|
||||
ush_copy(sh.cwd, (u64)sizeof(sh.cwd), ctx.cwd);
|
||||
ush_copy(initial_cwd, (u64)sizeof(initial_cwd), sh.cwd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
success = ush_cmd_yield();
|
||||
|
||||
if (has_context != 0) {
|
||||
if (ush_streq(sh.cwd, initial_cwd) == 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_CWD;
|
||||
ush_copy(ret.cwd, (u64)sizeof(ret.cwd), sh.cwd);
|
||||
}
|
||||
|
||||
if (sh.exit_requested != 0) {
|
||||
ret.flags |= USH_CMD_RET_FLAG_EXIT;
|
||||
ret.exit_code = sh.exit_code;
|
||||
}
|
||||
|
||||
(void)ush_command_ret_write(&ret);
|
||||
}
|
||||
|
||||
return (success != 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
|
||||
6
cleonos/c/include/cleonos_stdio.h
Normal file
6
cleonos/c/include/cleonos_stdio.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#ifndef CLEONOS_STDIO_H
|
||||
#define CLEONOS_STDIO_H
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#endif
|
||||
@@ -5,6 +5,43 @@ typedef unsigned long long u64;
|
||||
typedef unsigned long long usize;
|
||||
|
||||
#define CLEONOS_FS_NAME_MAX 96ULL
|
||||
#define CLEONOS_PROC_PATH_MAX 192ULL
|
||||
|
||||
#define CLEONOS_PROC_STATE_UNUSED 0ULL
|
||||
#define CLEONOS_PROC_STATE_PENDING 1ULL
|
||||
#define CLEONOS_PROC_STATE_RUNNING 2ULL
|
||||
#define CLEONOS_PROC_STATE_EXITED 3ULL
|
||||
#define CLEONOS_PROC_STATE_STOPPED 4ULL
|
||||
|
||||
#define CLEONOS_SIGKILL 9ULL
|
||||
#define CLEONOS_SIGTERM 15ULL
|
||||
#define CLEONOS_SIGCONT 18ULL
|
||||
#define CLEONOS_SIGSTOP 19ULL
|
||||
|
||||
#define CLEONOS_O_RDONLY 0x0000ULL
|
||||
#define CLEONOS_O_WRONLY 0x0001ULL
|
||||
#define CLEONOS_O_RDWR 0x0002ULL
|
||||
#define CLEONOS_O_CREAT 0x0040ULL
|
||||
#define CLEONOS_O_TRUNC 0x0200ULL
|
||||
#define CLEONOS_O_APPEND 0x0400ULL
|
||||
#define CLEONOS_FD_INHERIT ((u64)-1)
|
||||
|
||||
typedef struct cleonos_proc_snapshot {
|
||||
u64 pid;
|
||||
u64 ppid;
|
||||
u64 state;
|
||||
u64 started_tick;
|
||||
u64 exited_tick;
|
||||
u64 exit_status;
|
||||
u64 runtime_ticks;
|
||||
u64 mem_bytes;
|
||||
u64 tty_index;
|
||||
u64 last_signal;
|
||||
u64 last_fault_vector;
|
||||
u64 last_fault_error;
|
||||
u64 last_fault_rip;
|
||||
char path[CLEONOS_PROC_PATH_MAX];
|
||||
} cleonos_proc_snapshot;
|
||||
|
||||
#define CLEONOS_SYSCALL_LOG_WRITE 0ULL
|
||||
#define CLEONOS_SYSCALL_TIMER_TICKS 1ULL
|
||||
@@ -54,6 +91,39 @@ typedef unsigned long long usize;
|
||||
#define CLEONOS_SYSCALL_YIELD 45ULL
|
||||
#define CLEONOS_SYSCALL_SHUTDOWN 46ULL
|
||||
#define CLEONOS_SYSCALL_RESTART 47ULL
|
||||
#define CLEONOS_SYSCALL_AUDIO_AVAILABLE 48ULL
|
||||
#define CLEONOS_SYSCALL_AUDIO_PLAY_TONE 49ULL
|
||||
#define CLEONOS_SYSCALL_AUDIO_STOP 50ULL
|
||||
#define CLEONOS_SYSCALL_EXEC_PATHV 51ULL
|
||||
#define CLEONOS_SYSCALL_SPAWN_PATHV 52ULL
|
||||
#define CLEONOS_SYSCALL_PROC_ARGC 53ULL
|
||||
#define CLEONOS_SYSCALL_PROC_ARGV 54ULL
|
||||
#define CLEONOS_SYSCALL_PROC_ENVC 55ULL
|
||||
#define CLEONOS_SYSCALL_PROC_ENV 56ULL
|
||||
#define CLEONOS_SYSCALL_PROC_LAST_SIGNAL 57ULL
|
||||
#define CLEONOS_SYSCALL_PROC_FAULT_VECTOR 58ULL
|
||||
#define CLEONOS_SYSCALL_PROC_FAULT_ERROR 59ULL
|
||||
#define CLEONOS_SYSCALL_PROC_FAULT_RIP 60ULL
|
||||
#define CLEONOS_SYSCALL_PROC_COUNT 61ULL
|
||||
#define CLEONOS_SYSCALL_PROC_PID_AT 62ULL
|
||||
#define CLEONOS_SYSCALL_PROC_SNAPSHOT 63ULL
|
||||
#define CLEONOS_SYSCALL_PROC_KILL 64ULL
|
||||
#define CLEONOS_SYSCALL_KDBG_SYM 65ULL
|
||||
#define CLEONOS_SYSCALL_KDBG_BT 66ULL
|
||||
#define CLEONOS_SYSCALL_KDBG_REGS 67ULL
|
||||
#define CLEONOS_SYSCALL_STATS_TOTAL 68ULL
|
||||
#define CLEONOS_SYSCALL_STATS_ID_COUNT 69ULL
|
||||
#define CLEONOS_SYSCALL_STATS_RECENT_WINDOW 70ULL
|
||||
#define CLEONOS_SYSCALL_STATS_RECENT_ID 71ULL
|
||||
#define CLEONOS_SYSCALL_FD_OPEN 72ULL
|
||||
#define CLEONOS_SYSCALL_FD_READ 73ULL
|
||||
#define CLEONOS_SYSCALL_FD_WRITE 74ULL
|
||||
#define CLEONOS_SYSCALL_FD_CLOSE 75ULL
|
||||
#define CLEONOS_SYSCALL_FD_DUP 76ULL
|
||||
#define CLEONOS_SYSCALL_DL_OPEN 77ULL
|
||||
#define CLEONOS_SYSCALL_DL_CLOSE 78ULL
|
||||
#define CLEONOS_SYSCALL_DL_SYM 79ULL
|
||||
#define CLEONOS_SYSCALL_EXEC_PATHV_IO 80ULL
|
||||
|
||||
u64 cleonos_syscall(u64 id, u64 arg0, u64 arg1, u64 arg2);
|
||||
u64 cleonos_sys_log_write(const char *message, u64 length);
|
||||
@@ -69,6 +139,13 @@ u64 cleonos_sys_fs_child_count(const char *dir_path);
|
||||
u64 cleonos_sys_fs_get_child_name(const char *dir_path, u64 index, char *out_name);
|
||||
u64 cleonos_sys_fs_read(const char *path, char *out_buffer, u64 buffer_size);
|
||||
u64 cleonos_sys_exec_path(const char *path);
|
||||
u64 cleonos_sys_exec_pathv(const char *path, const char *argv_line, const char *env_line);
|
||||
u64 cleonos_sys_exec_pathv_io(const char *path,
|
||||
const char *argv_line,
|
||||
const char *env_line,
|
||||
u64 stdin_fd,
|
||||
u64 stdout_fd,
|
||||
u64 stderr_fd);
|
||||
u64 cleonos_sys_exec_request_count(void);
|
||||
u64 cleonos_sys_exec_success_count(void);
|
||||
u64 cleonos_sys_user_shell_ready(void);
|
||||
@@ -97,11 +174,42 @@ u64 cleonos_sys_kbd_dropped(void);
|
||||
u64 cleonos_sys_kbd_hotkey_switches(void);
|
||||
u64 cleonos_sys_getpid(void);
|
||||
u64 cleonos_sys_spawn_path(const char *path);
|
||||
u64 cleonos_sys_spawn_pathv(const char *path, const char *argv_line, const char *env_line);
|
||||
u64 cleonos_sys_wait_pid(u64 pid, u64 *out_status);
|
||||
u64 cleonos_sys_exit(u64 status);
|
||||
u64 cleonos_sys_sleep_ticks(u64 ticks);
|
||||
u64 cleonos_sys_yield(void);
|
||||
u64 cleonos_sys_shutdown(void);
|
||||
u64 cleonos_sys_restart(void);
|
||||
u64 cleonos_sys_audio_available(void);
|
||||
u64 cleonos_sys_audio_play_tone(u64 hz, u64 ticks);
|
||||
u64 cleonos_sys_audio_stop(void);
|
||||
u64 cleonos_sys_proc_argc(void);
|
||||
u64 cleonos_sys_proc_argv(u64 index, char *out_value, u64 out_size);
|
||||
u64 cleonos_sys_proc_envc(void);
|
||||
u64 cleonos_sys_proc_env(u64 index, char *out_value, u64 out_size);
|
||||
u64 cleonos_sys_proc_last_signal(void);
|
||||
u64 cleonos_sys_proc_fault_vector(void);
|
||||
u64 cleonos_sys_proc_fault_error(void);
|
||||
u64 cleonos_sys_proc_fault_rip(void);
|
||||
u64 cleonos_sys_proc_count(void);
|
||||
u64 cleonos_sys_proc_pid_at(u64 index, u64 *out_pid);
|
||||
u64 cleonos_sys_proc_snapshot(u64 pid, cleonos_proc_snapshot *out_snapshot, u64 out_size);
|
||||
u64 cleonos_sys_proc_kill(u64 pid, u64 signal);
|
||||
u64 cleonos_sys_kdbg_sym(u64 addr, char *out_line, u64 out_size);
|
||||
u64 cleonos_sys_kdbg_bt(u64 rbp, u64 rip, char *out_text, u64 out_size);
|
||||
u64 cleonos_sys_kdbg_regs(char *out_text, u64 out_size);
|
||||
u64 cleonos_sys_stats_total(void);
|
||||
u64 cleonos_sys_stats_id_count(u64 id);
|
||||
u64 cleonos_sys_stats_recent_window(void);
|
||||
u64 cleonos_sys_stats_recent_id(u64 id);
|
||||
u64 cleonos_sys_fd_open(const char *path, u64 flags, u64 mode);
|
||||
u64 cleonos_sys_fd_read(u64 fd, void *out_buffer, u64 size);
|
||||
u64 cleonos_sys_fd_write(u64 fd, const void *buffer, u64 size);
|
||||
u64 cleonos_sys_fd_close(u64 fd);
|
||||
u64 cleonos_sys_fd_dup(u64 fd);
|
||||
u64 cleonos_sys_dl_open(const char *path);
|
||||
u64 cleonos_sys_dl_close(u64 handle);
|
||||
u64 cleonos_sys_dl_sym(u64 handle, const char *symbol);
|
||||
|
||||
#endif
|
||||
|
||||
16
cleonos/c/include/ctype.h
Normal file
16
cleonos/c/include/ctype.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#ifndef CLEONOS_LIBC_CTYPE_H
|
||||
#define CLEONOS_LIBC_CTYPE_H
|
||||
|
||||
int isspace(int ch);
|
||||
int isdigit(int ch);
|
||||
int isalpha(int ch);
|
||||
int isalnum(int ch);
|
||||
int isxdigit(int ch);
|
||||
int isupper(int ch);
|
||||
int islower(int ch);
|
||||
int isprint(int ch);
|
||||
int iscntrl(int ch);
|
||||
int tolower(int ch);
|
||||
int toupper(int ch);
|
||||
|
||||
#endif
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user