| ... | ... | @@ -612,8 +612,6 @@ const Os = switch (builtin.os.tag) { |
| 612 | 612 | /// -1. Otherwise, it needs to be opened in update(), and will be |
| 613 | 613 | /// stored here. |
| 614 | 614 | dir_fd: i32, |
| 615 | | /// Number of files being watched by this directory handle. |
| 616 | | ref_count: u32, |
| 617 | 615 | }), |
| 618 | 616 | |
| 619 | 617 | const dir_open_flags: posix.O = f: { |
| ... | ... | @@ -673,11 +671,9 @@ const Os = switch (builtin.os.tag) { |
| 673 | 671 | try handles.append(gpa, .{ |
| 674 | 672 | .rs = .{}, |
| 675 | 673 | .dir_fd = if (skip_open_dir) -1 else dir_fd, |
| 676 | | .ref_count = 1, |
| 677 | 674 | }); |
| 678 | | } else { |
| 679 | | handles.items(.ref_count)[gop.index] += 1; |
| 680 | 675 | } |
| 676 | |
| 681 | 677 | break :rs &handles.items(.rs)[gop.index]; |
| 682 | 678 | }; |
| 683 | 679 | for (files.items) |basename| { |
| ... | ... | @@ -718,10 +714,6 @@ const Os = switch (builtin.os.tag) { |
| 718 | 714 | } |
| 719 | 715 | } |
| 720 | 716 | |
| 721 | | const ref_count_ptr = &handles.items(.ref_count)[i]; |
| 722 | | ref_count_ptr.* -= 1; |
| 723 | | if (ref_count_ptr.* > 0) continue; |
| 724 | | |
| 725 | 717 | // If the sub_path == "" then this patch has already the |
| 726 | 718 | // dir fd that we need to use as the ident to remove the |
| 727 | 719 | // event. If it was opened above with openat() then we need |
| ... | ... | @@ -738,10 +730,10 @@ const Os = switch (builtin.os.tag) { |
| 738 | 730 | // index in the udata field. |
| 739 | 731 | const last_dir_fd = fd: { |
| 740 | 732 | const last_path = w.dir_table.keys()[handles.len - 1]; |
| 741 | | const last_dir_fd = if (last_path.sub_path.len != 0) |
| 733 | const last_dir_fd = if (last_path.sub_path.len == 0) |
| 742 | 734 | last_path.root_dir.handle.fd |
| 743 | 735 | else |
| 744 | | handles.items(.dir_fd)[i]; |
| 736 | handles.items(.dir_fd)[handles.len - 1]; |
| 745 | 737 | assert(last_dir_fd != -1); |
| 746 | 738 | break :fd last_dir_fd; |
| 747 | 739 | }; |