More tweaks on Linux and Solaris.

This commit is contained in:
rsc 2003-11-25 02:11:11 +00:00
parent f7012583e9
commit 64bcfff3a1
14 changed files with 118 additions and 75 deletions

View file

@ -6,19 +6,39 @@
extern int _p9dir(struct stat*, char*, Dir*, char**, char*);
/* almost everyone has getdirentries, just use that */
#if defined(__linux__)
static int
mygetdents(int fd, char *buf, int n)
mygetdents(int fd, struct dirent *buf, int n)
{
ssize_t nn;
off_t off;
off = p9seek(fd, 0, 1);
nn = getdirentries(fd, (void*)buf, n, &off);
if(nn > 0)
p9seek(fd, off, 0);
return nn;
}
#elif defined(__APPLE__) || defined(__FreeBSD__)
static int
mygetdents(int fd, struct dirent *buf, int n)
{
ssize_t nn;
long off;
off = p9seek(fd, 0, 1);
nn = getdirentries(fd, buf, n, &off);
nn = getdirentries(fd, (void*)buf, n, &off);
if(nn > 0)
p9seek(fd, off, 0);
return nn;
}
#elif defined(__sun__)
static int
mygetdents(int fd, struct dirent *buf, int n)
{
return getdents(fd, (void*)buf, n);
}
#endif
static int
countde(char *p, int n)