From patchwork Thu Oct 15 13:06:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 40731 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 26FA5394D8A3; Thu, 15 Oct 2020 13:06:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 26FA5394D8A3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1602767205; bh=vUpOrQvELV7k3PmF8nZ3QRX239mYuSBacphdhInj+ec=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=tM8TBeN/oNKy4xebJ7eBv6t22Y358BbI4c5WH1E0T375SUe+6cb3rCsiKEOOiCvUe nDtbwliMR7MAHbumwdDTGsLrQ3zTAWVo2/hXznTiO8tesSTHK8i+TmlbrgXSoBYK7V 3aWLFSVNB8eIjtcxkmdn8kuWO69+51xU1vIkKzM4= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qk1-x72e.google.com (mail-qk1-x72e.google.com [IPv6:2607:f8b0:4864:20::72e]) by sourceware.org (Postfix) with ESMTPS id 7A7A5386F009 for ; Thu, 15 Oct 2020 13:06:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 7A7A5386F009 Received: by mail-qk1-x72e.google.com with SMTP id x20so2271079qkn.1 for ; Thu, 15 Oct 2020 06:06:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vUpOrQvELV7k3PmF8nZ3QRX239mYuSBacphdhInj+ec=; b=V3CLczfd6cs6LsMk5ulHMWYBI+HbbCfsmiL/Ony1bEAI3H68NDi1ptV1WbxZ3c3J/O jwG8uy40umUy6sjnZ1/xDgaGrQLUhydDocAnyDkkgXmsm38apAAeU8mzI+EzPX0dQTFG OsWtOPQpppJ1aXd4in/hGrpEkxue3FOGDKkBoc+KWXQZEUrwz4DC/3QqZi7AjnXw52gt ugNEFJOIrd9QJ95rBNv4eCab+N4jMPVlSyeHhTQ74bID/C12+LZQw5cHZAFog/65YOve IxOjue88LjE8vnWrPts6TYcButnEgRrAd/v9SrKTFSJyyyy4F48bpIhgIhZUEXLVL9yN OncA== X-Gm-Message-State: AOAM531SuE5iVMZuVN46EiNrcRNKQbkWMFRT08kXb/b+dvXkQKy4TBF9 zoEBnphcpfJk8Pnh0X3Bg4PmMjX4FHur0w== X-Google-Smtp-Source: ABdhPJwpjCaRtyn2g4F4cVUbEh/2it1yKD7ZsSpGWnyvHiV2k+Q/Tj7JvnlfFDSx2Xup8jijAGuXfg== X-Received: by 2002:ae9:eb0e:: with SMTP id b14mr3841588qkg.39.1602767201746; Thu, 15 Oct 2020 06:06:41 -0700 (PDT) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id 6sm1093648qtz.31.2020.10.15.06.06.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Oct 2020 06:06:41 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 3/3] linux: Add 64-bit time_t support for wait3 Date: Thu, 15 Oct 2020 10:06:32 -0300 Message-Id: <20201015130632.90961-3-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201015130632.90961-1-adhemerval.zanella@linaro.org> References: <20201015130632.90961-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-13.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" It basically calls the 64-bit time_t wait4 internal symbol. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Alistair Francis Reviewed-by: Lukasz Majewski --- include/sys/resource.h | 4 +++ sysdeps/unix/sysv/linux/wait3.c | 44 +++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 sysdeps/unix/sysv/linux/wait3.c diff --git a/include/sys/resource.h b/include/sys/resource.h index 64925f257c..2235b020fc 100644 --- a/include/sys/resource.h +++ b/include/sys/resource.h @@ -138,12 +138,16 @@ libc_hidden_proto (__setrlimit); #if __TIMESIZE == 64 # define __getrusage64 __getrusage # define __wait4_time64 __wait4 +# define __wait3_time64 __wait3 #else extern int __getrusage64 (enum __rusage_who who, struct __rusage64 *usage); libc_hidden_proto (__getrusage64) extern pid_t __wait4_time64 (pid_t pid, int *stat_loc, int options, struct __rusage64 *usage); libc_hidden_proto (__wait4_time64) +extern pid_t __wait3_time64 (int *stat_loc, int options, + struct __rusage64 *usage); +libc_hidden_proto (__wait3_time64) #endif #endif #endif diff --git a/sysdeps/unix/sysv/linux/wait3.c b/sysdeps/unix/sysv/linux/wait3.c new file mode 100644 index 0000000000..c05776f7ab --- /dev/null +++ b/sysdeps/unix/sysv/linux/wait3.c @@ -0,0 +1,44 @@ +/* Wait for process to change state, BSD style. Linux version. + Copyright (C) 2020 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 +#include + +pid_t +__wait3_time64 (int *stat_loc, int options, struct __rusage64 *usage) +{ + return __wait4_time64 (WAIT_ANY, stat_loc, options, usage); +} +#if __TIMESIZE != 64 +libc_hidden_def (__wait3_time64) + +pid_t +__wait3 (int *stat_loc, int options, struct rusage *usage) +{ + struct __rusage64 usage64; + pid_t ret = __wait3_time64 (stat_loc, options, + usage != NULL ? &usage64 : NULL); + if (ret > 0 && usage != NULL) + rusage64_to_rusage (&usage64, usage); + + return ret; +} +#endif + +weak_alias (__wait3, wait3)