diff options
author | Dale Rahn <drahn@cvs.openbsd.org> | 2007-02-09 14:51:14 +0000 |
---|---|---|
committer | Dale Rahn <drahn@cvs.openbsd.org> | 2007-02-09 14:51:14 +0000 |
commit | 1a9603dabab238e2d113a6b277c20a84c4fadcf3 (patch) | |
tree | 92a73183a7344617946c6d3d7bcf86900800aaf5 /libexec/ld.so/dir.c | |
parent | 87a420ac4a8ce469b56a43e63c58ced04dafbc04 (diff) |
readdir buffers should not get a fixed buffer size, but should be dependant
on the block size of the filesystem. Rounded up to page size for efficiency.
similar to change in libc yesterday. Should fix PR 5364.
Diffstat (limited to 'libexec/ld.so/dir.c')
-rw-r--r-- | libexec/ld.so/dir.c | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/libexec/ld.so/dir.c b/libexec/ld.so/dir.c index 40747894ef0..c061d8f4a0a 100644 --- a/libexec/ld.so/dir.c +++ b/libexec/ld.so/dir.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dir.c,v 1.12 2007/02/08 18:47:32 millert Exp $ */ +/* $OpenBSD: dir.c,v 1.13 2007/02/09 14:51:13 drahn Exp $ */ /* * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. @@ -59,7 +59,6 @@ _dl_opendir(const char *name) DIR *dirp; int fd; struct stat sb; - int incr; if ((fd = _dl_open(name, O_RDONLY | O_NONBLOCK)) < 0) return (NULL); @@ -73,18 +72,7 @@ _dl_opendir(const char *name) return (NULL); } - /* - * If the machine's page size is an exact multiple of DIRBLKSIZ, - * use a buffer that is cluster boundary aligned. - * Hopefully this can be a big win someday by allowing page trades - * to user space to be done by getdirentries() - * - not done in ld.so. - */ - incr = DIRBLKSIZ; - - /* UNION mount support removed */ - - dirp->dd_len = incr; + dirp->dd_len = _dl_round_page(sb.st_blksize); dirp->dd_buf = _dl_malloc(dirp->dd_len); if (dirp->dd_buf == NULL) { _dl_free(dirp); |