1 --- telldir.c.orig 2007-01-24 14:10:41.000000000 -0800
2 +++ telldir.c 2007-01-27 02:51:57.000000000 -0800
4 * cookie may be used only once before it is freed. This option
5 * is used to avoid having memory usage grow without bound.
9 +#endif /* !__DARWIN_UNIX03 */
12 * return a pointer into a directory
19 + _pthread_mutex_lock((pthread_mutex_t *)&dirp->dd_lock);
20 + LIST_FOREACH(lp, &dirp->dd_td->td_locq, loc_lqe) {
22 +#if __DARWIN_64_BIT_INO_T
23 + (lp->loc_seek == dirp->dd_td->seekoff)
24 +#else /* !__DARWIN_64_BIT_INO_T */
25 + (lp->loc_seek == dirp->dd_seek)
26 +#endif /* __DARWIN_64_BIT_INO_T */
27 + && (lp->loc_loc == dirp->dd_loc))
30 + if ((lp = (struct ddloc *)malloc(sizeof(struct ddloc))) == NULL) {
32 + _pthread_mutex_unlock((pthread_mutex_t *)&dirp->dd_lock);
35 +#else /* !__DARWIN_UNIX03 */
36 if ((lp = (struct ddloc *)malloc(sizeof(struct ddloc))) == NULL)
39 _pthread_mutex_lock((pthread_mutex_t *)&dirp->dd_lock);
40 +#endif /* __DARWIN_UNIX03 */
41 lp->loc_index = dirp->dd_td->td_loccnt++;
42 +#if __DARWIN_64_BIT_INO_T
43 + lp->loc_seek = dirp->dd_td->seekoff;
44 +#else /* !__DARWIN_64_BIT_INO_T */
45 lp->loc_seek = dirp->dd_seek;
46 +#endif /* __DARWIN_64_BIT_INO_T */
47 lp->loc_loc = dirp->dd_loc;
48 LIST_INSERT_HEAD(&dirp->dd_td->td_locq, lp, loc_lqe);
51 +#endif /* __DARWIN_UNIX03 */
53 _pthread_mutex_unlock((pthread_mutex_t *)&dirp->dd_lock);
54 return (lp->loc_index);
59 - if (lp->loc_loc == dirp->dd_loc && lp->loc_seek == dirp->dd_seek)
60 + if (lp->loc_loc == dirp->dd_loc &&
61 +#if __DARWIN_64_BIT_INO_T
62 + lp->loc_seek == dirp->dd_td->seekoff
63 +#else /* !__DARWIN_64_BIT_INO_T */
64 + lp->loc_seek == dirp->dd_seek
65 +#endif /* __DARWIN_64_BIT_INO_T */
68 (void) lseek(dirp->dd_fd, (off_t)lp->loc_seek, SEEK_SET);
69 +#if __DARWIN_64_BIT_INO_T
70 + dirp->dd_td->seekoff = lp->loc_seek;
71 +#else /* !__DARWIN_64_BIT_INO_T */
72 dirp->dd_seek = lp->loc_seek;
73 +#endif /* __DARWIN_64_BIT_INO_T */
75 while (dirp->dd_loc < lp->loc_loc) {
76 dp = _readdir_unlocked(dirp);
83 LIST_REMOVE(lp, loc_lqe);
88 +#ifndef BUILDING_VARIANT
90 * Reclaim memory for telldir cookies which weren't used.
94 LIST_INIT(&dirp->dd_td->td_locq);
96 +#endif /* !BUILDING_VARIANT */