From patchwork Tue Mar 15 21:03:10 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Blue Swirl X-Patchwork-Id: 87078 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 7D1CBB72CC for ; Wed, 16 Mar 2011 08:06:28 +1100 (EST) Received: from localhost ([127.0.0.1]:36915 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PzbRc-000868-KS for incoming@patchwork.ozlabs.org; Tue, 15 Mar 2011 17:06:20 -0400 Received: from [140.186.70.92] (port=51440 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PzbOt-0006GP-Qx for qemu-devel@nongnu.org; Tue, 15 Mar 2011 17:03:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PzbOs-00033t-Sp for qemu-devel@nongnu.org; Tue, 15 Mar 2011 17:03:31 -0400 Received: from mail-vx0-f173.google.com ([209.85.220.173]:33402) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PzbOs-00033j-Pg for qemu-devel@nongnu.org; Tue, 15 Mar 2011 17:03:30 -0400 Received: by vxb41 with SMTP id 41so1081469vxb.4 for ; Tue, 15 Mar 2011 14:03:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=JyakeekiMSSmCvRlOb8KqdBBoOapMOGiQ1W21RSuNCA=; b=Maav0oIR4cJ51akrBbech4pzcSzJZNe332dBBMS9NEpTQUT/7uIUboRyvgBsJMAUDs D35D+sSl0SIdJLsUJS8K0PtIH4yJh2+mXSm6/YPhBmw82CPMmQ7v+Bifu1C8U2liCSSg VDVI7eyQTy0y3b60c74fqf9w/AfyzcFsMU0bM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=FqC2boTBkhIoHNtljl6iDerUKgaJHc0hB88TY5xkYMSmkJwWYo0OnsRowkzXK/oUDE E5XzrRR0X4tlJKUDuSPy3ocTShdRZvpsyrEF2j95uh77juTJukOZFt4rvRgniNhR/QqB FPYwE7eJw2Ilr+dIeCCdrpm8n9rEAqIHSCPGE= Received: by 10.220.73.5 with SMTP id o5mr3622839vcj.253.1300223010164; Tue, 15 Mar 2011 14:03:30 -0700 (PDT) MIME-Version: 1.0 Received: by 10.220.193.193 with HTTP; Tue, 15 Mar 2011 14:03:10 -0700 (PDT) In-Reply-To: References: From: Blue Swirl Date: Tue, 15 Mar 2011 23:03:10 +0200 Message-ID: Subject: Re: [Qemu-devel] OSX build issues To: =?UTF-8?Q?Fran=C3=A7ois_Revol?= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.220.173 Cc: QEMU Developers X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org On Mon, Mar 14, 2011 at 11:21 PM, François Revol wrote: > The OSX build has been broken for some time now... > > * qemu-thread-posix.c: > both qemu_mutex_timedlock and qemu_cond_timedwait make use of clock_gettime() and CLOCK_REALTIME, which OSX doesn't have. > It seems like both functions are nowhere found. Can they be removed then ? This patch should fix the problem. From 8bc9b2c313bea3536ba258a16f211a8585c494f3 Mon Sep 17 00:00:00 2001 Message-Id: <8bc9b2c313bea3536ba258a16f211a8585c494f3.1300222948.git.blauwirbel@gmail.com> From: Blue Swirl Date: Tue, 15 Mar 2011 20:48:52 +0000 Subject: [PATCH] qemu-thread: delete unused functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit qemu_mutex_timedlock() and qemu_cond_timedwait() are no longer used. Remove them and their helper timespec_add_ms(). Reported-by: François Revol Signed-off-by: Blue Swirl --- qemu-thread-posix.c | 38 -------------------------------------- qemu-thread.h | 2 -- 2 files changed, 0 insertions(+), 40 deletions(-) diff --git a/qemu-thread-posix.c b/qemu-thread-posix.c index 87c1a9f..2bd02ef 100644 --- a/qemu-thread-posix.c +++ b/qemu-thread-posix.c @@ -61,30 +61,6 @@ int qemu_mutex_trylock(QemuMutex *mutex) return pthread_mutex_trylock(&mutex->lock); } -static void timespec_add_ms(struct timespec *ts, uint64_t msecs) -{ - ts->tv_sec = ts->tv_sec + (long)(msecs / 1000); - ts->tv_nsec = (ts->tv_nsec + ((long)msecs % 1000) * 1000000); - if (ts->tv_nsec >= 1000000000) { - ts->tv_nsec -= 1000000000; - ts->tv_sec++; - } -} - -int qemu_mutex_timedlock(QemuMutex *mutex, uint64_t msecs) -{ - int err; - struct timespec ts; - - clock_gettime(CLOCK_REALTIME, &ts); - timespec_add_ms(&ts, msecs); - - err = pthread_mutex_timedlock(&mutex->lock, &ts); - if (err && err != ETIMEDOUT) - error_exit(err, __func__); - return err; -} - void qemu_mutex_unlock(QemuMutex *mutex) { int err; @@ -139,20 +115,6 @@ void qemu_cond_wait(QemuCond *cond, QemuMutex *mutex) error_exit(err, __func__); } -int qemu_cond_timedwait(QemuCond *cond, QemuMutex *mutex, uint64_t msecs) -{ - struct timespec ts; - int err; - - clock_gettime(CLOCK_REALTIME, &ts); - timespec_add_ms(&ts, msecs); - - err = pthread_cond_timedwait(&cond->cond, &mutex->lock, &ts); - if (err && err != ETIMEDOUT) - error_exit(err, __func__); - return err; -} - void qemu_thread_create(QemuThread *thread, void *(*start_routine)(void*), void *arg) diff --git a/qemu-thread.h b/qemu-thread.h index acdb6b2..edc7ab6 100644 --- a/qemu-thread.h +++ b/qemu-thread.h @@ -15,7 +15,6 @@ void qemu_mutex_init(QemuMutex *mutex); void qemu_mutex_destroy(QemuMutex *mutex); void qemu_mutex_lock(QemuMutex *mutex); int qemu_mutex_trylock(QemuMutex *mutex); -int qemu_mutex_timedlock(QemuMutex *mutex, uint64_t msecs); void qemu_mutex_unlock(QemuMutex *mutex); void qemu_cond_init(QemuCond *cond); @@ -29,7 +28,6 @@ void qemu_cond_destroy(QemuCond *cond); void qemu_cond_signal(QemuCond *cond); void qemu_cond_broadcast(QemuCond *cond); void qemu_cond_wait(QemuCond *cond, QemuMutex *mutex); -int qemu_cond_timedwait(QemuCond *cond, QemuMutex *mutex, uint64_t msecs); void qemu_thread_create(QemuThread *thread, void *(*start_routine)(void*), -- 1.7.2.3