1--- src/extract.c~before~preallocate 2006-03-29 12:03:07.000000000 -0800 2+++ src/extract.c 2006-03-29 12:04:17.000000000 -0800 3@@ -40,6 +40,10 @@ struct copyfile_list_entry_t { 4 extern LIST_HEAD(copyfile_list_t, copyfile_list_entry_t) copyfile_list; 5 #endif 6 7+#ifdef __APPLE__ 8+#include <sys/mount.h> 9+#endif /* __APPLE__ */ 10+ 11 static bool we_are_root; /* true if our effective uid == 0 */ 12 static mode_t newdir_umask; /* umask when creating new directories */ 13 static mode_t current_umask; /* current umask (which is set to 0 if -p) */ 14@@ -731,6 +735,10 @@ extract_archive (void) 15 { 16 static int conttype_diagnosed; 17 18+#ifdef __APPLE__ 19+ /* XXX Would be nice to suppress this warning if we pre-allocate. */ 20+#endif /* __APPLE__ */ 21+ 22 if (!conttype_diagnosed) 23 { 24 conttype_diagnosed = 1; 25@@ -785,6 +793,20 @@ 26 } 27 } 28 29+#ifdef __APPLE__ 30+ /* Attempts to pre-allocate blocks for the destination file. */ 31+ if (!current_stat_info.is_sparse) { 32+ fstore_t fst; 33+ 34+ fst.fst_flags = 0; 35+ fst.fst_posmode = F_PEOFPOSMODE; 36+ fst.fst_offset = 0; 37+ fst.fst_length = current_stat_info.stat.st_size; 38+ 39+ (void)fcntl(fd, F_PREALLOCATE, &fst); 40+ } 41+#endif /* __APPLE__ */ 42+ 43 mv_begin (¤t_stat_info); 44 if (current_stat_info.is_sparse) 45 sparse_extract_file (fd, ¤t_stat_info, &size); 46