git://scm.lunaixsky.com
/
lunaix-os.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
feat: refine symbolic link support.
[lunaix-os.git]
/
lunaix-os
/
kernel
/
loader
/
exec.c
diff --git
a/lunaix-os/kernel/loader/exec.c
b/lunaix-os/kernel/loader/exec.c
index 0105753a614492e74baa58b12b75d4904b9ac598..6a18ffca11d91bdbeec592bd7b84689266473f11 100644
(file)
--- a/
lunaix-os/kernel/loader/exec.c
+++ b/
lunaix-os/kernel/loader/exec.c
@@
-7,6
+7,7
@@
#include <lunaix/spike.h>
#include <lunaix/status.h>
#include <lunaix/syscall.h>
#include <lunaix/spike.h>
#include <lunaix/status.h>
#include <lunaix/syscall.h>
+#include <lunaix/syscall_utils.h>
#include <klibc/string.h>
#include <klibc/string.h>
@@
-25,11
+26,11
@@
exec_str_size(const char** str_arr, size_t* length)
sz += strlen(chr);
len++;
sz += strlen(chr);
len++;
- chr = *(str_arr
+ sz
);
+ chr = *(str_arr
++
);
}
*length = len;
}
*length = len;
- return sz +
1
;
+ return sz +
sizeof(char*)
;
}
void
}
void
@@
-50,7
+51,7
@@
__exec_remap_heap(struct ld_param* param, struct proc_mm* pvms)
.flags = MAP_ANON | MAP_PRIVATE,
.type = REGION_TYPE_HEAP,
.proct = PROT_READ | PROT_WRITE,
.flags = MAP_ANON | MAP_PRIVATE,
.type = REGION_TYPE_HEAP,
.proct = PROT_READ | PROT_WRITE,
- .mlen =
DEFAULT_HEAP_PAGES *
PG_SIZE };
+ .mlen = PG_SIZE };
int status = 0;
struct mm_region* heap;
if ((status = mem_map(NULL, &heap, param->info.end, NULL, &map_param))) {
int status = 0;
struct mm_region* heap;
if ((status = mem_map(NULL, &heap, param->info.end, NULL, &map_param))) {
@@
-115,7
+116,7
@@
exec_load(struct ld_param* param,
memcpy(arg_start + sz_argv, (void*)envp, sz_envp);
ptr_t* ustack = (ptr_t*)USTACK_TOP;
memcpy(arg_start + sz_argv, (void*)envp, sz_envp);
ptr_t* ustack = (ptr_t*)USTACK_TOP;
- struct usr_exec_param* exec_param = mapped;
+ struct usr_exec_param* exec_param =
(struct usr_exec_param*)
mapped;
ustack[-1] = (ptr_t)mapped;
param->info.stack_top = &ustack[-1];
ustack[-1] = (ptr_t)mapped;
param->info.stack_top = &ustack[-1];
@@
-127,6
+128,8
@@
exec_load(struct ld_param* param,
.info = param->info };
} else {
// TODO need to find a way to inject argv and envp remotely
.info = param->info };
} else {
// TODO need to find a way to inject argv and envp remotely
+ // this is for the support of kernel level implementation of
+ // posix_spawn
fail("not implemented");
}
fail("not implemented");
}
@@
-192,5
+195,5
@@
__DEFINE_LXSYSCALL3(int,
// return so execve 'will not return' from the perspective of it's invoker
done:
// return so execve 'will not return' from the perspective of it's invoker
done:
- return
errno
;
+ return
DO_STATUS(errno)
;
}
\ No newline at end of file
}
\ No newline at end of file