From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Leonard Subject: [PATCH ARM v7 03/13] mini-os: move poor rand function to test.c Date: Fri, 8 Aug 2014 16:47:32 +0100 Message-ID: <1407512862-9373-4-git-send-email-talex5@gmail.com> References: <1407512862-9373-1-git-send-email-talex5@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XFmOA-00072R-14 for xen-devel@lists.xenproject.org; Fri, 08 Aug 2014 15:47:30 +0000 Received: by mail-wi0-f170.google.com with SMTP id f8so2734647wiw.3 for ; Fri, 08 Aug 2014 08:47:28 -0700 (PDT) In-Reply-To: <1407512862-9373-1-git-send-email-talex5@gmail.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: Thomas Leonard , Dave.Scott@eu.citrix.com, anil@recoil.org, stefano.stabellini@eu.citrix.com, samuel.thibault@ens-lyon.org List-Id: xen-devel@lists.xenproject.org It's only used by test.c and probably isn't something that should be exposed for general use (it just calls gettimeofday). This is also useful for ARM, which doesn't use math.c, where this used to live. Signed-off-by: Thomas Leonard --- extras/mini-os/lib/math.c | 13 ------------- extras/mini-os/test.c | 13 +++++++++++++ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/extras/mini-os/lib/math.c b/extras/mini-os/lib/math.c index c941b4c..561393e 100644 --- a/extras/mini-os/lib/math.c +++ b/extras/mini-os/lib/math.c @@ -424,16 +424,3 @@ __moddi3(quad_t a, quad_t b) (void)__qdivrem(ua, ub, &ur); return (neg ? -ur : ur); } - -#ifndef HAVE_LIBC -/* Should be random enough for our uses */ -int rand(void) -{ - static unsigned int previous; - struct timeval tv; - gettimeofday(&tv, NULL); - previous += tv.tv_sec + tv.tv_usec; - previous *= RAND_MIX; - return previous; -} -#endif diff --git a/extras/mini-os/test.c b/extras/mini-os/test.c index 64a4057..154af49 100644 --- a/extras/mini-os/test.c +++ b/extras/mini-os/test.c @@ -60,6 +60,19 @@ static void xenbus_tester(void *p) } #endif +#ifndef HAVE_LIBC +/* Should be random enough for our uses */ +int rand(void) +{ + static unsigned int previous; + struct timeval tv; + gettimeofday(&tv, NULL); + previous += tv.tv_sec + tv.tv_usec; + previous *= RAND_MIX; + return previous; +} +#endif + static void periodic_thread(void *p) { struct timeval tv; -- 2.0.3