From owner-freebsd-alpha Tue Oct 1 8:30:11 2002 Delivered-To: freebsd-alpha@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8378637B401 for ; Tue, 1 Oct 2002 08:30:07 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 619AF43E81 for ; Tue, 1 Oct 2002 08:30:06 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id g91FU6Co057404 for ; Tue, 1 Oct 2002 08:30:06 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id g91FU6Q3057403; Tue, 1 Oct 2002 08:30:06 -0700 (PDT) Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7D44537B401 for ; Tue, 1 Oct 2002 08:29:45 -0700 (PDT) Received: from alpha.svzserv.kemerovo.su (alpha.svzserv.kemerovo.su [213.184.65.85]) by mx1.FreeBSD.org (Postfix) with ESMTP id 421EE43E42 for ; Tue, 1 Oct 2002 08:29:43 -0700 (PDT) (envelope-from sa@alpha.svzserv.kemerovo.su) Received: from alpha.svzserv.kemerovo.su (localhost [127.0.0.1]) by alpha.svzserv.kemerovo.su (8.12.5/8.12.5) with ESMTP id g91FTSYk046586 for ; Tue, 1 Oct 2002 23:29:28 +0800 (NKZS) (envelope-from sa@alpha.svzserv.kemerovo.su) Received: (from root@localhost) by alpha.svzserv.kemerovo.su (8.12.5/8.12.5/Submit) id g91FTRTT046585; Tue, 1 Oct 2002 23:29:27 +0800 (NKZS) Message-Id: <200210011529.g91FTRTT046585@alpha.svzserv.kemerovo.su> Date: Tue, 1 Oct 2002 23:29:27 +0800 (NKZS) From: Eugene Grosbein To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: alpha/43561: kern_shutdown.c uses time_t as 'long int' that's not true for alpha Sender: owner-freebsd-alpha@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 43561 >Category: alpha >Synopsis: kern_shutdown.c uses time_t as 'long int' that's not true for alpha >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-alpha >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Tue Oct 01 08:30:04 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Eugene Grosbein >Release: FreeBSD 4.6-STABLE alpha >Organization: Svyaz Service JSC >Environment: System: FreeBSD alpha.svzserv.kemerovo.su 4.6-STABLE FreeBSD 4.6-STABLE #0: Tue Aug 20 11:41:08 NKZS 2002 sa@alpha.svzserv.kemerovo.su:/mnt/.2/obj/usr/src/sys/ALPHA alpha >Description: print_uptime() in src/sys/kern/kern_shutdown.c uses %ld format string to print time_t, that's correct for i386 where time_t is long and incorrect for alpha where time_t is int. >How-To-Repeat: Build kernel for alpha, watch warnings for kern_shutdown.c >Fix: Apply next patch to src/sys/kern/kern_shutdown.c --- kern_shutdown.c.orig Tue Oct 1 22:50:38 2002 +++ kern_shutdown.c Tue Oct 1 23:22:21 2002 @@ -172,6 +172,14 @@ static int waittime = -1; static struct pcb dumppcb; +#ifndef TIME_T_FORMAT +#ifdef __alpha__ +#define TIME_T_FORMAT "%d" +#else +#define TIME_T_FORMAT "%ld" +#endif +#endif + static void print_uptime() { @@ -182,21 +190,21 @@ printf("Uptime: "); f = 0; if (ts.tv_sec >= 86400) { - printf("%ldd", ts.tv_sec / 86400); + printf(TIME_T_FORMAT "d", ts.tv_sec / 86400); ts.tv_sec %= 86400; f = 1; } if (f || ts.tv_sec >= 3600) { - printf("%ldh", ts.tv_sec / 3600); + printf(TIME_T_FORMAT "h", ts.tv_sec / 3600); ts.tv_sec %= 3600; f = 1; } if (f || ts.tv_sec >= 60) { - printf("%ldm", ts.tv_sec / 60); + printf(TIME_T_FORMAT "m", ts.tv_sec / 60); ts.tv_sec %= 60; f = 1; } - printf("%lds\n", ts.tv_sec); + printf(TIME_T_FORMAT "s\n", ts.tv_sec); } /* Eugene Grosbein >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-alpha" in the body of the message