aboutsummaryrefslogtreecommitdiff
path: root/src/lib9/dirread.c
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2003-11-24 22:39:06 +0000
committerrsc <devnull@localhost>2003-11-24 22:39:06 +0000
commit912fba95e74c7631352bc5007249d75e720bbcdf (patch)
treeb9c86c0c38c71d742ffd3990706f380f8263fd8d /src/lib9/dirread.c
parent2db9e4821d8ae4889e63e5bb205b04eccb7af405 (diff)
downloadplan9port-912fba95e74c7631352bc5007249d75e720bbcdf.tar.gz
plan9port-912fba95e74c7631352bc5007249d75e720bbcdf.tar.bz2
plan9port-912fba95e74c7631352bc5007249d75e720bbcdf.zip
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.)
Diffstat (limited to 'src/lib9/dirread.c')
-rw-r--r--src/lib9/dirread.c13
1 files changed, 8 insertions, 5 deletions
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;