added some useless shell commands

This commit is contained in:
2026-07-12 04:37:46 -05:00
parent 3c6fd8cb65
commit d60036a4bd
13 changed files with 96 additions and 7 deletions

View File

@@ -196,6 +196,15 @@ static int32_t sys_dup2(int src, int dst) {
return dst;
}
static int32_t sys_lseek(int fd, size_t offset, int whence) {
if (fd < 0) return 0;
process_t* task = current_task();
file_t* file = task->fd_table[fd];
if (!file) return 0;
file->node->seek(file->node, offset, whence);
return 1;
}
void syscall(registers_t* regs) {
int32_t ret;
switch(regs->eax) {
@@ -209,6 +218,7 @@ void syscall(registers_t* regs) {
case 21: ret = sys_fork(regs); break;
case 22: ret = sys_exec(regs, (const char*)regs->ebx); break;
case 23: ret = sys_dup2(regs->ebx, regs->ecx); break;
case 24: ret = sys_lseek(regs->ebx, regs->ecx, regs->edx); break;
default: ret = -1;
}
regs->eax = ret;