* nscd/nscd_stat.c (receive_print_stats): Replace YESSTR/NOSTR
authorUlrich Drepper <drepper@redhat.com>
Sun, 26 Jun 2005 18:28:35 +0000 (18:28 +0000)
committerUlrich Drepper <drepper@redhat.com>
Sun, 26 Jun 2005 18:28:35 +0000 (18:28 +0000)
with own translation.

* sunrpc/xdr.c (xdr_hyper, xdr_u_hyper): When decoding, cast
t2 to uint32_t instead of ulong.
* sunrpc/Makefile (tests): Add tst-xdrmem.
* sunrpc/tst-xdrmem.c: New test.

ChangeLog
nptl/ChangeLog
nscd/nscd_stat.c
sunrpc/Makefile
sunrpc/tst-xdrmem.c [new file with mode: 0644]
sunrpc/xdr.c

index 09aeab3..53f96d7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
+2005-06-23  Thorsten Kukuk  <kukuk@suse.de>
+
+       * nscd/nscd_stat.c (receive_print_stats): Replace YESSTR/NOSTR
+       with own translation.
+
 2005-06-25  Jakub Jelinek  <jakub@redhat.com>
 
+       * sunrpc/xdr.c (xdr_hyper, xdr_u_hyper): When decoding, cast
+       t2 to uint32_t instead of ulong.
+       * sunrpc/Makefile (tests): Add tst-xdrmem.
+       * sunrpc/tst-xdrmem.c: New test.
+
        * Versions.def (ld): Add GLIBC_2.4.
        * configure.in: Add --enable-stackguard-randomization option.
        (ENABLE_STACKGUARD_RANDOMIZE): New define.
index 7a305bf..e578b24 100644 (file)
@@ -1,3 +1,25 @@
+2005-06-25  Jakub Jelinek  <jakub@redhat.com>
+
+       * sysdeps/i386/tls.h (tcbhead_t): Add stack_guard field.
+       (THREAD_SET_STACK_GUARD, THREAD_COPY_STACK_GUARD): Define.
+       * sysdeps/x86_64/tls.h (tcbhead_t): Add sysinfo and stack_guard
+       fields.
+       (THREAD_SET_STACK_GUARD, THREAD_COPY_STACK_GUARD): Define.
+       * sysdeps/s390/tls.h (tcbhead_t): Add stack_guard
+       field.  Put in sysinfo field unconditionally.
+       (THREAD_SET_STACK_GUARD, THREAD_COPY_STACK_GUARD): Define.
+       * sysdeps/powerpc/tls.h (tcbhead_t): Add stack_guard field.
+       (THREAD_SET_STACK_GUARD, THREAD_COPY_STACK_GUARD): Define.
+       * sysdeps/sparc/tls.h (tcbhead_t): Add sysinfo and stack_guard
+       fields.
+       (THREAD_SET_STACK_GUARD, THREAD_COPY_STACK_GUARD): Define.
+       * pthread_create.c (__pthread_create_2_1): Use
+       THREAD_COPY_STACK_GUARD macro.
+       * Makefile: Add rules to build and run tst-stackguard1{,-static}
+       tests.
+       * tst-stackguard1.c: New file.
+       * tst-stackguard1-static.c: New file.
+
 2005-06-14  Alan Modra  <amodra@bigpond.net.au>
 
        * sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h (PSEUDO):
index 9231642..8bf50f3 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 1998, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (c) 1998, 2003, 2004, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1998.
 
@@ -143,8 +143,8 @@ receive_print_stats (void)
   int fd;
   int i;
   uid_t uid = getuid ();
-  const char *yesstr = nl_langinfo (YESSTR);
-  const char *nostr = nl_langinfo (NOSTR);
+  const char *yesstr = _("yes");
+  const char *nostr = _("no");
 
   /* Find out whether there is another user but root allowed to
      request statistics.  */
index 4a2c60e..bc826af 100644 (file)
@@ -85,6 +85,7 @@ all: # Make this the default target; it will be defined in Rules.
 
 include ../Makeconfig
 
+tests = tst-xdrmem
 xtests := tst-getmyaddr
 
 ifeq ($(have-thread-library),yes)
diff --git a/sunrpc/tst-xdrmem.c b/sunrpc/tst-xdrmem.c
new file mode 100644 (file)
index 0000000..0c9929c
--- /dev/null
@@ -0,0 +1,205 @@
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@redhat.com>, 2005.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <limits.h>
+#include <stdio.h>
+#include <string.h>
+#include <rpc/rpc.h>
+
+static int
+do_test (void)
+{
+  XDR xdrs;
+  unsigned char buf[8192];
+  int v_int;
+  u_int v_u_int;
+  long v_long;
+  u_long v_u_long;
+  quad_t v_hyper;
+  u_quad_t v_u_hyper;
+  quad_t v_longlong_t;
+  u_quad_t v_u_longlong_t;
+  short v_short;
+  u_short v_u_short;
+  char v_char;
+  u_char v_u_char;
+  bool_t v_bool;
+  enum_t v_enum;
+  char *v_wrapstring;
+
+  xdrmem_create (&xdrs, (char *) buf, sizeof (buf), XDR_ENCODE);
+
+#define TESTS \
+  T(int, 0)                            \
+  T(int, CHAR_MAX)                     \
+  T(int, CHAR_MIN)                     \
+  T(int, SHRT_MAX)                     \
+  T(int, SHRT_MIN)                     \
+  T(int, INT_MAX)                      \
+  T(int, INT_MIN)                      \
+  T(int, 0x123)                                \
+  T(u_int, 0)                          \
+  T(u_int, UCHAR_MAX)                  \
+  T(u_int, USHRT_MAX)                  \
+  T(u_int, UINT_MAX)                   \
+  T(u_int, 0xdeadbeef)                 \
+  T(u_int, 0x12345678)                 \
+  T(long, 0)                           \
+  T(long, 2147483647L)                 \
+  T(long, -2147483648L)                        \
+  T(long, -305419896L)                 \
+  T(long, -305419896L)                 \
+  T(u_long, 0)                         \
+  T(u_long, 0xffffffffUL)              \
+  T(u_long, 0xdeadbeefUL)              \
+  T(u_long, 0x12345678UL)              \
+  T(hyper, 0)                          \
+  T(hyper, CHAR_MAX)                   \
+  T(hyper, CHAR_MIN)                   \
+  T(hyper, SHRT_MAX)                   \
+  T(hyper, SHRT_MIN)                   \
+  T(hyper, INT_MAX)                    \
+  T(hyper, INT_MIN)                    \
+  T(hyper, LONG_MAX)                   \
+  T(hyper, LONG_MIN)                   \
+  T(hyper, LONG_LONG_MAX)              \
+  T(hyper, LONG_LONG_MIN)              \
+  T(hyper, 0x12312345678LL)            \
+  T(hyper, 0x12387654321LL)            \
+  T(u_hyper, 0)                                \
+  T(u_hyper, UCHAR_MAX)                        \
+  T(u_hyper, USHRT_MAX)                        \
+  T(u_hyper, UINT_MAX)                 \
+  T(u_hyper, ULONG_MAX)                        \
+  T(u_hyper, ULONG_LONG_MAX)           \
+  T(u_hyper, 0xdeadbeefdeadbeefULL)    \
+  T(u_hyper, 0x12312345678ULL)         \
+  T(u_hyper, 0x12387654321ULL)         \
+  T(longlong_t, 0)                     \
+  T(longlong_t, CHAR_MAX)              \
+  T(longlong_t, CHAR_MIN)              \
+  T(longlong_t, SHRT_MAX)              \
+  T(longlong_t, SHRT_MIN)              \
+  T(longlong_t, INT_MAX)               \
+  T(longlong_t, INT_MIN)               \
+  T(longlong_t, LONG_MAX)              \
+  T(longlong_t, LONG_MIN)              \
+  T(longlong_t, LONG_LONG_MAX)         \
+  T(longlong_t, LONG_LONG_MIN)         \
+  T(longlong_t, 0x12312345678LL)       \
+  T(longlong_t, 0x12387654321LL)       \
+  T(u_longlong_t, 0)                   \
+  T(u_longlong_t, UCHAR_MAX)           \
+  T(u_longlong_t, USHRT_MAX)           \
+  T(u_longlong_t, UINT_MAX)            \
+  T(u_longlong_t, ULONG_MAX)           \
+  T(u_longlong_t, ULONG_LONG_MAX)      \
+  T(u_longlong_t, 0xdeadbeefdeadbeefULL)\
+  T(u_longlong_t, 0x12312345678ULL)    \
+  T(u_longlong_t, 0x12387654321ULL)    \
+  T(short, CHAR_MAX)                   \
+  T(short, CHAR_MIN)                   \
+  T(short, SHRT_MAX)                   \
+  T(short, SHRT_MIN)                   \
+  T(short, 0x123)                      \
+  T(u_short, 0)                                \
+  T(u_short, UCHAR_MAX)                        \
+  T(u_short, USHRT_MAX)                        \
+  T(u_short, 0xbeef)                   \
+  T(u_short, 0x5678)                   \
+  T(char, CHAR_MAX)                    \
+  T(char, CHAR_MIN)                    \
+  T(char, 0x23)                                \
+  T(u_char, 0)                         \
+  T(u_char, UCHAR_MAX)                 \
+  T(u_char, 0xef)                      \
+  T(u_char, 0x78)                      \
+  T(bool, 0)                           \
+  T(bool, 1)                           \
+  T(enum, 0)                           \
+  T(enum, CHAR_MAX)                    \
+  T(enum, CHAR_MIN)                    \
+  T(enum, SHRT_MAX)                    \
+  T(enum, SHRT_MIN)                    \
+  T(enum, INT_MAX)                     \
+  T(enum, INT_MIN)                     \
+  T(enum, 0x123)                       \
+  S(wrapstring, (char *) "")           \
+  S(wrapstring, (char *) "hello, world")
+
+#define T(type, val) \
+  v_##type = val;                      \
+  if (! xdr_##type (&xdrs, &v_##type)) \
+    {                                  \
+      puts ("encoding of " #type       \
+           " " #val " failed");        \
+      return 1;                                \
+    }
+#define S(type, val) T(type, val)
+
+  TESTS
+#undef T
+#undef S
+
+  xdr_destroy (&xdrs);
+
+  xdrmem_create (&xdrs, (char *) buf, sizeof (buf), XDR_DECODE);
+
+#define T(type, val) \
+  v_##type = 0x15;                     \
+  if (! xdr_##type (&xdrs, &v_##type)) \
+    {                                  \
+      puts ("decoding of " #type       \
+           " " #val " failed");        \
+      return 1;                                \
+    }                                  \
+  if (v_##type != val)                 \
+    {                                  \
+      puts ("decoded value differs, "  \
+           "type " #type " " #val);    \
+      return 1;                                \
+    }
+#define S(type, val) \
+  v_##type = NULL;                     \
+  if (! xdr_##type (&xdrs, &v_##type)) \
+    {                                  \
+      puts ("decoding of " #type       \
+           " " #val " failed");        \
+      return 1;                                \
+    }                                  \
+  if (strcmp (v_##type, val))          \
+    {                                  \
+      puts ("decoded value differs, "  \
+           "type " #type " " #val);    \
+      return 1;                                \
+    }                                  \
+  free (v_##type);                     \
+  v_##type = NULL;
+
+  TESTS
+#undef T
+#undef S
+
+  xdr_destroy (&xdrs);
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
index 411cbe1..1f25e3e 100644 (file)
@@ -239,7 +239,7 @@ xdr_hyper (XDR *xdrs, quad_t *llp)
       if (!XDR_GETLONG(xdrs, &t1) || !XDR_GETLONG(xdrs, &t2))
        return FALSE;
       *llp = ((quad_t) t1) << 32;
-      *llp |= (unsigned long int) t2;
+      *llp |= (uint32_t) t2;
       return TRUE;
     }
 
@@ -272,7 +272,7 @@ xdr_u_hyper (XDR *xdrs, u_quad_t *ullp)
       if (!XDR_GETLONG(xdrs, &t1) || !XDR_GETLONG(xdrs, &t2))
        return FALSE;
       *ullp = ((u_quad_t) t1) << 32;
-      *ullp |= (unsigned long int) t2;
+      *ullp |= (uint32_t) t2;
       return TRUE;
     }