From owner-freebsd-hackers@FreeBSD.ORG Mon Jul 11 14:22: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 236901065672; Mon, 11 Jul 2011 14:22: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 B78FD8FC20; Mon, 11 Jul 2011 14:22: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 p6BEMXDA091566 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 11 Jul 2011 17:22:33 +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 p6BEMXtr016122; Mon, 11 Jul 2011 17:22:33 +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 p6BEMXFN016100; Mon, 11 Jul 2011 17:22:33 +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 17:22:33 +0300 From: Kostik Belousov To: Petr Salinger Message-ID: <20110711142232.GU43872@deviant.kiev.zoral.com.ua> References: <20110711123332.GS43872@deviant.kiev.zoral.com.ua> <20110711133342.GT43872@deviant.kiev.zoral.com.ua> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="czRehjsqUdpaVUeF" 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, Robert Millan , current@freebsd.org 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 14:22:41 -0000 --czRehjsqUdpaVUeF Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jul 11, 2011 at 04:23:36PM +0200, Petr Salinger wrote: > >>>Can you, please, describe the reasoning behind the > >>>>+ if (sig =3D=3D SIGCHLD) sig =3D 0; > >>>line ? > >> > >>The main reason is backward compatibility. > >>The original FreeBSD code allows only to select between > >>SIGUSR1 or SIGCHLD signals. > >> > >>The our extension changes meaning of RFLINUXTHPN to select signal based= on > >>bits 24-30 of passed flags instead of using SIGUSR1 every time. > >> > >>When the passed "signal" number is zero, it should behave identically > >>on plain FreeBSD and in our environment, therefore SIGUSR1 is selected. > >>The assumption is (have been) that (yet) undefined bits are zero. > >>That way we are backward compatible with original FreeBSD. > >> > >>We still need an alternative way to select "none signal is sent" > >>after child exit (under linux #0 is used). > >> > >>The SIGCHLD can be "selected" (also on original FreeBSD) by not specify= ing > >>RFLINUXTHPN, therefore combination of RFLINUXTHPN and passed "signal" > >>number SIGCHLD is (have been) used for "none signal". > >> > >>BTW, the opposite side is in > >> > >>http://anonscm.debian.org/viewvc/glibc-bsd/trunk/glibc-ports/kfreebsd/c= lone.c?view=3Dmarkup > > > >I shall state that the sig =3D=3D SIGCHLD case is ugly. Having the separ= ate > >flag "do not send signal to the parent" would be much less clumsy. > >What are the requirements for the ABI stability for Debian/kFreeBSD ? > >Can this be fixed now, or is it too late ? >=20 > It should be backward compatible with one previous version. >=20 > What about in long term this: >=20 > RFLINUXTHPN bit will be renamed and will have meaning > "select signal based on bits 24-30 of passed flags" >=20 > - zero would mean "no signal" > - SIGCHLD would mean undefined > - SIGUSR1 would mean SIGUSR1 >=20 > It is ABI/API breakage under original FreeBSD. > The question is how frequently RFLINUXTHPN is used under native FreeBSD > and its port collection. RFLINUXPTH was used by the linuxthreads port, that was popular in the time of FreeBSD 4.x and may be 5.x to run mysql. I will object against this breakage. >=20 > And under "Debian GNU/kFreeBSD COMPAT" or 8-COMPAT > - SIGCHLD would mean "no signal" We never user COMPAT to _change_ the meaning of something, only to exclude some functionality, like syscall. >=20 > We do not use SIGUSR1 currently, the eglibc side can detect whether > it runs under new-enough kernel and decide whether use 0 or SIGCHLD > for "no signal". >=20 > The kernel side would be something like: >=20 > if (flags & RFLINUXTHPN) > { > p2->p_sigparent =3D RFTHPNSIGNUM(flags); > #if COMPAT8 > if (p2->p_sigparent =3D=3D SIGCHLD) > p2->p_sigparent =3D 0; > #endif > } No, this is even uglier, and see the note about compat. BTW, it seems that our rfork(2) ignores unknown flags. This should be fixed, might be in the same patch. --czRehjsqUdpaVUeF Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEARECAAYFAk4bBygACgkQC3+MBN1Mb4jK3wCfUDTbE+y2thPnkLBRDkRLq53a wWQAnjkr4O8ngWU0FTCHpzsmnMbLAl1Q =yDiE -----END PGP SIGNATURE----- --czRehjsqUdpaVUeF--