1
0
mirror of https://github.com/openbsd/src.git synced 2025-01-10 06:47:55 -08:00

slightly optimized the ptrace stat allocation to only happen when needed.

ok deraadt
This commit is contained in:
tedu 2008-11-11 02:13:14 +00:00
parent 7f4c1854d7
commit 9aaca6d3f2

View File

@ -1,4 +1,4 @@
/* $OpenBSD: kern_fork.c,v 1.100 2008/11/09 05:13:55 deraadt Exp $ */
/* $OpenBSD: kern_fork.c,v 1.101 2008/11/11 02:13:14 tedu Exp $ */
/* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */
/*
@ -181,7 +181,7 @@ fork1(struct proc *p1, int exitsig, int flags, void *stack, size_t stacksize,
int s;
extern void endtsleep(void *);
extern void realitexpire(void *);
struct ptrace_state *newptstat;
struct ptrace_state *newptstat = NULL;
#if NSYSTRACE > 0
void *newstrp = NULL;
#endif
@ -387,7 +387,8 @@ fork1(struct proc *p1, int exitsig, int flags, void *stack, size_t stacksize,
forkstat.sizkthread += vm->vm_dsize + vm->vm_ssize;
}
newptstat = malloc(sizeof(struct ptrace_state), M_SUBPROC, M_WAITOK);
if (p2->p_flag & P_TRACED && flags & FORK_FORK)
newptstat = malloc(sizeof(*newptstat), M_SUBPROC, M_WAITOK);
#if NSYSTRACE > 0
if (ISSET(p1->p_flag, P_SYSTRACE))
newstrp = systrace_getproc();