kern_exec.c (b8c526df70a4f68621e5dbdcc9cf1137219c8b6a) | kern_exec.c (116734c4d17fa35e66385279e8e57e89e878c27d) |
---|---|
1/* 2 * Copyright (c) 1993, David Greenman 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 84 unchanged lines hidden (view full) --- 93 char *fname; 94 char **argv; 95 char **envv; 96}; 97#endif 98 99/* 100 * execve() system call. | 1/* 2 * Copyright (c) 1993, David Greenman 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 84 unchanged lines hidden (view full) --- 93 char *fname; 94 char **argv; 95 char **envv; 96}; 97#endif 98 99/* 100 * execve() system call. |
101 * 102 * MPSAFE |
|
101 */ 102int 103execve(p, uap) 104 struct proc *p; 105 register struct execve_args *uap; 106{ 107 struct nameidata nd, *ndp; 108 struct ucred *newcred, *oldcred; --- 19 unchanged lines hidden (view full) --- 128 imgp->interpreted = 0; 129 imgp->interpreter_name[0] = '\0'; 130 imgp->auxargs = NULL; 131 imgp->vp = NULL; 132 imgp->firstpage = NULL; 133 imgp->ps_strings = 0; 134 imgp->auxarg_size = 0; 135 | 103 */ 104int 105execve(p, uap) 106 struct proc *p; 107 register struct execve_args *uap; 108{ 109 struct nameidata nd, *ndp; 110 struct ucred *newcred, *oldcred; --- 19 unchanged lines hidden (view full) --- 130 imgp->interpreted = 0; 131 imgp->interpreter_name[0] = '\0'; 132 imgp->auxargs = NULL; 133 imgp->vp = NULL; 134 imgp->firstpage = NULL; 135 imgp->ps_strings = 0; 136 imgp->auxarg_size = 0; 137 |
138 mtx_lock(&Giant); 139 |
|
136 /* 137 * Allocate temporary demand zeroed space for argument and 138 * environment strings 139 */ 140 imgp->stringbase = (char *)kmem_alloc_wait(exec_map, ARG_MAX + PAGE_SIZE); 141 if (imgp->stringbase == NULL) { 142 error = ENOMEM; 143 goto exec_fail; --- 296 unchanged lines hidden (view full) --- 440 ARG_MAX + PAGE_SIZE); 441 442 if (imgp->vp) { 443 NDFREE(ndp, NDF_ONLY_PNBUF); 444 vrele(imgp->vp); 445 } 446 447 if (error == 0) | 140 /* 141 * Allocate temporary demand zeroed space for argument and 142 * environment strings 143 */ 144 imgp->stringbase = (char *)kmem_alloc_wait(exec_map, ARG_MAX + PAGE_SIZE); 145 if (imgp->stringbase == NULL) { 146 error = ENOMEM; 147 goto exec_fail; --- 296 unchanged lines hidden (view full) --- 444 ARG_MAX + PAGE_SIZE); 445 446 if (imgp->vp) { 447 NDFREE(ndp, NDF_ONLY_PNBUF); 448 vrele(imgp->vp); 449 } 450 451 if (error == 0) |
448 return (0); | 452 goto done2; |
449 450exec_fail: 451 if (imgp->vmspace_destroyed) { 452 /* sorry, no more process anymore. exit gracefully */ 453 exit1(p, W_EXITCODE(0, SIGABRT)); 454 /* NOT REACHED */ | 453 454exec_fail: 455 if (imgp->vmspace_destroyed) { 456 /* sorry, no more process anymore. exit gracefully */ 457 exit1(p, W_EXITCODE(0, SIGABRT)); 458 /* NOT REACHED */ |
455 return(0); 456 } else { 457 return(error); 458 } | 459 error = 0; 460 } 461done2: 462 mtx_unlock(&Giant); 463 return(error); |
459} 460 461int 462exec_map_first_page(imgp) 463 struct image_params *imgp; 464{ 465 int rv, i; 466 int initial_pagein; --- 438 unchanged lines hidden --- | 464} 465 466int 467exec_map_first_page(imgp) 468 struct image_params *imgp; 469{ 470 int rv, i; 471 int initial_pagein; --- 438 unchanged lines hidden --- |