From c57abfa73560ac665e126a66081e1549bcd4645b Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Thu, 20 Mar 1997 02:20:57 +0000 Subject: Update. 1997-03-20 01:49 Ulrich Drepper * sysdeps/libm-ieee754/s_tanhl.c (__tanhl): Correct handling of -inf. * Makeconfig: (rpath-link): Add math/ directory. (math-objdir): New variable. (link-extra-lib): Define to special version when $(common-objpfx)!=$(objpfx) to allow libraries outside $(common-objpfx) be linked to the application. * math/Makefile: Add rules to build and run test programs. * math/libm-test.c (_GNU_SOURCE): Define only if still undefined. (check_equal): Correct check for error. (ceil_test): Fix typo. (log_test): Fix typo. (floor_test): Fix typo. (pow_test): Fix typos. (log10_test): Allow slight incorrectness for `log10(e)'. (modf_test): New functions to test `modf' et.al. (hypot_test): Rewrite test completely. Patch partly by Andreas Jaeger. * math/test-double.h (__NO_MATH_INLINES): Define only if not already defined. * math/test-float.h: Likewise. * math/test-logdouble.h: Likewise. * setjmp/setjmp.h: Change references of ANSI C to ISO C. * setjmp/tst-setjmp.c: Correct and extend test suite. * sysdeps/i386/__longjmp.S: Update copyright. * sysdeps/i386/bsd-_setjmp.S: Correct fatal bug in jump to `__sigsetjmp' in PIC code. * sysdeps/i386/bsd-setjmp.S: Likewise. * sysdeps/libm-i387/e_pow.S: Correct recognition of mantissa overflow. * sysdeps/libm-i387/e_powf.S: Likewise. * sysdeps/libm-i387/s_expm1.S: Handle x == +-0 as a special case since expm1(-0) == -0. * sysdeps/libm-i387/s_expm1f.S: Likewise. * sysdeps/libm-i387/s_expm1l.S: Likewise. * sysdeps/libm-ieee754/s_modf.c: Optimize code by avoiding unneeded access to FP number. * sysdeps/libm-ieee754/s_modff.c: Likewise. * sysdeps/libm-ieee754/s_modfl.c: Correct former completely bogus code. It never worked correctly. * sysdeps/libm-ieee754/s_tanh.c: Handle x == +-0 as a special case since tanh(-0) == -0. * sysdeps/libm-ieee754/s_tanhf.c: Likewise. 1997-03-19 21:13 Ulrich Drepper * stdlib/strtod.c (STRTOL): Use wchar_t as type for `decimal' and `thousands' to support systems with sizeof(wchar_t) != sizeof(wint_t). Blargh. * sysdeps/unix/sysv/linux/socketbits.h: Remove definition of SOL_IP, SOL_TCP, SOL_UDP, and SOL_IPX as they are defined in appropriate headers. * sysdeps/unix/sysv/linux/writev.c: Don't use MAX_IOVEC. Test for UIO_FASTIOV and set to 8 if not available. * sysdeps/unix/sysv/linux/readv.c: Likewise. Patch by HJ Lu. * sysdeps/unix/sysv/linux/xstat.c: Include , not "kernel_stat.h". * sysdeps/unix/sysv/linux/lxstat.c: Likewise. * sysdeps/unix/sysv/linux/fxstat.c: Likewise. Reported by fabsoft@fabsoft2.zarm.uni-bremen.de. --- sysdeps/i386/__longjmp.S | 28 ++++++++++++------------ sysdeps/i386/bsd-_setjmp.S | 42 +++++++++++++++++++++++------------- sysdeps/i386/bsd-setjmp.S | 42 +++++++++++++++++++++++------------- sysdeps/libm-i387/e_pow.S | 2 +- sysdeps/libm-i387/e_powf.S | 2 +- sysdeps/libm-i387/s_expm1.S | 8 ++++--- sysdeps/libm-i387/s_expm1f.S | 8 ++++--- sysdeps/libm-i387/s_expm1l.S | 8 ++++--- sysdeps/libm-ieee754/s_modf.c | 10 ++++----- sysdeps/libm-ieee754/s_modff.c | 8 ++++--- sysdeps/libm-ieee754/s_modfl.c | 19 +++++++--------- sysdeps/libm-ieee754/s_tanh.c | 6 ++++-- sysdeps/libm-ieee754/s_tanhf.c | 6 ++++-- sysdeps/libm-ieee754/s_tanhl.c | 7 ++++-- sysdeps/unix/bsd/osf/.cvsignore | 1 + sysdeps/unix/sysv/linux/fxstat.c | 2 +- sysdeps/unix/sysv/linux/lxstat.c | 2 +- sysdeps/unix/sysv/linux/readv.c | 15 ++++++------- sysdeps/unix/sysv/linux/socketbits.h | 9 ++++---- sysdeps/unix/sysv/linux/writev.c | 15 ++++++------- sysdeps/unix/sysv/linux/xstat.c | 2 +- 21 files changed, 136 insertions(+), 106 deletions(-) create mode 100644 sysdeps/unix/bsd/osf/.cvsignore (limited to 'sysdeps') diff --git a/sysdeps/i386/__longjmp.S b/sysdeps/i386/__longjmp.S index cb33a89de1..f6331d496d 100644 --- a/sysdeps/i386/__longjmp.S +++ b/sysdeps/i386/__longjmp.S @@ -1,21 +1,21 @@ /* longjmp for i386. -Copyright (C) 1995, 1996 Free Software Foundation, Inc. -This file is part of the GNU C Library. + Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. -The GNU C Library is free software; you can redistribute it and/or -modify it under the terms of the GNU 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 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. + 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., 675 Mass Ave, -Cambridge, MA 02139, USA. */ + 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 #define _ASM diff --git a/sysdeps/i386/bsd-_setjmp.S b/sysdeps/i386/bsd-_setjmp.S index a7ee5dbc1e..47972b28d1 100644 --- a/sysdeps/i386/bsd-_setjmp.S +++ b/sysdeps/i386/bsd-_setjmp.S @@ -1,21 +1,21 @@ /* BSD `_setjmp' entry point to `sigsetjmp (..., 0)'. i386 version. -Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc. -This file is part of the GNU C Library. + Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. -The GNU C Library is free software; you can redistribute it and/or -modify it under the terms of the GNU 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 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. + 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., 675 Mass Ave, -Cambridge, MA 02139, USA. */ + 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. */ /* This just does a tail-call to `__sigsetjmp (ARG, 0)'. We cannot do it in C because it must be a tail-call, so frame-unwinding @@ -29,5 +29,17 @@ ENTRY (_setjmp) pushl $0 /* Push second argument of zero. */ pushl %ecx /* Push back first argument. */ pushl %eax /* Push back return PC. */ - jmp JUMPTARGET (C_SYMBOL_NAME (__sigsetjmp)) +#ifdef PIC + /* We cannot use the PLT, because it requires that %ebx be set, but + we can't save and restore our caller's value. Instead, we do an + indirect jump through the GOT, using for the temporary register + %ecx, which is call-clobbered. */ + call here +here: popl %ecx + addl $_GLOBAL_OFFSET_TABLE_+[.-here], %ecx + movl C_SYMBOL_NAME(__sigsetjmp@GOT)(%ecx), %ecx + jmp *%ecx +#else + jmp __sigsetjmp +#endif END (_setjmp) diff --git a/sysdeps/i386/bsd-setjmp.S b/sysdeps/i386/bsd-setjmp.S index 239a8c41f2..411eaf1eb2 100644 --- a/sysdeps/i386/bsd-setjmp.S +++ b/sysdeps/i386/bsd-setjmp.S @@ -1,21 +1,21 @@ /* BSD `setjmp' entry point to `sigsetjmp (..., 1)'. i386 version. -Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc. -This file is part of the GNU C Library. + Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. -The GNU C Library is free software; you can redistribute it and/or -modify it under the terms of the GNU 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 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. + 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., 675 Mass Ave, -Cambridge, MA 02139, USA. */ + 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. */ /* This just does a tail-call to `__sigsetjmp (ARG, 1)'. We cannot do it in C because it must be a tail-call, so frame-unwinding @@ -29,5 +29,17 @@ ENTRY (setjmp) pushl $1 /* Push second argument of one. */ pushl %ecx /* Push back first argument. */ pushl %eax /* Push back return PC. */ - jmp JUMPTARGET (C_SYMBOL_NAME (__sigsetjmp)) +#ifdef PIC + /* We cannot use the PLT, because it requires that %ebx be set, but + we can't save and restore our caller's value. Instead, we do an + indirect jump through the GOT, using for the temporary register + %ecx, which is call-clobbered. */ + call here +here: popl %ecx + addl $_GLOBAL_OFFSET_TABLE_+[.-here], %ecx + movl C_SYMBOL_NAME(__sigsetjmp@GOT)(%ecx), %ecx + jmp *%ecx +#else + jmp __sigsetjmp +#endif END (setjmp) diff --git a/sysdeps/libm-i387/e_pow.S b/sysdeps/libm-i387/e_pow.S index ab6b454339..e665326438 100644 --- a/sysdeps/libm-i387/e_pow.S +++ b/sysdeps/libm-i387/e_pow.S @@ -308,7 +308,7 @@ ENTRY(__ieee754_pow) andb $1, %al jz 24f // jump if not odd cmpl $0xffe00000, %edx - jbe 24f // does not fit in mantissa bits + jae 24f // does not fit in mantissa bits // It's an odd integer. fldl MO(mzero) ret diff --git a/sysdeps/libm-i387/e_powf.S b/sysdeps/libm-i387/e_powf.S index 48316464ef..102cd4e3af 100644 --- a/sysdeps/libm-i387/e_powf.S +++ b/sysdeps/libm-i387/e_powf.S @@ -300,7 +300,7 @@ ENTRY(__ieee754_powf) testb $1, %dl jz 24f // jump if not odd cmpl $0xff000000, %edx - jbe 24f // does not fit in mantissa bits + jae 24f // does not fit in mantissa bits // It's an odd integer. fldl MO(mzero) ret diff --git a/sysdeps/libm-i387/s_expm1.S b/sysdeps/libm-i387/s_expm1.S index e1b198d604..92beaf0776 100644 --- a/sysdeps/libm-i387/s_expm1.S +++ b/sysdeps/libm-i387/s_expm1.S @@ -51,15 +51,17 @@ ENTRY(__expm1) fldl 4(%esp) // x fxam // Is NaN or +-Inf? fstsw %ax + movb $0x45, %ch + andb %ah, %ch + cmpb $0x40, %ch + je 3f // If +-0, jump. #ifdef PIC call 1f 1: popl %edx addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx #endif - movb $0x45, %ch - andb %ah, %ch cmpb $0x05, %ch - je 2f // Is +-Inf, jump. + je 2f // If +-Inf, jump. fldt MO(l2e) // log2(e) : x fmulp // log2(e)*x diff --git a/sysdeps/libm-i387/s_expm1f.S b/sysdeps/libm-i387/s_expm1f.S index 8626fee45d..45a60fe010 100644 --- a/sysdeps/libm-i387/s_expm1f.S +++ b/sysdeps/libm-i387/s_expm1f.S @@ -51,15 +51,17 @@ ENTRY(__expm1f) flds 4(%esp) // x fxam // Is NaN or +-Inf? fstsw %ax + movb $0x45, %ch + andb %ah, %ch + cmpb $0x40, %ch + je 3f // If +-0, jump. #ifdef PIC call 1f 1: popl %edx addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx #endif - movb $0x45, %ch - andb %ah, %ch cmpb $0x05, %ch - je 2f // Is +-Inf, jump. + je 2f // If +-Inf, jump. fldt MO(l2e) // log2(e) : x fmulp // log2(e)*x diff --git a/sysdeps/libm-i387/s_expm1l.S b/sysdeps/libm-i387/s_expm1l.S index 46290ca4a9..13fa698cc7 100644 --- a/sysdeps/libm-i387/s_expm1l.S +++ b/sysdeps/libm-i387/s_expm1l.S @@ -51,15 +51,17 @@ ENTRY(__expm1l) fldt 4(%esp) // x fxam // Is NaN or +-Inf? fstsw %ax + movb $0x45, %ch + andb %ah, %ch + cmpb $0x40, %ch + je 3f // If +-0, jump. #ifdef PIC call 1f 1: popl %edx addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx #endif - movb $0x45, %ch - andb %ah, %ch cmpb $0x05, %ch - je 2f // Is +-Inf, jump. + je 2f // If +-Inf, jump. fldt MO(l2e) // log2(e) : x fmulp // log2(e)*x diff --git a/sysdeps/libm-ieee754/s_modf.c b/sysdeps/libm-ieee754/s_modf.c index 8075c5f813..888d4f416d 100644 --- a/sysdeps/libm-ieee754/s_modf.c +++ b/sysdeps/libm-ieee754/s_modf.c @@ -51,10 +51,8 @@ static double one = 1.0; } else { i = (0x000fffff)>>j0; if(((i0&i)|i1)==0) { /* x is integral */ - u_int32_t high; *iptr = x; - GET_HIGH_WORD(high,x); - INSERT_WORDS(x,high&0x80000000,0); /* return +-0 */ + INSERT_WORDS(x,i0&0x80000000,0); /* return +-0 */ return x; } else { INSERT_WORDS(*iptr,i0&(~i),0); @@ -64,8 +62,10 @@ static double one = 1.0; } else if (j0>51) { /* no fraction part */ u_int32_t high; *iptr = x*one; - GET_HIGH_WORD(high,x); - INSERT_WORDS(x,high&0x80000000,0); /* return +-0 */ + /* We must handle NaNs separately. */ + if (j0 == 0x400 && ((i0 & 0xfffff) | i1)) + return x*one; + INSERT_WORDS(x,i0&0x80000000,0); /* return +-0 */ return x; } else { /* fraction part in low x */ i = ((u_int32_t)(0xffffffff))>>(j0-20); diff --git a/sysdeps/libm-ieee754/s_modff.c b/sysdeps/libm-ieee754/s_modff.c index 85f22c10e5..60f7f1ec29 100644 --- a/sysdeps/libm-ieee754/s_modff.c +++ b/sysdeps/libm-ieee754/s_modff.c @@ -8,7 +8,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -57,8 +57,10 @@ static float one = 1.0; } else { /* no fraction part */ u_int32_t ix; *iptr = x*one; - GET_FLOAT_WORD(ix,x); - SET_FLOAT_WORD(x,ix&0x80000000); /* return +-0 */ + /* We must handle NaNs separately. */ + if (j0 == 0x80 && (i0 & 0x7fffff)) + return x*one; + SET_FLOAT_WORD(x,i0&0x80000000); /* return +-0 */ return x; } } diff --git a/sysdeps/libm-ieee754/s_modfl.c b/sysdeps/libm-ieee754/s_modfl.c index 433c936240..324fe9fde6 100644 --- a/sysdeps/libm-ieee754/s_modfl.c +++ b/sysdeps/libm-ieee754/s_modfl.c @@ -55,32 +55,29 @@ static long double one = 1.0; } else { i = (0xffffffff)>>j0; if(((i0&i)|i1)==0) { /* x is integral */ - u_int32_t high; *iptr = x; - GET_HIGH_WORD(high,x); - INSERT_WORDS(x,high&0x80000000,0); /* return +-0 */ + SET_LDOUBLE_WORDS(x,se&0x8000,0,0); /* return +-0 */ return x; } else { - INSERT_WORDS(*iptr,i0&(~i),0); + SET_LDOUBLE_WORDS(*iptr,se,i0&(~i),0); return x - *iptr; } } } else if (j0>63) { /* no fraction part */ - u_int32_t high; *iptr = x*one; - GET_HIGH_WORD(high,x); - INSERT_WORDS(x,high&0x80000000,0); /* return +-0 */ + /* We must handle NaNs separately. */ + if (j0 == 0x4000 && ((i0 & 0x7fffffff) | i1)) + return x*one; + SET_LDOUBLE_WORDS(x,se&0x8000,0,0); /* return +-0 */ return x; } else { /* fraction part in low x */ i = ((u_int32_t)(0xffffffff))>>(j0-20); if((i1&i)==0) { /* x is integral */ - u_int32_t high; *iptr = x; - GET_HIGH_WORD(high,x); - INSERT_WORDS(x,high&0x80000000,0); /* return +-0 */ + INSERT_WORDS(x,se&0x8000,0); /* return +-0 */ return x; } else { - INSERT_WORDS(*iptr,i0,i1&(~i)); + SET_LDOUBLE_WORDS(*iptr,se,i0,i1&(~i)); return x - *iptr; } } diff --git a/sysdeps/libm-ieee754/s_tanh.c b/sysdeps/libm-ieee754/s_tanh.c index 208b459b35..944f96386f 100644 --- a/sysdeps/libm-ieee754/s_tanh.c +++ b/sysdeps/libm-ieee754/s_tanh.c @@ -55,10 +55,10 @@ static double one=1.0, two=2.0, tiny = 1.0e-300; #endif { double t,z; - int32_t jx,ix; + int32_t jx,ix,lx; /* High word of |x|. */ - GET_HIGH_WORD(jx,x); + EXTRACT_WORDS(jx,lx,x); ix = jx&0x7fffffff; /* x is INF or NaN */ @@ -69,6 +69,8 @@ static double one=1.0, two=2.0, tiny = 1.0e-300; /* |x| < 22 */ if (ix < 0x40360000) { /* |x|<22 */ + if ((ix | lx) == 0) + return x; /* x == +-0 */ if (ix<0x3c800000) /* |x|<2**-55 */ return x*(one+x); /* tanh(small) = small */ if (ix>=0x3ff00000) { /* |x|>=1 */ diff --git a/sysdeps/libm-ieee754/s_tanhf.c b/sysdeps/libm-ieee754/s_tanhf.c index b989ef3565..2a0ca9f3df 100644 --- a/sysdeps/libm-ieee754/s_tanhf.c +++ b/sysdeps/libm-ieee754/s_tanhf.c @@ -8,7 +8,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -40,13 +40,15 @@ static float one=1.0, two=2.0, tiny = 1.0e-30; ix = jx&0x7fffffff; /* x is INF or NaN */ - if(ix>=0x7f800000) { + if(ix>=0x7f800000) { if (jx>=0) return one/x+one; /* tanh(+-inf)=+-1 */ else return one/x-one; /* tanh(NaN) = NaN */ } /* |x| < 22 */ if (ix < 0x41b00000) { /* |x|<22 */ + if (ix == 0) + return x; /* x == +-0 */ if (ix<0x24000000) /* |x|<2**-55 */ return x*(one+x); /* tanh(small) = small */ if (ix>=0x3f800000) { /* |x|>=1 */ diff --git a/sysdeps/libm-ieee754/s_tanhl.c b/sysdeps/libm-ieee754/s_tanhl.c index f7ea3f4216..1e3dc3b613 100644 --- a/sysdeps/libm-ieee754/s_tanhl.c +++ b/sysdeps/libm-ieee754/s_tanhl.c @@ -68,12 +68,15 @@ static long double one=1.0, two=2.0, tiny = 1.0e-4900L; /* x is INF or NaN */ if(ix==0x7fff) { - if (se>=0x7fff) return one/x+one; /* tanhl(+-inf)=+-1 */ - else return one/x-one; /* tanhl(NaN) = NaN */ + /* for NaN it's not important which branch: tanhl(NaN) = NaN */ + if (se&0x8000) return one/x-one; /* tanhl(-inf)= -1; */ + else return one/x+one; /* tanhl(+inf)=+1 */ } /* |x| < 23 */ if (ix < 0x4003 || (ix == 0x4003 && j0 < 0xb8000000u)) {/* |x|<23 */ + if ((ix|j0|j1) == 0) + return x; /* x == +- 0 */ if (ix<0x3fc8) /* |x|<2**-55 */ return x*(one+x); /* tanh(small) = small */ if (ix>=0x3fff) { /* |x|>=1 */ diff --git a/sysdeps/unix/bsd/osf/.cvsignore b/sysdeps/unix/bsd/osf/.cvsignore new file mode 100644 index 0000000000..c9147fd335 --- /dev/null +++ b/sysdeps/unix/bsd/osf/.cvsignore @@ -0,0 +1 @@ +=* diff --git a/sysdeps/unix/sysv/linux/fxstat.c b/sysdeps/unix/sysv/linux/fxstat.c index 103218711b..5aa02dcac8 100644 --- a/sysdeps/unix/sysv/linux/fxstat.c +++ b/sysdeps/unix/sysv/linux/fxstat.c @@ -21,7 +21,7 @@ #include #include -#include "kernel_stat.h" +#include extern int __syscall_fstat (int, struct kernel_stat *); diff --git a/sysdeps/unix/sysv/linux/lxstat.c b/sysdeps/unix/sysv/linux/lxstat.c index 713490cf66..11c9038646 100644 --- a/sysdeps/unix/sysv/linux/lxstat.c +++ b/sysdeps/unix/sysv/linux/lxstat.c @@ -21,7 +21,7 @@ #include #include -#include "kernel_stat.h" +#include extern int __syscall_lstat (const char *, struct kernel_stat *); diff --git a/sysdeps/unix/sysv/linux/readv.c b/sysdeps/unix/sysv/linux/readv.c index 458e8ffb38..c8ff55ab45 100644 --- a/sysdeps/unix/sysv/linux/readv.c +++ b/sysdeps/unix/sysv/linux/readv.c @@ -26,15 +26,12 @@ extern ssize_t __syscall_readv __P ((int, __const struct iovec *, int)); /* Not all versions of the kernel support the large number of records. */ -#undef MAX_IOVEC -#ifdef UIO_FASTIOV -# define MAX_IOVEC UIO_FASTIOV -#else -# define MAX_IOVEC 8 /* 8 is a safe number. */ +#ifndef UIO_FASTIOV +# define UIO_FASTIOV 8 /* 8 is a safe number. */ #endif -/* We should deal with kernel which have a smaller UIO_MAXIOV as well +/* We should deal with kernel which have a smaller UIO_FASTIOV as well as a very big count. */ ssize_t readv (fd, vector, count) @@ -47,7 +44,7 @@ readv (fd, vector, count) bytes_read = __syscall_readv (fd, vector, count); - if (bytes_read < 0 && errno == EINVAL && count > MAX_IOVEC) + if (bytes_read < 0 && errno == EINVAL && count > UIO_FASTIOV) { int i; @@ -55,10 +52,10 @@ readv (fd, vector, count) __set_errno (errno_saved); bytes_read = 0; - for (i = 0; i < count; i += MAX_IOVEC) + for (i = 0; i < count; i += UIO_FASTIOV) { ssize_t bytes = __syscall_readv (fd, vector + i, - MIN (count - i, MAX_IOVEC)); + MIN (count - i, UIO_FASTIOV)); if (bytes < 0) return bytes; diff --git a/sysdeps/unix/sysv/linux/socketbits.h b/sysdeps/unix/sysv/linux/socketbits.h index 166971a384..101afc268c 100644 --- a/sysdeps/unix/sysv/linux/socketbits.h +++ b/sysdeps/unix/sysv/linux/socketbits.h @@ -83,14 +83,13 @@ enum __socket_type #define AF_INET6 PF_INET6 #define AF_MAX PF_MAX -/* Socket level values. */ -#define SOL_IP 0 -#define SOL_TCP 6 -#define SOL_UDP 17 +/* Socket level values. Others are defined in the appropriate headers. + + XXX These definitions also should go into the appropriate headers as + far as they are available. */ #define SOL_IPV6 41 #define SOL_ICMPV6 58 #define SOL_RAW 255 -#define SOL_IPX 256 #define SOL_AX25 257 #define SOL_ATALK 258 #define SOL_NETROM 259 diff --git a/sysdeps/unix/sysv/linux/writev.c b/sysdeps/unix/sysv/linux/writev.c index 11afd81d2e..d147186b51 100644 --- a/sysdeps/unix/sysv/linux/writev.c +++ b/sysdeps/unix/sysv/linux/writev.c @@ -25,15 +25,12 @@ extern ssize_t __syscall_writev __P ((int, const struct iovec *, int)); /* Not all versions of the kernel support the large number of records. */ -#undef MAX_IOVEC -#ifdef UIO_FASTIOV -# define MAX_IOVEC UIO_FASTIOV -#else -# define MAX_IOVEC 8 /* 8 is a safe number. */ +#ifndef UIO_FASTIOV +# define UIO_FASTIOV 8 /* 8 is a safe number. */ #endif -/* We should deal with kernel which have a smaller UIO_MAXIOV as well +/* We should deal with kernel which have a smaller UIO_FASTIOV as well as a very big count. */ ssize_t writev (fd, vector, count) @@ -46,7 +43,7 @@ writev (fd, vector, count) bytes_written = __syscall_writev (fd, vector, count); - if (bytes_written < 0 && errno == EINVAL && count > MAX_IOVEC) + if (bytes_written < 0 && errno == EINVAL && count > UIO_FASTIOV) { int i; @@ -54,10 +51,10 @@ writev (fd, vector, count) __set_errno (errno_saved); bytes_written = 0; - for (i = 0; i < count; i += MAX_IOVEC) + for (i = 0; i < count; i += UIO_FASTIOV) { ssize_t bytes = __syscall_writev (fd, vector + i, - MIN (count - i, MAX_IOVEC)); + MIN (count - i, UIO_FASTIOV)); if (bytes < 0) return bytes_written > 0 ? bytes_written : bytes; diff --git a/sysdeps/unix/sysv/linux/xstat.c b/sysdeps/unix/sysv/linux/xstat.c index be49b9d1de..aa120f5193 100644 --- a/sysdeps/unix/sysv/linux/xstat.c +++ b/sysdeps/unix/sysv/linux/xstat.c @@ -21,7 +21,7 @@ #include #include -#include "kernel_stat.h" +#include extern int __syscall_stat (const char *, struct kernel_stat *); -- cgit 1.4.1