Deleted Added
full compact
kern_fork.c (108520) kern_fork.c (108522)
1/*
2 * Copyright (c) 1982, 1986, 1989, 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.

--- 22 unchanged lines hidden (view full) ---

31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 *
38 * @(#)kern_fork.c 8.6 (Berkeley) 4/8/94
1/*
2 * Copyright (c) 1982, 1986, 1989, 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.

--- 22 unchanged lines hidden (view full) ---

31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 *
38 * @(#)kern_fork.c 8.6 (Berkeley) 4/8/94
39 * $FreeBSD: head/sys/kern/kern_fork.c 108520 2003-01-01 01:01:14Z alfred $
39 * $FreeBSD: head/sys/kern/kern_fork.c 108522 2003-01-01 01:19:31Z alfred $
40 */
41
42#include "opt_ktrace.h"
43#include "opt_mac.h"
44
45#include <sys/param.h>
46#include <sys/systm.h>
47#include <sys/sysproto.h>

--- 218 unchanged lines hidden (view full) ---

266 /*
267 * Unshare file descriptors (from parent.)
268 */
269 if (flags & RFFDG) {
270 FILEDESC_LOCK(p1->p_fd);
271 if (p1->p_fd->fd_refcnt > 1) {
272 struct filedesc *newfd;
273
40 */
41
42#include "opt_ktrace.h"
43#include "opt_mac.h"
44
45#include <sys/param.h>
46#include <sys/systm.h>
47#include <sys/sysproto.h>

--- 218 unchanged lines hidden (view full) ---

266 /*
267 * Unshare file descriptors (from parent.)
268 */
269 if (flags & RFFDG) {
270 FILEDESC_LOCK(p1->p_fd);
271 if (p1->p_fd->fd_refcnt > 1) {
272 struct filedesc *newfd;
273
274 newfd = fdcopy(td);
274 newfd = fdcopy(td->td_proc->p_fd);
275 FILEDESC_UNLOCK(p1->p_fd);
276 fdfree(td);
277 p1->p_fd = newfd;
278 } else
279 FILEDESC_UNLOCK(p1->p_fd);
280 }
281 *procp = NULL;
282 return (0);

--- 160 unchanged lines hidden (view full) ---

443 * Copy filedesc.
444 * XXX: This is busted. fd*() need to not take proc
445 * arguments or something.
446 */
447 if (flags & RFCFDG)
448 fd = fdinit(td->td_proc->p_fd);
449 else if (flags & RFFDG) {
450 FILEDESC_LOCK(p1->p_fd);
275 FILEDESC_UNLOCK(p1->p_fd);
276 fdfree(td);
277 p1->p_fd = newfd;
278 } else
279 FILEDESC_UNLOCK(p1->p_fd);
280 }
281 *procp = NULL;
282 return (0);

--- 160 unchanged lines hidden (view full) ---

443 * Copy filedesc.
444 * XXX: This is busted. fd*() need to not take proc
445 * arguments or something.
446 */
447 if (flags & RFCFDG)
448 fd = fdinit(td->td_proc->p_fd);
449 else if (flags & RFFDG) {
450 FILEDESC_LOCK(p1->p_fd);
451 fd = fdcopy(td);
451 fd = fdcopy(td->td_proc->p_fd);
452 FILEDESC_UNLOCK(p1->p_fd);
453 } else
454 fd = fdshare(p1->p_fd);
455
456 /*
457 * Make a proc table entry for the new process.
458 * Start by zeroing the section of proc that is zero-initialized,
459 * then copy the section that is copied directly from the parent.

--- 453 unchanged lines hidden ---
452 FILEDESC_UNLOCK(p1->p_fd);
453 } else
454 fd = fdshare(p1->p_fd);
455
456 /*
457 * Make a proc table entry for the new process.
458 * Start by zeroing the section of proc that is zero-initialized,
459 * then copy the section that is copied directly from the parent.

--- 453 unchanged lines hidden ---