+ if (vfexec) {
+ kern_return_t result;
+
+ result = task_create_local(task, FALSE, FALSE, &new_task);
+ if (result != KERN_SUCCESS)
+ printf("execve: task_create failed. Code: 0x%x\n", result);
+ p->task = new_task;
+ set_bsdtask_info(new_task, p);
+ if (p->p_nice != 0)
+ resetpriority(p);
+ task = new_task;
+ map = get_task_map(new_task);
+ result = thread_create(new_task, &thr_act);
+ if (result != KERN_SUCCESS)
+ printf("execve: thread_create failed. Code: 0x%x\n", result);
+ uthread = get_bsdthread_info(thr_act);
+ } else {
+ map = VM_MAP_NULL;
+
+ }
+
+ /*
+ * Load the Mach-O file.
+ */
+ VOP_UNLOCK(vp, 0, p);
+ if(ws_cache_name) {
+ tws_handle_startup_file(task, cred->cr_uid,
+ ws_cache_name, vp, &new_shared_regions);
+ }
+ if (new_shared_regions) {
+ shared_region_mapping_t new_shared_region;
+ shared_region_mapping_t old_shared_region;
+
+ if (shared_file_create_system_region(&new_shared_region))
+ panic("couldn't create system_shared_region\n");
+
+ vm_get_shared_region(task, &old_shared_region);
+ vm_set_shared_region(task, new_shared_region);
+
+ shared_region_mapping_dealloc(old_shared_region);
+ }
+
+ lret = load_machfile(vp, mach_header, arch_offset,
+ arch_size, &load_result, thr_act, map);
+