From patchwork Thu Mar 28 18:31:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Crowe X-Patchwork-Id: 1068573 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-100972-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=mcrowe.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="gY52Hs/r"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44VYPc6gggz9sPC for ; Fri, 29 Mar 2019 05:32:20 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; q=dns; s=default; b=jj9PnM+u ZQOqq0gGevTcURwvJIt6tgXwaKxFGwAsOqvzl81O9BU1Q+9E6lT+6MZektcb78zN rhnCMj8FQhRC4Lyt9BfgEzYVfy2mZ9e9WyCCURpW5Owsctbc724BthxLo30Nzk6u 6YqEa9NaUX+jy7ExJKsuRF1NyNwc96Gdvqo= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; s=default; bh=ElMiu2jC72eaRM knPp5DrNhGKt4=; b=gY52Hs/rO/o+hEXa8AZddIVtV6g6OXVcryHCs68AoAqqQa Cg30oV6lhDYz5aGVGRgNzu0fD+mrrR/bgo04d0IeGAwALIjadrFuQoN/cOAELjGx ufM5usQ6y8GbwRKPDNhcmRsdMxV7OV4jNp5IOBfI6A3tSS0f8EnkGI2Q90YOw= Received: (qmail 63999 invoked by alias); 28 Mar 2019 18:31:37 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 63941 invoked by uid 89); 28 Mar 2019 18:31:37 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 spammy=distributed X-HELO: avasout02.plus.net X-CM-Score: 0.00 From: Mike Crowe To: libc-alpha@sourceware.org Cc: Mike Crowe Subject: [PATCH 1/6] support: Add xclock_gettime Date: Thu, 28 Mar 2019 18:31:07 +0000 Message-Id: <120a887625ceeca4b06ee73d4af08827ec68ecde.1553797867.git-series.mac@mcrowe.com> In-Reply-To: References: In-Reply-To: References: * support/xclock_gettime.c (xclock_gettime): New file. Provide clock_gettime wrapper for use in tests that fails the test rather than returning failure. * support/xtime.h: New file to declare xclock_gettime. * support/Makefile: Add xclock_gettime.c. Reviewed-by: Adhemerval Zanella --- ChangeLog | 10 ++++++++++ support/Makefile | 1 + support/xclock_gettime.c | 28 ++++++++++++++++++++++++++++ support/xtime.h | 33 +++++++++++++++++++++++++++++++++ 4 files changed, 72 insertions(+) create mode 100644 support/xclock_gettime.c create mode 100644 support/xtime.h diff --git a/ChangeLog b/ChangeLog index 19d3e90..ff4dabd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2019-03-28 Mike Crowe + + * support/xclock_gettime.c (xclock_gettime): New file. Provide + clock_gettime wrapper for use in tests that fails the test rather + than returning failure. + + * support/xtime.h: New file to declare xclock_gettime. + + * support/Makefile: Add xclock_gettime.c. + 2019-03-26 Adhemerval Zanella * math/math.h (fpclassify, isfinite, isnormal, isnan): Use builtin for diff --git a/support/Makefile b/support/Makefile index f173565..1d37f70 100644 --- a/support/Makefile +++ b/support/Makefile @@ -77,6 +77,7 @@ libsupport-routines = \ xbind \ xcalloc \ xchroot \ + xclock_gettime \ xclose \ xconnect \ xcopy_file_range \ diff --git a/support/xclock_gettime.c b/support/xclock_gettime.c new file mode 100644 index 0000000..a0d4ee6 --- /dev/null +++ b/support/xclock_gettime.c @@ -0,0 +1,28 @@ +/* clock_gettime with error checking. + Copyright (C) 2019 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include + +void +xclock_gettime (clockid_t clockid, + struct timespec *ts) +{ + xpthread_check_return + ("clock_gettime", clock_gettime (clockid, ts)); +} diff --git a/support/xtime.h b/support/xtime.h new file mode 100644 index 0000000..68af1a5 --- /dev/null +++ b/support/xtime.h @@ -0,0 +1,33 @@ +/* Support functionality for using time. + Copyright (C) 2019 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef SUPPORT_TIME_H +#define SUPPORT_TIME_H + +#include + +__BEGIN_DECLS + +/* The following functions call the corresponding libc functions and + terminate the process on error. */ + +void xclock_gettime (clockid_t clock, struct timespec *ts); + +__END_DECLS + +#endif /* SUPPORT_TIME_H */