From owner-freebsd-current Wed Nov 4 22:14:00 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id WAA20840 for freebsd-current-outgoing; Wed, 4 Nov 1998 22:14:00 -0800 (PST) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from janus.syracuse.net (janus.syracuse.net [205.232.47.15]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id WAA20835 for ; Wed, 4 Nov 1998 22:13:58 -0800 (PST) (envelope-from green@unixhelp.org) Received: from localhost (green@localhost) by janus.syracuse.net (8.8.8/8.8.7) with ESMTP id BAA28151; Thu, 5 Nov 1998 01:13:34 -0500 (EST) Date: Thu, 5 Nov 1998 01:13:34 -0500 (EST) From: Brian Feldman X-Sender: green@janus.syracuse.net To: Peter Wemm cc: current@FreeBSD.ORG Subject: Re: RFSIGSHARE: forgot patch ;) In-Reply-To: <199811050357.LAA03894@spinner.netplex.com.au> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Hrmm.... I don't see why this doesn't work: + if (args->flags & CLONE_SIGHAND) + p2->p_sigacts = p->p_sigacts; don't tell me it's pointing into user-space, or some other neglected part of proc? I'll investigate I suppose. This is certainly helping me familiarize myself with the kernel, even if these specific patches cause a trap eventually (probably all the mallocing/freeing). I _really_ need to buy a copy of the BSD book... quick question: zalloc and malloc should each be used in what situations? Cheers, Brian Feldman "gaining lots of experience" On Thu, 5 Nov 1998, Peter Wemm wrote: > 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 > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message