Files
vlibc/src/dirent/telldir.c
T

23 lines
561 B
C

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <dirent.h>
#include "dirent_impl.h"
/*
* telldir (todo 24): return the stream's current directory location.
* readdir stores the kernel's d_off cookie of every entry it hands out —
* the offset at which iteration resumes AFTER that entry — so the cookie
* of the most recently returned entry is exactly the location a matching
* seekdir must restore. A fresh or rewound stream reports 0, the start.
*/
long
telldir(DIR *dir)
{
struct vlibc_DIR *d = dir;
return (long)d->de.d_off;
}