diff options
Diffstat (limited to 'io')
127 files changed, 657 insertions, 397 deletions
diff --git a/io/Makefile b/io/Makefile index 613dce0124..deb6100156 100644 --- a/io/Makefile +++ b/io/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1992-2015 Free Software Foundation, Inc. +# Copyright (C) 1992-2016 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 @@ -49,7 +49,7 @@ routines := \ ttyname ttyname_r isatty \ link linkat symlink symlinkat readlink readlinkat \ unlink unlinkat rmdir \ - ftw ftw64 fts poll ppoll \ + ftw ftw64 fts fts64 poll ppoll \ posix_fadvise posix_fadvise64 \ posix_fallocate posix_fallocate64 \ sendfile sendfile64 \ @@ -71,7 +71,7 @@ tests := test-utime test-stat test-stat2 test-lfs tst-getcwd \ 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-posix_fallocate + tst-posix_fallocate tst-fts tst-fts-lfs ifeq ($(run-built-tests),yes) tests-special += $(objpfx)ftwtest.out @@ -90,6 +90,7 @@ CFLAGS-fstatfs.c = -fexceptions CFLAGS-statvfs.c = -fexceptions CFLAGS-fstatvfs.c = -fexceptions CFLAGS-fts.c = -Wno-uninitialized $(uses-callbacks) -fexceptions +CFLAGS-fts64.c = -Wno-uninitialized $(uses-callbacks) -fexceptions CFLAGS-ftw.c = $(uses-callbacks) -fexceptions CFLAGS-ftw64.c = $(uses-callbacks) -fexceptions CFLAGS-lockf.c = -fexceptions diff --git a/io/Versions b/io/Versions index 6c0a23b465..64316cd025 100644 --- a/io/Versions +++ b/io/Versions @@ -122,4 +122,7 @@ libc { GLIBC_2.9 { dup3; pipe2; } + GLIBC_2.23 { + fts64_children; fts64_close; fts64_open; fts64_read; fts64_set; + } } diff --git a/io/access.c b/io/access.c index 43445a1a55..45347048af 100644 --- a/io/access.c +++ b/io/access.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 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 @@ -21,9 +21,7 @@ /* Test for access to FILE. */ int -__access (file, type) - const char *file; - int type; +__access (const char *file, int type) { if (file == NULL || (type & ~(R_OK|W_OK|X_OK|F_OK)) != 0) { diff --git a/io/bits/fcntl2.h b/io/bits/fcntl2.h index 2ac54b200a..c3f267e422 100644 --- a/io/bits/fcntl2.h +++ b/io/bits/fcntl2.h @@ -1,5 +1,5 @@ /* Checking macros for fcntl functions. - Copyright (C) 2007-2015 Free Software Foundation, Inc. + Copyright (C) 2007-2016 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 diff --git a/io/bits/poll2.h b/io/bits/poll2.h index a19bd19fd0..137bfaf65f 100644 --- a/io/bits/poll2.h +++ b/io/bits/poll2.h @@ -1,5 +1,5 @@ /* Checking macros for poll functions. - Copyright (C) 2012-2015 Free Software Foundation, Inc. + Copyright (C) 2012-2016 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 diff --git a/io/bug-ftw1.c b/io/bug-ftw1.c index fe0557779a..6efc4e7123 100644 --- a/io/bug-ftw1.c +++ b/io/bug-ftw1.c @@ -1,5 +1,5 @@ /* Test for ftw function searching in root directory. - Copyright (C) 2001-2015 Free Software Foundation, Inc. + Copyright (C) 2001-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 2001. diff --git a/io/bug-ftw2.c b/io/bug-ftw2.c index 4c1ea87d3c..139b8ff214 100644 --- a/io/bug-ftw2.c +++ b/io/bug-ftw2.c @@ -1,5 +1,5 @@ /* Test for ftw function searching in current directory. - Copyright (C) 2001-2015 Free Software Foundation, Inc. + Copyright (C) 2001-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 2001. diff --git a/io/bug-ftw4.c b/io/bug-ftw4.c index 2d2b43e4f4..c4b72acdd3 100644 --- a/io/bug-ftw4.c +++ b/io/bug-ftw4.c @@ -1,5 +1,5 @@ /* Test if ftw function doesn't leak fds. - Copyright (C) 2003-2015 Free Software Foundation, Inc. + Copyright (C) 2003-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek <jakub@redhat.com>, 2003. diff --git a/io/chdir.c b/io/chdir.c index 1003b9d200..16784cbabe 100644 --- a/io/chdir.c +++ b/io/chdir.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 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 @@ -21,8 +21,7 @@ /* Change the current directory to PATH. */ int -__chdir (path) - const char *path; +__chdir (const char *path) { if (path == NULL) { diff --git a/io/chmod.c b/io/chmod.c index 3dcc8937b0..cbb3c674e9 100644 --- a/io/chmod.c +++ b/io/chmod.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 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 @@ -22,9 +22,7 @@ /* Change the protections of FILE to MODE. */ int -__chmod (file, mode) - const char *file; - mode_t mode; +__chmod (const char *file, mode_t mode) { if (file == NULL) { diff --git a/io/chown.c b/io/chown.c index 280f2c1d59..06124c4fbd 100644 --- a/io/chown.c +++ b/io/chown.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 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 @@ -22,10 +22,7 @@ /* Change the owner and group of FILE. */ int -__chown (file, owner, group) - const char *file; - uid_t owner; - gid_t group; +__chown (const char *file, uid_t owner, gid_t group) { if (file == NULL) { diff --git a/io/close.c b/io/close.c index 267cfbc7e9..ccbe862e49 100644 --- a/io/close.c +++ b/io/close.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 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 @@ -20,8 +20,7 @@ /* Close the file descriptor FD. */ int -__close (fd) - int fd; +__close (int fd) { if (fd < 0) { diff --git a/io/creat.c b/io/creat.c index c03810d962..caacb69a9b 100644 --- a/io/creat.c +++ b/io/creat.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 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 @@ -23,9 +23,7 @@ /* Create FILE with protections MODE. */ int -creat (file, mode) - const char *file; - mode_t mode; +creat (const char *file, mode_t mode) { return __open (file, O_WRONLY|O_CREAT|O_TRUNC, mode); } diff --git a/io/creat64.c b/io/creat64.c index 6be8a77374..7be7903b95 100644 --- a/io/creat64.c +++ b/io/creat64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 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 @@ -22,9 +22,7 @@ /* Create FILE with protections MODE. */ int -creat64 (file, mode) - const char *file; - mode_t mode; +creat64 (const char *file, mode_t mode) { return __open64 (file, O_WRONLY|O_CREAT|O_TRUNC, mode); } @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 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 @@ -21,8 +21,7 @@ /* Duplicate FD, returning a new file descriptor open on the same file. */ int -__dup (fd) - int fd; +__dup (int fd) { __set_errno (ENOSYS); return -1; @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 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 @@ -23,9 +23,7 @@ /* 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; +__dup2 (int fd, int fd2) { if (fd < 0 || fd2 < 0) { @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2015 Free Software Foundation, Inc. +/* Copyright (C) 2008-2016 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,10 +24,7 @@ open the same file as FD is which setting flags according to FLAGS. Return FD2 or -1. */ int -__dup3 (fd, fd2, flags) - int fd; - int fd2; - int flags; +__dup3 (int fd, int fd2, int flags) { if (fd < 0 || fd2 < 0) { diff --git a/io/euidaccess.c b/io/euidaccess.c index 0adead8d7d..c8d25e78be 100644 --- a/io/euidaccess.c +++ b/io/euidaccess.c @@ -1,5 +1,5 @@ /* Test for access to FILE using effective UID and GID. Stub version. - Copyright (C) 1991-2015 Free Software Foundation, Inc. + Copyright (C) 1991-2016 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 @@ -21,9 +21,7 @@ #include <unistd.h> int -__euidaccess (file, type) - const char *file; - int type; +__euidaccess (const char *file, int type) { if (file == NULL || (type & ~(R_OK|W_OK|X_OK|F_OK)) != 0) { diff --git a/io/faccessat.c b/io/faccessat.c index 3bf8b79035..e4c2e84eb7 100644 --- a/io/faccessat.c +++ b/io/faccessat.c @@ -1,5 +1,5 @@ /* Test for access to file, relative to open directory. Stub version. - Copyright (C) 2006-2015 Free Software Foundation, Inc. + Copyright (C) 2006-2016 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 @@ -23,11 +23,7 @@ #include <sys/types.h> int -faccessat (fd, file, type, flag) - int fd; - const char *file; - int type; - int flag; +faccessat (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) diff --git a/io/fchdir.c b/io/fchdir.c index d4ae2bb7d0..31d9ae72ab 100644 --- a/io/fchdir.c +++ b/io/fchdir.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 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 diff --git a/io/fchmod.c b/io/fchmod.c index f0aac92225..c00d83fbc4 100644 --- a/io/fchmod.c +++ b/io/fchmod.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 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 @@ -22,9 +22,7 @@ /* Change the permissions of the file referenced by FD to MODE. */ int -__fchmod (fd, mode) - int fd; - mode_t mode; +__fchmod (int fd, mode_t mode) { if (fd < 0) { diff --git a/io/fchmodat.c b/io/fchmodat.c index 1cd794bf73..1b90899403 100644 --- a/io/fchmodat.c +++ b/io/fchmodat.c @@ -1,5 +1,5 @@ /* Change the protections of file relative to open directory. Stub version. - Copyright (C) 2006-2015 Free Software Foundation, Inc. + Copyright (C) 2006-2016 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,11 +24,7 @@ #include <sys/stat.h> int -fchmodat (fd, file, mode, flag) - int fd; - const char *file; - mode_t mode; - int flag; +fchmodat (int fd, const char *file, mode_t mode, int flag) { if (file == NULL || (flag & ~AT_SYMLINK_NOFOLLOW) != 0) { diff --git a/io/fchown.c b/io/fchown.c index 441e55953c..6d326ad246 100644 --- a/io/fchown.c +++ b/io/fchown.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 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 @@ -22,10 +22,7 @@ /* 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; +__fchown (int fd, uid_t owner, gid_t group) { if (fd < 0) { diff --git a/io/fchownat.c b/io/fchownat.c index e9e3bd6ffe..1d49dcaf55 100644 --- a/io/fchownat.c +++ b/io/fchownat.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2005-2015 Free Software Foundation, Inc. +/* Copyright (C) 2005-2016 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 @@ -23,12 +23,7 @@ /* 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; +fchownat (int fd, const char *file, uid_t owner, gid_t group, int flag) { if (file == NULL || (flag & ~AT_SYMLINK_NOFOLLOW) != 0) { diff --git a/io/fcntl.c b/io/fcntl.c index 5b1156d301..e540942c69 100644 --- a/io/fcntl.c +++ b/io/fcntl.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 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 @@ -20,9 +20,7 @@ /* Perform file control operations on FD. */ int -__fcntl (fd, cmd) - int fd; - int cmd; +__fcntl (int fd, int cmd, ...) { if (fd < 0) { diff --git a/io/fcntl.h b/io/fcntl.h index c6812c467b..1a92a8d738 100644 --- a/io/fcntl.h +++ b/io/fcntl.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 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 diff --git a/io/flock.c b/io/flock.c index fc999ade77..0f6d8e04be 100644 --- a/io/flock.c +++ b/io/flock.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2015 Free Software Foundation, Inc. +/* Copyright (C) 1992-2016 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 @@ -21,9 +21,7 @@ /* Apply or remove an advisory lock, according to OPERATION, on the file FD refers to. */ int -__flock (fd, operation) - int fd; - int operation; +__flock (int fd, int operation) { __set_errno (ENOSYS); return -1; diff --git a/io/fstat.c b/io/fstat.c index 78606c88c9..50f2a4fbfc 100644 --- a/io/fstat.c +++ b/io/fstat.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2015 Free Software Foundation, Inc. +/* Copyright (C) 1996-2016 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 diff --git a/io/fstat64.c b/io/fstat64.c index 57cb60f314..4ede2540ec 100644 --- a/io/fstat64.c +++ b/io/fstat64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2015 Free Software Foundation, Inc. +/* Copyright (C) 1996-2016 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 diff --git a/io/fstatat.c b/io/fstatat.c index b9c225e410..9d8b370169 100644 --- a/io/fstatat.c +++ b/io/fstatat.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2005-2015 Free Software Foundation, Inc. +/* Copyright (C) 2005-2016 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 diff --git a/io/fstatat64.c b/io/fstatat64.c index a71ea4deb9..dcdccf87af 100644 --- a/io/fstatat64.c +++ b/io/fstatat64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2005-2015 Free Software Foundation, Inc. +/* Copyright (C) 2005-2016 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 diff --git a/io/fstatfs.c b/io/fstatfs.c index 535023ee00..efd1fb2321 100644 --- a/io/fstatfs.c +++ b/io/fstatfs.c @@ -1,5 +1,5 @@ /* Return information about the filesystem on which FD resides. - Copyright (C) 1996-2015 Free Software Foundation, Inc. + Copyright (C) 1996-2016 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 diff --git a/io/fstatfs64.c b/io/fstatfs64.c index 378a3c3be8..e00b992da2 100644 --- a/io/fstatfs64.c +++ b/io/fstatfs64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998-2015 Free Software Foundation, Inc. +/* Copyright (C) 1998-2016 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 diff --git a/io/fstatvfs.c b/io/fstatvfs.c index d7124b9130..4e7333d96c 100644 --- a/io/fstatvfs.c +++ b/io/fstatvfs.c @@ -1,5 +1,5 @@ /* Return information about the filesystem on which FD resides. - Copyright (C) 1996-2015 Free Software Foundation, Inc. + Copyright (C) 1996-2016 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 diff --git a/io/fstatvfs64.c b/io/fstatvfs64.c index 9834f0db00..db947292cb 100644 --- a/io/fstatvfs64.c +++ b/io/fstatvfs64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998-2015 Free Software Foundation, Inc. +/* Copyright (C) 1998-2016 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 @@ -1,3 +1,21 @@ +/* File tree traversal functions. + Copyright (C) 1994-2016 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, see + <http://www.gnu.org/licenses/>. */ + /*- * Copyright (c) 1990, 1993, 1994 * The Regents of the University of California. All rights reserved. @@ -53,16 +71,30 @@ 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_build (FTS *, int) internal_function; -static void fts_lfree (FTSENT *) internal_function; -static void fts_load (FTS *, FTSENT *) internal_function; +/* Support for the LFS API version. */ +#ifndef FTS_OPEN +#define FTS_OPEN fts_open +#define FTS_CLOSE fts_close +#define FTS_READ fts_read +#define FTS_SET fts_set +#define FTS_CHILDREN fts_children +# define FTSOBJ FTS +# define FTSENTRY FTSENT +# define INO_T ino_t +# define STAT stat +# define LSTAT lstat +#endif + +static FTSENTRY *fts_alloc (FTSOBJ *, const char *, size_t) internal_function; +static FTSENTRY *fts_build (FTSOBJ *, int) internal_function; +static void fts_lfree (FTSENTRY *) internal_function; +static void fts_load (FTSOBJ *, FTSENTRY *) internal_function; static size_t fts_maxarglen (char * const *) internal_function; -static void fts_padjust (FTS *, FTSENT *) internal_function; -static int fts_palloc (FTS *, size_t) internal_function; -static FTSENT *fts_sort (FTS *, FTSENT *, int) internal_function; -static u_short fts_stat (FTS *, FTSENT *, int) internal_function; -static int fts_safe_changedir (FTS *, FTSENT *, int, const char *) +static void fts_padjust (FTSOBJ *, FTSENTRY *) internal_function; +static int fts_palloc (FTSOBJ *, size_t) internal_function; +static FTSENTRY *fts_sort (FTSOBJ *, FTSENTRY *, int) internal_function; +static u_short fts_stat (FTSOBJ *, FTSENTRY *, int) internal_function; +static int fts_safe_changedir (FTSOBJ *, FTSENTRY *, int, const char *) internal_function; #ifndef MAX @@ -84,17 +116,15 @@ static int fts_safe_changedir (FTS *, FTSENT *, int, const char *) #define BNAMES 2 /* fts_children, names only */ #define BREAD 3 /* fts_read */ -FTS * -fts_open(argv, options, compar) - char * const *argv; - int options; - int (*compar) (const FTSENT **, const FTSENT **); +FTSOBJ * +FTS_OPEN (char * const *argv, int options, + int (*compar) (const FTSENTRY **, const FTSENTRY **)) { - FTS *sp; - FTSENT *p, *root; + FTSOBJ *sp; + FTSENTRY *p, *root; int nitems; - FTSENT *parent = NULL; - FTSENT *tmp; + FTSENTRY *parent = NULL; + FTSENTRY *tmp; /* Options check. */ if (options & ~FTS_OPTIONMASK) { @@ -103,9 +133,9 @@ fts_open(argv, options, compar) } /* Allocate/initialize the stream */ - if ((sp = malloc((u_int)sizeof(FTS))) == NULL) + if ((sp = malloc((u_int)sizeof(FTSOBJ))) == NULL) return (NULL); - memset(sp, 0, sizeof(FTS)); + memset(sp, 0, sizeof(FTSOBJ)); sp->fts_compar = (int (*) (const void *, const void *)) compar; sp->fts_options = options; @@ -202,9 +232,7 @@ mem1: free(sp); static void internal_function -fts_load(sp, p) - FTS *sp; - FTSENT *p; +fts_load (FTSOBJ *sp, FTSENTRY *p) { int len; char *cp; @@ -228,10 +256,9 @@ fts_load(sp, p) } int -fts_close(sp) - FTS *sp; +FTS_CLOSE (FTSOBJ *sp) { - FTSENT *freep, *p; + FTSENTRY *freep, *p; int saved_errno; /* @@ -281,11 +308,10 @@ fts_close(sp) (p->fts_path[p->fts_pathlen - 1] == '/' \ ? p->fts_pathlen - 1 : p->fts_pathlen) -FTSENT * -fts_read(sp) - FTS *sp; +FTSENTRY * +FTS_READ (FTSOBJ *sp) { - FTSENT *p, *tmp; + FTSENTRY *p, *tmp; int instr; char *t; int saved_errno; @@ -479,10 +505,7 @@ name: t = sp->fts_path + NAPPEND(p->fts_parent); */ /* ARGSUSED */ int -fts_set(sp, p, instr) - FTS *sp; - FTSENT *p; - int instr; +FTS_SET (FTSOBJ *sp, FTSENTRY *p, int instr) { if (instr != 0 && instr != FTS_AGAIN && instr != FTS_FOLLOW && instr != FTS_NOINSTR && instr != FTS_SKIP) { @@ -493,12 +516,10 @@ fts_set(sp, p, instr) return (0); } -FTSENT * -fts_children(sp, instr) - FTS *sp; - int instr; +FTSENTRY * +FTS_CHILDREN(FTSOBJ *sp, int instr) { - FTSENT *p; + FTSENTRY *p; int fd; if (instr != 0 && instr != FTS_NAMEONLY) { @@ -585,16 +606,14 @@ dirent_not_directory(const struct dirent *dp) * directories and for any files after the subdirectories in the directory have * been found, cutting the stat calls by about 2/3. */ -static FTSENT * +static FTSENTRY * internal_function -fts_build(sp, type) - FTS *sp; - int type; +fts_build (FTSOBJ *sp, int type) { struct dirent *dp; - FTSENT *p, *head; + FTSENTRY *p, *head; int nitems; - FTSENT *cur, *tail; + FTSENTRY *cur, *tail; DIR *dirp; void *oldaddr; int cderrno, descend, len, level, nlinks, saved_errno, @@ -852,15 +871,12 @@ mem1: saved_errno = errno; static u_short internal_function -fts_stat(sp, p, follow) - FTS *sp; - FTSENT *p; - int follow; +fts_stat (FTSOBJ *sp, FTSENTRY *p, int follow) { - FTSENT *t; + FTSENTRY *t; dev_t dev; - ino_t ino; - struct stat *sbp, sb; + INO_T ino; + struct STAT *sbp, sb; int saved_errno; /* If user needs stat info, stat buffer already allocated. */ @@ -883,18 +899,18 @@ fts_stat(sp, p, follow) * fail, set the errno from the stat call. */ if (ISSET(FTS_LOGICAL) || follow) { - if (stat(p->fts_accpath, sbp)) { + if (STAT(p->fts_accpath, sbp)) { saved_errno = errno; - if (!lstat(p->fts_accpath, sbp)) { + if (!LSTAT(p->fts_accpath, sbp)) { __set_errno (0); return (FTS_SLNONE); } p->fts_errno = saved_errno; goto err; } - } else if (lstat(p->fts_accpath, sbp)) { + } else if (LSTAT(p->fts_accpath, sbp)) { p->fts_errno = errno; -err: memset(sbp, 0, sizeof(struct stat)); +err: memset(sbp, 0, sizeof(struct STAT)); return (FTS_NS); } @@ -934,14 +950,11 @@ err: memset(sbp, 0, sizeof(struct stat)); return (FTS_DEFAULT); } -static FTSENT * +static FTSENTRY * internal_function -fts_sort(sp, head, nitems) - FTS *sp; - FTSENT *head; - int nitems; +fts_sort (FTSOBJ *sp, FTSENTRY *head, int nitems) { - FTSENT **ap, *p; + FTSENTRY **ap, *p; /* * Construct an array of pointers to the structures and call qsort(3). @@ -951,11 +964,11 @@ fts_sort(sp, head, nitems) * 40 so don't realloc one entry at a time. */ if (nitems > sp->fts_nitems) { - struct _ftsent **a; + FTSENTRY **a; sp->fts_nitems = nitems + 40; if ((a = realloc(sp->fts_array, - (size_t)(sp->fts_nitems * sizeof(FTSENT *)))) == NULL) { + (size_t)(sp->fts_nitems * sizeof(FTSENTRY *)))) == NULL) { free(sp->fts_array); sp->fts_array = NULL; sp->fts_nitems = 0; @@ -965,21 +978,18 @@ fts_sort(sp, head, nitems) } for (ap = sp->fts_array, p = head; p; p = p->fts_link) *ap++ = p; - qsort((void *)sp->fts_array, nitems, sizeof(FTSENT *), sp->fts_compar); + qsort((void *)sp->fts_array, nitems, sizeof(FTSENTRY *), sp->fts_compar); for (head = *(ap = sp->fts_array); --nitems; ++ap) ap[0]->fts_link = ap[1]; ap[0]->fts_link = NULL; return (head); } -static FTSENT * +static FTSENTRY * internal_function -fts_alloc(sp, name, namelen) - FTS *sp; - const char *name; - size_t namelen; +fts_alloc (FTSOBJ *sp, const char *name, size_t namelen) { - FTSENT *p; + FTSENTRY *p; size_t len; /* @@ -990,9 +1000,9 @@ fts_alloc(sp, name, namelen) * fts_name field is declared to be of size 1, the fts_name pointer is * namelen + 2 before the first possible address of the stat structure. */ - len = sizeof(FTSENT) + namelen; + len = sizeof(FTSENTRY) + namelen; if (!ISSET(FTS_NOSTAT)) - len += sizeof(struct stat) + ALIGNBYTES; + len += sizeof(struct STAT) + ALIGNBYTES; if ((p = malloc(len)) == NULL) return (NULL); @@ -1001,7 +1011,7 @@ fts_alloc(sp, name, namelen) p->fts_name[namelen] = '\0'; if (!ISSET(FTS_NOSTAT)) - p->fts_statp = (struct stat *)ALIGN(p->fts_name + namelen + 2); + p->fts_statp = (struct STAT *)ALIGN(p->fts_name + namelen + 2); p->fts_namelen = namelen; p->fts_path = sp->fts_path; p->fts_errno = 0; @@ -1014,10 +1024,9 @@ fts_alloc(sp, name, namelen) static void internal_function -fts_lfree(head) - FTSENT *head; +fts_lfree (FTSENTRY *head) { - FTSENT *p; + FTSENTRY *p; /* Free a linked list of structures. */ while ((p = head)) { @@ -1034,9 +1043,7 @@ fts_lfree(head) */ static int internal_function -fts_palloc(sp, more) - FTS *sp; - size_t more; +fts_palloc (FTSOBJ *sp, size_t more) { char *p; @@ -1068,11 +1075,9 @@ fts_palloc(sp, more) */ static void internal_function -fts_padjust(sp, head) - FTS *sp; - FTSENT *head; +fts_padjust (FTSOBJ *sp, FTSENTRY *head) { - FTSENT *p; + FTSENTRY *p; char *addr = sp->fts_path; #define ADJUST(p) do { \ @@ -1095,8 +1100,7 @@ fts_padjust(sp, head) static size_t internal_function -fts_maxarglen(argv) - char * const *argv; +fts_maxarglen (char * const *argv) { size_t len, max; @@ -1113,11 +1117,7 @@ fts_maxarglen(argv) */ static int internal_function -fts_safe_changedir(sp, p, fd, path) - FTS *sp; - FTSENT *p; - int fd; - const char *path; +fts_safe_changedir (FTSOBJ *sp, FTSENTRY *p, int fd, const char *path) { int ret, oerrno, newfd; struct stat64 sb; @@ -1,3 +1,21 @@ +/* File tree traversal functions declarations. + Copyright (C) 1994-2016 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, see + <http://www.gnu.org/licenses/>. */ + /* * Copyright (c) 1989, 1993 * The Regents of the University of California. All rights reserved. @@ -35,12 +53,6 @@ #include <features.h> #include <sys/types.h> -/* The fts interface is incompatible with the LFS interface which - transparently uses the 64-bit file access functions. */ -#ifdef __USE_FILE_OFFSET64 -# error "<fts.h> cannot be used with -D_FILE_OFFSET_BITS==64" -#endif - typedef struct { struct _ftsent *fts_cur; /* current node */ @@ -68,6 +80,21 @@ typedef struct { int fts_options; /* fts_open options, global flags */ } FTS; +#ifdef __USE_LARGEFILE64 +typedef struct { + struct _ftsent64 *fts_cur; /* current node */ + struct _ftsent64 *fts_child; /* linked list of children */ + struct _ftsent64 **fts_array; /* sort array */ + dev_t fts_dev; /* starting device # */ + char *fts_path; /* path for this descent */ + int fts_rfd; /* fd for root */ + int fts_pathlen; /* sizeof(path) */ + int fts_nitems; /* elements in the sort array */ + int (*fts_compar) (const void *, const void *); /* compare fn */ + int fts_options; /* fts_open options, global flags */ +} FTS64; +#endif + typedef struct _ftsent { struct _ftsent *fts_cycle; /* cycle node */ struct _ftsent *fts_parent; /* parent directory */ @@ -119,13 +146,70 @@ typedef struct _ftsent { char fts_name[1]; /* file name */ } FTSENT; +#ifdef __USE_LARGEFILE64 +typedef struct _ftsent64 { + struct _ftsent64 *fts_cycle; /* cycle node */ + struct _ftsent64 *fts_parent; /* parent directory */ + struct _ftsent64 *fts_link; /* next file in directory */ + long fts_number; /* local numeric value */ + void *fts_pointer; /* local address value */ + char *fts_accpath; /* access path */ + char *fts_path; /* root path */ + int fts_errno; /* errno for this node */ + int fts_symfd; /* fd for symlink */ + u_short fts_pathlen; /* strlen(fts_path) */ + u_short fts_namelen; /* strlen(fts_name) */ + + ino64_t fts_ino; /* inode */ + dev_t fts_dev; /* device */ + nlink_t fts_nlink; /* link count */ + + short fts_level; /* depth (-1 to N) */ + + u_short fts_info; /* user flags for FTSENT structure */ + + u_short fts_flags; /* private flags for FTSENT structure */ + + u_short fts_instr; /* fts_set() instructions */ + + struct stat64 *fts_statp; /* stat(2) information */ + char fts_name[1]; /* file name */ +} FTSENT64; +#endif + __BEGIN_DECLS +#ifndef __USE_FILE_OFFSET64 FTSENT *fts_children (FTS *, int); int fts_close (FTS *); FTS *fts_open (char * const *, int, int (*)(const FTSENT **, const FTSENT **)); FTSENT *fts_read (FTS *); int fts_set (FTS *, FTSENT *, int) __THROW; +#else +# ifdef __REDIRECT +FTSENT *__REDIRECT (fts_children, (FTS *, int), fts64_children); +int __REDIRECT (fts_close, (FTS *), fts64_close); +FTS *__REDIRECT (fts_open, (char * const *, int, + int (*)(const FTSENT **, const FTSENT **)), + fts64_open); +FTSENT *__REDIRECT (fts_read, (FTS *), fts64_read); +int __REDIRECT (fts_set, (FTS *, FTSENT *, int), fts64_set) __THROW; +# else +# define fts_children fts64_children +# define fts_close fts64_close +# define fts_open fts64_open +# define fts_read fts64_read +# define fts_set fts64_set +# endif +#endif +#ifdef __USE_LARGEFILE64 +FTSENT64 *fts64_children (FTS64 *, int); +int fts64_close (FTS64 *); +FTS64 *fts64_open (char * const *, int, + int (*)(const FTSENT64 **, const FTSENT64 **)); +FTSENT64 *fts64_read (FTS64 *); +int fts64_set (FTS64 *, FTSENT64 *, int) __THROW; +#endif __END_DECLS #endif /* fts.h */ diff --git a/io/fts64.c b/io/fts64.c new file mode 100644 index 0000000000..2ff19778aa --- /dev/null +++ b/io/fts64.c @@ -0,0 +1,30 @@ +/* File tree traversal functions LFS version. + Copyright (C) 2015-2016 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, see + <http://www.gnu.org/licenses/>. */ + +#define FTS_OPEN fts64_open +#define FTS_CLOSE fts64_close +#define FTS_READ fts64_read +#define FTS_SET fts64_set +#define FTS_CHILDREN fts64_children +#define FTSOBJ FTS64 +#define FTSENTRY FTSENT64 +#define INO_T ino64_t +#define STAT stat64 +#define LSTAT lstat64 + +#include "fts.c" @@ -1,5 +1,5 @@ /* File tree walker functions. - Copyright (C) 1996-2015 Free Software Foundation, Inc. + Copyright (C) 1996-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. @@ -817,21 +817,14 @@ ftw_startup (const char *dir, int is_nftw, void *func, int descriptors, /* Entry points. */ int -FTW_NAME (path, func, descriptors) - const char *path; - FTW_FUNC_T func; - int descriptors; +FTW_NAME (const char *path, FTW_FUNC_T func, int descriptors) { return ftw_startup (path, 0, func, descriptors, 0); } #ifndef _LIBC int -NFTW_NAME (path, func, descriptors, flags) - const char *path; - NFTW_FUNC_T func; - int descriptors; - int flags; +NFTW_NAME (const char *path, NFTW_FUNC_T func, int descriptors, int flags) { return ftw_startup (path, 1, func, descriptors, flags); } @@ -842,11 +835,7 @@ NFTW_NAME (path, func, descriptors, flags) int NFTW_NEW_NAME (const char *, NFTW_FUNC_T, int, int); int -NFTW_NEW_NAME (path, func, descriptors, flags) - const char *path; - NFTW_FUNC_T func; - int descriptors; - int flags; +NFTW_NEW_NAME (const char *path, NFTW_FUNC_T func, int descriptors, int flags) { if (flags & ~(FTW_PHYS | FTW_MOUNT | FTW_CHDIR | FTW_DEPTH | FTW_ACTIONRETVAL)) @@ -867,11 +856,7 @@ int NFTW_OLD_NAME (const char *, NFTW_FUNC_T, int, int); int attribute_compat_text_section -NFTW_OLD_NAME (path, func, descriptors, flags) - const char *path; - NFTW_FUNC_T func; - int descriptors; - int flags; +NFTW_OLD_NAME (const char *path, NFTW_FUNC_T func, int descriptors, int flags) { flags &= (FTW_PHYS | FTW_MOUNT | FTW_CHDIR | FTW_DEPTH); return ftw_startup (path, 1, func, descriptors, flags); @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2015 Free Software Foundation, Inc. +/* Copyright (C) 1992-2016 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 diff --git a/io/ftw64.c b/io/ftw64.c index 642a346163..016c25862b 100644 --- a/io/ftw64.c +++ b/io/ftw64.c @@ -1,5 +1,5 @@ /* File tree walker functions. LFS version. - Copyright (C) 1996-2015 Free Software Foundation, Inc. + Copyright (C) 1996-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. diff --git a/io/ftwtest-sh b/io/ftwtest-sh index 478171db78..db8435ab5a 100644 --- a/io/ftwtest-sh +++ b/io/ftwtest-sh @@ -1,6 +1,6 @@ -#! /bin/sh +#!/bin/sh # Test for nftw(3). -# Copyright (C) 1997-2015 Free Software Foundation, Inc. +# Copyright (C) 1997-2016 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 @@ -45,7 +45,7 @@ export LC_ALL tmp=${objpfx}io tmpdir=$tmp/ftwtest.d -trap 'chmod -fR a+x $tmpdir; rm -fr $tmpdir $testout' 1 2 3 15 +trap 'chmod -fR a+x $tmpdir; rm -fr $tmpdir $testout' 0 1 2 3 15 if test -d $tmpdir; then chmod -fR a+x $tmpdir @@ -135,7 +135,7 @@ $testprogram --chdir $tmpdir | sort > $testout # perhaps $tmp involves some symlinks... -tmpreal=`cd $tmp; /bin/pwd 2>/dev/null || /usr/bin/pwd` +tmpreal=`cd $tmp; pwd -P 2>/dev/null` cat <<EOF | cmp $testout - || exit 1 base = "$tmp/", file = "ftwtest.d", flag = FTW_D, cwd = $tmpreal, level = 0 @@ -153,7 +153,7 @@ base = "$tmp/ftwtest.d/foo/lvl1/lvl2/lvl3/", file = "file@3", flag = FTW_F, cwd EOF rm $testout -curwd=`/bin/pwd 2>/dev/null || /usr/bin/pwd` +curwd=`pwd -P 2>/dev/null` cd "$tmp" $testprogram --chdir ftwtest.d | sort > $testout @@ -175,7 +175,7 @@ base = "ftwtest.d/foo/lvl1/lvl2/lvl3/", file = "file@3", flag = FTW_F, cwd = $tm EOF rm $testout -curwd=`/bin/pwd 2>/dev/null || /usr/bin/pwd` +curwd=`pwd -P` cd "$tmp" $testprogram --chdir ftwtest.d/. | sort > $testout @@ -197,7 +197,7 @@ base = "ftwtest.d/./foo/lvl1/lvl2/lvl3/", file = "file@3", flag = FTW_F, cwd = $ EOF rm $testout -curwd=`/bin/pwd 2>/dev/null || /usr/bin/pwd` +curwd=`pwd -P 2>/dev/null` cd "$tmp" $testprogram --chdir ftwtest.d/foo/lvl1/link@1 | sort > $testout @@ -296,4 +296,6 @@ rm $testout rm -fr $tmpdir +trap '' 0 + exit 0 diff --git a/io/futimens.c b/io/futimens.c index cda95a8cfe..80465ac2df 100644 --- a/io/futimens.c +++ b/io/futimens.c @@ -1,5 +1,5 @@ /* Change access and modification times of open file. Linux version. - Copyright (C) 2007-2015 Free Software Foundation, Inc. + Copyright (C) 2007-2016 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 diff --git a/io/fxstat.c b/io/fxstat.c index c91eac5a2d..0e07d48a12 100644 --- a/io/fxstat.c +++ b/io/fxstat.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 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 diff --git a/io/fxstat64.c b/io/fxstat64.c index 31ace24c0b..5e1632ced2 100644 --- a/io/fxstat64.c +++ b/io/fxstat64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 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 diff --git a/io/fxstatat.c b/io/fxstatat.c index fbf74d3c7e..3d71896d81 100644 --- a/io/fxstatat.c +++ b/io/fxstatat.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2005-2015 Free Software Foundation, Inc. +/* Copyright (C) 2005-2016 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 diff --git a/io/fxstatat64.c b/io/fxstatat64.c index 3faf88b50f..ce36159195 100644 --- a/io/fxstatat64.c +++ b/io/fxstatat64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2005-2015 Free Software Foundation, Inc. +/* Copyright (C) 2005-2016 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 diff --git a/io/getcwd.c b/io/getcwd.c index c6d0443f17..c402ca7484 100644 --- a/io/getcwd.c +++ b/io/getcwd.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 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 diff --git a/io/getdirname.c b/io/getdirname.c index 9e334de98c..2152623c1e 100644 --- a/io/getdirname.c +++ b/io/getdirname.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2015 Free Software Foundation, Inc. +/* Copyright (C) 1992-2016 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 diff --git a/io/getwd.c b/io/getwd.c index bbda67c6e2..090bda4362 100644 --- a/io/getwd.c +++ b/io/getwd.c @@ -1,5 +1,5 @@ /* Obsolete function to get current working directory. - Copyright (C) 1991-2015 Free Software Foundation, Inc. + Copyright (C) 1991-2016 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 @@ -23,8 +23,7 @@ char * -getwd (buf) - char *buf; +getwd (char *buf) { #ifndef PATH_MAX #define PATH_MAX 1024 diff --git a/io/have_o_cloexec.c b/io/have_o_cloexec.c index 0b61a44859..30f79ac40c 100644 --- a/io/have_o_cloexec.c +++ b/io/have_o_cloexec.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2007-2015 Free Software Foundation, Inc. +/* Copyright (C) 2007-2016 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 diff --git a/io/isatty.c b/io/isatty.c index ea68464d2b..3f8e3fd5cc 100644 --- a/io/isatty.c +++ b/io/isatty.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 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 @@ -20,8 +20,7 @@ /* Return 1 if FD is a terminal, 0 if not. */ int -__isatty (fd) - int fd; +__isatty (int fd) { __set_errno (ENOSYS); return -1; diff --git a/io/lchmod.c b/io/lchmod.c index a4a9ca8555..ea34e8a3c9 100644 --- a/io/lchmod.c +++ b/io/lchmod.c @@ -1,5 +1,5 @@ /* lchmod -- Change the protections of a file or symbolic link. Stub version. - Copyright (C) 2002-2015 Free Software Foundation, Inc. + Copyright (C) 2002-2016 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 diff --git a/io/lchown.c b/io/lchown.c index eceaf62ad2..3594900c3f 100644 --- a/io/lchown.c +++ b/io/lchown.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2015 Free Software Foundation, Inc. +/* Copyright (C) 1996-2016 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 @@ -22,10 +22,7 @@ /* Change the owner and group of FILE. */ int -__lchown (file, owner, group) - const char *file; - uid_t owner; - gid_t group; +__lchown (const char *file, uid_t owner, gid_t group) { if (file == NULL) { @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 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 @@ -22,9 +22,7 @@ /* Make a link to FROM called TO. */ int -__link (from, to) - const char *from; - const char *to; +__link (const char *from, const char *to) { if (from == NULL || to == NULL) { diff --git a/io/linkat.c b/io/linkat.c index b999f24d73..8db993d431 100644 --- a/io/linkat.c +++ b/io/linkat.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2005-2015 Free Software Foundation, Inc. +/* Copyright (C) 2005-2016 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 @@ -23,12 +23,7 @@ /* 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; +linkat (int fromfd, const char *from, int tofd, const char *to, int flags) { if (from == NULL || to == NULL) { diff --git a/io/lockf.c b/io/lockf.c index 6a10bf2830..0d3d19d020 100644 --- a/io/lockf.c +++ b/io/lockf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1994-2015 Free Software Foundation, Inc. +/* Copyright (C) 1994-2016 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 diff --git a/io/lockf64.c b/io/lockf64.c index 131b0703d5..229e2619c0 100644 --- a/io/lockf64.c +++ b/io/lockf64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1994-2015 Free Software Foundation, Inc. +/* Copyright (C) 1994-2016 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 diff --git a/io/lseek.c b/io/lseek.c index ac90483862..21948ecfbe 100644 --- a/io/lseek.c +++ b/io/lseek.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 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 @@ -21,10 +21,7 @@ /* Seek to OFFSET on FD, starting from WHENCE. */ off_t -__libc_lseek (fd, offset, whence) - int fd; - off_t offset; - int whence; +__libc_lseek (int fd, off_t offset, int whence) { if (fd < 0) { diff --git a/io/lseek64.c b/io/lseek64.c index dab4d5daea..1152bd0302 100644 --- a/io/lseek64.c +++ b/io/lseek64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 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 diff --git a/io/lstat.c b/io/lstat.c index 17557086bc..cfd94db512 100644 --- a/io/lstat.c +++ b/io/lstat.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2015 Free Software Foundation, Inc. +/* Copyright (C) 1996-2016 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 diff --git a/io/lstat64.c b/io/lstat64.c index e159600eb6..64df63b86e 100644 --- a/io/lstat64.c +++ b/io/lstat64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2015 Free Software Foundation, Inc. +/* Copyright (C) 1996-2016 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 diff --git a/io/lxstat.c b/io/lxstat.c index e83672f9ab..e08ba3cf6f 100644 --- a/io/lxstat.c +++ b/io/lxstat.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 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 diff --git a/io/lxstat64.c b/io/lxstat64.c index 4083c2519d..cecf658c34 100644 --- a/io/lxstat64.c +++ b/io/lxstat64.c @@ -1,5 +1,5 @@ /* lxstat64 -- get file metadata, not following symlinks. Stub version. - Copyright (C) 1991-2015 Free Software Foundation, Inc. + Copyright (C) 1991-2016 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 diff --git a/io/mkdir.c b/io/mkdir.c index e1dfe8400e..b6f84f1ac2 100644 --- a/io/mkdir.c +++ b/io/mkdir.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 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 @@ -23,9 +23,7 @@ /* Create a directory named PATH with protections MODE. */ int -__mkdir (path, mode) - const char *path; - mode_t mode; +__mkdir (const char *path, mode_t mode) { if (path == NULL) { diff --git a/io/mkdirat.c b/io/mkdirat.c index 7ba3145d1b..3d74b7e2c7 100644 --- a/io/mkdirat.c +++ b/io/mkdirat.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 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,10 +24,7 @@ /* Create a directory named PATH relative to FD with protections MODE. */ int -mkdirat (fd, path, mode) - int fd; - const char *path; - mode_t mode; +mkdirat (int fd, const char *path, mode_t mode) { if (path == NULL) { diff --git a/io/mkfifo.c b/io/mkfifo.c index fddd6c97b8..1d439e7529 100644 --- a/io/mkfifo.c +++ b/io/mkfifo.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 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 @@ -23,9 +23,7 @@ /* Create a named pipe (FIFO) named PATH with protections MODE. */ int -mkfifo (path, mode) - const char *path; - mode_t mode; +mkfifo (const char *path, mode_t mode) { if (path == NULL) { diff --git a/io/mkfifoat.c b/io/mkfifoat.c index 311e0097b0..5ef500ee4f 100644 --- a/io/mkfifoat.c +++ b/io/mkfifoat.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -25,10 +25,7 @@ /* 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; +mkfifoat (int fd, const char *path, mode_t mode) { if (path == NULL) { diff --git a/io/mknod.c b/io/mknod.c index 1f185cd410..574366d242 100644 --- a/io/mknod.c +++ b/io/mknod.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995-2015 Free Software Foundation, Inc. +/* Copyright (C) 1995-2016 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 diff --git a/io/mknodat.c b/io/mknodat.c index 80285e7732..9839d70a6b 100644 --- a/io/mknodat.c +++ b/io/mknodat.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995-2015 Free Software Foundation, Inc. +/* Copyright (C) 1995-2016 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 @@ -1,5 +1,5 @@ /* Open a file by name. Stub version. - Copyright (C) 1991-2015 Free Software Foundation, Inc. + Copyright (C) 1991-2016 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,9 +26,7 @@ /* Open FILE with access OFLAG. If O_CREAT or O_TMPFILE is in OFLAG, a third argument is the file protection. */ int -__libc_open (file, oflag) - const char *file; - int oflag; +__libc_open (const char *file, int oflag) { int mode; diff --git a/io/open64.c b/io/open64.c index f87ee57099..438ba47c1c 100644 --- a/io/open64.c +++ b/io/open64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 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,9 +24,7 @@ /* Open FILE with access OFLAG. If O_CREAT or O_TMPFILE is in OFLAG, a third argument is the file protection. */ int -__libc_open64 (file, oflag) - const char *file; - int oflag; +__libc_open64 (const char *file, int oflag) { int mode; diff --git a/io/open64_2.c b/io/open64_2.c index 0fd562dc0f..957fd8c6d9 100644 --- a/io/open64_2.c +++ b/io/open64_2.c @@ -1,5 +1,5 @@ /* _FORTIFY_SOURCE wrapper for open64. - Copyright (C) 2013-2015 Free Software Foundation, Inc. + Copyright (C) 2013-2016 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 diff --git a/io/open_2.c b/io/open_2.c index f11ebe00bb..4168c117f4 100644 --- a/io/open_2.c +++ b/io/open_2.c @@ -1,5 +1,5 @@ /* _FORTIFY_SOURCE wrapper for open. - Copyright (C) 2013-2015 Free Software Foundation, Inc. + Copyright (C) 2013-2016 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 diff --git a/io/openat.c b/io/openat.c index 08d61843fa..c7714a99f4 100644 --- a/io/openat.c +++ b/io/openat.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2005-2015 Free Software Foundation, Inc. +/* Copyright (C) 2005-2016 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 diff --git a/io/openat64.c b/io/openat64.c index 060fdf9045..1557818170 100644 --- a/io/openat64.c +++ b/io/openat64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2005-2015 Free Software Foundation, Inc. +/* Copyright (C) 2005-2016 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 diff --git a/io/openat64_2.c b/io/openat64_2.c index 8548c3d557..533391fc0c 100644 --- a/io/openat64_2.c +++ b/io/openat64_2.c @@ -1,5 +1,5 @@ /* _FORTIFY_SOURCE wrapper for openat64. - Copyright (C) 2013-2015 Free Software Foundation, Inc. + Copyright (C) 2013-2016 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 diff --git a/io/openat_2.c b/io/openat_2.c index 54a98bece8..c4f2f755a4 100644 --- a/io/openat_2.c +++ b/io/openat_2.c @@ -1,5 +1,5 @@ /* _FORTIFY_SOURCE wrapper for openat. - Copyright (C) 2013-2015 Free Software Foundation, Inc. + Copyright (C) 2013-2016 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 @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 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,8 +24,7 @@ bytes written on PIPEDES[1] can be read from PIPEDES[0]. Returns 0 if successful, -1 if not. */ int -__pipe (__pipedes) - int __pipedes[2]; +__pipe (int __pipedes[2]) { if (__pipedes == NULL) { diff --git a/io/pipe2.c b/io/pipe2.c index d06ed7af9f..5949ef5c89 100644 --- a/io/pipe2.c +++ b/io/pipe2.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 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,9 +24,7 @@ PIPEDES[1] can be read from PIPEDES[0]. Apply FLAGS to the new file descriptors. Returns 0 if successful, -1 if not. */ int -__pipe2 (pipedes, flags) - int pipedes[2]; - int flags; +__pipe2 (int pipedes[2], int flags) { if (pipedes == NULL) { @@ -1,5 +1,5 @@ /* Poll (or wait) for file descriptor I/O availability. Stub version. - Copyright (C) 1994-2015 Free Software Foundation, Inc. + Copyright (C) 1994-2016 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 diff --git a/io/posix_fadvise.c b/io/posix_fadvise.c index 9205c6799d..caec5f960c 100644 --- a/io/posix_fadvise.c +++ b/io/posix_fadvise.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2015 Free Software Foundation, Inc. +/* Copyright (C) 2000-2016 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 diff --git a/io/posix_fadvise64.c b/io/posix_fadvise64.c index 50cd39af6b..76bdab450d 100644 --- a/io/posix_fadvise64.c +++ b/io/posix_fadvise64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2015 Free Software Foundation, Inc. +/* Copyright (C) 2000-2016 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 diff --git a/io/posix_fallocate.c b/io/posix_fallocate.c index 8eefc625fc..317ebc0b43 100644 --- a/io/posix_fallocate.c +++ b/io/posix_fallocate.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2015 Free Software Foundation, Inc. +/* Copyright (C) 2000-2016 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 diff --git a/io/posix_fallocate64.c b/io/posix_fallocate64.c index 05922d16e6..e99f9014e0 100644 --- a/io/posix_fallocate64.c +++ b/io/posix_fallocate64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2015 Free Software Foundation, Inc. +/* Copyright (C) 2000-2016 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 diff --git a/io/ppoll.c b/io/ppoll.c index f64c737913..3e8ad612ae 100644 --- a/io/ppoll.c +++ b/io/ppoll.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2006-2015 Free Software Foundation, Inc. +/* Copyright (C) 2006-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2006. @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 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 @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 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 diff --git a/io/readlink.c b/io/readlink.c index 4516e6401c..48590acb40 100644 --- a/io/readlink.c +++ b/io/readlink.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 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 @@ -22,10 +22,7 @@ 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; +__readlink (const char *path, char *buf, size_t len) { __set_errno (ENOSYS); return -1; diff --git a/io/readlinkat.c b/io/readlinkat.c index 63b48ea1fe..c955aba604 100644 --- a/io/readlinkat.c +++ b/io/readlinkat.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2005-2015 Free Software Foundation, Inc. +/* Copyright (C) 2005-2016 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 @@ -23,11 +23,7 @@ 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; +readlinkat (int fd, const char *path, char *buf, size_t len) { if (path == NULL) { diff --git a/io/rmdir.c b/io/rmdir.c index f4ad1662b5..c73dd702a4 100644 --- a/io/rmdir.c +++ b/io/rmdir.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 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 @@ -22,8 +22,7 @@ /* Remove the directory PATH. */ int -__rmdir (path) - const char *path; +__rmdir (const char *path) { if (path == NULL) { diff --git a/io/sendfile.c b/io/sendfile.c index 22a0d134b8..29ff4a2b30 100644 --- a/io/sendfile.c +++ b/io/sendfile.c @@ -1,5 +1,5 @@ /* sendfile -- copy data directly from one file descriptor to another - Copyright (C) 2002-2015 Free Software Foundation, Inc. + Copyright (C) 2002-2016 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 diff --git a/io/sendfile64.c b/io/sendfile64.c index 7126eca0f8..31e0e4b060 100644 --- a/io/sendfile64.c +++ b/io/sendfile64.c @@ -1,5 +1,5 @@ /* sendfile -- copy data directly from one file descriptor to another - Copyright (C) 2002-2015 Free Software Foundation, Inc. + Copyright (C) 2002-2016 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 @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2015 Free Software Foundation, Inc. +/* Copyright (C) 1996-2016 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 diff --git a/io/stat64.c b/io/stat64.c index 2bcb8f09c9..59ad8ee481 100644 --- a/io/stat64.c +++ b/io/stat64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2015 Free Software Foundation, Inc. +/* Copyright (C) 1996-2016 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 diff --git a/io/statfs.c b/io/statfs.c index fbad09fc10..040cee8b8b 100644 --- a/io/statfs.c +++ b/io/statfs.c @@ -1,5 +1,5 @@ /* statfs -- Return information about the filesystem on which FILE resides. - Copyright (C) 1996-2015 Free Software Foundation, Inc. + Copyright (C) 1996-2016 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 diff --git a/io/statfs64.c b/io/statfs64.c index 8a893e800f..1beda66436 100644 --- a/io/statfs64.c +++ b/io/statfs64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998-2015 Free Software Foundation, Inc. +/* Copyright (C) 1998-2016 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 diff --git a/io/statvfs.c b/io/statvfs.c index a3f210bb12..b55bac5636 100644 --- a/io/statvfs.c +++ b/io/statvfs.c @@ -1,5 +1,5 @@ /* Return information about the filesystem on which FILE resides. - Copyright (C) 1998-2015 Free Software Foundation, Inc. + Copyright (C) 1998-2016 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 diff --git a/io/statvfs64.c b/io/statvfs64.c index c2203e2ba0..671ad0e44c 100644 --- a/io/statvfs64.c +++ b/io/statvfs64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998-2015 Free Software Foundation, Inc. +/* Copyright (C) 1998-2016 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 diff --git a/io/symlink.c b/io/symlink.c index 77d1203007..f3134914de 100644 --- a/io/symlink.c +++ b/io/symlink.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 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 @@ -22,9 +22,7 @@ /* Make a link to FROM called TO. */ int -__symlink (from, to) - const char *from; - const char *to; +__symlink (const char *from, const char *to) { if (from == NULL || to == NULL) { diff --git a/io/symlinkat.c b/io/symlinkat.c index 0c8747d3c2..240c9fcc43 100644 --- a/io/symlinkat.c +++ b/io/symlinkat.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2005-2015 Free Software Foundation, Inc. +/* Copyright (C) 2005-2016 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 @@ -23,10 +23,7 @@ /* Make a link to FROM called TO relative to FD. */ int -symlinkat (from, fd, to) - const char *from; - int fd; - const char *to; +symlinkat (const char *from, int fd, const char *to) { if (from == NULL || to == NULL) { diff --git a/io/sys/poll.h b/io/sys/poll.h index dc097daa29..e751860acd 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-2015 Free Software Foundation, Inc. + Copyright (C) 1994-2016 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 diff --git a/io/sys/sendfile.h b/io/sys/sendfile.h index 1d2a698817..d4c14bacde 100644 --- a/io/sys/sendfile.h +++ b/io/sys/sendfile.h @@ -1,5 +1,5 @@ /* sendfile -- copy data directly from one file descriptor to another - Copyright (C) 1998-2015 Free Software Foundation, Inc. + Copyright (C) 1998-2016 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 diff --git a/io/sys/stat.h b/io/sys/stat.h index 5c571a921e..bf63882c7e 100644 --- a/io/sys/stat.h +++ b/io/sys/stat.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 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 diff --git a/io/sys/statfs.h b/io/sys/statfs.h index 531b44b3dd..69a228d0fb 100644 --- a/io/sys/statfs.h +++ b/io/sys/statfs.h @@ -1,5 +1,5 @@ /* Definitions for getting information about a filesystem. - Copyright (C) 1996-2015 Free Software Foundation, Inc. + Copyright (C) 1996-2016 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 diff --git a/io/sys/statvfs.h b/io/sys/statvfs.h index 175badcb97..5d96652ac1 100644 --- a/io/sys/statvfs.h +++ b/io/sys/statvfs.h @@ -1,5 +1,5 @@ /* Definitions for getting information about a filesystem. - Copyright (C) 1998-2015 Free Software Foundation, Inc. + Copyright (C) 1998-2016 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 diff --git a/io/test-lfs.c b/io/test-lfs.c index 539c2a2b14..3088a21fd8 100644 --- a/io/test-lfs.c +++ b/io/test-lfs.c @@ -1,5 +1,5 @@ /* Some basic tests for LFS. - Copyright (C) 2000-2015 Free Software Foundation, Inc. + Copyright (C) 2000-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Andreas Jaeger <aj@suse.de>, 2000. @@ -56,7 +56,6 @@ do_prepare (int argc, char *argv[]) name = malloc (name_len + sizeof ("/lfsXXXXXX")); mempcpy (mempcpy (name, test_dir, name_len), "/lfsXXXXXX", sizeof ("/lfsXXXXXX")); - add_temp_file (name); /* Open our test file. */ fd = mkstemp64 (name); @@ -71,6 +70,7 @@ do_prepare (int argc, char *argv[]) else error (EXIT_FAILURE, errno, "cannot create temporary file"); } + add_temp_file (name); if (getrlimit64 (RLIMIT_FSIZE, &rlim) != 0) { @@ -144,7 +144,7 @@ test_ftello (void) int do_test (int argc, char *argv[]) { - int ret; + int ret, fd2; struct stat64 statbuf; ret = lseek64 (fd, TWO_GB+100, SEEK_SET); @@ -195,6 +195,25 @@ do_test (int argc, char *argv[]) error (EXIT_FAILURE, 0, "stat reported size %lld instead of %lld.", (long long int) statbuf.st_size, (TWO_GB + 100 + 5)); + fd2 = openat64 (AT_FDCWD, name, O_RDWR); + if (fd2 == -1) + { + if (errno == ENOSYS) + { + /* Silently ignore this test. */ + error (0, 0, "openat64 is not supported"); + } + else + error (EXIT_FAILURE, errno, "openat64 failed to open big file"); + } + else + { + ret = close (fd2); + + if (ret == -1) + error (EXIT_FAILURE, errno, "error closing file"); + } + test_ftello (); return 0; diff --git a/io/test-stat.c b/io/test-stat.c index a58e1b2868..9d8e6b63ba 100644 --- a/io/test-stat.c +++ b/io/test-stat.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2015 Free Software Foundation, Inc. +/* Copyright (C) 2000-2016 Free Software Foundation, Inc. Contributed by Maciej W. Rozycki <macro@ds2.pg.gda.pl>, 2000. This file is part of the GNU C Library. diff --git a/io/test-stat2.c b/io/test-stat2.c index d2b7f25328..f62f5c1ee0 100644 --- a/io/test-stat2.c +++ b/io/test-stat2.c @@ -1,5 +1,5 @@ /* Test consistence of results of stat and stat64. - Copyright (C) 2000-2015 Free Software Foundation, Inc. + Copyright (C) 2000-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2000. diff --git a/io/test-utime.c b/io/test-utime.c index 085926cb08..d8d2390757 100644 --- a/io/test-utime.c +++ b/io/test-utime.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1994-2015 Free Software Foundation, Inc. +/* Copyright (C) 1994-2016 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 diff --git a/io/tst-fcntl.c b/io/tst-fcntl.c index dfdb42eea4..98a642e5fc 100644 --- a/io/tst-fcntl.c +++ b/io/tst-fcntl.c @@ -1,5 +1,5 @@ /* Tests for fcntl. - Copyright (C) 2000-2015 Free Software Foundation, Inc. + Copyright (C) 2000-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 2000. @@ -38,6 +38,9 @@ extern int do_test (int argc, char *argv[]); /* Name of the temporary files. */ static char *name; +/* File descriptor to temporary file. */ +static int fd; + void do_prepare (int argc, char *argv[]) { @@ -47,6 +50,13 @@ do_prepare (int argc, char *argv[]) name = malloc (name_len + sizeof ("/fcntlXXXXXX")); mempcpy (mempcpy (name, test_dir, name_len), "/fcntlXXXXXX", sizeof ("/fcntlXXXXXX")); + /* Create the temporary file. */ + fd = mkstemp (name); + if (fd == -1) + { + printf ("cannot open temporary file: %m\n"); + exit (1); + } add_temp_file (name); } @@ -54,20 +64,12 @@ do_prepare (int argc, char *argv[]) int do_test (int argc, char *argv[]) { - int fd; int fd2; int fd3; struct stat64 st; int val; int result = 0; - /* Create the temporary file. */ - fd = mkstemp (name); - if (fd == -1) - { - printf ("cannot open temporary file: %m\n"); - return 1; - } if (fstat64 (fd, &st) != 0) { printf ("cannot stat test file: %m\n"); diff --git a/io/tst-fts-lfs.c b/io/tst-fts-lfs.c new file mode 100644 index 0000000000..bc169342f8 --- /dev/null +++ b/io/tst-fts-lfs.c @@ -0,0 +1,2 @@ +#define _FILE_OFFSET_BITS 64 +#include "tst-fts.c" diff --git a/io/tst-fts.c b/io/tst-fts.c new file mode 100644 index 0000000000..b7d77143f4 --- /dev/null +++ b/io/tst-fts.c @@ -0,0 +1,231 @@ +/* Simple test for some fts functions. + Copyright (C) 2015-2016 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, see + <http://www.gnu.org/licenses/>. */ + +#include <sys/types.h> +#include <sys/stat.h> +#include <fts.h> + +#include <errno.h> +#include <error.h> +#include <string.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + +static void prepare (void); +static int do_test (void); +#define PREPARE(argc, argv) prepare () +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" + +static char *fts_test_dir; + +static void +make_dir (const char *dirname) +{ + char *name; + if (asprintf (&name, "%s/%s", fts_test_dir, dirname) < 0) + { + puts ("out of memory"); + exit (1); + } + + if (mkdir (name, 0700) < 0) + { + printf ("cannot create dir \"%s\": %m\n", name); + exit (1); + } + + add_temp_file (name); +} + +static void +make_file (const char *filename) +{ + char *name; + if (asprintf (&name, "%s/%s", fts_test_dir, filename) < 0) + { + puts ("out of memory"); + exit (1); + } + + int fd = open (name, O_WRONLY | O_CREAT | O_EXCL, 0600); + if (fd < 0) + { + printf ("cannot create file \"%s\": %m\n", name); + exit (1); + } + close (fd); + + add_temp_file (name); +} + +static void +prepare (void) +{ + char *dirbuf; + char dir_name[] = "/tst-fts.XXXXXX"; + + if (asprintf (&dirbuf, "%s%s", test_dir, dir_name) < 0) + { + puts ("out of memory"); + exit (1); + } + + if (mkdtemp (dirbuf) == NULL) + { + puts ("cannot create temporary directory"); + exit (1); + } + + add_temp_file (dirbuf); + fts_test_dir = dirbuf; + + make_file ("12"); + make_file ("345"); + make_file ("6789"); + + make_dir ("aaa"); + make_file ("aaa/1234"); + make_file ("aaa/5678"); + + make_dir ("bbb"); + make_file ("bbb/1234"); + make_file ("bbb/5678"); + make_file ("bbb/90ab"); +} + +/* Largest name wins, otherwise strcmp. */ +static int +compare_ents (const FTSENT **ent1, const FTSENT **ent2) +{ + short len1 = (*ent1)->fts_namelen; + short len2 = (*ent2)->fts_namelen; + if (len1 != len2) + return len1 - len2; + else + { + const char *name1 = (*ent1)->fts_name; + const char *name2 = (*ent2)->fts_name; + return strcmp (name1, name2); + } +} + +/* Count the number of files seen as children. */ +static int files = 0; + +static void +children (FTS *fts) +{ + FTSENT *child = fts_children (fts, 0); + if (child == NULL && errno != 0) + { + printf ("FAIL: fts_children: %m\n"); + exit (1); + } + + while (child != NULL) + { + short level = child->fts_level; + const char *name = child->fts_name; + if (child->fts_info == FTS_F || child->fts_info == FTS_NSOK) + { + files++; + printf ("%*s%s\n", 2 * level, "", name); + } + child = child->fts_link; + } +} + +/* Count the number of dirs seen in the test. */ +static int dirs = 0; + +static int +do_test (void) +{ + char *paths[2] = { fts_test_dir, NULL }; + FTS *fts; + fts = fts_open (paths, FTS_LOGICAL, &compare_ents); + if (fts == NULL) + { + printf ("FAIL: fts_open: %m\n"); + exit (1); + } + + FTSENT *ent; + while ((ent = fts_read (fts)) != NULL) + { + const char *name = ent->fts_name; + short level = ent->fts_level; + switch (ent->fts_info) + { + case FTS_F: + /* Don't show anything, children will have on parent dir. */ + break; + + case FTS_D: + printf ("%*s%s =>\n", 2 * level, "", name); + children (fts); + break; + + case FTS_DP: + dirs++; + printf ("%*s<= %s\n", 2 * level, "", name); + break; + + case FTS_NS: + case FTS_ERR: + printf ("FAIL: fts_read ent: %s\n", strerror (ent->fts_errno)); + exit (1); + break; + + default: + printf ("FAIL: unexpected fts_read ent %s\n", name); + exit (1); + break; + } + } + /* fts_read returns NULL when done (and clears errno) + or when an error occured (with errno set). */ + if (errno != 0) + { + printf ("FAIL: fts_read: %m\n"); + exit (1); + } + + if (fts_close (fts) != 0) + { + printf ("FAIL: fts_close: %m\n"); + exit (1); + } + + if (files != 8) + { + printf ("FAIL: Unexpected number of files: %d\n", files); + return 1; + } + + if (dirs != 3) + { + printf ("FAIL: Unexpected number of dirs: %d\n", dirs); + return 1; + } + + puts ("PASS"); + return 0; +} diff --git a/io/tst-getcwd.c b/io/tst-getcwd.c index 858d7ba4dd..ab15b2b0bc 100644 --- a/io/tst-getcwd.c +++ b/io/tst-getcwd.c @@ -1,5 +1,5 @@ /* Test of getcwd function. - Copyright (C) 2000-2015 Free Software Foundation, Inc. + Copyright (C) 2000-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 2000. diff --git a/io/ttyname.c b/io/ttyname.c index 6332d29916..cc7adda415 100644 --- a/io/ttyname.c +++ b/io/ttyname.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -25,8 +25,7 @@ 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; +ttyname (int fd) { __set_errno (ENOSYS); return NULL; diff --git a/io/ttyname_r.c b/io/ttyname_r.c index 50dbd67467..6462b1ff87 100644 --- a/io/ttyname_r.c +++ b/io/ttyname_r.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 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 @@ -22,10 +22,7 @@ /* 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; +__ttyname_r (int fd, char *buf, size_t buflen) { __set_errno (ENOSYS); return ENOSYS; diff --git a/io/umask.c b/io/umask.c index 2afb8372c3..9cf0514b94 100644 --- a/io/umask.c +++ b/io/umask.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 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 @@ -21,8 +21,7 @@ /* Set the file creation mask to MASK, returning the old mask. */ mode_t -__umask (mask) - mode_t mask; +__umask (mode_t mask) { __set_errno (ENOSYS); return -1; diff --git a/io/unlink.c b/io/unlink.c index 65ec5c66ca..5dbcf92874 100644 --- a/io/unlink.c +++ b/io/unlink.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 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 @@ -22,8 +22,7 @@ /* Remove the link named NAME. */ int -__unlink (name) - const char *name; +__unlink (const char *name) { if (name == NULL) { diff --git a/io/unlinkat.c b/io/unlinkat.c index 9122d73c41..a5ecc0dce1 100644 --- a/io/unlinkat.c +++ b/io/unlinkat.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2005-2015 Free Software Foundation, Inc. +/* Copyright (C) 2005-2016 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 @@ -23,10 +23,7 @@ /* Remove the link named NAME. */ int -unlinkat (fd, name, flag) - int fd; - const char *name; - int flag; +unlinkat (int fd, const char *name, int flag) { if (name == NULL || (flag & AT_REMOVEDIR) != 0) { diff --git a/io/utime.c b/io/utime.c index 830d3414e9..c7b7cfeae8 100644 --- a/io/utime.c +++ b/io/utime.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 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 @@ -23,9 +23,7 @@ /* 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; +utime (const char *file, const struct utimbuf *times) { if (file == NULL) { diff --git a/io/utime.h b/io/utime.h index 9fbfc193aa..3cc0d5e99d 100644 --- a/io/utime.h +++ b/io/utime.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 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 diff --git a/io/utimensat.c b/io/utimensat.c index 7c878da984..bc7341f84e 100644 --- a/io/utimensat.c +++ b/io/utimensat.c @@ -1,5 +1,5 @@ /* Change access and modification times of open file. Stub version. - Copyright (C) 2007-2015 Free Software Foundation, Inc. + Copyright (C) 2007-2016 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 diff --git a/io/write.c b/io/write.c index 2bc8662364..0e1c109064 100644 --- a/io/write.c +++ b/io/write.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 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 diff --git a/io/xmknod.c b/io/xmknod.c index e5dd951c2e..9f82c0b089 100644 --- a/io/xmknod.c +++ b/io/xmknod.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 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 diff --git a/io/xmknodat.c b/io/xmknodat.c index e92817e3d2..3c2e04ddb1 100644 --- a/io/xmknodat.c +++ b/io/xmknodat.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2005-2015 Free Software Foundation, Inc. +/* Copyright (C) 2005-2016 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 diff --git a/io/xstat.c b/io/xstat.c index 03c6edeb2b..80ed0b87f7 100644 --- a/io/xstat.c +++ b/io/xstat.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 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 diff --git a/io/xstat64.c b/io/xstat64.c index 3ef4c42a50..4e09392461 100644 --- a/io/xstat64.c +++ b/io/xstat64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 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 |