aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog17
-rw-r--r--config.h.in2
-rw-r--r--libio/fileops.c3
-rw-r--r--libio/tst-freopen.c4
-rw-r--r--linuxthreads/ChangeLog6
-rw-r--r--linuxthreads/sysdeps/i386/pt-machine.h4
-rw-r--r--linuxthreads/sysdeps/i386/tls.h4
-rw-r--r--linuxthreads/sysdeps/i386/useldt.h2
-rw-r--r--stdio-common/tst-fseek.c156
-rw-r--r--sysdeps/ia64/fpu/libm_support.h4
10 files changed, 107 insertions, 95 deletions
diff --git a/ChangeLog b/ChangeLog
index 5a719a4ef1..bc0ccd0ee0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2002-07-24 Ulrich Drepper <drepper@redhat.com>
+
+ * libio/fileops.c (_IO_file_seekoff_mmap): Do use fp->_offset to
+ compute current position.
+
+ * stdio-common/tst-fseek.c (main): Improve error messages.
+
+ * libio/tst-freopen.c (main): Remove unused variable.
+
+ * libio/fileops.c (_IO_file_seekoff_mmap): Set fp->_offset after
+ succesful seek call. Simply error checking.
+
+2002-07-25 Jakub Jelinek <jakub@redhat.com>
+
+ * config.h.in: Use __ASSEMBLER__ test macro not ASSEMBLER.
+ * sysdeps/ia64/fpu/libm_support.h: Likewise.
+
2002-07-19 Roland McGrath <roland@frob.com>
* hurd/hurdsig.c (_hurdsig_getenv): Always return null if
diff --git a/config.h.in b/config.h.in
index cf4835cbec..c179f2a887 100644
--- a/config.h.in
+++ b/config.h.in
@@ -1,4 +1,4 @@
-#if !defined ASSEMBLER && !defined _ISOMAC && !defined __OPTIMIZE__
+#if !defined __ASSEMBLER__ && !defined _ISOMAC && !defined __OPTIMIZE__
# error "glibc cannot be compiled without optimization"
#endif
diff --git a/libio/fileops.c b/libio/fileops.c
index c054d5e7d0..29412968db 100644
--- a/libio/fileops.c
+++ b/libio/fileops.c
@@ -932,8 +932,7 @@ _IO_file_seekoff_mmap (fp, offset, dir, mode)
using a pushback buffer, but in the usual case has the same value as
(fp->_IO_read_ptr - fp->_IO_buf_base). */
if (mode == 0)
- return ((fp->_IO_buf_end - fp->_IO_buf_base)
- - (fp->_IO_read_end - fp->_IO_read_ptr));
+ return fp->_offset - (fp->_IO_read_end - fp->_IO_read_ptr);
switch (dir)
{
diff --git a/libio/tst-freopen.c b/libio/tst-freopen.c
index 20e5f2f874..8228951071 100644
--- a/libio/tst-freopen.c
+++ b/libio/tst-freopen.c
@@ -23,10 +23,10 @@
#include <string.h>
#include <unistd.h>
-int main (void)
+int
+main (void)
{
char name[] = "/tmp/tst-freopen.XXXXXX";
- char buf[4096];
const char * const test = "Let's test freopen.\n";
char temp[strlen (test) + 1];
int fd = mkstemp (name);
diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog
index 95feff2ac6..2fe02b1fd8 100644
--- a/linuxthreads/ChangeLog
+++ b/linuxthreads/ChangeLog
@@ -1,3 +1,9 @@
+2002-07-25 Jakub Jelinek <jakub@redhat.com>
+
+ * sysdeps/i386/tls.h: Use __ASSEMBLER__ test macro not ASSEMBLER.
+ * sysdeps/i386/pt-machine.h: Likewise.
+ * sysdeps/i386/useldt.h: Likewise.
+
2002-07-22 Ulrich Drepper <drepper@redhat.com>
* pthread.c (__pthread_initialize_minimal): If !SHARED and TLS
diff --git a/linuxthreads/sysdeps/i386/pt-machine.h b/linuxthreads/sysdeps/i386/pt-machine.h
index ec92ce2418..919eda2edb 100644
--- a/linuxthreads/sysdeps/i386/pt-machine.h
+++ b/linuxthreads/sysdeps/i386/pt-machine.h
@@ -22,7 +22,7 @@
#ifndef _PT_MACHINE_H
#define _PT_MACHINE_H 1
-#ifndef ASSEMBLER
+#ifndef __ASSEMBLER__
#ifndef PT_EI
# define PT_EI extern inline
#endif
@@ -103,6 +103,6 @@ compare_and_swap_is_available (void)
Otherwise, it's a 486 or above and it has cmpxchg. */
return changed != 0;
}
-#endif /* ASSEMBLER */
+#endif /* __ASSEMBLER__ */
#endif /* pt-machine.h */
diff --git a/linuxthreads/sysdeps/i386/tls.h b/linuxthreads/sysdeps/i386/tls.h
index 44f947c9c6..24671dbb48 100644
--- a/linuxthreads/sysdeps/i386/tls.h
+++ b/linuxthreads/sysdeps/i386/tls.h
@@ -22,7 +22,7 @@
# include <pt-machine.h>
-#ifndef ASSEMBLER
+#ifndef __ASSEMBLER__
# include <stddef.h>
/* Type for the dtv. */
@@ -49,7 +49,7 @@ typedef struct
/* Signal that TLS support is available. */
# define USE_TLS 1
-# ifndef ASSEMBLER
+# ifndef __ASSEMBLER__
/* Get system call information. */
# include <sysdep.h>
diff --git a/linuxthreads/sysdeps/i386/useldt.h b/linuxthreads/sysdeps/i386/useldt.h
index 64a3b52123..3edcdca26c 100644
--- a/linuxthreads/sysdeps/i386/useldt.h
+++ b/linuxthreads/sysdeps/i386/useldt.h
@@ -19,7 +19,7 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#ifndef ASSEMBLER
+#ifndef __ASSEMBLER__
#include <stddef.h> /* For offsetof. */
#include <stdlib.h> /* For abort(). */
diff --git a/stdio-common/tst-fseek.c b/stdio-common/tst-fseek.c
index 243dcd35a7..461bb5491d 100644
--- a/stdio-common/tst-fseek.c
+++ b/stdio-common/tst-fseek.c
@@ -1,5 +1,5 @@
/* Tests of fseek and fseeko.
- Copyright (C) 2000,01 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2000.
@@ -63,7 +63,7 @@ main (void)
if (fwrite (outstr, sizeof (outstr) - 1, 1, fp) != 1)
{
- puts ("write error");
+ printf ("%d: write error\n", __LINE__);
result = 1;
goto out;
}
@@ -71,248 +71,240 @@ main (void)
/* The EOF flag must be reset. */
if (fgetc (fp) != EOF)
{
- puts ("managed to read at end of file");
+ printf ("%d: managed to read at end of file\n", __LINE__);
result = 1;
}
else if (! feof (fp))
{
- puts ("EOF flag not set");
+ printf ("%d: EOF flag not set\n", __LINE__);
result = 1;
}
if (fseek (fp, 0, SEEK_CUR) != 0)
{
- puts ("fseek(fp, 0, SEEK_CUR) failed");
+ printf ("%d: fseek(fp, 0, SEEK_CUR) failed\n", __LINE__);
result = 1;
}
else if (feof (fp))
{
- puts ("fseek() didn't reset EOF flag");
+ printf ("%d: fseek() didn't reset EOF flag\n", __LINE__);
result = 1;
}
/* Do the same for fseeko(). */
-#ifdef USE_IN_LIBIO
if (fgetc (fp) != EOF)
{
- puts ("managed to read at end of file");
+ printf ("%d: managed to read at end of file\n", __LINE__);
result = 1;
}
else if (! feof (fp))
{
- puts ("EOF flag not set");
+ printf ("%d: EOF flag not set\n", __LINE__);
result = 1;
}
if (fseeko (fp, 0, SEEK_CUR) != 0)
{
- puts ("fseek(fp, 0, SEEK_CUR) failed");
+ printf ("%d: fseek(fp, 0, SEEK_CUR) failed\n", __LINE__);
result = 1;
}
else if (feof (fp))
{
- puts ("fseek() didn't reset EOF flag");
+ printf ("%d: fseek() didn't reset EOF flag\n", __LINE__);
result = 1;
}
-#endif
/* Go back to the beginning of the file: absolute. */
if (fseek (fp, 0, SEEK_SET) != 0)
{
- puts ("fseek(fp, 0, SEEK_SET) failed");
+ printf ("%d: fseek(fp, 0, SEEK_SET) failed\n", __LINE__);
result = 1;
}
else if (fflush (fp) != 0)
{
- puts ("fflush() failed");
+ printf ("%d: fflush() failed\n", __LINE__);
result = 1;
}
else if (lseek (fd, 0, SEEK_CUR) != 0)
{
- puts ("lseek() returned different position");
+ printf ("%d: lseek() returned different position\n", __LINE__);
result = 1;
}
else if (fread (buf, sizeof (outstr) - 1, 1, fp) != 1)
{
- puts ("fread() failed");
+ printf ("%d: fread() failed\n", __LINE__);
result = 1;
}
else if (memcmp (buf, outstr, sizeof (outstr) - 1) != 0)
{
- puts ("content after fseek(,,SEEK_SET) wrong");
+ printf ("%d: content after fseek(,,SEEK_SET) wrong\n", __LINE__);
result = 1;
}
-#ifdef USE_IN_LIBIO
/* Now with fseeko. */
if (fseeko (fp, 0, SEEK_SET) != 0)
{
- puts ("fseeko(fp, 0, SEEK_SET) failed");
+ printf ("%d: fseeko(fp, 0, SEEK_SET) failed\n", __LINE__);
result = 1;
}
else if (fflush (fp) != 0)
{
- puts ("fflush() failed");
+ printf ("%d: fflush() failed\n", __LINE__);
result = 1;
}
else if (lseek (fd, 0, SEEK_CUR) != 0)
{
- puts ("lseek() returned different position");
+ printf ("%d: lseek() returned different position\n", __LINE__);
result = 1;
}
else if (fread (buf, sizeof (outstr) - 1, 1, fp) != 1)
{
- puts ("fread() failed");
+ printf ("%d: fread() failed\n", __LINE__);
result = 1;
}
else if (memcmp (buf, outstr, sizeof (outstr) - 1) != 0)
{
- puts ("content after fseeko(,,SEEK_SET) wrong");
+ printf ("%d: content after fseeko(,,SEEK_SET) wrong\n", __LINE__);
result = 1;
}
-#endif
/* Go back to the beginning of the file: relative. */
if (fseek (fp, -(sizeof (outstr) - 1), SEEK_CUR) != 0)
{
- puts ("fseek(fp, 0, SEEK_SET) failed");
+ printf ("%d: fseek(fp, 0, SEEK_SET) failed\n", __LINE__);
result = 1;
}
else if (fflush (fp) != 0)
{
- puts ("fflush() failed");
+ printf ("%d: fflush() failed\n", __LINE__);
result = 1;
}
else if (lseek (fd, 0, SEEK_CUR) != 0)
{
- puts ("lseek() returned different position");
+ printf ("%d: lseek() returned different position\n", __LINE__);
result = 1;
}
else if (fread (buf, sizeof (outstr) - 1, 1, fp) != 1)
{
- puts ("fread() failed");
+ printf ("%d: fread() failed\n", __LINE__);
result = 1;
}
else if (memcmp (buf, outstr, sizeof (outstr) - 1) != 0)
{
- puts ("content after fseek(,,SEEK_SET) wrong");
+ printf ("%d: content after fseek(,,SEEK_SET) wrong\n", __LINE__);
result = 1;
}
-#ifdef USE_IN_LIBIO
/* Now with fseeko. */
if (fseeko (fp, -(sizeof (outstr) - 1), SEEK_CUR) != 0)
{
- puts ("fseeko(fp, 0, SEEK_SET) failed");
+ printf ("%d: fseeko(fp, 0, SEEK_SET) failed\n", __LINE__);
result = 1;
}
else if (fflush (fp) != 0)
{
- puts ("fflush() failed");
+ printf ("%d: fflush() failed\n", __LINE__);
result = 1;
}
else if (lseek (fd, 0, SEEK_CUR) != 0)
{
- puts ("lseek() returned different position");
+ printf ("%d: lseek() returned different position\n", __LINE__);
result = 1;
}
else if (fread (buf, sizeof (outstr) - 1, 1, fp) != 1)
{
- puts ("fread() failed");
+ printf ("%d: fread() failed\n", __LINE__);
result = 1;
}
else if (memcmp (buf, outstr, sizeof (outstr) - 1) != 0)
{
- puts ("content after fseeko(,,SEEK_SET) wrong");
+ printf ("%d: content after fseeko(,,SEEK_SET) wrong\n", __LINE__);
result = 1;
}
-#endif
/* Go back to the beginning of the file: from the end. */
if (fseek (fp, -(sizeof (outstr) - 1), SEEK_END) != 0)
{
- puts ("fseek(fp, 0, SEEK_SET) failed");
+ printf ("%d: fseek(fp, 0, SEEK_SET) failed\n", __LINE__);
result = 1;
}
else if (fflush (fp) != 0)
{
- puts ("fflush() failed");
+ printf ("%d: fflush() failed\n", __LINE__);
result = 1;
}
else if (lseek (fd, 0, SEEK_CUR) != 0)
{
- puts ("lseek() returned different position");
+ printf ("%d: lseek() returned different position\n", __LINE__);
result = 1;
}
else if (fread (buf, sizeof (outstr) - 1, 1, fp) != 1)
{
- puts ("fread() failed");
+ printf ("%d: fread() failed\n", __LINE__);
result = 1;
}
else if (memcmp (buf, outstr, sizeof (outstr) - 1) != 0)
{
- puts ("content after fseek(,,SEEK_SET) wrong");
+ printf ("%d: content after fseek(,,SEEK_SET) wrong\n", __LINE__);
result = 1;
}
-#ifdef USE_IN_LIBIO
/* Now with fseeko. */
if (fseeko (fp, -(sizeof (outstr) - 1), SEEK_END) != 0)
{
- puts ("fseeko(fp, 0, SEEK_SET) failed");
+ printf ("%d: fseeko(fp, 0, SEEK_SET) failed\n", __LINE__);
result = 1;
}
else if (fflush (fp) != 0)
{
- puts ("fflush() failed");
+ printf ("%d: fflush() failed\n", __LINE__);
result = 1;
}
else if (lseek (fd, 0, SEEK_CUR) != 0)
{
- puts ("lseek() returned different position");
+ printf ("%d: lseek() returned different position\n", __LINE__);
result = 1;
}
else if (fread (buf, sizeof (outstr) - 1, 1, fp) != 1)
{
- puts ("fread() failed");
+ printf ("%d: fread() failed\n", __LINE__);
result = 1;
}
else if (memcmp (buf, outstr, sizeof (outstr) - 1) != 0)
{
- puts ("content after fseeko(,,SEEK_SET) wrong");
+ printf ("%d: content after fseeko(,,SEEK_SET) wrong\n", __LINE__);
result = 1;
}
-#endif
if (fwrite (outstr, sizeof (outstr) - 1, 1, fp) != 1)
{
- puts ("write error 2");
+ printf ("%d: write error 2\n", __LINE__);
result = 1;
goto out;
}
if (fwrite (outstr, sizeof (outstr) - 1, 1, fp) != 1)
{
- puts ("write error 3");
+ printf ("%d: write error 3\n", __LINE__);
result = 1;
goto out;
}
if (fwrite (outstr, sizeof (outstr) - 1, 1, fp) != 1)
{
- puts ("write error 4");
+ printf ("%d: write error 4\n", __LINE__);
result = 1;
goto out;
}
if (fwrite (outstr, sizeof (outstr) - 1, 1, fp) != 1)
{
- puts ("write error 5");
+ printf ("%d: write error 5\n", __LINE__);
result = 1;
goto out;
}
if (fputc ('1', fp) == EOF || fputc ('2', fp) == EOF)
{
- puts ("cannot add characters at the end");
+ printf ("%d: cannot add characters at the end\n", __LINE__);
result = 1;
goto out;
}
@@ -320,7 +312,7 @@ main (void)
/* Check the access time. */
if (fstat64 (fd, &st1) < 0)
{
- puts ("fstat64() before fseeko() failed\n");
+ printf ("%d: fstat64() before fseeko() failed\n\n", __LINE__);
result = 1;
}
else
@@ -329,7 +321,7 @@ main (void)
if (fseek (fp, -(2 + 2 * (sizeof (outstr) - 1)), SEEK_CUR) != 0)
{
- puts ("fseek() after write characters failed");
+ printf ("%d: fseek() after write characters failed\n", __LINE__);
result = 1;
goto out;
}
@@ -343,27 +335,27 @@ main (void)
if (fstat64 (fd, &st2) < 0)
{
- puts ("fstat64() after fseeko() failed\n");
+ printf ("%d: fstat64() after fseeko() failed\n\n", __LINE__);
result = 1;
}
if (st1.st_ctime >= t)
{
- puts ("st_ctime not updated");
+ printf ("%d: st_ctime not updated\n", __LINE__);
result = 1;
}
if (st1.st_mtime >= t)
{
- puts ("st_mtime not updated");
+ printf ("%d: st_mtime not updated\n", __LINE__);
result = 1;
}
if (st1.st_ctime >= st2.st_ctime)
{
- puts ("st_ctime not changed");
+ printf ("%d: st_ctime not changed\n", __LINE__);
result = 1;
}
if (st1.st_mtime >= st2.st_mtime)
{
- puts ("st_mtime not changed");
+ printf ("%d: st_mtime not changed\n", __LINE__);
result = 1;
}
}
@@ -372,7 +364,7 @@ main (void)
if (fread (buf, 1, 2 + 2 * (sizeof (outstr) - 1), fp)
!= 2 + 2 * (sizeof (outstr) - 1))
{
- puts ("reading 2 records plus bits failed");
+ printf ("%d: reading 2 records plus bits failed\n", __LINE__);
result = 1;
}
else if (memcmp (buf, outstr, sizeof (outstr) - 1) != 0
@@ -381,23 +373,23 @@ main (void)
|| buf[2 * (sizeof (outstr) - 1)] != '1'
|| buf[2 * (sizeof (outstr) - 1) + 1] != '2')
{
- puts ("reading records failed");
+ printf ("%d: reading records failed\n", __LINE__);
result = 1;
}
else if (ungetc ('9', fp) == EOF)
{
- puts ("ungetc() failed");
+ printf ("%d: ungetc() failed\n", __LINE__);
result = 1;
}
else if (fseek (fp, -(2 + 2 * (sizeof (outstr) - 1)), SEEK_END) != 0)
{
- puts ("fseek after ungetc failed");
+ printf ("%d: fseek after ungetc failed\n", __LINE__);
result = 1;
}
else if (fread (buf, 1, 2 + 2 * (sizeof (outstr) - 1), fp)
!= 2 + 2 * (sizeof (outstr) - 1))
{
- puts ("reading 2 records plus bits failed");
+ printf ("%d: reading 2 records plus bits failed\n", __LINE__);
result = 1;
}
else if (memcmp (buf, outstr, sizeof (outstr) - 1) != 0
@@ -405,82 +397,80 @@ main (void)
sizeof (outstr) - 1) != 0
|| buf[2 * (sizeof (outstr) - 1)] != '1')
{
- puts ("reading records for the second time failed");
+ printf ("%d: reading records for the second time failed\n", __LINE__);
result = 1;
}
else if (buf[2 * (sizeof (outstr) - 1) + 1] == '9')
{
- puts ("unget character not ignored");
+ printf ("%d: unget character not ignored\n", __LINE__);
result = 1;
}
else if (buf[2 * (sizeof (outstr) - 1) + 1] != '2')
{
- puts ("unget somehow changed character");
+ printf ("%d: unget somehow changed character\n", __LINE__);
result = 1;
}
fclose (fp);
-#ifdef USE_IN_LIBIO
fp = fopen (fname, "r");
if (fp == NULL)
{
- puts ("fopen() failed\n");
+ printf ("%d: fopen() failed\n\n", __LINE__);
result = 1;
}
else if (fstat64 (fileno (fp), &st1) < 0)
{
- puts ("fstat64() before fseeko() failed\n");
+ printf ("%d: fstat64() before fseeko() failed\n\n", __LINE__);
result = 1;
}
else if (fseeko (fp, 0, SEEK_END) != 0)
{
- puts ("fseeko(fp, 0, SEEK_END) failed");
+ printf ("%d: fseeko(fp, 0, SEEK_END) failed\n", __LINE__);
result = 1;
}
else if (ftello (fp) != st1.st_size)
{
- printf ("fstat64 st_size %zd ftello %zd\n", st1.st_size,
- ftello (fp));
+ printf ("%d: fstat64 st_size %zd ftello %zd\n", __LINE__,
+ (size_t) st1.st_size, (size_t) ftello (fp));
result = 1;
}
else
- puts ("SEEK_END works");
+ printf ("%d: SEEK_END works\n", __LINE__);
if (fp != NULL)
fclose (fp);
fp = fopen (fname, "r");
if (fp == NULL)
{
- puts ("fopen() failed\n");
+ printf ("%d: fopen() failed\n\n", __LINE__);
result = 1;
}
else if (fstat64 (fileno (fp), &st1) < 0)
{
- puts ("fstat64() before fgetc() failed\n");
+ printf ("%d: fstat64() before fgetc() failed\n\n", __LINE__);
result = 1;
}
else if (fgetc (fp) == EOF)
{
- puts ("fgetc() before fseeko() failed\n");
+ printf ("%d: fgetc() before fseeko() failed\n\n", __LINE__);
result = 1;
}
else if (fseeko (fp, 0, SEEK_END) != 0)
{
- puts ("fseeko(fp, 0, SEEK_END) failed");
+ printf ("%d: fseeko(fp, 0, SEEK_END) failed\n", __LINE__);
result = 1;
}
else if (ftello (fp) != st1.st_size)
{
- printf ("fstat64 st_size %zd ftello %zd\n", st1.st_size,
- ftello (fp));
+ printf ("%d: fstat64 st_size %zd ftello %zd\n", __LINE__,
+ (size_t) st1.st_size, (size_t) ftello (fp));
result = 1;
}
else
- puts ("SEEK_END works");
+ printf ("%d: SEEK_END works\n", __LINE__);
if (fp != NULL)
fclose (fp);
-#endif
out:
unlink (fname);
diff --git a/sysdeps/ia64/fpu/libm_support.h b/sysdeps/ia64/fpu/libm_support.h
index 7510f2c259..f1b37b4b15 100644
--- a/sysdeps/ia64/fpu/libm_support.h
+++ b/sysdeps/ia64/fpu/libm_support.h
@@ -49,7 +49,7 @@
// 12/07/2000 Added scalbn error_types values.
//
-#ifndef ASSEMBLER
+#ifndef __ASSEMBLER__
#include <math.h>
float __libm_frexp_4f( float x, int* exp);
@@ -337,7 +337,7 @@ extern _LIB_VERSION_TYPE _LIB_VERSION;
// This is a run-time variable and may effect
// floating point behavior of the libm functions
-#endif /* ASSEMBLER */
+#endif /* __ASSEMBLER__ */
/* Support for compatible assembler handling. */
#if !defined L && defined _LIBC