summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-07-04 10:39:13 +0000
committerUlrich Drepper <drepper@redhat.com>1998-07-04 10:39:13 +0000
commitba9234d947af45f15b1e4dece1a9cd447cecc038 (patch)
treefb6ec34cfaf4d1cef1a689164024fc99f2649206
parent6ef9f70bdbe3fdb7b16d7c9726e624700d774136 (diff)
downloadglibc-ba9234d947af45f15b1e4dece1a9cd447cecc038.tar.gz
Update.
1998-07-04 10:14 Ulrich Drepper <drepper@cygnus.com> * libio/Makefile (routines): Add iofread_u and iofwrite_u. * libio/Versions: Add fread_unlocked and fwrite_unlocked. * Makerules (lib%.so): Adjust ignore pattern for last makefile change. * time/tzfile.c (decode): Optimize by using bswap_32. (__tzfile_read): Use _unlocked stream functions. Correct setting of __tzname array values. (__tzfile_compute): Correct setting of __tzname array values. * time/tzset.c (__tzstring): Clean up a bit. 1998-06-29 19:01 Jim Wilson <wilson@cygnus.com> * posix/regex.c (re_comp): Add cast to char * before gettext calls. 1998-06-30 Andreas Jaeger <aj@arthur.rhein-neckar.de> * sysdeps/unix/bsd/poll.c (__poll): Allocate fd_set dynamically so that fd can be bigger than FD_SETSIZE. 1998-07-01 Andreas Jaeger <aj@arthur.rhein-neckar.de> * nscd/grpcache.c: Include <unistd.h>. * nscd/pwdcache.c: Likewise. * nis/nis_modify.c: Include <string.h>. * nis/nis_add.c: Likewise. * nis/nis_checkpoint.c: Likewise. * posix/runptests.c: Likewise. * sysdeps/generic/statvfs64.c: Likewise. * sysdeps/generic/fstatvfs64.c: Likewise. 1998-07-03 13:16 Ulrich Drepper <drepper@cygnus.com> * localedata/charmaps/ISO-8859-9: Change mapping for 0xea, 0xec, 0xef to match data from Unicode. Reported by Michael Deutschmann <michael@talamasca.wkpowerlink.com>. 1998-07-03 11:45 Ulrich Drepper <drepper@cygnus.com> * stdio-common/printf.h: Define printf_function and printf_arginfo_function types using __PMT not __P. Reported by Marc Lehmann. 1998-07-02 14:07 -0400 Zack Weinberg <zack@rabi.phys.columbia.edu> * assert/test-assert.c: New test. * assert/test-assert-perr.c: New test. * assert/Makefile (tests): Add test-assert and test-assert-perr. 1998-07-02 13:45 Zack Weinberg <zack@rabi.phys.columbia.edu> BSD-style SCM_CREDS support. * sysdeps/unix/sysv/linux/socket.h: Define struct cmsgcred and SCM_CREDS. * sysdeps/unix/sysv/linux/sendmsg.c: New file. Convert user visible SCM_CREDS packet to what the kernel wants. * sysdeps/unix/sysv/linux/recvmsg.c: New file. Convert SCM_CREDS packet output by kernel to what users want. * sysdeps/unix/sysv/linux/sendmsg.S: Moved to... * sysdeps/unix/sysv/linux/__sendmsg.S: here. * sysdeps/unix/sysv/linux/recvmsg.S: Moved to... * sysdeps/unix/sysv/linux/__recvmsg.S: here. * sysdeps/unix/sysv/linux/Makefile [subdir=socket]: Add __sendmsg and __recvmsg to sysdep_routines. * sysdeps/unix/sysv/linux/Dist: Add __sendmsg.S and __recvmsg.S. 1998-07-02 Thorsten Kukuk <kukuk@vt.uni-paderborn.de> * nscd/grpcache.c: Fix gid pointer handling and debug messages. * nscd/pwdcache.c: Fix uid pointer handling and debug messages. * nscd/nscd.c: Check, if pthread_create fails. 1998-07-02 Andreas Jaeger <aj@arthur.rhein-neckar.de> * stdio-common/test_rdwr.c (main): Use %Zu for size_t in printf format strings. * stdio-common/bug1.c (main): Likewise. * stdio-common/bug5.c (main): Likewise. * stdio-common/tstgetln.c (main): Likewise. * elf/sprof.c (generate_call_graph): Likewise. (load_shobj): Likewise. * posix/runptests.c (main): Likewise. * string/tst-strlen.c (main): Likewise. * sysdeps/libm-ieee754/e_acos.c (__ieee754_acos): Remove unused variable q3. * sysdeps/libm-ieee754/e_asin.c (__ieee754_asin): Likewise 1998-07-03 Andreas Jaeger <aj@arthur.rhein-neckar.de> * wctype/Versions: Add __towctrans. Noticed by Alex Buell <alex.buell@tahallah.demon.co.uk>. 1998-07-02 Mark Kettenis <kettenis@phys.uva.nl> * grp/initgroups.c (compat_call): Only call dynamically loaded functions if they are really present. 1998-07-02 Mark Kettenis <kettenis@phys.uva.nl> * sysdeps/unix/sysv/linux/bits/sched.h: Move __END_DECLS within #ifdef that contains __BEGIN_DECLS. 1998-07-02 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * libio/iofwrite.c: Fix return value when size == 0. 1998-07-01 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * posix/Makefile (distribute): Add annexc.c. (generated): Add $(objpfx)annexc and $(objpfx)annexc.out. 1998-07-01 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Add bits/pthreadtypes.h here, and do not clobber headers. * sysdeps/unix/sysv/linux/Dist: Add bits/pthreadtypes.h. 1998-07-03 Andreas Jaeger <aj@arthur.rhein-neckar.de> * timezone/tst-timezone.c: Add tests for tzname variable. 1998-07-03 12:17 Zack Weinberg <zack@rabi.phys.columbia.edu> * Makefile [versioning=yes]: Build the mapfiles with a pattern rule that lists all of them as targets. (sysd-versions): Depend only on Versions.def. Write a Makefile fragment that defines $(vers-libs) based on contents of that file; then include it. (lib-noranlib): Depend on lib-mapfiles not sysd-versions. (lib-mapfiles): New target, depends on sysd-versions and $(vers-libs). Predicate all this on avoid-generated unset as well as versioning. 1998-07-03 14:35 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
-rw-r--r--ChangeLog142
-rw-r--r--Makerules3
-rw-r--r--assert/Makefile3
-rw-r--r--assert/test-assert-perr.c86
-rw-r--r--assert/test-assert.c88
-rw-r--r--elf/sprof.c4
-rw-r--r--grp/initgroups.c17
-rw-r--r--libio/Makefile2
-rw-r--r--libio/Versions2
-rw-r--r--libio/iofread_u.c42
-rw-r--r--libio/iofwrite.c6
-rw-r--r--libio/iofwrite_u.c47
-rw-r--r--linuxthreads/ChangeLog4
-rw-r--r--linuxthreads/attr.c1
-rw-r--r--localedata/charmaps/ISO-8859-96
-rw-r--r--nis/nis_add.c1
-rw-r--r--nis/nis_checkpoint.c1
-rw-r--r--nis/nis_modify.c1
-rw-r--r--nscd/grpcache.c34
-rw-r--r--nscd/nscd.c61
-rw-r--r--nscd/pwdcache.c35
-rw-r--r--posix/Makefile5
-rw-r--r--posix/regex.c4
-rw-r--r--posix/runptests.c3
-rw-r--r--stdio-common/bug1.c4
-rw-r--r--stdio-common/bug5.c2
-rw-r--r--stdio-common/printf.h12
-rw-r--r--stdio-common/test_rdwr.c10
-rw-r--r--stdio-common/tstgetln.c4
-rw-r--r--string/tst-strlen.c2
-rw-r--r--sysdeps/generic/fstatvfs64.c1
-rw-r--r--sysdeps/generic/statvfs64.c1
-rw-r--r--sysdeps/libm-ieee754/e_acos.c2
-rw-r--r--sysdeps/libm-ieee754/e_asin.c2
-rw-r--r--sysdeps/unix/bsd/poll.c38
-rw-r--r--sysdeps/unix/sysv/linux/Dist3
-rw-r--r--sysdeps/unix/sysv/linux/Makefile4
-rw-r--r--sysdeps/unix/sysv/linux/__recvmsg.S (renamed from sysdeps/unix/sysv/linux/recvmsg.S)4
-rw-r--r--sysdeps/unix/sysv/linux/__sendmsg.S (renamed from sysdeps/unix/sysv/linux/sendmsg.S)4
-rw-r--r--sysdeps/unix/sysv/linux/aio_sigqueue.c5
-rw-r--r--sysdeps/unix/sysv/linux/bits/sched.h4
-rw-r--r--sysdeps/unix/sysv/linux/bits/socket.h26
-rw-r--r--sysdeps/unix/sysv/linux/recvmsg.c93
-rw-r--r--sysdeps/unix/sysv/linux/sendmsg.c91
-rw-r--r--time/tzfile.c47
-rw-r--r--time/tzset.c5
-rw-r--r--timezone/tst-timezone.c26
-rw-r--r--wctype/Versions3
48 files changed, 854 insertions, 137 deletions
diff --git a/ChangeLog b/ChangeLog
index 02d6720314..1c6598717e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,144 @@
-Fri Jul 3 14:35:55 1998 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
+1998-07-04 10:14 Ulrich Drepper <drepper@cygnus.com>
+
+ * libio/Makefile (routines): Add iofread_u and iofwrite_u.
+ * libio/Versions: Add fread_unlocked and fwrite_unlocked.
+
+ * Makerules (lib%.so): Adjust ignore pattern for last makefile change.
+
+ * time/tzfile.c (decode): Optimize by using bswap_32.
+ (__tzfile_read): Use _unlocked stream functions. Correct setting of
+ __tzname array values.
+ (__tzfile_compute): Correct setting of __tzname array values.
+ * time/tzset.c (__tzstring): Clean up a bit.
+
+1998-06-29 19:01 Jim Wilson <wilson@cygnus.com>
+
+ * posix/regex.c (re_comp): Add cast to char * before gettext calls.
+
+1998-06-30 Andreas Jaeger <aj@arthur.rhein-neckar.de>
+
+ * sysdeps/unix/bsd/poll.c (__poll): Allocate fd_set dynamically so
+ that fd can be bigger than FD_SETSIZE.
+
+1998-07-01 Andreas Jaeger <aj@arthur.rhein-neckar.de>
+
+ * nscd/grpcache.c: Include <unistd.h>.
+ * nscd/pwdcache.c: Likewise.
+
+ * nis/nis_modify.c: Include <string.h>.
+ * nis/nis_add.c: Likewise.
+ * nis/nis_checkpoint.c: Likewise.
+ * posix/runptests.c: Likewise.
+ * sysdeps/generic/statvfs64.c: Likewise.
+ * sysdeps/generic/fstatvfs64.c: Likewise.
+
+1998-07-03 13:16 Ulrich Drepper <drepper@cygnus.com>
+
+ * localedata/charmaps/ISO-8859-9: Change mapping for 0xea, 0xec, 0xef
+ to match data from Unicode.
+ Reported by Michael Deutschmann <michael@talamasca.wkpowerlink.com>.
+
+1998-07-03 11:45 Ulrich Drepper <drepper@cygnus.com>
+
+ * stdio-common/printf.h: Define printf_function and
+ printf_arginfo_function types using __PMT not __P.
+ Reported by Marc Lehmann.
+
+1998-07-02 14:07 -0400 Zack Weinberg <zack@rabi.phys.columbia.edu>
+
+ * assert/test-assert.c: New test.
+ * assert/test-assert-perr.c: New test.
+ * assert/Makefile (tests): Add test-assert and test-assert-perr.
+
+1998-07-02 13:45 Zack Weinberg <zack@rabi.phys.columbia.edu>
+
+ BSD-style SCM_CREDS support.
+
+ * sysdeps/unix/sysv/linux/socket.h: Define struct cmsgcred and
+ SCM_CREDS.
+ * sysdeps/unix/sysv/linux/sendmsg.c: New file. Convert user
+ visible SCM_CREDS packet to what the kernel wants.
+ * sysdeps/unix/sysv/linux/recvmsg.c: New file. Convert
+ SCM_CREDS packet output by kernel to what users want.
+
+ * sysdeps/unix/sysv/linux/sendmsg.S: Moved to...
+ * sysdeps/unix/sysv/linux/__sendmsg.S: here.
+ * sysdeps/unix/sysv/linux/recvmsg.S: Moved to...
+ * sysdeps/unix/sysv/linux/__recvmsg.S: here.
+
+ * sysdeps/unix/sysv/linux/Makefile [subdir=socket]: Add
+ __sendmsg and __recvmsg to sysdep_routines.
+ * sysdeps/unix/sysv/linux/Dist: Add __sendmsg.S and __recvmsg.S.
+
+1998-07-02 Thorsten Kukuk <kukuk@vt.uni-paderborn.de>
+
+ * nscd/grpcache.c: Fix gid pointer handling and debug messages.
+ * nscd/pwdcache.c: Fix uid pointer handling and debug messages.
+ * nscd/nscd.c: Check, if pthread_create fails.
+
+1998-07-02 Andreas Jaeger <aj@arthur.rhein-neckar.de>
+
+ * stdio-common/test_rdwr.c (main): Use %Zu for size_t in printf
+ format strings.
+ * stdio-common/bug1.c (main): Likewise.
+ * stdio-common/bug5.c (main): Likewise.
+ * stdio-common/tstgetln.c (main): Likewise.
+ * elf/sprof.c (generate_call_graph): Likewise.
+ (load_shobj): Likewise.
+ * posix/runptests.c (main): Likewise.
+ * string/tst-strlen.c (main): Likewise.
+
+ * sysdeps/libm-ieee754/e_acos.c (__ieee754_acos): Remove unused
+ variable q3.
+ * sysdeps/libm-ieee754/e_asin.c (__ieee754_asin): Likewise
+
+1998-07-03 Andreas Jaeger <aj@arthur.rhein-neckar.de>
+
+ * wctype/Versions: Add __towctrans.
+ Noticed by Alex Buell <alex.buell@tahallah.demon.co.uk>.
+
+1998-07-02 Mark Kettenis <kettenis@phys.uva.nl>
+
+ * grp/initgroups.c (compat_call): Only call dynamically loaded
+ functions if they are really present.
+
+1998-07-02 Mark Kettenis <kettenis@phys.uva.nl>
+
+ * sysdeps/unix/sysv/linux/bits/sched.h: Move __END_DECLS within
+ #ifdef that contains __BEGIN_DECLS.
+
+1998-07-02 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
+
+ * libio/iofwrite.c: Fix return value when size == 0.
+
+1998-07-01 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
+
+ * posix/Makefile (distribute): Add annexc.c.
+ (generated): Add $(objpfx)annexc and $(objpfx)annexc.out.
+
+1998-07-01 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
+
+ * sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Add
+ bits/pthreadtypes.h here, and do not clobber headers.
+
+ * sysdeps/unix/sysv/linux/Dist: Add bits/pthreadtypes.h.
+
+1998-07-03 Andreas Jaeger <aj@arthur.rhein-neckar.de>
+
+ * timezone/tst-timezone.c: Add tests for tzname variable.
+
+1998-07-03 12:17 Zack Weinberg <zack@rabi.phys.columbia.edu>
+
+ * Makefile [versioning=yes]: Build the mapfiles with a pattern
+ rule that lists all of them as targets.
+ (sysd-versions): Depend only on Versions.def. Write a Makefile
+ fragment that defines $(vers-libs) based on contents of that file;
+ then include it.
+ (lib-noranlib): Depend on lib-mapfiles not sysd-versions.
+ (lib-mapfiles): New target, depends on sysd-versions and $(vers-libs).
+ Predicate all this on avoid-generated unset as well as versioning.
+
+1998-07-03 14:35 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/unix/sysv/linux/m68k/Versions: New file.
diff --git a/Makerules b/Makerules
index 72caf6046c..998f866114 100644
--- a/Makerules
+++ b/Makerules
@@ -345,7 +345,8 @@ $(LINK.o) -shared -o $@ $(sysdep-LDFLAGS) $(config-LDFLAGS) \
$(LDFLAGS.so) $(LDFLAGS-$(@F:lib%.so=%).so) \
-L$(subst :, -L,$(rpath-link)) -Wl,-rpath-link=$(rpath-link) \
-Wl,--whole-archive \
- $(filter-out $(map-file) $(@F:.so=.map) $(+preinit) $(+postinit),$^) \
+ $(filter-out $(map-file) $(common-objpfx)$(@F:.so=.map) \
+ $(+preinit) $(+postinit),$^) \
$(no-whole-archive) $(LDLIBS-$(@F:lib%.so=%).so)
endef
diff --git a/assert/Makefile b/assert/Makefile
index 5780457502..63fb9253ff 100644
--- a/assert/Makefile
+++ b/assert/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1991, 1994, 1997 Free Software Foundation, Inc.
+# Copyright (C) 1991, 1994, 1997, 1998 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
@@ -23,5 +23,6 @@ subdir := assert
headers := assert.h
routines := assert assert-perr
+tests := test-assert test-assert-perr
include ../Rules
diff --git a/assert/test-assert-perr.c b/assert/test-assert-perr.c
new file mode 100644
index 0000000000..824c1a9f97
--- /dev/null
+++ b/assert/test-assert-perr.c
@@ -0,0 +1,86 @@
+/* Test assert_perror().
+ *
+ * This is hairier than you'd think, involving games with
+ * stdio and signals.
+ *
+ */
+
+#include <signal.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <setjmp.h>
+
+jmp_buf rec;
+char buf[160];
+
+void
+sigabrt (int unused)
+{
+ longjmp (rec, 1); /* recover control */
+}
+
+#undef NDEBUG
+#include <assert.h>
+void
+assert1 (void)
+{
+ assert_perror (1);
+}
+
+void
+assert2 (void)
+{
+ assert_perror (0);
+}
+
+#define NDEBUG
+#include <assert.h>
+void
+assert3 (void)
+{
+ assert_perror (2);
+}
+
+int
+main(void)
+{
+ volatile int failed = 1; /* safety in presence of longjmp() */
+
+ fclose (stderr);
+ stderr = tmpfile ();
+ if (!stderr)
+ abort ();
+
+ signal (SIGABRT, sigabrt);
+
+ if (!setjmp (rec))
+ assert1 ();
+ else
+ failed = 0; /* should happen */
+
+ if (!setjmp (rec))
+ assert2 ();
+ else
+ failed = 1; /* should not happen */
+
+ if (!setjmp (rec))
+ assert3 ();
+ else
+ failed = 1; /* should not happen */
+
+ rewind (stderr);
+ fgets (buf, 160, stderr);
+ if (!strstr(buf, strerror (1)))
+ failed = 1;
+
+ fgets (buf, 160, stderr);
+ if (strstr (buf, strerror (0)))
+ failed = 1;
+
+ fgets (buf, 160, stderr);
+ if (strstr (buf, strerror (2)))
+ failed = 1;
+
+ return failed;
+}
diff --git a/assert/test-assert.c b/assert/test-assert.c
new file mode 100644
index 0000000000..045721e9cd
--- /dev/null
+++ b/assert/test-assert.c
@@ -0,0 +1,88 @@
+/* Test assert().
+ *
+ * This is hairier than you'd think, involving games with
+ * stdio and signals.
+ *
+ */
+
+#include <signal.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <setjmp.h>
+
+jmp_buf rec;
+char buf[160];
+
+void
+sigabrt (int unused)
+{
+ longjmp (rec, 1); /* recover control */
+}
+
+#undef NDEBUG
+#include <assert.h>
+void
+assert1 (void)
+{
+ assert (1 == 2);
+}
+
+void
+assert2 (void)
+{
+ assert (1 == 1);
+}
+
+
+#define NDEBUG
+#include <assert.h>
+void
+assert3 (void)
+{
+ assert (2 == 3);
+}
+
+int
+main (void)
+{
+
+ volatile int failed = 1;
+
+ fclose (stderr);
+ stderr = tmpfile ();
+ if(!stderr)
+ abort ();
+
+ signal (SIGABRT, sigabrt);
+
+ if (!setjmp (rec))
+ assert1 ();
+ else
+ failed = 0; /* should happen */
+
+ if (!setjmp (rec))
+ assert2 ();
+ else
+ failed = 1; /* should not happen */
+
+ if (!setjmp (rec))
+ assert3 ();
+ else
+ failed = 1; /* should not happen */
+
+ rewind (stderr);
+ fgets (buf, 160, stderr);
+ if (!strstr (buf, "1 == 2"))
+ failed = 1;
+
+ fgets (buf, 160, stderr);
+ if (strstr (buf, "1 == 1"))
+ failed = 1;
+
+ fgets (buf, 160, stderr);
+ if (strstr (buf, "2 == 3"))
+ failed = 1;
+
+ return failed;
+}
diff --git a/elf/sprof.c b/elf/sprof.c
index f54a61657f..c6a9b305e2 100644
--- a/elf/sprof.c
+++ b/elf/sprof.c
@@ -449,7 +449,7 @@ load_shobj (const char *name)
else
log_hashfraction = -1;
if (do_test)
- printf ("hashfraction = %d\ndivider = %d\n",
+ printf ("hashfraction = %d\ndivider = %Zu\n",
result->hashfraction,
result->hashfraction * sizeof (struct here_fromstruct));
result->tossize = textsize / HASHFRACTION;
@@ -1197,7 +1197,7 @@ generate_call_graph (struct profdata *profdata)
}
/* Info abount the function itself. */
- n = printf ("[%d]", cnt);
+ n = printf ("[%Zu]", cnt);
printf ("%*s%5.1f%8.2f%8.2f%9" PRIdMAX " %s [%Zd]\n",
7 - n, " ",
total_ticks ? (100.0 * sortsym[cnt]->ticks) / total_ticks : 0,
diff --git a/grp/initgroups.c b/grp/initgroups.c
index f42c92db9a..454882e0af 100644
--- a/grp/initgroups.c
+++ b/grp/initgroups.c
@@ -59,12 +59,18 @@ compat_call (service_user *nip, const char *user, gid_t group, long int *start,
get_function getgrent_fct;
end_function endgrent_fct;
+ getgrent_fct = __nss_lookup_function (nip, "getgrent_r");
+ if (getgrent_fct == NULL)
+ return NSS_STATUS_UNAVAIL;
+
setgrent_fct = __nss_lookup_function (nip, "setgrent");
- status = _CALL_DL_FCT (setgrent_fct, ());
- if (status != NSS_STATUS_SUCCESS)
- return status;
+ if (setgrent_fct)
+ {
+ status = _CALL_DL_FCT (setgrent_fct, ());
+ if (status != NSS_STATUS_SUCCESS)
+ return status;
+ }
- getgrent_fct = __nss_lookup_function (nip, "getgrent_r");
endgrent_fct = __nss_lookup_function (nip, "endgrent");
tmpbuf = __alloca (buflen);
@@ -115,7 +121,8 @@ compat_call (service_user *nip, const char *user, gid_t group, long int *start,
while (status == NSS_STATUS_SUCCESS);
done:
- _CALL_DL_FCT (endgrent_fct, ());
+ if (endgrent_fct)
+ _CALL_DL_FCT (endgrent_fct, ());
return NSS_STATUS_SUCCESS;
}
diff --git a/libio/Makefile b/libio/Makefile
index 61bd54f400..3c75183987 100644
--- a/libio/Makefile
+++ b/libio/Makefile
@@ -34,7 +34,7 @@ routines := \
clearerr feof ferror fgetc fileno fputc freopen fseek getc getchar \
memstream pclose putc putchar rewind setbuf setlinebuf vasprintf \
iovdprintf vscanf vsnprintf obprintf fcloseall fseeko ftello \
- freopen64 fseeko64 ftello64 \
+ freopen64 fseeko64 ftello64 iofread_u iofwrite_u \
\
libc_fatal
diff --git a/libio/Versions b/libio/Versions
index ea58a29321..12277ae29f 100644
--- a/libio/Versions
+++ b/libio/Versions
@@ -98,6 +98,6 @@ libc {
# f*
fgetpos64; fopen64; freopen64; fseeko; fseeko64; fsetpos64; ftello;
- ftello64; fopen; fclose; fdopen;
+ ftello64; fopen; fclose; fdopen; fread_unlocked; fwrite_unlocked;
}
}
diff --git a/libio/iofread_u.c b/libio/iofread_u.c
new file mode 100644
index 0000000000..bd7ceaf379
--- /dev/null
+++ b/libio/iofread_u.c
@@ -0,0 +1,42 @@
+/* Copyright (C) 1993, 1995, 1997, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU IO Library.
+
+ This library 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 2, or (at
+ your option) any later version.
+
+ This 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this library; see the file COPYING. If not, write to
+ the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+ MA 02111-1307, USA.
+
+ As a special exception, if you link this library with files
+ compiled with a GNU compiler to produce an executable, this does
+ not cause the resulting executable to be covered by the GNU General
+ Public License. This exception does not however invalidate any
+ other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+#include "libioP.h"
+
+_IO_size_t
+fread_unlocked (buf, size, count, fp)
+ void *buf;
+ _IO_size_t size;
+ _IO_size_t count;
+ _IO_FILE *fp;
+{
+ _IO_size_t bytes_requested = size*count;
+ _IO_size_t bytes_read;
+ CHECK_FILE (fp, 0);
+ if (bytes_requested == 0)
+ return 0;
+ bytes_read = _IO_sgetn (fp, (char *) buf, bytes_requested);
+ return bytes_requested == bytes_read ? count : bytes_read / size;
+}
diff --git a/libio/iofwrite.c b/libio/iofwrite.c
index 0f82797ecf..d163d29361 100644
--- a/libio/iofwrite.c
+++ b/libio/iofwrite.c
@@ -35,15 +35,15 @@ _IO_fwrite (buf, size, count, fp)
_IO_size_t request = size * count;
_IO_size_t written;
CHECK_FILE (fp, 0);
+ /* Many traditional implementations return 0 if size==0 && count > 0,
+ but ANSI requires us to return count in this case. */
if (request == 0)
- return 0;
+ return count;
_IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
_IO_flockfile (fp);
written = _IO_sputn (fp, (const char *) buf, request);
_IO_funlockfile (fp);
_IO_cleanup_region_end (0);
- /* Many traditional implementations return 0 if size==0 && count > 0,
- but ANSI requires us to return count in this case. */
if (written == request)
return count;
else
diff --git a/libio/iofwrite_u.c b/libio/iofwrite_u.c
new file mode 100644
index 0000000000..7d1d24b758
--- /dev/null
+++ b/libio/iofwrite_u.c
@@ -0,0 +1,47 @@
+/* Copyright (C) 1993, 1996, 1997, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU IO Library.
+
+ This library 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 2, or (at
+ your option) any later version.
+
+ This 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this library; see the file COPYING. If not, write to
+ the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+ MA 02111-1307, USA.
+
+ As a special exception, if you link this library with files
+ compiled with a GNU compiler to produce an executable, this does
+ not cause the resulting executable to be covered by the GNU General
+ Public License. This exception does not however invalidate any
+ other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+#include "libioP.h"
+
+_IO_size_t
+fwrite_unlocked (buf, size, count, fp)
+ const void *buf;
+ _IO_size_t size;
+ _IO_size_t count;
+ _IO_FILE *fp;
+{
+ _IO_size_t request = size * count;
+ _IO_size_t written;
+ CHECK_FILE (fp, 0);
+ /* Many traditional implementations return 0 if size==0 && count > 0,
+ but ANSI requires us to return count in this case. */
+ if (request == 0)
+ return count;
+ written = _IO_sputn (fp, (const char *) buf, request);
+ if (written == request)
+ return count;
+ else
+ return written / size;
+}
diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog
index 08525005b6..9619ae48f0 100644
--- a/linuxthreads/ChangeLog
+++ b/linuxthreads/ChangeLog
@@ -1,3 +1,7 @@
+1998-07-01 Andreas Jaeger <aj@arthur.rhein-neckar.de>
+
+ * attr.c: Include <string.h>.
+
1998-06-30 11:47 Ulrich Drepper <drepper@cygnus.com>
* attr.c: Include errno.h. Use memcpy to copy sched_param.
diff --git a/linuxthreads/attr.c b/linuxthreads/attr.c
index cdd27d6012..b5610030b5 100644
--- a/linuxthreads/attr.c
+++ b/linuxthreads/attr.c
@@ -15,6 +15,7 @@
/* Handling of thread attributes */
#include <errno.h>
+#include <string.h>
#include <unistd.h>
#include <sys/param.h>
#include "pthread.h"
diff --git a/localedata/charmaps/ISO-8859-9 b/localedata/charmaps/ISO-8859-9
index 43fd5f6bf7..12455ecb5b 100644
--- a/localedata/charmaps/ISO-8859-9
+++ b/localedata/charmaps/ISO-8859-9
@@ -245,12 +245,12 @@ CHARMAP
<c,> /xE7 <U00E7> LATIN SMALL LETTER C WITH CEDILLA
<e!> /xE8 <U00E8> LATIN SMALL LETTER E WITH GRAVE
<e'> /xE9 <U00E9> LATIN SMALL LETTER E WITH ACUTE
-<e;> /xEA <U0119> LATIN SMALL LETTER E WITH OGONEK
+<e/>> /xEA <U00EA> LATIN SMALL LETTER E WITH CIRCUMFLEX
<e:> /xEB <U00EB> LATIN SMALL LETTER E WITH DIAERESIS
-<e.> /xEC <U0117> LATIN SMALL LETTER E WITH DOT ABOVE
+<i!> /xEC <U00EC> LATIN SMALL LETTER I WITH GRAVE
<i'> /xED <U00ED> LATIN SMALL LETTER I WITH ACUTE
<i/>> /xEE <U00EE> LATIN SMALL LETTER I WITH CIRCUMFLEX
-<i-> /xEF <U012B> LATIN SMALL LETTER I WITH MACRON
+<i:> /xEF <U00EF> LATIN SMALL LETTER I WITH DIAERESIS
<g(> /xF0 <U011F> LATIN SMALL LETTER G WITH BREVE
<n?> /xF1 <U00F1> LATIN SMALL LETTER N WITH TILDE
<o!> /xF2 <U00F2> LATIN SMALL LETTER O WITH GRAVE
diff --git a/nis/nis_add.c b/nis/nis_add.c
index 10b46aff18..9618ad87c7 100644
--- a/nis/nis_add.c
+++ b/nis/nis_add.c
@@ -17,6 +17,7 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
+#include <string.h>
#include <rpcsvc/nis.h>
#include "nis_xdr.h"
diff --git a/nis/nis_checkpoint.c b/nis/nis_checkpoint.c
index 585214a3b4..f1e860f7b8 100644
--- a/nis/nis_checkpoint.c
+++ b/nis/nis_checkpoint.c
@@ -17,6 +17,7 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
+#include <string.h>
#include <rpcsvc/nis.h>
#include "nis_xdr.h"
diff --git a/nis/nis_modify.c b/nis/nis_modify.c
index 57efe82bf2..a1bcd7ff9c 100644
--- a/nis/nis_modify.c
+++ b/nis/nis_modify.c
@@ -17,6 +17,7 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
+#include <string.h>
#include <rpcsvc/nis.h>
#include "nis_xdr.h"
diff --git a/nscd/grpcache.c b/nscd/grpcache.c
index 3f3f4ba0ec..2806ddd52e 100644
--- a/nscd/grpcache.c
+++ b/nscd/grpcache.c
@@ -22,6 +22,7 @@
#include <pthread.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
#include <rpcsvc/nis.h>
#include <sys/types.h>
@@ -48,7 +49,7 @@ typedef struct grphash grphash;
struct gidhash
{
struct gidhash *next;
- struct grphash *grptr;
+ struct group *grptr;
};
typedef struct gidhash gidhash;
@@ -176,6 +177,7 @@ static int
add_cache (struct group *grp)
{
grphash *work;
+ gidhash *gidwork;
unsigned long int hash = __nis_hash (grp->gr_name,
strlen (grp->gr_name)) % modulo;
@@ -197,7 +199,17 @@ add_cache (struct group *grp)
}
time (&work->create);
- gidtbl[grp->gr_gid % modulo].grptr = work;
+ gidwork = &gidtbl[grp->gr_gid % modulo];
+ if (gidwork->grptr == NULL)
+ gidwork->grptr = work->grp;
+ else
+ {
+ while (gidwork->next != NULL)
+ gidwork = gidwork->next;
+
+ gidwork->next = calloc (1, sizeof (gidhash));
+ gidwork->next->grptr = work->grp;
+ }
return 0;
}
@@ -231,8 +243,8 @@ cache_search_gid (gid_t gid)
while (work->grptr != NULL)
{
- if (work->grptr->grp->gr_gid == gid)
- return work->grptr->grp;
+ if (work->grptr->gr_gid == gid)
+ return work->grptr;
if (work->next != NULL)
work = work->next;
else
@@ -475,7 +487,7 @@ cache_getgrgid (void *v_param)
return NULL;
}
-void *
+static void *
grptable_update (void *v)
{
time_t now;
@@ -509,7 +521,7 @@ grptable_update (void *v)
while (uh && uh->grptr)
{
- if (uh->grptr->grp->gr_gid == work->grp->gr_gid)
+ if (uh->grptr->gr_gid == work->grp->gr_gid)
{
if (debug_flag > 3)
dbg_log (_("Give gid for \"%s\" free"),
@@ -543,14 +555,14 @@ grptable_update (void *v)
}
}
if (debug_flag > 2)
- dbg_log (_("(pwdtable_update) Release wait lock\n"));
+ dbg_log (_("(grptable_update) Release wait lock"));
pthread_rwlock_unlock (&grplock);
sleep (20);
}
return NULL;
}
-void *
+static void *
negtable_update (void *v)
{
time_t now;
@@ -561,12 +573,12 @@ negtable_update (void *v)
while (!do_shutdown)
{
if (debug_flag > 2)
- dbg_log (_("(negtable_update) Wait for write lock!"));
+ dbg_log (_("(neggrptable_update) Wait for write lock!"));
pthread_rwlock_wrlock (&neglock);
if (debug_flag > 2)
- dbg_log (_("(negtable_update) Have write lock"));
+ dbg_log (_("(neggrptable_update) Have write lock"));
time (&now);
for (i = 0; i < modulo; ++i)
@@ -597,7 +609,7 @@ negtable_update (void *v)
}
}
if (debug_flag > 2)
- dbg_log (_("(negtable_update) Release wait lock"));
+ dbg_log (_("(neggrptable_update) Release wait lock"));
pthread_rwlock_unlock (&neglock);
sleep (10);
}
diff --git a/nscd/nscd.c b/nscd/nscd.c
index 9f167d2daa..e1c636775f 100644
--- a/nscd/nscd.c
+++ b/nscd/nscd.c
@@ -309,7 +309,7 @@ write_pid (const char *file)
typedef int (*pwbyname_function) (const char *name, struct passwd *pw,
char *buffer, size_t buflen);
-/* Hanlde incoming requests. */
+/* Handle incoming requests. */
static
void handle_requests (void)
{
@@ -317,6 +317,12 @@ void handle_requests (void)
int conn; /* Handle on which connection (client) the request came from. */
int done = 0;
char *key;
+ pthread_attr_t th_attr;
+
+ /* We will create all threads detached. Therefore prepare an attribute
+ now. */
+ pthread_attr_init (&th_attr);
+ pthread_attr_setdetachstate (&th_attr, PTHREAD_CREATE_DETACHED);
while (!done)
{
@@ -331,15 +337,23 @@ void handle_requests (void)
{
param_t *param = malloc (sizeof (param_t));
pthread_t thread;
+ int status;
if (debug_flag)
dbg_log ("\tGETPWBYNAME (%s)", key);
param->key = key;
param->conn = conn;
if (disabled_passwd)
- pthread_create (&thread, NULL, cache_pw_disabled, (void *)param);
+ status = pthread_create (&thread, &th_attr, cache_pw_disabled,
+ (void *)param);
else
- pthread_create (&thread, NULL, cache_getpwnam, (void *)param);
+ status = pthread_create (&thread, &th_attr, cache_getpwnam,
+ (void *)param);
+ if (status != 0)
+ {
+ dbg_log (_("Creation of thread failed: %s"), strerror (errno));
+ close_socket (conn);
+ }
pthread_detach (thread);
}
break;
@@ -347,48 +361,69 @@ void handle_requests (void)
{
param_t *param = malloc (sizeof (param_t));
pthread_t thread;
+ int status;
if (debug_flag)
dbg_log ("\tGETPWBYUID (%s)", key);
param->key = key;
param->conn = conn;
if (disabled_passwd)
- pthread_create (&thread, NULL, cache_pw_disabled, (void *)param);
+ status = pthread_create (&thread, &th_attr, cache_pw_disabled,
+ (void *)param);
else
- pthread_create (&thread, NULL, cache_getpwuid, (void *)param);
- pthread_detach (thread);
+ status = pthread_create (&thread, &th_attr, cache_getpwuid,
+ (void *)param);
+ if (status != 0)
+ {
+ dbg_log (_("Creation of thread failed: %s"), strerror (errno));
+ close_socket (conn);
+ }
}
break;
case GETGRBYNAME:
{
param_t *param = malloc (sizeof (param_t));
pthread_t thread;
+ int status;
if (debug_flag)
dbg_log ("\tGETGRBYNAME (%s)", key);
param->key = key;
param->conn = conn;
if (disabled_group)
- pthread_create (&thread, NULL, cache_gr_disabled, (void *)param);
+ status = pthread_create (&thread, &th_attr, cache_gr_disabled,
+ (void *)param);
else
- pthread_create (&thread, NULL, cache_getgrnam, (void *)param);
- pthread_detach (thread);
+ status = pthread_create (&thread, &th_attr, cache_getgrnam,
+ (void *)param);
+ if (status != 0)
+ {
+ dbg_log (_("Creation of thread failed: %s"), strerror (errno));
+ close_socket (conn);
+ }
}
break;
case GETGRBYGID:
{
param_t *param = malloc (sizeof (param_t));
pthread_t thread;
+ int status;
if (debug_flag)
dbg_log ("\tGETGRBYGID (%s)", key);
param->key = key;
param->conn = conn;
if (disabled_group)
- pthread_create (&thread, NULL, cache_gr_disabled, (void *)param);
+ status = pthread_create (&thread, &th_attr, cache_gr_disabled,
+ (void *)param);
else
- pthread_create (&thread, NULL, cache_getgrgid, (void *)param);
- pthread_detach (thread);
+ status = pthread_create (&thread, &th_attr, cache_getgrgid,
+ (void *)param);
+ if (status != 0)
+ {
+ dbg_log (_("Creation of thread failed: %s"), strerror (errno));
+ close_socket (conn);
+ }
}
break;
case GETHOSTBYNAME:
@@ -432,4 +467,6 @@ void handle_requests (void)
break;
}
}
+
+ pthread_attr_destroy (&th_attr);
}
diff --git a/nscd/pwdcache.c b/nscd/pwdcache.c
index 721e77b7c9..e2bf73afc1 100644
--- a/nscd/pwdcache.c
+++ b/nscd/pwdcache.c
@@ -22,6 +22,7 @@
#include <pthread.h>
#include <pwd.h>
#include <string.h>
+#include <unistd.h>
#include <rpcsvc/nis.h>
#include <sys/types.h>
@@ -48,7 +49,7 @@ typedef struct pwdhash pwdhash;
struct uidhash
{
struct uidhash *next;
- struct pwdhash *pwptr;
+ struct passwd *pwptr;
};
typedef struct uidhash uidhash;
@@ -159,6 +160,7 @@ static int
add_cache (struct passwd *pwd)
{
pwdhash *work;
+ uidhash *uidwork;
unsigned long int hash = __nis_hash (pwd->pw_name,
strlen (pwd->pw_name)) % modulo;
@@ -180,8 +182,17 @@ add_cache (struct passwd *pwd)
}
/* Set a pointer from the pwuid hash table to the pwname hash table */
time (&work->create);
- uidtbl[pwd->pw_uid % modulo].pwptr = work;
+ uidwork = &uidtbl[pwd->pw_uid % modulo];
+ if (uidwork->pwptr == NULL)
+ uidwork->pwptr = work->pwd;
+ else
+ {
+ while (uidwork->next != NULL)
+ uidwork = uidwork->next;
+ uidwork->next = calloc (1, sizeof (uidhash));
+ uidwork->next->pwptr = work->pwd;
+ }
return 0;
}
@@ -214,8 +225,8 @@ cache_search_uid (uid_t uid)
while (work->pwptr != NULL)
{
- if (work->pwptr->pwd->pw_uid == uid)
- return work->pwptr->pwd;
+ if (work->pwptr->pw_uid == uid)
+ return work->pwptr;
if (work->next != NULL)
work = work->next;
else
@@ -458,7 +469,7 @@ cache_getpwuid (void *v_param)
return NULL;
}
-void *
+static void *
pwdtable_update (void *v)
{
time_t now;
@@ -492,7 +503,7 @@ pwdtable_update (void *v)
while (uh != NULL && uh->pwptr)
{
- if (uh->pwptr->pwd->pw_uid == work->pwd->pw_uid)
+ if (uh->pwptr->pw_uid == work->pwd->pw_uid)
{
if (debug_flag)
dbg_log (_("Give uid for \"%s\" free"),
@@ -533,7 +544,7 @@ pwdtable_update (void *v)
return NULL;
}
-void *
+static void *
negtable_update (void *v)
{
time_t now;
@@ -544,12 +555,12 @@ negtable_update (void *v)
while (!do_shutdown)
{
if (debug_flag > 2)
- dbg_log (_("(negtable_update) Wait for write lock!"));
+ dbg_log (_("(negpwdtable_update) Wait for write lock!"));
pthread_rwlock_wrlock (&neglock);
- if (debug_flag)
- dbg_log (_("(negtable_update) Have write lock"));
+ if (debug_flag > 2)
+ dbg_log (_("(negpwdtable_update) Have write lock"));
time (&now);
for (i = 0; i < modulo; ++i)
@@ -579,8 +590,8 @@ negtable_update (void *v)
work = work->next;
}
}
- if (debug_flag)
- dbg_log (_("(negtable_update) Release wait lock"));
+ if (debug_flag > 2)
+ dbg_log (_("(negpwdtable_update) Release wait lock"));
pthread_rwlock_unlock (&neglock);
sleep (10);
diff --git a/posix/Makefile b/posix/Makefile
index 5a37df6325..ad70fddd63 100644
--- a/posix/Makefile
+++ b/posix/Makefile
@@ -30,7 +30,7 @@ headers := sys/utsname.h sys/times.h sys/wait.h sys/types.h unistd.h \
distribute := confstr.h TESTS TESTS2C.sed testcases.h \
PTESTS PTESTS2C.sed ptestcases.h \
- globtest.c globtest.sh wordexp-tst.sh
+ globtest.c globtest.sh wordexp-tst.sh annexc.c
routines := \
uname \
@@ -63,7 +63,8 @@ gpl2lgpl := getopt.c getopt1.c getopt.h regex.c regex.h
before-compile := testcases.h ptestcases.h
# So they get cleaned up.
-generated := $(addprefix wordexp-test-result, 1 2 3 4 5 6 7 8 9 10)
+generated := $(addprefix wordexp-test-result, 1 2 3 4 5 6 7 8 9 10) \
+ $(objpfx)annexc $(objpfx)annexc.out
include ../Rules
diff --git a/posix/regex.c b/posix/regex.c
index 26c876a155..3868da3eb7 100644
--- a/posix/regex.c
+++ b/posix/regex.c
@@ -5509,12 +5509,12 @@ re_comp (s)
{
re_comp_buf.buffer = (unsigned char *) malloc (200);
if (re_comp_buf.buffer == NULL)
- return gettext (re_error_msgid[(int) REG_ESPACE]);
+ return (char *) gettext (re_error_msgid[(int) REG_ESPACE]);
re_comp_buf.allocated = 200;
re_comp_buf.fastmap = (char *) malloc (1 << BYTEWIDTH);
if (re_comp_buf.fastmap == NULL)
- return gettext (re_error_msgid[(int) REG_ESPACE]);
+ return (char *) gettext (re_error_msgid[(int) REG_ESPACE]);
}
/* Since `re_exec' always passes NULL for the `regs' argument, we
diff --git a/posix/runptests.c b/posix/runptests.c
index 50b157b76f..b1eabb9ebd 100644
--- a/posix/runptests.c
+++ b/posix/runptests.c
@@ -21,6 +21,7 @@
#include <sys/types.h>
#include <regex.h>
#include <stdio.h>
+#include <string.h>
/* Data structure to describe the tests. */
struct test
@@ -108,7 +109,7 @@ main (int argc, char *argv[])
regfree (&re);
}
- printf ("\n%u tests, %d errors\n", cnt, errors);
+ printf ("\n%Zu tests, %d errors\n", cnt, errors);
/* We should return here the error status but since some tests are known
to fail this would only cause the libc testsuite to fail. */
diff --git a/stdio-common/bug1.c b/stdio-common/bug1.c
index 455b14d7cf..51639d3476 100644
--- a/stdio-common/bug1.c
+++ b/stdio-common/bug1.c
@@ -12,12 +12,12 @@ main (void)
stream = open_memstream (&bp, &size);
fprintf (stream, "hello");
fflush (stream);
- printf ("buf = %s, size = %d\n", bp, size);
+ printf ("buf = %s, size = %Zu\n", bp, size);
lose |= size != 5;
lose |= strncmp (bp, "hello", size);
fprintf (stream, ", world");
fclose (stream);
- printf ("buf = %s, size = %d\n", bp, size);
+ printf ("buf = %s, size = %Zu\n", bp, size);
lose |= size != 12;
lose |= strncmp (bp, "hello, world", 12);
diff --git a/stdio-common/bug5.c b/stdio-common/bug5.c
index 8c3d0e3bc7..f655845891 100644
--- a/stdio-common/bug5.c
+++ b/stdio-common/bug5.c
@@ -28,7 +28,7 @@ main (void)
return 1;
}
for (i = 0; i < 1000; ++i)
- fprintf (in, "%u\n", i);
+ fprintf (in, "%Zu\n", i);
out = fopen (outname, "w");
if (out == NULL)
diff --git a/stdio-common/printf.h b/stdio-common/printf.h
index 8b3b4eb967..852027ce21 100644
--- a/stdio-common/printf.h
+++ b/stdio-common/printf.h
@@ -59,17 +59,17 @@ struct printf_info
The function should return the number of characters written,
or -1 for errors. */
-typedef int printf_function __P ((FILE *__stream,
- __const struct printf_info *__info,
- __const void *__const *__args));
+typedef int printf_function __PMT ((FILE *__stream,
+ __const struct printf_info *__info,
+ __const void *__const *__args));
/* Type of a printf specifier-arginfo function.
INFO gives information about the format specification.
N, ARGTYPES, and return value are as for printf_parse_format. */
-typedef int printf_arginfo_function __P ((__const struct printf_info *__info,
- size_t __n,
- int *__argtypes));
+typedef int printf_arginfo_function __PMT ((__const struct printf_info *__info,
+ size_t __n,
+ int *__argtypes));
/* Register FUNC to be called to format SPEC specifiers; ARGINFO must be
diff --git a/stdio-common/test_rdwr.c b/stdio-common/test_rdwr.c
index 32bce5b77a..e274dcc665 100644
--- a/stdio-common/test_rdwr.c
+++ b/stdio-common/test_rdwr.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1992, 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -61,13 +61,13 @@ main (int argc, char **argv)
int c = getc (f);
if (c == EOF)
{
- printf ("EOF at %u.\n", i);
+ printf ("EOF at %Zu.\n", i);
lose = 1;
break;
}
else if (c != hello[i])
{
- printf ("Got '%c' instead of '%c' at %u.\n",
+ printf ("Got '%c' instead of '%c' at %Zu.\n",
(unsigned char) c, hello[i], i);
lose = 1;
break;
@@ -83,7 +83,7 @@ main (int argc, char **argv)
for (i = replace_from; i < replace_to; ++i)
if (putc(replace[i], f) == EOF)
{
- printf ("putc('%c') got %s at %u.\n",
+ printf ("putc('%c') got %s at %Zu.\n",
replace[i], strerror (errno), i);
lose = 1;
break;
@@ -97,7 +97,7 @@ main (int argc, char **argv)
}
else
{
- printf ("ftell returns %lu; should be %u.\n", where, replace_from);
+ printf ("ftell returns %lu; should be %Zu.\n", where, replace_from);
lose = 1;
}
}
diff --git a/stdio-common/tstgetln.c b/stdio-common/tstgetln.c
index fe37672703..d6ff2c139d 100644
--- a/stdio-common/tstgetln.c
+++ b/stdio-common/tstgetln.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1995, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -32,7 +32,7 @@ main (int argc, char *argv[])
while ((len = getline (&buf, &size, stdin)) != -1)
{
- printf ("bufsize %u; read %d: ", size, len);
+ printf ("bufsize %Zu; read %Zd: ", size, len);
if (fwrite (buf, len, 1, stdout) != 1)
{
perror ("fwrite");
diff --git a/string/tst-strlen.c b/string/tst-strlen.c
index c43cb1a4d6..1b1f8344b8 100644
--- a/string/tst-strlen.c
+++ b/string/tst-strlen.c
@@ -33,7 +33,7 @@ main(int argc, char *argv[])
if (strlen (buf) != words * 4 + lens[last])
{
- printf ("failed for base=%d, words=%d, and last=%d\n",
+ printf ("failed for base=%Zu, words=%Zu, and last=%Zu\n",
base, words, last);
return 1;
}
diff --git a/sysdeps/generic/fstatvfs64.c b/sysdeps/generic/fstatvfs64.c
index a96c7bdec2..8ede56eec3 100644
--- a/sysdeps/generic/fstatvfs64.c
+++ b/sysdeps/generic/fstatvfs64.c
@@ -19,6 +19,7 @@
#include <errno.h>
#include <sys/statvfs.h>
+#include <string.h>
/* Return information about the filesystem on which FD resides. */
int
diff --git a/sysdeps/generic/statvfs64.c b/sysdeps/generic/statvfs64.c
index 349760362b..d88bd5945b 100644
--- a/sysdeps/generic/statvfs64.c
+++ b/sysdeps/generic/statvfs64.c
@@ -20,6 +20,7 @@
#include <errno.h>
#include <sys/statvfs.h>
#include <stddef.h>
+#include <string.h>
/* Return information about the filesystem on which FILE resides. */
int
diff --git a/sysdeps/libm-ieee754/e_acos.c b/sysdeps/libm-ieee754/e_acos.c
index fa858defc5..eb4080a8b8 100644
--- a/sysdeps/libm-ieee754/e_acos.c
+++ b/sysdeps/libm-ieee754/e_acos.c
@@ -71,7 +71,7 @@ qS[] ={1.0, -2.40339491173441421878e+00, /* 0xC0033A27, 0x1C8A2D4B */
double x;
#endif
{
- double z,p,q,r,w,s,c,df,p1,p2,p3,q1,q2,q3,z2,z4,z6;
+ double z,p,q,r,w,s,c,df,p1,p2,p3,q1,q2,z2,z4,z6;
int32_t hx,ix;
GET_HIGH_WORD(hx,x);
ix = hx&0x7fffffff;
diff --git a/sysdeps/libm-ieee754/e_asin.c b/sysdeps/libm-ieee754/e_asin.c
index 65dc318db3..aa19598848 100644
--- a/sysdeps/libm-ieee754/e_asin.c
+++ b/sysdeps/libm-ieee754/e_asin.c
@@ -79,7 +79,7 @@ qS[] = {1.0, -2.40339491173441421878e+00, /* 0xC0033A27, 0x1C8A2D4B */
double x;
#endif
{
- double t,w,p,q,c,r,s,p1,p2,p3,q1,q2,q3,z2,z4,z6;
+ double t,w,p,q,c,r,s,p1,p2,p3,q1,q2,z2,z4,z6;
int32_t hx,ix;
GET_HIGH_WORD(hx,x);
ix = hx&0x7fffffff;
diff --git a/sysdeps/unix/bsd/poll.c b/sysdeps/unix/bsd/poll.c
index e92b718022..23ae6e21be 100644
--- a/sysdeps/unix/bsd/poll.c
+++ b/sysdeps/unix/bsd/poll.c
@@ -16,11 +16,14 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
+#include <alloca.h>
#include <sys/poll.h>
#include <sys/types.h>
#include <errno.h>
#include <string.h>
#include <sys/time.h>
+#include <sys/param.h>
+#include <unistd.h>
/* Poll the file descriptors described by the NFDS structures starting at
FDS. If TIMEOUT is nonzero and not -1, allow TIMEOUT milliseconds for
@@ -34,25 +37,37 @@ __poll (fds, nfds, timeout)
unsigned long int nfds;
int timeout;
{
+ static int max_fd_size;
struct timeval tv;
- fd_set rset, wset, xset;
+ fd_set *rset, *wset, *xset;
struct pollfd *f;
int ready;
int maxfd = 0;
+ int bytes;
- FD_ZERO (&rset);
- FD_ZERO (&wset);
- FD_ZERO (&xset);
+ if (!max_fd_size)
+ max_fd_size = __getdtablesize ();
+
+ bytes = howmany (max_fd_size, __NFDBITS);
+ rset = alloca (bytes);
+ wset = alloca (bytes);
+ xset = alloca (bytes);
+
+ /* We can't call FD_ZERO, since FD_ZERO only works with sets
+ of exactly __FD_SETSIZE size. */
+ __bzero (rset, bytes);
+ __bzero (wset, bytes);
+ __bzero (xset, bytes);
for (f = fds; f < &fds[nfds]; ++f)
if (f->fd >= 0)
{
if (f->events & POLLIN)
- FD_SET (f->fd, &rset);
+ FD_SET (f->fd, rset);
if (f->events & POLLOUT)
- FD_SET (f->fd, &wset);
+ FD_SET (f->fd, wset);
if (f->events & POLLPRI)
- FD_SET (f->fd, &xset);
+ FD_SET (f->fd, xset);
if (f->fd > maxfd && (f->events & (POLLIN|POLLOUT|POLLPRI)))
maxfd = f->fd;
}
@@ -60,19 +75,18 @@ __poll (fds, nfds, timeout)
tv.tv_sec = timeout / 1000;
tv.tv_usec = (timeout % 1000) * 1000;
- ready = __select (maxfd + 1, &rset, &wset, &xset,
- timeout == -1 ? NULL : &tv);
+ ready = __select (maxfd + 1, rset, wset, xset, timeout == -1 ? NULL : &tv);
if (ready > 0)
for (f = fds; f < &fds[nfds]; ++f)
{
f->revents = 0;
if (f->fd >= 0)
{
- if (FD_ISSET (f->fd, &rset))
+ if (FD_ISSET (f->fd, rset))
f->revents |= POLLIN;
- if (FD_ISSET (f->fd, &wset))
+ if (FD_ISSET (f->fd, wset))
f->revents |= POLLOUT;
- if (FD_ISSET (f->fd, &xset))
+ if (FD_ISSET (f->fd, xset))
f->revents |= POLLPRI;
}
}
diff --git a/sysdeps/unix/sysv/linux/Dist b/sysdeps/unix/sysv/linux/Dist
index 27b3077a65..89758cd3a8 100644
--- a/sysdeps/unix/sysv/linux/Dist
+++ b/sysdeps/unix/sysv/linux/Dist
@@ -1,3 +1,4 @@
+bits/pthreadtypes.h
stdio_lim.h.in
cmsg_nxthdr.c
errlist.h
@@ -74,3 +75,5 @@ sys/user.h
sys/vt.h
xstatconv.c
getdents64.c
+__sendmsg.S
+__recvmsg.S
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index ec42e776c0..7de1008716 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -58,7 +58,7 @@ ifeq ($(subdir),socket)
sysdep_headers += net/if.h net/if_ppp.h net/ppp-comp.h \
net/ppp_defs.h net/if_arp.h net/route.h net/ethernet.h \
net/if_slip.h net/if_packet.h
-sysdep_routines += cmsg_nxthdr sa_len
+sysdep_routines += cmsg_nxthdr sa_len __sendmsg __recvmsg
endif
ifeq ($(subdir),sunrpc)
@@ -75,7 +75,7 @@ inhibit-siglist := yes
endif
ifeq ($(subdir),posix)
-headers := bits/pthreadtypes.h
+sysdep_headers += bits/pthreadtypes.h
endif
ifeq ($(subdir),inet)
diff --git a/sysdeps/unix/sysv/linux/recvmsg.S b/sysdeps/unix/sysv/linux/__recvmsg.S
index 98be36be5b..515ff552aa 100644
--- a/sysdeps/unix/sysv/linux/recvmsg.S
+++ b/sysdeps/unix/sysv/linux/__recvmsg.S
@@ -1,5 +1,5 @@
-#define socket recvmsg
+#define socket __recvmsg
#define __socket __libc_recvmsg
+#define SOCKOP___recvmsg SOCKOP_recvmsg
#define NARGS 3
#include <socket.S>
-weak_alias (__libc_recvmsg, __recvmsg)
diff --git a/sysdeps/unix/sysv/linux/sendmsg.S b/sysdeps/unix/sysv/linux/__sendmsg.S
index c01d9b68e7..165ee14698 100644
--- a/sysdeps/unix/sysv/linux/sendmsg.S
+++ b/sysdeps/unix/sysv/linux/__sendmsg.S
@@ -1,5 +1,5 @@
-#define socket sendmsg
+#define socket __sendmsg
#define __socket __libc_sendmsg
+#define SOCKOP___sendmsg SOCKOP_sendmsg
#define NARGS 3
#include <socket.S>
-weak_alias (__libc_sendmsg, __sendmsg)
diff --git a/sysdeps/unix/sysv/linux/aio_sigqueue.c b/sysdeps/unix/sysv/linux/aio_sigqueue.c
index fc1187b443..5dea29fcf6 100644
--- a/sysdeps/unix/sysv/linux/aio_sigqueue.c
+++ b/sysdeps/unix/sysv/linux/aio_sigqueue.c
@@ -24,9 +24,6 @@
extern int __syscall_rt_sigqueueinfo (int, int, siginfo_t *);
-/* This variable is used quite often in the libc code. */
-extern pid_t __libc_pid;
-
/* Return any pending signal or wait for one for the given time. */
int
@@ -40,10 +37,8 @@ __aio_sigqueue (sig, val)
info.si_signo = sig;
info.si_errno = 0;
info.si_code = SI_ASYNCIO;
-
info.si_pid = getpid ();
info.si_uid = getuid ();
-
info.si_value = val;
return __syscall_rt_sigqueueinfo (info.si_pid, sig, &info);
diff --git a/sysdeps/unix/sysv/linux/bits/sched.h b/sysdeps/unix/sysv/linux/bits/sched.h
index c7f6d8d902..9d5d5e65df 100644
--- a/sysdeps/unix/sysv/linux/bits/sched.h
+++ b/sysdeps/unix/sysv/linux/bits/sched.h
@@ -57,6 +57,8 @@ extern int clone __P ((int (*__fn) (void *__arg), void *__child_stack,
int __flags, void *__arg));
#endif
+__END_DECLS
+
#endif /* need schedparam */
#if !defined __defined_schedparam \
@@ -69,5 +71,3 @@ struct __sched_param
};
# undef __need_schedparam
#endif
-
-__END_DECLS
diff --git a/sysdeps/unix/sysv/linux/bits/socket.h b/sysdeps/unix/sysv/linux/bits/socket.h
index 5517ba8803..c1f752ec29 100644
--- a/sysdeps/unix/sysv/linux/bits/socket.h
+++ b/sysdeps/unix/sysv/linux/bits/socket.h
@@ -222,12 +222,32 @@ __cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg)
<linux/socket.h>. */
enum
{
- SCM_RIGHTS = 0x01, /* Data array contains access rights. */
+ SCM_RIGHTS = 0x01, /* Transfer file descriptors. */
#define SCM_RIGHTS SCM_RIGHTS
- __SCM_CREDENTIALS = 0x02, /* Data array is `struct ucred'. */
- __SCM_CONNECT = 0x03 /* Data array is `struct scm_connect'. */
+#ifdef __USE_BSD
+ SCM_CREDS = 0x02, /* BSD-compatible credentials passing. */
+# define SCM_CREDS SCM_CREDS
+#endif
+ __SCM_CONNECT = 0x03, /* Data array is `struct scm_connect'. */
};
+#ifdef __USE_BSD
+
+/* User visible structure for SCM_CREDS message
+ (chosen for BSD source compatibility) */
+
+# define CMGROUP_MAX 16 /* Linux does not provide this info, so it doesn't
+ matter... use what bsd does. */
+struct cmsgcred
+{
+ pid_t cmcred_pid; /* PID of sending process. */
+ uid_t cmcred_uid; /* Real UID of sending process. */
+ uid_t cmcred_euid; /* Effective UID of sending process. */
+ gid_t cmcred_gid; /* Real GID of sending process. */
+ short int cmcred_ngroups; /* Number or groups. */
+ gid_t cmcred_groups[CMGROUP_MAX]; /* Groups. */
+};
+#endif
/* Get socket manipulation related informations from kernel headers. */
#include <asm/socket.h>
diff --git a/sysdeps/unix/sysv/linux/recvmsg.c b/sysdeps/unix/sysv/linux/recvmsg.c
new file mode 100644
index 0000000000..04cf230828
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/recvmsg.c
@@ -0,0 +1,93 @@
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <sys/socket.h>
+#include <errno.h>
+#include <string.h>
+
+#include <asm/posix_types.h>
+
+/* The kernel expects this structure in SCM_CREDS messages.
+ * Note: sizeof(struct __kernel_ucred) <= sizeof(struct cmsgcred) must hold.
+ */
+struct __kernel_ucred
+{
+ __kernel_pid_t pid;
+ __kernel_uid_t uid;
+ __kernel_gid_t gid;
+};
+
+extern int __recvmsg (int, struct msghdr *, int);
+
+int
+recvmsg (fd, message, flags)
+ int fd;
+ struct msghdr *message;
+ int flags;
+{
+ struct cmsghdr *cm;
+ int ret;
+ int found_creds = 0;
+
+ /* Must check for space first. */
+ cm = CMSG_FIRSTHDR (message);
+ while (cm)
+ {
+ if (cm->cmsg_type == SCM_CREDS)
+ {
+ if (cm->cmsg_len < CMSG_SPACE (sizeof (struct cmsgcred)))
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+ found_creds = 1;
+ }
+ cm = CMSG_NXTHDR (message, cm);
+ }
+
+
+ ret = __recvmsg (fd, message, flags);
+
+ if (ret == -1)
+ return ret;
+
+ /* Postprocess the message control block for SCM_CREDS. */
+ cm = CMSG_FIRSTHDR (message);
+ if (found_creds)
+ while (cm)
+ {
+ if (cm->cmsg_type == SCM_CREDS)
+ {
+ struct cmsgcred *c = (struct cmsgcred *) CMSG_DATA (cm);
+ struct __kernel_ucred u;
+ int i;
+ memcpy (&u, CMSG_DATA (cm), sizeof (struct __kernel_ucred));
+
+ c->cmcred_pid = u.pid;
+ c->cmcred_uid = u.uid;
+ c->cmcred_gid = u.gid;
+
+ c->cmcred_euid = -1;
+ c->cmcred_ngroups = 0;
+ for (i = 0; i < CMGROUP_MAX; i++)
+ c->cmcred_groups[i] = -1;
+ }
+ cm = CMSG_NXTHDR (message, cm);
+ }
+ return ret;
+}
diff --git a/sysdeps/unix/sysv/linux/sendmsg.c b/sysdeps/unix/sysv/linux/sendmsg.c
new file mode 100644
index 0000000000..8902530c2b
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sendmsg.c
@@ -0,0 +1,91 @@
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <sys/socket.h>
+#include <errno.h>
+#include <unistd.h>
+
+#include <asm/posix_types.h>
+
+/* The kernel expects this structure in SCM_CREDS messages.
+ * Note: sizeof(struct __kernel_ucred) <= sizeof(struct cmsgcred) must hold.
+ */
+struct __kernel_ucred
+{
+ __kernel_pid_t pid;
+ __kernel_uid_t uid;
+ __kernel_gid_t gid;
+};
+
+extern int __sendmsg (int, const struct msghdr *, int);
+
+/* Send a message described by MESSAGE on socket FD.
+ Returns the number of bytes sent, or -1 for errors. */
+int
+sendmsg (fd, message, flags)
+ int fd;
+ const struct msghdr *message;
+ int flags;
+{
+ struct cmsghdr *cm;
+ struct cmsgcred *cc;
+ struct __kernel_ucred *u;
+ pid_t pid;
+
+ /* Preprocess the message control block for SCM_CREDS. */
+ cm = CMSG_FIRSTHDR (message);
+ while (cm)
+ {
+ if (cm->cmsg_type == SCM_CREDS)
+ {
+ if (cm->cmsg_len < CMSG_SPACE (sizeof (struct cmsgcred)))
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ u = (struct __kernel_ucred *) CMSG_DATA (cm);
+ cc = (struct cmsgcred *) CMSG_DATA (cm);
+ /* Linux expects the calling process to pass in
+ its credentials, and sanity checks them.
+ You can send real, effective, or set- uid and gid.
+ If the user hasn't filled in the buffer, we default to
+ real uid and gid. */
+ pid = getpid ();
+ if (cc->cmcred_pid != pid)
+ {
+ u->pid = pid;
+ u->uid = getuid ();
+ u->gid = getgid ();
+ }
+ else
+ {
+ struct __kernel_ucred v;
+ v.pid = cc->cmcred_pid;
+ v.uid = cc->cmcred_uid;
+ v.gid = cc->cmcred_gid;
+ u->pid = v.pid;
+ u->uid = v.uid;
+ u->gid = v.gid;
+ }
+ }
+ cm = CMSG_NXTHDR ((struct msghdr *) message, cm);
+ }
+
+ return __sendmsg (fd, message, flags);
+}
diff --git a/time/tzfile.c b/time/tzfile.c
index 1d51a695ff..eca09e2bbb 100644
--- a/time/tzfile.c
+++ b/time/tzfile.c
@@ -60,6 +60,7 @@ static size_t num_leaps;
static struct leap *leaps = NULL;
#include <endian.h>
+#include <byteswap.h>
/* Decode the four bytes at PTR as a signed integer in network byte order. */
static inline int
@@ -67,6 +68,8 @@ decode (const void *ptr)
{
if ((BYTE_ORDER == BIG_ENDIAN) && sizeof (int) == 4)
return *(const int *) ptr;
+ else if (BYTE_ORDER == LITTLE_ENDIAN && sizeof (int) == 4)
+ return bswap_32 (*(const int *) ptr);
else
{
const unsigned char *p = ptr;
@@ -157,7 +160,7 @@ __tzfile_read (const char *file)
if (f == NULL)
return;
- if (fread ((void *) &tzhead, sizeof (tzhead), 1, f) != 1)
+ if (fread_unlocked ((void *) &tzhead, sizeof (tzhead), 1, f) != 1)
goto lose;
num_transitions = (size_t) decode (tzhead.tzh_timecnt);
@@ -198,8 +201,8 @@ __tzfile_read (const char *file)
if (sizeof (time_t) < 4)
abort ();
- if (fread(transitions, 4, num_transitions, f) != num_transitions ||
- fread(type_idxs, 1, num_transitions, f) != num_transitions)
+ if (fread_unlocked (transitions, 4, num_transitions, f) != num_transitions
+ || fread_unlocked (type_idxs, 1, num_transitions, f) != num_transitions)
goto lose;
/* Check for bogus indices in the data file, so we can hereafter
@@ -222,32 +225,32 @@ __tzfile_read (const char *file)
for (i = 0; i < num_types; ++i)
{
unsigned char x[4];
- if (fread (x, 1, 4, f) != 4 ||
- fread (&types[i].isdst, 1, 1, f) != 1 ||
- fread (&types[i].idx, 1, 1, f) != 1)
+ if (fread_unlocked (x, 1, 4, f) != 4
+ || fread_unlocked (&types[i].isdst, 1, 1, f) != 1
+ || fread_unlocked (&types[i].idx, 1, 1, f) != 1)
goto lose;
if (types[i].idx >= chars) /* Bogus index in data file. */
goto lose;
types[i].offset = (long int) decode (x);
}
- if (fread (zone_names, 1, chars, f) != chars)
+ if (fread_unlocked (zone_names, 1, chars, f) != chars)
goto lose;
for (i = 0; i < num_leaps; ++i)
{
unsigned char x[4];
- if (fread (x, 1, sizeof (x), f) != sizeof (x))
+ if (fread_unlocked (x, 1, sizeof (x), f) != sizeof (x))
goto lose;
leaps[i].transition = (time_t) decode (x);
- if (fread (x, 1, sizeof (x), f) != sizeof (x))
+ if (fread_unlocked (x, 1, sizeof (x), f) != sizeof (x))
goto lose;
leaps[i].change = (long int) decode (x);
}
for (i = 0; i < num_isstd; ++i)
{
- int c = getc (f);
+ int c = getc_unlocked (f);
if (c == EOF)
goto lose;
types[i].isstd = c != 0;
@@ -257,7 +260,7 @@ __tzfile_read (const char *file)
for (i = 0; i < num_isgmt; ++i)
{
- int c = getc (f);
+ int c = getc_unlocked (f);
if (c == EOF)
goto lose;
types[i].isgmt = c != 0;
@@ -271,8 +274,7 @@ __tzfile_read (const char *file)
We choose the offsets in the types of each flavor that are
transitioned to earliest in time. */
__tzname[1] = NULL;
- for (i = 0; i < num_types && i < sizeof (__tzname) / sizeof (__tzname[0]);
- ++i)
+ for (i = 0; i < num_types; ++i)
__tzname[types[i].isdst] = __tzstring (&zone_names[types[i].idx]);
if (__tzname[1] == NULL)
__tzname[1] = __tzname[0];
@@ -296,8 +298,8 @@ __tzfile_read (const char *file)
__use_tzfile = 1;
return;
- lose:;
- fclose(f);
+ lose:
+ fclose (f);
}
/* The user specified a hand-made timezone, but not its DST rules.
@@ -425,10 +427,8 @@ __tzfile_compute (time_t timer, int use_localtime,
__daylight = rule_stdoff != rule_dstoff;
__timezone = -rule_stdoff;
__tzname[1] = NULL;
- for (i = 0;
- i < num_types && i < sizeof (__tzname) / sizeof (__tzname[0]);
- ++i)
- __tzname[types[i].isdst] = &zone_names[types[i].idx];
+ for (i = 0; i < num_types; ++i)
+ __tzname[types[i].isdst] = __tzstring (&zone_names[types[i].idx]);
if (__tzname[1] == NULL)
/* There is no daylight saving time. */
__tzname[1] = __tzname[0];
@@ -455,9 +455,9 @@ __tzfile_compute (time_t timer, int use_localtime,
leaps[i].change > leaps[i - 1].change))
{
*leap_hit = 1;
- while (i > 0 &&
- leaps[i].transition == leaps[i - 1].transition + 1 &&
- leaps[i].change == leaps[i - 1].change + 1)
+ while (i > 0
+ && leaps[i].transition == leaps[i - 1].transition + 1
+ && leaps[i].change == leaps[i - 1].change + 1)
{
++*leap_hit;
--i;
@@ -483,5 +483,6 @@ compute_tzname_max (size_t chars)
++p;
if ((size_t) (p - start) > __tzname_cur_max)
__tzname_cur_max = p - start;
- } while (++p < &zone_names[chars]);
+ }
+ while (++p < &zone_names[chars]);
}
diff --git a/time/tzset.c b/time/tzset.c
index 4b8fa41021..9c8e5d7b9c 100644
--- a/time/tzset.c
+++ b/time/tzset.c
@@ -115,7 +115,7 @@ char *
__tzstring (string)
const char *string;
{
- struct tzstring_head *h = &tzstring_list.head;
+ struct tzstring_head *h;
size_t needed;
char *p;
@@ -139,7 +139,8 @@ __tzstring (string)
size_t buffer_size = tzstring_last_buffer_size;
while ((buffer_size *= 2) < needed)
continue;
- if (! (h = h->next = malloc (sizeof *h + buffer_size)))
+ h = malloc (sizeof *h + buffer_size);
+ if (h == NULL)
return NULL;
h->next = NULL;
tzstring_last_buffer_size = buffer_size;
diff --git a/timezone/tst-timezone.c b/timezone/tst-timezone.c
index 49b3621128..d05632d272 100644
--- a/timezone/tst-timezone.c
+++ b/timezone/tst-timezone.c
@@ -20,6 +20,7 @@
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <unistd.h>
int failed = 0;
@@ -29,14 +30,16 @@ struct test_times
const char *name;
int daylight;
int timezone;
+ const char *tzname[2];
};
static const struct test_times tests[] =
{
- { "Europe/Berlin", 1, -3600 },
- { "Universal", 0, 0 },
- { "Australia/Melbourne", 1, -36000 },
- { "America/Sao_Paulo", 1, 10800 },
+ { "Europe/Berlin", 1, -3600, { "CET", "CEST" }},
+ { "Universal", 0, 0, {"UTC", "UTC" }},
+ { "Australia/Melbourne", 1, -36000, { "EST", "EST" }},
+ { "America/Sao_Paulo", 1, 10800, {"EST", "EDT" }},
+ { "America/Los_Angeles", 1, 28800, {"PST", "PDT" }},
{ NULL, 0, 0 }
};
@@ -52,8 +55,10 @@ print_tzvars (void)
void
-check_tzvars (const char *name, int dayl, int timez)
+check_tzvars (const char *name, int dayl, int timez, const char *const tznam[])
{
+ int i;
+
if (daylight != dayl)
{
printf ("Timezone: %s, daylight is: %d but should be: %d\n",
@@ -66,6 +71,13 @@ check_tzvars (const char *name, int dayl, int timez)
name, timezone, timez);
++failed;
}
+ for (i = 0; i <= 1; ++i)
+ if (strcmp (tzname[i], tznam[i]) != 0)
+ {
+ printf ("Timezone: %s, tzname[%d] is: %s but should be: %s\n",
+ name, i, tzname[i], tznam[i]);
+ ++failed;
+ }
}
@@ -92,12 +104,12 @@ main (int argc, char ** argv)
}
tzset ();
print_tzvars ();
- check_tzvars (pt->name, pt->daylight, pt->timezone);
+ check_tzvars (pt->name, pt->daylight, pt->timezone, pt->tzname);
/* calling localtime shouldn't make a difference */
localtime (&t);
print_tzvars ();
- check_tzvars (pt->name, pt->daylight, pt->timezone);
+ check_tzvars (pt->name, pt->daylight, pt->timezone, pt->tzname);
}
return failed ? EXIT_FAILURE : EXIT_SUCCESS;
diff --git a/wctype/Versions b/wctype/Versions
index 3c24c22570..9b4fc57b1b 100644
--- a/wctype/Versions
+++ b/wctype/Versions
@@ -14,6 +14,9 @@ libc {
wctrans; wctype; wcwidth;
}
GLIBC_2.1 {
+ # functions used in inline functions or macros
+ __towctrans;
+
# i*
iswblank;
}