From 912fba95e74c7631352bc5007249d75e720bbcdf Mon Sep 17 00:00:00 2001 From: rsc Date: Mon, 24 Nov 2003 22:39:06 +0000 Subject: Changes for Mac OS X. Most important is stack sizes in samterm, which were completely bogus. (Libthread used to ignore them but not anymore. Maybe we really should ignore them, but that breaks Venti, which needs *really* big stacks.) --- src/lib9/dirread.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/lib9/dirread.c') diff --git a/src/lib9/dirread.c b/src/lib9/dirread.c index 359b09ec..2e1ce886 100644 --- a/src/lib9/dirread.c +++ b/src/lib9/dirread.c @@ -11,12 +11,16 @@ extern int _p9dir(struct stat*, char*, Dir*, char**, char*); -#if !defined(_HAVEGETDENTS) && defined(_HAVEGETDIRENTRIES) +/* everyone has getdirentries, just use that */ static int -getdents(int fd, char *buf, int n) +mygetdents(int fd, char *buf, int n) { ssize_t nn; +#if _GETDIRENTRIES_TAKES_LONG + long off; +#else off_t off; +#endif off = seek(fd, 0, 1); nn = getdirentries(fd, buf, n, &off); @@ -24,7 +28,6 @@ getdents(int fd, char *buf, int n) seek(fd, off, 0); return nn; } -#endif static int countde(char *p, int n) @@ -123,7 +126,7 @@ dirread(int fd, Dir **dp) if(buf == nil) return -1; - n = getdents(fd, (void*)buf, st.st_blksize); + n = mygetdents(fd, (void*)buf, st.st_blksize); if(n < 0){ free(buf); return -1; @@ -156,7 +159,7 @@ dirreadall(int fd, Dir **d) return -1; } buf = nbuf; - n = getdents(fd, (void*)(buf+ts), st.st_blksize); + n = mygetdents(fd, (void*)(buf+ts), st.st_blksize); if(n <= 0) break; ts += n; -- cgit v1.2.3