From owner-freebsd-sparc64@FreeBSD.ORG Mon Oct 13 11:19:10 2003 Return-Path: Delivered-To: freebsd-sparc64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 370E116A4B3; Mon, 13 Oct 2003 11:19:10 -0700 (PDT) Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id 22BED43F93; Mon, 13 Oct 2003 11:19:05 -0700 (PDT) (envelope-from bde@zeta.org.au) Received: from gamplex.bde.org (katana.zip.com.au [61.8.7.246]) by mailman.zeta.org.au (8.9.3p2/8.8.7) with ESMTP id EAA09624; Tue, 14 Oct 2003 04:18:56 +1000 Date: Tue, 14 Oct 2003 04:17:34 +1000 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: Harti Brandt In-Reply-To: <20031013153219.H45269@beagle.fokus.fraunhofer.de> Message-ID: <20031014035805.F32262@gamplex.bde.org> References: <20031013153219.H45269@beagle.fokus.fraunhofer.de> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: standards@freebsd.org cc: sparc64@freebsd.org Subject: Re: time_t on sparc64 X-BeenThere: freebsd-sparc64@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting FreeBSD to the Sparc List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Oct 2003 18:19:10 -0000 On Mon, 13 Oct 2003, Harti Brandt wrote: > I just discovered that time_t is 32-bit on sparc64. One of the problems > is that struct timeval is defined by Posix as > > struct timeval { > time_t tv_secs; > suseconds_t tv_usecs; > }; This is a bug in POSIX. In BSD, tv_secs has type long which may be, and is different from time_t. > but _timeval.h has > > struct timeval { > long tv_secs; > suseconds_t tv_usecs; > } > > This means, that our timeval is not Posix compatible. What is the reason > for time_t not beeing a long on sparc64? time_t was used in some data structures whose layout shouldn't be changed even for new arches. Mainly in ufs in Lite2: %%% ffs/fs.h: time_t fs_time; /* last time written */ ffs/fs.h: time_t cg_time; /* time last written */ ffs/fs.h: time_t cg_time; /* time last written */ lfs/lfs.h: time_t bi_segcreate; /* origin segment create time */ ufs/quota.h: time_t dqb_btime; /* time limit for excessive disk use */ ufs/quota.h: time_t dqb_itime; /* time limit for excessive files */ %%% These are now: %%% ffs/fs.h: int32_t fs_old_time; /* last time written */ ffs/fs.h: ufs_time_t fs_time; /* last time written */ ffs/fs.h: int32_t cg_old_time; /* time last written */ ffs/fs.h: ufs_time_t cg_time; /* time last written */ /dev/null: time_t bi_segcreate; /* origin segment create time */ ufs/quota.h: int32_t dqb_btime; /* time limit for excessive disk use */ ufs/quota.h: int32_t dqb_itime; /* time limit for excessive files */ %%% I.e., int32_t is now not mispelled time_t in f^Hufs1 and Y2.038K bugs are fixed in ffs2 except for quotas. ffs2 also parametrizes timestamps in inodes better: %%% ufs/dinode.h:typedef int64_t ufs_time_t; ufs/dinode.h: ufs_time_t di_atime; /* 32: Last access time. */ ufs/dinode.h: ufs_time_t di_mtime; /* 40: Last modified time. */ ufs/dinode.h: ufs_time_t di_ctime; /* 48: Last inode change time. */ ufs/dinode.h: ufs_time_t di_birthtime; /* 56: Inode creation time. */ ufs/dinode.h: int32_t di_mtimensec; /* 64: Last modified time. */ ufs/dinode.h: int32_t di_atimensec; /* 68: Last access time. */ ufs/dinode.h: int32_t di_ctimensec; /* 72: Last inode change time. */ ufs/dinode.h: int32_t di_birthnsec; /* 76: Inode creation time. */ [Note that these aren't in a timespec struct, POSIX or otherwise, since the struct would give MD packing which happens to be inefficient in most cases.] ufs/dinode.h: int32_t di_atime; /* 16: Last access time. */ ufs/dinode.h: int32_t di_atimensec; /* 20: Last access time. */ ufs/dinode.h: int32_t di_mtime; /* 24: Last modified time. */ ufs/dinode.h: int32_t di_mtimensec; /* 28: Last modified time. */ ufs/dinode.h: int32_t di_ctime; /* 32: Last inode change time. */ ufs/dinode.h: int32_t di_ctimensec; /* 36: Last inode change time. */ [Y2.038K bugs are still in ffs1.] %%% To change time_t to 64 bits, all in-use non-transient data structures need to be changed similarly. Bruce