Date: Thu, 05 Nov 1998 11:57:10 +0800 From: Peter Wemm <peter@netplex.com.au> To: Brian Feldman <green@unixhelp.org> Cc: current@FreeBSD.ORG Subject: Re: RFSIGSHARE: forgot patch ;) Message-ID: <199811050357.LAA03894@spinner.netplex.com.au> In-Reply-To: Your message of "Wed, 04 Nov 1998 22:15:53 EST." <Pine.BSF.4.05.9811042214220.25785-100000@janus.syracuse.net>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199811050357.LAA03894>
