Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 1 Oct 2002 23:29:27 +0800 (NKZS)
From:      Eugene Grosbein <eugen@grosbein.pp.ru>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   alpha/43561: kern_shutdown.c uses time_t as 'long int' that's not true for alpha
Message-ID:  <200210011529.g91FTRTT046585@alpha.svzserv.kemerovo.su>

next in thread | raw e-mail | index | archive | help

>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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200210011529.g91FTRTT046585>