Patch for FreeBSD 32bit running on 64bit for futimes for review

From: Doug Ambrisko <ambrisko_at_ambrisko.com>
Date: Thu, 8 Dec 2005 11:43:09 -0800 (PST)
I'm looking for a review of fixing futimes when running on FreeBSD/i386
binary on FreeBSD/amd64.  The problem is that tar uses this to set
the time on files it is extracting.  Without this shim the dates
are messed up Jan 1 1970.  This breaks a ports build of i386 on
amd64 in a i386 chroot.

Index: sys/compat/freebsd32/freebsd32_misc.c
===================================================================
RCS file: /usr/local/cvsroot/freebsd/src/sys/compat/freebsd32/freebsd32_misc.c,v
retrieving revision 1.38.2.1
diff -u -p -r1.38.2.1 freebsd32_misc.c
--- sys/compat/freebsd32/freebsd32_misc.c	18 Jul 2005 19:49:48 -0000	1.38.2.1
+++ sys/compat/freebsd32/freebsd32_misc.c	8 Dec 2005 18:26:54 -0000
_at__at_ -846,6 +846,28 _at__at_ freebsd32_utimes(struct thread *td, stru
 }
 
 int
+freebsd32_futimes(struct thread *td, struct freebsd32_futimes_args *uap)
+{
+	struct timeval32 s32[2];
+	struct timeval s[2], *sp;
+	int error;
+
+	if (uap->tptr != NULL) {
+		error = copyin(uap->tptr, s32, sizeof(s32));
+		if (error)
+			return (error);
+		CP(s32[0], s[0], tv_sec);
+		CP(s32[0], s[0], tv_usec);
+		CP(s32[1], s[1], tv_sec);
+		CP(s32[1], s[1], tv_usec);
+		sp = s;
+	} else
+		sp = NULL;
+	return (kern_futimes(td, uap->fd, sp, UIO_SYSSPACE));
+}
+
+
+int
 freebsd32_adjtime(struct thread *td, struct freebsd32_adjtime_args *uap)
 {
 	struct timeval32 tv32;
Index: sys/compat/freebsd32/syscalls.master
===================================================================
RCS file: /usr/local/cvsroot/freebsd/src/sys/compat/freebsd32/syscalls.master,v
retrieving revision 1.50.2.1
diff -u -p -r1.50.2.1 syscalls.master
--- sys/compat/freebsd32/syscalls.master	20 Jul 2005 17:42:15 -0000	1.50.2.1
+++ sys/compat/freebsd32/syscalls.master	8 Dec 2005 18:26:55 -0000
_at__at_ -366,7 +366,8 _at__at_
 204	AUE_NULL	MNOPROTO { int munlock(const void *addr, \
 				    size_t len); }
 205	AUE_NULL	MNOPROTO	{ int undelete(char *path); }
-206	AUE_NULL	MNOPROTO	{ int futimes(int fd, struct timeval *tptr); }
+206	AUE_NULL	MSTD	{ int freebsd32_futimes(int fd, \
+				    struct timeval32 *tptr); }
 207	AUE_NULL	MNOPROTO { int getpgid(pid_t pid); }
 208	AUE_NULL	UNIMPL	newreboot (NetBSD)
 209	AUE_NULL	MNOPROTO { int poll(struct pollfd *fds, u_int nfds, \

If this is correct, then it looks like I commit this then commit
the generated files after.

Thanks,

Doug A.
Received on Thu Dec 08 2005 - 18:43:35 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:48 UTC