aboutsummaryrefslogtreecommitdiff
path: root/dirent
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2007-07-12 18:26:36 +0000
committerJakub Jelinek <jakub@redhat.com>2007-07-12 18:26:36 +0000
commit0ecb606cb6cf65de1d9fc8a919bceb4be476c602 (patch)
tree2ea1f8305970753e4a657acb2ccc15ca3eec8e2c /dirent
parent7d58530341304d403a6626d7f7a1913165fe2f32 (diff)
downloadglibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.tar.xz
glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.zip
2.5-18.1
Diffstat (limited to 'dirent')
-rw-r--r--dirent/Makefile7
-rw-r--r--dirent/Versions3
-rw-r--r--dirent/alphasort64.c27
-rw-r--r--dirent/closedir.c35
-rw-r--r--dirent/dirent.h10
-rw-r--r--dirent/dirfd.c33
-rw-r--r--dirent/fdopendir.c35
-rw-r--r--dirent/getdents.c37
-rw-r--r--dirent/getdents64.c36
-rw-r--r--dirent/opendir.c34
-rw-r--r--dirent/readdir.c33
-rw-r--r--dirent/readdir64.c32
-rw-r--r--dirent/readdir64_r.c33
-rw-r--r--dirent/readdir_r.c35
-rw-r--r--dirent/rewinddir.c35
-rw-r--r--dirent/scandir64.c30
-rw-r--r--dirent/seekdir.c41
-rw-r--r--dirent/telldir.c41
-rw-r--r--dirent/tst-fdopendir.c124
-rw-r--r--dirent/tst-fdopendir2.c41
-rw-r--r--dirent/tst-seekdir.c28
-rw-r--r--dirent/versionsort64.c27
22 files changed, 753 insertions, 4 deletions
diff --git a/dirent/Makefile b/dirent/Makefile
index df150bcedc..ef639f2095 100644
--- a/dirent/Makefile
+++ b/dirent/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1991-2000, 2002, 2003 Free Software Foundation, Inc.
+# Copyright (C) 1991-2000,2002,2003,2005,2006 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
@@ -25,10 +25,11 @@ headers := dirent.h bits/dirent.h
routines := opendir closedir readdir readdir_r rewinddir \
seekdir telldir scandir alphasort versionsort \
getdents getdents64 dirfd readdir64 readdir64_r scandir64 \
- alphasort64 versionsort64
+ alphasort64 versionsort64 fdopendir
distribute := dirstream.h
-tests := list tst-seekdir opendir-tst1 bug-readdir1
+tests := list tst-seekdir opendir-tst1 bug-readdir1 tst-fdopendir \
+ tst-fdopendir2
CFLAGS-scandir.c = $(uses-callbacks)
CFLAGS-scandir64.c = $(uses-callbacks)
diff --git a/dirent/Versions b/dirent/Versions
index 9d96caeb36..41c1584426 100644
--- a/dirent/Versions
+++ b/dirent/Versions
@@ -41,4 +41,7 @@ libc {
# g*
getdirentries64;
}
+ GLIBC_2.4 {
+ fdopendir;
+ }
}
diff --git a/dirent/alphasort64.c b/dirent/alphasort64.c
new file mode 100644
index 0000000000..fe84aec2f1
--- /dev/null
+++ b/dirent/alphasort64.c
@@ -0,0 +1,27 @@
+/* Copyright (C) 1992, 1997, 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. */
+
+#include <dirent.h>
+#include <string.h>
+
+int
+alphasort64 (const void *a, const void *b)
+{
+ return strcoll ((*(const struct dirent64 **) a)->d_name,
+ (*(const struct dirent64 **) b)->d_name);
+}
diff --git a/dirent/closedir.c b/dirent/closedir.c
new file mode 100644
index 0000000000..4410f02fb3
--- /dev/null
+++ b/dirent/closedir.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 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. */
+
+#include <errno.h>
+#include <stddef.h>
+#include <dirent.h>
+
+
+/* Close the directory stream DIRP.
+ Return 0 if successful, -1 if not. */
+int
+__closedir (DIR *dirp)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+weak_alias (__closedir, closedir)
+
+stub_warning (closedir)
+#include <stub-tag.h>
diff --git a/dirent/dirent.h b/dirent/dirent.h
index a5e8a004e2..ed4147dbca 100644
--- a/dirent/dirent.h
+++ b/dirent/dirent.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2000, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2000, 2003, 2004, 2005 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
@@ -134,6 +134,14 @@ typedef struct __dirstream DIR;
marked with __THROW. */
extern DIR *opendir (__const char *__name) __nonnull ((1));
+#ifdef __USE_GNU
+/* Same as opendir, but open the stream on the file descriptor FD.
+
+ This function is a possible cancellation point and therefore not
+ marked with __THROW. */
+extern DIR *fdopendir (int __fd);
+#endif
+
/* Close the directory stream DIRP.
Return 0 if successful, -1 if not.
diff --git a/dirent/dirfd.c b/dirent/dirfd.c
new file mode 100644
index 0000000000..06c0cde435
--- /dev/null
+++ b/dirent/dirfd.c
@@ -0,0 +1,33 @@
+/* Return the file descriptor used by a DIR stream. Stub version.
+ Copyright (C) 1995, 1996 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. */
+
+#include <dirent.h>
+#include <dirstream.h>
+#include <errno.h>
+
+int
+dirfd (dirp)
+ DIR *dirp;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (dirfd)
+#include <stub-tag.h>
diff --git a/dirent/fdopendir.c b/dirent/fdopendir.c
new file mode 100644
index 0000000000..275cfd58fe
--- /dev/null
+++ b/dirent/fdopendir.c
@@ -0,0 +1,35 @@
+/* Open a directory stream from a file descriptor. Stub version.
+ Copyright (C) 2005, 2006 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. */
+
+#include <errno.h>
+#include <stddef.h>
+#include <dirent.h>
+
+
+/* Open a directory stream on FD. */
+DIR *
+__fdopendir (int fd)
+{
+ __set_errno (ENOSYS);
+ return NULL;
+}
+weak_alias (__fdopendir, fdopendir)
+
+stub_warning (fdopendir)
+#include <stub-tag.h>
diff --git a/dirent/getdents.c b/dirent/getdents.c
new file mode 100644
index 0000000000..1b1b7c7e8f
--- /dev/null
+++ b/dirent/getdents.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 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. */
+
+#include <stddef.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <dirent.h>
+
+ssize_t
+__getdirentries (fd, buf, nbytes, basep)
+ int fd;
+ char *buf;
+ size_t nbytes;
+ off_t *basep;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+weak_alias (__getdirentries, getdirentries)
+
+stub_warning (getdirentries)
+#include <stub-tag.h>
diff --git a/dirent/getdents64.c b/dirent/getdents64.c
new file mode 100644
index 0000000000..cb30e76545
--- /dev/null
+++ b/dirent/getdents64.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 1991,95,96,97,99,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. */
+
+#include <stddef.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <dirent.h>
+
+ssize_t
+getdirentries64 (fd, buf, nbytes, basep)
+ int fd;
+ char *buf;
+ size_t nbytes;
+ off64_t *basep;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (getdirentries64)
+#include <stub-tag.h>
diff --git a/dirent/opendir.c b/dirent/opendir.c
new file mode 100644
index 0000000000..771013f6eb
--- /dev/null
+++ b/dirent/opendir.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 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. */
+
+#include <errno.h>
+#include <stddef.h>
+#include <dirent.h>
+
+
+/* Open a directory stream on NAME. */
+DIR *
+__opendir (const char *name)
+{
+ __set_errno (ENOSYS);
+ return NULL;
+}
+weak_alias (__opendir, opendir)
+
+stub_warning (opendir)
+#include <stub-tag.h>
diff --git a/dirent/readdir.c b/dirent/readdir.c
new file mode 100644
index 0000000000..893b246d41
--- /dev/null
+++ b/dirent/readdir.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 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. */
+
+#include <errno.h>
+#include <stddef.h>
+#include <dirent.h>
+
+/* Read a directory entry from DIRP. */
+struct dirent *
+__readdir (DIR *dirp)
+{
+ __set_errno (ENOSYS);
+ return NULL;
+}
+weak_alias (__readdir, readdir)
+
+stub_warning (readdir)
+#include <stub-tag.h>
diff --git a/dirent/readdir64.c b/dirent/readdir64.c
new file mode 100644
index 0000000000..0c18bd9440
--- /dev/null
+++ b/dirent/readdir64.c
@@ -0,0 +1,32 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 1998 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. */
+
+#include <errno.h>
+#include <stddef.h>
+#include <dirent.h>
+
+/* Read a directory entry from DIRP. */
+struct dirent64 *
+__readdir64 (DIR *dirp)
+{
+ __set_errno (ENOSYS);
+ return NULL;
+}
+weak_alias (__readdir64, readdir64)
+stub_warning (readdir64)
+#include <stub-tag.h>
diff --git a/dirent/readdir64_r.c b/dirent/readdir64_r.c
new file mode 100644
index 0000000000..cf9e952e1a
--- /dev/null
+++ b/dirent/readdir64_r.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 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. */
+
+#include <errno.h>
+#include <stddef.h>
+#include <dirent.h>
+
+/* Read a directory entry from DIRP, store result in ENTRY and return
+ pointer to result in *RESULT. */
+int
+readdir64_r (DIR *dirp, struct dirent64 *entry, struct dirent64 **result)
+{
+ __set_errno (ENOSYS);
+ *result = NULL;
+ return -1;
+}
+stub_warning (readdir64_r)
+#include <stub-tag.h>
diff --git a/dirent/readdir_r.c b/dirent/readdir_r.c
new file mode 100644
index 0000000000..ad45dfa504
--- /dev/null
+++ b/dirent/readdir_r.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 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. */
+
+#include <errno.h>
+#include <stddef.h>
+#include <dirent.h>
+
+/* Read a directory entry from DIRP, store result in ENTRY and return
+ pointer to result in *RESULT. */
+int
+__readdir_r (DIR *dirp, struct dirent *entry, struct dirent **result)
+{
+ __set_errno (ENOSYS);
+ *result = NULL;
+ return ENOSYS;
+}
+weak_alias (__readdir_r, readdir_r)
+
+stub_warning (readdir_r)
+#include <stub-tag.h>
diff --git a/dirent/rewinddir.c b/dirent/rewinddir.c
new file mode 100644
index 0000000000..e78d316880
--- /dev/null
+++ b/dirent/rewinddir.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 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 PURP