Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-7]: src/sys/compat/common Pull up following revision(s) (requeste...



details:   https://anonhg.NetBSD.org/src/rev/79c207f3291b
branches:  netbsd-7
changeset: 799956:79c207f3291b
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Sat Aug 27 15:10:59 2016 +0000

description:
Pull up following revision(s) (requested by mrg in ticket #1240):
        sys/compat/common/vfs_syscalls_43.c: revision 1.58
fill in the tv_nsec parts of the converted timespec in cvtstat().

diffstat:

 sys/compat/common/vfs_syscalls_43.c |  37 ++++++++++++++++++++++++++++++++-----
 1 files changed, 32 insertions(+), 5 deletions(-)

diffs (74 lines):

diff -r 85d6dead2e1a -r 79c207f3291b sys/compat/common/vfs_syscalls_43.c
--- a/sys/compat/common/vfs_syscalls_43.c       Sat Aug 27 15:09:22 2016 +0000
+++ b/sys/compat/common/vfs_syscalls_43.c       Sat Aug 27 15:10:59 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_syscalls_43.c,v 1.56 2014/01/28 01:29:04 christos Exp $    */
+/*     $NetBSD: vfs_syscalls_43.c,v 1.56.4.1 2016/08/27 15:10:59 bouyer Exp $  */
 
 /*
  * Copyright (c) 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_43.c,v 1.56 2014/01/28 01:29:04 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_43.c,v 1.56.4.1 2016/08/27 15:10:59 bouyer Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -75,15 +75,42 @@
 #include <compat/common/compat_util.h>
 #include <compat/common/compat_mod.h>
 
+static void cvttimespec(struct timespec *, struct timespec50 *);
 static void cvtstat(struct stat *, struct stat43 *);
 
 /*
+ * Convert from an old to a new timespec structure.
+ */
+static void
+cvttimespec(struct timespec *ts, struct timespec50 *ots)
+{
+
+       if (ts->tv_sec > INT_MAX) {
+#if defined(DEBUG) || 1
+               static bool first = true;
+
+               if (first) {
+                       first = false;
+                       printf("%s[%s:%d]: time_t does not fit\n",
+                           __func__, curlwp->l_proc->p_comm,
+                           curlwp->l_lid);
+               }
+#endif
+               ots->tv_sec = INT_MAX;
+       } else
+               ots->tv_sec = ts->tv_sec;
+       ots->tv_nsec = ts->tv_nsec;
+}
+
+/*
  * Convert from an old to a new stat structure.
  */
 static void
 cvtstat(struct stat *st, struct stat43 *ost)
 {
 
+       /* Handle any padding. */
+       memset(ost, 0, sizeof *ost);
        ost->st_dev = st->st_dev;
        ost->st_ino = st->st_ino;
        ost->st_mode = st->st_mode & 0xffff;
@@ -95,9 +122,9 @@
                ost->st_size = st->st_size;
        else
                ost->st_size = -2;
-       ost->st_atime = st->st_atime;
-       ost->st_mtime = st->st_mtime;
-       ost->st_ctime = st->st_ctime;
+       cvttimespec(&st->st_atimespec, &ost->st_atimespec);
+       cvttimespec(&st->st_mtimespec, &ost->st_mtimespec);
+       cvttimespec(&st->st_ctimespec, &ost->st_ctimespec);
        ost->st_blksize = st->st_blksize;
        ost->st_blocks = st->st_blocks;
        ost->st_flags = st->st_flags;



Home | Main Index | Thread Index | Old Index