From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43621) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WNRaM-0006sz-Af for qemu-devel@nongnu.org; Tue, 11 Mar 2014 14:39:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WNRaH-0008Ce-I4 for qemu-devel@nongnu.org; Tue, 11 Mar 2014 14:39:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:7420) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WNRaH-0008CK-B1 for qemu-devel@nongnu.org; Tue, 11 Mar 2014 14:39:25 -0400 Date: Tue, 11 Mar 2014 20:39:22 +0200 From: "Michael S. Tsirkin" Message-ID: <20140311183922.GB10982@redhat.com> 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> <20140311161301.GG2450@work-vm> <20140311163657.GH2450@work-vm> 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 , Stefan Hajnoczi , Jan Kiszka , "Dr. David Alan Gilbert" , QEMU Developers , Gerd Hoffmann , Anthony Liguori , Laszlo Ersek On Tue, Mar 11, 2014 at 05:51:16PM +0000, Peter Maydell wrote: > On 11 March 2014 16:36, Dr. David Alan Gilbert wrote: > > * Peter Maydell (peter.maydell@linaro.org) wrote: > >> On 11 March 2014 16:13, Dr. David Alan Gilbert wrote: > >> > * Peter Maydell (peter.maydell@linaro.org) wrote: > >> >> 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 > >> > >> I still think it's a generally worse way to do checks. > >> We currently have only one check against __GLIBC_MINOR__ > >> in the tree (and that's in extremely Linux-specific > >> code). > >> > >> > the parameters on other OSs > >> > maybe different (freebsd has got a 3rd parameter for no > >> > apparent reason). > >> > >> This rather suggests we should abstract the "set thread > >> name" functionality out into its own function so we > >> can easily provide other implementations for those > >> other OSes later. > > > > OK, well there is already a > > > > void os_set_proc_name(const char *s) > > > > in os-posix.c but it has ~2 problems: > > 1) If the OS doesn't support doing it that way it exit(1)'s > > 2) it uses prctl to set it on the current thread, where > > pthread_setname_np has the advantage that it sets it on > > something you have a pthread* for. > > 3) There isn't a matching entry in os-win32.c > > > > is the best thing to add another function to os-posix and os-win > > then? > > Given this function's only for use in qemu-thread-posix.c > I think it would be reasonable to just have it live there. > It would be nicer to have an > > static void qemu_thread_set_name(QemuThread *thread, const char *name) > { > #ifdef CONFIG_THREAD_SETNAME_NP > pthread_setname_np(thread->thread, name); > #endif > } > > rather than #ifdefs in the middle of functions, > that's all. > > thanks > -- PMM Shouldn't we prevent the unsupported option from appearing in qemu output though? Otherwise how does user know whether it works?