From owner-freebsd-hackers@FreeBSD.ORG Mon Jul 11 12:33:41 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3222F106566C; Mon, 11 Jul 2011 12:33:41 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id A26548FC12; Mon, 11 Jul 2011 12:33:40 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id p6BCXW6a081246 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 11 Jul 2011 15:33:32 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4) with ESMTP id p6BCXWN9051722; Mon, 11 Jul 2011 15:33:32 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id p6BCXWUN051721; Mon, 11 Jul 2011 15:33:32 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 11 Jul 2011 15:33:32 +0300 From: Kostik Belousov To: Robert Millan Message-ID: <20110711123332.GS43872@deviant.kiev.zoral.com.ua> References: Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="0lx/R+CYDdR/AN/7" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: freebsd-hackers@freebsd.org, Ed Maste , Petr Salinger Subject: Re: [PATCH] Improve LinuxThreads compatibility in rfork() X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2011 12:33:41 -0000 --0lx/R+CYDdR/AN/7 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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). >=20 > As the threading implementation in Debian GNU/kFreeBSD is > LinuxThreads-based, we had to diverge from upstream kFreeBSD ABI and > implement this extension. >=20 > 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. >=20 > Thanks for considering >=20 > --=20 > Robert Millan > --- a/sys/kern/kern_fork.c > +++ b/sys/kern/kern_fork.c > @@ -477,7 +477,13 @@ > p2->p_sigacts =3D newsigacts; > } > if (flags & RFLINUXTHPN)=20 > - p2->p_sigparent =3D SIGUSR1; > + { > + int sig; > + sig =3D RFTHPNSIGNUM(flags); > + if (sig =3D=3D 0) sig =3D SIGUSR1; > + if (sig =3D=3D SIGCHLD) sig =3D 0; > + p2->p_sigparent =3D sig; > + } > else > p2->p_sigparent =3D SIGCHLD; > =20 > --- 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) > =20 > #endif /* __BSD_VISIBLE */ > =20 I looked at this patch some time ago already. Can you, please, describe the reasoning behind the > + if (sig =3D=3D SIGCHLD) sig =3D 0; line ? --0lx/R+CYDdR/AN/7 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEARECAAYFAk4a7ZsACgkQC3+MBN1Mb4jHtQCdFtXxd7IPd2EOHy8m69ikcFjU MJsAoLdgwXH65XU7DLUUsMGGTOL+AwcF =Bltg -----END PGP SIGNATURE----- --0lx/R+CYDdR/AN/7--