From a5f4e34a264b7cd296f8ca890ca4eaa1d0f99317 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Mon, 10 Aug 1998 15:54:54 +0000 Subject: Update. 1998-08-10 15:49 Ulrich Drepper * include/dirent.h: Protect from double inclusion. 1998-08-09 Mark Kettenis * posix/glob.h: Add LFS support for glob and globfree. * posix/Versions [GLIBC_2.1]: Add glob64 and globfree64. * posix/Makefile (routines): Add glob64. * sysdeps/generic/glob64.c: New file. * sysdeps/unix/sysv/linux/glob64.c: New file. * sysdeps/unix/sysv/linux/alpha/glob64.c: New file. * sysdeps/unix/sysv/linux/sparc/sparc64/glob64.c: New file. * sysdeps/generic/glob.c [_LIBC && glob] (__glob_pattern_p): Elide function. * sysdeps/unix/sysv/linux/alpha/glob.c: Add glob64 as a weak alias for __new_glob. Likewise for globfree64. * sysdeps/unix/sysv/linux/sparc/sparc64/glob.c: New file. 1998-08-09 Andreas Schwab * sysdeps/unix/Makefile ($(common-objpfx)s-proto.d): Remove -include flag from command. --- ChangeLog | 24 +++++++++++++ FAQ | 19 ++++++++++ FAQ.in | 15 ++++++++ include/dirent.h | 4 ++- manual/top-menu.texi | 1 + posix/Makefile | 2 +- posix/Versions | 2 +- posix/glob.h | 50 +++++++++++++++++++++----- sysdeps/generic/glob.c | 5 ++- sysdeps/generic/glob64.c | 47 ++++++++++++++++++++++++ sysdeps/unix/Makefile | 3 +- sysdeps/unix/sysv/linux/alpha/glob.c | 6 ++++ sysdeps/unix/sysv/linux/alpha/glob64.c | 1 + sysdeps/unix/sysv/linux/glob64.c | 18 ++++++++++ sysdeps/unix/sysv/linux/sparc/sparc64/glob.c | 7 ++++ sysdeps/unix/sysv/linux/sparc/sparc64/glob64.c | 1 + 16 files changed, 191 insertions(+), 14 deletions(-) create mode 100644 sysdeps/generic/glob64.c create mode 100644 sysdeps/unix/sysv/linux/alpha/glob64.c create mode 100644 sysdeps/unix/sysv/linux/glob64.c create mode 100644 sysdeps/unix/sysv/linux/sparc/sparc64/glob.c create mode 100644 sysdeps/unix/sysv/linux/sparc/sparc64/glob64.c diff --git a/ChangeLog b/ChangeLog index a71f1bd6de..1d2ba89be4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,27 @@ +1998-08-10 15:49 Ulrich Drepper + + * include/dirent.h: Protect from double inclusion. + +1998-08-09 Mark Kettenis + + * posix/glob.h: Add LFS support for glob and globfree. + * posix/Versions [GLIBC_2.1]: Add glob64 and globfree64. + * posix/Makefile (routines): Add glob64. + * sysdeps/generic/glob64.c: New file. + * sysdeps/unix/sysv/linux/glob64.c: New file. + * sysdeps/unix/sysv/linux/alpha/glob64.c: New file. + * sysdeps/unix/sysv/linux/sparc/sparc64/glob64.c: New file. + * sysdeps/generic/glob.c [_LIBC && glob] (__glob_pattern_p): + Elide function. + * sysdeps/unix/sysv/linux/alpha/glob.c: Add glob64 as a weak alias + for __new_glob. Likewise for globfree64. + * sysdeps/unix/sysv/linux/sparc/sparc64/glob.c: New file. + +1998-08-09 Andreas Schwab + + * sysdeps/unix/Makefile ($(common-objpfx)s-proto.d): Remove + -include flag from command. + 1998-08-10 Ulrich Drepper * nss/nss_db/db-XXX.c (_nss_db_getXXX): If buffer is too small diff --git a/FAQ b/FAQ index ebb93d7023..5b8f2050a6 100644 --- a/FAQ +++ b/FAQ @@ -115,6 +115,9 @@ please let me know. 3.11. I get some errors with `gcc -ansi'. Isn't glibc ANSI compatible? 3.12. I can't access some functions anymore. nm shows that they do exist but linking fails nevertheless. +3.13. When using the db-2 library which comes with glibc is used in + the Perl db modules the testsuite is not passed. This did not + happen with db-1, gdbm, or ndbm. 4. Miscellaneous @@ -1159,6 +1162,22 @@ e.g. __ivaliduser). If a program uses these interfaces, it's broken. These internal interfaces might change between glibc releases or dropped completely. + +3.13. When using the db-2 library which comes with glibc is used in + the Perl db modules the testsuite is not passed. This did not + happen with db-1, gdbm, or ndbm. + +{UD} You are using an outdated copy of the DB_File Perl module. In fact db-2 +finally removed the handling of zero-sized keys which was one of the features +tested by the old Perl testsuite and therefore you see an error. But this +never was documented and guaranteed, only broken programs used this feature. + +Consequently db-2 does not need to support this feature and instead signals +an error which leads to easier debugging. The DB_File module maintainer +Paul Marquess acknowledged this change and fixed +the testsuite so that if you use DB_File v1.60 or later you should not have +any more problems with db-2. + . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . diff --git a/FAQ.in b/FAQ.in index 4f65022b0c..c4bafc0c55 100644 --- a/FAQ.in +++ b/FAQ.in @@ -997,6 +997,21 @@ e.g. __ivaliduser). If a program uses these interfaces, it's broken. These internal interfaces might change between glibc releases or dropped completely. +?? When using the db-2 library which comes with glibc is used in + the Perl db modules the testsuite is not passed. This did not + happen with db-1, gdbm, or ndbm. + +{UD} You are using an outdated copy of the DB_File Perl module. In fact db-2 +finally removed the handling of zero-sized keys which was one of the features +tested by the old Perl testsuite and therefore you see an error. But this +never was documented and guaranteed, only broken programs used this feature. + +Consequently db-2 does not need to support this feature and instead signals +an error which leads to easier debugging. The DB_File module maintainer +Paul Marquess acknowledged this change and fixed +the testsuite so that if you use DB_File v1.60 or later you should not have +any more problems with db-2. + ? Miscellaneous diff --git a/include/dirent.h b/include/dirent.h index 594d90d89f..58d7546c4a 100644 --- a/include/dirent.h +++ b/include/dirent.h @@ -1,4 +1,5 @@ -#include +#ifndef _DIRENT_H +# include /* Now define the internal interfaces. */ extern DIR *__opendir __P ((__const char *__name)); @@ -9,3 +10,4 @@ extern int __readdir_r __P ((DIR *__dirp, struct dirent *__entry, struct dirent **__result)); extern __ssize_t __getdirentries __P ((int __fd, char *__buf, size_t __nbytes, __off_t *__basep)); +#endif diff --git a/manual/top-menu.texi b/manual/top-menu.texi index 05a8ed680e..fa94127260 100644 --- a/manual/top-menu.texi +++ b/manual/top-menu.texi @@ -532,6 +532,7 @@ File Attributes * Testing File Access:: How to find out if your process can access a file. * File Times:: About the time attributes of a file. +* File Size:: Manually changing the size of a file. Pipes and FIFOs diff --git a/posix/Makefile b/posix/Makefile index 201cb781b7..77471c8eee 100644 --- a/posix/Makefile +++ b/posix/Makefile @@ -44,7 +44,7 @@ routines := \ getpgid setpgid getpgrp bsd-getpgrp setpgrp getsid setsid \ getlogin getlogin_r setlogin \ pathconf sysconf fpathconf \ - glob fnmatch regex \ + glob glob64 fnmatch regex \ confstr \ getopt getopt1 getopt_init \ sched_setp sched_getp sched_sets sched_gets sched_yield sched_primax \ diff --git a/posix/Versions b/posix/Versions index afb7242359..985281d99a 100644 --- a/posix/Versions +++ b/posix/Versions @@ -73,7 +73,7 @@ libc { __pread64; __pwrite64; # g* - gai_strerror; getnameinfo; + gai_strerror; getnameinfo; glob64; globfree64; # p* pread; pread64; pwrite; pwrite64; diff --git a/posix/glob.h b/posix/glob.h index da719c2a45..609f2177e5 100644 --- a/posix/glob.h +++ b/posix/glob.h @@ -77,21 +77,13 @@ extern "C" { #define GLOB_NOSPACE 1 /* Ran out of memory. */ #define GLOB_ABORTED 2 /* Read error. */ #define GLOB_NOMATCH 3 /* No matches found. */ - +#define GLOB_NOSYS 4 /* Not implemented. */ #ifdef _GNU_SOURCE /* Previous versions of this file defined GLOB_ABEND instead of GLOB_ABORTED. Provide a compatibility definition here. */ # define GLOB_ABEND GLOB_ABORTED #endif -/* This value is returned if the implementation does not support - `glob'. Since this is not the case here it will never be - returned but the conformance test suites still require the symbol - to be defined. */ -#ifdef _XOPEN_SOURCE -# define GLOB_NOSYS (-1) -#endif - /* Structure describing a globbing run. */ #if !defined _AMIGA && !defined VMS /* Buggy compiler. */ struct stat; @@ -112,6 +104,25 @@ typedef struct int (*gl_stat) __PMT ((__const char *, struct stat *)); } glob_t; +#ifdef _LARGEFILE64_SOURCE +struct stat64; +typedef struct + { + size_t gl_pathc; + char **gl_pathv; + size_t gl_offs; + int gl_flags; + + /* If the GLOB_ALTDIRFUNC flag is set, the following functions + are used instead of the normal file access functions. */ + void (*gl_closedir) __PMT ((void *)); + struct dirent64 *(*gl_readdir) __PMT ((void *)); + __ptr_t (*gl_opendir) __PMT ((__const char *)); + int (*gl_lstat) __PMT ((__const char *, struct stat64 *)); + int (*gl_stat) __PMT ((__const char *, struct stat64 *)); + } glob64_t; +#endif + /* Do glob searching for PATTERN, placing results in PGLOB. The bits defined above may be set in FLAGS. If a directory cannot be opened or read and ERRFUNC is not nil, @@ -120,12 +131,33 @@ typedef struct `glob' returns GLOB_ABEND; if it returns zero, the error is ignored. If memory cannot be allocated for PGLOB, GLOB_NOSPACE is returned. Otherwise, `glob' returns zero. */ +#if _FILE_OFFSET_BITS != 64 extern int glob __P ((__const char *__pattern, int __flags, int (*__errfunc) __P ((__const char *, int)), glob_t *__pglob)); /* Free storage allocated in PGLOB by a previous `glob' call. */ extern void globfree __P ((glob_t *__pglob)); +#else +# if __GNUC__ >= 2 +extern int glob __P ((__const char *__pattern, int __flags, + int (*__errfunc) __P ((__const char *, int)), + glob_t *__pglob)) __asm__ ("glob64"); + +extern void globfree __P ((glob_t *__pglob)) __asm__ ("globfree64"); +# else +# define glob glob64 +# define globfree globfree64 +# endif +#endif + +#ifdef _LARGEFILE64_SOURCE +extern int glob64 __P ((__const char *__pattern, int __flags, + int (*__errfunc) __P ((__const char *, int)), + glob64_t *__pglob)); + +extern void globfree64 __P ((glob64_t *__pglob)); +#endif #ifdef _GNU_SOURCE diff --git a/sysdeps/generic/glob.c b/sysdeps/generic/glob.c index 5fc094ebe7..626b0914bc 100644 --- a/sysdeps/generic/glob.c +++ b/sysdeps/generic/glob.c @@ -1121,6 +1121,8 @@ prefix_array (dirname, array, n) } +/* We must not compile this function twice. */ +#if !defined _LIBC || !defined glob /* Return nonzero if PATTERN contains any metacharacters. Metacharacters can be quoted with backslashes if QUOTE is nonzero. */ int @@ -1155,8 +1157,9 @@ __glob_pattern_p (pattern, quote) return 0; } -#ifdef _LIBC +# ifdef _LIBC weak_alias (__glob_pattern_p, glob_pattern_p) +# endif #endif diff --git a/sysdeps/generic/glob64.c b/sysdeps/generic/glob64.c new file mode 100644 index 0000000000..6e1b835f8d --- /dev/null +++ b/sysdeps/generic/glob64.c @@ -0,0 +1,47 @@ +/* Copyright (C) 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* Do glob searching for PATTERN, placing results in PGLOB. + The bits defined above may be set in FLAGS. + If a directory cannot be opened or read and ERRFUNC is not nil, + it is called with the pathname that caused the error, and the + `errno' value from the failing call; if it returns non-zero + `glob' returns GLOB_ABORTED; if it returns zero, the error is ignored. + If memory cannot be allocated for PGLOB, GLOB_NOSPACE is returned. + Otherwise, `glob' returns zero. */ +int +glob64 (const char *pattern, int flags, + int (*errfunc) (const char *, int), glib64_t *pglob); +{ + if (pattern == NULL || pglob == NULL || (flags & ~__GLOB_FLAGS) != 0) + { + __set_errno (EINVAL); + return -1; + } + + __set_errno (ENOSYS); + return GLOB_NOSYS; +} + +void +globfree64 (glob64_t *pglob) +{ +} + +stub_warning (glob64) +#include diff --git a/sysdeps/unix/Makefile b/sysdeps/unix/Makefile index 18bd88b614..9727844897 100644 --- a/sysdeps/unix/Makefile +++ b/sysdeps/unix/Makefile @@ -307,7 +307,8 @@ endif $(common-objpfx)s-proto.d: $(common-objpfx)%.d: $(..)sysdeps/unix/%.S \ $(wildcard $(+sysdep_dirs:%=%/syscalls.list)) - $(+make-deps) +# Don't try to use compat.h in the db2 subdir + $(subst -include ./compat.h,,$(+make-deps)) common-generated += s-proto.d postclean-generated += sysd-syscalls diff --git a/sysdeps/unix/sysv/linux/alpha/glob.c b/sysdeps/unix/sysv/linux/alpha/glob.c index 5baa0aea78..311a923026 100644 --- a/sysdeps/unix/sysv/linux/alpha/glob.c +++ b/sysdeps/unix/sysv/linux/alpha/glob.c @@ -15,6 +15,9 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#define glob64 __no_glob64_decl +#define globfree64 __no_globfree64_decl + #include #include @@ -37,3 +40,6 @@ extern void __new_globfree (glob_t *__pglob); default_symbol_version(__new_glob, glob, GLIBC_2.1); default_symbol_version(__new_globfree, globfree, GLIBC_2.1); + +weak_alias (__new_glob, glob64) +weak_alias (__new_globfree, globfree64) diff --git a/sysdeps/unix/sysv/linux/alpha/glob64.c b/sysdeps/unix/sysv/linux/alpha/glob64.c new file mode 100644 index 0000000000..33918ea6a5 --- /dev/null +++ b/sysdeps/unix/sysv/linux/alpha/glob64.c @@ -0,0 +1 @@ +/* glob64 is in glob.c */ diff --git a/sysdeps/unix/sysv/linux/glob64.c b/sysdeps/unix/sysv/linux/glob64.c new file mode 100644 index 0000000000..022ae54848 --- /dev/null +++ b/sysdeps/unix/sysv/linux/glob64.c @@ -0,0 +1,18 @@ +#include +#include +#include + +#define dirent dirent64 +#define __readdir(dirp) __readdir64 (dirp) + +#define glob_t glob64_t +#define glob(pattern, flags, errfunc, pglob) \ + glob64 (pattern, flags, errfunc, pglob) +#define globfree(pglob) globfree64 (pglob) + +#undef stat +#define stat stat64 +#undef __stat +#define __stat(file, buf) stat64 (file, buf) + +#include diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/glob.c b/sysdeps/unix/sysv/linux/sparc/sparc64/glob.c new file mode 100644 index 0000000000..b6da989e57 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/glob.c @@ -0,0 +1,7 @@ +#define glob64 __no_glob64_decl +#define globfree64 __no_globfree64_decl +#include +#undef glob64 +#undef globfree64 +weak_alias (glob, glob64) +weak_alias (globfree, globfree64) diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/glob64.c b/sysdeps/unix/sysv/linux/sparc/sparc64/glob64.c new file mode 100644 index 0000000000..33918ea6a5 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/glob64.c @@ -0,0 +1 @@ +/* glob64 is in glob.c */ -- cgit v1.2.3