Rework requesting process arguments
This commit is contained in:
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
#define PROC_NAME_MAX 0x100
|
#define PROC_NAME_MAX 0x100
|
||||||
|
|
||||||
#define PROC_STACKBLOCKS (1024*4)
|
#define PROC_STACKBLOCKS (1024*2)
|
||||||
#define PROC_STACKSIZE (PROC_STACKBLOCKS * BITMAP_BLOCK_SIZE)
|
#define PROC_STACKSIZE (PROC_STACKBLOCKS * BITMAP_BLOCK_SIZE)
|
||||||
|
|
||||||
#define PROC_MAX 0x100 // max amount of processes
|
#define PROC_MAX 0x100 // max amount of processes
|
||||||
@ -19,7 +19,7 @@
|
|||||||
#define PROC_VFSHANDLES_MAX 0x80
|
#define PROC_VFSHANDLES_MAX 0x80
|
||||||
#define PROC_PIPEHANDLES_MAX 0x20
|
#define PROC_PIPEHANDLES_MAX 0x20
|
||||||
|
|
||||||
#define PROC_MMAN_MAP_BASE 0x700000000000
|
#define PROC_MMAN_MAP_BASE 0x500000000000
|
||||||
#define PROC_USER_STACK_TOP 0x800000000000
|
#define PROC_USER_STACK_TOP 0x800000000000
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -91,21 +91,24 @@ int32_t SYSCALL5(sys_processctl, pid1, cmd1, arg1, arg2, arg3) {
|
|||||||
ret = proc->procargs.len;
|
ret = proc->procargs.len;
|
||||||
} break;
|
} break;
|
||||||
case PCTL_ARGV: {
|
case PCTL_ARGV: {
|
||||||
char **argbuf = (char **)arg1;
|
size_t *argslen = (size_t *)arg1;
|
||||||
|
char **argbuf = (char **)arg2;
|
||||||
if (argbuf == NULL) {
|
if (argbuf == NULL) {
|
||||||
ret = E_INVALIDARGUMENT;
|
ret = E_INVALIDARGUMENT;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
size_t len = arg2;
|
size_t maxargs = (size_t)arg3;
|
||||||
size_t i;
|
|
||||||
ProcArg *arg, *argtmp;
|
ProcArg *arg, *argtmp;
|
||||||
LL_FOREACH_SAFE_IDX_LIMIT(proc->procargs.list, arg, argtmp, i, len) {
|
size_t i;
|
||||||
|
LL_FOREACH_SAFE_IDX_LIMIT(proc->procargs.list, arg, argtmp, i, maxargs) {
|
||||||
if (argbuf[i] == NULL) {
|
if (argbuf[i] == NULL) {
|
||||||
ret = E_INVALIDARGUMENT;
|
ret = E_INVALIDARGUMENT;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
hal_strcpy(argbuf[i], arg->string);
|
hal_strcpy(argbuf[i], arg->string);
|
||||||
}
|
}
|
||||||
|
*argslen = i;
|
||||||
|
|
||||||
ret = E_OK;
|
ret = E_OK;
|
||||||
} break;
|
} break;
|
||||||
|
Reference in New Issue
Block a user