Changed the style of the diff headers (use "patch -p1" now).
[rsync/rsync-patches.git] / atimes.diff
... / ...
CommitLineData
1After applying this patch, run these commands for a successful build:
2
3 ./prepare-source
4 ./configure (optional if already run)
5 make
6
7
8--- old/flist.c
9+++ new/flist.c
10@@ -51,6 +51,7 @@ extern int preserve_devices;
11 extern int preserve_specials;
12 extern int preserve_uid;
13 extern int preserve_gid;
14+extern int preserve_atimes;
15 extern int relative_paths;
16 extern int implied_dirs;
17 extern int prune_empty_dirs;
18@@ -85,7 +86,13 @@ void init_flist(void)
19 struct file_struct f;
20
21 /* Figure out how big the file_struct is without trailing padding */
22- file_struct_len = offsetof(struct file_struct, flags) + sizeof f.flags;
23+ if (preserve_atimes)
24+ file_struct_len = offsetof(struct file_struct, fl4g5);
25+ else
26+ file_struct_len = offsetof(struct file_struct, atime);
27+ /* The "flags" uchar is no longer accessed directly, so I
28+ * mangled the name to fl4g5 as a reminder. */
29+ file_struct_len += sizeof f.fl4g5;
30 checksum_len = protocol_version < 21 ? 2 : MD4_SUM_LENGTH;
31 }
32
33@@ -141,16 +148,18 @@ static void list_file_entry(struct file_
34
35 #ifdef SUPPORT_LINKS
36 if (preserve_links && S_ISLNK(f->mode)) {
37- rprintf(FINFO, "%s %11.0f %s %s -> %s\n",
38+ rprintf(FINFO, "%s %11.0f %s %s %s -> %s\n",
39 permbuf,
40 (double)f->length, timestring(f->modtime),
41+ preserve_atimes ? timestring(f->atime) : "",
42 f_name(f, NULL), f->u.link);
43 } else
44 #endif
45 {
46- rprintf(FINFO, "%s %11.0f %s %s\n",
47+ rprintf(FINFO, "%s %11.0f %s %s %s\n",
48 permbuf,
49 (double)f->length, timestring(f->modtime),
50+ preserve_atimes ? timestring(f->atime) : "",
51 f_name(f, NULL));
52 }
53 }
54@@ -312,6 +321,7 @@ static void send_file_entry(struct file_
55 {
56 unsigned short flags;
57 static time_t modtime;
58+ static time_t atime;
59 static mode_t mode;
60 static int64 dev;
61 static dev_t rdev;
62@@ -327,7 +337,7 @@ static void send_file_entry(struct file_
63
64 if (!file) {
65 write_byte(f, 0);
66- modtime = 0, mode = 0;
67+ modtime = 0, atime = 0, mode = 0;
68 dev = 0, rdev = makedev(0, 0);
69 rdev_major = 0;
70 uid = 0, gid = 0;
71@@ -339,7 +349,7 @@ static void send_file_entry(struct file_
72
73 f_name(file, fname);
74
75- flags = file->flags & XMIT_TOP_DIR;
76+ flags = FFLAGS(file) & XMIT_TOP_DIR;
77
78 if (file->mode == mode)
79 flags |= XMIT_SAME_MODE;
80@@ -375,6 +385,12 @@ static void send_file_entry(struct file_
81 flags |= XMIT_SAME_TIME;
82 else
83 modtime = file->modtime;
84+ if (preserve_atimes && !S_ISDIR(mode)) {
85+ if (file->atime == atime)
86+ flags |= XMIT_SAME_ATIME;
87+ else
88+ atime = file->atime;
89+ }
90
91 #ifdef SUPPORT_HARD_LINKS
92 if (file->link_u.idev) {
93@@ -428,6 +444,8 @@ static void send_file_entry(struct file_
94 write_int(f, modtime);
95 if (!(flags & XMIT_SAME_MODE))
96 write_int(f, to_wire_mode(mode));
97+ if (preserve_atimes && !S_ISDIR(mode) && !(flags & XMIT_SAME_ATIME))
98+ write_int(f, atime);
99 if (preserve_uid && !(flags & XMIT_SAME_UID)) {
100 if (!numeric_ids)
101 add_uid(uid);
102@@ -496,6 +514,7 @@ static struct file_struct *receive_file_
103 unsigned short flags, int f)
104 {
105 static time_t modtime;
106+ static time_t atime;
107 static mode_t mode;
108 static int64 dev;
109 static dev_t rdev;
110@@ -514,7 +533,7 @@ static struct file_struct *receive_file_
111 struct file_struct *file;
112
113 if (!flist) {
114- modtime = 0, mode = 0;
115+ modtime = 0, atime = 0, mode = 0;
116 dev = 0, rdev = makedev(0, 0);
117 rdev_major = 0;
118 uid = 0, gid = 0;
119@@ -570,6 +589,8 @@ static struct file_struct *receive_file_
120 modtime = (time_t)read_int(f);
121 if (!(flags & XMIT_SAME_MODE))
122 mode = from_wire_mode(read_int(f));
123+ if (preserve_atimes && !S_ISDIR(mode) && !(flags & XMIT_SAME_ATIME))
124+ atime = (time_t)read_int(f);
125
126 if (chmod_modes && !S_ISLNK(mode))
127 mode = tweak_mode(mode, chmod_modes);
128@@ -625,6 +646,8 @@ static struct file_struct *receive_file_
129 file->mode = mode;
130 file->uid = uid;
131 file->gid = gid;
132+ if (preserve_atimes)
133+ file->atime = atime;
134
135 if (dirname_len) {
136 file->dirname = lastdir = bp;
137@@ -650,12 +673,12 @@ static struct file_struct *receive_file_
138 && lastname[del_hier_name_len-1] == '.'
139 && lastname[del_hier_name_len-2] == '/')
140 del_hier_name_len -= 2;
141- file->flags |= FLAG_TOP_DIR | FLAG_DEL_HERE;
142+ FFLAGS(file) |= FLAG_TOP_DIR | FLAG_DEL_HERE;
143 } else if (in_del_hier) {
144 if (!relative_paths || !del_hier_name_len
145 || (l1 >= del_hier_name_len
146 && lastname[del_hier_name_len] == '/'))
147- file->flags |= FLAG_DEL_HERE;
148+ FFLAGS(file) |= FLAG_DEL_HERE;
149 else
150 in_del_hier = 0;
151 }
152@@ -871,12 +894,14 @@ struct file_struct *make_file(char *fnam
153 memset(bp, 0, file_struct_len);
154 bp += file_struct_len;
155
156- file->flags = flags;
157+ FFLAGS(file) = flags;
158 file->modtime = st.st_mtime;
159 file->length = st.st_size;
160 file->mode = st.st_mode;
161 file->uid = st.st_uid;
162 file->gid = st.st_gid;
163+ if (preserve_atimes)
164+ file->atime = st.st_atime;
165
166 #ifdef SUPPORT_HARD_LINKS
167 if (flist && flist->hlink_pool) {
168@@ -989,7 +1014,7 @@ static void send_if_directory(int f, str
169 char is_dot_dir = fbuf[ol-1] == '.' && (ol == 1 || fbuf[ol-2] == '/');
170
171 if (S_ISDIR(file->mode)
172- && !(file->flags & FLAG_MOUNT_POINT) && f_name(file, fbuf)) {
173+ && !(FFLAGS(file) & FLAG_MOUNT_POINT) && f_name(file, fbuf)) {
174 void *save_filters;
175 unsigned int len = strlen(fbuf);
176 if (len > 1 && fbuf[len-1] == '/')
177@@ -1595,8 +1620,9 @@ static void clean_flist(struct file_list
178 }
179 /* Make sure we don't lose track of a user-specified
180 * top directory. */
181- flist->files[keep]->flags |= flist->files[drop]->flags
182- & (FLAG_TOP_DIR|FLAG_DEL_HERE);
183+ FFLAGS(flist->files[keep])
184+ |= FFLAGS(flist->files[drop])
185+ & (FLAG_TOP_DIR|FLAG_DEL_HERE);
186
187 clear_file(flist->files[drop], flist);
188
189@@ -1720,7 +1746,7 @@ static void output_flist(struct file_lis
190 file->dirname ? file->dirname : "",
191 file->dirname ? "/" : "", NS(file->basename),
192 S_ISDIR(file->mode) ? "/" : "", (int)file->mode,
193- (double)file->length, uidbuf, gidbuf, file->flags);
194+ (double)file->length, uidbuf, gidbuf, FFLAGS(file));
195 }
196 }
197
198--- old/generator.c
199+++ new/generator.c
200@@ -44,6 +44,7 @@ extern int preserve_perms;
201 extern int preserve_uid;
202 extern int preserve_gid;
203 extern int preserve_times;
204+extern int preserve_atimes;
205 extern int omit_dir_times;
206 extern int delete_mode;
207 extern int delete_before;
208@@ -91,6 +92,7 @@ extern dev_t filesystem_dev;
209 extern char *backup_dir;
210 extern char *backup_suffix;
211 extern int backup_suffix_len;
212+extern unsigned int file_struct_len;
213 extern struct file_list *the_file_list;
214 extern struct filter_list_struct server_filter_list;
215
216@@ -185,7 +187,7 @@ static int delete_item(char *fname, int
217 for (j = dirlist->count; j--; ) {
218 struct file_struct *fp = dirlist->files[j];
219
220- if (fp->flags & FLAG_MOUNT_POINT)
221+ if (FFLAGS(fp) & FLAG_MOUNT_POINT)
222 continue;
223
224 strlcpy(p, fp->basename, remainder);
225@@ -263,7 +265,7 @@ static void delete_in_dir(struct file_li
226 filt_array[cur_depth] = push_local_filters(fbuf, dlen);
227
228 if (one_file_system) {
229- if (file->flags & FLAG_TOP_DIR)
230+ if (FFLAGS(file) & FLAG_TOP_DIR)
231 filesystem_dev = stp->st_dev;
232 else if (filesystem_dev != stp->st_dev)
233 return;
234@@ -275,7 +277,7 @@ static void delete_in_dir(struct file_li
235 * from the filesystem. */
236 for (i = dirlist->count; i--; ) {
237 struct file_struct *fp = dirlist->files[i];
238- if (!fp->basename || fp->flags & FLAG_MOUNT_POINT)
239+ if (!fp->basename || FFLAGS(fp) & FLAG_MOUNT_POINT)
240 continue;
241 if (flist_find(flist, fp) < 0) {
242 f_name(fp, delbuf);
243@@ -301,11 +303,11 @@ static void do_delete_pass(struct file_l
244 for (j = 0; j < flist->count; j++) {
245 struct file_struct *file = flist->files[j];
246
247- if (!(file->flags & FLAG_DEL_HERE))
248+ if (!(FFLAGS(file) & FLAG_DEL_HERE))
249 continue;
250
251 f_name(file, fbuf);
252- if (verbose > 1 && file->flags & FLAG_TOP_DIR)
253+ if (verbose > 1 && FFLAGS(file) & FLAG_TOP_DIR)
254 rprintf(FINFO, "deleting in %s\n", fbuf);
255
256 if (link_stat(fbuf, &st, keep_dirlinks) < 0
257@@ -347,8 +349,11 @@ void itemize(struct file_struct *file, i
258 iflags |= ITEM_REPORT_SIZE;
259 if ((iflags & (ITEM_TRANSFER|ITEM_LOCAL_CHANGE) && !keep_time
260 && (!(iflags & ITEM_XNAME_FOLLOWS) || *xname))
261- || (keep_time && cmp_modtime(file->modtime, st->st_mtime) != 0))
262+ || (keep_time && cmp_time(file->modtime, st->st_mtime) != 0))
263 iflags |= ITEM_REPORT_TIME;
264+ if (preserve_atimes && !S_ISDIR(file->mode) && !S_ISLNK(file->mode)
265+ && cmp_time(file->atime, st->st_atime) != 0)
266+ iflags |= ITEM_REPORT_ATIME;
267 if ((file->mode & CHMOD_BITS) != (st->st_mode & CHMOD_BITS))
268 iflags |= ITEM_REPORT_PERMS;
269 if (preserve_uid && am_root && file->uid != st->st_uid)
270@@ -396,7 +401,7 @@ int unchanged_file(char *fn, struct file
271 if (ignore_times)
272 return 0;
273
274- return cmp_modtime(st->st_mtime, file->modtime) == 0;
275+ return cmp_time(st->st_mtime, file->modtime) == 0;
276 }
277
278
279@@ -550,13 +555,13 @@ static int find_fuzzy(struct file_struct
280 uint32 dist;
281
282 if (!S_ISREG(fp->mode) || !fp->length
283- || fp->flags & FLAG_NO_FUZZY)
284+ || FFLAGS(fp) & FLAG_NO_FUZZY)
285 continue;
286
287 name = fp->basename;
288
289 if (fp->length == file->length
290- && cmp_modtime(fp->modtime, file->modtime) == 0) {
291+ && cmp_time(fp->modtime, file->modtime) == 0) {
292 if (verbose > 4) {
293 rprintf(FINFO,
294 "fuzzy size/modtime match for %s\n",
295@@ -632,7 +637,7 @@ static int try_dests_reg(struct file_str
296 if (!unchanged_attrs(file, stp))
297 continue;
298 if ((always_checksum || ignore_times)
299- && cmp_modtime(stp->st_mtime, file->modtime))
300+ && cmp_time(stp->st_mtime, file->modtime))
301 continue;
302 best_match = j;
303 match_level = 3;
304@@ -659,6 +664,8 @@ static int try_dests_reg(struct file_str
305 itemizing && verbose > 1,
306 code) < 0)
307 goto try_a_copy;
308+ if (preserve_atimes)
309+ set_file_attrs(fname, file, stp, 0);
310 if (preserve_hard_links && file->link_u.links)
311 hard_link_cluster(file, ndx, itemizing, code);
312 } else if (itemizing)
313@@ -894,7 +901,7 @@ static void recv_generator(char *fname,
314 && verbose && code && f_out != -1)
315 rprintf(code, "%s/\n", fname);
316 if (delete_during && f_out != -1 && !phase && dry_run < 2
317- && (file->flags & FLAG_DEL_HERE))
318+ && (FFLAGS(file) & FLAG_DEL_HERE))
319 delete_in_dir(the_file_list, fname, file, &st);
320 return;
321 }
322@@ -1073,7 +1080,7 @@ static void recv_generator(char *fname,
323 }
324
325 if (update_only && statret == 0
326- && cmp_modtime(st.st_mtime, file->modtime) > 0) {
327+ && cmp_time(st.st_mtime, file->modtime) > 0) {
328 if (verbose > 1)
329 rprintf(FINFO, "%s is newer\n", fname);
330 return;
331@@ -1176,7 +1183,7 @@ static void recv_generator(char *fname,
332 if (fuzzy_basis) {
333 int j = flist_find(fuzzy_dirlist, file);
334 if (j >= 0) /* don't use changing file as future fuzzy basis */
335- fuzzy_dirlist->files[j]->flags |= FLAG_NO_FUZZY;
336+ FFLAGS(fuzzy_dirlist->files[j]) |= FLAG_NO_FUZZY;
337 }
338
339 /* open the file */
340--- old/hlink.c
341+++ new/hlink.c
342@@ -26,6 +26,7 @@ extern int link_dest;
343 extern int make_backups;
344 extern int log_format_has_i;
345 extern char *basis_dir[];
346+extern unsigned int file_struct_len;
347 extern struct file_list *the_file_list;
348
349 #ifdef SUPPORT_HARD_LINKS
350@@ -86,10 +87,10 @@ static void link_idev_data(void)
351 FPTR(cur)->link_u.links = pool_talloc(hlink_pool,
352 struct hlink, 1, "hlink_list");
353
354- FPTR(head)->flags |= FLAG_HLINK_TOL;
355+ FFLAGS(FPTR(head)) |= FLAG_HLINK_TOL;
356 FPTR(cur)->F_HLINDEX = to;
357 FPTR(cur)->F_NEXT = head;
358- FPTR(cur)->flags |= FLAG_HLINK_EOL;
359+ FFLAGS(FPTR(cur)) |= FLAG_HLINK_EOL;
360 hlink_list[to++] = head;
361 } else
362 FPTR(cur)->link_u.links = NULL;
363@@ -175,7 +176,7 @@ int hard_link_check(struct file_struct *
364 {
365 #ifdef SUPPORT_HARD_LINKS
366 int head;
367- if (skip && !(file->flags & FLAG_HLINK_EOL))
368+ if (skip && !(FFLAGS(file) & FLAG_HLINK_EOL))
369 head = hlink_list[file->F_HLINDEX] = file->F_NEXT;
370 else
371 head = hlink_list[file->F_HLINDEX];
372@@ -270,8 +271,8 @@ void hard_link_cluster(struct file_struc
373 file->F_HLINDEX = FINISHED_LINK;
374 if (link_stat(f_name(file, hlink1), &st1, 0) < 0)
375 return;
376- if (!(file->flags & FLAG_HLINK_TOL)) {
377- while (!(file->flags & FLAG_HLINK_EOL)) {
378+ if (!(FFLAGS(file) & FLAG_HLINK_TOL)) {
379+ while (!(FFLAGS(file) & FLAG_HLINK_EOL)) {
380 ndx = file->F_NEXT;
381 file = FPTR(ndx);
382 }
383@@ -286,6 +287,6 @@ void hard_link_cluster(struct file_struc
384 maybe_hard_link(file, ndx, hlink2, statret, &st2,
385 hlink1, &st1, itemizing, code);
386 file->F_HLINDEX = FINISHED_LINK;
387- } while (!(file->flags & FLAG_HLINK_EOL));
388+ } while (!(FFLAGS(file) & FLAG_HLINK_EOL));
389 #endif
390 }
391--- old/log.c
392+++ new/log.c
393@@ -41,6 +41,7 @@ extern int module_id;
394 extern int msg_fd_out;
395 extern int protocol_version;
396 extern int preserve_times;
397+extern int preserve_atimes;
398 extern int log_format_has_i;
399 extern int log_format_has_o_or_i;
400 extern int daemon_log_format_has_o_or_i;
401@@ -607,10 +608,12 @@ static void log_formatted(enum logcode c
402 n[3] = !(iflags & ITEM_REPORT_SIZE) ? '.' : 's';
403 n[4] = !(iflags & ITEM_REPORT_TIME) ? '.'
404 : !preserve_times || S_ISLNK(file->mode) ? 'T' : 't';
405- n[5] = !(iflags & ITEM_REPORT_PERMS) ? '.' : 'p';
406- n[6] = !(iflags & ITEM_REPORT_OWNER) ? '.' : 'o';
407- n[7] = !(iflags & ITEM_REPORT_GROUP) ? '.' : 'g';
408- n[8] = '\0';
409+ n[5] = !(iflags & ITEM_REPORT_ATIME) ? '.'
410+ : S_ISLNK(file->mode) ? 'U' : 'u';
411+ n[6] = !(iflags & ITEM_REPORT_PERMS) ? '.' : 'p';
412+ n[7] = !(iflags & ITEM_REPORT_OWNER) ? '.' : 'o';
413+ n[8] = !(iflags & ITEM_REPORT_GROUP) ? '.' : 'g';
414+ n[9] = '\0';
415
416 if (iflags & (ITEM_IS_NEW|ITEM_MISSING_DATA)) {
417 char ch = iflags & ITEM_IS_NEW ? '+' : '?';
418--- old/options.c
419+++ new/options.c
420@@ -52,6 +52,7 @@ int preserve_uid = 0;
421 int preserve_gid = 0;
422 int preserve_times = 0;
423 int omit_dir_times = 0;
424+int preserve_atimes = 0;
425 int update_only = 0;
426 int cvs_exclude = 0;
427 int dry_run = 0;
428@@ -299,8 +300,9 @@ void usage(enum logcode F)
429 rprintf(F," --devices preserve device files (super-user only)\n");
430 rprintf(F," --specials preserve special files\n");
431 rprintf(F," -D same as --devices --specials\n");
432- rprintf(F," -t, --times preserve times\n");
433- rprintf(F," -O, --omit-dir-times omit directories when preserving times\n");
434+ rprintf(F," -t, --times preserve modify times\n");
435+ rprintf(F," -O, --omit-dir-times omit directories when preserving modify times\n");
436+ rprintf(F," -U, --atimes preserve access (use) times\n");
437 rprintf(F," --super receiver attempts super-user activities\n");
438 rprintf(F," -S, --sparse handle sparse files efficiently\n");
439 rprintf(F," -n, --dry-run show what would have been transferred\n");
440@@ -412,6 +414,9 @@ static struct poptOption long_options[]
441 {"times", 't', POPT_ARG_VAL, &preserve_times, 1, 0, 0 },
442 {"no-times", 0, POPT_ARG_VAL, &preserve_times, 0, 0, 0 },
443 {"no-t", 0, POPT_ARG_VAL, &preserve_times, 0, 0, 0 },
444+ {"atimes", 'U', POPT_ARG_VAL, &preserve_atimes, 1, 0, 0 },
445+ {"no-atimes", 0, POPT_ARG_VAL, &preserve_atimes, 0, 0, 0 },
446+ {"no-k", 0, POPT_ARG_VAL, &preserve_atimes, 0, 0, 0 },
447 {"omit-dir-times", 'O', POPT_ARG_VAL, &omit_dir_times, 2, 0, 0 },
448 {"modify-window", 0, POPT_ARG_INT, &modify_window, OPT_MODIFY_WINDOW, 0, 0 },
449 {"super", 0, POPT_ARG_VAL, &am_root, 2, 0, 0 },
450@@ -1505,6 +1510,8 @@ void server_options(char **args,int *arg
451 argstr[x++] = 'D';
452 if (preserve_times)
453 argstr[x++] = 't';
454+ if (preserve_atimes)
455+ argstr[x++] = 'U';
456 if (preserve_perms)
457 argstr[x++] = 'p';
458 else if (preserve_executability && am_sender)
459--- old/rsync.c
460+++ new/rsync.c
461@@ -37,6 +37,7 @@ extern int preserve_perms;
462 extern int preserve_executability;
463 extern int preserve_times;
464 extern int omit_dir_times;
465+extern int preserve_atimes;
466 extern int orig_umask;
467 extern int am_root;
468 extern int am_server;
469@@ -116,6 +117,7 @@ int set_file_attrs(char *fname, struct f
470 int updated = 0;
471 STRUCT_STAT st2;
472 int change_uid, change_gid;
473+ time_t atime, mtime;
474
475 if (!st) {
476 if (dry_run)
477@@ -134,18 +136,33 @@ int set_file_attrs(char *fname, struct f
478 }
479 }
480
481+ /* This code must be the first update in the function due to
482+ * how it uses the "updated" variable. */
483 if (!preserve_times || (S_ISDIR(st->st_mode) && omit_dir_times))
484 flags |= ATTRS_SKIP_MTIME;
485+ if (!preserve_atimes || S_ISDIR(st->st_mode))
486+ flags |= ATTRS_SKIP_ATIME;
487 if (!(flags & ATTRS_SKIP_MTIME)
488- && cmp_modtime(st->st_mtime, file->modtime) != 0) {
489- int ret = set_modtime(fname, file->modtime, st->st_mode);
490+ && cmp_time(st->st_mtime, file->modtime) != 0) {
491+ mtime = file->modtime;
492+ updated = 1;
493+ } else
494+ mtime = st->st_mtime;
495+ if (!(flags & ATTRS_SKIP_ATIME)
496+ && cmp_time(st->st_atime, file->atime) != 0) {
497+ atime = file->atime;
498+ updated = 1;
499+ } else
500+ atime = st->st_atime;
501+ if (updated) {
502+ int ret = set_times(fname, mtime, atime, st->st_mode);
503 if (ret < 0) {
504 rsyserr(FERROR, errno, "failed to set times on %s",
505 full_fname(fname));
506 return 0;
507 }
508- if (ret == 0) /* ret == 1 if symlink could not be set */
509- updated = 1;
510+ if (ret > 0) /* ret == 1 if symlink could not be set */
511+ updated = 0;
512 }
513
514 change_uid = am_root && preserve_uid && st->st_uid != file->uid;
515--- old/rsync.h
516+++ new/rsync.h
517@@ -54,6 +54,7 @@
518 #define XMIT_HAS_IDEV_DATA (1<<9)
519 #define XMIT_SAME_DEV (1<<10)
520 #define XMIT_RDEV_MINOR_IS_SMALL (1<<11)
521+#define XMIT_SAME_ATIME (1<<12)
522
523 /* These flags are used in the live flist data. */
524
525@@ -119,6 +120,7 @@
526
527 #define ATTRS_REPORT (1<<0)
528 #define ATTRS_SKIP_MTIME (1<<1)
529+#define ATTRS_SKIP_ATIME (1<<2)
530
531 #define FULL_FLUSH 1
532 #define NORMAL_FLUSH 0
533@@ -135,6 +137,7 @@
534 #define FNAMECMP_FUZZY 0x83
535
536 /* For use by the itemize_changes code */
537+#define ITEM_REPORT_ATIME (1<<0)
538 #define ITEM_REPORT_CHECKSUM (1<<1)
539 #define ITEM_REPORT_SIZE (1<<2)
540 #define ITEM_REPORT_TIME (1<<3)
541@@ -520,9 +523,12 @@ struct file_struct {
542 uid_t uid;
543 gid_t gid;
544 mode_t mode;
545- uchar flags; /* this item MUST remain last */
546+ time_t atime; /* this MUST be second to last */
547+ uchar fl4g5; /* this item MUST remain last */
548 };
549
550+#define FFLAGS(f) ((uchar*)(f))[file_struct_len-1]
551+
552 /*
553 * Start the flist array at FLIST_START entries and grow it
554 * by doubling until FLIST_LINEAR then grow by FLIST_LINEAR
555--- old/rsync.yo
556+++ new/rsync.yo
557@@ -323,8 +323,9 @@ to the detailed description below for a
558 --devices preserve device files (super-user only)
559 --specials preserve special files
560 -D same as --devices --specials
561- -t, --times preserve times
562- -O, --omit-dir-times omit directories when preserving times
563+ -t, --times preserve modify times
564+ -O, --omit-dir-times omit directories when preserving mod-times
565+ -U, --atimes preserve access (use) times
566 --super receiver attempts super-user activities
567 -S, --sparse handle sparse files efficiently
568 -n, --dry-run show what would have been transferred
569@@ -800,6 +801,12 @@ it is preserving modification times (see
570 the directories on the receiving side, it is a good idea to use bf(-O).
571 This option is inferred if you use bf(--backup) without bf(--backup-dir).
572
573+dit(bf(-U, --atimes)) This tells rsync to set the access (use) times of the
574+destination files to the same value as the source files. Note that the
575+reading of the source file may update the atime of the source files, so
576+repeated rsync runs with --atimes may be needed if you want to force the
577+access-time values to be 100% identical on the two systems.
578+
579 dit(bf(--super)) This tells the receiving side to attempt super-user
580 activities even if the receiving rsync wasn't run by the super-user. These
581 activities include: preserving users via the bf(--owner) option, preserving
582@@ -1307,8 +1314,8 @@ if the receiving rsync is at least versi
583 with older versions of rsync, but that also turns on the output of other
584 verbose messages).
585
586-The "%i" escape has a cryptic output that is 8 letters long. The general
587-format is like the string bf(YXcstpog), where bf(Y) is replaced by the
588+The "%i" escape has a cryptic output that is 9 letters long. The general
589+format is like the string bf(YXcstupog), where bf(Y) is replaced by the
590 kind of update being done, bf(X) is replaced by the file-type, and the
591 other letters represent attributes that may be output if they are being
592 modified.
593@@ -1348,9 +1355,13 @@ quote(itemize(
594 by the file transfer.
595 it() A bf(t) means the modification time is different and is being updated
596 to the sender's value (requires bf(--times)). An alternate value of bf(T)
597- means that the time will be set to the transfer time, which happens
598+ means that the modify time will be set to the transfer time, which happens
599 anytime a symlink is transferred, or when a file or device is transferred
600 without bf(--times).
601+ it() A bf(u) means the access (use) time is different and is being updated to
602+ the sender's value (requires bf(--atimes)). An alternate value of bf(U)
603+ means that the access time will be set to the transfer time, which happens
604+ anytime a symlink is transferred.
605 it() A bf(p) means the permissions are different and are being updated to
606 the sender's value (requires bf(--perms)).
607 it() An bf(o) means the owner is different and is being updated to the
608--- old/sender.c
609+++ new/sender.c
610@@ -38,6 +38,7 @@ extern int do_progress;
611 extern int inplace;
612 extern int batch_fd;
613 extern int write_batch;
614+extern unsigned int file_struct_len;
615 extern struct stats stats;
616 extern struct file_list *the_file_list;
617 extern char *log_format;
618@@ -126,7 +127,7 @@ void successful_send(int ndx)
619
620 file = the_file_list->files[ndx];
621 /* The generator might tell us about symlinks we didn't send. */
622- if (!(file->flags & FLAG_SENT) && !S_ISLNK(file->mode))
623+ if (!(FFLAGS(file) & FLAG_SENT) && !S_ISLNK(file->mode))
624 return;
625 if (file->dir.root) {
626 offset = stringjoin(fname, sizeof fname,
627@@ -370,7 +371,7 @@ void send_files(struct file_list *flist,
628 rprintf(FINFO, "sender finished %s\n", fname);
629
630 /* Flag that we actually sent this entry. */
631- file->flags |= FLAG_SENT;
632+ FFLAGS(file) |= FLAG_SENT;
633 }
634 make_backups = save_make_backups;
635
636--- old/testsuite/atimes.test
637+++ new/testsuite/atimes.test
638@@ -0,0 +1,19 @@
639+#! /bin/sh
640+
641+# Test rsync copying atimes
642+
643+. "$suitedir/rsync.fns"
644+
645+set -x
646+
647+mkdir "$fromdir"
648+
649+touch "$fromdir/foo"
650+touch -a -t 200102031717.42 "$fromdir/foo"
651+
652+TLS_ARGS=--atime
653+
654+checkit "$RSYNC -rtUgvvv \"$fromdir/\" \"$todir/\"" "$fromdir" "$todir"
655+
656+# The script would have aborted on error, so getting here means we've won.
657+exit 0
658--- old/testsuite/devices.test
659+++ new/testsuite/devices.test
660@@ -42,14 +42,14 @@ touch -r "$fromdir/block" "$fromdir/bloc
661 $RSYNC -ai "$fromdir/block" "$todir/block2" \
662 | tee "$outfile"
663 cat <<EOT >"$chkfile"
664-cD++++++ block
665+cD+++++++ block
666 EOT
667 diff $diffopt "$chkfile" "$outfile" || test_fail "test 1 failed"
668
669 $RSYNC -ai "$fromdir/block2" "$todir/block" \
670 | tee "$outfile"
671 cat <<EOT >"$chkfile"
672-cD++++++ block2
673+cD+++++++ block2
674 EOT
675 diff $diffopt "$chkfile" "$outfile" || test_fail "test 2 failed"
676
677@@ -58,7 +58,7 @@ sleep 1
678 $RSYNC -Di "$fromdir/block3" "$todir/block" \
679 | tee "$outfile"
680 cat <<EOT >"$chkfile"
681-cD..T... block3
682+cD..T.... block3
683 EOT
684 diff $diffopt "$chkfile" "$outfile" || test_fail "test 3 failed"
685
686@@ -66,15 +66,15 @@ $RSYNC -aiHvv "$fromdir/" "$todir/" \
687 | tee "$outfile"
688 filter_outfile
689 cat <<EOT >"$chkfile"
690-.d..t... ./
691-cD..t... block
692-cD...... block2
693-cD++++++ block3
694-hD++++++ block2.5 => block3
695-cD++++++ char
696-cD++++++ char2
697-cD++++++ char3
698-cS++++++ fifo
699+.d..t.... ./
700+cD..t.... block
701+cD....... block2
702+cD+++++++ block3
703+hD+++++++ block2.5 => block3
704+cD+++++++ char
705+cD+++++++ char2
706+cD+++++++ char3
707+cS+++++++ fifo
708 EOT
709 if test ! -b "$fromdir/block2.5"; then
710 sed -e '/block2\.5/d' \
711--- old/testsuite/itemize.test
712+++ new/testsuite/itemize.test
713@@ -29,14 +29,14 @@ ln "$fromdir/foo/config1" "$fromdir/foo/
714 $RSYNC -iplr "$fromdir/" "$todir/" \
715 | tee "$outfile"
716 cat <<EOT >"$chkfile"
717-cd++++++ bar/
718-cd++++++ bar/baz/
719->f++++++ bar/baz/rsync
720-cd++++++ foo/
721->f++++++ foo/config1
722->f++++++ foo/config2
723->f++++++ foo/extra
724-cL++++++ foo/sym -> ../bar/baz/rsync
725+cd+++++++ bar/
726+cd+++++++ bar/baz/
727+>f+++++++ bar/baz/rsync
728+cd+++++++ foo/
729+>f+++++++ foo/config1
730+>f+++++++ foo/config2
731+>f+++++++ foo/extra
732+cL+++++++ foo/sym -> ../bar/baz/rsync
733 EOT
734 diff $diffopt "$chkfile" "$outfile" || test_fail "test 1 failed"
735
736@@ -48,10 +48,10 @@ chmod 601 "$fromdir/foo/config2"
737 $RSYNC -iplrH "$fromdir/" "$todir/" \
738 | tee "$outfile"
739 cat <<EOT >"$chkfile"
740->f..T... bar/baz/rsync
741->f..T... foo/config1
742->f.sTp.. foo/config2
743-hf..T... foo/extra => foo/config1
744+>f..T.... bar/baz/rsync
745+>f..T.... foo/config1
746+>f.sT.p.. foo/config2
747+hf..T.... foo/extra => foo/config1
748 EOT
749 diff $diffopt "$chkfile" "$outfile" || test_fail "test 2 failed"
750
751@@ -68,11 +68,11 @@ chmod 777 "$todir/bar/baz/rsync"
752 $RSYNC -iplrtc "$fromdir/" "$todir/" \
753 | tee "$outfile"
754 cat <<EOT >"$chkfile"
755-.f..tp.. bar/baz/rsync
756-.d..t... foo/
757-.f..t... foo/config1
758->fcstp.. foo/config2
759-cL..T... foo/sym -> ../bar/baz/rsync
760+.f..t.p.. bar/baz/rsync
761+.d..t.... foo/
762+.f..t.... foo/config1
763+>fcst.p.. foo/config2
764+cL..T.... foo/sym -> ../bar/baz/rsync
765 EOT
766 diff $diffopt "$chkfile" "$outfile" || test_fail "test 3 failed"
767
768@@ -97,15 +97,15 @@ $RSYNC -ivvplrtH "$fromdir/" "$todir/" \
769 | tee "$outfile"
770 filter_outfile
771 cat <<EOT >"$chkfile"
772-.d ./
773-.d bar/
774-.d bar/baz/
775-.f...p.. bar/baz/rsync
776-.d foo/
777-.f foo/config1
778->f..t... foo/config2
779-hf foo/extra
780-.L foo/sym -> ../bar/baz/rsync
781+.d ./
782+.d bar/
783+.d bar/baz/
784+.f....p.. bar/baz/rsync
785+.d foo/
786+.f foo/config1
787+>f..t.... foo/config2
788+hf foo/extra
789+.L foo/sym -> ../bar/baz/rsync
790 EOT
791 diff $diffopt "$chkfile" "$outfile" || test_fail "test 5 failed"
792
793@@ -124,8 +124,8 @@ touch "$todir/foo/config2"
794 $RSYNC -iplrtH "$fromdir/" "$todir/" \
795 | tee "$outfile"
796 cat <<EOT >"$chkfile"
797-.f...p.. foo/config1
798->f..t... foo/config2
799+.f....p.. foo/config1
800+>f..t.... foo/config2
801 EOT
802 diff $diffopt "$chkfile" "$outfile" || test_fail "test 7 failed"
803
804@@ -134,15 +134,15 @@ $RSYNC -ivvplrtH --copy-dest="$lddir" "$
805 | tee "$outfile"
806 filter_outfile
807 cat <<EOT >"$chkfile"
808-.d..t... ./
809-cd++++++ bar/
810-cd++++++ bar/baz/
811-cf bar/baz/rsync
812-cd++++++ foo/
813-cf foo/config1
814-cf foo/config2
815-hf foo/extra => foo/config1
816-cL..T... foo/sym -> ../bar/baz/rsync
817+.d..t.... ./
818+cd+++++++ bar/
819+cd+++++++ bar/baz/
820+cf bar/baz/rsync
821+cd+++++++ foo/
822+cf foo/config1
823+cf foo/config2
824+hf foo/extra => foo/config1
825+cL..T.... foo/sym -> ../bar/baz/rsync
826 EOT
827 diff $diffopt "$chkfile" "$outfile" || test_fail "test 8 failed"
828
829@@ -150,11 +150,11 @@ rm -rf "$todir"
830 $RSYNC -iplrtH --copy-dest="$lddir" "$fromdir/" "$todir/" \
831 | tee "$outfile"
832 cat <<EOT >"$chkfile"
833-.d..t... ./
834-cd++++++ bar/
835-cd++++++ bar/baz/
836-cd++++++ foo/
837-hf foo/extra => foo/config1
838+.d..t.... ./
839+cd+++++++ bar/
840+cd+++++++ bar/baz/
841+cd+++++++ foo/
842+hf foo/extra => foo/config1
843 EOT
844 diff $diffopt "$chkfile" "$outfile" || test_fail "test 9 failed"
845
846@@ -181,15 +181,15 @@ $RSYNC -ivvplrtH --link-dest="$lddir" "$
847 | tee "$outfile"
848 filter_outfile
849 cat <<EOT >"$chkfile"
850-.d..t... ./
851-cd++++++ bar/
852-cd++++++ bar/baz/
853-hf bar/baz/rsync
854-cd++++++ foo/
855-hf foo/config1
856-hf foo/config2
857-hf foo/extra => foo/config1
858-hL foo/sym -> ../bar/baz/rsync
859+.d..t.... ./
860+cd+++++++ bar/
861+cd+++++++ bar/baz/
862+hf bar/baz/rsync
863+cd+++++++ foo/
864+hf foo/config1
865+hf foo/config2
866+hf foo/extra => foo/config1
867+hL foo/sym -> ../bar/baz/rsync
868 EOT
869 diff $diffopt "$chkfile" "$outfile" || test_fail "test 11 failed"
870
871@@ -197,10 +197,10 @@ rm -rf "$todir"
872 $RSYNC -iplrtH --link-dest="$lddir" "$fromdir/" "$todir/" \
873 | tee "$outfile"
874 cat <<EOT >"$chkfile"
875-.d..t... ./
876-cd++++++ bar/
877-cd++++++ bar/baz/
878-cd++++++ foo/
879+.d..t.... ./
880+cd+++++++ bar/
881+cd+++++++ bar/baz/
882+cd+++++++ foo/
883 EOT
884 diff $diffopt "$chkfile" "$outfile" || test_fail "test 12 failed"
885
886@@ -228,14 +228,14 @@ filter_outfile
887 # TODO fix really-old problem when combining -H with --compare-dest:
888 # missing output for foo/extra hard-link (and it might not be updated)!
889 cat <<EOT >"$chkfile"
890-.d..t... ./
891-cd++++++ bar/
892-cd++++++ bar/baz/
893-.f bar/baz/rsync
894-cd++++++ foo/
895-.f foo/config1
896-.f foo/config2
897-.L foo/sym -> ../bar/baz/rsync
898+.d..t.... ./
899+cd+++++++ bar/
900+cd+++++++ bar/baz/
901+.f bar/baz/rsync
902+cd+++++++ foo/
903+.f foo/config1
904+.f foo/config2
905+.L foo/sym -> ../bar/baz/rsync
906 EOT
907 diff $diffopt "$chkfile" "$outfile" || test_fail "test 14 failed"
908
909@@ -243,10 +243,10 @@ rm -rf "$todir"
910 $RSYNC -iplrtH --compare-dest="$lddir" "$fromdir/" "$todir/" \
911 | tee "$outfile"
912 cat <<EOT >"$chkfile"
913-.d..t... ./
914-cd++++++ bar/
915-cd++++++ bar/baz/
916-cd++++++ foo/
917+.d..t.... ./
918+cd+++++++ bar/
919+cd+++++++ bar/baz/
920+cd+++++++ foo/
921 EOT
922 diff $diffopt "$chkfile" "$outfile" || test_fail "test 15 failed"
923
924--- old/testsuite/rsync.fns
925+++ new/testsuite/rsync.fns
926@@ -66,7 +66,7 @@ printmsg() {
927 }
928
929 rsync_ls_lR() {
930- find "$@" -print | sort | sed 's/ /\\ /g' | xargs "$TOOLDIR/tls"
931+ find "$@" -print | sort | sed 's/ /\\ /g' | xargs "$TOOLDIR/tls" $TLS_ARGS
932 }
933
934 check_perms() {
935@@ -184,6 +184,10 @@ checkit() {
936 # We can just write everything to stdout/stderr, because the
937 # wrapper hides it unless there is a problem.
938
939+ if test x$TLS_ARGS = x--atime; then
940+ ( cd "$2" && rsync_ls_lR . ) > "$tmpdir/ls-from"
941+ fi
942+
943 echo "Running: \"$1\""
944 eval "$1"
945 status=$?
946@@ -191,10 +195,13 @@ checkit() {
947 failed="YES";
948 fi
949
950+ if test x$TLS_ARGS != x--atime; then
951+ ( cd "$2" && rsync_ls_lR . ) > "$tmpdir/ls-from"
952+ fi
953+
954 echo "-------------"
955 echo "check how the directory listings compare with diff:"
956 echo ""
957- ( cd "$2" && rsync_ls_lR . ) > "$tmpdir/ls-from"
958 ( cd "$3" && rsync_ls_lR . ) > "$tmpdir/ls-to"
959 diff $diffopt "$tmpdir/ls-from" "$tmpdir/ls-to" || failed=YES
960
961--- old/tls.c
962+++ new/tls.c
963@@ -39,6 +39,7 @@
964
965
966 #include "rsync.h"
967+#include "popt.h"
968
969 #define PROGRAM "tls"
970
971@@ -48,6 +49,7 @@ int read_only = 1;
972 int list_only = 0;
973 int preserve_perms = 0;
974
975+static int display_atime = 0;
976
977 static void failed(char const *what, char const *where)
978 {
979@@ -56,14 +58,29 @@ static void failed(char const *what, cha
980 exit(1);
981 }
982
983+static void storetime(char *dest, time_t t)
984+{
985+ if (t) {
986+ struct tm *mt = gmtime(&t);
987
988+ sprintf(dest, "%04d-%02d-%02d %02d:%02d:%02d ",
989+ (int)mt->tm_year + 1900,
990+ (int)mt->tm_mon + 1,
991+ (int)mt->tm_mday,
992+ (int)mt->tm_hour,
993+ (int)mt->tm_min,
994+ (int)mt->tm_sec);
995+ } else {
996+ strcpy(dest, " ");
997+ }
998+}
999
1000 static void list_file(const char *fname)
1001 {
1002 STRUCT_STAT buf;
1003 char permbuf[PERMSTRING_SIZE];
1004- struct tm *mt;
1005- char datebuf[50];
1006+ char mtimebuf[50];
1007+ char atimebuf[50];
1008 char linkbuf[4096];
1009
1010 if (do_lstat(fname, &buf) < 0)
1011@@ -96,19 +113,8 @@ static void list_file(const char *fname)
1012
1013 permstring(permbuf, buf.st_mode);
1014
1015- if (buf.st_mtime) {
1016- mt = gmtime(&buf.st_mtime);
1017-
1018- sprintf(datebuf, "%04d-%02d-%02d %02d:%02d:%02d",
1019- (int)mt->tm_year + 1900,
1020- (int)mt->tm_mon + 1,
1021- (int)mt->tm_mday,
1022- (int)mt->tm_hour,
1023- (int)mt->tm_min,
1024- (int)mt->tm_sec);
1025- } else {
1026- strcpy(datebuf, " ");
1027- }
1028+ storetime(mtimebuf, buf.st_mtime);
1029+ storetime(atimebuf, buf.st_atime);
1030
1031 /* TODO: Perhaps escape special characters in fname? */
1032
1033@@ -119,24 +125,55 @@ static void list_file(const char *fname)
1034 (long)minor(buf.st_rdev));
1035 } else /* NB: use double for size since it might not fit in a long. */
1036 printf("%12.0f", (double)buf.st_size);
1037- printf(" %6ld.%-6ld %6ld %s %s%s\n",
1038+ printf(" %6ld.%-6ld %6ld %s%s%s%s\n",
1039 (long)buf.st_uid, (long)buf.st_gid, (long)buf.st_nlink,
1040- datebuf, fname, linkbuf);
1041+ mtimebuf, display_atime && !S_ISDIR(buf.st_mode) ? atimebuf : "",
1042+ fname, linkbuf);
1043 }
1044
1045+static struct poptOption long_options[] = {
1046+ /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
1047+ {"atime", 'u', POPT_ARG_NONE, &display_atime, 0, 0, 0},
1048+ {"help", 'h', POPT_ARG_NONE, 0, 'h', 0, 0},
1049+ {0,0,0,0,0,0,0}
1050+};
1051+
1052+static void tls_usage(int ret)
1053+{
1054+ fprintf(stderr, "usage: " PROGRAM " [--atime | -u] DIR ...\n"
1055+ "Trivial file listing program for portably checking rsync\n");
1056+ exit(ret);
1057+}
1058
1059 int
1060 main(int argc, char *argv[])
1061 {
1062- if (argc < 2) {
1063- fprintf(stderr, "usage: " PROGRAM " DIR ...\n"
1064- "Trivial file listing program for portably checking rsync\n");
1065- return 1;
1066+ poptContext pc;
1067+ const char **extra_args;
1068+ int opt;
1069+
1070+ pc = poptGetContext(PROGRAM, argc, (const char **)argv,
1071+ long_options, 0);
1072+ while ((opt = poptGetNextOpt(pc)) != -1) {
1073+ switch (opt) {
1074+ case 'h':
1075+ tls_usage(0);
1076+ default:
1077+ fprintf(stderr,
1078+ "%s: %s\n",
1079+ poptBadOption(pc, POPT_BADOPTION_NOALIAS),
1080+ poptStrerror(opt));
1081+ tls_usage(1);
1082+ }
1083 }
1084
1085- for (argv++; *argv; argv++) {
1086- list_file(*argv);
1087- }
1088+ extra_args = poptGetArgs(pc);
1089+ if (*extra_args == NULL)
1090+ tls_usage(1);
1091+
1092+ for (; *extra_args; extra_args++)
1093+ list_file(*extra_args);
1094+ poptFreeContext(pc);
1095
1096 return 0;
1097 }
1098--- old/util.c
1099+++ new/util.c
1100@@ -130,7 +130,7 @@ void overflow_exit(char *str)
1101
1102
1103
1104-int set_modtime(char *fname, time_t modtime, mode_t mode)
1105+int set_times(char *fname, time_t modtime, time_t atime, mode_t mode)
1106 {
1107 #if !defined HAVE_LUTIMES || !defined HAVE_UTIMES
1108 if (S_ISLNK(mode))
1109@@ -138,9 +138,13 @@ int set_modtime(char *fname, time_t modt
1110 #endif
1111
1112 if (verbose > 2) {
1113- rprintf(FINFO, "set modtime of %s to (%ld) %s",
1114+ char mtimebuf[200];
1115+
1116+ strlcpy(mtimebuf, timestring(modtime), sizeof mtimebuf);
1117+ rprintf(FINFO,
1118+ "set modtime, atime of %s to (%ld) %s, (%ld) %s\n",
1119 fname, (long)modtime,
1120- asctime(localtime(&modtime)));
1121+ mtimebuf, (long)atime, timestring(atime));
1122 }
1123
1124 if (dry_run)
1125@@ -149,7 +153,7 @@ int set_modtime(char *fname, time_t modt
1126 {
1127 #ifdef HAVE_UTIMES
1128 struct timeval t[2];
1129- t[0].tv_sec = time(NULL);
1130+ t[0].tv_sec = atime;
1131 t[0].tv_usec = 0;
1132 t[1].tv_sec = modtime;
1133 t[1].tv_usec = 0;
1134@@ -160,12 +164,12 @@ int set_modtime(char *fname, time_t modt
1135 return utimes(fname, t);
1136 #elif defined HAVE_UTIMBUF
1137 struct utimbuf tbuf;
1138- tbuf.actime = time(NULL);
1139+ tbuf.actime = atime;
1140 tbuf.modtime = modtime;
1141 return utime(fname,&tbuf);
1142 #elif defined HAVE_UTIME
1143 time_t t[2];
1144- t[0] = time(NULL);
1145+ t[0] = atime;
1146 t[1] = modtime;
1147 return utime(fname,t);
1148 #else
1149@@ -1183,8 +1187,8 @@ int msleep(int t)
1150
1151
1152 /**
1153- * Determine if two file modification times are equivalent (either
1154- * exact or in the modification timestamp window established by
1155+ * Determine if two file times are equivalent (either
1156+ * exact or in the timestamp window established by
1157 * --modify-window).
1158 *
1159 * @retval 0 if the times should be treated as the same
1160@@ -1193,7 +1197,7 @@ int msleep(int t)
1161 *
1162 * @retval -1 if the 2nd is later
1163 **/
1164-int cmp_modtime(time_t file1, time_t file2)
1165+int cmp_time(time_t file1, time_t file2)
1166 {
1167 if (file2 > file1) {
1168 if (file2 - file1 <= modify_window)