From owner-freebsd-current Wed Nov 4 19:57:47 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id TAA09946 for freebsd-current-outgoing; Wed, 4 Nov 1998 19:57:47 -0800 (PST) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from spinner.netplex.com.au (spinner.netplex.com.au [202.12.86.3]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id TAA09937 for ; Wed, 4 Nov 1998 19:57:42 -0800 (PST) (envelope-from peter@netplex.com.au) Received: from spinner.netplex.com.au (localhost [127.0.0.1]) by spinner.netplex.com.au (8.9.1/8.9.1/Spinner) with ESMTP id LAA03894; Thu, 5 Nov 1998 11:57:11 +0800 (WST) (envelope-from peter@spinner.netplex.com.au) Message-Id: <199811050357.LAA03894@spinner.netplex.com.au> X-Mailer: exmh version 2.0.2 2/24/98 To: Brian Feldman cc: current@FreeBSD.ORG Subject: Re: RFSIGSHARE: forgot patch ;) In-reply-to: Your message of "Wed, 04 Nov 1998 22:15:53 EST." Date: Thu, 05 Nov 1998 11:57:10 +0800 From: Peter Wemm Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Brian Feldman wrote: [..] > --- ./kern/kern_fork.c.orig Wed Nov 4 20:33:11 1998 > +++ ./kern/kern_fork.c Wed Nov 4 20:44:29 1998 > @@ -151,6 +151,10 @@ > p1->p_pid); > return (EOPNOTSUPP); > } > + if (flags & RFSIGSHARE) { > + printf("shared signal space attemped: pid: %d\n", > p1->p_pid); > + return (EOPNOTSUPP); > + } > #endif > > /* RFSIGSHARE should work fine on SMP. > @@ -320,6 +324,16 @@ > bcopy(p1->p_cred, p2->p_cred, sizeof(*p2->p_cred)); > p2->p_cred->p_refcnt = 1; > crhold(p1->p_ucred); > + > + if (flags & RFSIGSHARE) { > + p2->p_sig->p_refcnt++; > + } else { > + p2->p_sig = malloc(sizeof(struct procsig), M_TEMP, > M_WAITOK); > + p2->p_sig->p_refcnt = 1; > + p2->p_sigmask = p1->p_sigmask; > + p2->p_sigignore = p1->p_sigignore; > + p2->p_sigcatch = p1->p_sigcatch; > + } > > /* bump references to the text vnode (for procfs) */ > p2->p_textvp = p1->p_textvp; Umm, you are sharing the signal masks, not the signal handler vectors themselves. Think p_sigacts.. Those are stored after the PCB and are paged out. Assuming you take a shot at sharing them, try this: Keep p_sigacts there by default. If a process attempts to share the signals during a fork, then malloc a copy and attach it to both the child and parent. When the reference count drops to 1, the remaining process should probably have it's vectors copied to the upages again and the malloc space freed. But good stuff so far! :-) Cheers, -Peter To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message