diff options
author | Yao Qi <yao@codesourcery.com> | 2014-11-23 21:49:20 +0800 |
---|---|---|
committer | Yao Qi <yao@codesourcery.com> | 2014-11-28 18:37:47 +0800 |
commit | 2196f55f0140f3e278ed4002040f32acc5a6aaf1 (patch) | |
tree | 6bd039ca439dc4078b8b908ca0628b2e9390f427 /gdb/gnulib/import | |
parent | 7014e923da3a3b95a99c3fb5f17e109864bd1113 (diff) | |
download | gdb-2196f55f0140f3e278ed4002040f32acc5a6aaf1.zip gdb-2196f55f0140f3e278ed4002040f32acc5a6aaf1.tar.gz gdb-2196f55f0140f3e278ed4002040f32acc5a6aaf1.tar.bz2 |
Import readlink
This patch is to import readlink gnulib module. stat module is imported
too, but it isn't used by gdb.
gdb:
2014-11-28 Yao Qi <yao@codesourcery.com>
* gnulib/update-gnulib.sh (IMPORTED_GNULIB_MODULES): Add readlink.
* gnulib/aclocal.m4: Re-generated.
* gnulib/config.in: Likewise.
* gnulib/configure: Likewise.
* gnulib/import/Makefile.am: Likewise.
* gnulib/import/Makefile.in: Likewise.
* gnulib/import/m4/gnulib-cache.m4: Likewise.
* gnulib/import/m4/gnulib-comp.m4: Likewise.
* gnulib/import/dosname.h: New file
* gnulib/import/m4/largefile.m4: New file.
* gnulib/import/m4/readlink.m4: New file.
* gnulib/import/m4/stat.m4: New file.
* gnulib/import/readlink.c: New file.
* gnulib/import/stat.c: New file.
Diffstat (limited to 'gdb/gnulib/import')
-rw-r--r-- | gdb/gnulib/import/Makefile.am | 27 | ||||
-rw-r--r-- | gdb/gnulib/import/Makefile.in | 35 | ||||
-rw-r--r-- | gdb/gnulib/import/dosname.h | 53 | ||||
-rw-r--r-- | gdb/gnulib/import/m4/gnulib-cache.m4 | 3 | ||||
-rw-r--r-- | gdb/gnulib/import/m4/gnulib-comp.m4 | 24 | ||||
-rw-r--r-- | gdb/gnulib/import/m4/largefile.m4 | 149 | ||||
-rw-r--r-- | gdb/gnulib/import/m4/readlink.m4 | 71 | ||||
-rw-r--r-- | gdb/gnulib/import/m4/stat.m4 | 71 | ||||
-rw-r--r-- | gdb/gnulib/import/readlink.c | 74 | ||||
-rw-r--r-- | gdb/gnulib/import/stat.c | 138 |
10 files changed, 628 insertions, 17 deletions
diff --git a/gdb/gnulib/import/Makefile.am b/gdb/gnulib/import/Makefile.am index 22f7135..635d62c 100644 --- a/gdb/gnulib/import/Makefile.am +++ b/gdb/gnulib/import/Makefile.am @@ -21,7 +21,7 @@ # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. -# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=import --m4-base=import/m4 --doc-base=doc --tests-base=tests --aux-dir=import/extra --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca dirent dirfd errno fnmatch-gnu frexpl inttypes memchr memmem pathmax strstr sys_stat unistd update-copyright wchar wctype-h +# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=import --m4-base=import/m4 --doc-base=doc --tests-base=tests --aux-dir=import/extra --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca dirent dirfd errno fnmatch-gnu frexpl inttypes memchr memmem pathmax readlink strstr sys_stat unistd update-copyright wchar wctype-h AUTOMAKE_OPTIONS = 1.5 gnits @@ -184,6 +184,13 @@ EXTRA_libgnu_a_SOURCES += dirfd.c ## end gnulib module dirfd +## begin gnulib module dosname + + +EXTRA_DIST += dosname.h + +## end gnulib module dosname + ## begin gnulib module errno BUILT_SOURCES += $(ERRNO_H) @@ -772,6 +779,15 @@ EXTRA_DIST += pathmax.h ## end gnulib module pathmax +## begin gnulib module readlink + + +EXTRA_DIST += readlink.c + +EXTRA_libgnu_a_SOURCES += readlink.c + +## end gnulib module readlink + ## begin gnulib module snippet/arg-nonnull # The BUILT_SOURCES created by this Makefile snippet are not used via #include @@ -841,6 +857,15 @@ EXTRA_DIST += $(top_srcdir)/import/extra/snippet/warn-on-use.h ## end gnulib module snippet/warn-on-use +## begin gnulib module stat + + +EXTRA_DIST += stat.c + +EXTRA_libgnu_a_SOURCES += stat.c + +## end gnulib module stat + ## begin gnulib module stdbool BUILT_SOURCES += $(STDBOOL_H) diff --git a/gdb/gnulib/import/Makefile.in b/gdb/gnulib/import/Makefile.in index 9068728..8ddfcbc 100644 --- a/gdb/gnulib/import/Makefile.in +++ b/gdb/gnulib/import/Makefile.in @@ -36,7 +36,7 @@ # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. -# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=import --m4-base=import/m4 --doc-base=doc --tests-base=tests --aux-dir=import/extra --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca dirent dirfd errno fnmatch-gnu frexpl inttypes memchr memmem pathmax strstr sys_stat unistd update-copyright wchar wctype-h +# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=import --m4-base=import/m4 --doc-base=doc --tests-base=tests --aux-dir=import/extra --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca dirent dirfd errno fnmatch-gnu frexpl inttypes memchr memmem pathmax readlink strstr sys_stat unistd update-copyright wchar wctype-h @@ -88,6 +88,7 @@ am__aclocal_m4_deps = $(top_srcdir)/import/m4/00gnulib.m4 \ $(top_srcdir)/import/m4/inttypes.m4 \ $(top_srcdir)/import/m4/isnand.m4 \ $(top_srcdir)/import/m4/isnanl.m4 \ + $(top_srcdir)/import/m4/largefile.m4 \ $(top_srcdir)/import/m4/localcharset.m4 \ $(top_srcdir)/import/m4/locale-fr.m4 \ $(top_srcdir)/import/m4/locale-ja.m4 \ @@ -104,7 +105,9 @@ am__aclocal_m4_deps = $(top_srcdir)/import/m4/00gnulib.m4 \ $(top_srcdir)/import/m4/multiarch.m4 \ $(top_srcdir)/import/m4/off_t.m4 \ $(top_srcdir)/import/m4/pathmax.m4 \ + $(top_srcdir)/import/m4/readlink.m4 \ $(top_srcdir)/import/m4/ssize_t.m4 \ + $(top_srcdir)/import/m4/stat.m4 \ $(top_srcdir)/import/m4/stdbool.m4 \ $(top_srcdir)/import/m4/stddef_h.m4 \ $(top_srcdir)/import/m4/stdint.m4 \ @@ -1025,20 +1028,20 @@ noinst_HEADERS = noinst_LIBRARIES = libgnu.a noinst_LTLIBRARIES = EXTRA_DIST = m4/gnulib-cache.m4 alloca.c alloca.in.h dirent.in.h \ - dirfd.c errno.in.h float.c float.in.h itold.c fnmatch.c \ - fnmatch.in.h fnmatch_loop.c fpucw.h frexp.c frexp.c frexpl.c \ - inttypes.in.h float+.h isnan.c isnand-nolibm.h isnand.c \ - float+.h isnan.c isnanl-nolibm.h isnanl.c config.charset \ - ref-add.sin ref-del.sin math.in.h mbrtowc.c mbsinit.c \ - mbsrtowcs-impl.h mbsrtowcs-state.c mbsrtowcs.c memchr.c \ - memchr.valgrind memmem.c str-two-way.h pathmax.h \ - $(top_srcdir)/import/extra/snippet/arg-nonnull.h \ + dirfd.c dosname.h errno.in.h float.c float.in.h itold.c \ + fnmatch.c fnmatch.in.h fnmatch_loop.c fpucw.h frexp.c frexp.c \ + frexpl.c inttypes.in.h float+.h isnan.c isnand-nolibm.h \ + isnand.c float+.h isnan.c isnanl-nolibm.h isnanl.c \ + config.charset ref-add.sin ref-del.sin math.in.h mbrtowc.c \ + mbsinit.c mbsrtowcs-impl.h mbsrtowcs-state.c mbsrtowcs.c \ + memchr.c memchr.valgrind memmem.c str-two-way.h pathmax.h \ + readlink.c $(top_srcdir)/import/extra/snippet/arg-nonnull.h \ $(top_srcdir)/import/extra/snippet/c++defs.h \ - $(top_srcdir)/import/extra/snippet/warn-on-use.h stdbool.in.h \ - stddef.in.h stdint.in.h streq.h string.in.h str-two-way.h \ - strstr.c sys_stat.in.h sys_types.in.h time.in.h unistd.in.h \ - $(top_srcdir)/import/extra/update-copyright verify.h \ - wchar.in.h wctype.in.h + $(top_srcdir)/import/extra/snippet/warn-on-use.h stat.c \ + stdbool.in.h stddef.in.h stdint.in.h streq.h string.in.h \ + str-two-way.h strstr.c sys_stat.in.h sys_types.in.h time.in.h \ + unistd.in.h $(top_srcdir)/import/extra/update-copyright \ + verify.h wchar.in.h wctype.in.h # The BUILT_SOURCES created by this Makefile snippet are not used via #include # statements but through direct file reference. Therefore this snippet must be @@ -1077,7 +1080,7 @@ libgnu_a_DEPENDENCIES = $(gl_LIBOBJS) @ALLOCA@ EXTRA_libgnu_a_SOURCES = alloca.c dirfd.c float.c itold.c fnmatch.c \ fnmatch_loop.c frexp.c frexp.c frexpl.c isnan.c isnand.c \ isnan.c isnanl.c mbrtowc.c mbsinit.c mbsrtowcs-state.c \ - mbsrtowcs.c memchr.c memmem.c strstr.c + mbsrtowcs.c memchr.c memmem.c readlink.c stat.c strstr.c charset_alias = $(DESTDIR)$(libdir)/charset.alias charset_tmp = $(DESTDIR)$(libdir)/charset.tmp ARG_NONNULL_H = arg-nonnull.h @@ -1161,6 +1164,8 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mbsrtowcs.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memchr.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memmem.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/readlink.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stat.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strnlen1.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strstr.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unistd.Po@am__quote@ diff --git a/gdb/gnulib/import/dosname.h b/gdb/gnulib/import/dosname.h new file mode 100644 index 0000000..0468ce4 --- /dev/null +++ b/gdb/gnulib/import/dosname.h @@ -0,0 +1,53 @@ +/* File names on MS-DOS/Windows systems. + + Copyright (C) 2000-2001, 2004-2006, 2009-2012 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + + From Paul Eggert and Jim Meyering. */ + +#ifndef _DOSNAME_H +#define _DOSNAME_H + +#if (defined _WIN32 || defined __WIN32__ || \ + defined __MSDOS__ || defined __CYGWIN__ || \ + defined __EMX__ || defined __DJGPP__) + /* This internal macro assumes ASCII, but all hosts that support drive + letters use ASCII. */ +# define _IS_DRIVE_LETTER(C) (((unsigned int) (C) | ('a' - 'A')) - 'a' \ + <= 'z' - 'a') +# define FILE_SYSTEM_PREFIX_LEN(Filename) \ + (_IS_DRIVE_LETTER ((Filename)[0]) && (Filename)[1] == ':' ? 2 : 0) +# ifndef __CYGWIN__ +# define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 1 +# endif +# define ISSLASH(C) ((C) == '/' || (C) == '\\') +#else +# define FILE_SYSTEM_PREFIX_LEN(Filename) 0 +# define ISSLASH(C) ((C) == '/') +#endif + +#ifndef FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE +# define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 0 +#endif + +#if FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE +# define IS_ABSOLUTE_FILE_NAME(F) ISSLASH ((F)[FILE_SYSTEM_PREFIX_LEN (F)]) +# else +# define IS_ABSOLUTE_FILE_NAME(F) \ + (ISSLASH ((F)[0]) || FILE_SYSTEM_PREFIX_LEN (F) != 0) +#endif +#define IS_RELATIVE_FILE_NAME(F) (! IS_ABSOLUTE_FILE_NAME (F)) + +#endif /* DOSNAME_H_ */ diff --git a/gdb/gnulib/import/m4/gnulib-cache.m4 b/gdb/gnulib/import/m4/gnulib-cache.m4 index 8dd2a5c..a8451ec 100644 --- a/gdb/gnulib/import/m4/gnulib-cache.m4 +++ b/gdb/gnulib/import/m4/gnulib-cache.m4 @@ -27,7 +27,7 @@ # Specification in the form of a command-line invocation: -# gnulib-tool --import --dir=. --lib=libgnu --source-base=import --m4-base=import/m4 --doc-base=doc --tests-base=tests --aux-dir=import/extra --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca dirent dirfd errno fnmatch-gnu frexpl inttypes memchr memmem pathmax strstr sys_stat unistd update-copyright wchar wctype-h +# gnulib-tool --import --dir=. --lib=libgnu --source-base=import --m4-base=import/m4 --doc-base=doc --tests-base=tests --aux-dir=import/extra --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca dirent dirfd errno fnmatch-gnu frexpl inttypes memchr memmem pathmax readlink strstr sys_stat unistd update-copyright wchar wctype-h # Specification in the form of a few gnulib-tool.m4 macro invocations: gl_LOCAL_DIR([]) @@ -42,6 +42,7 @@ gl_MODULES([ memchr memmem pathmax + readlink strstr sys_stat unistd diff --git a/gdb/gnulib/import/m4/gnulib-comp.m4 b/gdb/gnulib/import/m4/gnulib-comp.m4 index a56c214..525485a 100644 --- a/gdb/gnulib/import/m4/gnulib-comp.m4 +++ b/gdb/gnulib/import/m4/gnulib-comp.m4 @@ -43,6 +43,7 @@ AC_DEFUN([gl_EARLY], # Code from module configmake: # Code from module dirent: # Code from module dirfd: + # Code from module dosname: # Code from module errno: # Code from module extensions: AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) @@ -60,6 +61,8 @@ AC_DEFUN([gl_EARLY], # Code from module inttypes-incomplete: # Code from module isnand-nolibm: # Code from module isnanl-nolibm: + # Code from module largefile: + AC_REQUIRE([AC_SYS_LARGEFILE]) # Code from module localcharset: # Code from module math: # Code from module mbrtowc: @@ -70,10 +73,12 @@ AC_DEFUN([gl_EARLY], # Code from module memmem-simple: # Code from module multiarch: # Code from module pathmax: + # Code from module readlink: # Code from module snippet/arg-nonnull: # Code from module snippet/c++defs: # Code from module snippet/warn-on-use: # Code from module ssize_t: + # Code from module stat: # Code from module stdbool: # Code from module stddef: # Code from module stdint: @@ -158,6 +163,7 @@ AC_DEFUN([gl_INIT], AC_LIBOBJ([isnanl]) gl_PREREQ_ISNANL fi + AC_REQUIRE([gl_LARGEFILE]) gl_LOCALCHARSET LOCALCHARSET_TESTS_ENVIRONMENT="CHARSETALIASDIR=\"\$(abs_top_builddir)/$gl_source_base\"" AC_SUBST([LOCALCHARSET_TESTS_ENVIRONMENT]) @@ -198,7 +204,19 @@ AC_DEFUN([gl_INIT], gl_STRING_MODULE_INDICATOR([memmem]) gl_MULTIARCH gl_PATHMAX + gl_FUNC_READLINK + if test $HAVE_READLINK = 0 || test $REPLACE_READLINK = 1; then + AC_LIBOBJ([readlink]) + gl_PREREQ_READLINK + fi + gl_UNISTD_MODULE_INDICATOR([readlink]) gt_TYPE_SSIZE_T + gl_FUNC_STAT + if test $REPLACE_STAT = 1; then + AC_LIBOBJ([stat]) + gl_PREREQ_STAT + fi + gl_SYS_STAT_MODULE_INDICATOR([stat]) AM_STDBOOL_H gl_STDDEF_H gl_STDINT_H @@ -369,6 +387,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/config.charset lib/dirent.in.h lib/dirfd.c + lib/dosname.h lib/errno.in.h lib/float+.h lib/float.c @@ -399,8 +418,10 @@ AC_DEFUN([gl_FILE_LIST], [ lib/memchr.valgrind lib/memmem.c lib/pathmax.h + lib/readlink.c lib/ref-add.sin lib/ref-del.sin + lib/stat.c lib/stdbool.in.h lib/stddef.in.h lib/stdint.in.h @@ -443,6 +464,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/inttypes.m4 m4/isnand.m4 m4/isnanl.m4 + m4/largefile.m4 m4/localcharset.m4 m4/locale-fr.m4 m4/locale-ja.m4 @@ -459,7 +481,9 @@ AC_DEFUN([gl_FILE_LIST], [ m4/multiarch.m4 m4/off_t.m4 m4/pathmax.m4 + m4/readlink.m4 m4/ssize_t.m4 + m4/stat.m4 m4/stdbool.m4 m4/stddef_h.m4 m4/stdint.m4 diff --git a/gdb/gnulib/import/m4/largefile.m4 b/gdb/gnulib/import/m4/largefile.m4 new file mode 100644 index 0000000..a88850a --- /dev/null +++ b/gdb/gnulib/import/m4/largefile.m4 @@ -0,0 +1,149 @@ +# Enable large files on systems where this is not the default. + +# Copyright 1992-1996, 1998-2012 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# The following implementation works around a problem in autoconf <= 2.68; +# AC_SYS_LARGEFILE does not configure for large inodes on Mac OS X 10.5. +m4_version_prereq([2.69], [] ,[ + +# _AC_SYS_LARGEFILE_TEST_INCLUDES +# ------------------------------- +m4_define([_AC_SYS_LARGEFILE_TEST_INCLUDES], +[@%:@include <sys/types.h> + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +@%:@define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]];[]dnl +]) + + +# _AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE, +# CACHE-VAR, +# DESCRIPTION, +# PROLOGUE, [FUNCTION-BODY]) +# -------------------------------------------------------- +m4_define([_AC_SYS_LARGEFILE_MACRO_VALUE], +[AC_CACHE_CHECK([for $1 value needed for large files], [$3], +[while :; do + m4_ifval([$6], [AC_LINK_IFELSE], [AC_COMPILE_IFELSE])( + [AC_LANG_PROGRAM([$5], [$6])], + [$3=no; break]) + m4_ifval([$6], [AC_LINK_IFELSE], [AC_COMPILE_IFELSE])( + [AC_LANG_PROGRAM([@%:@define $1 $2 +$5], [$6])], + [$3=$2; break]) + $3=unknown + break +done]) +case $$3 in #( + no | unknown) ;; + *) AC_DEFINE_UNQUOTED([$1], [$$3], [$4]);; +esac +rm -rf conftest*[]dnl +])# _AC_SYS_LARGEFILE_MACRO_VALUE + + +# AC_SYS_LARGEFILE +# ---------------- +# By default, many hosts won't let programs access large files; +# one must use special compiler options to get large-file access to work. +# For more details about this brain damage please see: +# http://www.unix-systems.org/version2/whatsnew/lfs20mar.html +AC_DEFUN([AC_SYS_LARGEFILE], +[AC_ARG_ENABLE(largefile, + [ --disable-largefile omit support for large files]) +if test "$enable_largefile" != no; then + + AC_CACHE_CHECK([for special C compiler options needed for large files], + ac_cv_sys_largefile_CC, + [ac_cv_sys_largefile_CC=no + if test "$GCC" != yes; then + ac_save_CC=$CC + while :; do + # IRIX 6.2 and later do not support large files by default, + # so use the C compiler's -n32 option if that helps. + AC_LANG_CONFTEST([AC_LANG_PROGRAM([_AC_SYS_LARGEFILE_TEST_INCLUDES])]) + AC_COMPILE_IFELSE([], [break]) + CC="$CC -n32" + AC_COMPILE_IFELSE([], [ac_cv_sys_largefile_CC=' -n32'; break]) + break + done + CC=$ac_save_CC + rm -f conftest.$ac_ext + fi]) + if test "$ac_cv_sys_largefile_CC" != no; then + CC=$CC$ac_cv_sys_largefile_CC + fi + + _AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, 64, + ac_cv_sys_file_offset_bits, + [Number of bits in a file offset, on hosts where this is settable.], + [_AC_SYS_LARGEFILE_TEST_INCLUDES]) + if test $ac_cv_sys_file_offset_bits = unknown; then + _AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1, + ac_cv_sys_large_files, + [Define for large files, on AIX-style hosts.], + [_AC_SYS_LARGEFILE_TEST_INCLUDES]) + fi + + AH_VERBATIM([_DARWIN_USE_64_BIT_INODE], +[/* Enable large inode numbers on Mac OS X. */ +#ifndef _DARWIN_USE_64_BIT_INODE +# define _DARWIN_USE_64_BIT_INODE 1 +#endif]) +fi +])# AC_SYS_LARGEFILE + +])# m4_version_prereq 2.69 + +# Enable large files on systems where this is implemented by Gnulib, not by the +# system headers. +# Set the variables WINDOWS_64_BIT_OFF_T, WINDOWS_64_BIT_ST_SIZE if Gnulib +# overrides ensure that off_t or 'struct size.st_size' are 64-bit, respectively. +AC_DEFUN([gl_LARGEFILE], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + case "$host_os" in + mingw*) + dnl Native Windows. + dnl mingw64 defines off_t to a 64-bit type already, if + dnl _FILE_OFFSET_BITS=64, which is ensured by AC_SYS_LARGEFILE. + AC_CACHE_CHECK([for 64-bit off_t], [gl_cv_type_off_t_64], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include <sys/types.h> + int verify_off_t_size[sizeof (off_t) >= 8 ? 1 : -1]; + ]], + [[]])], + [gl_cv_type_off_t_64=yes], [gl_cv_type_off_t_64=no]) + ]) + if test $gl_cv_type_off_t_64 = no; then + WINDOWS_64_BIT_OFF_T=1 + else + WINDOWS_64_BIT_OFF_T=0 + fi + dnl But all native Windows platforms (including mingw64) have a 32-bit + dnl st_size member in 'struct stat'. + WINDOWS_64_BIT_ST_SIZE=1 + ;; + *) + dnl Nothing to do on gnulib's side. + dnl A 64-bit off_t is + dnl - already the default on Mac OS X, FreeBSD, NetBSD, OpenBSD, IRIX, + dnl OSF/1, Cygwin, + dnl - enabled by _FILE_OFFSET_BITS=64 (ensured by AC_SYS_LARGEFILE) on + dnl glibc, HP-UX, Solaris, + dnl - enabled by _LARGE_FILES=1 (ensured by AC_SYS_LARGEFILE) on AIX, + dnl - impossible to achieve on Minix 3.1.8. + WINDOWS_64_BIT_OFF_T=0 + WINDOWS_64_BIT_ST_SIZE=0 + ;; + esac +]) diff --git a/gdb/gnulib/import/m4/readlink.m4 b/gdb/gnulib/import/m4/readlink.m4 new file mode 100644 index 0000000..ccf5141 --- /dev/null +++ b/gdb/gnulib/import/m4/readlink.m4 @@ -0,0 +1,71 @@ +# readlink.m4 serial 12 +dnl Copyright (C) 2003, 2007, 2009-2012 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_READLINK], +[ + AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CHECK_FUNCS_ONCE([readlink]) + if test $ac_cv_func_readlink = no; then + HAVE_READLINK=0 + else + AC_CACHE_CHECK([whether readlink signature is correct], + [gl_cv_decl_readlink_works], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include <unistd.h> + /* Cause compilation failure if original declaration has wrong type. */ + ssize_t readlink (const char *, char *, size_t);]])], + [gl_cv_decl_readlink_works=yes], [gl_cv_decl_readlink_works=no])]) + dnl Solaris 9 ignores trailing slash. + dnl FreeBSD 7.2 dereferences only one level of links with trailing slash. + AC_CACHE_CHECK([whether readlink handles trailing slash correctly], + [gl_cv_func_readlink_works], + [# We have readlink, so assume ln -s works. + ln -s conftest.no-such conftest.link + ln -s conftest.link conftest.lnk2 + AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[#include <unistd.h> +]], [[char buf[20]; + return readlink ("conftest.lnk2/", buf, sizeof buf) != -1;]])], + [gl_cv_func_readlink_works=yes], [gl_cv_func_readlink_works=no], + [case "$host_os" in + # Guess yes on glibc systems. + *-gnu*) gl_cv_func_readlink_works="guessing yes" ;; + # If we don't know, assume the worst. + *) gl_cv_func_readlink_works="guessing no" ;; + esac + ]) + rm -f conftest.link conftest.lnk2]) + case "$gl_cv_func_readlink_works" in + *yes) + if test "$gl_cv_decl_readlink_works" != yes; then + REPLACE_READLINK=1 + fi + ;; + *) + AC_DEFINE([READLINK_TRAILING_SLASH_BUG], [1], [Define to 1 if readlink + fails to recognize a trailing slash.]) + REPLACE_READLINK=1 + ;; + esac + fi +]) + +# Like gl_FUNC_READLINK, except prepare for separate compilation +# (no REPLACE_READLINK, no AC_LIBOBJ). +AC_DEFUN([gl_FUNC_READLINK_SEPARATE], +[ + AC_CHECK_FUNCS_ONCE([readlink]) + gl_PREREQ_READLINK +]) + +# Prerequisites of lib/readlink.c. +AC_DEFUN([gl_PREREQ_READLINK], +[ + : +]) diff --git a/gdb/gnulib/import/m4/stat.m4 b/gdb/gnulib/import/m4/stat.m4 new file mode 100644 index 0000000..0fd117e --- /dev/null +++ b/gdb/gnulib/import/m4/stat.m4 @@ -0,0 +1,71 @@ +# serial 11 + +# Copyright (C) 2009-2012 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_STAT], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) + AC_CHECK_FUNCS_ONCE([lstat]) + dnl mingw is the only known platform where stat(".") and stat("./") differ + AC_CACHE_CHECK([whether stat handles trailing slashes on directories], + [gl_cv_func_stat_dir_slash], + [AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[#include <sys/stat.h> +]], [[struct stat st; return stat (".", &st) != stat ("./", &st);]])], + [gl_cv_func_stat_dir_slash=yes], [gl_cv_func_stat_dir_slash=no], + [case $host_os in + mingw*) gl_cv_func_stat_dir_slash="guessing no";; + *) gl_cv_func_stat_dir_slash="guessing yes";; + esac])]) + dnl AIX 7.1, Solaris 9, mingw64 mistakenly succeed on stat("file/"). + dnl (For mingw, this is due to a broken stat() override in libmingwex.a.) + dnl FreeBSD 7.2 mistakenly succeeds on stat("link-to-file/"). + AC_CACHE_CHECK([whether stat handles trailing slashes on files], + [gl_cv_func_stat_file_slash], + [touch conftest.tmp + # Assume that if we have lstat, we can also check symlinks. + if test $ac_cv_func_lstat = yes; then + ln -s conftest.tmp conftest.lnk + fi + AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[#include <sys/stat.h> +]], [[int result = 0; + struct stat st; + if (!stat ("conftest.tmp/", &st)) + result |= 1; +#if HAVE_LSTAT + if (!stat ("conftest.lnk/", &st)) + result |= 2; +#endif + return result; + ]])], + [gl_cv_func_stat_file_slash=yes], [gl_cv_func_stat_file_slash=no], + [case "$host_os" in + # Guess yes on glibc systems. + *-gnu*) gl_cv_func_stat_file_slash="guessing yes" ;; + # If we don't know, assume the worst. + *) gl_cv_func_stat_file_slash="guessing no" ;; + esac + ]) + rm -f conftest.tmp conftest.lnk]) + case $gl_cv_func_stat_dir_slash in + *no) REPLACE_STAT=1 + AC_DEFINE([REPLACE_FUNC_STAT_DIR], [1], [Define to 1 if stat needs + help when passed a directory name with a trailing slash]);; + esac + case $gl_cv_func_stat_file_slash in + *no) REPLACE_STAT=1 + AC_DEFINE([REPLACE_FUNC_STAT_FILE], [1], [Define to 1 if stat needs + help when passed a file name with a trailing slash]);; + esac +]) + +# Prerequisites of lib/stat.c. +AC_DEFUN([gl_PREREQ_STAT], [:]) diff --git a/gdb/gnulib/import/readlink.c b/gdb/gnulib/import/readlink.c new file mode 100644 index 0000000..baac132 --- /dev/null +++ b/gdb/gnulib/import/readlink.c @@ -0,0 +1,74 @@ +/* Stub for readlink(). + Copyright (C) 2003-2007, 2009-2012 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include <unistd.h> + +#include <errno.h> +#include <string.h> +#include <sys/stat.h> + +#if !HAVE_READLINK + +/* readlink() substitute for systems that don't have a readlink() function, + such as DJGPP 2.03 and mingw32. */ + +ssize_t +readlink (const char *name, char *buf _GL_UNUSED, + size_t bufsize _GL_UNUSED) +{ + struct stat statbuf; + + /* In general we should use lstat() here, not stat(). But on platforms + without symbolic links, lstat() - if it exists - would be equivalent to + stat(), therefore we can use stat(). This saves us a configure check. */ + if (stat (name, &statbuf) >= 0) + errno = EINVAL; + return -1; +} + +#else /* HAVE_READLINK */ + +# undef readlink + +/* readlink() wrapper that uses correct types, for systems like cygwin + 1.5.x where readlink returns int, and which rejects trailing slash, + for Solaris 9. */ + +ssize_t +rpl_readlink (const char *name, char *buf, size_t bufsize) +{ +# if READLINK_TRAILING_SLASH_BUG + size_t len = strlen (name); + if (len && name[len - 1] == '/') + { + /* Even if name without the slash is a symlink to a directory, + both lstat() and stat() must resolve the trailing slash to + the directory rather than the symlink. We can therefore + safely use stat() to distinguish between EINVAL and + ENOTDIR/ENOENT, avoiding extra overhead of rpl_lstat(). */ + struct stat st; + if (stat (name, &st) == 0) + errno = EINVAL; + return -1; + } +# endif /* READLINK_TRAILING_SLASH_BUG */ + return readlink (name, buf, bufsize); +} + +#endif /* HAVE_READLINK */ diff --git a/gdb/gnulib/import/stat.c b/gdb/gnulib/import/stat.c new file mode 100644 index 0000000..c0bcb88 --- /dev/null +++ b/gdb/gnulib/import/stat.c @@ -0,0 +1,138 @@ +/* Work around platform bugs in stat. + Copyright (C) 2009-2012 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* written by Eric Blake */ + +/* If the user's config.h happens to include <sys/stat.h>, let it include only + the system's <sys/stat.h> here, so that orig_stat doesn't recurse to + rpl_stat. */ +#define __need_system_sys_stat_h +#include <config.h> + +/* Get the original definition of stat. It might be defined as a macro. */ +#include <sys/types.h> +#include <sys/stat.h> +#undef __need_system_sys_stat_h + +#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +# if _GL_WINDOWS_64_BIT_ST_SIZE +# undef stat /* avoid warning on mingw64 with _FILE_OFFSET_BITS=64 */ +# define stat _stati64 +# define REPLACE_FUNC_STAT_DIR 1 +# undef REPLACE_FUNC_STAT_FILE +# elif REPLACE_FUNC_STAT_FILE +/* mingw64 has a broken stat() function, based on _stat(), in libmingwex.a. + Bypass it. */ +# define stat _stat +# define REPLACE_FUNC_STAT_DIR 1 +# undef REPLACE_FUNC_STAT_FILE +# endif +#endif + +static int +orig_stat (const char *filename, struct stat *buf) +{ + return stat (filename, buf); +} + +/* Specification. */ +/* Write "sys/stat.h" here, not <sys/stat.h>, otherwise OSF/1 5.1 DTK cc + eliminates this include because of the preliminary #include <sys/stat.h> + above. */ +#include "sys/stat.h" + +#include <errno.h> +#include <limits.h> +#include <stdbool.h> +#include <string.h> +#include "dosname.h" +#include "verify.h" + +#if REPLACE_FUNC_STAT_DIR +# include "pathmax.h" + /* The only known systems where REPLACE_FUNC_STAT_DIR is needed also + have a constant PATH_MAX. */ +# ifndef PATH_MAX +# error "Please port this replacement to your platform" +# endif +#endif + +/* Store information about NAME into ST. Work around bugs with + trailing slashes. Mingw has other bugs (such as st_ino always + being 0 on success) which this wrapper does not work around. But + at least this implementation provides the ability to emulate fchdir + correctly. */ + +int +rpl_stat (char const *name, struct stat *st) +{ + int result = orig_stat (name, st); +#if REPLACE_FUNC_STAT_FILE + /* Solaris 9 mistakenly succeeds when given a non-directory with a + trailing slash. */ + if (result == 0 && !S_ISDIR (st->st_mode)) + { + size_t len = strlen (name); + if (ISSLASH (name[len - 1])) + { + errno = ENOTDIR; + return -1; + } + } +#endif /* REPLACE_FUNC_STAT_FILE */ +#if REPLACE_FUNC_STAT_DIR + + if (result == -1 && errno == ENOENT) + { + /* Due to mingw's oddities, there are some directories (like + c:\) where stat() only succeeds with a trailing slash, and + other directories (like c:\windows) where stat() only + succeeds without a trailing slash. But we want the two to be + synonymous, since chdir() manages either style. Likewise, Mingw also + reports ENOENT for names longer than PATH_MAX, when we want + ENAMETOOLONG, and for stat("file/"), when we want ENOTDIR. + Fortunately, mingw PATH_MAX is small enough for stack + allocation. */ + char fixed_name[PATH_MAX + 1] = {0}; + size_t len = strlen (name); + bool check_dir = false; + verify (PATH_MAX <= 4096); + if (PATH_MAX <= len) + errno = ENAMETOOLONG; + else if (len) + { + strcpy (fixed_name, name); + if (ISSLASH (fixed_name[len - 1])) + { + check_dir = true; + while (len && ISSLASH (fixed_name[len - 1])) + fixed_name[--len] = '\0'; + if (!len) + fixed_name[0] = '/'; + } + else + fixed_name[len++] = '/'; + result = orig_stat (fixed_name, st); + if (result == 0 && check_dir && !S_ISDIR (st->st_mode)) + { + result = -1; + errno = ENOTDIR; + } + } + } +#endif /* REPLACE_FUNC_STAT_DIR */ + return result; +} |