1998-04-02  Ulrich Drepper  <drepper@cygnus.com>

	* stdlib/isomac.c: Use -isystem instead of -I for system include
	dir.

1998-03-30 08:05  H.J. Lu  <hjl@gnu.org>

	* resolv/res_comp.c (underscorechar): New.
	(middlechar): Allow '_'.

1998-04-02  Ulrich Drepper  <drepper@cygnus.com>

	* intl/explodename.c (stdlib.h): Include that file only if
	STDC_HEADERS or _LIBC.
	(string.h): Include that file only if HAVE_STRING_H or _LIBC.
	Patch by Philippe De Muyter <phdm@macqel.be>.

1998-04-01 21:08  Zack Weinberg  <zack@rabi.phys.columbia.edu>

	* aclocal.m4 (AC_PROG_CC_LOCAL): Remove superfluous tests.
	(AC_PROG_CHECK_VER): New macro.
	* configure.in: Use AC_PROG_CHECK_VER to check versions of
	gcc, gmake, msgfmt, makeinfo.  Remove superfluous tests.

1998-04-02 15:13  Ulrich Drepper  <drepper@cygnus.com>

	* sysdeps/unix/sysv/linux/i386/i686/sysdep.h: New file.
	* sysdeps/i386/i686/strtok.S: New file
	* sysdeps/i386/i686/strtok_r.S: New file

1998-04-02  Mark Kettenis  <kettenis@phys.uva.nl>

	* posix/unistd.h: [__USE_FILE_OFFSET64] (lseek): Change return
	type to __off64_t.
	* libio/stdio.h [__USE_FILE_OFFSET64] (fseeko): Declare offset
	parameter as __off64_t instead of __off_t.
	(ftello): Make alias for ftello64 instead of ftello.  Change
	return type to __off64_t.

1998-04-02  Ulrich Drepper  <drepper@cygnus.com>

	* sysdeps/i386/bits/string.h: Fix various typos.
	Patch by Horst von Brand <vonbrand@sleipnir.valparaiso.cl>.

	* sysdeps/unix/sysv/linux/getcwd.c: Use getcwd syscall in Linux 2.1.92.

1998-04-02  Ulrich Drepper  <drepper@cygnus.com>

	* sysdeps/unix/sysv/linux/i386/chown.c: Handle old kernels without
	lchown syscall correctly.  [PR libc/541].
This commit is contained in:
Ulrich Drepper 1998-04-02 17:42:53 +00:00
parent d0fc4041fe
commit 63bda0c13a
16 changed files with 819 additions and 448 deletions

View File

@ -1,3 +1,54 @@
1998-04-02 Ulrich Drepper <drepper@cygnus.com>
* stdlib/isomac.c: Use -isystem instead of -I for system include
dir.
1998-03-30 08:05 H.J. Lu <hjl@gnu.org>
* resolv/res_comp.c (underscorechar): New.
(middlechar): Allow '_'.
1998-04-02 Ulrich Drepper <drepper@cygnus.com>
* intl/explodename.c (stdlib.h): Include that file only if
STDC_HEADERS or _LIBC.
(string.h): Include that file only if HAVE_STRING_H or _LIBC.
Patch by Philippe De Muyter <phdm@macqel.be>.
1998-04-01 21:08 Zack Weinberg <zack@rabi.phys.columbia.edu>
* aclocal.m4 (AC_PROG_CC_LOCAL): Remove superfluous tests.
(AC_PROG_CHECK_VER): New macro.
* configure.in: Use AC_PROG_CHECK_VER to check versions of
gcc, gmake, msgfmt, makeinfo. Remove superfluous tests.
1998-04-02 15:13 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/unix/sysv/linux/i386/i686/sysdep.h: New file.
* sysdeps/i386/i686/strtok.S: New file
* sysdeps/i386/i686/strtok_r.S: New file
1998-04-02 Mark Kettenis <kettenis@phys.uva.nl>
* posix/unistd.h: [__USE_FILE_OFFSET64] (lseek): Change return
type to __off64_t.
* libio/stdio.h [__USE_FILE_OFFSET64] (fseeko): Declare offset
parameter as __off64_t instead of __off_t.
(ftello): Make alias for ftello64 instead of ftello. Change
return type to __off64_t.
1998-04-02 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/i386/bits/string.h: Fix various typos.
Patch by Horst von Brand <vonbrand@sleipnir.valparaiso.cl>.
* sysdeps/unix/sysv/linux/getcwd.c: Use getcwd syscall in Linux 2.1.92.
1998-04-02 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/unix/sysv/linux/i386/chown.c: Handle old kernels without
lchown syscall correctly. [PR libc/541].
1998-04-02 11:45 Ulrich Drepper <drepper@cygnus.com>
* localedata/Makefile: Correct testsuite rules.

96
aclocal.m4 vendored
View File

@ -32,51 +32,79 @@ fi
AC_MSG_RESULT($ac_cv_check_symbol_$1)])dnl
dnl
dnl Locate a program and check that its version is acceptable.
dnl AC_PROG_CHECK_VER(var, namelist, version-switch,
dnl [version-extract-regexp], version-glob, fatal)
AC_DEFUN(AC_CHECK_PROG_VER,
[# Prepare to iterate over the program-name list.
set dummy $2; shift
AC_MSG_CHECKING([for [$]1])
AC_CACHE_VAL(ac_cv_prog_$1, [dnl
if test -n "[$]$1"; then
ac_cv_prog_$1="[$]$1" # Let the user override the test.
else
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
for ac_word; do
for ac_dir in $PATH; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/$ac_word; then
ac_cv_prog_$1="$ac_word"
break
fi
done
test -n "$ac_cv_prog_$1" && break
done
IFS="$ac_save_ifs"
fi])dnl
if test -z "$ac_cv_prog_$1"; then
AC_MSG_RESULT(no)
$1=:
ac_verc_fail=t; ifelse([$6],,,[ac_verc_fatal=$6])
else
# Found it, now check the version.
ac_word=$ac_cv_prog_$1
dnl Do this by hand to avoid "(cached) (cached)".
if test "[$]{ac_cv_prog_$1_ver+set}" != set; then
changequote(<<,>>)dnl
ac_cv_prog_$1_ver=`$ac_word $3 2>&1 ifelse(<<$4>>,,,<<| sed -n 's/^.*$4.*$/\1/p'>>)`
fi
if test -n "$ac_cv_prog_$1_ver"; then
case $ac_cv_prog_$1_ver in
<<$5>>) ac_vers_ok=", ok"; $1=$ac_cv_prog_$1;;
changequote([,])dnl
*) ac_vers_ok=", bad"; $1=:
ac_verc_fail=t; ifelse([$6],,,[ac_verc_fatal=$6]);;
esac
else
ac_vers_ok="v. ?.??, bad"; $1=:
ac_verc_fail=t; ifelse([$6],,,[ac_verc_fatal=$6])
fi
AC_MSG_RESULT($ac_word $ac_cv_prog_$1_ver$ac_vers_ok)
fi
AC_SUBST($1)dnl
])
dnl These modifications are to allow for an empty cross compiler tree.
dnl In the situation that cross-linking is impossible, the variable
dnl `cross_linkable' will be substituted with "yes".
dnl The vercheck macros are expected to have been called already.
AC_DEFUN(AC_PROG_CC_LOCAL,
[AC_BEFORE([$0], [AC_PROG_CPP])dnl
AC_CHECK_PROG(CC, gcc, gcc)
if test -z "$CC"; then
AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
fi
AC_PROG_CC_WORKS_LOCAL
AC_PROG_CC_GNU
dnl The following differs from the AC_PROG_CC macro in autoconf. Since
dnl we require a recent version of gcc to be used we do not need to go
dnl into lengths and test for bugs in old versions. It must be gcc 2.7
dnl or above.
if test $ac_cv_prog_gcc = yes; then
GCC=yes
dnl Check the version
cat > conftest.c <<EOF
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
yes;
#endif
EOF
if AC_TRY_COMMAND(${CC-cc} -E conftest.c) | egrep yes >/dev/null 2>&1; then
if test -z "$CFLAGS"; then
CFLAGS="-g -O2"
fi
else
AC_MSG_ERROR([We require GNU CC version 2.7 or newer])
fi
else
if test $ac_cv_prog_gcc != yes; then
AC_MSG_ERROR([GNU libc must be compiled using GNU CC])
fi
])
AC_DEFUN(AC_PROG_CC_WORKS_LOCAL,
[AC_MSG_CHECKING([whether the C compiler ($CC $CFLAGS $LDFLAGS) works])
AC_LANG_SAVE
AC_CACHE_VAL(ac_cv_prog_cc_works,
[AC_LANG_SAVE
AC_LANG_C
AC_TRY_COMPILER([main(){return(0);}], ac_cv_prog_cc_works, ac_cv_prog_cc_cross)
AC_LANG_RESTORE
AC_LANG_RESTORE])
AC_MSG_RESULT($ac_cv_prog_cc_works)
if test $ac_cv_prog_cc_works = no; then
cross_linkable=no
@ -85,8 +113,9 @@ dnl AC_MSG_ERROR([installation or configuration problem: C compiler cannot creat
else
cross_linkable=yes
fi
AC_MSG_CHECKING([whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler])
AC_MSG_RESULT($ac_cv_prog_cc_cross)
AC_CACHE_CHECK(
[whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler],
ac_cv_prog_cc_cross, [:])
AC_SUBST(cross_linkable)
cross_compiling=$ac_cv_prog_cc_cross
])
@ -105,7 +134,7 @@ AC_DEFUN(LIBC_PROG_BINUTILS,
if test -n "$path_binutils"; then
# Make absolute; ensure a single trailing slash.
path_binutils=`(cd $path_binutils; pwd) | sed 's%/*$%/%'`
CC="$CC -B$with_binutils"
CC="$CC -B$path_binutils"
fi
AS=`$CC -print-file-name=as`
LD=`$CC -print-file-name=ld`
@ -118,4 +147,5 @@ gnu_as=$libc_cv_prog_as_gnu
AC_CACHE_CHECK(whether $LD is GNU ld, libc_cv_prog_ld_gnu,
[LIBC_PROG_FOO_GNU($LD, libc_cv_prog_ld_gnu=yes, libc_cv_prog_ld_gnu=no)])
gnu_ld=$libc_cv_prog_ld_gnu])
gnu_ld=$libc_cv_prog_ld_gnu
])

573
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -429,33 +429,30 @@ if test "$INSTALL" = "${srcdir}/install-sh -c"; then
INSTALL='\$(..)./install-sh -c'
fi
AC_PROG_LN_S
AC_CHECK_PROGS(MSGFMT, msgfmt gmsgfmt, :)
if test "$MSGFMT" != ":"; then
changequote(,)dnl Need [] for regexps.
if $MSGFMT --version 2>&1 | grep 'GNU gettext.*0\.[1-9][0-9]' >/dev/null 2>&1
changequote([,])dnl
then : # msgfmt from gettext 0.10 or greater, works.
else
AC_MSG_WARN([
*** (g)msgfmt is too old or wrong version (need gettext 0.10 or better).])
MSGFMT=":"
fi
fi
AC_CHECK_PROG(MAKEINFO, makeinfo, makeinfo)
if test "$MAKEINFO"; then
changequote(,)dnl Need [] for regexps.
if $MAKEINFO --version | grep 'texinfo 3\.[1-9][1-9]' >/dev/null 2>&1
changequote([,])dnl
then : # Makeinfo 3.11 or greater, works.
else
AC_MSG_WARN([
*** makeinfo is too old (need version 3.11 or better).
*** You should install the needed version and re-configure since otherwise
*** you won't get the info pages installed.])
MAKEINFO=
fi
fi
# These programs are version sensitive.
AC_CHECK_PROG_VER(CC, gcc cc, -v,
[version \([egcs0-9.-]*\)],
[egcs-2.91.*|egcs-2.90.2[789]|egcs-2.90.[3-9][0-9]|2.8.[1-9]*|2.9.[0-9]*], t)
AC_CHECK_PROG_VER(MAKE, make gmake, --version,
[version \([0-9][0-9.]*\), by],
[3.75 | 3.76.[2-9] | 3.7[789]* | 3.[89]*], t)
AC_CHECK_PROG_VER(MSGFMT, msgfmt gmsgfmt, --version,
[GNU gettext.*\([0-9][0-9]*\.[0-9]*\)],
[0.[1-9][0-9] | [1-9].*])
AC_CHECK_PROG_VER(MAKEINFO, makeinfo, --version,
[GNU texinfo \([0-9][0-9.]*\)],
[3.1[1-9] | 3.[2-9][0-9]])
test -n "$ac_verc_fatal" && AC_MSG_ERROR([
*** Some critical program is missing or too old.
*** Check the INSTALL file for required versions.])
test -n "$ac_verc_fail" && AC_MSG_WARN([
*** An auxiliary program is missing or too old;
*** some features will be disabled.
*** Check the INSTALL file for required versions.])
AC_PROG_CC_LOCAL
AC_CANONICAL_BUILD
@ -482,26 +479,6 @@ fi
rm -f $tmpo $tmplib])
AC_SUBST(libc_cv_ar_S)dnl
# check for recent compiler
AC_MSG_CHECKING(compiler version)
changequote(,)dnl
case `${CC-cc} -v 2>&1` in
*egcs-2.91.* | *egcs-1.0.[2-9]* | *egcs-1.1* | *2.8.[1-9]* | *2.9.[0-9]*)
cc_is_recent="ok"
;;
*)
cc_is_recent="too old"
;;
esac
changequote([,])dnl
AC_MSG_RESULT($cc_is_recent)
if test "$cc_is_recent" != "ok"; then
AC_MSG_WARN([
*** Your compiler is too old.
*** You need at least egcs 1.0.2 or GNU CC 2.8.1 to compile glibc.
])
fi
# Test if LD_LIBRARY_PATH contains the notation for the current directory
# since this would lead to problems installing/building glibc.
# LD_LIBRARY_PATH contains the current directory if one of the following
@ -522,9 +499,10 @@ esac
changequote([,])dnl
AC_MSG_RESULT($ld_library_path_setting)
if test "$ld_library_path_setting" != "ok"; then
AC_MSG_ERROR(
*** LD_LIBRARY_PATH shouldn't contain the current path when building glibc.
*** Please change the environment variable and run configure again.)
AC_MSG_ERROR([
*** LD_LIBRARY_PATH shouldn't contain the current directory when
*** building glibc. Please change the environment variable
*** and run configure again.])
fi
AC_PATH_PROG(BASH, bash, no)
@ -608,36 +586,6 @@ if test $libc_cv_need_minus_P = yes; then
asm-CPPFLAGS = -P # The assembler can't grok cpp's # line directives."
fi
# gcc 2.7.x has a bug where if -pipe is set, the assembler will always
# be told to read stdin. This causes the compiler to hang when fed an
# .s file.
if test $ac_cv_prog_gcc = yes; then
case `${CC-cc} -v 2>&1` in
*2.7*)
# We must check this even if -pipe is not given here, because the user
# might do `make CFLAGS=-pipe'.
AC_CACHE_CHECK(for gcc 2.7.x -pipe bug, libc_cv_gcc_pipe_bug, [dnl
cp /dev/null conftest.s
cat >conftest1.s <<EOF
.nosuchdirective
EOF
if ${CC-cc} -pipe -c conftest.s <conftest1.s 2>/dev/null; then
libc_cv_gcc_pipe_bug=no
else
libc_cv_gcc_pipe_bug=yes
fi
rm -f conftest*])
if test $libc_cv_gcc_pipe_bug = yes; then
makeCC="${CC-cc} -B\$(common-objpfx)"
makeCFLAGS=$CFLAGS
CFLAGS=`echo $CFLAGS |sed 's/-pipe//'`
fi;;
*) libc_cv_gcc_pipe_bug=no;;
esac
else
libc_cv_gcc_pipe_bug=no
fi
AC_CACHE_CHECK(for assembler global-symbol directive,
libc_cv_asm_global_directive, [dnl
libc_cv_asm_global_directive=UNKNOWN
@ -1179,16 +1127,5 @@ fi
VERSION=`sed -e 's/^#define VERSION "\([^"]*\)"/\1/p' -e d < $srcdir/version.h`
AC_SUBST(VERSION)
if test $libc_cv_gcc_pipe_bug = yes; then
realCC=$CC
CC=$makeCC
CFLAGS=$makeCFLAGS
fi
AC_OUTPUT_COMMANDS([
if test "$realCC"; then
sed -e 's/%{pipe:-}/%|/g' `$realCC -print-file-name=specs` >specsT
mv specsT specs
fi], [realCC=$realCC])
AC_OUTPUT(config.make glibcbug ${config_makefile} ${config_uname}, ,
[echo '$config_vars' >> config.make; test -d bits || mkdir bits])

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
/* Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
This file is part of the GNU C Library. Its master source is NOT part of
@ -23,8 +23,15 @@
# include <config.h>
#endif
#include <stdlib.h>
#include <string.h>
#if defined STDC_HEADERS || defined _LIBC
# include <stdlib.h>
#endif
#if defined HAVE_STRING_H || defined _LIBC
# include <string.h>
#else
# include <strings.h>
#endif
#include <sys/types.h>
#include "loadinfo.h"

View File

@ -1,5 +1,5 @@
/* Define ISO C stdio on top of C++ iostreams.
Copyright (C) 1991, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
Copyright (C) 1991, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
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
@ -559,7 +559,7 @@ typedef __off64_t off64_t;
# ifndef __USE_FILE_OFFSET64
extern int fseeko __P ((FILE *__stream, __off_t __off, int __whence));
# else
extern int fseeko __P ((FILE *__stream, __off_t __off, int __whence))
extern int fseeko __P ((FILE *__stream, __off64_t __off, int __whence))
__asm__ ("fseeko64");
# endif
# ifdef __USE_LARGEFILE64
@ -570,7 +570,7 @@ extern int fseeko64 __P ((FILE *__stream, __off64_t __off, int __whence));
# ifndef __USE_FILE_OFFSET64
extern __off_t ftello __P ((FILE *__stream));
# else
extern __off_t ftello __P ((FILE *__stream)) __asm__ ("ftello");
extern __off64_t ftello __P ((FILE *__stream)) __asm__ ("ftello64");
# endif
# ifdef __USE_LARGEFILE64
extern __off64_t ftello64 __P ((FILE *__stream));

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
/* Copyright (C) 1991,92,93,94,95,96,97,98 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
@ -273,7 +273,7 @@ extern __off_t __lseek __P ((int __fd, __off_t __offset, int __whence));
#ifndef __USE_FILE_OFFSET64
extern __off_t lseek __P ((int __fd, __off_t __offset, int __whence));
#else
extern __off_t lseek __P ((int __fd, __off64_t __offset, int __whence))
extern __off64_t lseek __P ((int __fd, __off64_t __offset, int __whence))
__asm__ ("lseek64");
#endif
#ifdef __USE_LARGEFILE64

View File

@ -354,6 +354,7 @@ dn_find(exp_dn, msg, dnptrs, lastdnptr)
*/
#define PERIOD 0x2e
#define hyphenchar(c) ((c) == 0x2d)
#define underscorechar(c) ((c) == 0x5f)
#define bslashchar(c) ((c) == 0x5c)
#define periodchar(c) ((c) == PERIOD)
#define asterchar(c) ((c) == 0x2a)
@ -362,7 +363,7 @@ dn_find(exp_dn, msg, dnptrs, lastdnptr)
#define digitchar(c) ((c) >= 0x30 && (c) <= 0x39)
#define borderchar(c) (alphachar(c) || digitchar(c))
#define middlechar(c) (borderchar(c) || hyphenchar(c))
#define middlechar(c) (borderchar(c) || hyphenchar(c) || underscorechar(c))
#define domainchar(c) ((c) > 0x20 && (c) < 0x7f)
int

View File

@ -1,5 +1,5 @@
/* Check system header files for ISO 9899:1990 (ISO C) compliance.
Copyright (C) 1996, 1997 Free Software Foundation, Inc.
Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jens Schweikhardt <schweikh@noc.dfn.de>, 1996.
@ -176,8 +176,8 @@ static char *macros[] =
/* Format string to build command to invoke compiler. */
static const char fmt[] = "\
echo \"#include <%s>\" |\
%s -E -dM -ansi -pedantic %s -D_LIBC -I. -I `%s --print-prog-name=include` -\
> %s";
%s -E -dM -ansi -pedantic %s -D_LIBC -I. \
-isystem `%s --print-prog-name=include` - > %s";
/* The compiler we use (given on the command line). */

View File

@ -72,7 +72,7 @@ __memcpy_c (void *__dest, __const void *__src, size_t __n)
*(2 + (const unsigned short int *) __src);
return __dest;
case 8:
*(unsigned long int *) __dest = *(const unsigned long int *) __to;
*(unsigned long int *) __dest = *(const unsigned long int *) __src;
*(1 + (unsigned long int *) __dest) =
*(1 + (const unsigned long int *) __src);
return __dest;
@ -177,13 +177,13 @@ __memset_cc (void *__s, unsigned long int __pattern, size_t __n)
switch (__n)
{
case 0:
return s;
return __s;
case 1:
*(unsigned char *) __s = __pattern;
return __s;
case 2:
*(unsigned short int *) __s = __pattern;
return s;
return __s;
case 3:
*(unsigned short int *) __s = __pattern;
*(2 + (unsigned char *) __s) = __pattern;
@ -210,7 +210,7 @@ __memset_cc (void *__s, unsigned long int __pattern, size_t __n)
__COMMON_CODE ("\n\tstosb");
return __s;
case 2:
__COMMON__CODE ("\n\tstosw");
__COMMON_CODE ("\n\tstosw");
return s;
case 3:
__COMMON_CODE ("\n\tstosw\n\tstosb");

240
sysdeps/i386/i686/strtok.S Normal file
View File

@ -0,0 +1,240 @@
/* strtok (str, delim) -- Return next DELIM separated token from STR.
For Intel 80686.
Copyright (C) 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
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. */
#include <sysdep.h>
#include "asm-syntax.h"
/* This file can be used for three variants of the strtok function:
strtok:
INPUT PARAMETER:
str (sp + 4)
delim (sp + 8)
strtok_r:
INPUT PARAMETER:
str (sp + 4)
delim (sp + 8)
save_ptr (sp + 12)
We do a common implementation here. */
#ifndef USE_AS_STRTOK_R
.bss
.local save_ptr
ASM_TYPE_DIRECTIVE (save_ptr, @object)
.size save_ptr, 4
save_ptr:
.space 4
#define FUNCTION strtok
#endif
.text
#if !defined USE_AS_STRTOK_R && defined PIC
0: movl (%esp), %ebx
ret
#endif
ENTRY (FUNCTION)
#if !defined USE_AS_STRTOK_R && defined PIC
pushl %ebx /* Save PIC register. */
call 0b
addl $_GLOBAL_OFFSET_TABLE_, %ebx
#endif
/* First we create a table with flags for all possible characters.
For the ASCII (7bit/8bit) or ISO-8859-X character sets which are
supported by the C string functions we have 256 characters.
Before inserting marks for the stop characters we clear the whole
table. */
movl %edi, %edx
subl $256, %esp
movl $64, %ecx
movl %esp, %edi
xorl %eax, %eax
rep
stosl
/* Note: %ecx = 0 !!! */
movl %edx, %edi
#if !defined USE_AS_STRTOK_R && defined PIC
movl 264(%esp), %edx /* Get start of string. */
#else
movl 260(%esp), %edx /* Get start of string. */
#endif
#ifdef USE_AS_STRTOK_R
/* The value is stored in the third argument. */
movl 268(%esp), %eax
movl (%eax), %eax
#else
/* The value is in the local variable defined above. But
we have to take care for PIC code. */
# ifndef PIC
movl save_ptr, %eax
# else
movl save_ptr@GOTOFF(%ebx), %eax
# endif
#endif
/* If the pointer is NULL we have to use the stored value of
the last run. */
cmpl $0, %edx
cmove %eax, %edx
#if !defined USE_AS_STRTOK_R && defined PIC
movl 268(%esp), %eax /* Get start of delimiter set. */
#else
movl 264(%esp), %eax /* Get start of delimiter set. */
#endif
/* For understanding the following code remember that %ecx == 0 now.
Although all the following instruction only modify %cl we always
have a correct zero-extended 32-bit value in %ecx. */
L(2): movb (%eax), %cl /* get byte from stopset */
testb %cl, %cl /* is NUL char? */
jz L(1) /* yes => start compare loop */
movb %cl, (%esp,%ecx) /* set corresponding byte in stopset table */
movb 1(%eax), %cl /* get byte from stopset */
testb $0xff, %cl /* is NUL char? */
jz L(1) /* yes => start compare loop */
movb %cl, (%esp,%ecx) /* set corresponding byte in stopset table */
movb 2(%eax), %cl /* get byte from stopset */
testb $0xff, %cl /* is NUL char? */
jz L(1) /* yes => start compare loop */
movb %cl, (%esp,%ecx) /* set corresponding byte in stopset table */
movb 3(%eax), %cl /* get byte from stopset */
addl $4, %eax /* increment stopset pointer */
movb %cl, (%esp,%ecx) /* set corresponding byte in stopset table */
testb $0xff, %cl /* is NUL char? */
jnz L(2) /* no => process next dword from stopset */
L(1): leal -4(%edx), %eax /* prepare loop */
/* We use a neat trick for the following loop. Normally we would
have to test for two termination conditions
1. a character in the stopset was found
and
2. the end of the string was found
As a sign that the character is in the stopset we store its
value in the table. The value of NUL is NUL so the loop
terminates for NUL in every case. */
L(3): addl $4, %eax /* adjust pointer for full loop round */
movb (%eax), %cl /* get byte from string */
testb %cl, (%esp,%ecx) /* is it contained in stopset? */
jz L(4) /* no => start of token */
movb 1(%eax), %cl /* get byte from string */
testb %cl, (%esp,%ecx) /* is it contained in stopset? */
jz L(5) /* no => start of token */
movb 2(%eax), %cl /* get byte from string */
testb %cl, (%esp,%ecx) /* is it contained in stopset? */
jz L(6) /* no => start of token */
movb 3(%eax), %cl /* get byte from string */
testb %cl, (%esp,%ecx) /* is it contained in stopset? */
jnz L(3) /* yes => start of loop */
incl %eax /* adjust pointer */
L(6): incl %eax
L(5): incl %eax
/* Now we have to terminate the string. */
L(4): leal -4(%eax), %edx /* We use %EDX for the next run. */
L(7): addl $4, %edx /* adjust pointer for full loop round */
movb (%edx), %cl /* get byte from string */
cmpb %cl, (%esp,%ecx) /* is it contained in skipset? */
je L(8) /* yes => return */
movb 1(%edx), %cl /* get byte from string */
cmpb %cl, (%esp,%ecx) /* is it contained in skipset? */
je L(9) /* yes => return */
movb 2(%edx), %cl /* get byte from string */
cmpb %cl, (%esp,%ecx) /* is it contained in skipset? */
je L(10) /* yes => return */
movb 3(%edx), %cl /* get byte from string */
cmpb %cl, (%esp,%ecx) /* is it contained in skipset? */
jne L(7) /* no => start loop again */
incl %edx /* adjust pointer */
L(10): incl %edx
L(9): incl %edx
L(8): /* Remove the stopset table. */
addl $256, %esp
cmpl %eax, %edx
je L(returnNULL) /* There was no token anymore. */
movb $0, (%edx) /* Terminate string. */
/* Are we at end of string? */
cmpb $0, %cl
leal 1(%edx), %ecx
cmovne %ecx, %edx
/* Store the pointer to the next character. */
#ifdef USE_AS_STRTOK_R
movl 12(%esp), %ecx
movl %edx, (%ecx)
#else
# ifndef PIC
movl %edx, save_ptr
# else
movl %edx, save_ptr@GOTOFF(%ebx)
popl %ebx
# endif
#endif
ret
L(returnNULL):
xorl %eax, %eax
/* Store current pointer for next round. */
#ifdef USE_AS_STRTOK_R
movl 12(%esp), %ecx
movl %edx, (%ecx)
#else
# ifndef PIC
movl %edx, save_ptr
# else
movl %edx, save_ptr@GOTOFF(%ebx)
popl %ebx
# endif
#endif
ret
END (FUNCTION)

View File

@ -0,0 +1,4 @@
#define FUNCTION __strtok_r
#define USE_AS_STRTOK_R 1
#include <sysdeps/i386/i686/strtok.S>
weak_alias (__strtok_r, strtok_r)

View File

@ -1,5 +1,5 @@
/* Determine current working directory. Linux version.
Copyright (C) 1997 Free Software Foundation, Inc.
Copyright (C) 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@ -22,6 +22,7 @@
#include <limits.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/syscall.h>
/* The "proc" filesystem provides an easy method to retrieve the value.
@ -31,10 +32,20 @@
the proc filesystem mounted. Use the POSIX implementation in this case. */
static char *generic_getcwd (char *buf, size_t size) internal_function;
#ifdef __NR_getcwd
/* Kernel 2.1.92 introduced a third way to get the current working
directory: a syscall. We've got to be careful that even when
compiling under 2.1.92+ the libc still runs under older kernels. */
extern int __syscall_getcwd (char *buf, unsigned long size);
static no_syscall_getcwd;
static int no_new_dcache = 1;
#else
static int no_new_dcache;
#endif
char *
__getcwd (char *buf, size_t size)
{
static int no_new_dcache = 0;
int save_errno;
char *path;
int n;
@ -66,6 +77,41 @@ __getcwd (char *buf, size_t size)
save_errno = errno;
#ifdef __NR_getcwd
if (!no_syscall_getcwd)
{
int retval;
do
retval = __syscall_getcwd (path, alloc_size);
if (retval >= 0)
{
if (buf == NULL)
{
buf = realloc (path, strlen (path) + 1);
if (buf == NULL)
/* `relloc' failed but we still have the original string. */
buf = path;
}
return buf;
}
if (errno == ENOSYS)
{
no_syscall_getcwd = 1;
no_new_dcache = 0; /* Now we will try the /proc method. */
}
else if (errno != ERANGE || buf != NULL)
{
if (buf == NULL)
free (path);
return NULL;
}
__set_errno (save_errno);
}
#endif
n = __readlink ("/proc/self/cwd", path, alloc_size - 1);
if (n != -1)
{
@ -79,7 +125,14 @@ __getcwd (char *buf, size_t size)
}
path[n] = '\0';
return buf ?: (char *) realloc (path, (size_t) n + 1);
if (buf == NULL)
{
buf = realloc (path, (size_t) n + 1);
if (buf == NULL)
/* `relloc' failed but we still have the original string. */
buf = path;
}
return buf;
}
else
no_new_dcache = 1;

View File

@ -59,9 +59,15 @@ __real_chown (const char *file, uid_t owner, gid_t group)
#endif
#if !defined __NR_lchown || \
(defined HAVE_ELF && defined PIC && defined DO_VERSIONING)
/* compiling under older kernels or for compatibiity */
#ifndef __NR_lchown
/* Compiling under older kernels. */
int
__chown_is_lchown (const char *file, uid_t owner, gid_t group)
{
return __syscall_chown (file, owner, group);
}
#elif defined HAVE_ELF && defined PIC && defined DO_VERSIONING
/* Compiling for compatibiity. */
int
__chown_is_lchown (const char *file, uid_t owner, gid_t group)
{

View File

@ -0,0 +1,71 @@
/* Copyright (C) 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper, <drepper@cygnus.com>, 1998.
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. */
#ifndef _LINUX_I386_I686_SYSDEP_H
#define _LINUX_I386_I686_SYSDEP_H 1
/* There is some commonality. */
#include <sysdeps/unix/sysv/linux/i386/sysdep.h>
/* We define special versions of the error handler code to match the i686's
deep branch prediction mechanism. */
#ifdef PIC
# undef SYSCALL_ERROR_HANDLER
/* Store (- %eax) into errno through the GOT. */
# ifdef _LIBC_REENTRANT
# define SYSCALL_ERROR_HANDLER \
.type syscall_error,@function; \
0:movl (%esp),%ebx; \
ret; \
syscall_error: \
pushl %ebx; \
call 0b; \
addl $_GLOBAL_OFFSET_TABLE_, %ebx; \
xorl %edx, %edx; \
subl %eax, %edx; \
pushl %edx; \
call __errno_location@PLT; \
popl %ecx; \
popl %ebx; \
movl %ecx, (%eax); \
movl $-1, %eax; \
jmp L(pseudo_end); \
.size syscall_error,.-syscall_error;
/* A quick note: it is assumed that the call to `__errno_location' does
not modify the stack! */
# else
# define SYSCALL_ERROR_HANDLER \
.type syscall_error,@function; \
0:movl (%esp),%ecx; \
ret; \
syscall_error: \
call 0b; \
addl $_GLOBAL_OFFSET_TABLE_, %ecx; \
xorl %edx, %edx; \
subl %eax, %edx; \
movl errno@GOT(%ecx), %ecx; \
movl %edx, (%ecx); \
movl $-1, %eax; \
jmp L(pseudo_end); \
.size syscall_error,.-syscall_error;
# endif /* _LIBC_REENTRANT */
#endif /* PIC */
#endif /* linux/i386/i686/sysdep.h */

View File

@ -140,10 +140,10 @@ syscall_error: \
%ecx and %edx when we have more than 1 and 2 registers resp.
The code below might look a bit long but we have to take care for
the pipelined processors (i586 and up). Here the `pushl' and `popl'
the pipelined processors (i586). Here the `pushl' and `popl'
instructions are marked as NP (not pairable) but the exception is
two consecutive of these instruction. This gives no penalty on
i386 and i486 processors though. */
other processors though. */
#undef DO_CALL
#define DO_CALL(args, syscall_name) \