On Thu, Feb 28, 2008 at 06:28:53PM -0500, Weiming Liu wrote: > Hi. I am doing some experiment on mconsole driver. My wish is to create a > new user process from mconsole driver, modifying its address space, changing > its file mapping... Eventually may be I can migrate a process from host or > between UML instances. I am a newbie to both kernel and UML, and I have > several questions on implementation: > > 1. create a new process from a kernel thread. It seems that mconsole uses a > work queque, and requests are processed at kevents thread. Right now what I > am doing is, creating a new kernel thread and letting it call sys_ececve(). > I then find its task_struct by looking for its name and its parent. It seems > stupid and maybe not correct. Is there any better way to do this?
Use a completion: In the parent, do DECLARE_COMPLETION(c) kernel_thread() wait_for_completion(&c) child_task = my_task; In the child, do my_task = current; complete(&c); You'll also want to wrap a semaphore around the whole thing. > 2. I need to manipulate the process' address space (memory segments, file > mappings) like what flush_old_exec() and do_mmap() are doing. I cannot find > a way to call those functions since I am in a kernel thread, and it seems > too complicated by working directly on page tables and memory. How can this > be done in a convenient way? There are helpers for all these things. Jeff -- Work email - jdike at linux dot intel dot com ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ User-mode-linux-devel mailing list User-mode-linux-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel