Date: Thu, 5 Nov 1998 01:13:34 -0500 (EST) From: Brian Feldman <green@unixhelp.org> To: Peter Wemm <peter@netplex.com.au> Cc: current@FreeBSD.ORG Subject: Re: RFSIGSHARE: forgot patch ;) Message-ID: <Pine.BSF.4.05.9811050110520.28066-100000@janus.syracuse.net> In-Reply-To: <199811050357.LAA03894@spinner.netplex.com.au>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.05.9811050110520.28066-100000>