diff options
Diffstat (limited to 'dirent')
-rw-r--r-- | dirent/Makefile | 7 | ||||
-rw-r--r-- | dirent/Versions | 3 | ||||
-rw-r--r-- | dirent/alphasort64.c | 27 | ||||
-rw-r--r-- | dirent/closedir.c | 35 | ||||
-rw-r--r-- | dirent/dirent.h | 10 | ||||
-rw-r--r-- | dirent/dirfd.c | 33 | ||||
-rw-r--r-- | dirent/fdopendir.c | 35 | ||||
-rw-r--r-- | dirent/getdents.c | 37 | ||||
-rw-r--r-- | dirent/getdents64.c | 36 | ||||
-rw-r--r-- | dirent/opendir.c | 34 | ||||
-rw-r--r-- | dirent/readdir.c | 33 | ||||
-rw-r--r-- | dirent/readdir64.c | 32 | ||||
-rw-r--r-- | dirent/readdir64_r.c | 33 | ||||
-rw-r--r-- | dirent/readdir_r.c | 35 | ||||
-rw-r--r-- | dirent/rewinddir.c | 35 | ||||
-rw-r--r-- | dirent/scandir64.c | 30 | ||||
-rw-r--r-- | dirent/seekdir.c | 41 | ||||
-rw-r--r-- | dirent/telldir.c | 41 | ||||
-rw-r--r-- | dirent/tst-fdopendir.c | 124 | ||||
-rw-r--r-- | dirent/tst-fdopendir2.c | 41 | ||||
-rw-r--r-- | dirent/tst-seekdir.c | 28 | ||||
-rw-r--r-- | dirent/versionsort64.c | 27 |
22 files changed, 4 insertions, 753 deletions
diff --git a/dirent/Makefile b/dirent/Makefile index ef639f2095..df150bcedc 100644 --- a/dirent/Makefile +++ b/dirent/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1991-2000,2002,2003,2005,2006 Free Software Foundation, Inc. +# Copyright (C) 1991-2000, 2002, 2003 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,11 +25,10 @@ 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 fdopendir + alphasort64 versionsort64 distribute := dirstream.h -tests := list tst-seekdir opendir-tst1 bug-readdir1 tst-fdopendir \ - tst-fdopendir2 +tests := list tst-seekdir opendir-tst1 bug-readdir1 CFLAGS-scandir.c = $(uses-callbacks) CFLAGS-scandir64.c = $(uses-callbacks) diff --git a/dirent/Versions b/dirent/Versions index 41c1584426..9d96caeb36 100644 --- a/dirent/Versions +++ b/dirent/Versions @@ -41,7 +41,4 @@ libc { # g* getdirentries64; } - GLIBC_2.4 { - fdopendir; - } } diff --git a/dirent/alphasort64.c b/dirent/alphasort64.c deleted file mode 100644 index fe84aec2f1..0000000000 --- a/dirent/alphasort64.c +++ /dev/null @@ -1,27 +0,0 @@ -/* 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 deleted file mode 100644 index 4410f02fb3..0000000000 --- a/dirent/closedir.c +++ /dev/null @@ -1,35 +0,0 @@ -/* 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 ed4147dbca..a5e8a004e2 100644 --- a/dirent/dirent.h +++ b/dirent/dirent.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2000, 2003, 2004, 2005 Free Software Foundation, Inc. +/* Copyright (C) 1991-2000, 2003, 2004 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,14 +134,6 @@ 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 deleted file mode 100644 index 06c0cde435..0000000000 --- a/dirent/dirfd.c +++ /dev/null @@ -1,33 +0,0 @@ -/* 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 deleted file mode 100644 index 275cfd58fe..0000000000 --- a/dirent/fdopendir.c +++ /dev/null @@ -1,35 +0,0 @@ -/* 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 deleted file mode 100644 index 1b1b7c7e8f..0000000000 --- a/dirent/getdents.c +++ /dev/null @@ -1,37 +0,0 @@ -/* 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 deleted file mode 100644 index cb30e76545..0000000000 --- a/dirent/getdents64.c +++ /dev/null @@ -1,36 +0,0 @@ -/* 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 deleted file mode 100644 index 771013f6eb..0000000000 --- a/dirent/opendir.c +++ /dev/null @@ -1,34 +0,0 @@ -/* 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 deleted file mode 100644 index 893b246d41..0000000000 --- a/dirent/readdir.c +++ /dev/null @@ -1,33 +0,0 @@ -/* 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 deleted file mode 100644 index 0c18bd9440..0000000000 --- a/dirent/readdir64.c +++ /dev/null @@ -1,32 +0,0 @@ -/* 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 deleted file mode 100644 index cf9e952e1a..0000000000 --- a/dirent/readdir64_r.c +++ /dev/null @@ -1,33 +0,0 @@ -/* 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 deleted file mode 100644 index ad45dfa504..0000000000 --- a/dirent/readdir_r.c +++ /dev/null @@ -1,35 +0,0 @@ -/* 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 deleted file mode 100644 index e78d316880..0000000000 --- a/dirent/rewinddir.c +++ /dev/null @@ -1,35 +0,0 @@ -/* 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> - - -/* Rewind DIRP to the beginning of the directory. */ -void -rewinddir (dirp) - DIR *dirp; -{ - __set_errno (ENOSYS); - /* No way to indicate failure. */ -} - - -stub_warning (rewinddir) -#include <stub-tag.h> diff --git a/dirent/scandir64.c b/dirent/scandir64.c deleted file mode 100644 index 68608de9a0..0000000000 --- a/dirent/scandir64.c +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright (C) 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> - -#define SCANDIR scandir64 -#define READDIR __readdir64 -#define DIRENT_TYPE struct dirent64 - -int scandir64 (__const char *__restrict __dir, - struct dirent64 ***__restrict __namelist, - int (*__selector) (__const struct dirent64 *), - int (*__cmp) (__const void *, __const void *)); - -#include <dirent/scandir.c> diff --git a/dirent/seekdir.c b/dirent/seekdir.c deleted file mode 100644 index c3828cde0f..0000000000 --- a/dirent/seekdir.c +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright (C) 1991, 1995, 1996, 1997, 1999 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 <sys/types.h> -#include <errno.h> -#include <stddef.h> -#include <dirent.h> - -/* Seek to position POS in DIRP. */ -void -seekdir (dirp, pos) - DIR *dirp; - long int pos; -{ - if (dirp == NULL) - { - __set_errno (EINVAL); - return; - } - - __set_errno (ENOSYS); -} - - -stub_warning (seekdir) -#include <stub-tag.h> diff --git a/dirent/telldir.c b/dirent/telldir.c deleted file mode 100644 index 7b14452327..0000000000 --- a/dirent/telldir.c +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright (C) 1991, 1995, 1996, 1997, 1999 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 <sys/types.h> -#include <stddef.h> -#include <dirent.h> - -/* Return the current position of DIRP. */ -long int -telldir (dirp) - DIR *dirp; -{ - if (dirp == NULL) - { - __set_errno (EINVAL); - return -1l; - } - - __set_errno (ENOSYS); - return -1l; -} - - -stub_warning (telldir) -#include <stub-tag.h> diff --git a/dirent/tst-fdopendir.c b/dirent/tst-fdopendir.c deleted file mode 100644 index 3cf315d85c..0000000000 --- a/dirent/tst-fdopendir.c +++ /dev/null @@ -1,124 +0,0 @@ -#include <stdio.h> -#include <fcntl.h> -#include <stdlib.h> -#include <unistd.h> -#include <dirent.h> -#include <stdbool.h> -#include <string.h> - - -static int -do_test (void) -{ - char fname[] = "/tmp/jXXXXXX"; - int fd = mkstemp (fname); - if (fd == -1) - { - puts ("mkstemp failed"); - return 1; - } - - write (fd, "hello", 5); - close (fd); - - struct stat64 st; - if (stat64 (fname, &st) == -1) - { - puts ("first stat failed"); - return 0; - } - - /* Make sure there is enough time between the creation and the access. */ - sleep (2); - - fd = open (fname, O_RDONLY | O_NOATIME); - if (fd == -1) - { - puts ("first open failed"); - return 1; - } - - char buf[5]; - read(fd, buf, sizeof (buf)); - close(fd); - - struct stat64 st2; - if (stat64 (fname, &st2) == -1) - { - puts ("second stat failed"); - return 0; - } - - bool no_noatime = false; -#ifdef _STATBUF_ST_NSEC - if (st.st_atim.tv_sec != st2.st_atim.tv_sec - || st.st_atim.tv_nsec != st2.st_atim.tv_nsec) -#else - if (st.st_atime != st2.st_atime) -#endif - { - puts ("file atime changed"); - no_noatime = true; - } - - unlink(fname); - - strcpy(fname, "/tmp/dXXXXXX"); - char *d = mkdtemp (fname); - if (d == NULL) - { - puts ("mkdtemp failed"); - return 1; - } - - if (stat64 (d, &st) == -1) - { - puts ("third stat failed"); - return 0; - } - sleep (2); - - fd = open64 (d, O_RDONLY|O_NDELAY|O_DIRECTORY|O_NOATIME); - if (fd == -1) - { - puts ("second open failed"); - return 1; - } - DIR *dir = fdopendir (fd); - if (dir == NULL) - { - puts ("fdopendir failed"); - return 1; - } - - struct dirent *de; - while ((de = readdir (dir)) != NULL) - ; - - closedir (dir); - - if (stat64 (d, &st2) == -1) - { - puts ("fourth stat failed"); - return 0; - } -#ifdef _STATBUF_ST_NSEC - if (!no_noatime - && (st.st_atim.tv_sec != st2.st_atim.tv_sec - || st.st_atim.tv_nsec != st2.st_atim.tv_nsec)) -#else - if (!no_noatime && st.st_atime != st2.st_atime) -#endif - { - puts ("directory atime changed"); - return 1; - } - - rmdir(fname); - - return 0; -} - -#define TIMEOUT 6 -#define TEST_FUNCTION do_test () -#include "../test-skeleton.c" diff --git a/dirent/tst-fdopendir2.c b/dirent/tst-fdopendir2.c deleted file mode 100644 index 3720809dc2..0000000000 --- a/dirent/tst-fdopendir2.c +++ /dev/null @@ -1,41 +0,0 @@ -#include <errno.h> -#include <dirent.h> -#include <stdio.h> -#include <unistd.h> - - -static int -do_test (void) -{ - char tmpl[] = "/tmp/tst-fdopendir2-XXXXXX"; - int fd = mkstemp (tmpl); - if (fd == -1) - { - puts ("cannot open temp file"); - return 1; - } - - errno = 0; - DIR *d = fdopendir (fd); - - int e = errno; - - close (fd); - unlink (tmpl); - - if (d != NULL) - { - puts ("fdopendir with normal file descriptor did not fail"); - return 1; - } - if (e != ENOTDIR) - { - printf ("fdopendir set errno to %d, not %d as expected\n", e, ENOTDIR); - return 1; - } - - return 0; -} - -#define TEST_FUNCTION do_test () -#include "../test-skeleton.c" diff --git a/dirent/tst-seekdir.c b/dirent/tst-seekdir.c index 43808fecb5..b833c30705 100644 --- a/dirent/tst-seekdir.c +++ b/dirent/tst-seekdir.c @@ -11,23 +11,8 @@ main (int argc, char *argv[]) int i = 0; int result = 0; struct dirent *dp; - long int save0; - long int rewind; dirp = opendir ("."); - if (dirp == NULL) - { - printf ("opendir failed: %m\n"); - return 1; - } - - save0 = telldir (dirp); - if (save0 == -1) - { - printf ("telldir failed: %m\n"); - result = 1; - } - for (dp = readdir (dirp); dp != NULL; dp = readdir (dirp)) { /* save position 3 (after fourth entry) */ @@ -59,19 +44,6 @@ main (int argc, char *argv[]) for (dp = readdir (dirp); dp != NULL; dp = readdir (dirp)) printf ("%s\n", dp->d_name); - /* Check rewinddir */ - rewinddir (dirp); - rewind = telldir (dirp); - if (rewind == -1) - { - printf ("telldir failed: %m\n"); - result = 1; - } - else if (save0 != rewind) - { - printf ("rewinddir didn't reset directory stream\n"); - result = 1; - } closedir (dirp); return result; diff --git a/dirent/versionsort64.c b/dirent/versionsort64.c deleted file mode 100644 index e471827023..0000000000 --- a/dirent/versionsort64.c +++ /dev/null @@ -1,27 +0,0 @@ -/* 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 -versionsort64 (const void *a, const void *b) -{ - return __strverscmp ((*(const struct dirent64 **) a)->d_name, - (*(const struct dirent64 **) b)->d_name); -} |