Date: Mon, 11 Jul 2011 15:33:32 +0300 From: Kostik Belousov <kostikbel@gmail.com> To: Robert Millan <rmh@debian.org> Cc: freebsd-hackers@freebsd.org, Ed Maste <emaste@freebsd.org>, Petr Salinger <Petr.Salinger@seznam.cz> Subject: Re: [PATCH] Improve LinuxThreads compatibility in rfork() Message-ID: <20110711123332.GS43872@deviant.kiev.zoral.com.ua> In-Reply-To: <CAOfDtXMe_pkBdAFpUdvzmfs38Re=nw_YBz4w0Va0naEcuak7iw@mail.gmail.com> References: <CAOfDtXMe_pkBdAFpUdvzmfs38Re=nw_YBz4w0Va0naEcuak7iw@mail.gmail.com>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --]
On Mon, Jul 11, 2011 at 12:54:06PM +0200, Robert Millan wrote:
> This patch made by Petr Salinger improves compatibility with
> LinuxThreads in rfork() syscall. The Linux clone() implementation
> allows specifying the signal sent to parent when child terminates
> (instead of SIGCHLD).
>
> As the threading implementation in Debian GNU/kFreeBSD is
> LinuxThreads-based, we had to diverge from upstream kFreeBSD ABI and
> implement this extension.
>
> I hope it is acceptable for you to use the same encoding, this way we
> would archieve ABI compatibility to run Debian GNU/kFreeBSD inside a
> chroot/jail on top of a FreeBSD system.
>
> Thanks for considering
>
> --
> Robert Millan
> --- a/sys/kern/kern_fork.c
> +++ b/sys/kern/kern_fork.c
> @@ -477,7 +477,13 @@
> p2->p_sigacts = newsigacts;
> }
> if (flags & RFLINUXTHPN)
> - p2->p_sigparent = SIGUSR1;
> + {
> + int sig;
> + sig = RFTHPNSIGNUM(flags);
> + if (sig == 0) sig = SIGUSR1;
> + if (sig == SIGCHLD) sig = 0;
> + p2->p_sigparent = sig;
> + }
> else
> p2->p_sigparent = SIGCHLD;
>
> --- a/sys/sys/unistd.h
> +++ b/sys/sys/unistd.h
> @@ -182,6 +182,10 @@
> #define RFHIGHPID (1<<18) /* use a pid higher than 10 (idleproc) */
> #define RFPPWAIT (1<<31) /* parent sleeps until child exits (vfork) */
> #define RFKERNELONLY (RFSTOPPED | RFHIGHPID | RFPPWAIT)
> +#define RFTHPNSHIFT 24 /* reserve bits 24-30 */
> +#define RFTHPNMASK 0x7F /* for compatibility with linuxthreads/clone() */
> + /* allow to specify "clone exit parent notification" signal */
> +#define RFTHPNSIGNUM(flags) (((flags) >> RFTHPNSHIFT) & RFTHPNMASK)
>
> #endif /* __BSD_VISIBLE */
>
I looked at this patch some time ago already.
Can you, please, describe the reasoning behind the
> + if (sig == SIGCHLD) sig = 0;
line ?
[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (FreeBSD)
iEYEARECAAYFAk4a7ZsACgkQC3+MBN1Mb4jHtQCdFtXxd7IPd2EOHy8m69ikcFjU
MJsAoLdgwXH65XU7DLUUsMGGTOL+AwcF
=Bltg
-----END PGP SIGNATURE-----
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110711123332.GS43872>
