From patchwork Thu Mar 12 17:24:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 45739 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4C239214BF for ; Thu, 12 Mar 2015 17:24:12 +0000 (UTC) Received: by wivz2 with SMTP id z2sf13464369wiv.1 for ; Thu, 12 Mar 2015 10:24:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=71+lovLjI8DYz0jN12tK7u2QxXmQ8v80KyzvQtE3aMw=; b=NNVoPQDqBZpBKbGxkXqzKydSFEBrbpNG6UX4qhvdcYHfKyhOrW3hSc5T2nJY2OkpjW C53Slx/mu/Vnug8xNXi81K8259Mk1TpV6wQVry8hVxPyE2Eoe0q32/PAU3k3Z4jmn3fq e12DhVSr5tN6Jg0qNkZbkpVZYh/Rn/mOz82MMyyX5rJ24rT2iuDtmd9HL532I7EkAcea WsfdDVBfW1V16CFJa0xnmcfrreSonE4fd1JUWjL8mpdU77Hx0xLOg8WMmaR3wIiKYrck Jv/Vv1TdxVH7eKXHFHk/aLJ+QTQGZeG7XZC9d5JEcz9O1EKI00aK6vnZlYgw6XhYMPoU +DMw== X-Gm-Message-State: ALoCoQlo0z82JOcJXug4Uo8RqHKKbylDUpRAd6iO06QwumoTkg73LJbot9PmhJG8xjon8OIhS4Jc X-Received: by 10.152.45.7 with SMTP id i7mr6544475lam.9.1426181051503; Thu, 12 Mar 2015 10:24:11 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.18.225 with SMTP id z1ls313380lad.109.gmail; Thu, 12 Mar 2015 10:24:11 -0700 (PDT) X-Received: by 10.112.41.236 with SMTP id i12mr11532163lbl.14.1426181051355; Thu, 12 Mar 2015 10:24:11 -0700 (PDT) Received: from mail-la0-f46.google.com (mail-la0-f46.google.com. [209.85.215.46]) by mx.google.com with ESMTPS id ar8si4899809lbc.48.2015.03.12.10.24.11 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Mar 2015 10:24:11 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.46 as permitted sender) client-ip=209.85.215.46; Received: by labgd6 with SMTP id gd6so17376716lab.3 for ; Thu, 12 Mar 2015 10:24:11 -0700 (PDT) X-Received: by 10.112.181.41 with SMTP id dt9mr41008457lbc.56.1426181050984; Thu, 12 Mar 2015 10:24:10 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.35.133 with SMTP id h5csp372773lbj; Thu, 12 Mar 2015 10:24:09 -0700 (PDT) X-Received: by 10.66.224.164 with SMTP id rd4mr91456842pac.12.1426181048984; Thu, 12 Mar 2015 10:24:08 -0700 (PDT) Received: from mail-pd0-f169.google.com (mail-pd0-f169.google.com. [209.85.192.169]) by mx.google.com with ESMTPS id td9si788640pac.213.2015.03.12.10.24.07 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Mar 2015 10:24:08 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.192.169 as permitted sender) client-ip=209.85.192.169; Received: by pdev10 with SMTP id v10so21604655pde.13 for ; Thu, 12 Mar 2015 10:24:07 -0700 (PDT) X-Received: by 10.70.54.103 with SMTP id i7mr30547710pdp.114.1426181047504; Thu, 12 Mar 2015 10:24:07 -0700 (PDT) Received: from localhost.localdomain (c-67-170-153-23.hsd1.or.comcast.net. [67.170.153.23]) by mx.google.com with ESMTPSA id os6sm11949379pac.28.2015.03.12.10.24.06 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 12 Mar 2015 10:24:06 -0700 (PDT) From: John Stultz To: lkml Cc: John Stultz , Arnd Bergmann , Andrew Morton , Cyrill Gorcunov , Serge Hallyn , Dave Hansen , Thomas Gleixner , Alex Thorlton , "vishnu.ps" Subject: [RFC][PATCH] sysinfo: Use timespec64 accessors for calculating uptime Date: Thu, 12 Mar 2015 10:24:03 -0700 Message-Id: <1426181043-2453-1-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.9.1 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: john.stultz@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.46 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , As part of the y2038 effort, convert sysinfo's uptime calculation to use the timespec64 based accessor. Uptime isn't likely to ever exceed a s32, so this doesn't actually bring much in the way of change, but it is done for consistency sake as we deprecate 32bit internal interfaces. Cc: Arnd Bergmann Cc: Andrew Morton Cc: Cyrill Gorcunov Cc: Serge Hallyn Cc: Dave Hansen Cc: Thomas Gleixner Cc: Alex Thorlton Cc: "vishnu.ps" Signed-off-by: John Stultz --- kernel/sys.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/kernel/sys.c b/kernel/sys.c index a03d9cd..6d2d700 100644 --- a/kernel/sys.c +++ b/kernel/sys.c @@ -2260,12 +2260,16 @@ static int do_sysinfo(struct sysinfo *info) { unsigned long mem_total, sav_total; unsigned int mem_unit, bitcount; - struct timespec tp; + struct timespec64 tp; memset(info, 0, sizeof(struct sysinfo)); - get_monotonic_boottime(&tp); - info->uptime = tp.tv_sec + (tp.tv_nsec ? 1 : 0); + get_monotonic_boottime64(&tp); + /* + * y2038: uptime is unlikely to ever grow beyond an s32 + * so this cast to a long shouldn't be an issue. + */ + info->uptime = (long)tp.tv_sec + (tp.tv_nsec ? 1 : 0); get_avenrun(info->loads, 0, SI_LOAD_SHIFT - FSHIFT);