Exemplo n.º 1
0
int launch_process(char *proc_name)
{
    Tree *pTree = get_proc_binary(proc_name);
    void *binary = (void *)((char *)pTree->fileInfo+sizeof(struct posix_header_ustar));

    process_t *proc = NULL;

    if (binary)
    {
        proc = create_process_new(binary, 0, -1, /* generate new pid */
                                pTree->name,
                                NULL,
                                0,
                                (char **const)env_variables,
                                kern_env_count);
    }
    return proc == NULL? -1: proc->pid;
}
Exemplo n.º 2
0
void execve(process* p, char* bin_file,char* argv[], char* envp[]){
  //printf("\n [in execve fn]Process %s called execve ,fd0 type=%c",p->p_name,p->fdtable[0].filetype);
	process* new_p = create_process_new(p->pp,bin_file,0);
	int is_background = is_background_process(argv);
	//new_p->fdtable = p->fdtable;
	new_p->maxfd = p->maxfd;
	invalidate_r_queue(p->pid);
	new_p->pid = p->pid;

	//set the environment variable of the new process
	set_env(new_p,argv,envp);
	copy_fdtable(p,new_p);
	free_process_memory(p);
	
	if(is_background == 1){
		new_p->is_background = 1;
		child_update(new_p->pid);
	}

	add_to_readyQ(new_p);

}
Exemplo n.º 3
0
process* create_process(process* pp, char* bin_file) {
    return create_process_new(pp,bin_file,1);
}