From: Jeroen I. <idd...@ly...> - 2002-01-16 11:19:51
|
Hi, Included is patch wich does has the following addition/fixes: * Commandline arguments now supported THe following api's are changed: NOTE : this is for USER LAND and KERNEL functions proc_create_proc user_create_proc int sys_proc_create_proc(cont char *path,const char *name,const **args,int argc,int priority) args is an array with (char *) pointers. argc is the number of arguments. There must be argc valid pointers in **args. The array doesn't need to end with a NULL pointer. Arguments are stored in the kernel 'proc' struc . struct proc{ . . char **args :added, contains the **args (in user_proc_create proc the argument list is coppied to kernel space) char argc :added, same as argc } New: int user_proc_get_argument int sys_proc_get_argument(int arg_no,char *arg,int max_len) This function retrieves the argument of the current process. arg_no argument number. char *arg buffer in wich the information is returned. max_len Size of buffer. proc_get_arg_count user_proc_get_arg_count int sys_proc_get_arg_count(void); return the nummber of arguments sys_proc_get_arg_count = argc + 1. Because argument 0 is p->name. note: Argument 0 is p->name (p is kernel proces info) Argument 1.. sys_proc_get_arg_count() -1 are the arguments in the **args parameter of sys_proc_create_proc. When arg_no >= sys_proc_get_arg_count() the function returns an empty string. * I changed the exec instruction of the shell. * Support the linux '&' * Arguments are passed to process * TestApp modifed for testing (it prints all+2 arguments) e.g. exec /boot/bin/testapp param1 param2& exec /boot/bin/testapp param1 param2 & exec /boot/bin/testapp& exec /boot/bin/testapp zzz (for non linux geeks: when command line ends with & the shell doesn't wait until process exits). * Yesterday i submited a patch wich adds 'const' to the source parameter of user_memcpy and also adds (void) where necessary to the function parameter list. Because I forgot to modify the arg_user_memcpy,another version of this patch is included in this included in this patch. (sorry for combining the patches , but this was necessary because of some parctical reasons) *NOTE: Because the change of the arg_user_memcpy and the change of parameter of proc_Create_proc function I also changed the cpu.c/cpu.h and syscall.S of the 'SH' port. Because I can't test this I don't know if I broke it. I have tested the patch as follows: Modified testapp with retrieves the argument 0.. sys_proc_get_arg_count()+2. I have run this program for different combinitation of parameters: * Without parameters * With parameters * with combination of the '&' * Checked by the debug logging if all parameters are freed when process exits. * Applied the patch to a clean source and compiled for i386 target. I don't get any compiler warnings or the above tests didn't failed. * Patch is for newos version 20020115 Greez Jeroen. |