From owner-p4-projects@FreeBSD.ORG Tue Sep 30 22:08:40 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 57408106568C; Tue, 30 Sep 2008 22:08:40 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DAD281065689 for ; Tue, 30 Sep 2008 22:08:39 +0000 (UTC) (envelope-from peter-gmail@wemm.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id C7B7C8FC08 for ; Tue, 30 Sep 2008 22:08:39 +0000 (UTC) (envelope-from peter-gmail@wemm.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id m8UM8dAp046976 for ; Tue, 30 Sep 2008 22:08:39 GMT (envelope-from peter-gmail@wemm.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id m8UM8ddM046959 for perforce@freebsd.org; Tue, 30 Sep 2008 22:08:39 GMT (envelope-from peter-gmail@wemm.org) Date: Tue, 30 Sep 2008 22:08:39 GMT Message-Id: <200809302208.m8UM8ddM046959@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to peter-gmail@wemm.org using -f From: Peter Wemm To: Perforce Change Reviews Cc: Subject: PERFORCE change 150730 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Sep 2008 22:08:40 -0000 http://perforce.freebsd.org/chv.cgi?CH=150730 Change 150730 by peter@peter_overcee on 2008/09/30 22:08:18 IFC @150727 Affected files ... .. //depot/projects/hammer/bin/pkill/pkill.1#3 integrate .. //depot/projects/hammer/bin/pkill/pkill.c#3 integrate .. //depot/projects/hammer/lib/libarchive/archive_entry.c#36 integrate .. //depot/projects/hammer/lib/libarchive/archive_entry.h#26 integrate .. //depot/projects/hammer/lib/libarchive/archive_entry_copy_stat.c#2 integrate .. //depot/projects/hammer/lib/libarchive/archive_entry_private.h#6 integrate .. //depot/projects/hammer/lib/libarchive/archive_entry_stat.c#2 integrate .. //depot/projects/hammer/lib/libarchive/archive_read_support_format_tar.c#44 integrate .. //depot/projects/hammer/lib/libarchive/archive_write_disk.c#18 integrate .. //depot/projects/hammer/lib/libarchive/archive_write_set_format_pax.c#36 integrate .. //depot/projects/hammer/lib/libarchive/config_freebsd.h#11 integrate .. //depot/projects/hammer/lib/libarchive/test/Makefile#14 integrate .. //depot/projects/hammer/lib/libarchive/test/test_entry.c#6 integrate .. //depot/projects/hammer/lib/libarchive/test/test_write_disk.c#8 integrate .. //depot/projects/hammer/lib/libarchive/test/test_write_disk_times.c#1 branch .. //depot/projects/hammer/lib/libarchive/test/test_write_format_pax.c#1 branch .. //depot/projects/hammer/lib/libc/gen/getosreldate.3#4 integrate .. //depot/projects/hammer/sbin/bsdlabel/bsdlabel.c#24 integrate .. //depot/projects/hammer/sbin/fdisk/fdisk.c#23 integrate .. //depot/projects/hammer/share/examples/FreeBSD_version/FreeBSD_version.c#2 integrate .. //depot/projects/hammer/share/man/man4/wpi.4#3 integrate .. //depot/projects/hammer/sys/arm/at91/at91_mci.c#6 integrate .. //depot/projects/hammer/sys/dev/cxgb/cxgb_main.c#26 integrate .. //depot/projects/hammer/sys/dev/dc/dcphy.c#6 integrate .. //depot/projects/hammer/sys/dev/dc/pnphy.c#4 integrate .. //depot/projects/hammer/sys/dev/fatm/if_fatm.c#18 integrate .. //depot/projects/hammer/sys/dev/mii/ciphy.c#9 integrate .. //depot/projects/hammer/sys/dev/mii/e1000phy.c#14 integrate .. //depot/projects/hammer/sys/dev/mii/miidevs#27 integrate .. //depot/projects/hammer/sys/dev/mmc/mmcsd.c#5 integrate .. //depot/projects/hammer/sys/dev/msk/if_msk.c#13 integrate .. //depot/projects/hammer/sys/kern/uipc_socket.c#86 integrate .. //depot/projects/hammer/sys/net/if_lagg.c#17 integrate .. //depot/projects/hammer/usr.sbin/boot0cfg/boot0cfg.c#11 integrate Differences ... ==== //depot/projects/hammer/bin/pkill/pkill.1#3 (text+ko) ==== @@ -1,6 +1,6 @@ .\" $NetBSD: pkill.1,v 1.8 2003/02/14 15:59:18 grant Exp $ .\" -.\" $FreeBSD: src/bin/pkill/pkill.1,v 1.2 2008/09/28 16:44:15 ed Exp $ +.\" $FreeBSD: src/bin/pkill/pkill.1,v 1.3 2008/09/30 17:30:39 ed Exp $ .\" .\" Copyright (c) 2002 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -179,9 +179,10 @@ Restrict matches to processes associated with a terminal in the comma-separated list .Ar tty . -The -.Pa /dev/ -prefix of the terminal names must be omitted. +Terminal names may be of the form +.Pa tty Ns Ar xx +or the shortened form +.Ar xx . A single dash .Pq Ql - matches processes not associated with a terminal. ==== //depot/projects/hammer/bin/pkill/pkill.c#3 (text+ko) ==== @@ -38,7 +38,7 @@ */ #include -__FBSDID("$FreeBSD: src/bin/pkill/pkill.c,v 1.2 2008/09/28 16:44:15 ed Exp $"); +__FBSDID("$FreeBSD: src/bin/pkill/pkill.c,v 1.3 2008/09/30 17:30:39 ed Exp $"); #include #include @@ -675,16 +675,18 @@ } snprintf(buf, sizeof(buf), _PATH_DEV "%s", cp); + if (stat(buf, &st) != -1) + goto foundtty; + + snprintf(buf, sizeof(buf), _PATH_DEV "tty%s", cp); + if (stat(buf, &st) != -1) + goto foundtty; - if (stat(buf, &st) == -1) { - if (errno == ENOENT) { - errx(STATUS_BADUSAGE, - "No such tty: `%s'", sp); - } - err(STATUS_ERROR, "Cannot access `%s'", sp); - } + if (errno == ENOENT) + errx(STATUS_BADUSAGE, "No such tty: `%s'", sp); + err(STATUS_ERROR, "Cannot access `%s'", sp); - if ((st.st_mode & S_IFCHR) == 0) +foundtty: if ((st.st_mode & S_IFCHR) == 0) errx(STATUS_BADUSAGE, "Not a tty: `%s'", sp); li->li_number = st.st_rdev; ==== //depot/projects/hammer/lib/libarchive/archive_entry.c#36 (text+ko) ==== @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_entry.c,v 1.53 2008/09/01 04:54:29 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/archive_entry.c,v 1.54 2008/09/30 03:53:03 kientzle Exp $"); #ifdef HAVE_SYS_STAT_H #include @@ -461,6 +461,24 @@ } time_t +archive_entry_birthtime(struct archive_entry *entry) +{ + return (entry->ae_stat.aest_birthtime); +} + +long +archive_entry_birthtime_nsec(struct archive_entry *entry) +{ + return (entry->ae_stat.aest_birthtime_nsec); +} + +int +archive_entry_birthtime_is_set(struct archive_entry *entry) +{ + return (entry->ae_set & AE_SET_BIRTHTIME); +} + +time_t archive_entry_ctime(struct archive_entry *entry) { return (entry->ae_stat.aest_ctime); @@ -838,6 +856,22 @@ } void +archive_entry_set_birthtime(struct archive_entry *entry, time_t m, long ns) +{ + entry->stat_valid = 0; + entry->ae_set |= AE_SET_BIRTHTIME; + entry->ae_stat.aest_birthtime = m; + entry->ae_stat.aest_birthtime_nsec = ns; +} + +void +archive_entry_unset_birthtime(struct archive_entry *entry) +{ + archive_entry_set_birthtime(entry, 0, 0); + entry->ae_set &= ~AE_SET_BIRTHTIME; +} + +void archive_entry_set_ctime(struct archive_entry *entry, time_t t, long ns) { entry->stat_valid = 0; ==== //depot/projects/hammer/lib/libarchive/archive_entry.h#26 (text+ko) ==== @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/lib/libarchive/archive_entry.h,v 1.29 2008/09/18 04:19:06 kientzle Exp $ + * $FreeBSD: src/lib/libarchive/archive_entry.h,v 1.30 2008/09/30 03:53:03 kientzle Exp $ */ #ifndef ARCHIVE_ENTRY_H_INCLUDED @@ -174,6 +174,9 @@ __LA_DECL time_t archive_entry_atime(struct archive_entry *); __LA_DECL long archive_entry_atime_nsec(struct archive_entry *); __LA_DECL int archive_entry_atime_is_set(struct archive_entry *); +__LA_DECL time_t archive_entry_birthtime(struct archive_entry *); +__LA_DECL long archive_entry_birthtime_nsec(struct archive_entry *); +__LA_DECL int archive_entry_birthtime_is_set(struct archive_entry *); __LA_DECL time_t archive_entry_ctime(struct archive_entry *); __LA_DECL long archive_entry_ctime_nsec(struct archive_entry *); __LA_DECL int archive_entry_ctime_is_set(struct archive_entry *); @@ -224,6 +227,8 @@ __LA_DECL void archive_entry_set_atime(struct archive_entry *, time_t, long); __LA_DECL void archive_entry_unset_atime(struct archive_entry *); +__LA_DECL void archive_entry_set_birthtime(struct archive_entry *, time_t, long); +__LA_DECL void archive_entry_unset_birthtime(struct archive_entry *); __LA_DECL void archive_entry_set_ctime(struct archive_entry *, time_t, long); __LA_DECL void archive_entry_unset_ctime(struct archive_entry *); __LA_DECL void archive_entry_set_dev(struct archive_entry *, dev_t); ==== //depot/projects/hammer/lib/libarchive/archive_entry_copy_stat.c#2 (text+ko) ==== @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_entry_copy_stat.c,v 1.1 2007/05/29 01:00:18 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/archive_entry_copy_stat.c,v 1.2 2008/09/30 03:53:03 kientzle Exp $"); #ifdef HAVE_SYS_STAT_H #include @@ -47,6 +47,12 @@ archive_entry_set_atime(entry, st->st_atime, 0); archive_entry_set_ctime(entry, st->st_ctime, 0); archive_entry_set_mtime(entry, st->st_mtime, 0); +#if HAVE_STRUCT_STAT_ST_BIRTHTIME + archive_entry_set_birthtime(entry, st->st_birthtime, 0); +#endif +#endif +#if HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC + archive_entry_set_birthtime(entry, st->st_birthtime, st->st_birthtimespec.tv_nsec); #endif archive_entry_set_dev(entry, st->st_dev); archive_entry_set_gid(entry, st->st_gid); ==== //depot/projects/hammer/lib/libarchive/archive_entry_private.h#6 (text+ko) ==== @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/lib/libarchive/archive_entry_private.h,v 1.5 2008/09/01 04:54:29 kientzle Exp $ + * $FreeBSD: src/lib/libarchive/archive_entry_private.h,v 1.6 2008/09/30 03:53:03 kientzle Exp $ */ #ifndef ARCHIVE_ENTRY_PRIVATE_H_INCLUDED @@ -112,6 +112,8 @@ uint32_t aest_ctime_nsec; int64_t aest_mtime; uint32_t aest_mtime_nsec; + int64_t aest_birthtime; + uint32_t aest_birthtime_nsec; gid_t aest_gid; ino_t aest_ino; mode_t aest_mode; @@ -142,6 +144,7 @@ #define AE_SET_ATIME 4 #define AE_SET_CTIME 8 #define AE_SET_MTIME 16 +#define AE_SET_BIRTHTIME 32 #define AE_SET_SIZE 64 /* ==== //depot/projects/hammer/lib/libarchive/archive_entry_stat.c#2 (text+ko) ==== @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_entry_stat.c,v 1.1 2007/05/29 01:00:18 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/archive_entry_stat.c,v 1.2 2008/09/30 03:53:03 kientzle Exp $"); #ifdef HAVE_SYS_STAT_H #include @@ -64,6 +64,9 @@ * the appropriate conversions get invoked. */ st->st_atime = archive_entry_atime(entry); +#if HAVE_STRUCT_STAT_ST_BIRTHTIME + st->st_birthtime = archive_entry_birthtime(entry); +#endif st->st_ctime = archive_entry_ctime(entry); st->st_mtime = archive_entry_mtime(entry); st->st_dev = archive_entry_dev(entry); @@ -88,6 +91,9 @@ st->st_ctim.tv_nsec = archive_entry_ctime_nsec(entry); st->st_mtim.tv_nsec = archive_entry_mtime_nsec(entry); #endif +#if HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC + st->st_birthtimespec.tv_nsec = archive_entry_birthtime_nsec(entry); +#endif /* * TODO: On Linux, store 32 or 64 here depending on whether ==== //depot/projects/hammer/lib/libarchive/archive_read_support_format_tar.c#44 (text+ko) ==== @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_format_tar.c,v 1.70 2008/07/10 09:50:55 cperciva Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_format_tar.c,v 1.71 2008/09/30 03:57:07 kientzle Exp $"); #ifdef HAVE_ERRNO_H #include @@ -1451,6 +1451,10 @@ if (strcmp(key, "LIBARCHIVE.xxxxxxx")==0) archive_entry_set_xxxxxx(entry, value); */ + if (strcmp(key, "LIBARCHIVE.creationtime")==0) { + pax_time(value, &s, &n); + archive_entry_set_birthtime(entry, s, n); + } if (strncmp(key, "LIBARCHIVE.xattr.", 17)==0) pax_attribute_xattr(entry, key, value); break; ==== //depot/projects/hammer/lib/libarchive/archive_write_disk.c#18 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_disk.c,v 1.39 2008/09/14 05:51:25 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_disk.c,v 1.40 2008/09/30 04:02:36 kientzle Exp $"); #ifdef HAVE_SYS_TYPES_H #include @@ -96,10 +96,12 @@ struct fixup_entry { struct fixup_entry *next; mode_t mode; + int64_t atime; + int64_t birthtime; int64_t mtime; - int64_t atime; + unsigned long atime_nanos; + unsigned long birthtime_nanos; unsigned long mtime_nanos; - unsigned long atime_nanos; unsigned long fflags_set; int fixup; /* bitmask of what needs fixing */ char *name; @@ -227,7 +229,8 @@ unsigned long fflags_set, unsigned long fflags_clear); static int set_ownership(struct archive_write_disk *); static int set_mode(struct archive_write_disk *, int mode); -static int set_time(struct archive_write_disk *); +static int set_time(int, int, const char *, time_t, long, time_t, long); +static int set_times(struct archive_write_disk *); static struct fixup_entry *sort_dir_list(struct fixup_entry *p); static gid_t trivial_lookup_gid(void *, const char *, gid_t); static uid_t trivial_lookup_uid(void *, const char *, uid_t); @@ -448,19 +451,29 @@ || archive_entry_atime_is_set(entry))) { fe = current_fixup(a, archive_entry_pathname(entry)); fe->fixup |= TODO_TIMES; + if (archive_entry_atime_is_set(entry)) { + fe->atime = archive_entry_atime(entry); + fe->atime_nanos = archive_entry_atime_nsec(entry); + } else { + /* If atime is unset, use start time. */ + fe->atime = a->start_time; + fe->atime_nanos = 0; + } if (archive_entry_mtime_is_set(entry)) { fe->mtime = archive_entry_mtime(entry); fe->mtime_nanos = archive_entry_mtime_nsec(entry); } else { + /* If mtime is unset, use start time. */ fe->mtime = a->start_time; fe->mtime_nanos = 0; } - if (archive_entry_atime_is_set(entry)) { - fe->atime = archive_entry_atime(entry); - fe->atime_nanos = archive_entry_atime_nsec(entry); + if (archive_entry_birthtime_is_set(entry)) { + fe->birthtime = archive_entry_birthtime(entry); + fe->birthtime_nanos = archive_entry_birthtime_nsec(entry); } else { - fe->atime = a->start_time; - fe->atime_nanos = 0; + /* If birthtime is unset, use mtime. */ + fe->birthtime = fe->mtime; + fe->birthtime_nanos = fe->mtime_nanos; } } @@ -698,7 +711,7 @@ if (r2 < ret) ret = r2; } if (a->todo & TODO_TIMES) { - int r2 = set_time(a); + int r2 = set_times(a); if (r2 < ret) ret = r2; } if (a->todo & TODO_ACLS) { @@ -1170,10 +1183,19 @@ #ifdef HAVE_UTIMES /* {f,l,}utimes() are preferred, when available. */ struct timeval times[2]; + times[0].tv_sec = p->atime; + times[0].tv_usec = p->atime_nanos / 1000; +#ifdef HAVE_STRUCT_STAT_ST_BIRTHTIME + /* if it's valid and not mtime, push the birthtime first */ + if (((times[1].tv_sec = p->birthtime) < p->mtime) && + (p->birthtime > 0)) + { + times[1].tv_usec = p->birthtime_nanos / 1000; + utimes(p->name, times); + } +#endif times[1].tv_sec = p->mtime; times[1].tv_usec = p->mtime_nanos / 1000; - times[0].tv_sec = p->atime; - times[0].tv_usec = p->atime_nanos / 1000; #ifdef HAVE_LUTIMES lutimes(p->name, times); #else @@ -1687,61 +1709,31 @@ * when they're available. */ static int -set_time(struct archive_write_disk *a) +set_time(int fd, int mode, const char *name, + time_t atime, long atime_nsec, + time_t mtime, long mtime_nsec) { struct timeval times[2]; - /* If no time was provided, we're done. */ - if (!archive_entry_atime_is_set(a->entry) - && !archive_entry_mtime_is_set(a->entry)) - return (ARCHIVE_OK); - - /* We know at least one is set, so... */ - if (archive_entry_mtime_is_set(a->entry)) { - times[1].tv_sec = archive_entry_mtime(a->entry); - times[1].tv_usec = archive_entry_mtime_nsec(a->entry) / 1000; - } else { - times[1].tv_sec = a->start_time; - times[1].tv_usec = 0; - } + times[0].tv_sec = atime; + times[0].tv_usec = atime_nsec / 1000; + times[1].tv_sec = mtime; + times[1].tv_usec = mtime_nsec / 1000; - /* If no atime was specified, use start time instead. */ - /* In theory, it would be marginally more correct to use - * time(NULL) here, but that would cost us an extra syscall - * for little gain. */ - if (archive_entry_atime_is_set(a->entry)) { - times[0].tv_sec = archive_entry_atime(a->entry); - times[0].tv_usec = archive_entry_atime_nsec(a->entry) / 1000; - } else { - times[0].tv_sec = a->start_time; - times[0].tv_usec = 0; - } - #ifdef HAVE_FUTIMES - if (a->fd >= 0 && futimes(a->fd, times) == 0) { - return (ARCHIVE_OK); - } + if (fd >= 0) + return (futimes(fd, times)); +#else + (void)fd; /* UNUSED */ #endif - #ifdef HAVE_LUTIMES - if (lutimes(a->name, times) != 0) + (void)mode; /* UNUSED */ + return (lutimes(name, times)); #else - if (!S_ISLNK(a->mode) && utimes(a->name, times) != 0) + if (S_ISLNK(mode)) + return (0); + return (utimes(name, times)); #endif - { - archive_set_error(&a->archive, errno, "Can't update time for %s", - a->name); - return (ARCHIVE_WARN); - } - - /* - * Note: POSIX does not provide a portable way to restore ctime. - * (Apart from resetting the system clock, which is distasteful.) - * So, any restoration of ctime will necessarily be OS-specific. - */ - - /* XXX TODO: Can FreeBSD restore ctime? XXX */ - return (ARCHIVE_OK); } #elif defined(HAVE_UTIME) /* @@ -1749,47 +1741,93 @@ * if utimes() isn't available. */ static int -set_time(struct archive_write_disk *a) +set_time(int fd, int mode, const char *name, + time_t atime, long atime_nsec, + time_t mtime, long mtime_nsec) { struct utimbuf times; + (void)fd; /* UNUSED */ + (void)name; /* UNUSED */ + (void)atime_nsec; /* UNUSED */ + (void)mtime_nsec; /* UNUSED */ + times.actime = atime; + times.modtime = mtime; + if (S_ISLINK(mode)) + return (ARCHIVE_OK); + return (utime(name, ×)); +} +#else +static int +set_time(int fd, int mode, const char *name, + time_t atime, long atime_nsec, + time_t mtime, long mtime_nsec) +{ + return (ARCHIVE_WARN); +} +#endif +static int +set_times(struct archive_write_disk *a) +{ + time_t atime = a->start_time, mtime = a->start_time; + long atime_nsec = 0, mtime_nsec = 0; + /* If no time was provided, we're done. */ if (!archive_entry_atime_is_set(a->entry) +#if HAVE_STRUCT_STAT_ST_BIRTHTIME + && !archive_entry_birthtime_is_set(a->entry) +#endif && !archive_entry_mtime_is_set(a->entry)) return (ARCHIVE_OK); - /* We know at least one is set, so... */ - /* Set mtime from mtime if set, else start time. */ - if (archive_entry_mtime_is_set(a->entry)) - times.modtime = archive_entry_mtime(a->entry); - else - times.modtime = a->start_time; + /* If no atime was specified, use start time instead. */ + /* In theory, it would be marginally more correct to use + * time(NULL) here, but that would cost us an extra syscall + * for little gain. */ + if (archive_entry_atime_is_set(a->entry)) { + atime = archive_entry_atime(a->entry); + atime_nsec = archive_entry_atime_nsec(a->entry); + } - /* Set atime from provided atime, else mtime. */ - if (archive_entry_atime_is_set(a->entry)) - times.actime = archive_entry_atime(a->entry); - else - times.actime = a->start_time; + /* + * If you have struct stat.st_birthtime, we assume BSD birthtime + * semantics, in which {f,l,}utimes() updates birthtime to earliest + * mtime. So we set the time twice, first using the birthtime, + * then using the mtime. + */ +#if HAVE_STRUCT_STAT_ST_BIRTHTIME + /* If birthtime is set, flush that through to disk first. */ + if (archive_entry_birthtime_is_set(a->entry)) + if (set_time(a->fd, a->mode, a->name, atime, atime_nsec, + archive_entry_birthtime(a->entry), + archive_entry_birthtime_nsec(a->entry))) { + archive_set_error(&a->archive, errno, + "Can't update time for %s", + a->name); + return (ARCHIVE_WARN); + } +#endif - if (!S_ISLNK(a->mode) && utime(a->name, ×) != 0) { + if (archive_entry_mtime_is_set(a->entry)) { + mtime = archive_entry_mtime(a->entry); + mtime_nsec = archive_entry_mtime_nsec(a->entry); + } + if (set_time(a->fd, a->mode, a->name, + atime, atime_nsec, mtime, mtime_nsec)) { archive_set_error(&a->archive, errno, - "Can't update time for %s", a->name); + "Can't update time for %s", + a->name); return (ARCHIVE_WARN); } + + /* + * Note: POSIX does not provide a portable way to restore ctime. + * (Apart from resetting the system clock, which is distasteful.) + * So, any restoration of ctime will necessarily be OS-specific. + */ + return (ARCHIVE_OK); } -#else -/* This platform doesn't give us a way to restore the time. */ -static int -set_time(struct archive_write_disk *a) -{ - (void)a; /* UNUSED */ - archive_set_error(&a->archive, errno, - "Can't update time for %s", a->name); - return (ARCHIVE_WARN); -} -#endif - static int set_mode(struct archive_write_disk *a, int mode) ==== //depot/projects/hammer/lib/libarchive/archive_write_set_format_pax.c#36 (text+ko) ==== @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_set_format_pax.c,v 1.48 2008/08/10 02:06:28 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_set_format_pax.c,v 1.49 2008/09/30 03:57:07 kientzle Exp $"); #ifdef HAVE_ERRNO_H #include @@ -762,6 +762,15 @@ archive_entry_atime(entry_main), archive_entry_atime_nsec(entry_main)); + /* Store birth/creationtime only if it's earlier than mtime */ + if (archive_entry_birthtime_is_set(entry_main) && + archive_entry_birthtime(entry_main) + < archive_entry_mtime(entry_main)) + add_pax_attr_time(&(pax->pax_header), + "LIBARCHIVE.creationtime", + archive_entry_birthtime(entry_main), + archive_entry_birthtime_nsec(entry_main)); + /* I use a star-compatible file flag attribute. */ p = archive_entry_fflags_text(entry_main); if (p != NULL && *p != '\0') ==== //depot/projects/hammer/lib/libarchive/config_freebsd.h#11 (text+ko) ==== @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/lib/libarchive/config_freebsd.h,v 1.14 2008/09/14 05:51:25 kientzle Exp $ + * $FreeBSD: src/lib/libarchive/config_freebsd.h,v 1.15 2008/09/30 03:53:03 kientzle Exp $ */ /* FreeBSD 5.0 and later have ACL support. */ @@ -89,6 +89,8 @@ #define HAVE_STRING_H 1 #define HAVE_STRRCHR 1 #define HAVE_STRUCT_STAT_ST_BLKSIZE 1 +#define HAVE_STRUCT_STAT_ST_BIRTHTIME 1 +#define HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC 1 #define HAVE_STRUCT_STAT_ST_FLAGS 1 #define HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC 1 #define HAVE_SYS_ACL_H 1 ==== //depot/projects/hammer/lib/libarchive/test/Makefile#14 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/lib/libarchive/test/Makefile,v 1.25 2008/09/08 00:58:12 kientzle Exp $ +# $FreeBSD: src/lib/libarchive/test/Makefile,v 1.27 2008/09/30 04:02:36 kientzle Exp $ # Where to find the libarchive sources LA_SRCDIR=${.CURDIR}/.. @@ -57,11 +57,13 @@ test_write_disk_hardlink.c \ test_write_disk_perms.c \ test_write_disk_secure.c \ + test_write_disk_times.c \ test_write_format_ar.c \ test_write_format_cpio.c \ test_write_format_cpio_empty.c \ test_write_format_cpio_newc.c \ test_write_format_cpio_odc.c \ + test_write_format_pax.c \ test_write_format_shar_empty.c \ test_write_format_tar.c \ test_write_format_tar_empty.c \ ==== //depot/projects/hammer/lib/libarchive/test/test_entry.c#6 (text+ko) ==== @@ -23,7 +23,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" -__FBSDID("$FreeBSD: src/lib/libarchive/test/test_entry.c,v 1.8 2008/09/01 05:38:33 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/test/test_entry.c,v 1.10 2008/09/30 04:13:21 kientzle Exp $"); #include @@ -79,6 +79,15 @@ assertEqualInt(archive_entry_atime_nsec(e), 0); assert(!archive_entry_atime_is_set(e)); + /* birthtime */ + archive_entry_set_birthtime(e, 17579, 24990); + assertEqualInt(archive_entry_birthtime(e), 17579); + assertEqualInt(archive_entry_birthtime_nsec(e), 24990); + archive_entry_unset_birthtime(e); + assertEqualInt(archive_entry_birthtime(e), 0); + assertEqualInt(archive_entry_birthtime_nsec(e), 0); + assert(!archive_entry_birthtime_is_set(e)); + /* ctime */ archive_entry_set_ctime(e, 13580, 24681); assertEqualInt(archive_entry_ctime(e), 13580); @@ -312,6 +321,7 @@ /* Set values in 'e' */ archive_entry_clear(e); archive_entry_set_atime(e, 13579, 24680); + archive_entry_set_birthtime(e, 13779, 24990); archive_entry_set_ctime(e, 13580, 24681); #if ARCHIVE_VERSION_NUMBER >= 1009000 archive_entry_set_dev(e, 235); @@ -348,6 +358,8 @@ /* Clone should have same contents. */ assertEqualInt(archive_entry_atime(e2), 13579); assertEqualInt(archive_entry_atime_nsec(e2), 24680); + assertEqualInt(archive_entry_birthtime(e2), 13779); + assertEqualInt(archive_entry_birthtime_nsec(e2), 24990); assertEqualInt(archive_entry_ctime(e2), 13580); assertEqualInt(archive_entry_ctime_nsec(e2), 24681); #if ARCHIVE_VERSION_NUMBER >= 1009000 @@ -435,6 +447,7 @@ /* Change the original */ archive_entry_set_atime(e, 13580, 24690); + archive_entry_set_birthtime(e, 13980, 24999); archive_entry_set_ctime(e, 13590, 24691); #if ARCHIVE_VERSION_NUMBER >= 1009000 archive_entry_set_dev(e, 245); @@ -468,6 +481,8 @@ /* Clone should still have same contents. */ assertEqualInt(archive_entry_atime(e2), 13579); assertEqualInt(archive_entry_atime_nsec(e2), 24680); + assertEqualInt(archive_entry_birthtime(e2), 13779); + assertEqualInt(archive_entry_birthtime_nsec(e2), 24990); assertEqualInt(archive_entry_ctime(e2), 13580); assertEqualInt(archive_entry_ctime_nsec(e2), 24681); #if ARCHIVE_VERSION_NUMBER >= 1009000 @@ -561,6 +576,8 @@ archive_entry_clear(e); assertEqualInt(archive_entry_atime(e), 0); assertEqualInt(archive_entry_atime_nsec(e), 0); + assertEqualInt(archive_entry_birthtime(e), 0); + assertEqualInt(archive_entry_birthtime_nsec(e), 0); assertEqualInt(archive_entry_ctime(e), 0); assertEqualInt(archive_entry_ctime_nsec(e), 0); assertEqualInt(archive_entry_dev(e), 0); @@ -612,6 +629,7 @@ st.st_atimespec.tv_nsec = 6543210; st.st_ctimespec.tv_nsec = 5432109; st.st_mtimespec.tv_nsec = 3210987; + st.st_birthtimespec.tv_nsec = 7459386; #endif /* Copy them into the entry. */ archive_entry_copy_stat(e, &st); @@ -633,6 +651,7 @@ assertEqualInt(archive_entry_atime_nsec(e), 6543210); assertEqualInt(archive_entry_ctime_nsec(e), 5432109); assertEqualInt(archive_entry_mtime_nsec(e), 3210987); + assertEqualInt(archive_entry_birthtime_nsec(e), 7459386); #endif /* ==== //depot/projects/hammer/lib/libarchive/test/test_write_disk.c#8 (text+ko) ==== @@ -23,7 +23,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" -__FBSDID("$FreeBSD: src/lib/libarchive/test/test_write_disk.c,v 1.14 2008/09/05 06:13:11 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/test/test_write_disk.c,v 1.15 2008/09/30 04:02:36 kientzle Exp $"); #if ARCHIVE_VERSION_NUMBER >= 1009000 @@ -99,6 +99,7 @@ st.st_mode, archive_entry_mode(ae)); assertEqualInt(st.st_mode, (archive_entry_mode(ae) & ~UMASK)); assertEqualInt(st.st_size, sizeof(data)); + /* test_write_disk_times has more detailed tests of this area. */ assertEqualInt(st.st_mtime, 123456789); failure("No atime was specified, so atime should get set to current time"); now = time(NULL); ==== //depot/projects/hammer/lib/libc/gen/getosreldate.3#4 (text+ko) ==== @@ -22,9 +22,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc/gen/getosreldate.3,v 1.4 2008/09/20 21:12:54 rodrigc Exp $ +.\" $FreeBSD: src/lib/libc/gen/getosreldate.3,v 1.5 2008/09/30 11:25:55 kib Exp $ .\" -.Dd December 2, 2005 +.Dd September 30, 2008 .Dt GETOSRELDATE 3 .Os .Sh NAME @@ -34,6 +34,7 @@ .Sh LIBRARY .Lb libc .Sh SYNOPSIS +.In unistd.h .Ft int .Fn getosreldate void .Sh DESCRIPTION ==== //depot/projects/hammer/sbin/bsdlabel/bsdlabel.c#24 (text+ko) ==== @@ -53,7 +53,7 @@ #endif /* not lint */ #endif #include -__FBSDID("$FreeBSD: src/sbin/bsdlabel/bsdlabel.c,v 1.115 2008/09/18 14:04:02 lulf Exp $"); +__FBSDID("$FreeBSD: src/sbin/bsdlabel/bsdlabel.c,v 1.117 2008/09/30 11:46:14 lulf Exp $"); #include #include @@ -236,11 +236,12 @@ return(1); } pname = g_providername(fd); - close(fd); if (pname == NULL) { - warnx("error getting providername for %s", specname); + warn("error getting providername for %s", specname); + close(fd); return(1); } + close(fd); } if (installboot && op == UNSPEC) ==== //depot/projects/hammer/sbin/fdisk/fdisk.c#23 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include -__FBSDID("$FreeBSD: src/sbin/fdisk/fdisk.c,v 1.86 2008/09/07 13:58:35 lulf Exp $"); +__FBSDID("$FreeBSD: src/sbin/fdisk/fdisk.c,v 1.87 2008/09/30 07:18:49 lulf Exp $"); #include #include @@ -770,7 +770,7 @@ gctl_ro_param(grq, "class", -1, "MBR"); pname = g_providername(fd); if (pname == NULL) { - warnx("Error getting providername for %s\n", disk); + warn("Error getting providername for %s", disk); return (-1); } gctl_ro_param(grq, "geom", -1, pname); ==== //depot/projects/hammer/share/examples/FreeBSD_version/FreeBSD_version.c#2 (text+ko) ==== @@ -1,3 +1,4 @@ +/* $FreeBSD: src/share/examples/FreeBSD_version/FreeBSD_version.c,v 1.3 2008/09/30 11:25:55 kib Exp $ */ #if __FreeBSD__ == 0 /* 1.0 did not define __FreeBSD__ */ #define __FreeBSD_version 199401 #elif __FreeBSD__ == 1 /* 1.1 defined it to be 1 */ @@ -5,13 +6,16 @@ #else /* 2.0 and higher define it to be 2 */ #include /* and this works */ #endif +#include +#include -int main(void) { - extern int getosreldate(void); - printf("Compilation release date: %d\n", __FreeBSD_version); +int +main(void) { + printf("Compilation release date: %d\n", __FreeBSD_version); #if __FreeBSD_version >= 199408 - printf("Execution environment release date: %d\n", getosreldate()); + printf("Execution environment release date: %d\n", getosreldate()); #else - printf("Execution environment release date: can't tell\n"); + printf("Execution environment release date: can't tell\n"); #endif + return (0); } ==== //depot/projects/hammer/share/man/man4/wpi.4#3 (text+ko) ==== @@ -24,7 +24,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/share/man/man4/wpi.4,v 1.4 2008/04/20 20:35:46 sam Exp $ +.\" $FreeBSD: src/share/man/man4/wpi.4,v 1.5 2008/09/30 14:24:03 glebius Exp $ .\" .Dd Apri 13, 2008 .Os @@ -94,24 +94,24 @@ Join an existing BSS network (i.e., connect to an access point): .Pp .Bd -literal -offset indent -ifconfig wlan create wlandev wpi0 inet 192.168.0.20 \e +ifconfig wlan0 create wlandev wpi0 inet 192.168.0.20 \e netmask 0xffffff00 .Ed .Pp Join a specific BSS network with network name .Dq Li my_net : .Pp -.Dl "ifconfig wlan create wlandev wpi0 ssid my_net up" +.Dl "ifconfig wlan0 create wlandev wpi0 ssid my_net up" .Pp Join a specific BSS network with 64-bit WEP encryption: .Bd -literal -offset indent -ifconfig wlan create wlandev wpi0 ssid my_net \e +ifconfig wlan0 create wlandev wpi0 ssid my_net \e wepmode on wepkey 0x1234567890 weptxkey 1 up .Ed .Pp Join a specific BSS network with 128-bit WEP encryption: .Bd -literal -offset indent -ifconfig wlan create wlandev wpi0 wlanmode adhoc ssid my_net \e +ifconfig wlan0 create wlandev wpi0 wlanmode adhoc ssid my_net \e wepmode on wepkey 0x01020304050607080910111213 weptxkey 1 .Ed .Sh DIAGNOSTICS ==== //depot/projects/hammer/sys/arm/at91/at91_mci.c#6 (text+ko) ==== @@ -24,7 +24,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/arm/at91/at91_mci.c,v 1.6 2008/09/28 23:37:56 imp Exp $"); +__FBSDID("$FreeBSD: src/sys/arm/at91/at91_mci.c,v 1.7 2008/09/30 02:32:41 imp Exp $"); #include #include @@ -455,7 +455,7 @@ static int at91_mci_get_ro(device_t brdev, device_t reqdev) { - return (-1); + return (0); } static int @@ -642,9 +642,6 @@ case MMCBR_IVAR_VDD: *(int *)result = sc->host.ios.vdd; break; - case MMCBR_IVAR_CAPS: - *(int *)result = sc->host.ios.caps; - break; } return (0); } @@ -685,7 +682,6 @@ case MMCBR_IVAR_HOST_OCR: case MMCBR_IVAR_F_MIN: case MMCBR_IVAR_F_MAX: - case MMCBR_IVAR_CAPS: return (EINVAL); } return (0); ==== //depot/projects/hammer/sys/dev/cxgb/cxgb_main.c#26 (text+ko) ==== @@ -28,7 +28,7 @@ ***************************************************************************/ #include -__FBSDID("$FreeBSD: src/sys/dev/cxgb/cxgb_main.c,v 1.67 2008/09/23 03:16:54 kmacy Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/cxgb/cxgb_main.c,v 1.68 2008/09/30 21:21:52 kmacy Exp $"); #include #include @@ -981,6 +981,12 @@ ifmedia_add(&p->media, IFM_ETHER | IFM_1000_T | IFM_FDX, 0, NULL); media_flags = 0; + } else if (!strcmp(p->phy.desc, "1000BASE-X")) { + /* + * XXX: This is not very accurate. Fix when common code + * returns more specific value - eg 1000BASE-SX, LX, etc. + */ + media_flags = IFM_ETHER | IFM_1000_SX | IFM_FDX; } else { printf("unsupported media type %s\n", p->phy.desc); return (ENXIO); ==== //depot/projects/hammer/sys/dev/dc/dcphy.c#6 (text+ko) ==== @@ -31,13 +31,13 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/dc/dcphy.c,v 1.33 2007/11/16 10:25:36 yongari Exp $"); >>> TRUNCATED FOR MAIL (1000 lines) <<<