From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55997) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W2uZJ-0005b5-GL for qemu-devel@nongnu.org; Mon, 13 Jan 2014 22:21:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W2uZD-00065W-Gy for qemu-devel@nongnu.org; Mon, 13 Jan 2014 22:21:33 -0500 Received: from mx1.redhat.com ([209.132.183.28]:18597) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W2uZD-00065Q-7O for qemu-devel@nongnu.org; Mon, 13 Jan 2014 22:21:27 -0500 Date: Tue, 14 Jan 2014 11:21:19 +0800 From: Fam Zheng Message-ID: <20140114032119.GD9212@T430.nay.redhat.com> References: <1389632394-10130-1-git-send-email-pbonzini@redhat.com> <1389632394-10130-7-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PATCH v15 6/9] module: implement module loading List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Michael Tokarev , QEMU Developers , Alex Bligh , Paolo Bonzini , Miroslav Rezanina , =?iso-8859-1?Q?Llu=EDs?= Vilanova , Richard Henderson On Mon, 01/13 22:05, Peter Maydell wrote: > On 13 January 2014 16:59, Paolo Bonzini wrote: > > From: Fam Zheng > > > > This patch adds loading, stamp checking and initialization of modules. > > > > The init function of dynamic module is no longer directly called as > > __attribute__((constructor)) in static linked version, it is called > > only after passed the checking of presense of stamp symbol: > > > > qemu_stamp_$(date +%s$$$RANDOM) > > > > > +echo "CONFIG_STAMP=`date +%s`_$$_$RANDOM" >> $config_host_mak > > This is not really a good idea because $RANDOM is a bashism > and our configure script is a generic POSIX shell script. In > particular if you configure on Ubuntu you're likely to find that /bin/sh > is dash and $RANDOM silently expands to the empty string. > > (One day I will clean up the tempfile generation stuff to fix > its misuse of $RANDOM...) > So what's the best way to generate random number here? > > +void DSO_STAMP_FUN(void); > > +/* For error message, this function is an identification of qemu module */ > > What is this comment trying to say? Existence of this symbol indicates it *is* a qemu module. Where we continue to check for existence of DSO_STAMP_FUN, and report it's only the wrong version. Thanks, Fam