Skip to content

Commit

Permalink
kthd: ipc performance improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
jewelcodes committed Nov 30, 2024
1 parent b820bdf commit 28e1a2a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions kthd/src/chdir.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ void kthdChdir(ChdirCommand *cmd) {
struct stat st;
if(stat(cmd->path, &st)) {
cmd->header.header.status = -1*errno;
luxSendLumen(cmd);
luxSendKernel(cmd);
return;
}

if((st.st_mode & S_IFMT) != S_IFDIR) {
cmd->header.header.status = -ENOTDIR;
luxSendLumen(cmd);
luxSendKernel(cmd);
return;
}

Expand All @@ -89,5 +89,5 @@ void kthdChdir(ChdirCommand *cmd) {

// success, clean up the path
clean(cmd->path);
luxSendLumen(cmd);
luxSendKernel(cmd);
}
12 changes: 6 additions & 6 deletions kthd/src/exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ void kthdExec(ExecCommand *cmd) {
int fd = open(cmd->path, O_RDONLY);
if(fd < 0) {
cmd->header.header.status = -ENOENT;
luxSendLumen(cmd);
luxSendKernel(cmd);
return;
}

Expand All @@ -30,7 +30,7 @@ void kthdExec(ExecCommand *cmd) {
if(fstat(fd, &st)) {
close(fd);
cmd->header.header.status = -1*errno;
luxSendLumen(cmd);
luxSendKernel(cmd);
return;
}

Expand All @@ -45,7 +45,7 @@ void kthdExec(ExecCommand *cmd) {

if(cmd->header.header.status) {
close(fd);
luxSendLumen(cmd);
luxSendKernel(cmd);
return;
}

Expand All @@ -56,7 +56,7 @@ void kthdExec(ExecCommand *cmd) {
if(!res) {
close(fd);
cmd->header.header.status = -ENOMEM;
luxSendLumen(cmd);
luxSendKernel(cmd);
return;
}

Expand All @@ -66,13 +66,13 @@ void kthdExec(ExecCommand *cmd) {
close(fd);
free(res);
cmd->header.header.status = -1*errno;
luxSendLumen(cmd);
luxSendKernel(cmd);
return;
}

// and relay the response
res->header.header.length += st.st_size;
res->header.header.status = 0;
luxSendLumen(res);
luxSendKernel(res);
free(res);
}

0 comments on commit 28e1a2a

Please sign in to comment.