summaryrefslogtreecommitdiffstats
path: root/libc/misc/dirent
diff options
context:
space:
mode:
Diffstat (limited to 'libc/misc/dirent')
-rw-r--r--libc/misc/dirent/Makefile.in21
-rw-r--r--libc/misc/dirent/alphasort.c10
-rw-r--r--libc/misc/dirent/alphasort64.c23
-rw-r--r--libc/misc/dirent/dirfd.c12
-rw-r--r--libc/misc/dirent/dirstream.h2
-rw-r--r--libc/misc/dirent/readdir.c12
-rw-r--r--libc/misc/dirent/readdir64.c27
-rw-r--r--libc/misc/dirent/readdir64_r.c27
-rw-r--r--libc/misc/dirent/readdir_r.c12
-rw-r--r--libc/misc/dirent/rewinddir.c9
-rw-r--r--libc/misc/dirent/scandir.c40
-rw-r--r--libc/misc/dirent/scandir64.c29
-rw-r--r--libc/misc/dirent/seekdir.c10
-rw-r--r--libc/misc/dirent/telldir.c6
14 files changed, 127 insertions, 113 deletions
diff --git a/libc/misc/dirent/Makefile.in b/libc/misc/dirent/Makefile.in
index e1dfa3d94..d17ad8a17 100644
--- a/libc/misc/dirent/Makefile.in
+++ b/libc/misc/dirent/Makefile.in
@@ -1,30 +1,27 @@
# Makefile for uClibc
#
# Copyright (C) 2001 by Lineo, inc.
-# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+# Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
#
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-CSRC:= alphasort.c closedir.c dirfd.c opendir.c readdir.c rewinddir.c scandir.c \
+CSRC := alphasort.c closedir.c dirfd.c opendir.c readdir.c rewinddir.c scandir.c \
seekdir.c telldir.c readdir_r.c
ifeq ($(UCLIBC_HAS_LFS),y)
-CSRC+= readdir64.c alphasort64.c scandir64.c readdir64_r.c
+CSRC += readdir64.c alphasort64.c scandir64.c readdir64_r.c
endif
-MISC_DIRENT_DIR:=$(top_srcdir)libc/misc/dirent
-MISC_DIRENT_OUT:=$(top_builddir)libc/misc/dirent
+MISC_DIRENT_DIR := $(top_srcdir)libc/misc/dirent
+MISC_DIRENT_OUT := $(top_builddir)libc/misc/dirent
-MISC_DIRENT_SRC:=$(patsubst %.c,$(MISC_DIRENT_DIR)/%.c,$(CSRC))
-MISC_DIRENT_OBJ:=$(patsubst %.c,$(MISC_DIRENT_OUT)/%.o,$(CSRC))
+MISC_DIRENT_SRC := $(patsubst %.c,$(MISC_DIRENT_DIR)/%.c,$(CSRC))
+MISC_DIRENT_OBJ := $(patsubst %.c,$(MISC_DIRENT_OUT)/%.o,$(CSRC))
-libc-a-y+=$(MISC_DIRENT_OBJ)
-libc-so-y+=$(MISC_DIRENT_OBJ:.o=.os)
+libc-y += $(MISC_DIRENT_OBJ)
-libc-multi-y+=$(MISC_DIRENT_SRC)
-
-objclean-y+=misc_dirent_objclean
+objclean-y += misc_dirent_objclean
misc_dirent_objclean:
$(RM) $(MISC_DIRENT_OUT)/*.{o,os}
diff --git a/libc/misc/dirent/alphasort.c b/libc/misc/dirent/alphasort.c
index feae021e6..533366222 100644
--- a/libc/misc/dirent/alphasort.c
+++ b/libc/misc/dirent/alphasort.c
@@ -1,10 +1,18 @@
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
#include <dirent.h>
#include <string.h>
#include "dirstream.h"
+libc_hidden_proto(strcmp)
+
int alphasort(const void * a, const void * b)
{
- return __strcmp ((*(const struct dirent **) a)->d_name,
+ return strcmp ((*(const struct dirent **) a)->d_name,
(*(const struct dirent **) b)->d_name);
}
diff --git a/libc/misc/dirent/alphasort64.c b/libc/misc/dirent/alphasort64.c
index c6cfcdacf..86a91095d 100644
--- a/libc/misc/dirent/alphasort64.c
+++ b/libc/misc/dirent/alphasort64.c
@@ -1,24 +1,19 @@
-#include <features.h>
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include <_lfs_64.h>
-#if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS != 64
-#undef _FILE_OFFSET_BITS
-#define _FILE_OFFSET_BITS 64
-#endif
-#ifndef __USE_LARGEFILE64
-# define __USE_LARGEFILE64 1
-#endif
-/* We absolutely do _NOT_ want interfaces silently
- * renamed under us or very bad things will happen... */
-#ifdef __USE_FILE_OFFSET64
-# undef __USE_FILE_OFFSET64
-#endif
#include <dirent.h>
#include <string.h>
#include "dirstream.h"
+libc_hidden_proto(strcmp)
int alphasort64(const void * a, const void * b)
{
- return __strcmp ((*(const struct dirent64 **) a)->d_name,
+ return strcmp ((*(const struct dirent64 **) a)->d_name,
(*(const struct dirent64 **) b)->d_name);
}
diff --git a/libc/misc/dirent/dirfd.c b/libc/misc/dirent/dirfd.c
index 48e955450..c6f46e965 100644
--- a/libc/misc/dirent/dirfd.c
+++ b/libc/misc/dirent/dirfd.c
@@ -1,8 +1,16 @@
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
#include <dirent.h>
#include <errno.h>
#include "dirstream.h"
-int attribute_hidden __dirfd(DIR * dir)
+libc_hidden_proto(dirfd)
+
+int dirfd(DIR * dir)
{
if (!dir || dir->dd_fd == -1) {
__set_errno(EBADF);
@@ -11,4 +19,4 @@ int attribute_hidden __dirfd(DIR * dir)
return dir->dd_fd;
}
-strong_alias(__dirfd,dirfd)
+libc_hidden_def(dirfd)
diff --git a/libc/misc/dirent/dirstream.h b/libc/misc/dirent/dirstream.h
index 15c70858f..a90ca6312 100644
--- a/libc/misc/dirent/dirstream.h
+++ b/libc/misc/dirent/dirstream.h
@@ -72,10 +72,8 @@ struct __dirstream {
extern ssize_t __getdents(int fd, char *buf, size_t count) attribute_hidden;
-extern struct dirent *__readdir (DIR *__dirp) __nonnull ((1)) attribute_hidden;
#ifdef __UCLIBC_HAS_LFS__
extern ssize_t __getdents64 (int fd, char *buf, size_t count) attribute_hidden;
-extern struct dirent64 *__readdir64 (DIR *__dirp) __nonnull ((1)) attribute_hidden;
#endif
#endif /* dirent.h */
diff --git a/libc/misc/dirent/readdir.c b/libc/misc/dirent/readdir.c
index 2d4ad4aeb..6fb1146eb 100644
--- a/libc/misc/dirent/readdir.c
+++ b/libc/misc/dirent/readdir.c
@@ -1,3 +1,9 @@
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
#include <features.h>
#include <errno.h>
@@ -7,7 +13,9 @@
#include <dirent.h>
#include "dirstream.h"
-struct dirent attribute_hidden *__readdir(DIR * dir)
+libc_hidden_proto(readdir)
+
+struct dirent *readdir(DIR * dir)
{
ssize_t bytes;
struct dirent *de;
@@ -46,4 +54,4 @@ all_done:
__pthread_mutex_unlock(&(dir->dd_lock));
return de;
}
-strong_alias(__readdir,readdir)
+libc_hidden_def(readdir)
diff --git a/libc/misc/dirent/readdir64.c b/libc/misc/dirent/readdir64.c
index 177af3fc9..5386ee17e 100644
--- a/libc/misc/dirent/readdir64.c
+++ b/libc/misc/dirent/readdir64.c
@@ -1,17 +1,11 @@
-#include <features.h>
-
-#if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS != 64
-#undef _FILE_OFFSET_BITS
-#define _FILE_OFFSET_BITS 64
-#endif
-#ifndef __USE_LARGEFILE64
-# define __USE_LARGEFILE64 1
-#endif
-/* We absolutely do _NOT_ want interfaces silently
- * renamed under us or very bad things will happen... */
-#ifdef __USE_FILE_OFFSET64
-# undef __USE_FILE_OFFSET64
-#endif
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include <_lfs_64.h>
+
#include <dirent.h>
#include <errno.h>
#include <stdlib.h>
@@ -20,7 +14,8 @@
#include <dirent.h>
#include "dirstream.h"
-struct dirent64 attribute_hidden *__readdir64(DIR * dir)
+libc_hidden_proto(readdir64)
+struct dirent64 *readdir64(DIR * dir)
{
ssize_t bytes;
struct dirent64 *de;
@@ -60,4 +55,4 @@ all_done:
return de;
}
-strong_alias(__readdir64,readdir64)
+libc_hidden_def(readdir64)
diff --git a/libc/misc/dirent/readdir64_r.c b/libc/misc/dirent/readdir64_r.c
index 1cbaf3156..b42351702 100644
--- a/libc/misc/dirent/readdir64_r.c
+++ b/libc/misc/dirent/readdir64_r.c
@@ -1,17 +1,12 @@
-#include <features.h>
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
-#if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS != 64
-#undef _FILE_OFFSET_BITS
-#define _FILE_OFFSET_BITS 64
-#endif
-#ifndef __USE_LARGEFILE64
-# define __USE_LARGEFILE64 1
-#endif
-/* We absolutely do _NOT_ want interfaces silently
- * renamed under us or very bad things will happen... */
-#ifdef __USE_FILE_OFFSET64
-# undef __USE_FILE_OFFSET64
-#endif
+#include <_lfs_64.h>
+
+#include <dirent.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
@@ -19,6 +14,9 @@
#include <dirent.h>
#include "dirstream.h"
+libc_hidden_proto(memcpy)
+
+libc_hidden_proto(readdir64_r)
int readdir64_r(DIR *dir, struct dirent64 *entry, struct dirent64 **result)
{
int ret;
@@ -59,7 +57,7 @@ int readdir64_r(DIR *dir, struct dirent64 *entry, struct dirent64 **result)
if (de == NULL) {
*result = NULL;
} else {
- *result = __memcpy (entry, de, de->d_reclen);
+ *result = memcpy (entry, de, de->d_reclen);
}
ret = 0;
@@ -68,3 +66,4 @@ all_done:
__pthread_mutex_unlock(&(dir->dd_lock));
return((de != NULL)? 0 : ret);
}
+libc_hidden_def(readdir64_r)
diff --git a/libc/misc/dirent/readdir_r.c b/libc/misc/dirent/readdir_r.c
index 25cb80b63..2c44707f2 100644
--- a/libc/misc/dirent/readdir_r.c
+++ b/libc/misc/dirent/readdir_r.c
@@ -1,3 +1,9 @@
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
#include <errno.h>
#include <stdlib.h>
#include <string.h>
@@ -5,6 +11,9 @@
#include <dirent.h>
#include "dirstream.h"
+libc_hidden_proto(memcpy)
+
+libc_hidden_proto(readdir_r)
int readdir_r(DIR *dir, struct dirent *entry, struct dirent **result)
{
int ret;
@@ -45,7 +54,7 @@ int readdir_r(DIR *dir, struct dirent *entry, struct dirent **result)
if (de == NULL) {
*result = NULL;
} else {
- *result = __memcpy (entry, de, de->d_reclen);
+ *result = memcpy (entry, de, de->d_reclen);
}
ret = 0;
@@ -55,3 +64,4 @@ all_done:
return((de != NULL)? 0 : ret);
}
+libc_hidden_def(readdir_r)
diff --git a/libc/misc/dirent/rewinddir.c b/libc/misc/dirent/rewinddir.c
index 18d6547a8..516700183 100644
--- a/libc/misc/dirent/rewinddir.c
+++ b/libc/misc/dirent/rewinddir.c
@@ -1,8 +1,15 @@
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
#include <dirent.h>
#include <errno.h>
#include <unistd.h>
#include "dirstream.h"
+libc_hidden_proto(lseek)
/* rewinddir() just does an lseek(fd,0,0) - see close for comments */
void rewinddir(DIR * dir)
@@ -12,7 +19,7 @@ void rewinddir(DIR * dir)
return;
}
__pthread_mutex_lock(&(dir->dd_lock));
- __lseek(dir->dd_fd, 0, SEEK_SET);
+ lseek(dir->dd_fd, 0, SEEK_SET);
dir->dd_nextoff = dir->dd_nextloc = dir->dd_size = 0;
__pthread_mutex_unlock(&(dir->dd_lock));
}
diff --git a/libc/misc/dirent/scandir.c b/libc/misc/dirent/scandir.c
index 72929fb57..41491baee 100644
--- a/libc/misc/dirent/scandir.c
+++ b/libc/misc/dirent/scandir.c
@@ -1,28 +1,8 @@
-/* Copyright (C) 1992-1998, 2000 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA.
- */
-
-/* Modified for uClibc by Erik Andersen
- */
-
-#define qsort __qsort
-#define opendir __opendir
-#define closedir __closedir
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
#include <dirent.h>
#include <stdio.h>
@@ -32,6 +12,12 @@
#include <sys/types.h>
#include "dirstream.h"
+libc_hidden_proto(memcpy)
+libc_hidden_proto(readdir)
+libc_hidden_proto(opendir)
+libc_hidden_proto(closedir)
+libc_hidden_proto(qsort)
+
int scandir(const char *dir, struct dirent ***namelist,
int (*selector) (const struct dirent *),
int (*compar) (const void *, const void *))
@@ -49,7 +35,7 @@ int scandir(const char *dir, struct dirent ***namelist,
__set_errno (0);
pos = 0;
- while ((current = __readdir (dp)) != NULL)
+ while ((current = readdir (dp)) != NULL)
if (selector == NULL || (*selector) (current))
{
struct dirent *vnew;
@@ -76,7 +62,7 @@ int scandir(const char *dir, struct dirent ***namelist,
if (vnew == NULL)
break;
- names[pos++] = (struct dirent *) __memcpy (vnew, current, dsize);
+ names[pos++] = (struct dirent *) memcpy (vnew, current, dsize);
}
if (unlikely(errno != 0))
diff --git a/libc/misc/dirent/scandir64.c b/libc/misc/dirent/scandir64.c
index e77b88d3c..7b1dbd000 100644
--- a/libc/misc/dirent/scandir64.c
+++ b/libc/misc/dirent/scandir64.c
@@ -20,24 +20,7 @@
/* Modified for uClibc by Erik Andersen
*/
-#define qsort __qsort
-#define opendir __opendir
-#define closedir __closedir
-
-#include <features.h>
-
-#if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS != 64
-#undef _FILE_OFFSET_BITS
-#define _FILE_OFFSET_BITS 64
-#endif
-#ifndef __USE_LARGEFILE64
-# define __USE_LARGEFILE64 1
-#endif
-/* We absolutely do _NOT_ want interfaces silently
- * renamed under us or very bad things will happen... */
-#ifdef __USE_FILE_OFFSET64
-# undef __USE_FILE_OFFSET64
-#endif
+#include <_lfs_64.h>
#include <dirent.h>
#include <stdio.h>
@@ -47,6 +30,12 @@
#include <sys/types.h>
#include "dirstream.h"
+libc_hidden_proto(memcpy)
+libc_hidden_proto(opendir)
+libc_hidden_proto(closedir)
+libc_hidden_proto(qsort)
+libc_hidden_proto(readdir64)
+
int scandir64(const char *dir, struct dirent64 ***namelist,
int (*selector) (const struct dirent64 *),
int (*compar) (const void *, const void *))
@@ -64,7 +53,7 @@ int scandir64(const char *dir, struct dirent64 ***namelist,
__set_errno (0);
pos = 0;
- while ((current = __readdir64 (dp)) != NULL)
+ while ((current = readdir64 (dp)) != NULL)
if (selector == NULL || (*selector) (current))
{
struct dirent64 *vnew;
@@ -91,7 +80,7 @@ int scandir64(const char *dir, struct dirent64 ***namelist,
if (vnew == NULL)
break;
- names[pos++] = (struct dirent64 *) __memcpy (vnew, current, dsize);
+ names[pos++] = (struct dirent64 *) memcpy (vnew, current, dsize);
}
if (unlikely(errno != 0))
diff --git a/libc/misc/dirent/seekdir.c b/libc/misc/dirent/seekdir.c
index 6e841291a..ba25ffd40 100644
--- a/libc/misc/dirent/seekdir.c
+++ b/libc/misc/dirent/seekdir.c
@@ -1,8 +1,16 @@
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
#include <dirent.h>
#include <errno.h>
#include <unistd.h>
#include "dirstream.h"
+libc_hidden_proto(lseek)
+
void seekdir(DIR * dir, long int offset)
{
if (!dir) {
@@ -10,7 +18,7 @@ void seekdir(DIR * dir, long int offset)
return;
}
__pthread_mutex_lock(&(dir->dd_lock));
- dir->dd_nextoff = __lseek(dir->dd_fd, offset, SEEK_SET);
+ dir->dd_nextoff = lseek(dir->dd_fd, offset, SEEK_SET);
dir->dd_size = dir->dd_nextloc = 0;
__pthread_mutex_unlock(&(dir->dd_lock));
}
diff --git a/libc/misc/dirent/telldir.c b/libc/misc/dirent/telldir.c
index 124030431..3c5deca8e 100644
--- a/libc/misc/dirent/telldir.c
+++ b/libc/misc/dirent/telldir.c
@@ -1,3 +1,9 @@
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
#include <dirent.h>
#include <errno.h>
#include <unistd.h>