From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54593) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WNPJn-0007UE-9I for qemu-devel@nongnu.org; Tue, 11 Mar 2014 12:14:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WNPJi-00020L-Vw for qemu-devel@nongnu.org; Tue, 11 Mar 2014 12:14:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:19437) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WNPJi-000205-Ni for qemu-devel@nongnu.org; Tue, 11 Mar 2014 12:14:10 -0400 Date: Tue, 11 Mar 2014 16:13:01 +0000 From: "Dr. David Alan Gilbert" Message-ID: <20140311161301.GG2450@work-vm> References: <1394392713-31471-1-git-send-email-mst@redhat.com> <1394392713-31471-9-git-send-email-mst@redhat.com> <531F2C52.50401@siemens.com> <531F3083.9090304@siemens.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PATCH] qemu-thread-posix: Fix build against older glibc version List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Kevin Wolf , Anthony Liguori , "Michael S. Tsirkin" , Jan Kiszka , QEMU Developers , Gerd Hoffmann , Stefan Hajnoczi , Laszlo Ersek * Peter Maydell (peter.maydell@linaro.org) wrote: > On 11 March 2014 15:49, Jan Kiszka wrote: > > pthread_setname_np was introduced with 2.12. > > > > Signed-off-by: Jan Kiszka > > --- > > util/qemu-thread-posix.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/util/qemu-thread-posix.c b/util/qemu-thread-posix.c > > index 45113b4..960d7f5 100644 > > --- a/util/qemu-thread-posix.c > > +++ b/util/qemu-thread-posix.c > > @@ -420,7 +420,7 @@ void qemu_thread_create(QemuThread *thread, const char *name, > > if (err) > > error_exit(err, __func__); > > > > -#ifdef _GNU_SOURCE > > +#if defined(__GLIBC__) && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 12)) > > if (name_threads) { > > pthread_setname_np(thread->thread, name); > > } > > -- > > 1.8.1.1.298.ge7eed54 > > Can we have a configure test for the function instead, please? > We don't generally do tests for specific glibc versions > (among other things, glibc is not the only C library we > might be compiled against -- consider MacOSX, the BSDs, > and occasionally somebody tries to compile against one > of the embedded libcs). Except pthread_setname_np is not portable and was previously ifdef'd _GNU_SOURCE anyway, and the parameters on other OSs maybe different (freebsd has got a 3rd parameter for no apparent reason). Dave -- Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK