diff options
Diffstat (limited to 'io')
-rw-r--r-- | io/Makefile | 61 | ||||
-rw-r--r-- | io/Versions | 16 | ||||
-rw-r--r-- | io/access.c | 41 | ||||
-rw-r--r-- | io/bug-ftw5.c | 25 | ||||
-rw-r--r-- | io/chdir.c | 40 | ||||
-rw-r--r-- | io/chmod.c | 42 | ||||
-rw-r--r-- | io/chown.c | 45 | ||||
-rw-r--r-- | io/close.c | 40 | ||||
-rw-r--r-- | io/creat.c | 36 | ||||
-rw-r--r-- | io/creat64.c | 31 | ||||
-rw-r--r-- | io/dup.c | 34 | ||||
-rw-r--r-- | io/dup2.c | 48 | ||||
-rw-r--r-- | io/euidaccess.c | 42 | ||||
-rw-r--r-- | io/faccessat.c | 51 | ||||
-rw-r--r-- | io/fchdir.c | 33 | ||||
-rw-r--r-- | io/fchmod.c | 42 | ||||
-rw-r--r-- | io/fchmodat.c | 50 | ||||
-rw-r--r-- | io/fchown.c | 43 | ||||
-rw-r--r-- | io/fchownat.c | 51 | ||||
-rw-r--r-- | io/fcntl.c | 41 | ||||
-rw-r--r-- | io/fcntl.h | 41 | ||||
-rw-r--r-- | io/flock.c | 36 | ||||
-rw-r--r-- | io/fstatat.c | 58 | ||||
-rw-r--r-- | io/fstatat64.c | 58 | ||||
-rw-r--r-- | io/fstatfs.c | 34 | ||||
-rw-r--r-- | io/fstatfs64.c | 32 | ||||
-rw-r--r-- | io/fstatvfs.c | 33 | ||||
-rw-r--r-- | io/fstatvfs64.c | 32 | ||||
-rw-r--r-- | io/fts.c | 54 | ||||
-rw-r--r-- | io/ftw.c | 148 | ||||
-rw-r--r-- | io/ftw64.c | 3 | ||||
-rw-r--r-- | io/fxstat.c | 50 | ||||
-rw-r--r-- | io/fxstat64.c | 49 | ||||
-rw-r--r-- | io/fxstatat.c | 50 | ||||
-rw-r--r-- | io/fxstatat64.c | 51 | ||||
-rw-r--r-- | io/getcwd.c | 40 | ||||
-rw-r--r-- | io/isatty.c | 34 | ||||
-rw-r--r-- | io/lchmod.c | 33 | ||||
-rw-r--r-- | io/lchown.c | 43 | ||||
-rw-r--r-- | io/link.c | 42 | ||||
-rw-r--r-- | io/linkat.c | 52 | ||||
-rw-r--r-- | io/lockf.c | 74 | ||||
-rw-r--r-- | io/lockf64.c | 79 | ||||
-rw-r--r-- | io/lseek64.c | 49 | ||||
-rw-r--r-- | io/lxstat.c | 27 | ||||
-rw-r--r-- | io/lxstat64.c | 39 | ||||
-rw-r--r-- | io/mkdir.c | 43 | ||||
-rw-r--r-- | io/mkdirat.c | 58 | ||||
-rw-r--r-- | io/mkfifo.c | 43 | ||||
-rw-r--r-- | io/mkfifoat.c | 60 | ||||
-rw-r--r-- | io/mknod.c | 62 | ||||
-rw-r--r-- | io/mknodat.c | 60 | ||||
-rw-r--r-- | io/open.c | 54 | ||||
-rw-r--r-- | io/open64.c | 57 | ||||
-rw-r--r-- | io/openat.c | 71 | ||||
-rw-r--r-- | io/openat64.c | 71 | ||||
-rw-r--r-- | io/pipe.c | 44 | ||||
-rw-r--r-- | io/poll.c | 39 | ||||
-rw-r--r-- | io/posix_fadvise.c | 31 | ||||
-rw-r--r-- | io/posix_fadvise64.c | 31 | ||||
-rw-r--r-- | io/posix_fallocate.c | 31 | ||||
-rw-r--r-- | io/posix_fallocate64.c | 31 | ||||
-rw-r--r-- | io/ppoll.c | 76 | ||||
-rw-r--r-- | io/read.c | 49 | ||||
-rw-r--r-- | io/readlink.c | 37 | ||||
-rw-r--r-- | io/readlinkat.c | 51 | ||||
-rw-r--r-- | io/rmdir.c | 41 | ||||
-rw-r--r-- | io/sendfile.c | 33 | ||||
-rw-r--r-- | io/sendfile64.c | 33 | ||||
-rw-r--r-- | io/statfs.c | 35 | ||||
-rw-r--r-- | io/statfs64.c | 32 | ||||
-rw-r--r-- | io/statvfs.c | 34 | ||||
-rw-r--r-- | io/statvfs64.c | 32 | ||||
-rw-r--r-- | io/symlink.c | 42 | ||||
-rw-r--r-- | io/symlinkat.c | 49 | ||||
-rw-r--r-- | io/sys/poll.h | 26 | ||||
-rw-r--r-- | io/sys/sendfile.h | 6 | ||||
-rw-r--r-- | io/sys/stat.h | 100 | ||||
-rw-r--r-- | io/test-lfs.c | 2 | ||||
-rw-r--r-- | io/tst-faccessat.c | 212 | ||||
-rw-r--r-- | io/tst-fchmodat.c | 191 | ||||
-rw-r--r-- | io/tst-fchownat.c | 190 | ||||
-rw-r--r-- | io/tst-fcntl.c | 2 | ||||
-rw-r--r-- | io/tst-fstatat.c | 188 | ||||
-rw-r--r-- | io/tst-futimesat.c | 147 | ||||
-rw-r--r-- | io/tst-linkat.c | 171 | ||||
-rw-r--r-- | io/tst-mkdirat.c | 162 | ||||
-rw-r--r-- | io/tst-mkfifoat.c | 162 | ||||
-rw-r--r-- | io/tst-mknodat.c | 162 | ||||
-rw-r--r-- | io/tst-openat.c | 209 | ||||
-rw-r--r-- | io/tst-readlinkat.c | 136 | ||||
-rw-r--r-- | io/tst-renameat.c | 225 | ||||
-rw-r--r-- | io/tst-symlinkat.c | 164 | ||||
-rw-r--r-- | io/tst-ttyname_r.c | 42 | ||||
-rw-r--r-- | io/tst-unlinkat.c | 178 | ||||
-rw-r--r-- | io/ttyname.c | 38 | ||||
-rw-r--r-- | io/ttyname_r.c | 37 | ||||
-rw-r--r-- | io/umask.c | 34 | ||||
-rw-r--r-- | io/unlink.c | 41 | ||||
-rw-r--r-- | io/unlinkat.c | 49 | ||||
-rw-r--r-- | io/utime.c | 43 | ||||
-rw-r--r-- | io/write.c | 50 | ||||
-rw-r--r-- | io/xmknod.c | 48 | ||||
-rw-r--r-- | io/xmknodat.c | 64 | ||||
-rw-r--r-- | io/xstat.c | 39 | ||||
-rw-r--r-- | io/xstat64.c | 38 |
106 files changed, 90 insertions, 6449 deletions
diff --git a/io/Makefile b/io/Makefile index 6623551769..906d1e3301 100644 --- a/io/Makefile +++ b/io/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1992-2002,2003,2005,2006, 2007 Free Software Foundation, Inc. +# Copyright (C) 1992-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 @@ -26,47 +26,38 @@ headers := sys/stat.h bits/stat.h sys/statfs.h bits/statfs.h sys/vfs.h \ poll.h sys/poll.h bits/poll.h \ utime.h ftw.h fts.h sys/sendfile.h -routines := \ - utime \ - mkfifo mkfifoat \ - stat fstat lstat stat64 fstat64 lstat64 fstatat fstatat64 \ - xstat fxstat lxstat xstat64 fxstat64 lxstat64 \ - mknod mknodat xmknod xmknodat \ - fxstatat fxstatat64 \ - statfs fstatfs statfs64 fstatfs64 \ - statvfs fstatvfs statvfs64 fstatvfs64 \ - umask chmod fchmod lchmod fchmodat \ - mkdir mkdirat \ - open open64 openat openat64 close \ - read write lseek lseek64 access euidaccess faccessat \ - fcntl flock lockf lockf64 \ - dup dup2 pipe \ - creat creat64 \ - chdir fchdir \ - getcwd getwd getdirname \ - chown fchown lchown fchownat \ - ttyname ttyname_r isatty \ - link linkat symlink symlinkat readlink readlinkat \ - unlink unlinkat rmdir \ - ftw ftw64 fts poll ppoll \ - posix_fadvise posix_fadvise64 \ - posix_fallocate posix_fallocate64 \ +routines := \ + utime \ + mkfifo \ + stat fstat lstat mknod stat64 fstat64 lstat64 \ + xstat fxstat lxstat xmknod xstat64 fxstat64 lxstat64 \ + statfs fstatfs statfs64 fstatfs64 \ + statvfs fstatvfs statvfs64 fstatvfs64 \ + umask chmod fchmod lchmod mkdir \ + open open64 close read write lseek lseek64 access euidaccess \ + fcntl flock lockf lockf64 \ + dup dup2 pipe \ + creat creat64 \ + chdir fchdir \ + getcwd getwd getdirname \ + chown fchown lchown \ + ttyname ttyname_r isatty \ + link symlink readlink \ + unlink rmdir \ + ftw ftw64 fts poll \ + posix_fadvise posix_fadvise64 \ + posix_fallocate posix_fallocate64 \ sendfile sendfile64 # These routines will be omitted from the libc shared object. # Instead the static object files will be included in a special archive # linked against when the shared library will be used. -static-only-routines = stat fstat lstat stat64 fstat64 lstat64 \ - fstatat fstatat64 mknod mknodat +static-only-routines = stat fstat lstat mknod stat64 fstat64 lstat64 others := pwd test-srcs := ftwtest tests := test-utime test-stat test-stat2 test-lfs tst-getcwd \ - tst-fcntl bug-ftw1 bug-ftw2 bug-ftw3 bug-ftw4 tst-statvfs \ - tst-openat tst-unlinkat tst-fstatat tst-futimesat \ - tst-renameat tst-fchownat tst-fchmodat tst-faccessat \ - tst-symlinkat tst-linkat tst-readlinkat tst-mkdirat \ - tst-mknodat tst-mkfifoat tst-ttyname_r bug-ftw5 + tst-fcntl bug-ftw1 bug-ftw2 bug-ftw3 bug-ftw4 tst-statvfs distribute := ftwtest-sh @@ -74,7 +65,6 @@ include ../Rules CFLAGS-fcntl.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-poll.c = -fexceptions -fasynchronous-unwind-tables -CFLAGS-ppoll.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-lockf.c = -fexceptions CFLAGS-statfs.c = -fexceptions CFLAGS-fstatfs.c = -fexceptions @@ -98,9 +88,6 @@ CFLAGS-mknod.c = -DHAVE_DOT_HIDDEN CFLAGS-stat64.c = -DHAVE_DOT_HIDDEN CFLAGS-fstat64.c = -DHAVE_DOT_HIDDEN CFLAGS-lstat64.c = -DHAVE_DOT_HIDDEN -CFLAGS-fstatat.c = -DHAVE_DOT_HIDDEN -CFLAGS-fstatat64.c = -DHAVE_DOT_HIDDEN -CFLAGS-mknodat.c = -DHAVE_DOT_HIDDEN endif test-stat2-ARGS = Makefile . $(objpfx)test-stat2 diff --git a/io/Versions b/io/Versions index bc9c9d2685..5b311ee03b 100644 --- a/io/Versions +++ b/io/Versions @@ -97,20 +97,4 @@ libc { # n* nftw; nftw64; } - GLIBC_2.4 { - eaccess; - - faccessat; - fchmodat; - fchownat; - __fxstatat; __fxstatat64; - linkat; - mkdirat; mkfifoat; __xmknodat; - openat; openat64; - readlinkat; - symlinkat; - unlinkat; - - ppoll; - } } diff --git a/io/access.c b/io/access.c deleted file mode 100644 index c266e945a9..0000000000 --- a/io/access.c +++ /dev/null @@ -1,41 +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 <unistd.h> - -/* Test for access to FILE. */ -int -__access (file, type) - const char *file; - int type; -{ - if (file == NULL || (type & ~(R_OK|W_OK|X_OK|F_OK)) != 0) - { - __set_errno (EINVAL); - return -1; - } - - __set_errno (ENOSYS); - return -1; -} -stub_warning (access) - -weak_alias (__access, access) -#include <stub-tag.h> diff --git a/io/bug-ftw5.c b/io/bug-ftw5.c deleted file mode 100644 index c1cd81d30e..0000000000 --- a/io/bug-ftw5.c +++ /dev/null @@ -1,25 +0,0 @@ -#include <errno.h> -#include <ftw.h> -#include <stdio.h> - -static int -fn (const char *file, const struct stat *sb, int flag, struct FTW *s) -{ - puts (file); - return FTW_STOP; -} - -static int -do_test (void) -{ - if (nftw ("/", fn, 0, FTW_CHDIR | FTW_ACTIONRETVAL) < 0) - { - printf ("nftw / FTW_CHDIR: %m\n"); - return 1; - } - - return 0; -} - -#define TEST_FUNCTION do_test () -#include "../test-skeleton.c" diff --git a/io/chdir.c b/io/chdir.c deleted file mode 100644 index afaeef8787..0000000000 --- a/io/chdir.c +++ /dev/null @@ -1,40 +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 <unistd.h> - -/* Change the current directory to PATH. */ -int -__chdir (path) - const char *path; -{ - if (path == NULL) - { - __set_errno (EINVAL); - return -1; - } - - __set_errno (ENOSYS); - return -1; -} -stub_warning (chdir) - -weak_alias (__chdir, chdir) -#include <stub-tag.h> diff --git a/io/chmod.c b/io/chmod.c deleted file mode 100644 index 38b05127c9..0000000000 --- a/io/chmod.c +++ /dev/null @@ -1,42 +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 <sys/stat.h> -#include <sys/types.h> - -/* Change the protections of FILE to MODE. */ -int -__chmod (file, mode) - const char *file; - mode_t mode; -{ - if (file == NULL) - { - __set_errno (EINVAL); - return -1; - } - - __set_errno (ENOSYS); - return -1; -} -stub_warning (chmod) - -weak_alias (__chmod, chmod) -#include <stub-tag.h> diff --git a/io/chown.c b/io/chown.c deleted file mode 100644 index 0e368f2ac4..0000000000 --- a/io/chown.c +++ /dev/null @@ -1,45 +0,0 @@ -/* Copyright (C) 1991, 1992, 1995, 1996, 1997, 2002 - 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 <unistd.h> -#include <sys/types.h> - -/* Change the owner and group of FILE. */ -int -__chown (file, owner, group) - const char *file; - uid_t owner; - gid_t group; -{ - if (file == NULL) - { - __set_errno (EINVAL); - return -1; - } - - __set_errno (ENOSYS); - return -1; -} -libc_hidden_def (__chown) -stub_warning (chown) - -weak_alias (__chown, chown) -#include <stub-tag.h> diff --git a/io/close.c b/io/close.c deleted file mode 100644 index 0856ba851b..0000000000 --- a/io/close.c +++ /dev/null @@ -1,40 +0,0 @@ -/* Copyright (C) 1991, 1995, 1996, 1997, 2002 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 <unistd.h> - -/* Close the file descriptor FD. */ -int -__close (fd) - int fd; -{ - if (fd < 0) - { - __set_errno (EBADF); - return -1; - } - - __set_errno (ENOSYS); - return -1; -} -libc_hidden_def (__close) -stub_warning (close) - -weak_alias (__close, close) -#include <stub-tag.h> diff --git a/io/creat.c b/io/creat.c deleted file mode 100644 index 462882415c..0000000000 --- a/io/creat.c +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright (C) 1991, 1996, 1997, 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 - 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 <fcntl.h> -#include <sys/types.h> -#include <sysdep-cancel.h> - -#undef creat - -/* Create FILE with protections MODE. */ -int -__libc_creat (file, mode) - const char *file; - mode_t mode; -{ - return __open (file, O_WRONLY|O_CREAT|O_TRUNC, mode); -} -weak_alias (__libc_creat, creat) - -/* __open handles cancellation. */ -LIBC_CANCEL_HANDLED (); diff --git a/io/creat64.c b/io/creat64.c deleted file mode 100644 index 39f4580571..0000000000 --- a/io/creat64.c +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright (C) 1991, 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 <fcntl.h> -#include <sys/types.h> - -#undef creat - -/* Create FILE with protections MODE. */ -int -creat64 (file, mode) - const char *file; - mode_t mode; -{ - return __open64 (file, O_WRONLY|O_CREAT|O_TRUNC, mode); -} diff --git a/io/dup.c b/io/dup.c deleted file mode 100644 index 5d5e1b4cd5..0000000000 --- a/io/dup.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 <fcntl.h> -#include <unistd.h> - -/* Duplicate FD, returning a new file descriptor open on the same file. */ -int -__dup (fd) - int fd; -{ - __set_errno (ENOSYS); - return -1; -} -stub_warning (dup) - -weak_alias (__dup, dup) -#include <stub-tag.h> diff --git a/io/dup2.c b/io/dup2.c deleted file mode 100644 index 2b897896f6..0000000000 --- a/io/dup2.c +++ /dev/null @@ -1,48 +0,0 @@ -/* Copyright (C) 1991, 1995, 1996, 1997, 2002 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 <fcntl.h> -#include <unistd.h> - - -/* Duplicate FD to FD2, closing the old FD2 and making FD2 be - open the same file as FD is. Return FD2 or -1. */ -int -__dup2 (fd, fd2) - int fd; - int fd2; -{ - if (fd < 0 || fd2 < 0) - { - __set_errno (EBADF); - return -1; - } - - if (fd == fd2) - /* No way to check that they are valid. */ - return fd2; - - __set_errno (ENOSYS); - return -1; -} -libc_hidden_def (__dup2) -stub_warning (dup2) - -weak_alias (__dup2, dup2) -#include <stub-tag.h> diff --git a/io/euidaccess.c b/io/euidaccess.c deleted file mode 100644 index 943f1f7c82..0000000000 --- a/io/euidaccess.c +++ /dev/null @@ -1,42 +0,0 @@ -/* Test for access to FILE using effective UID and GID. Stub version. - Copyright (C) 1991,1995,1996,1997,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 <unistd.h> - -int -__euidaccess (file, type) - const char *file; - int type; -{ - if (file == NULL || (type & ~(R_OK|W_OK|X_OK|F_OK)) != 0) - { - __set_errno (EINVAL); - return -1; - } - - __set_errno (ENOSYS); - return -1; -} -weak_alias (__euidaccess, euidaccess) -weak_alias (__euidaccess, eaccess) -stub_warning (euidaccess) -stub_warning (eaccess) -#include <stub-tag.h> diff --git a/io/faccessat.c b/io/faccessat.c deleted file mode 100644 index 8e41d37c21..0000000000 --- a/io/faccessat.c +++ /dev/null @@ -1,51 +0,0 @@ -/* Test for access to file, relative to open directory. Stub version. - Copyright (C) 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 <fcntl.h> -#include <stddef.h> -#include <unistd.h> -#include <sys/types.h> - -int -faccessat (fd, file, type, flag) - int fd; - const char *file; - int type; - int flag; -{ - if (file == NULL || (flag & ~(AT_SYMLINK_NOFOLLOW | AT_EACCESS)) != 0 - || (type & ~(R_OK|W_OK|X_OK|F_OK)) != 0) - { - __set_errno (EINVAL); - return -1; - } - - if (fd < 0 && fd != AT_FDCWD) - { - __set_errno (EBADF); - return -1; - } - - __set_errno (ENOSYS); - return -1; -} -stub_warning (faccessat) - -#include <stub-tag.h> diff --git a/io/fchdir.c b/io/fchdir.c deleted file mode 100644 index db1e4f8f35..0000000000 --- a/io/fchdir.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 <unistd.h> - -/* Change the current directory to FD. */ -int -fchdir (fd) - int fd; -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (fchdir) -#include <stub-tag.h> diff --git a/io/fchmod.c b/io/fchmod.c deleted file mode 100644 index 4b5eacb3eb..0000000000 --- a/io/fchmod.c +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright (C) 1991, 1992, 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 <sys/stat.h> -#include <sys/types.h> - -/* Change the protections of the file FD refers to to MODE. */ -int -__fchmod (fd, mode) - int fd; - mode_t mode; -{ - if (fd < 0) - { - __set_errno (EINVAL); - return -1; - } - - __set_errno (ENOSYS); - return -1; -} -stub_warning (fchmod) - -weak_alias (__fchmod, fchmod) -#include <stub-tag.h> diff --git a/io/fchmodat.c b/io/fchmodat.c deleted file mode 100644 index 6aecf2ac23..0000000000 --- a/io/fchmodat.c +++ /dev/null @@ -1,50 +0,0 @@ -/* Change the protections of file relative to open directory. Stub version. - Copyright (C) 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 <fcntl.h> -#include <stddef.h> -#include <unistd.h> -#include <sys/types.h> - -int -fchmodat (fd, file, mode, flag) - int fd; - const char *file; - mode_t mode; - int flag; -{ - if (file == NULL || (flag & ~AT_SYMLINK_NOFOLLOW) != 0) - { - __set_errno (EINVAL); - return -1; - } - - if (fd < 0 && fd != AT_FDCWD) - { - __set_errno (EBADF); - return -1; - } - - __set_errno (ENOSYS); - return -1; -} -stub_warning (fchownat) - -#include <stub-tag.h> diff --git a/io/fchown.c b/io/fchown.c deleted file mode 100644 index e0d42dd293..0000000000 --- a/io/fchown.c +++ /dev/null @@ -1,43 +0,0 @@ -/* Copyright (C) 1991, 1992, 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 <unistd.h> -#include <sys/types.h> - -/* Change the owner and group of the file referred to by FD. */ -int -__fchown (fd, owner, group) - int fd; - uid_t owner; - gid_t group; -{ - if (fd < 0) - { - __set_errno (EINVAL); - return -1; - } - - __set_errno (ENOSYS); - return -1; -} -stub_warning (fchown) - -weak_alias (__fchown, fchown) -#include <stub-tag.h> diff --git a/io/fchownat.c b/io/fchownat.c deleted file mode 100644 index f6921c9012..0000000000 --- a/io/fchownat.c +++ /dev/null @@ -1,51 +0,0 @@ -/* Copyright (C) 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 - 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 <fcntl.h> -#include <stddef.h> -#include <unistd.h> -#include <sys/types.h> - -/* Change the owner and group of FILE. */ -int -fchownat (fd, file, owner, group, flag) - int fd; - const char *file; - uid_t owner; - gid_t group; - int flag; -{ - if (file == NULL || (flag & ~AT_SYMLINK_NOFOLLOW) != 0) - { - __set_errno (EINVAL); - return -1; - } - - if (fd < 0 && fd != AT_FDCWD) - { - __set_errno (EBADF); - return -1; - } - - __set_errno (ENOSYS); - return -1; -} -stub_warning (fchownat) - -#include <stub-tag.h> diff --git a/io/fcntl.c b/io/fcntl.c deleted file mode 100644 index db6fbc399c..0000000000 --- a/io/fcntl.c +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright (C) 1991, 1995, 1996, 1997, 2002 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 <fcntl.h> - -/* Perform file control operations on FD. */ -int -__fcntl (fd, cmd) - int fd; - int cmd; -{ - if (fd < 0) - { - __set_errno (EBADF); - return -1; - } - - __set_errno (ENOSYS); - return -1; -} -libc_hidden_def (__fcntl) -stub_warning (fcntl) - -weak_alias (__fcntl, fcntl) -#include <stub-tag.h> diff --git a/io/fcntl.h b/io/fcntl.h index 72a944b3d4..ef9d5f9b81 100644 --- a/io/fcntl.h +++ b/io/fcntl.h @@ -1,5 +1,4 @@ -/* Copyright (C) 1991,1992,1994-2001,2003,2004,2005,2006 - Free Software Foundation, Inc. +/* Copyright (C) 1991,1992,1994-2001,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 @@ -56,18 +55,6 @@ __BEGIN_DECLS # define SEEK_END 2 /* Seek from end of file. */ #endif /* XPG */ -#ifdef __USE_ATFILE -# define AT_FDCWD -100 /* Special value used to indicate - the *at functions should use the - current working directory. */ -# define AT_SYMLINK_NOFOLLOW 0x100 /* Do not follow symbolic links. */ -# define AT_REMOVEDIR 0x200 /* Remove directory instead of - unlinking file. */ -# define AT_SYMLINK_FOLLOW 0x400 /* Follow symbolic links. */ -# define AT_EACCESS 0x200 /* Test access permitted for - effective IDs, not real IDs. */ -#endif - /* Do the file control operation described by CMD on FD. The remaining arguments are interpreted depending on CMD. @@ -95,32 +82,6 @@ extern int __REDIRECT (open, (__const char *__file, int __oflag, ...), open64) extern int open64 (__const char *__file, int __oflag, ...) __nonnull ((1)); #endif -#ifdef __USE_ATFILE -/* Similar to `open' but a relative path name is interpreted relative to - the directory for which FD is a descriptor. - - NOTE: some other `openat' implementation support additional functionality - through this interface, especially using the O_XATTR flag. This is not - yet supported here. - - This function is a cancellation point and therefore not marked with - __THROW. */ -# ifndef __USE_FILE_OFFSET64 -extern int openat (int __fd, __const char *__file, int __oflag, ...) - __nonnull ((2)); -# else -# ifdef __REDIRECT -extern int __REDIRECT (openat, (int __fd, __const char *__file, int __oflag, - ...), openat64) __nonnull ((2)); -# else -# define openat openat64 -# endif -# endif - -extern int openat64 (int __fd, __const char *__file, int __oflag, ...) - __nonnull ((2)); -#endif - /* Create and open FILE, with mode MODE. This takes an `int' MODE argument because that is what `mode_t' will be widened to. diff --git a/io/flock.c b/io/flock.c deleted file mode 100644 index db3bfcfcbe..0000000000 --- a/io/flock.c +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright (C) 1992, 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 <sys/file.h> - -/* Apply or remove an advisory lock, according to OPERATION, - on the file FD refers to. */ -int -__flock (fd, operation) - int fd; - int operation; -{ - __set_errno (ENOSYS); - return -1; -} - -weak_alias (__flock, flock) - -stub_warning (flock) -#include <stub-tag.h> diff --git a/io/fstatat.c b/io/fstatat.c deleted file mode 100644 index 1ac80597a0..0000000000 --- a/io/fstatat.c +++ /dev/null @@ -1,58 +0,0 @@ -/* Copyright (C) 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 - 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. - - In addition to the permissions in the GNU Lesser General Public - License, the Free Software Foundation gives you unlimited - permission to link the compiled version of this file with other - programs, and to distribute those programs without any restriction - coming from the use of this file. (The GNU Lesser General Public - License restrictions do apply in other respects; for example, they - cover modification of the file, and distribution when not linked - into another program.) - - Note that people who make modified versions of this file are not - obligated to grant this special exception for their modified - versions; it is their choice whether to do so. The GNU Lesser - General Public License gives permission to release a modified - version without this exception; this exception also makes it - possible to release a modified version which carries forward this - exception. - - 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/stat.h> - -/* This definition is only used if inlining fails for this function; see - the last page of <sys/stat.h>. The real work is done by the `x' - function which is passed a version number argument. We arrange in the - makefile that when not inlined this function is always statically - linked; that way a dynamically-linked executable always encodes the - version number corresponding to the data structures it uses, so the `x' - functions in the shared library can adapt without needing to recompile - all callers. */ - -#undef fstatat -int -fstatat (int fd, const char *file, struct stat *buf, int flag) -{ - return __fxstatat (_STAT_VER, fd, file, buf, flag); -} - -/* Hide the symbol so that no definition but the one locally in the - executable or DSO is used. */ -#ifdef HAVE_DOT_HIDDEN -asm (".hidden\tfstatat"); -#endif diff --git a/io/fstatat64.c b/io/fstatat64.c deleted file mode 100644 index a14b42d42e..0000000000 --- a/io/fstatat64.c +++ /dev/null @@ -1,58 +0,0 @@ -/* Copyright (C) 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 - 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. - - In addition to the permissions in the GNU Lesser General Public - License, the Free Software Foundation gives you unlimited - permission to link the compiled version of this file with other - programs, and to distribute those programs without any restriction - coming from the use of this file. (The GNU Lesser General Public - License restrictions do apply in other respects; for example, they - cover modification of the file, and distribution when not linked - into another program.) - - Note that people who make modified versions of this file are not - obligated to grant this special exception for their modified - versions; it is their choice whether to do so. The GNU Lesser - General Public License gives permission to release a modified - version without this exception; this exception also makes it - possible to release a modified version which carries forward this - exception. - - 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/stat.h> - -/* This definition is only used if inlining fails for this function; see - the last page of <sys/stat.h>. The real work is done by the `x' - function which is passed a version number argument. We arrange in the - makefile that when not inlined this function is always statically - linked; that way a dynamically-linked executable always encodes the - version number corresponding to the data structures it uses, so the `x' - functions in the shared library can adapt without needing to recompile - all callers. */ - -#undef fstatat64 -int -fstatat64 (int fd, const char *file, struct stat64 *buf, int flag) -{ - return __fxstatat64 (_STAT_VER, fd, file, buf, flag); -} - -/* Hide the symbol so that no definition but the one locally in the - executable or DSO is used. */ -#ifdef HAVE_DOT_HIDDEN -asm (".hidden\tfstatat64"); -#endif diff --git a/io/fstatfs.c b/io/fstatfs.c deleted file mode 100644 index 4a1a996cbc..0000000000 --- a/io/fstatfs.c +++ /dev/null @@ -1,34 +0,0 @@ -/* Return information about the filesystem on which FD resides. - Copyright (C) 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 <sys/statfs.h> -#include <stddef.h> - -/* Return information about the filesystem on which FD resides. */ -int -__fstatfs (int fd, struct statfs *buf) -{ - __set_errno (ENOSYS); - return -1; -} -stub_warning (fstatfs) - -weak_alias (__fstatfs, fstatfs) -#include <stub-tag.h> diff --git a/io/fstatfs64.c b/io/fstatfs64.c deleted file mode 100644 index 249b97ea44..0000000000 --- a/io/fstatfs64.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright (C) 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 <errno.h> -#include <sys/statfs.h> - -/* Return information about the filesystem on which FD resides. */ -int -__fstatfs64 (int fd, struct statfs64 *buf) -{ - __set_errno (ENOSYS); - return -1; -} -weak_alias (__fstatfs64, fstatfs64) - -stub_warning (fstatfs64) -#include <stub-tag.h> diff --git a/io/fstatvfs.c b/io/fstatvfs.c deleted file mode 100644 index c5f75a7c97..0000000000 --- a/io/fstatvfs.c +++ /dev/null @@ -1,33 +0,0 @@ -/* Return information about the filesystem on which FD resides. - Copyright (C) 1996, 1997, 1998, 2002 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/statvfs.h> - -/* Return information about the filesystem on which FD resides. */ -int -__fstatvfs (int fd, struct statvfs *buf) -{ - __set_errno (ENOSYS); - return -1; -} -stub_warning (fstatvfs) -weak_alias (__fstatvfs, fstatvfs) -libc_hidden_weak (fstatvfs) -#include <stub-tag.h> diff --git a/io/fstatvfs64.c b/io/fstatvfs64.c deleted file mode 100644 index 47d4e266e2..0000000000 --- a/io/fstatvfs64.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright (C) 1998, 2001 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/statvfs.h> - -/* Return information about the filesystem on which FD resides. */ -int -__fstatvfs64 (int fd, struct statvfs64 *buf) -{ - __set_errno (ENOSYS); - return -1; -} -weak_alias (__fstatvfs64, fstatvfs64) - -stub_warning (fstatvfs64) -#include <stub-tag.h> @@ -53,7 +53,7 @@ static char sccsid[] = "@(#)fts.c 8.6 (Berkeley) 8/14/94"; #endif -static FTSENT *fts_alloc (FTS *, const char *, size_t) internal_function; +static FTSENT *fts_alloc (FTS *, const char *, int) internal_function; static FTSENT *fts_build (FTS *, int) internal_function; static void fts_lfree (FTSENT *) internal_function; static void fts_load (FTS *, FTSENT *) internal_function; @@ -93,8 +93,8 @@ fts_open(argv, options, compar) register FTS *sp; register FTSENT *p, *root; register int nitems; - FTSENT *parent = NULL; - FTSENT *tmp; + FTSENT *parent, *tmp; + int len; /* Options check. */ if (options & ~FTS_OPTIONMASK) { @@ -120,22 +120,18 @@ fts_open(argv, options, compar) #ifndef MAXPATHLEN #define MAXPATHLEN 1024 #endif - size_t maxarglen = fts_maxarglen(argv); - if (fts_palloc(sp, MAX(maxarglen, MAXPATHLEN))) + if (fts_palloc(sp, MAX(fts_maxarglen(argv), MAXPATHLEN))) goto mem1; /* Allocate/initialize root's parent. */ - if (*argv != NULL) { - if ((parent = fts_alloc(sp, "", 0)) == NULL) - goto mem2; - parent->fts_level = FTS_ROOTPARENTLEVEL; - } + if ((parent = fts_alloc(sp, "", 0)) == NULL) + goto mem2; + parent->fts_level = FTS_ROOTPARENTLEVEL; /* Allocate/initialize root(s). */ for (root = NULL, nitems = 0; *argv != NULL; ++argv, ++nitems) { /* Don't allow zero-length paths. */ - size_t len = strlen(*argv); - if (len == 0) { + if ((len = strlen(*argv)) == 0) { __set_errno (ENOENT); goto mem3; } @@ -251,7 +247,8 @@ fts_close(sp) /* Free up child linked list, sort array, path buffer. */ if (sp->fts_child) fts_lfree(sp->fts_child); - free(sp->fts_array); + if (sp->fts_array) + free(sp->fts_array); free(sp->fts_path); /* Return to original directory, save errno if necessary. */ @@ -376,14 +373,12 @@ fts_read(sp) } p = sp->fts_child; sp->fts_child = NULL; - sp->fts_cur = p; goto name; } /* Move to the next node on this level. */ next: tmp = p; if ((p = p->fts_link) != NULL) { - sp->fts_cur = p; free(tmp); /* @@ -396,7 +391,7 @@ next: tmp = p; return (NULL); } fts_load(sp, p); - return p; + return (sp->fts_cur = p); } /* @@ -422,12 +417,11 @@ next: tmp = p; name: t = sp->fts_path + NAPPEND(p->fts_parent); *t++ = '/'; memmove(t, p->fts_name, p->fts_namelen + 1); - return p; + return (sp->fts_cur = p); } /* Move up to the parent node. */ p = tmp->fts_parent; - sp->fts_cur = p; free(tmp); if (p->fts_level == FTS_ROOTPARENTLEVEL) { @@ -468,7 +462,7 @@ name: t = sp->fts_path + NAPPEND(p->fts_parent); return (NULL); } p->fts_info = p->fts_errno ? FTS_ERR : FTS_DP; - return p; + return (sp->fts_cur = p); } /* @@ -696,7 +690,7 @@ fts_build(sp, type) if (!ISSET(FTS_SEEDOT) && ISDOT(dp->d_name)) continue; - if ((p = fts_alloc(sp, dp->d_name, _D_EXACT_NAMLEN (dp))) == NULL) + if ((p = fts_alloc(sp, dp->d_name, (int)_D_EXACT_NAMLEN (dp))) == NULL) goto mem1; if (_D_EXACT_NAMLEN (dp) >= maxlen) {/* include space for NUL */ oldaddr = sp->fts_path; @@ -707,7 +701,8 @@ fts_build(sp, type) * structures already allocated. */ mem1: saved_errno = errno; - free(p); + if (p) + free(p); fts_lfree(head); (void)__closedir(dirp); cur->fts_info = FTS_ERR; @@ -748,10 +743,6 @@ mem1: saved_errno = errno; p->fts_flags |= FTS_ISW; #endif -#if 0 - /* Unreachable code. cderrno is only ever set to a nonnull - value if dirp is closed at the same time. But then we - cannot enter this loop. */ if (cderrno) { if (nlinks) { p->fts_info = FTS_NS; @@ -759,9 +750,7 @@ mem1: saved_errno = errno; } else p->fts_info = FTS_NSOK; p->fts_accpath = cur->fts_accpath; - } else -#endif - if (nlinks == 0 + } else if (nlinks == 0 #if defined DT_DIR && defined _DIRENT_HAVE_D_TYPE || (nostat && dp->d_type != DT_DIR && dp->d_type != DT_UNKNOWN) @@ -829,7 +818,6 @@ mem1: saved_errno = errno; fts_safe_changedir(sp, cur->fts_parent, -1, ".."))) { cur->fts_info = FTS_ERR; SET(FTS_STOP); - fts_lfree(head); return (NULL); } @@ -837,7 +825,6 @@ mem1: saved_errno = errno; if (!nitems) { if (type == BREAD) cur->fts_info = FTS_DP; - fts_lfree(head); return (NULL); } @@ -974,7 +961,7 @@ internal_function fts_alloc(sp, name, namelen) FTS *sp; const char *name; - size_t namelen; + register int namelen; { register FTSENT *p; size_t len; @@ -1044,7 +1031,10 @@ fts_palloc(sp, more) * We limit fts_pathlen to USHRT_MAX to be safe in both cases. */ if (sp->fts_pathlen < 0 || sp->fts_pathlen >= USHRT_MAX) { - free(sp->fts_path); + if (sp->fts_path) { + free(sp->fts_path); + sp->fts_path = NULL; + } sp->fts_path = NULL; __set_errno (ENAMETOOLONG); return (1); @@ -1,5 +1,5 @@ /* File tree walker functions. - Copyright (C) 1996-2003, 2004, 2006, 2007 Free Software Foundation, Inc. + Copyright (C) 1996-2003, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. @@ -36,7 +36,7 @@ char *alloca (); # endif #endif -#ifdef _LIBC +#if defined _LIBC # include <dirent.h> # define NAMLEN(dirent) _D_EXACT_NAMLEN (dirent) #else @@ -59,14 +59,12 @@ char *alloca (); #endif #include <errno.h> -#include <fcntl.h> #include <ftw.h> #include <limits.h> #include <search.h> #include <stdlib.h> #include <string.h> #include <unistd.h> -#include <not-cancel.h> #if HAVE_SYS_PARAM_H || defined _LIBC # include <sys/param.h> #endif @@ -144,11 +142,9 @@ int rpl_lstat (const char *, struct stat *); # ifdef _LIBC # define LXSTAT __lxstat # define XSTAT __xstat -# define FXSTATAT __fxstatat # else # define LXSTAT(V,f,sb) lstat (f,sb) # define XSTAT(V,f,sb) stat (f,sb) -# define FXSTATAT(V,d,f,sb,m) fstatat (d, f, sb, m) # endif # define FTW_FUNC_T __ftw_func_t # define NFTW_FUNC_T __nftw_func_t @@ -165,7 +161,6 @@ int rpl_lstat (const char *, struct stat *); struct dir_data { DIR *stream; - int streamfd; char *content; }; @@ -267,7 +262,7 @@ find_object (struct ftw_data *data, struct STAT *st) static inline int __attribute ((always_inline)) -open_dir_stream (int *dfdp, struct ftw_data *data, struct dir_data *dirp) +open_dir_stream (struct ftw_data *data, struct dir_data *dirp) { int result = 0; @@ -301,7 +296,8 @@ open_dir_stream (int *dfdp, struct ftw_data *data, struct dir_data *dirp) int save_err = errno; free (buf); __set_errno (save_err); - return -1; + result = -1; + break; } buf = newp; } @@ -327,7 +323,6 @@ open_dir_stream (int *dfdp, struct ftw_data *data, struct dir_data *dirp) { __closedir (st); data->dirstreams[data->actdir]->stream = NULL; - data->dirstreams[data->actdir]->streamfd = -1; data->dirstreams[data->actdir] = NULL; } } @@ -336,37 +331,15 @@ open_dir_stream (int *dfdp, struct ftw_data *data, struct dir_data *dirp) /* Open the new stream. */ if (result == 0) { + const char *name = ((data->flags & FTW_CHDIR) + ? data->dirbuf + data->ftw.base: data->dirbuf); assert (data->dirstreams[data->actdir] == NULL); - if (dfdp != NULL && *dfdp != -1) - { - int fd = openat64_not_cancel_3 (*dfdp, data->dirbuf + data->ftw.base, - O_RDONLY | O_DIRECTORY | O_NDELAY); - dirp->stream = NULL; - if (fd != -1 && (dirp->stream = __fdopendir (fd)) == NULL) - close_not_cancel_no_status (fd); - } - else - { - const char *name; - - if (data->flags & FTW_CHDIR) - { - name = data->dirbuf + data->ftw.base; - if (name[0] == '\0') - name = "."; - } - else - name = data->dirbuf; - - dirp->stream = __opendir (name); - } - + dirp->stream = __opendir (name); if (dirp->stream == NULL) result = -1; else { - dirp->streamfd = dirfd (dirp->stream); dirp->content = NULL; data->dirstreams[data->actdir] = dirp; @@ -382,7 +355,7 @@ open_dir_stream (int *dfdp, struct ftw_data *data, struct dir_data *dirp) static int internal_function process_entry (struct ftw_data *data, struct dir_data *dir, const char *name, - size_t namlen, int d_type) + size_t namlen) { struct STAT st; int result = 0; @@ -409,40 +382,21 @@ process_entry (struct ftw_data *data, struct dir_data *dir, const char *name, *((char *) __mempcpy (data->dirbuf + data->ftw.base, name, namlen)) = '\0'; - int statres; - if (dir->streamfd != -1) - statres = FXSTATAT (_STAT_VER, dir->streamfd, name, &st, - (data->flags & FTW_PHYS) ? AT_SYMLINK_NOFOLLOW : 0); - else - { - if ((data->flags & FTW_CHDIR) == 0) - name = data->dirbuf; + if ((data->flags & FTW_CHDIR) == 0) + name = data->dirbuf; - statres = ((data->flags & FTW_PHYS) - ? LXSTAT (_STAT_VER, name, &st) - : XSTAT (_STAT_VER, name, &st)); - } - - if (statres < 0) + if (((data->flags & FTW_PHYS) + ? LXSTAT (_STAT_VER, name, &st) + : XSTAT (_STAT_VER, name, &st)) < 0) { if (errno != EACCES && errno != ENOENT) result = -1; - else if (data->flags & FTW_PHYS) - flag = FTW_NS; - else if (d_type == DT_LNK) + else if (!(data->flags & FTW_PHYS) + && LXSTAT (_STAT_VER, name, &st) == 0 + && S_ISLNK (st.st_mode)) flag = FTW_SLN; else - { - if (dir->streamfd != -1) - statres = FXSTATAT (_STAT_VER, dir->streamfd, name, &st, - AT_SYMLINK_NOFOLLOW); - else - statres = LXSTAT (_STAT_VER, name, &st); - if (statres == 0 && S_ISLNK (st.st_mode)) - flag = FTW_SLN; - else - flag = FTW_NS; - } + flag = FTW_NS; } else { @@ -491,8 +445,7 @@ ftw_dir (struct ftw_data *data, struct STAT *st, struct dir_data *old_dir) /* Open the stream for this directory. This might require that another stream has to be closed. */ - result = open_dir_stream (old_dir == NULL ? NULL : &old_dir->streamfd, - data, &dir); + result = open_dir_stream (data, &dir); if (result != 0) { if (errno == EACCES) @@ -512,7 +465,6 @@ ftw_dir (struct ftw_data *data, struct STAT *st, struct dir_data *old_dir) fail: save_err = errno; __closedir (dir.stream); - dir.streamfd = -1; __set_errno (save_err); if (data->actdir-- == 0) @@ -534,7 +486,7 @@ fail: /* Next, update the `struct FTW' information. */ ++data->ftw.level; - startp = __rawmemchr (data->dirbuf, '\0'); + startp = strchr (data->dirbuf, '\0'); /* There always must be a directory name. */ assert (startp != data->dirbuf); if (startp[-1] != '/') @@ -543,7 +495,7 @@ fail: while (dir.stream != NULL && (d = __readdir64 (dir.stream)) != NULL) { - result = process_entry (data, &dir, d->d_name, NAMLEN (d), d->d_type); + result = process_entry (data, &dir, d->d_name, NAMLEN (d)); if (result != 0) break; } @@ -557,7 +509,6 @@ fail: assert (dir.content == NULL); __closedir (dir.stream); - dir.streamfd = -1; __set_errno (save_err); if (data->actdir-- == 0) @@ -573,8 +524,7 @@ fail: { char *endp = strchr (runp, '\0'); - // XXX Should store the d_type values as well?! - result = process_entry (data, &dir, runp, endp - runp, DT_UNKNOWN); + result = process_entry (data, &dir, runp, endp - runp); runp = endp + 1; } @@ -635,7 +585,6 @@ ftw_startup (const char *dir, int is_nftw, void *func, int descriptors, struct STAT st; int result = 0; int save_err; - int cwdfd = -1; char *cwd = NULL; char *cp; @@ -690,26 +639,11 @@ ftw_startup (const char *dir, int is_nftw, void *func, int descriptors, /* Now go to the directory containing the initial file/directory. */ if (flags & FTW_CHDIR) { - /* We have to be able to go back to the current working - directory. The best way to do this is to use a file - descriptor. */ - cwdfd = __open (".", O_RDONLY | O_DIRECTORY); - if (cwdfd == -1) - { - /* Try getting the directory name. This can be needed if - the current directory is executable but not readable. */ - if (errno == EACCES) - /* GNU extension ahead. */ - cwd = __getcwd (NULL, 0); - - if (cwd == NULL) - goto out_fail; - } - else if (data.maxdir > 1) - /* Account for the file descriptor we use here. */ - --data.maxdir; - - if (data.ftw.base > 0) + /* GNU extension ahead. */ + cwd = __getcwd (NULL, 0); + if (cwd == NULL) + result = -1; + else if (data.ftw.base > 0) { /* Change to the directory the file is in. In data.dirbuf we have a writable copy of the file name. Just NUL @@ -730,16 +664,9 @@ ftw_startup (const char *dir, int is_nftw, void *func, int descriptors, /* Get stat info for start directory. */ if (result == 0) { - const char *name; - - if (data.flags & FTW_CHDIR) - { - name = data.dirbuf + data.ftw.base; - if (name[0] == '\0') - name = "."; - } - else - name = data.dirbuf; + const char *name = ((data.flags & FTW_CHDIR) + ? data.dirbuf + data.ftw.base + : data.dirbuf); if (((flags & FTW_PHYS) ? LXSTAT (_STAT_VER, name, &st) @@ -786,13 +713,7 @@ ftw_startup (const char *dir, int is_nftw, void *func, int descriptors, } /* Return to the start directory (if necessary). */ - if (cwdfd != -1) - { - int save_err = errno; - __fchdir (cwdfd); - __set_errno (save_err); - } - else if (cwd != NULL) + if (cwd != NULL) { int save_err = errno; __chdir (cwd); @@ -801,7 +722,6 @@ ftw_startup (const char *dir, int is_nftw, void *func, int descriptors, } /* Free all memory. */ - out_fail: save_err = errno; __tdestroy (data.known_objects, free); free (data.dirbuf); @@ -835,7 +755,7 @@ NFTW_NAME (path, func, descriptors, flags) } #else -# include <shlib-compat.h> +#include <shlib-compat.h> int NFTW_NEW_NAME (const char *, NFTW_FUNC_T, int, int); @@ -857,7 +777,7 @@ NFTW_NEW_NAME (path, func, descriptors, flags) versioned_symbol (libc, NFTW_NEW_NAME, NFTW_NAME, GLIBC_2_3_3); -# if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_3_3) +#if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_3_3) /* Older nftw* version just ignored all unknown flags. */ @@ -876,5 +796,5 @@ NFTW_OLD_NAME (path, func, descriptors, flags) } compat_symbol (libc, NFTW_OLD_NAME, NFTW_NAME, GLIBC_2_1); -# endif +#endif #endif diff --git a/io/ftw64.c b/io/ftw64.c index 39e6ceabf8..7913b7af17 100644 --- a/io/ftw64.c +++ b/io/ftw64.c @@ -1,5 +1,5 @@ /* File tree walker functions. LFS version. - Copyright (C) 1996, 1997, 1998, 2001, 2006 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 1998, 2001 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. @@ -26,7 +26,6 @@ #define STAT stat64 #define LXSTAT __lxstat64 #define XSTAT __xstat64 -#define FXSTATAT __fxstatat64 #define FTW_FUNC_T __ftw64_func_t #define NFTW_FUNC_T __nftw64_func_t diff --git a/io/fxstat.c b/io/fxstat.c deleted file mode 100644 index b750daca63..0000000000 --- a/io/fxstat.c +++ /dev/null @@ -1,50 +0,0 @@ -/* Copyright (C) 1991, 1995, 1996, 1997, 2002 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 <sys/stat.h> - -/* Get information about the file descriptor FD in BUF. */ -int -__fxstat (int vers, int fd, struct stat *buf) -{ - if (vers != _STAT_VER) - { - __set_errno (EINVAL); - return -1; - } - - if (fd < 0) - { - __set_errno (EBADF); - return -1; - } - else if (buf == NULL) - { - __set_errno (EINVAL); - return -1; - } - - __set_errno (ENOSYS); - return -1; -} -stub_warning (fstat) -hidden_def (__fxstat) -weak_alias (__fxstat, _fxstat) -#include <stub-tag.h> diff --git a/io/fxstat64.c b/io/fxstat64.c deleted file mode 100644 index 865ba49484..0000000000 --- a/io/fxstat64.c +++ /dev/null @@ -1,49 +0,0 @@ -/* Copyright (C) 1991, 1995, 1996, 1997, 2002 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 <sys/stat.h> - -/* Get information about the file descriptor FD in BUF. */ -int -__fxstat64 (int vers, int fd, struct stat64 *buf) -{ - if (vers != _STAT_VER) - { - __set_errno (EINVAL); - return -1; - } - - if (fd < 0) - { - __set_errno (EBADF); - return -1; - } - else if (buf == NULL) - { - __set_errno (EINVAL); - return -1; - } - - __set_errno (ENOSYS); - return -1; -} -hidden_def (__fxstat64) -stub_warning (fstat64) -#include <stub-tag.h> diff --git a/io/fxstatat.c b/io/fxstatat.c deleted file mode 100644 index 2486c73c84..0000000000 --- a/io/fxstatat.c +++ /dev/null @@ -1,50 +0,0 @@ -/* 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 <fcntl.h> -#include <stddef.h> -#include <sys/stat.h> - -/* Get information about the file descriptor FD in BUF. */ -int -__fxstatat (int vers, int fd, const char *filename, struct stat *buf, int flag) -{ - if (vers != _STAT_VER) - { - __set_errno (EINVAL); - return -1; - } - - if (fd < 0 && fd != AT_FDCWD) - { - __set_errno (EBADF); - return -1; - } - if (buf == NULL || (flag & ~AT_SYMLINK_NOFOLLOW) != 0) - { - __set_errno (EINVAL); - return -1; - } - - __set_errno (ENOSYS); - return -1; -} -libc_hidden_def (__fxstatat) -stub_warning (fstatat) -#include <stub-tag.h> diff --git a/io/fxstatat64.c b/io/fxstatat64.c deleted file mode 100644 index 20bdd610c3..0000000000 --- a/io/fxstatat64.c +++ /dev/null @@ -1,51 +0,0 @@ -/* 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 <fcntl.h> -#include <stddef.h> -#include <sys/stat.h> - -/* Get information about the file descriptor FD in BUF. */ -int -__fxstatat64 (int vers, int fd, const char *filename, struct stat64 *buf, - int flag) -{ - if (vers != _STAT_VER) - { - __set_errno (EINVAL); - return -1; - } - - if (fd < 0 && fd != AT_FDCWD) - { - __set_errno (EBADF); - return -1; - } - if (buf == NULL || (flag & ~AT_SYMLINK_NOFOLLOW) != 0) - { - __set_errno (EINVAL); - return -1; - } - - __set_errno (ENOSYS); - return -1; -} -libc_hidden_def (__fxstatat64) -stub_warning (fstatat64) -#include <stub-tag.h> diff --git a/io/getcwd.c b/io/getcwd.c deleted file mode 100644 index c472d1d7a6..0000000000 --- a/io/getcwd.c +++ /dev/null @@ -1,40 +0,0 @@ -/* Copyright (C) 1991, 1992, 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 <unistd.h> -#include <stddef.h> - -/* Get the pathname of the current working directory, - and put it in SIZE bytes of BUF. Returns NULL if the - directory couldn't be determined or SIZE was too small. - If successful, returns BUF. In GNU, if BUF is NULL, - an array is allocated with `malloc'; the array is SIZE - bytes long, unless SIZE <= 0, in which case it is as - big as necessary. */ -char * -__getcwd (char *buf, size_t size) -{ - __set_errno (ENOSYS); - return NULL; -} -weak_alias (__getcwd, getcwd) - -stub_warning (__getcwd) -stub_warning (getcwd) -#include <stub-tag.h> diff --git a/io/isatty.c b/io/isatty.c deleted file mode 100644 index 9b0410c614..0000000000 --- a/io/isatty.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 <unistd.h> - -/* Return 1 if FD is a terminal, 0 if not. */ -int -__isatty (fd) - int fd; -{ - __set_errno (ENOSYS); - return -1; -} - -weak_alias (__isatty, isatty) - -stub_warning (isatty) -#include <stub-tag.h> diff --git a/io/lchmod.c b/io/lchmod.c deleted file mode 100644 index 524b24c1ed..0000000000 --- a/io/lchmod.c +++ /dev/null @@ -1,33 +0,0 @@ -/* lchmod -- Change the protections of a file or symbolic link. Stub version. - Copyright (C) 2002 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/stat.h> -#include <sys/types.h> - -/* Change the protections of FILE to MODE. */ -int -lchmod (const char *file, mode_t mode) -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (lchmod) -#include <stub-tag.h> diff --git a/io/lchown.c b/io/lchown.c deleted file mode 100644 index 4e0330e526..0000000000 --- a/io/lchown.c +++ /dev/null @@ -1,43 +0,0 @@ -/* Copyright (C) 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 <errno.h> -#include <stddef.h> -#include <unistd.h> -#include <sys/types.h> - -/* Change the owner and group of FILE. */ -int -__lchown (file, owner, group) - const char *file; - uid_t owner; - gid_t group; -{ - if (file == NULL) - { - __set_errno (EINVAL); - return -1; - } - - __set_errno (ENOSYS); - return -1; -} -stub_warning (lchown) - -weak_alias (__lchown, lchown) -#include <stub-tag.h> diff --git a/io/link.c b/io/link.c deleted file mode 100644 index 70c9949704..0000000000 --- a/io/link.c +++ /dev/null @@ -1,42 +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 <unistd.h> - - -/* Make a link to FROM called TO. */ -int -__link (from, to) - const char *from; - const char *to; -{ - if (from == NULL || to == NULL) - { - __set_errno (EINVAL); - return -1; - } - - __set_errno (ENOSYS); - return -1; -} -stub_warning (link) - -weak_alias (__link, link) -#include <stub-tag.h> diff --git a/io/linkat.c b/io/linkat.c deleted file mode 100644 index 9afcf61a3c..0000000000 --- a/io/linkat.c +++ /dev/null @@ -1,52 +0,0 @@ -/* 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 <fcntl.h> -#include <stddef.h> -#include <unistd.h> - - -/* Make a link to FROM relative to FROMFD called TO relative to TOFD. */ -int -linkat (fromfd, from, tofd, to, flags) - int fromfd; - const char *from; - int tofd; - const char *to; - int flags; -{ - if (from == NULL || to == NULL) - { - __set_errno (EINVAL); - return -1; - } - - if ((tofd != AT_FDCWD && tofd < 0 && *to != '/') - || (fromfd != AT_FDCWD && fromfd < 0 && *from != '/')) - { - __set_errno (EBADF); - return -1; - } - - __set_errno (ENOSYS); - return -1; -} -stub_warning (linkat) - -#include <stub-tag.h> diff --git a/io/lockf.c b/io/lockf.c deleted file mode 100644 index 7b23f66bc9..0000000000 --- a/io/lockf.c +++ /dev/null @@ -1,74 +0,0 @@ -/* Copyright (C) 1994,1996,1997,1998,2000,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 - 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 <unistd.h> -#include <fcntl.h> -#include <errno.h> -#include <string.h> - -/* lockf is a simplified interface to fcntl's locking facilities. */ - -int -lockf (int fd, int cmd, off_t len) -{ - struct flock fl; - - memset ((char *) &fl, '\0', sizeof (fl)); - - /* lockf is always relative to the current file position. */ - fl.l_whence = SEEK_CUR; - fl.l_start = 0; - fl.l_len = len; - - switch (cmd) - { - case F_TEST: - /* Test the lock: return 0 if FD is unlocked or locked by this process; - return -1, set errno to EACCES, if another process holds the lock. */ - fl.l_type = F_RDLCK; - if (__fcntl (fd, F_GETLK, &fl) < 0) - return -1; - if (fl.l_type == F_UNLCK || fl.l_pid == __getpid ()) - return 0; - __set_errno (EACCES); - return -1; - - case F_ULOCK: - fl.l_type = F_UNLCK; - cmd = F_SETLK; - break; - case F_LOCK: - fl.l_type = F_WRLCK; - cmd = F_SETLKW; - break; - case F_TLOCK: - fl.l_type = F_WRLCK; - cmd = F_SETLK; - break; - - default: - __set_errno (EINVAL); - return -1; - } - - /* lockf() is a cancellation point but so is fcntl() if F_SETLKW is - used. Therefore we don't have to care about cancellation here, - the fcntl() function will take care of it. */ - return __fcntl (fd, cmd, &fl); -} diff --git a/io/lockf64.c b/io/lockf64.c deleted file mode 100644 index e3b110cd3f..0000000000 --- a/io/lockf64.c +++ /dev/null @@ -1,79 +0,0 @@ -/* Copyright (C) 1994,96,97,98,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 <sys/types.h> -#include <unistd.h> -#include <fcntl.h> -#include <errno.h> -#include <string.h> - -/* lockf is a simplified interface to fcntl's locking facilities. */ - -int -lockf64 (int fd, int cmd, off64_t len64) -{ - struct flock fl; - off_t len = (off_t) len64; - - if (len64 != (off64_t) len) - { - /* We can't represent the length. */ - __set_errno (EOVERFLOW); - return -1; - } - - memset ((char *) &fl, '\0', sizeof (fl)); - - /* lockf is always relative to the current file position. */ - fl.l_whence = SEEK_CUR; - fl.l_start = 0; - fl.l_len = len; - - switch (cmd) - { - case F_TEST: - /* Test the lock: return 0 if FD is unlocked or locked by this process; - return -1, set errno to EACCES, if another process holds the lock. */ - fl.l_type = F_RDLCK; - if (__fcntl (fd, F_GETLK, &fl) < 0) - return -1; - if (fl.l_type == F_UNLCK || fl.l_pid == __getpid ()) - return 0; - __set_errno (EACCES); - return -1; - - case F_ULOCK: - fl.l_type = F_UNLCK; - cmd = F_SETLK; - break; - case F_LOCK: - fl.l_type = F_WRLCK; - cmd = F_SETLKW; - break; - case F_TLOCK: - fl.l_type = F_WRLCK; - cmd = F_SETLK; - break; - - default: - __set_errno (EINVAL); - return -1; - } - - return __fcntl (fd, cmd, &fl); -} diff --git a/io/lseek64.c b/io/lseek64.c deleted file mode 100644 index d0a8cff03e..0000000000 --- a/io/lseek64.c +++ /dev/null @@ -1,49 +0,0 @@ -/* Copyright (C) 1991,95,96,97,98,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 <errno.h> -#include <unistd.h> -#include <sys/types.h> - -/* Seek to OFFSET on FD, starting from WHENCE. */ -off64_t -__libc_lseek64 (int fd, off64_t offset, int whence) -{ - if (fd < 0) - { - __set_errno (EBADF); - return -1; - } - switch (whence) - { - case SEEK_SET: - case SEEK_CUR: - case SEEK_END: - break; - default: - __set_errno (EINVAL); - return -1; - } - - __set_errno (ENOSYS); - return -1; -} -weak_alias (__libc_lseek64, __lseek64) -weak_alias (__libc_lseek64, lseek64) -stub_warning (lseek64) -#include <stub-tag.h> diff --git a/io/lxstat.c b/io/lxstat.c deleted file mode 100644 index 23d4442b5c..0000000000 --- a/io/lxstat.c +++ /dev/null @@ -1,27 +0,0 @@ -/* Copyright (C) 1991,1992,1995,1996,1997,2002 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/stat.h> - -int -__lxstat (int version, const char *file, struct stat *buf) -{ - return __xstat (version, file, buf); -} -hidden_def (__lxstat) -weak_alias (__lxstat, _lxstat) diff --git a/io/lxstat64.c b/io/lxstat64.c deleted file mode 100644 index 596ecd2277..0000000000 --- a/io/lxstat64.c +++ /dev/null @@ -1,39 +0,0 @@ -/* Copyright (C) 1991, 1995, 1996, 1997, 2002 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 <sys/stat.h> - -/* Get file information about FILE in BUF. - If FILE is a symbolic link, do not follow it. */ -int -__lxstat64 (int vers, const char *file, struct stat64 *buf) -{ - if (vers != _STAT_VER || file == NULL || buf == NULL) - { - __set_errno (EINVAL); - return -1; - } - - __set_errno (ENOSYS); - return -1; -} -hidden_def (__lxstat64) -stub_warning (__lxstat64) -#include <stub-tag.h> diff --git a/io/mkdir.c b/io/mkdir.c deleted file mode 100644 index 8037dfb3ee..0000000000 --- a/io/mkdir.c +++ /dev/null @@ -1,43 +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 <sys/stat.h> -#include <sys/types.h> - - -/* Create a directory named PATH with protections MODE. */ -int -__mkdir (path, mode) - const char *path; - mode_t mode; -{ - if (path == NULL) - { - __set_errno (EINVAL); - return -1; - } - - __set_errno (ENOSYS); - return -1; -} -stub_warning (mkdir) - -weak_alias (__mkdir, mkdir) -#include <stub-tag.h> diff --git a/io/mkdirat.c b/io/mkdirat.c deleted file mode 100644 index ccea3aa8d8..0000000000 --- a/io/mkdirat.c +++ /dev/null @@ -1,58 +0,0 @@ -/* Copyright (C) 1991, 1995, 1996, 1997, 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 - 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 <fcntl.h> -#include <stddef.h> -#include <sys/stat.h> -#include <sys/types.h> - - -/* Create a directory named PATH relative to FD with protections MODE. */ -int -mkdirat (fd, path, mode) - int fd; - const char *path; - mode_t mode; -{ - if (path == NULL) - { - __set_errno (EINVAL); - return -1; - } - - if (fd != AT_FDCWD && path[0] != '/') - { - /* Check FD is associated with a directory. */ - struct stat64 st; - if (__fxstat64 (_STAT_VER, fd, &st) != 0) - return -1; - - if (!S_ISDIR (st.st_mode)) - { - __set_errno (ENOTDIR); - return -1; - } - } - - __set_errno (ENOSYS); - return -1; -} -stub_warning (mkdirat) - -#include <stub-tag.h> diff --git a/io/mkfifo.c b/io/mkfifo.c deleted file mode 100644 index 614ebe97c3..0000000000 --- a/io/mkfifo.c +++ /dev/null @@ -1,43 +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 <sys/stat.h> -#include <sys/types.h> - - -/* Create a named pipe (FIFO) named PATH with protections MODE. */ -int -mkfifo (path, mode) - const char *path; - mode_t mode; -{ - if (path == NULL) - { - __set_errno (EINVAL); - return -1; - } - - __set_errno (ENOSYS); - return -1; -} - - -stub_warning (mkfifo) -#include <stub-tag.h> diff --git a/io/mkfifoat.c b/io/mkfifoat.c deleted file mode 100644 index 48c38c8182..0000000000 --- a/io/mkfifoat.c +++ /dev/null @@ -1,60 +0,0 @@ -/* Copyright (C) 1991, 1995, 1996, 1997, 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 - 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 <fcntl.h> -#include <stddef.h> -#include <sys/stat.h> -#include <sys/types.h> - - -/* Create a named pipe (FIFO) named PATH relative to FD with - protections MODE. */ -int -mkfifoat (fd, path, mode) - int fd; - const char *path; - mode_t mode; -{ - if (path == NULL) - { - __set_errno (EINVAL); - return -1; - } - - if (fd != AT_FDCWD && path[0] != '/') - { - /* Check FD is associated with a directory. */ - struct stat64 st; - if (__fxstat64 (_STAT_VER, fd, &st) != 0) - return -1; - - if (!S_ISDIR (st.st_mode)) - { - __set_errno (ENOTDIR); - return -1; - } - } - - __set_errno (ENOSYS); - return -1; -} - - -stub_warning (mkfifoat) -#include <stub-tag.h> diff --git a/io/mknod.c b/io/mknod.c deleted file mode 100644 index 7d43593a25..0000000000 --- a/io/mknod.c +++ /dev/null @@ -1,62 +0,0 @@ -/* Copyright (C) 1995, 1996, 2001 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. - - In addition to the permissions in the GNU Lesser General Public - License, the Free Software Foundation gives you unlimited - permission to link the compiled version of this file with other - programs, and to distribute those programs without any restriction - coming from the use of this file. (The GNU Lesser General Public - License restrictions do apply in other respects; for example, they - cover modification of the file, and distribution when not linked - into another program.) - - Note that people who make modified versions of this file are not - obligated to grant this special exception for their modified - versions; it is their choice whether to do so. The GNU Lesser - General Public License gives permission to release a modified - version without this exception; this exception also makes it - possible to release a modified version which carries forward this - exception. - - 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 <sys/stat.h> - -/* This definition is only used if inlining fails for this function; see - the last page of <sys/stat.h>. The real work is done by the `x' - function which is passed a version number argument. We arrange in the - makefile that when not inlined this function is always statically - linked; that way a dynamically-linked executable always encodes the - version number corresponding to the data structures it uses, so the `x' - functions in the shared library can adapt without needing to recompile - all callers. */ - -int -__mknod (const char *path, mode_t mode, dev_t dev) -{ - return __xmknod (_MKNOD_VER, path, mode, &dev); -} - -weak_alias (__mknod, mknod) - -/* Hide the symbol so that no definition but the one locally in the - executable or DSO is used. */ -#ifdef HAVE_DOT_HIDDEN -asm (".hidden\tmknod"); -asm (".hidden\t__mknod"); -#endif diff --git a/io/mknodat.c b/io/mknodat.c deleted file mode 100644 index ac515b5b48..0000000000 --- a/io/mknodat.c +++ /dev/null @@ -1,60 +0,0 @@ -/* Copyright (C) 1995, 1996, 2001, 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 - 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. - - In addition to the permissions in the GNU Lesser General Public - License, the Free Software Foundation gives you unlimited - permission to link the compiled version of this file with other - programs, and to distribute those programs without any restriction - coming from the use of this file. (The GNU Lesser General Public - License restrictions do apply in other respects; for example, they - cover modification of the file, and distribution when not linked - into another program.) - - Note that people who make modified versions of this file are not - obligated to grant this special exception for their modified - versions; it is their choice whether to do so. The GNU Lesser - General Public License gives permission to release a modified - version without this exception; this exception also makes it - possible to release a modified version which carries forward this - exception. - - 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 <sys/stat.h> - -/* This definition is only used if inlining fails for this function; see - the last page of <sys/stat.h>. The real work is done by the `x' - function which is passed a version number argument. We arrange in the - makefile that when not inlined this function is always statically - linked; that way a dynamically-linked executable always encodes the - version number corresponding to the data structures it uses, so the `x' - functions in the shared library can adapt without needing to recompile - all callers. */ - -int -mknodat (int fd, const char *path, mode_t mode, dev_t dev) -{ - return __xmknodat (_MKNOD_VER, fd, path, mode, &dev); -} - - -/* Hide the symbol so that no definition but the one locally in the - executable or DSO is used. */ -#ifdef HAVE_DOT_HIDDEN -asm (".hidden\tmknodat"); -#endif diff --git a/io/open.c b/io/open.c deleted file mode 100644 index 188110b3f3..0000000000 --- a/io/open.c +++ /dev/null @@ -1,54 +0,0 @@ -/* Copyright (C) 1991, 1995, 1996, 1997, 2002 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 <fcntl.h> -#include <stdarg.h> -#include <stddef.h> - -/* Open FILE with access OFLAG. If OFLAG includes O_CREAT, - a third argument is the file protection. */ -int -__open (file, oflag) - const char *file; - int oflag; -{ - int mode; - - if (file == NULL) - { - __set_errno (EINVAL); - return -1; - } - - if (oflag & O_CREAT) - { - va_list arg; - va_start(arg, oflag); - mode = va_arg(arg, int); - va_end(arg); - } - - __set_errno (ENOSYS); - return -1; -} -libc_hidden_def (__open) -stub_warning (open) - -weak_alias (__open, open) -#include <stub-tag.h> diff --git a/io/open64.c b/io/open64.c deleted file mode 100644 index d9a38112ac..0000000000 --- a/io/open64.c +++ /dev/null @@ -1,57 +0,0 @@ -/* Copyright (C) 1991, 1995, 1996, 1997, 1999, 2000, 2002 - 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 <fcntl.h> -#include <stdarg.h> -#include <stddef.h> -#include <bp-sym.h> - -/* Open FILE with access OFLAG. If OFLAG includes O_CREAT, - a third argument is the file protection. */ -int -__libc_open64 (file, oflag) - const char *file; - int oflag; -{ - int mode; - - if (file == NULL) - { - __set_errno (EINVAL); - return -1; - } - - if (oflag & O_CREAT) - { - va_list arg; - va_start (arg, oflag); - mode = va_arg (arg, int); - va_end (arg); - } - - __set_errno (ENOSYS); - return -1; -} -strong_alias (__libc_open64, __open64) -libc_hidden_def (__open64) -weak_alias (__libc_open64, BP_SYM (open64)) - -stub_warning (open64) -#include <stub-tag.h> diff --git a/io/openat.c b/io/openat.c deleted file mode 100644 index c65ad19c7a..0000000000 --- a/io/openat.c +++ /dev/null @@ -1,71 +0,0 @@ -/* 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 <fcntl.h> -#include <stdarg.h> -#include <stddef.h> -#include <sys/stat.h> - -/* Open FILE with access OFLAG. Interpret relative paths relative to - the directory associated with FD. If OFLAG includes O_CREAT, a - third argument is the file protection. */ -int -__openat (fd, file, oflag) - int fd; - const char *file; - int oflag; -{ - int mode; - - if (file == NULL) - { - __set_errno (EINVAL); - return -1; - } - - if (fd != AT_FDCWD && file[0] != '/') - { - /* Check FD is associated with a directory. */ - struct stat64 st; - if (__fxstat64 (_STAT_VER, fd, &st) != 0) - return -1; - - if (!S_ISDIR (st.st_mode)) - { - __set_errno (ENOTDIR); - return -1; - } - } - - if (oflag & O_CREAT) - { - va_list arg; - va_start (arg, oflag); - mode = va_arg (arg, int); - va_end (arg); - } - - __set_errno (ENOSYS); - return -1; -} -libc_hidden_def (__openat) -weak_alias (__openat, openat) -stub_warning (openat) - -#include <stub-tag.h> diff --git a/io/openat64.c b/io/openat64.c deleted file mode 100644 index 830701a949..0000000000 --- a/io/openat64.c +++ /dev/null @@ -1,71 +0,0 @@ -/* 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 <fcntl.h> -#include <stdarg.h> -#include <stddef.h> -#include <sys/stat.h> - -/* Open FILE with access OFLAG. Interpret relative paths relative to - the directory associated with FD. If OFLAG includes O_CREAT, a - third argument is the file protection. */ -int -__openat64 (fd, file, oflag) - int fd; - const char *file; - int oflag; -{ - int mode; - - if (file == NULL) - { - __set_errno (EINVAL); - return -1; - } - - if (fd != AT_FDCWD && file[0] != '/') - { - /* Check FD is associated with a directory. */ - struct stat64 st; - if (__fxstat64 (_STAT_VER, fd, &st) != 0) - return -1; - - if (!S_ISDIR (st.st_mode)) - { - __set_errno (ENOTDIR); - return -1; - } - } - - if (oflag & O_CREAT) - { - va_list arg; - va_start (arg, oflag); - mode = va_arg (arg, int); - va_end (arg); - } - - __set_errno (ENOSYS); - return -1; -} -libc_hidden_def (__openat64) -weak_alias (__openat64, openat64) -stub_warning (openat64) - -#include <stub-tag.h> diff --git a/io/pipe.c b/io/pipe.c deleted file mode 100644 index babaf9c24b..0000000000 --- a/io/pipe.c +++ /dev/null @@ -1,44 +0,0 @@ -/* Copyright (C) 1991, 1995, 1996, 2002 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 <unistd.h> -#include <stddef.h> - -/* Create a one-way communication channel (__pipe). - If successful, two file descriptors are stored in PIPEDES; - bytes written on PIPEDES[1] can be read from PIPEDES[0]. - Returns 0 if successful, -1 if not. */ -int -__pipe (__pipedes) - int __pipedes[2]; -{ - if (__pipedes == NULL) - { - __set_errno (EINVAL); - return -1; - } - - __set_errno (ENOSYS); - return -1; -} -libc_hidden_def (__pipe) -stub_warning (pipe) - -weak_alias (__pipe, pipe) -#include <stub-tag.h> diff --git a/io/poll.c b/io/poll.c deleted file mode 100644 index 9f2f191764..0000000000 --- a/io/poll.c +++ /dev/null @@ -1,39 +0,0 @@ -/* Copyright (C) 1994, 1995, 1996, 1997, 2001 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/poll.h> -#include <errno.h> - -/* Poll the file descriptors described by the NFDS structures starting at - FDS. If TIMEOUT is nonzero and not -1, allow TIMEOUT milliseconds for - an event to occur; if TIMEOUT is -1, block until an event occurs. - Returns the number of file descriptors with events, zero if timed out, - or -1 for errors. */ - -int -poll (fds, nfds, timeout) - struct pollfd *fds; - nfds_t nfds; - int timeout; -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (poll) -#include <stub-tag.h> diff --git a/io/posix_fadvise.c b/io/posix_fadvise.c deleted file mode 100644 index 92f8bb8974..0000000000 --- a/io/posix_fadvise.c +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright (C) 2000, 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 - 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 <fcntl.h> - -/* Advice the system about the expected behaviour of the application with - respect to the file associated with FD. */ - -int -posix_fadvise (int fd, __off_t offset, __off_t len, int advise) -{ - return ENOSYS; -} -stub_warning (posix_fadvise) -#include <stub-tag.h> diff --git a/io/posix_fadvise64.c b/io/posix_fadvise64.c deleted file mode 100644 index e7eae5e6e3..0000000000 --- a/io/posix_fadvise64.c +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright (C) 2000, 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 - 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 <fcntl.h> - -/* Advice the system about the expected behaviour of the application with - respect to the file associated with FD. */ - -int -posix_fadvise64 (int fd, __off64_t offset, __off64_t len, int advise) -{ - return ENOSYS; -} -stub_warning (posix_fadvise64) -#include <stub-tag.h> diff --git a/io/posix_fallocate.c b/io/posix_fallocate.c deleted file mode 100644 index 218b4adbe3..0000000000 --- a/io/posix_fallocate.c +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright (C) 2000, 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 - 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 <fcntl.h> - -/* Reserve storage for the data of the file associated with FD. */ - -int -posix_fallocate (int fd, __off_t offset, __off_t len) -{ - __set_errno (ENOSYS); - return -1; -} -stub_warning (posix_fallocate) -#include <stub-tag.h> diff --git a/io/posix_fallocate64.c b/io/posix_fallocate64.c deleted file mode 100644 index 80c1cd385d..0000000000 --- a/io/posix_fallocate64.c +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright (C) 2000, 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 - 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 <fcntl.h> - -/* Reserve storage for the data of the file associated with FD. */ - -int -posix_fallocate64 (int fd, __off64_t offset, __off64_t len) -{ - __set_errno (ENOSYS); - return -1; -} -stub_warning (posix_fallocate64) -#include <stub-tag.h> diff --git a/io/ppoll.c b/io/ppoll.c deleted file mode 100644 index a035cfeb1f..0000000000 --- a/io/ppoll.c +++ /dev/null @@ -1,76 +0,0 @@ -/* Copyright (C) 2006 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@redhat.com>, 2006. - - 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 <limits.h> -#include <signal.h> -#include <stddef.h> /* For NULL. */ -#include <sys/poll.h> -#include <sysdep-cancel.h> - - -int -ppoll (struct pollfd *fds, nfds_t nfds, const struct timespec *timeout, - const sigset_t *sigmask) -{ - int tval = -1; - - /* poll uses a simple millisecond value. Convert it. */ - if (timeout != NULL) - { - if (timeout->tv_sec < 0 - || timeout->tv_nsec < 0 || timeout->tv_nsec >= 1000000000) - { - __set_errno (EINVAL); - return -1; - } - - if (timeout->tv_sec > INT_MAX / 1000 - || (timeout->tv_sec == INT_MAX / 1000 - && ((timeout->tv_nsec + 999999) / 1000000 > INT_MAX % 1000))) - /* We cannot represent the timeout in an int value. Wait - forever. */ - tval = -1; - else - tval = (timeout->tv_sec * 1000 - + (timeout->tv_nsec + 999999) / 1000000); - } - - /* The setting and restoring of the signal mask and the select call - should be an atomic operation. This can't be done without kernel - help. */ - sigset_t savemask; - if (sigmask != NULL) - __sigprocmask (SIG_SETMASK, sigmask, &savemask); - - /* Note the ppoll() is a cancellation point. But since we call - poll() which itself is a cancellation point we do not have - to do anything here. */ - int retval = __poll (fds, nfds, tval); - - if (sigmask != NULL) - __sigprocmask (SIG_SETMASK, &savemask, NULL); - - return retval; -} - -#ifndef ppoll -/* __poll handles cancellation. */ -LIBC_CANCEL_HANDLED (); -#endif diff --git a/io/read.c b/io/read.c deleted file mode 100644 index 3943edd689..0000000000 --- a/io/read.c +++ /dev/null @@ -1,49 +0,0 @@ -/* Copyright (C) 1991, 1995, 1996, 1997, 2002 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 <unistd.h> -#include <stddef.h> - -/* Read NBYTES into BUF from FD. Return the number read or -1. */ -ssize_t -__libc_read (int fd, void *buf, size_t nbytes) -{ - if (nbytes == 0) - return 0; - if (fd < 0) - { - __set_errno (EBADF); - return -1; - } - if (buf == NULL) - { - __set_errno (EINVAL); - return -1; - } - - __set_errno (ENOSYS); - return -1; -} -libc_hidden_def (__libc_read) -stub_warning (read) - -weak_alias (__libc_read, __read) -libc_hidden_weak (__read) -weak_alias (__libc_read, read) -#include <stub-tag.h> diff --git a/io/readlink.c b/io/readlink.c deleted file mode 100644 index b69d08695c..0000000000 --- a/io/readlink.c +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright (C) 1991, 1995, 1996, 1997, 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 <unistd.h> - -/* Read the contents of the symbolic link PATH into no more than - LEN bytes of BUF. The contents are not null-terminated. - Returns the number of characters read, or -1 for errors. */ -ssize_t -__readlink (path, buf, len) - const char *path; - char *buf; - size_t len; -{ - __set_errno (ENOSYS); - return -1; -} -stub_warning (readlink) - -weak_alias (__readlink, readlink) -#include <stub-tag.h> diff --git a/io/readlinkat.c b/io/readlinkat.c deleted file mode 100644 index 7e6a2227d8..0000000000 --- a/io/readlinkat.c +++ /dev/null @@ -1,51 +0,0 @@ -/* 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 <fcntl.h> -#include <unistd.h> - -/* Read the contents of the symbolic link PATH relative to FD into no - more than LEN bytes of BUF. The contents are not null-terminated. - Returns the number of characters read, or -1 for errors. */ -ssize_t -readlinkat (fd, path, buf, len) - int fd; - const char *path; - char *buf; - size_t len; -{ - if (path == NULL) - { - __set_errno (EINVAL); - return -1; - } - - if (fd != AT_FDCWD && fd < 0 && *path != '/') - { - __set_errno (EBADF); - return -1; - } - - __set_errno (ENOSYS); - return -1; -} -stub_warning (readlinkat) -libc_hidden_def (readlinkat) - -#include <stub-tag.h> diff --git a/io/rmdir.c b/io/rmdir.c deleted file mode 100644 index 5a16fd4284..0000000000 --- a/io/rmdir.c +++ /dev/null @@ -1,41 +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 <unistd.h> - - -/* Remove the directory PATH. */ -int -__rmdir (path) - const char *path; -{ - if (path == NULL) - { - __set_errno (EINVAL); - return -1; - } - - __set_errno (ENOSYS); - return -1; -} -stub_warning (rmdir) - -weak_alias (__rmdir, rmdir) -#include <stub-tag.h> diff --git a/io/sendfile.c b/io/sendfile.c deleted file mode 100644 index 98dc9a814d..0000000000 --- a/io/sendfile.c +++ /dev/null @@ -1,33 +0,0 @@ -/* sendfile -- copy data directly from one file descriptor to another - Copyright (C) 2002 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/sendfile.h> -#include <errno.h> - -/* Send COUNT bytes from file associated with IN_FD starting at OFFSET to - descriptor OUT_FD. */ -ssize_t -sendfile (int out_fd, int in_fd, off_t *offset, size_t count) -{ - __set_errno (ENOSYS); - return -1; -} -stub_warning (sendfile) - -#include <stub-tag.h> diff --git a/io/sendfile64.c b/io/sendfile64.c deleted file mode 100644 index 76b961e22a..0000000000 --- a/io/sendfile64.c +++ /dev/null @@ -1,33 +0,0 @@ -/* sendfile -- copy data directly from one file descriptor to another - Copyright (C) 2002 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/sendfile.h> -#include <errno.h> - -/* Send COUNT bytes from file associated with IN_FD starting at OFFSET to - descriptor OUT_FD. */ -ssize_t -sendfile64 (int out_fd, int in_fd, off64_t *offset, size_t count) -{ - __set_errno (ENOSYS); - return -1; -} -stub_warning (sendfile64) - -#include <stub-tag.h> diff --git a/io/statfs.c b/io/statfs.c deleted file mode 100644 index af4a9ea4e5..0000000000 --- a/io/statfs.c +++ /dev/null @@ -1,35 +0,0 @@ -/* statfs -- Return information about the filesystem on which FILE resides. - Copyright (C) 1996, 1997, 2002 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/statfs.h> -#include <stddef.h> - -/* Return information about the filesystem on which FILE resides. */ -int -__statfs (const char *file, struct statfs *buf) -{ - __set_errno (ENOSYS); - return -1; -} -libc_hidden_def (__statfs) -weak_alias (__statfs, statfs) - -stub_warning (statfs) -#include <stub-tag.h> diff --git a/io/statfs64.c b/io/statfs64.c deleted file mode 100644 index cf1a7d82a4..0000000000 --- a/io/statfs64.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright (C) 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 <errno.h> -#include <sys/statfs.h> - -/* Return information about the filesystem on which FILE resides. */ -int -__statfs64 (const char *file, struct statfs64 *buf) -{ - __set_errno (ENOSYS); - return -1; -} -weak_alias (__statfs64, statfs64) - -stub_warning (statfs64) -#include <stub-tag.h> diff --git a/io/statvfs.c b/io/statvfs.c deleted file mode 100644 index 22e24cfeeb..0000000000 --- a/io/statvfs.c +++ /dev/null @@ -1,34 +0,0 @@ -/* Return information about the filesystem on which FILE resides. - Copyright (C) 1998, 2002 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/statvfs.h> -#include <stddef.h> - -/* Return information about the filesystem on which FILE resides. */ -int -__statvfs (const char *file, struct statvfs *buf) -{ - __set_errno (ENOSYS); - return -1; -} -weak_alias (__statvfs, statvfs) -libc_hidden_weak (statvfs) -stub_warning (statvfs) -#include <stub-tag.h> diff --git a/io/statvfs64.c b/io/statvfs64.c deleted file mode 100644 index 4424abdbea..0000000000 --- a/io/statvfs64.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright (C) 1998, 2001 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/statvfs.h> - -/* Return information about the filesystem on which FILE resides. */ -int -__statvfs64 (const char *file, struct statvfs64 *buf) -{ - __set_errno (ENOSYS); - return -1; -} -weak_alias (__statvfs64, statvfs64) - -stub_warning (statvfs64) -#include <stub-tag.h> diff --git a/io/symlink.c b/io/symlink.c deleted file mode 100644 index e6c6709f1a..0000000000 --- a/io/symlink.c +++ /dev/null @@ -1,42 +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 <unistd.h> - - -/* Make a link to FROM called TO. */ -int -__symlink (from, to) - const char *from; - const char *to; -{ - if (from == NULL || to == NULL) - { - __set_errno (EINVAL); - return -1; - } - - __set_errno (ENOSYS); - return -1; -} -stub_warning (symlink) - -weak_alias (__symlink, symlink) -#include <stub-tag.h> diff --git a/io/symlinkat.c b/io/symlinkat.c deleted file mode 100644 index 5c2f3f553a..0000000000 --- a/io/symlinkat.c +++ /dev/null @@ -1,49 +0,0 @@ -/* Copyright (C) 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 - 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 <fcntl.h> -#include <stddef.h> -#include <unistd.h> - - -/* Make a link to FROM called TO relative to FD. */ -int -symlinkat (from, fd, to) - const char *from; - int fd; - const char *to; -{ - if (from == NULL || to == NULL) - { - __set_errno (EINVAL); - return -1; - } - - if (fd != AT_FDCWD && fd < 0 && *to != '/') - { - __set_errno (EBADF); - return -1; - } - - __set_errno (ENOSYS); - return -1; -} -stub_warning (symlinkat) - -#include <stub-tag.h> diff --git a/io/sys/poll.h b/io/sys/poll.h index 4085b785ee..89a27eab2b 100644 --- a/io/sys/poll.h +++ b/io/sys/poll.h @@ -1,5 +1,5 @@ /* Compatibility definitions for System V `poll' interface. - Copyright (C) 1994,1996-2001,2004,2005,2006 Free Software Foundation, Inc. + Copyright (C) 1994,96,97,98,99,2000,2001,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 @@ -24,13 +24,6 @@ /* Get the platform dependent bits of `poll'. */ #include <bits/poll.h> -#ifdef __USE_GNU -/* Get the __sigset_t definition. */ -# include <bits/sigset.h> -/* Get the timespec definition. */ -# define __need_timespec -# include <time.h> -#endif /* Type used for the number of file descriptors. */ @@ -51,24 +44,9 @@ __BEGIN_DECLS FDS. If TIMEOUT is nonzero and not -1, allow TIMEOUT milliseconds for an event to occur; if TIMEOUT is -1, block until an event occurs. Returns the number of file descriptors with events, zero if timed out, - or -1 for errors. - - This function is a cancellation point and therefore not marked with - __THROW. */ + or -1 for errors. */ extern int poll (struct pollfd *__fds, nfds_t __nfds, int __timeout); -#ifdef __USE_GNU -/* Like poll, but before waiting the threads signal mask is replaced - with that specified in the fourth parameter. For better usability, - the timeout value is specified using a TIMESPEC object. - - This function is a cancellation point and therefore not marked with - __THROW. */ -extern int ppoll (struct pollfd *__fds, nfds_t __nfds, - __const struct timespec *__timeout, - __const __sigset_t *__ss); -#endif - __END_DECLS #endif /* sys/poll.h */ diff --git a/io/sys/sendfile.h b/io/sys/sendfile.h index 4c1367b6be..24256b5414 100644 --- a/io/sys/sendfile.h +++ b/io/sys/sendfile.h @@ -32,19 +32,19 @@ __BEGIN_DECLS case of error. */ #ifndef __USE_FILE_OFFSET64 extern ssize_t sendfile (int __out_fd, int __in_fd, off_t *__offset, - size_t __count) __THROW; + size_t __count) __THROW __nonnull ((3)); #else # ifdef __REDIRECT_NTH extern ssize_t __REDIRECT_NTH (sendfile, (int __out_fd, int __in_fd, __off64_t *__offset, - size_t __count), sendfile64); + size_t __count), sendfile64) __nonnull ((3)); # else # define sendfile sendfile64 # endif #endif #ifdef __USE_LARGEFILE64 extern ssize_t sendfile64 (int __out_fd, int __in_fd, __off64_t *__offset, - size_t __count) __THROW; + size_t __count) __THROW __nonnull ((3)); #endif __END_DECLS diff --git a/io/sys/stat.h b/io/sys/stat.h index 4cc0b429a2..7075003922 100644 --- a/io/sys/stat.h +++ b/io/sys/stat.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991,1992,1995-2004,2005,2006 Free Software Foundation, Inc. +/* Copyright (C) 1991,1992,1995-2002,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 @@ -228,30 +228,6 @@ extern int stat64 (__const char *__restrict __file, extern int fstat64 (int __fd, struct stat64 *__buf) __THROW __nonnull ((2)); #endif -#ifdef __USE_ATFILE -/* Similar to stat, get the attributes for FILE and put them in BUF. - Relative path names are interpreted relative to FD unless FD is - AT_FDCWD. */ -# ifndef __USE_FILE_OFFSET64 -extern int fstatat (int __fd, __const char *__restrict __file, - struct stat *__restrict __buf, int __flag) - __THROW __nonnull ((2, 3)); -# else -# ifdef __REDIRECT_NTH -extern int __REDIRECT_NTH (fstatat, (int __fd, __const char *__restrict __file, - struct stat *__restrict __buf, - int __flag), - fstatat64) __nonnull ((2, 3)); -# else -# define fstatat fstatat64 -# endif -# endif - -extern int fstatat64 (int __fd, __const char *__restrict __file, - struct stat64 *__restrict __buf, int __flag) - __THROW __nonnull ((2, 3)); -#endif - #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED # ifndef __USE_FILE_OFFSET64 /* Get file attributes about FILE and put them in BUF. @@ -293,14 +269,6 @@ extern int lchmod (__const char *__file, __mode_t __mode) extern int fchmod (int __fd, __mode_t __mode) __THROW; #endif -#ifdef __USE_ATFILE -/* Set file access permissions of FILE relative to - the directory FD is open on. */ -extern int fchmodat (int __fd, __const char *__file, __mode_t mode, int __flag) - __THROW __nonnull ((2)) __wur; -#endif /* Use ATFILE. */ - - /* Set the file creation mask of the current process to MASK, and return the old creation mask. */ @@ -316,14 +284,6 @@ extern __mode_t getumask (void) __THROW; extern int mkdir (__const char *__path, __mode_t __mode) __THROW __nonnull ((1)); -#ifdef __USE_ATFILE -/* Like mkdir, create a new directory with permission bits MODE. But - interpret relative PATH names relative to the directory associated - with FD. */ -extern int mkdirat (int __fd, __const char *__path, __mode_t __mode) - __THROW __nonnull ((2)); -#endif - /* Create a device file named PATH, with permission and special bits MODE and device number DEV (which can be constructed from major and minor device numbers with the `makedev' macro above). */ @@ -332,26 +292,10 @@ extern int mknod (__const char *__path, __mode_t __mode, __dev_t __dev) __THROW __nonnull ((1)); #endif -#ifdef __USE_ATFILE -/* Like mknod, create a new device file with permission bits MODE and - device number DEV. But interpret relative PATH names relative to - the directory associated with FD. */ -extern int mknodat (int __fd, __const char *__path, __mode_t __mode, - __dev_t __dev) __THROW __nonnull ((2)); -#endif - /* Create a new FIFO named PATH, with permission bits MODE. */ extern int mkfifo (__const char *__path, __mode_t __mode) __THROW __nonnull ((1)); - -#ifdef __USE_ATFILE -/* Like mkfifo, create a new FIFO with permission bits MODE. But - interpret relative PATH names relative to the directory associated - with FD. */ -extern int mkfifoat (int __fd, __const char *__path, __mode_t __mode) - __THROW __nonnull ((2)); -#endif /* To allow the `struct stat' structure and the file type `mode_t' bits to vary without changing shared library major version number, @@ -383,9 +327,6 @@ extern int __xstat (int __ver, __const char *__filename, struct stat *__stat_buf) __THROW __nonnull ((2, 3)); extern int __lxstat (int __ver, __const char *__filename, struct stat *__stat_buf) __THROW __nonnull ((2, 3)); -extern int __fxstatat (int __ver, int __fildes, __const char *__filename, - struct stat *__stat_buf, int __flag) - __THROW __nonnull ((3, 4)); #else # ifdef __REDIRECT_NTH extern int __REDIRECT_NTH (__fxstat, (int __ver, int __fildes, @@ -397,10 +338,6 @@ extern int __REDIRECT_NTH (__xstat, (int __ver, __const char *__filename, extern int __REDIRECT_NTH (__lxstat, (int __ver, __const char *__filename, struct stat *__stat_buf), __lxstat64) __nonnull ((2, 3)); -extern int __REDIRECT_NTH (__fxstatat, (int __ver, int __fildes, - __const char *__filename, - struct stat *__stat_buf, int __flag), - __fxstatat64) __nonnull ((3, 4)); # else # define __fxstat __fxstat64 @@ -416,17 +353,10 @@ extern int __xstat64 (int __ver, __const char *__filename, struct stat64 *__stat_buf) __THROW __nonnull ((2, 3)); extern int __lxstat64 (int __ver, __const char *__filename, struct stat64 *__stat_buf) __THROW __nonnull ((2, 3)); -extern int __fxstatat64 (int __ver, int __fildes, __const char *__filename, - struct stat64 *__stat_buf, int __flag) - __THROW __nonnull ((3, 4)); #endif extern int __xmknod (int __ver, __const char *__path, __mode_t __mode, __dev_t *__dev) __THROW __nonnull ((2, 4)); -extern int __xmknodat (int __ver, int __fd, __const char *__path, - __mode_t __mode, __dev_t *__dev) - __THROW __nonnull ((3, 5)); - #if defined __GNUC__ && __GNUC__ >= 2 /* Inlined versions of the real stat and mknod functions. */ @@ -450,15 +380,6 @@ __NTH (fstat (int __fd, struct stat *__statbuf)) return __fxstat (_STAT_VER, __fd, __statbuf); } -# ifdef __USE_ATFILE -extern __inline__ int -__NTH (fstatat (int __fd, __const char *__filename, struct stat *__statbuf, - int __flag)) -{ - return __fxstatat (_STAT_VER, __fd, __filename, __statbuf, __flag); -} -# endif - # if defined __USE_MISC || defined __USE_BSD extern __inline__ int __NTH (mknod (__const char *__path, __mode_t __mode, __dev_t __dev)) @@ -467,15 +388,6 @@ __NTH (mknod (__const char *__path, __mode_t __mode, __dev_t __dev)) } # endif -# ifdef __USE_ATFILE -extern __inline__ int -__NTH (mknodat (int __fd, __const char *__path, __mode_t __mode, - __dev_t __dev)) -{ - return __xmknodat (_MKNOD_VER, __fd, __path, __mode, &__dev); -} -# endif - # if defined __USE_LARGEFILE64 \ && (! defined __USE_FILE_OFFSET64 \ || (defined __REDIRECT_NTH && defined __OPTIMIZE__)) @@ -498,16 +410,6 @@ __NTH (fstat64 (int __fd, struct stat64 *__statbuf)) { return __fxstat64 (_STAT_VER, __fd, __statbuf); } - -# ifdef __USE_GNU -extern __inline__ int -__NTH (fstatat64 (int __fd, __const char *__filename, struct stat64 *__statbuf, - int __flag)) -{ - return __fxstatat64 (_STAT_VER, __fd, __filename, __statbuf, __flag); -} -# endif - # endif #endif diff --git a/io/test-lfs.c b/io/test-lfs.c index c27af408eb..a4669c3984 100644 --- a/io/test-lfs.c +++ b/io/test-lfs.c @@ -50,7 +50,7 @@ int fd; void do_prepare (int argc, char *argv[]) { - size_t name_len; + char name_len; struct rlimit64 rlim; name_len = strlen (test_dir); diff --git a/io/tst-faccessat.c b/io/tst-faccessat.c deleted file mode 100644 index 48532070a7..0000000000 --- a/io/tst-faccessat.c +++ /dev/null @@ -1,212 +0,0 @@ -/* Test for faccessat function. */ - -#include <dirent.h> -#include <fcntl.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> - - -static void prepare (void); -#define PREPARE(argc, argv) prepare () - -static int do_test (void); -#define TEST_FUNCTION do_test () - -#include "../test-skeleton.c" - -static int dir_fd; - -static void -prepare (void) -{ - size_t test_dir_len = strlen (test_dir); - static const char dir_name[] = "/tst-faccessat.XXXXXX"; - - size_t dirbuflen = test_dir_len + sizeof (dir_name); - char *dirbuf = malloc (dirbuflen); - if (dirbuf == NULL) - { - puts ("out of memory"); - exit (1); - } - - snprintf (dirbuf, dirbuflen, "%s%s", test_dir, dir_name); - if (mkdtemp (dirbuf) == NULL) - { - puts ("cannot create temporary directory"); - exit (1); - } - - add_temp_file (dirbuf); - - dir_fd = open (dirbuf, O_RDONLY | O_DIRECTORY); - if (dir_fd == -1) - { - puts ("cannot open directory"); - exit (1); - } -} - - -static int -do_test (void) -{ - /* fdopendir takes over the descriptor, make a copy. */ - int dupfd = dup (dir_fd); - if (dupfd == -1) - { - puts ("dup failed"); - return 1; - } - if (lseek (dupfd, 0, SEEK_SET) != 0) - { - puts ("1st lseek failed"); - return 1; - } - - /* The directory should be empty save the . and .. files. */ - DIR *dir = fdopendir (dupfd); - if (dir == NULL) - { - puts ("fdopendir failed"); - return 1; - } - struct dirent64 *d; - while ((d = readdir64 (dir)) != NULL) - if (strcmp (d->d_name, ".") != 0 && strcmp (d->d_name, "..") != 0) - { - printf ("temp directory contains file \"%s\"\n", d->d_name); - return 1; - } - closedir (dir); - - /* Try to create a file. */ - int fd = openat (dir_fd, "some-file", O_CREAT|O_RDWR|O_EXCL, 0666); - if (fd == -1) - { - if (errno == ENOSYS) - { - puts ("*at functions not supported"); - return 0; - } - - puts ("file creation failed"); - return 1; - } - write (fd, "hello", 5); - puts ("file created"); - - /* Before closing the file, try using this file descriptor to open - another file. This must fail. */ - if (faccessat (fd, "should-not-work", F_OK, AT_EACCESS) != -1) - { - puts ("faccessat using descriptor for normal file worked"); - return 1; - } - if (errno != ENOTDIR) - { - puts ("\ -error for faccessat using descriptor for normal file not ENOTDIR "); - return 1; - } - - close (fd); - - int result = 0; - - if (faccessat (dir_fd, "some-file", F_OK, AT_EACCESS)) - { - printf ("faccessat F_OK: %m\n"); - result = 1; - } - if (faccessat (dir_fd, "some-file", W_OK, AT_EACCESS)) - { - printf ("faccessat W_OK: %m\n"); - result = 1; - } - - errno = 0; - if (faccessat (dir_fd, "some-file", X_OK, AT_EACCESS) == 0 - || errno != EACCES) - { - printf ("faccessat X_OK on nonexecutable: %m\n"); - result = 1; - } - - if (fchmodat (dir_fd, "some-file", 0400, 0) != 0) - { - printf ("fchownat failed: %m\n"); - return 1; - } - - if (faccessat (dir_fd, "some-file", R_OK, AT_EACCESS)) - { - printf ("faccessat R_OK: %m\n"); - result = 1; - } - - errno = 0; - if (faccessat (dir_fd, "some-file", W_OK, AT_EACCESS) == 0 - ? (geteuid () != 0) : (errno != EACCES)) - { - printf ("faccessat W_OK on unwritable file: %m\n"); - result = 1; - } - - /* Create a file descriptor which is closed again right away. */ - int dir_fd2 = dup (dir_fd); - if (dir_fd2 == -1) - { - puts ("dup failed"); - return 1; - } - close (dir_fd2); - - /* With the file descriptor closed the next call must fail. */ - if (faccessat (dir_fd2, "some-file", F_OK, AT_EACCESS) != -1) - { - puts ("faccessat using closed descriptor succeeded"); - return 1; - } - if (errno != EBADF) - { - puts ("faccessat using closed descriptor did not set EBADF"); - return 1; - } - - /* Same with a non-existing file. */ - if (faccessat (dir_fd2, "non-existing-file", F_OK, AT_EACCESS) != -1) - { - puts ("2nd faccessat using closed descriptor succeeded"); - return 1; - } - if (errno != EBADF) - { - puts ("2nd faccessat using closed descriptor did not set EBADF"); - return 1; - } - - if (unlinkat (dir_fd, "some-file", 0) != 0) - { - puts ("unlinkat failed"); - result = 1; - } - - close (dir_fd); - - fd = faccessat (-1, "some-file", F_OK, AT_EACCESS); - if (fd != -1) - { - puts ("faccessat using -1 descriptor succeeded"); - return 1; - } - if (errno != EBADF) - { - puts ("faccessat using -1 descriptor did not set EBADF"); - return 1; - } - - return result; -} diff --git a/io/tst-fchmodat.c b/io/tst-fchmodat.c deleted file mode 100644 index bfb75d62e5..0000000000 --- a/io/tst-fchmodat.c +++ /dev/null @@ -1,191 +0,0 @@ -/* Test for fchmodat function. */ - -#include <dirent.h> -#include <fcntl.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> - - -static void prepare (void); -#define PREPARE(argc, argv) prepare () - -static int do_test (void); -#define TEST_FUNCTION do_test () - -#include "../test-skeleton.c" - -static int dir_fd; - -static void -prepare (void) -{ - size_t test_dir_len = strlen (test_dir); - static const char dir_name[] = "/tst-fchmodat.XXXXXX"; - - size_t dirbuflen = test_dir_len + sizeof (dir_name); - char *dirbuf = malloc (dirbuflen); - if (dirbuf == NULL) - { - puts ("out of memory"); - exit (1); - } - - snprintf (dirbuf, dirbuflen, "%s%s", test_dir, dir_name); - if (mkdtemp (dirbuf) == NULL) - { - puts ("cannot create temporary directory"); - exit (1); - } - - add_temp_file (dirbuf); - - dir_fd = open (dirbuf, O_RDONLY | O_DIRECTORY); - if (dir_fd == -1) - { - puts ("cannot open directory"); - exit (1); - } -} - - -static int -do_test (void) -{ - /* fdopendir takes over the descriptor, make a copy. */ - int dupfd = dup (dir_fd); - if (dupfd == -1) - { - puts ("dup failed"); - return 1; - } - if (lseek (dupfd, 0, SEEK_SET) != 0) - { - puts ("1st lseek failed"); - return 1; - } - - /* The directory should be empty save the . and .. files. */ - DIR *dir = fdopendir (dupfd); - if (dir == NULL) - { - puts ("fdopendir failed"); - return 1; - } - struct dirent64 *d; - while ((d = readdir64 (dir)) != NULL) - if (strcmp (d->d_name, ".") != 0 && strcmp (d->d_name, "..") != 0) - { - printf ("temp directory contains file \"%s\"\n", d->d_name); - return 1; - } - closedir (dir); - - umask (022); - - /* Try to create a file. */ - int fd = openat (dir_fd, "some-file", O_CREAT|O_RDWR|O_EXCL, 0666); - if (fd == -1) - { - if (errno == ENOSYS) - { - puts ("*at functions not supported"); - return 0; - } - - puts ("file creation failed"); - return 1; - } - write (fd, "hello", 5); - puts ("file created"); - - struct stat64 st1; - if (fstat64 (fd, &st1) != 0) - { - puts ("fstat64 failed"); - return 1; - } - - /* Before closing the file, try using this file descriptor to open - another file. This must fail. */ - if (fchmodat (fd, "some-file", 0400, 0) != -1) - { - puts ("fchmodat using descriptor for normal file worked"); - return 1; - } - if (errno != ENOTDIR) - { - puts ("\ -error for fchmodat using descriptor for normal file not ENOTDIR "); - return 1; - } - - close (fd); - - if ((st1.st_mode & 0777) != 0644) - { - printf ("openat created mode %04o, not 0644\n", (st1.st_mode & 0777)); - return 1; - } - - if (fchmodat (dir_fd, "some-file", 0400, 0) != 0) - { - puts ("fchownat failed"); - return 1; - } - - struct stat64 st2; - if (fstatat64 (dir_fd, "some-file", &st2, 0) != 0) - { - puts ("fstatat64 failed"); - return 1; - } - - if ((st2.st_mode & 0777) != 0400) - { - puts ("mode change failed"); - return 1; - } - - if (unlinkat (dir_fd, "some-file", 0) != 0) - { - puts ("unlinkat failed"); - return 1; - } - - /* Create a file descriptor which is closed again right away. */ - int dir_fd2 = dup (dir_fd); - if (dir_fd2 == -1) - { - puts ("dup failed"); - return 1; - } - close (dir_fd2); - - if (fchmodat (dir_fd2, "some-file", 0400, 0) != -1) - { - puts ("fchmodat using closed descriptor worked"); - return 1; - } - if (errno != EBADF) - { - puts ("error for fchmodat using closed descriptor not EBADF "); - return 1; - } - - close (dir_fd); - - if (fchmodat (-1, "some-file", 0400, 0) != -1) - { - puts ("fchmodat using invalid descriptor worked"); - return 1; - } - if (errno != EBADF) - { - puts ("error for fchmodat using invalid descriptor not EBADF "); - return 1; - } - - return 0; -} diff --git a/io/tst-fchownat.c b/io/tst-fchownat.c deleted file mode 100644 index fd32ac9e6b..0000000000 --- a/io/tst-fchownat.c +++ /dev/null @@ -1,190 +0,0 @@ -#include <dirent.h> -#include <fcntl.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> - - -static void prepare (void); -#define PREPARE(argc, argv) prepare () - -static int do_test (void); -#define TEST_FUNCTION do_test () - -#include "../test-skeleton.c" - -static int dir_fd; - -static void -prepare (void) -{ -#if _POSIX_CHOWN_RESTRICTED > 0 - uid_t uid = getuid (); - if (uid != 0) - { - puts ("need root privileges"); - exit (0); - } -#endif - - size_t test_dir_len = strlen (test_dir); - static const char dir_name[] = "/tst-fchownat.XXXXXX"; - - size_t dirbuflen = test_dir_len + sizeof (dir_name); - char *dirbuf = malloc (dirbuflen); - if (dirbuf == NULL) - { - puts ("out of memory"); - exit (1); - } - - snprintf (dirbuf, dirbuflen, "%s%s", test_dir, dir_name); - if (mkdtemp (dirbuf) == NULL) - { - puts ("cannot create temporary directory"); - exit (1); - } - - add_temp_file (dirbuf); - - dir_fd = open (dirbuf, O_RDONLY | O_DIRECTORY); - if (dir_fd == -1) - { - puts ("cannot open directory"); - exit (1); - } -} - - -static int -do_test (void) -{ - /* fdopendir takes over the descriptor, make a copy. */ - int dupfd = dup (dir_fd); - if (dupfd == -1) - { - puts ("dup failed"); - return 1; - } - if (lseek (dupfd, 0, SEEK_SET) != 0) - { - puts ("1st lseek failed"); - return 1; - } - - /* The directory should be empty safe the . and .. files. */ - DIR *dir = fdopendir (dupfd); - if (dir == NULL) - { - puts ("fdopendir failed"); - return 1; - } - struct dirent64 *d; - while ((d = readdir64 (dir)) != NULL) - if (strcmp (d->d_name, ".") != 0 && strcmp (d->d_name, "..") != 0) - { - printf ("temp directory contains file \"%s\"\n", d->d_name); - return 1; - } - closedir (dir); - - /* Try to create a file. */ - int fd = openat (dir_fd, "some-file", O_CREAT|O_RDWR|O_EXCL, 0666); - if (fd == -1) - { - if (errno == ENOSYS) - { - puts ("*at functions not supported"); - return 0; - } - - puts ("file creation failed"); - return 1; - } - write (fd, "hello", 5); - puts ("file created"); - - struct stat64 st1; - if (fstat64 (fd, &st1) != 0) - { - puts ("fstat64 failed"); - return 1; - } - - /* Before closing the file, try using this file descriptor to open - another file. This must fail. */ - if (fchownat (fd, "some-file", 1, 1, 0) != -1) - { - puts ("fchownat using descriptor for normal file worked"); - return 1; - } - if (errno != ENOTDIR) - { - puts ("\ -error for fchownat using descriptor for normal file not ENOTDIR "); - return 1; - } - - close (fd); - - if (fchownat (dir_fd, "some-file", st1.st_uid + 1, st1.st_gid + 1, 0) != 0) - { - puts ("fchownat failed"); - return 1; - } - - struct stat64 st2; - if (fstatat64 (dir_fd, "some-file", &st2, 0) != 0) - { - puts ("fstatat64 failed"); - return 1; - } - - if (st1.st_uid + 1 != st2.st_uid || st1.st_gid + 1 != st2.st_gid) - { - puts ("owner change failed"); - return 1; - } - - if (unlinkat (dir_fd, "some-file", 0) != 0) - { - puts ("unlinkat failed"); - return 1; - } - - /* Create a file descriptor which is closed again right away. */ - int dir_fd2 = dup (dir_fd); - if (dir_fd2 == -1) - { - puts ("dup failed"); - return 1; - } - close (dir_fd2); - - if (fchownat (dir_fd2, "some-file", 1, 1, 0) != -1) - { - puts ("fchownat using closed descriptor worked"); - return 1; - } - if (errno != EBADF) - { - puts ("error for fchownat using closed descriptor not EBADF "); - return 1; - } - - close (dir_fd); - - if (fchownat (-1, "some-file", 1, 1, 0) != -1) - { - puts ("fchownat using invalid descriptor worked"); - return 1; - } - if (errno != EBADF) - { - puts ("error for fchownat using invalid descriptor not EBADF "); - return 1; - } - - return 0; -} diff --git a/io/tst-fcntl.c b/io/tst-fcntl.c index 93ea9b0b02..fed884913c 100644 --- a/io/tst-fcntl.c +++ b/io/tst-fcntl.c @@ -42,7 +42,7 @@ static char *name; void do_prepare (int argc, char *argv[]) { - size_t name_len; + char name_len; name_len = strlen (test_dir); name = malloc (name_len + sizeof ("/fcntlXXXXXX")); diff --git a/io/tst-fstatat.c b/io/tst-fstatat.c deleted file mode 100644 index 5493102167..0000000000 --- a/io/tst-fstatat.c +++ /dev/null @@ -1,188 +0,0 @@ -#include <dirent.h> -#include <fcntl.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> - - -static void prepare (void); -#define PREPARE(argc, argv) prepare () - -static int do_test (void); -#define TEST_FUNCTION do_test () - -#include "../test-skeleton.c" - -static int dir_fd; - -static void -prepare (void) -{ - size_t test_dir_len = strlen (test_dir); - static const char dir_name[] = "/tst-fstatat.XXXXXX"; - - size_t dirbuflen = test_dir_len + sizeof (dir_name); - char *dirbuf = malloc (dirbuflen); - if (dirbuf == NULL) - { - puts ("out of memory"); - exit (1); - } - - snprintf (dirbuf, dirbuflen, "%s%s", test_dir, dir_name); - if (mkdtemp (dirbuf) == NULL) - { - puts ("cannot create temporary directory"); - exit (1); - } - - add_temp_file (dirbuf); - - dir_fd = open (dirbuf, O_RDONLY | O_DIRECTORY); - if (dir_fd == -1) - { - puts ("cannot open directory"); - exit (1); - } -} - - -static int -do_test (void) -{ - /* fdopendir takes over the descriptor, make a copy. */ - int dupfd = dup (dir_fd); - if (dupfd == -1) - { - puts ("dup failed"); - return 1; - } - if (lseek (dupfd, 0, SEEK_SET) != 0) - { - puts ("1st lseek failed"); - return 1; - } - - /* The directory should be empty safe the . and .. files. */ - DIR *dir = fdopendir (dupfd); - if (dir == NULL) - { - puts ("fdopendir failed"); - return 1; - } - struct dirent64 *d; - while ((d = readdir64 (dir)) != NULL) - if (strcmp (d->d_name, ".") != 0 && strcmp (d->d_name, "..") != 0) - { - printf ("temp directory contains file \"%s\"\n", d->d_name); - return 1; - } - closedir (dir); - - /* Try to create a file. */ - int fd = openat (dir_fd, "some-file", O_CREAT|O_RDWR|O_EXCL, 0666); - if (fd == -1) - { - if (errno == ENOSYS) - { - puts ("*at functions not supported"); - return 0; - } - - puts ("file creation failed"); - return 1; - } - write (fd, "hello", 5); - puts ("file created"); - - struct stat64 st1; - - /* Before closing the file, try using this file descriptor to open - another file. This must fail. */ - if (fstatat64 (fd, "some-file", &st1, 0) != -1) - { - puts ("fstatatat using descriptor for normal file worked"); - return 1; - } - if (errno != ENOTDIR) - { - puts ("error for fstatat using descriptor for normal file not ENOTDIR "); - return 1; - } - - if (fstat64 (fd, &st1) != 0) - { - puts ("fstat64 failed"); - return 1; - } - - close (fd); - - struct stat64 st2; - if (fstatat64 (dir_fd, "some-file", &st2, 0) != 0) - { - puts ("fstatat64 failed"); - return 1; - } - - if (st1.st_dev != st2.st_dev - || st1.st_ino != st2.st_ino - || st1.st_size != st2.st_size) - { - puts ("stat results do not match"); - return 1; - } - - if (unlinkat (dir_fd, "some-file", 0) != 0) - { - puts ("unlinkat failed"); - return 1; - } - - if (fstatat64 (dir_fd, "some-file", &st2, 0) == 0) - { - puts ("second fstatat64 succeeded"); - return 1; - } - if (errno != ENOENT) - { - puts ("second fstatat64 did not fail with ENOENT"); - return 1; - } - - /* Create a file descriptor which is closed again right away. */ - int dir_fd2 = dup (dir_fd); - if (dir_fd2 == -1) - { - puts ("dup failed"); - return 1; - } - close (dir_fd2); - - if (fstatat64 (dir_fd2, "some-file", &st1, 0) != -1) - { - puts ("fstatat64 using closed descriptor worked"); - return 1; - } - if (errno != EBADF) - { - puts ("error for fstatat using closed descriptor not EBADF "); - return 1; - } - - close (dir_fd); - - if (fstatat64 (-1, "some-file", &st1, 0) != -1) - { - puts ("fstatat64 using invalid descriptor worked"); - return 1; - } - if (errno != EBADF) - { - puts ("error for fstatat using invalid descriptor not EBADF "); - return 1; - } - - return 0; -} diff --git a/io/tst-futimesat.c b/io/tst-futimesat.c deleted file mode 100644 index c1e8d93f41..0000000000 --- a/io/tst-futimesat.c +++ /dev/null @@ -1,147 +0,0 @@ -#include <dirent.h> -#include <fcntl.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <sys/time.h> - - -static void prepare (void); -#define PREPARE(argc, argv) prepare () - -static int do_test (void); -#define TEST_FUNCTION do_test () - -#include "../test-skeleton.c" - -static int dir_fd; - -static void -prepare (void) -{ - size_t test_dir_len = strlen (test_dir); - static const char dir_name[] = "/tst-futimesat.XXXXXX"; - - size_t dirbuflen = test_dir_len + sizeof (dir_name); - char *dirbuf = malloc (dirbuflen); - if (dirbuf == NULL) - { - puts ("out of memory"); - exit (1); - } - - snprintf (dirbuf, dirbuflen, "%s%s", test_dir, dir_name); - if (mkdtemp (dirbuf) == NULL) - { - puts ("cannot create temporary directory"); - exit (1); - } - - add_temp_file (dirbuf); - - dir_fd = open (dirbuf, O_RDONLY | O_DIRECTORY); - if (dir_fd == -1) - { - puts ("cannot open directory"); - exit (1); - } -} - - -static int -do_test (void) -{ - /* fdopendir takes over the descriptor, make a copy. */ - int dupfd = dup (dir_fd); - if (dupfd == -1) - { - puts ("dup failed"); - return 1; - } - if (lseek (dupfd, 0, SEEK_SET) != 0) - { - puts ("1st lseek failed"); - return 1; - } - - /* The directory should be empty safe the . and .. files. */ - DIR *dir = fdopendir (dupfd); - if (dir == NULL) - { - puts ("fdopendir failed"); - return 1; - } - struct dirent64 *d; - while ((d = readdir64 (dir)) != NULL) - if (strcmp (d->d_name, ".") != 0 && strcmp (d->d_name, "..") != 0) - { - printf ("temp directory contains file \"%s\"\n", d->d_name); - return 1; - } - closedir (dir); - - /* Try to create a file. */ - int fd = openat (dir_fd, "some-file", O_CREAT|O_RDWR|O_EXCL, 0666); - if (fd == -1) - { - if (errno == ENOSYS) - { - puts ("*at functions not supported"); - return 0; - } - - puts ("file creation failed"); - return 1; - } - write (fd, "hello", 5); - puts ("file created"); - - struct stat64 st1; - if (fstat64 (fd, &st1) != 0) - { - puts ("fstat64 failed"); - return 1; - } - - close (fd); - - struct timeval tv[2]; - tv[0].tv_sec = st1.st_atime + 1; - tv[0].tv_usec = 0; - tv[1].tv_sec = st1.st_mtime + 1; - tv[1].tv_usec = 0; - if (futimesat (dir_fd, "some-file", tv) != 0) - { - puts ("futimesat failed"); - return 1; - } - - struct stat64 st2; - if (fstatat64 (dir_fd, "some-file", &st2, 0) != 0) - { - puts ("fstatat64 failed"); - return 1; - } - - if (st2.st_mtime != tv[1].tv_sec -#ifdef _STATBUF_ST_NSEC - || st2.st_mtim.tv_nsec != 0 -#endif - ) - { - puts ("stat shows different mtime"); - return 1; - } - - - if (unlinkat (dir_fd, "some-file", 0) != 0) - { - puts ("unlinkat failed"); - return 1; - } - - close (dir_fd); - - return 0; -} diff --git a/io/tst-linkat.c b/io/tst-linkat.c deleted file mode 100644 index d63c982751..0000000000 --- a/io/tst-linkat.c +++ /dev/null @@ -1,171 +0,0 @@ -#include <dirent.h> -#include <fcntl.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> - - -static void prepare (void); -#define PREPARE(argc, argv) prepare () - -static int do_test (void); -#define TEST_FUNCTION do_test () - -#include "../test-skeleton.c" - -static int dir_fd; - -static void -prepare (void) -{ - size_t test_dir_len = strlen (test_dir); - static const char dir_name[] = "/tst-linkat.XXXXXX"; - - size_t dirbuflen = test_dir_len + sizeof (dir_name); - char *dirbuf = malloc (dirbuflen); - if (dirbuf == NULL) - { - puts ("out of memory"); - exit (1); - } - - snprintf (dirbuf, dirbuflen, "%s%s", test_dir, dir_name); - if (mkdtemp (dirbuf) == NULL) - { - puts ("cannot create temporary directory"); - exit (1); - } - - add_temp_file (dirbuf); - - dir_fd = open (dirbuf, O_RDONLY | O_DIRECTORY); - if (dir_fd == -1) - { - puts ("cannot open directory"); - exit (1); - } -} - - -static int -do_test (void) -{ - /* fdopendir takes over the descriptor, make a copy. */ - int dupfd = dup (dir_fd); - if (dupfd == -1) - { - puts ("dup failed"); - return 1; - } - if (lseek (dupfd, 0, SEEK_SET) != 0) - { - puts ("1st lseek failed"); - return 1; - } - - /* The directory should be empty safe the . and .. files. */ - DIR *dir = fdopendir (dupfd); - if (dir == NULL) - { - puts ("fdopendir failed"); - return 1; - } - struct dirent64 *d; - while ((d = readdir64 (dir)) != NULL) - if (strcmp (d->d_name, ".") != 0 && strcmp (d->d_name, "..") != 0) - { - printf ("temp directory contains file \"%s\"\n", d->d_name); - return 1; - } - closedir (dir); - - /* Try to create a file. */ - int fd = openat (dir_fd, "some-file", O_CREAT|O_RDWR|O_EXCL, 0666); - if (fd == -1) - { - if (errno == ENOSYS) - { - puts ("*at functions not supported"); - return 0; - } - - puts ("file creation failed"); - return 1; - } - write (fd, "hello", 5); - puts ("file created"); - - struct stat64 st1; - if (fstat64 (fd, &st1) != 0) - { - puts ("fstat64 failed"); - return 1; - } - - close (fd); - - if (linkat (dir_fd, "some-file", dir_fd, "another-file", 0) != 0) - { - puts ("symlinkat failed"); - return 1; - } - - struct stat64 st2; - if (fstatat64 (dir_fd, "some-file", &st2, 0) != 0) - { - puts ("fstatat64 failed"); - return 1; - } - if (st1.st_dev != st2.st_dev || st1.st_ino != st2.st_ino) - { - puts ("file changed after symlinkat"); - return 1; - } - - if (fstatat64 (dir_fd, "another-file", &st2, AT_SYMLINK_NOFOLLOW) != 0) - { - puts ("2nd fstatat64 failed"); - return 1; - } - if (S_ISLNK (st2.st_mode)) - { - puts ("2nd fstatat64 shows file is a symlink"); - return 1; - } - if (st1.st_dev != st2.st_dev - || st1.st_ino != st2.st_ino - || st1.st_size != st2.st_size) - { - puts ("stat results for linked file do not match"); - return 1; - } - - if (fstatat64 (dir_fd, "another-file", &st2, 0) != 0) - { - puts ("3rd fstatat64 failed"); - return 1; - } - if (st1.st_dev != st2.st_dev - || st1.st_ino != st2.st_ino - || st1.st_size != st2.st_size) - { - puts ("stat results do not match"); - return 1; - } - - if (unlinkat (dir_fd, "another-file", 0) != 0) - { - puts ("unlinkat failed"); - return 1; - } - if (unlinkat (dir_fd, "some-file", 0) != 0) - { - puts ("2nd unlinkat failed"); - return 1; - } - - close (dir_fd); - - return 0; -} diff --git a/io/tst-mkdirat.c b/io/tst-mkdirat.c deleted file mode 100644 index 3efa4622ef..0000000000 --- a/io/tst-mkdirat.c +++ /dev/null @@ -1,162 +0,0 @@ -#include <dirent.h> -#include <fcntl.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> - - -static void prepare (void); -#define PREPARE(argc, argv) prepare () - -static int do_test (void); -#define TEST_FUNCTION do_test () - -#include "../test-skeleton.c" - -static int dir_fd; - -static void -prepare (void) -{ - size_t test_dir_len = strlen (test_dir); - static const char dir_name[] = "/tst-mkdirat.XXXXXX"; - - size_t dirbuflen = test_dir_len + sizeof (dir_name); - char *dirbuf = malloc (dirbuflen); - if (dirbuf == NULL) - { - puts ("out of memory"); - exit (1); - } - - snprintf (dirbuf, dirbuflen, "%s%s", test_dir, dir_name); - if (mkdtemp (dirbuf) == NULL) - { - puts ("cannot create temporary directory"); - exit (1); - } - - add_temp_file (dirbuf); - - dir_fd = open (dirbuf, O_RDONLY | O_DIRECTORY); - if (dir_fd == -1) - { - puts ("cannot open directory"); - exit (1); - } -} - - -static int -do_test (void) -{ - /* fdopendir takes over the descriptor, make a copy. */ - int dupfd = dup (dir_fd); - if (dupfd == -1) - { - puts ("dup failed"); - return 1; - } - if (lseek (dupfd, 0, SEEK_SET) != 0) - { - puts ("1st lseek failed"); - return 1; - } - - /* The directory should be empty safe the . and .. files. */ - DIR *dir = fdopendir (dupfd); - if (dir == NULL) - { - puts ("fdopendir failed"); - return 1; - } - struct dirent64 *d; - while ((d = readdir64 (dir)) != NULL) - if (strcmp (d->d_name, ".") != 0 && strcmp (d->d_name, "..") != 0) - { - printf ("temp directory contains file \"%s\"\n", d->d_name); - return 1; - } - closedir (dir); - - /* Create a new directory. */ - int e = mkdirat (dir_fd, "some-dir", 0777); - if (e == -1) - { - if (errno == ENOSYS) - { - puts ("*at functions not supported"); - return 0; - } - - puts ("directory creation failed"); - return 1; - } - - struct stat64 st1; - if (fstatat64 (dir_fd, "some-dir", &st1, 0) != 0) - { - puts ("fstat64 failed"); - return 1; - } - if (!S_ISDIR (st1.st_mode)) - { - puts ("mkdirat did not create a directory"); - return 1; - } - - dupfd = dup (dir_fd); - if (dupfd == -1) - { - puts ("dup failed"); - return 1; - } - if (lseek (dupfd, 0, SEEK_SET) != 0) - { - puts ("1st lseek failed"); - return 1; - } - - dir = fdopendir (dupfd); - if (dir == NULL) - { - puts ("2nd fdopendir failed"); - return 1; - } - bool has_some_dir = false; - while ((d = readdir64 (dir)) != NULL) - if (strcmp (d->d_name, "some-dir") == 0) - { - has_some_dir = true; -#ifdef _DIRENT_HAVE_D_TYPE - if (d->d_type != DT_UNKNOWN && d->d_type != DT_DIR) - { - puts ("d_type for some-dir wrong"); - return 1; - } -#endif - } - else if (strcmp (d->d_name, ".") != 0 && strcmp (d->d_name, "..") != 0) - { - printf ("temp directory contains file \"%s\"\n", d->d_name); - return 1; - } - closedir (dir); - - if (!has_some_dir) - { - puts ("some-dir not in directory list"); - return 1; - } - - if (unlinkat (dir_fd, "some-dir", AT_REMOVEDIR) != 0) - { - puts ("unlinkat failed"); - return 1; - } - - close (dir_fd); - - return 0; -} diff --git a/io/tst-mkfifoat.c b/io/tst-mkfifoat.c deleted file mode 100644 index 2bf29f63af..0000000000 --- a/io/tst-mkfifoat.c +++ /dev/null @@ -1,162 +0,0 @@ -#include <dirent.h> -#include <fcntl.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> - - -static void prepare (void); -#define PREPARE(argc, argv) prepare () - -static int do_test (void); -#define TEST_FUNCTION do_test () - -#include "../test-skeleton.c" - -static int dir_fd; - -static void -prepare (void) -{ - size_t test_dir_len = strlen (test_dir); - static const char dir_name[] = "/tst-mkfifoat.XXXXXX"; - - size_t dirbuflen = test_dir_len + sizeof (dir_name); - char *dirbuf = malloc (dirbuflen); - if (dirbuf == NULL) - { - puts ("out of memory"); - exit (1); - } - - snprintf (dirbuf, dirbuflen, "%s%s", test_dir, dir_name); - if (mkdtemp (dirbuf) == NULL) - { - puts ("cannot create temporary directory"); - exit (1); - } - - add_temp_file (dirbuf); - - dir_fd = open (dirbuf, O_RDONLY | O_DIRECTORY); - if (dir_fd == -1) - { - puts ("cannot open directory"); - exit (1); - } -} - - -static int -do_test (void) -{ - /* fdopendir takes over the descriptor, make a copy. */ - int dupfd = dup (dir_fd); - if (dupfd == -1) - { - puts ("dup failed"); - return 1; - } - if (lseek (dupfd, 0, SEEK_SET) != 0) - { - puts ("1st lseek failed"); - return 1; - } - - /* The directory should be empty safe the . and .. files. */ - DIR *dir = fdopendir (dupfd); - if (dir == NULL) - { - puts ("fdopendir failed"); - return 1; - } - struct dirent64 *d; - while ((d = readdir64 (dir)) != NULL) - if (strcmp (d->d_name, ".") != 0 && strcmp (d->d_name, "..") != 0) - { - printf ("temp directory contains file \"%s\"\n", d->d_name); - return 1; - } - closedir (dir); - - /* Create a new directory. */ - int e = mkfifoat (dir_fd, "some-fifo", 0777); - if (e == -1) - { - if (errno == ENOSYS) - { - puts ("*at functions not supported"); - return 0; - } - - puts ("fifo creation failed"); - return 1; - } - - struct stat64 st1; - if (fstatat64 (dir_fd, "some-fifo", &st1, 0) != 0) - { - puts ("fstat64 failed"); - return 1; - } - if (!S_ISFIFO (st1.st_mode)) - { - puts ("mkfifoat did not create FIFO"); - return 1; - } - - dupfd = dup (dir_fd); - if (dupfd == -1) - { - puts ("dup failed"); - return 1; - } - if (lseek (dupfd, 0, SEEK_SET) != 0) - { - puts ("1st lseek failed"); - return 1; - } - - dir = fdopendir (dupfd); - if (dir == NULL) - { - puts ("2nd fdopendir failed"); - return 1; - } - bool has_some_fifo = false; - while ((d = readdir64 (dir)) != NULL) - if (strcmp (d->d_name, "some-fifo") == 0) - { - has_some_fifo = true; -#ifdef _DIRENT_HAVE_D_TYPE - if (d->d_type != DT_UNKNOWN && d->d_type != DT_FIFO) - { - puts ("d_type for some-fifo wrong"); - return 1; - } -#endif - } - else if (strcmp (d->d_name, ".") != 0 && strcmp (d->d_name, "..") != 0) - { - printf ("temp directory contains file \"%s\"\n", d->d_name); - return 1; - } - closedir (dir); - - if (!has_some_fifo) - { - puts ("some-fifo not in directory list"); - return 1; - } - - if (unlinkat (dir_fd, "some-fifo", 0) != 0) - { - puts ("unlinkat failed"); - return 1; - } - - close (dir_fd); - - return 0; -} diff --git a/io/tst-mknodat.c b/io/tst-mknodat.c deleted file mode 100644 index 9158c0dfd4..0000000000 --- a/io/tst-mknodat.c +++ /dev/null @@ -1,162 +0,0 @@ -#include <dirent.h> -#include <fcntl.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> - - -static void prepare (void); -#define PREPARE(argc, argv) prepare () - -static int do_test (void); -#define TEST_FUNCTION do_test () - -#include "../test-skeleton.c" - -static int dir_fd; - -static void -prepare (void) -{ - size_t test_dir_len = strlen (test_dir); - static const char dir_name[] = "/tst-mknodat.XXXXXX"; - - size_t dirbuflen = test_dir_len + sizeof (dir_name); - char *dirbuf = malloc (dirbuflen); - if (dirbuf == NULL) - { - puts ("out of memory"); - exit (1); - } - - snprintf (dirbuf, dirbuflen, "%s%s", test_dir, dir_name); - if (mkdtemp (dirbuf) == NULL) - { - puts ("cannot create temporary directory"); - exit (1); - } - - add_temp_file (dirbuf); - - dir_fd = open (dirbuf, O_RDONLY | O_DIRECTORY); - if (dir_fd == -1) - { - puts ("cannot open directory"); - exit (1); - } -} - - -static int -do_test (void) -{ - /* fdopendir takes over the descriptor, make a copy. */ - int dupfd = dup (dir_fd); - if (dupfd == -1) - { - puts ("dup failed"); - return 1; - } - if (lseek (dupfd, 0, SEEK_SET) != 0) - { - puts ("1st lseek failed"); - return 1; - } - - /* The directory should be empty safe the . and .. files. */ - DIR *dir = fdopendir (dupfd); - if (dir == NULL) - { - puts ("fdopendir failed"); - return 1; - } - struct dirent64 *d; - while ((d = readdir64 (dir)) != NULL) - if (strcmp (d->d_name, ".") != 0 && strcmp (d->d_name, "..") != 0) - { - printf ("temp directory contains file \"%s\"\n", d->d_name); - return 1; - } - closedir (dir); - - /* Create a new directory. */ - int e = mknodat (dir_fd, "some-sock", 0777 | S_IFSOCK, 0); - if (e == -1) - { - if (errno == ENOSYS) - { - puts ("*at functions not supported"); - return 0; - } - - puts ("socket creation failed"); - return 1; - } - - struct stat64 st1; - if (fstatat64 (dir_fd, "some-sock", &st1, 0) != 0) - { - puts ("fstat64 failed"); - return 1; - } - if (!S_ISSOCK (st1.st_mode)) - { - puts ("mknodat did not create a Unix domain socket"); - return 1; - } - - dupfd = dup (dir_fd); - if (dupfd == -1) - { - puts ("dup failed"); - return 1; - } - if (lseek (dupfd, 0, SEEK_SET) != 0) - { - puts ("1st lseek failed"); - return 1; - } - - dir = fdopendir (dupfd); - if (dir == NULL) - { - puts ("2nd fdopendir failed"); - return 1; - } - bool has_some_sock = false; - while ((d = readdir64 (dir)) != NULL) - if (strcmp (d->d_name, "some-sock") == 0) - { - has_some_sock = true; -#ifdef _DIRENT_HAVE_D_TYPE - if (d->d_type != DT_UNKNOWN && d->d_type != DT_SOCK) - { - puts ("d_type for some-sock wrong"); - return 1; - } -#endif - } - else if (strcmp (d->d_name, ".") != 0 && strcmp (d->d_name, "..") != 0) - { - printf ("temp directory contains file \"%s\"\n", d->d_name); - return 1; - } - closedir (dir); - - if (!has_some_sock) - { - puts ("some-sock not in directory list"); - return 1; - } - - if (unlinkat (dir_fd, "some-sock", 0) != 0) - { - puts ("unlinkat failed"); - return 1; - } - - close (dir_fd); - - return 0; -} diff --git a/io/tst-openat.c b/io/tst-openat.c deleted file mode 100644 index 0ceb745880..0000000000 --- a/io/tst-openat.c +++ /dev/null @@ -1,209 +0,0 @@ -#include <dirent.h> -#include <fcntl.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> - - -static void prepare (void); -#define PREPARE(argc, argv) prepare () - -static int do_test (void); -#define TEST_FUNCTION do_test () - -#include "../test-skeleton.c" - -static int dir_fd; - -static void -prepare (void) -{ - size_t test_dir_len = strlen (test_dir); - static const char dir_name[] = "/tst-openat.XXXXXX"; - - size_t dirbuflen = test_dir_len + sizeof (dir_name); - char *dirbuf = malloc (dirbuflen); - if (dirbuf == NULL) - { - puts ("out of memory"); - exit (1); - } - - snprintf (dirbuf, dirbuflen, "%s%s", test_dir, dir_name); - if (mkdtemp (dirbuf) == NULL) - { - puts ("cannot create temporary directory"); - exit (1); - } - - add_temp_file (dirbuf); - - dir_fd = open (dirbuf, O_RDONLY | O_DIRECTORY); - if (dir_fd == -1) - { - puts ("cannot open directory"); - exit (1); - } -} - - -static int -do_test (void) -{ - /* fdopendir takes over the descriptor, make a copy. */ - int dupfd = dup (dir_fd); - if (dupfd == -1) - { - puts ("dup failed"); - return 1; - } - if (lseek (dupfd, 0, SEEK_SET) != 0) - { - puts ("1st lseek failed"); - return 1; - } - - /* The directory should be empty safe the . and .. files. */ - DIR *dir = fdopendir (dupfd); - if (dir == NULL) - { - puts ("fdopendir failed"); - return 1; - } - struct dirent64 *d; - while ((d = readdir64 (dir)) != NULL) - if (strcmp (d->d_name, ".") != 0 && strcmp (d->d_name, "..") != 0) - { - printf ("temp directory contains file \"%s\"\n", d->d_name); - return 1; - } - closedir (dir); - - /* Try to create a file. */ - int fd = openat (dir_fd, "some-file", O_CREAT|O_RDWR|O_EXCL, 0666); - if (fd == -1) - { - if (errno == ENOSYS) - { - puts ("*at functions not supported"); - return 0; - } - - puts ("file creation failed"); - return 1; - } - write (fd, "hello", 5); - - /* Before closing the file, try using this file descriptor to open - another file. This must fail. */ - int fd2 = openat (fd, "should-not-work", O_CREAT|O_RDWR, 0666); - if (fd2 != -1) - { - puts ("openat using descriptor for normal file worked"); - return 1; - } - if (errno != ENOTDIR) - { - puts ("error for openat using descriptor for normal file not ENOTDIR "); - return 1; - } - - close (fd); - puts ("file created"); - - /* fdopendir takes over the descriptor, make a copy. */ - dupfd = dup (dir_fd); - if (dupfd == -1) - { - puts ("dup failed"); - return 1; - } - if (lseek (dupfd, 0, SEEK_SET) != 0) - { - puts ("2nd lseek failed"); - return 1; - } - - /* The directory should be empty safe the . and .. files. */ - dir = fdopendir (dupfd); - if (dir == NULL) - { - puts ("fdopendir failed"); - return 1; - } - bool seen_file = false; - while ((d = readdir64 (dir)) != NULL) - if (strcmp (d->d_name, ".") != 0 && strcmp (d->d_name, "..") != 0) - { - if (strcmp (d->d_name, "some-file") != 0) - { - printf ("temp directory contains file \"%s\"\n", d->d_name); - return 1; - } - - seen_file = true; - } - closedir (dir); - - if (!seen_file) - { - puts ("file not created in correct directory"); - return 1; - } - - int cwdfd = open (".", O_RDONLY | O_DIRECTORY); - if (cwdfd == -1) - { - puts ("cannot get descriptor for cwd"); - return 1; - } - - if (fchdir (dir_fd) != 0) - { - puts ("1st fchdir failed"); - return 1; - } - - if (unlink ("some-file") != 0) - { - puts ("unlink failed"); - return 1; - } - - if (fchdir (cwdfd) != 0) - { - puts ("2nd fchdir failed"); - return 1; - } - - close (dir_fd); - close (cwdfd); - - /* With the file descriptor closed the next call must fail. */ - fd = openat (dir_fd, "some-file", O_CREAT|O_RDWR|O_EXCL, 0666); - if (fd != -1) - { - puts ("openat using closed descriptor succeeded"); - return 1; - } - if (errno != EBADF) - { - puts ("openat using closed descriptor did not set EBADF"); - return 1; - } - - fd = openat (-1, "some-file", O_CREAT|O_RDWR|O_EXCL, 0666); - if (fd != -1) - { - puts ("openat using -1 descriptor succeeded"); - return 1; - } - if (errno != EBADF) - { - puts ("openat using -1 descriptor did not set EBADF"); - return 1; - } - - return 0; -} diff --git a/io/tst-readlinkat.c b/io/tst-readlinkat.c deleted file mode 100644 index 891b6e6817..0000000000 --- a/io/tst-readlinkat.c +++ /dev/null @@ -1,136 +0,0 @@ -#include <dirent.h> -#include <fcntl.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> - - -static void prepare (void); -#define PREPARE(argc, argv) prepare () - -static int do_test (void); -#define TEST_FUNCTION do_test () - -#include "../test-skeleton.c" - -static int dir_fd; - -static void -prepare (void) -{ - size_t test_dir_len = strlen (test_dir); - static const char dir_name[] = "/tst-symlinkat.XXXXXX"; - - size_t dirbuflen = test_dir_len + sizeof (dir_name); - char *dirbuf = malloc (dirbuflen); - if (dirbuf == NULL) - { - puts ("out of memory"); - exit (1); - } - - snprintf (dirbuf, dirbuflen, "%s%s", test_dir, dir_name); - if (mkdtemp (dirbuf) == NULL) - { - puts ("cannot create temporary directory"); - exit (1); - } - - add_temp_file (dirbuf); - - dir_fd = open (dirbuf, O_RDONLY | O_DIRECTORY); - if (dir_fd == -1) - { - puts ("cannot open directory"); - exit (1); - } -} - - -static int -do_test (void) -{ - /* fdopendir takes over the descriptor, make a copy. */ - int dupfd = dup (dir_fd); - if (dupfd == -1) - { - puts ("dup failed"); - return 1; - } - if (lseek (dupfd, 0, SEEK_SET) != 0) - { - puts ("1st lseek failed"); - return 1; - } - - /* The directory should be empty safe the . and .. files. */ - DIR *dir = fdopendir (dupfd); - if (dir == NULL) - { - puts ("fdopendir failed"); - return 1; - } - struct dirent64 *d; - while ((d = readdir64 (dir)) != NULL) - if (strcmp (d->d_name, ".") != 0 && strcmp (d->d_name, "..") != 0) - { - printf ("temp directory contains file \"%s\"\n", d->d_name); - return 1; - } - closedir (dir); - - static const char symlinkcontent[] = "some-file"; - if (symlinkat (symlinkcontent, dir_fd, "another-file") != 0) - { - puts ("symlinkat failed"); - return 1; - } - - struct stat64 st2; - if (fstatat64 (dir_fd, "another-file", &st2, AT_SYMLINK_NOFOLLOW) != 0) - { - puts ("fstatat64 failed"); - return 1; - } - if (!S_ISLNK (st2.st_mode)) - { - puts ("2nd fstatat64 does not show file is a symlink"); - return 1; - } - - if (fstatat64 (dir_fd, symlinkcontent, &st2, AT_SYMLINK_NOFOLLOW) == 0) - { - puts ("2nd fstatat64 succeeded"); - return 1; - } - - char buf[100]; - int n = readlinkat (dir_fd, "another-file", buf, sizeof (buf)); - if (n == -1) - { - puts ("readlinkat failed"); - return 1; - } - if (n != sizeof (symlinkcontent) - 1) - { - printf ("readlinkat returned %d, expected %zu\n", - n, sizeof (symlinkcontent) - 1); - return 1; - } - if (strncmp (buf, symlinkcontent, n) != 0) - { - puts ("readlinkat retrieved wrong link content"); - return 1; - } - - if (unlinkat (dir_fd, "another-file", 0) != 0) - { - puts ("unlinkat failed"); - return 1; - } - - close (dir_fd); - - return 0; -} diff --git a/io/tst-renameat.c b/io/tst-renameat.c deleted file mode 100644 index a7c0ec16c4..0000000000 --- a/io/tst-renameat.c +++ /dev/null @@ -1,225 +0,0 @@ -#include <dirent.h> -#include <fcntl.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> - - -static void prepare (void); -#define PREPARE(argc, argv) prepare () - -static int do_test (void); -#define TEST_FUNCTION do_test () - -#include "../test-skeleton.c" - -static int dir_fd; - -static void -prepare (void) -{ - size_t test_dir_len = strlen (test_dir); - static const char dir_name[] = "/tst-renameat.XXXXXX"; - - size_t dirbuflen = test_dir_len + sizeof (dir_name); - char *dirbuf = malloc (dirbuflen); - if (dirbuf == NULL) - { - puts ("out of memory"); - exit (1); - } - - snprintf (dirbuf, dirbuflen, "%s%s", test_dir, dir_name); - if (mkdtemp (dirbuf) == NULL) - { - puts ("cannot create temporary directory"); - exit (1); - } - - add_temp_file (dirbuf); - - dir_fd = open (dirbuf, O_RDONLY | O_DIRECTORY); - if (dir_fd == -1) - { - puts ("cannot open directory"); - exit (1); - } -} - - -static int -do_test (void) -{ - /* fdopendir takes over the descriptor, make a copy. */ - int dupfd = dup (dir_fd); - if (dupfd == -1) - { - puts ("dup failed"); - return 1; - } - if (lseek (dupfd, 0, SEEK_SET) != 0) - { - puts ("1st lseek failed"); - return 1; - } - - /* The directory should be empty safe the . and .. files. */ - DIR *dir = fdopendir (dupfd); - if (dir == NULL) - { - puts ("fdopendir failed"); - return 1; - } - struct dirent64 *d; - while ((d = readdir64 (dir)) != NULL) - if (strcmp (d->d_name, ".") != 0 && strcmp (d->d_name, "..") != 0) - { - printf ("temp directory contains file \"%s\"\n", d->d_name); - return 1; - } - closedir (dir); - - /* Try to create a file. */ - int fd = openat (dir_fd, "some-file", O_CREAT|O_RDWR|O_EXCL, 0666); - if (fd == -1) - { - if (errno == ENOSYS) - { - puts ("*at functions not supported"); - return 0; - } - - puts ("file creation failed"); - return 1; - } - write (fd, "hello", 5); - puts ("file created"); - - struct stat64 st1; - if (fstat64 (fd, &st1) != 0) - { - puts ("fstat64 failed"); - return 1; - } - - /* Using a descriptor for a normal file must fail. */ - if (renameat (fd, "some-file", dir_fd, "another-file") == 0) - { - puts ("renameat with normal file descriptor succeeded"); - return 1; - } - if (errno != ENOTDIR) - { - puts ("error for renameat with normal file descriptor not ENOTDIR"); - return 1; - } - - if (renameat (dir_fd, "some-file", fd, "another-file") == 0) - { - puts ("2nd renameat with normal file descriptor succeeded"); - return 1; - } - if (errno != ENOTDIR) - { - puts ("error for 2nd renameat with normal file descriptor not ENOTDIR"); - return 1; - } - - close (fd); - - if (renameat (dir_fd, "some-file", dir_fd, "another-file") != 0) - { - puts ("renameat failed"); - return 1; - } - - struct stat64 st2; - if (fstatat64 (dir_fd, "some-file", &st2, 0) == 0) - { - puts ("fstatat64 succeeded"); - return 1; - } - if (errno != ENOENT) - { - puts ("fstatat64 did not fail with ENOENT"); - return 1; - } - - if (fstatat64 (dir_fd, "another-file", &st2, 0) != 0) - { - puts ("2nd fstatat64 failed"); - return 1; - } - - if (st1.st_dev != st2.st_dev - || st1.st_ino != st2.st_ino - || st1.st_size != st2.st_size) - { - puts ("stat results do not match"); - return 1; - } - - /* Create a file descriptor which is closed again right away. */ - int dir_fd2 = dup (dir_fd); - if (dir_fd2 == -1) - { - puts ("dup failed"); - return 1; - } - close (dir_fd2); - - if (renameat (dir_fd2, "another-file", dir_fd, "some-file") == 0) - { - puts ("renameat with closed file descriptor succeeded"); - return 1; - } - if (errno != EBADF) - { - puts ("error for renameat with closed file descriptor not EBADF"); - return 1; - } - - if (renameat (dir_fd, "another-file", dir_fd2, "some-file") == 0) - { - puts ("2nd renameat with closed file descriptor succeeded"); - return 1; - } - if (errno != EBADF) - { - puts ("error for 2nd renameat with closed file descriptor not EBADF"); - return 1; - } - - if (unlinkat (dir_fd, "another-file", 0) != 0) - { - puts ("unlinkat failed"); - return 1; - } - - if (renameat (-1, "another-file", dir_fd, "some-file") == 0) - { - puts ("renameat with invalid file descriptor succeeded"); - return 1; - } - if (errno != EBADF) - { - puts ("error for renameat with invalid file descriptor not EBADF"); - return 1; - } - - if (renameat (dir_fd, "another-file", -1, "some-file") == 0) - { - puts ("2nd renameat with invalid file descriptor succeeded"); - return 1; - } - if (errno != EBADF) - { - puts ("error for 2nd renameat with invalid file descriptor not EBADF"); - return 1; - } - - close (dir_fd); - - return 0; -} diff --git a/io/tst-symlinkat.c b/io/tst-symlinkat.c deleted file mode 100644 index 1e98588fc8..0000000000 --- a/io/tst-symlinkat.c +++ /dev/null @@ -1,164 +0,0 @@ -#include <dirent.h> -#include <fcntl.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> - - -static void prepare (void); -#define PREPARE(argc, argv) prepare () - -static int do_test (void); -#define TEST_FUNCTION do_test () - -#include "../test-skeleton.c" - -static int dir_fd; - -static void -prepare (void) -{ - size_t test_dir_len = strlen (test_dir); - static const char dir_name[] = "/tst-symlinkat.XXXXXX"; - - size_t dirbuflen = test_dir_len + sizeof (dir_name); - char *dirbuf = malloc (dirbuflen); - if (dirbuf == NULL) - { - puts ("out of memory"); - exit (1); - } - - snprintf (dirbuf, dirbuflen, "%s%s", test_dir, dir_name); - if (mkdtemp (dirbuf) == NULL) - { - puts ("cannot create temporary directory"); - exit (1); - } - - add_temp_file (dirbuf); - - dir_fd = open (dirbuf, O_RDONLY | O_DIRECTORY); - if (dir_fd == -1) - { - puts ("cannot open directory"); - exit (1); - } -} - - -static int -do_test (void) -{ - /* fdopendir takes over the descriptor, make a copy. */ - int dupfd = dup (dir_fd); - if (dupfd == -1) - { - puts ("dup failed"); - return 1; - } - if (lseek (dupfd, 0, SEEK_SET) != 0) - { - puts ("1st lseek failed"); - return 1; - } - - /* The directory should be empty safe the . and .. files. */ - DIR *dir = fdopendir (dupfd); - if (dir == NULL) - { - puts ("fdopendir failed"); - return 1; - } - struct dirent64 *d; - while ((d = readdir64 (dir)) != NULL) - if (strcmp (d->d_name, ".") != 0 && strcmp (d->d_name, "..") != 0) - { - printf ("temp directory contains file \"%s\"\n", d->d_name); - return 1; - } - closedir (dir); - - /* Try to create a file. */ - int fd = openat (dir_fd, "some-file", O_CREAT|O_RDWR|O_EXCL, 0666); - if (fd == -1) - { - if (errno == ENOSYS) - { - puts ("*at functions not supported"); - return 0; - } - - puts ("file creation failed"); - return 1; - } - write (fd, "hello", 5); - puts ("file created"); - - struct stat64 st1; - if (fstat64 (fd, &st1) != 0) - { - puts ("fstat64 failed"); - return 1; - } - - close (fd); - - if (symlinkat ("some-file", dir_fd, "another-file") != 0) - { - puts ("symlinkat failed"); - return 1; - } - - struct stat64 st2; - if (fstatat64 (dir_fd, "some-file", &st2, 0) != 0) - { - puts ("fstatat64 failed"); - return 1; - } - if (st1.st_dev != st2.st_dev || st1.st_ino != st2.st_ino) - { - puts ("file changed after symlinkat"); - return 1; - } - - if (fstatat64 (dir_fd, "another-file", &st2, AT_SYMLINK_NOFOLLOW) != 0) - { - puts ("2nd fstatat64 failed"); - return 1; - } - if (!S_ISLNK (st2.st_mode)) - { - puts ("2nd fstatat64 does not show file is a symlink"); - return 1; - } - - if (fstatat64 (dir_fd, "another-file", &st2, 0) != 0) - { - puts ("3rd fstatat64 failed"); - return 1; - } - if (st1.st_dev != st2.st_dev - || st1.st_ino != st2.st_ino - || st1.st_size != st2.st_size) - { - puts ("stat results do not match"); - return 1; - } - - if (unlinkat (dir_fd, "another-file", 0) != 0) - { - puts ("unlinkat failed"); - return 1; - } - if (unlinkat (dir_fd, "some-file", 0) != 0) - { - puts ("2nd unlinkat failed"); - return 1; - } - - close (dir_fd); - - return 0; -} diff --git a/io/tst-ttyname_r.c b/io/tst-ttyname_r.c deleted file mode 100644 index 8e2f30c972..0000000000 --- a/io/tst-ttyname_r.c +++ /dev/null @@ -1,42 +0,0 @@ -#include <errno.h> -#include <error.h> -#include <fcntl.h> -#include <stdio.h> -#include <unistd.h> - -static void do_prepare (void); -#define PREPARE(argc, argv) do_prepare () -static int do_test (void); -#define TEST_FUNCTION do_test () -#include <test-skeleton.c> - -static int temp_fd; - -static void -do_prepare (void) -{ - char *temp_file; - temp_fd = create_temp_file ("tst-ttyname_r.", &temp_file); - if (temp_fd == -1) - error (1, errno, "cannot create temporary file"); -} - -static int -do_test (void) -{ - int ret = 0; - char buf[sysconf (_SC_TTY_NAME_MAX) + 1]; - int res = ttyname_r (-1, buf, sizeof (buf)); - if (res != EBADF) - { - printf ("1st ttyname_r returned with res %d\n", res); - ret++; - } - res = ttyname_r (temp_fd, buf, sizeof (buf)); - if (res != ENOTTY) - { - printf ("2nd ttyname_r returned with res %d\n", res); - ret++; - } - return ret; -} diff --git a/io/tst-unlinkat.c b/io/tst-unlinkat.c deleted file mode 100644 index c25443c27f..0000000000 --- a/io/tst-unlinkat.c +++ /dev/null @@ -1,178 +0,0 @@ -#include <dirent.h> -#include <fcntl.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> - - -static void prepare (void); -#define PREPARE(argc, argv) prepare () - -static int do_test (void); -#define TEST_FUNCTION do_test () - -#include "../test-skeleton.c" - -static int dir_fd; - -static void -prepare (void) -{ - size_t test_dir_len = strlen (test_dir); - static const char dir_name[] = "/tst-unlinkat.XXXXXX"; - - size_t dirbuflen = test_dir_len + sizeof (dir_name); - char *dirbuf = malloc (dirbuflen); - if (dirbuf == NULL) - { - puts ("out of memory"); - exit (1); - } - - snprintf (dirbuf, dirbuflen, "%s%s", test_dir, dir_name); - if (mkdtemp (dirbuf) == NULL) - { - puts ("cannot create temporary directory"); - exit (1); - } - - add_temp_file (dirbuf); - - dir_fd = open (dirbuf, O_RDONLY | O_DIRECTORY); - if (dir_fd == -1) - { - puts ("cannot open directory"); - exit (1); - } -} - - -static int -do_test (void) -{ - /* fdopendir takes over the descriptor, make a copy. */ - int dupfd = dup (dir_fd); - if (dupfd == -1) - { - puts ("dup failed"); - return 1; - } - if (lseek (dupfd, 0, SEEK_SET) != 0) - { - puts ("1st lseek failed"); - return 1; - } - - /* The directory should be empty safe the . and .. files. */ - DIR *dir = fdopendir (dupfd); - if (dir == NULL) - { - puts ("fdopendir failed"); - return 1; - } - struct dirent64 *d; - while ((d = readdir64 (dir)) != NULL) - if (strcmp (d->d_name, ".") != 0 && strcmp (d->d_name, "..") != 0) - { - printf ("temp directory contains file \"%s\"\n", d->d_name); - return 1; - } - closedir (dir); - - /* Try to create a file. */ - int fd = openat (dir_fd, "some-file", O_CREAT|O_RDWR|O_EXCL, 0666); - if (fd == -1) - { - if (errno == ENOSYS) - { - puts ("*at functions not supported"); - return 0; - } - - puts ("file creation failed"); - return 1; - } - write (fd, "hello", 5); - close (fd); - puts ("file created"); - - /* fdopendir takes over the descriptor, make a copy. */ - dupfd = dup (dir_fd); - if (dupfd == -1) - { - puts ("2nd dup failed"); - return 1; - } - if (lseek (dupfd, 0, SEEK_SET) != 0) - { - puts ("2nd lseek failed"); - return 1; - } - - /* The directory should be empty safe the . and .. files. */ - dir = fdopendir (dupfd); - if (dir == NULL) - { - puts ("2nd fdopendir failed"); - return 1; - } - bool seen_file = false; - while ((d = readdir64 (dir)) != NULL) - if (strcmp (d->d_name, ".") != 0 && strcmp (d->d_name, "..") != 0) - { - if (strcmp (d->d_name, "some-file") != 0) - { - printf ("temp directory contains file \"%s\"\n", d->d_name); - return 1; - } - - seen_file = true; - } - closedir (dir); - - if (!seen_file) - { - puts ("file not created in correct directory"); - return 1; - } - - /* Remove the file now. */ - if (unlinkat (dir_fd, "some-file", 0) != 0) - { - puts ("unlinkat failed"); - return 1; - } - - /* We won't need dir_fd anymore after this, so use it. */ - if (lseek (dir_fd, 0, SEEK_SET) != 0) - { - puts ("3rd lseek failed"); - return 1; - } - - /* The directory should be empty safe the . and .. files. */ - dir = fdopendir (dir_fd); - if (dir == NULL) - { - puts ("3rd fdopendir failed"); - return 1; - } - while ((d = readdir64 (dir)) != NULL) - if (strcmp (d->d_name, ".") != 0 && strcmp (d->d_name, "..") != 0) - { - if (strcmp (d->d_name, "some-file") == 0) - { - puts ("some-file not removed"); - return 1; - } - else - { - printf ("temp directory contains file \"%s\"\n", d->d_name); - return 1; - } - } - closedir (dir); - - return 0; -} diff --git a/io/ttyname.c b/io/ttyname.c deleted file mode 100644 index 088ba918a8..0000000000 --- a/io/ttyname.c +++ /dev/null @@ -1,38 +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 <unistd.h> - - -char *__ttyname = NULL; - -/* Return the pathname of the terminal FD is open on, or NULL on errors. - The returned storage is good only until the next call to this function. */ -char * -ttyname (fd) - int fd; -{ - __set_errno (ENOSYS); - return NULL; -} - - -stub_warning (ttyname) -#include <stub-tag.h> diff --git a/io/ttyname_r.c b/io/ttyname_r.c deleted file mode 100644 index 14c1209096..0000000000 --- a/io/ttyname_r.c +++ /dev/null @@ -1,37 +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 <unistd.h> - - -/* Store at most BUFLEN characters the pathname of the terminal FD is - open on in BUF. Return 0 on success, otherwise an error number. */ -int -__ttyname_r (fd, buf, buflen) - int fd; - char *buf; - size_t buflen; -{ - __set_errno (ENOSYS); - return ENOSYS; -} -weak_alias (__ttyname_r, ttyname_r) - -stub_warning (ttyname_r) -#include <stub-tag.h> diff --git a/io/umask.c b/io/umask.c deleted file mode 100644 index 588d57e1ce..0000000000 --- a/io/umask.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 <sys/stat.h> -#include <errno.h> -#include <sys/types.h> - -/* Set the file creation mask to MASK, returning the old mask. */ -mode_t -__umask (mask) - mode_t mask; -{ - __set_errno (ENOSYS); - return -1; -} -stub_warning (umask) - -weak_alias (__umask, umask) -#include <stub-tag.h> diff --git a/io/unlink.c b/io/unlink.c deleted file mode 100644 index 1ec6d87ae1..0000000000 --- a/io/unlink.c +++ /dev/null @@ -1,41 +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 <unistd.h> - - -/* Remove the link named NAME. */ -int -__unlink (name) - const char *name; -{ - if (name == NULL) - { - __set_errno (EINVAL); - return -1; - } - - __set_errno (ENOSYS); - return -1; -} -stub_warning (unlink) - -weak_alias (__unlink, unlink) -#include <stub-tag.h> diff --git a/io/unlinkat.c b/io/unlinkat.c deleted file mode 100644 index f9a08b9903..0000000000 --- a/io/unlinkat.c +++ /dev/null @@ -1,49 +0,0 @@ -/* Copyright (C) 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 - 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 <fcntl.h> -#include <stddef.h> -#include <unistd.h> - - -/* Remove the link named NAME. */ -int -unlinkat (fd, name, flag) - int fd; - const char *name; - int flag; -{ - if (name == NULL || (flag & AT_REMOVEDIR) != 0) - { - __set_errno (EINVAL); - return -1; - } - - if (fd < 0 && fd != AT_FDCWD) - { - __set_errno (EBADF); - return -1; - } - - __set_errno (ENOSYS); - return -1; -} -stub_warning (unlinkat) - -#include <stub-tag.h> diff --git a/io/utime.c b/io/utime.c deleted file mode 100644 index 3a3bcc38cc..0000000000 --- a/io/utime.c +++ /dev/null @@ -1,43 +0,0 @@ -/* Copyright (C) 1991,95,96,97,2002 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 <utime.h> - - -/* Set the access and modification times of FILE to those given in TIMES. - If TIMES is NULL, set them to the current time. */ -int -utime (file, times) - const char *file; - const struct utimbuf *times; -{ - if (file == NULL) - { - __set_errno (EINVAL); - return -1; - } - - __set_errno (ENOSYS); - return -1; -} -libc_hidden_def (utime) - -stub_warning (utime) -#include <stub-tag.h> diff --git a/io/write.c b/io/write.c deleted file mode 100644 index 928d43ced2..0000000000 --- a/io/write.c +++ /dev/null @@ -1,50 +0,0 @@ -/* Copyright (C) 1991, 1995, 1996, 1997, 2002 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 <sysdep.h> -#include <errno.h> -#include <unistd.h> -#include <stddef.h> - -/* Write NBYTES of BUF to FD. Return the number written, or -1. */ -ssize_t -__libc_write (int fd, const void *buf, size_t nbytes) -{ - if (nbytes == 0) - return 0; - if (fd < 0) - { - __set_errno (EBADF); - return -1; - } - if (buf == NULL) - { - __set_errno (EINVAL); - return -1; - } - - __set_errno (ENOSYS); - return -1; -} -libc_hidden_def (__libc_write) -stub_warning (write) - -weak_alias (__libc_write, __write) -libc_hidden_weak (__write) -weak_alias (__libc_write, write) -#include <stub-tag.h> diff --git a/io/xmknod.c b/io/xmknod.c deleted file mode 100644 index c2daa46e07..0000000000 --- a/io/xmknod.c +++ /dev/null @@ -1,48 +0,0 @@ -/* Copyright (C) 1991,1993,1995-1997,2002,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 - 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 <sys/stat.h> - -/* Create a device file named PATH, with permission and special bits MODE - and device number DEV (which can be constructed from major and minor - device numbers with the `makedev' macro above). */ -int -__xmknod (int vers, const char *path, mode_t mode, dev_t *dev) -{ - if (vers != _MKNOD_VER) - { - __set_errno (EINVAL); - return -1; - } - - if (path == NULL) - { - __set_errno (EINVAL); - return -1; - } - - __set_errno (ENOSYS); - return -1; -} -stub_warning (__xmknod) - -weak_alias (__xmknod, _xmknod) -libc_hidden_def (__xmknod) -#include <stub-tag.h> diff --git a/io/xmknodat.c b/io/xmknodat.c deleted file mode 100644 index 48dc1b2630..0000000000 --- a/io/xmknodat.c +++ /dev/null @@ -1,64 +0,0 @@ -/* Copyright (C) 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 - 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 <fcntl.h> -#include <stddef.h> -#include <sys/types.h> -#include <sys/stat.h> - -/* Create a device file named PATH relative to FD, with permission and - special bits MODE and device number DEV (which can be constructed - from major and minor device numbers with the `makedev' macro - above). */ -int -__xmknodat (int vers, int fd, const char *path, mode_t mode, dev_t *dev) -{ - if (vers != _MKNOD_VER) - { - __set_errno (EINVAL); - return -1; - } - - if (path == NULL) - { - __set_errno (EINVAL); - return -1; - } - - if (fd != AT_FDCWD && path[0] != '/') - { - /* Check FD is associated with a directory. */ - struct stat64 st; - if (__fxstat64 (_STAT_VER, fd, &st) != 0) - return -1; - - if (!S_ISDIR (st.st_mode)) - { - __set_errno (ENOTDIR); - return -1; - } - } - - __set_errno (ENOSYS); - return -1; -} -stub_warning (__xmknodat) - -libc_hidden_def (__xmknodat) -#include <stub-tag.h> diff --git a/io/xstat.c b/io/xstat.c deleted file mode 100644 index e7328cc10e..0000000000 --- a/io/xstat.c +++ /dev/null @@ -1,39 +0,0 @@ -/* Copyright (C) 1991, 1995, 1996, 1997, 2002 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/stat.h> -#include <stddef.h> - -/* Get file information about FILE in BUF. */ -int -__xstat (int vers, const char *file, struct stat *buf) -{ - if (vers != _STAT_VER || file == NULL || buf == NULL) - { - __set_errno (EINVAL); - return -1; - } - - __set_errno (ENOSYS); - return -1; -} -hidden_def (__xstat) -stub_warning (stat) -weak_alias (__xstat, _xstat) -#include <stub-tag.h> diff --git a/io/xstat64.c b/io/xstat64.c deleted file mode 100644 index 2fb94cf331..0000000000 --- a/io/xstat64.c +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright (C) 1991, 1995, 1996, 1997, 2002 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/stat.h> -#include <stddef.h> - -/* Get file information about FILE in BUF. */ -int -__xstat64 (int vers, const char *file, struct stat64 *buf) -{ - if (vers != _STAT_VER || file == NULL || buf == NULL) - { - __set_errno (EINVAL); - return -1; - } - - __set_errno (ENOSYS); - return -1; -} -hidden_def (__xstat64) -stub_warning (stat64) -#include <stub-tag.h> |