From 09c00166e46fe394db30efb6fc982761b2fb7b82 Mon Sep 17 00:00:00 2001 From: Tom Rhodes Date: Sat, 24 Dec 2005 22:22:17 +0000 Subject: [PATCH] Make tv_sec a time_t on all platforms but alpha. Brings us more in line with POSIX. This also makes the struct correct we ever implement an i386-time64 architecture. Not that we need too. Reviewed by: imp, brooks Approved by: njl (acpica), des (no objects, touches procfs) Tested with: make universe --- libexec/bootpd/bootpd.c | 5 +++-- sys/dev/acpica/Osd/OsdSynch.c | 4 ++-- sys/dev/firewire/sbp.c | 4 ++-- sys/fs/procfs/procfs_status.c | 8 ++++---- sys/sys/_timeval.h | 6 +++++- 5 files changed, 16 insertions(+), 11 deletions(-) diff --git a/libexec/bootpd/bootpd.c b/libexec/bootpd/bootpd.c index 239b26780a7c..b0a49b5cea9a 100644 --- a/libexec/bootpd/bootpd.c +++ b/libexec/bootpd/bootpd.c @@ -67,6 +67,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #ifdef NO_SETSID # include /* for O_RDONLY, etc */ @@ -535,8 +536,8 @@ main(argc, argv) } if (!FD_ISSET(s, &readfds)) { if (debug > 1) - report(LOG_INFO, "exiting after %ld minutes of inactivity", - actualtimeout.tv_sec / 60); + report(LOG_INFO, "exiting after %jd minutes of inactivity", + (intmax_t)actualtimeout.tv_sec / 60); exit(0); } ra_len = sizeof(recv_addr); diff --git a/sys/dev/acpica/Osd/OsdSynch.c b/sys/dev/acpica/Osd/OsdSynch.c index 659b6fb91fd7..6cc6bcf65416 100644 --- a/sys/dev/acpica/Osd/OsdSynch.c +++ b/sys/dev/acpica/Osd/OsdSynch.c @@ -257,8 +257,8 @@ AcpiOsWaitSemaphore(ACPI_HANDLE Handle, UINT32 Units, UINT16 Timeout) tmo = 1; if (acpi_semaphore_debug) { - printf("%s: Wakeup timeleft(%lu, %lu), tmo %u, sem %p, thread %d\n", - __func__, timelefttv.tv_sec, timelefttv.tv_usec, tmo, as, + printf("%s: Wakeup timeleft(%jd, %lu), tmo %u, sem %p, thread %d\n", + __func__, (intmax_t)timelefttv.tv_sec, timelefttv.tv_usec, tmo, as, AcpiOsGetThreadId()); } } diff --git a/sys/dev/firewire/sbp.c b/sys/dev/firewire/sbp.c index c2f8e4f23a57..51e93c9153ff 100644 --- a/sys/dev/firewire/sbp.c +++ b/sys/dev/firewire/sbp.c @@ -698,8 +698,8 @@ sbp_login(struct sbp_dev *sdev) if (t.tv_sec >= 0 && t.tv_usec > 0) ticks = (t.tv_sec * 1000 + t.tv_usec / 1000) * hz / 1000; SBP_DEBUG(0) - printf("%s: sec = %ld usec = %ld ticks = %d\n", __func__, - t.tv_sec, t.tv_usec, ticks); + printf("%s: sec = %jd usec = %ld ticks = %d\n", __func__, + (intmax_t)t.tv_sec, t.tv_usec, ticks); END_DEBUG callout_reset(&sdev->login_callout, ticks, sbp_login_callout, (void *)(sdev)); diff --git a/sys/fs/procfs/procfs_status.c b/sys/fs/procfs/procfs_status.c index 1579037166b2..95f2b1792616 100644 --- a/sys/fs/procfs/procfs_status.c +++ b/sys/fs/procfs/procfs_status.c @@ -132,10 +132,10 @@ procfs_doprocstatus(PFS_FILL_ARGS) calcru(p, &ut, &st); start = p->p_stats->p_start; timevaladd(&start, &boottime); - sbuf_printf(sb, " %ld,%ld %ld,%ld %ld,%ld", - start.tv_sec, start.tv_usec, - ut.tv_sec, ut.tv_usec, - st.tv_sec, st.tv_usec); + sbuf_printf(sb, " %jd,%ld %jd,%ld %jd,%ld", + (intmax_t)start.tv_sec, start.tv_usec, + (intmax_t)ut.tv_sec, ut.tv_usec, + (intmax_t)st.tv_sec, st.tv_usec); } else { sbuf_printf(sb, " -1,-1 -1,-1 -1,-1"); } diff --git a/sys/sys/_timeval.h b/sys/sys/_timeval.h index d9ea6f5edbdd..2a51d2fa944a 100644 --- a/sys/sys/_timeval.h +++ b/sys/sys/_timeval.h @@ -45,7 +45,11 @@ typedef __time_t time_t; * Structure returned by gettimeofday(2) system call, and used in other calls. */ struct timeval { - long tv_sec; /* seconds (XXX should be time_t) */ +#ifdef __alpha__ + long tv_sec; /* seconds */ +#else + time_t tv_sec; /* seconds */ +#endif suseconds_t tv_usec; /* and microseconds */ };