summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/fwalk.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/stdio/fwalk.c')
-rw-r--r--lib/libc/stdio/fwalk.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/libc/stdio/fwalk.c b/lib/libc/stdio/fwalk.c
index b1a25d1..17cb5ce 100644
--- a/lib/libc/stdio/fwalk.c
+++ b/lib/libc/stdio/fwalk.c
@@ -42,20 +42,26 @@ static const char rcsid[] =
"$FreeBSD$";
#endif /* LIBC_SCCS and not lint */
-#include <errno.h>
+#include <sys/types.h>
+#include <machine/atomic.h>
#include <stdio.h>
#include "local.h"
#include "glue.h"
int
_fwalk(function)
- register int (*function)(FILE *);
+ int (*function)(FILE *);
{
- register FILE *fp;
- register int n, ret;
- register struct glue *g;
+ FILE *fp;
+ int n, ret;
+ struct glue *g;
ret = 0;
+ /*
+ * It should be safe to walk the list without locking it;
+ * new nodes are only added to the end and none are ever
+ * removed.
+ */
for (g = &__sglue; g != NULL; g = g->next)
for (fp = g->iobs, n = g->niobs; --n >= 0; fp++)
if (fp->_flags != 0)
OpenPOWER on IntegriCloud