summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-03-03 17:58:38 +0000
committerUlrich Drepper <drepper@redhat.com>1998-03-03 17:58:38 +0000
commit8fb3e0079a0512e8525f6c5897c51563d57801e7 (patch)
treea6f26d8cbf90b7ee76dc3c0b7fc20f8664f9a513
parentae828bc6f9a3ff47cb92846f71a9a7f8c6d5c941 (diff)
downloadglibc-8fb3e0079a0512e8525f6c5897c51563d57801e7.tar.gz
glibc-8fb3e0079a0512e8525f6c5897c51563d57801e7.tar.xz
glibc-8fb3e0079a0512e8525f6c5897c51563d57801e7.zip
Update.
1998-03-03 17:55  Ulrich Drepper  <drepper@cygnus.com>

	* elf/sprof.c: Cleanup a bit.

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

	* sysdeps/generic/sysdep.h (L): New. Define.

	* sysdeps/unix/sysv/linux/i386/sysdep.h (L): New. Define.

	* sysdeps/i386/i586/addmul_1.S: Fix a typo.

	* sysdeps/unix/sysv/linux/i386/clone.S: Follow Intel's advice
	to have only one exit point for functions.
	* sysdeps/unix/sysv/linux/i386/mmap.S: Likewise.
	* sysdeps/unix/sysv/linux/i386/s_pread64.S: Likewise.
	* sysdeps/unix/sysv/linux/i386/s_pwrite64.S: Likewise.
	* sysdeps/unix/sysv/linux/i386/socket.S: Likewise.
	* sysdeps/unix/sysv/linux/i386/syscall.S: Likewise.

1998-03-03  Andreas Jaeger  <aj@arthur.rhein-neckar.de>

	* sysdeps/unix/sysv/linux/sigaction.c (__sigaction): Safe and
	reset errno so that errno isn't set to ENOSYS in the first call.
	* sysdeps/unix/sysv/linux/i386/sigaction.c (__sigaction): Likewise.
	* sysdeps/unix/sysv/linux/sigsuspend.c (__sigsuspend): Likewise.
	* sysdeps/unix/sysv/linux/sigprocmask.c (__sigprocmask): Likewise.
	* sysdeps/unix/sysv/linux/sigpending.c (sigpending): Likewise.
-rw-r--r--BUGS4
-rw-r--r--ChangeLog29
-rw-r--r--db2/README2
-rw-r--r--elf/sprof.c107
-rw-r--r--sysdeps/generic/sysdep.h7
-rw-r--r--sysdeps/i386/i586/addmul_1.S2
-rw-r--r--sysdeps/unix/sysv/linux/i386/clone.S3
-rw-r--r--sysdeps/unix/sysv/linux/i386/mmap.S3
-rw-r--r--sysdeps/unix/sysv/linux/i386/s_pread64.S5
-rw-r--r--sysdeps/unix/sysv/linux/i386/s_pwrite64.S5
-rw-r--r--sysdeps/unix/sysv/linux/i386/sigaction.c2
-rw-r--r--sysdeps/unix/sysv/linux/i386/socket.S3
-rw-r--r--sysdeps/unix/sysv/linux/i386/syscall.S3
-rw-r--r--sysdeps/unix/sysv/linux/i386/sysdep.h3
-rw-r--r--sysdeps/unix/sysv/linux/sigaction.c2
-rw-r--r--sysdeps/unix/sysv/linux/sigpending.c2
-rw-r--r--sysdeps/unix/sysv/linux/sigprocmask.c2
-rw-r--r--sysdeps/unix/sysv/linux/sigsuspend.c2
18 files changed, 120 insertions, 66 deletions
diff --git a/BUGS b/BUGS
index 546fab20a8..ccb60773da 100644
--- a/BUGS
+++ b/BUGS
@@ -1,7 +1,7 @@
 	    List of known bugs (certainly very incomplete)
 	    ----------------------------------------------
 
-Time-stamp: <1998-02-27T13:05:49-0800 drepper>
+Time-stamp: <1998-03-03T15:29:53-0800 drepper>
 
 This following list contains those bugs which I'm aware of.  Please
 make sure that bugs you report are not listed here.  If you can fix one
@@ -52,7 +52,7 @@ Severity: [  *] to [***]
        directive, with localedef, not only the copied category is
        checked for errors, but the whole file containing the same
        category.
-       [PR libc/207]
+       [PR libc/207 and PR libc/454]
 
 [  *]  The libm-ieee `gamma' function gives wrong results (at least for
        -0.5).
diff --git a/ChangeLog b/ChangeLog
index 0e93f1489b..b7ef62a97b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,32 @@
+1998-03-03 17:55  Ulrich Drepper  <drepper@cygnus.com>
+
+	* elf/sprof.c: Cleanup a bit.
+
+1998-03-03 08:01  H.J. Lu  <hjl@gnu.org>
+
+	* sysdeps/generic/sysdep.h (L): New. Define.
+
+	* sysdeps/unix/sysv/linux/i386/sysdep.h (L): New. Define.
+
+	* sysdeps/i386/i586/addmul_1.S: Fix a typo.
+
+	* sysdeps/unix/sysv/linux/i386/clone.S: Follow Intel's advice
+	to have only one exit point for functions.
+	* sysdeps/unix/sysv/linux/i386/mmap.S: Likewise.
+	* sysdeps/unix/sysv/linux/i386/s_pread64.S: Likewise.
+	* sysdeps/unix/sysv/linux/i386/s_pwrite64.S: Likewise.
+	* sysdeps/unix/sysv/linux/i386/socket.S: Likewise.
+	* sysdeps/unix/sysv/linux/i386/syscall.S: Likewise.
+
+1998-03-03  Andreas Jaeger  <aj@arthur.rhein-neckar.de>
+
+	* sysdeps/unix/sysv/linux/sigaction.c (__sigaction): Safe and
+	reset errno so that errno isn't set to ENOSYS in the first call.
+	* sysdeps/unix/sysv/linux/i386/sigaction.c (__sigaction): Likewise.
+	* sysdeps/unix/sysv/linux/sigsuspend.c (__sigsuspend): Likewise.
+	* sysdeps/unix/sysv/linux/sigprocmask.c (__sigprocmask): Likewise.
+	* sysdeps/unix/sysv/linux/sigpending.c (sigpending): Likewise.
+
 1998-03-02 17:55  Ulrich Drepper  <drepper@cygnus.com>
 
 	* sysdeps/i386/add_n.S: Change to use ENTRY and END macro.
diff --git a/db2/README b/db2/README
index 0793d740be..cf527ab5ac 100644
--- a/db2/README
+++ b/db2/README
@@ -2,7 +2,7 @@ As a special exception, when Berkeley DB is distributed along with the
 GNU C Library, in any program which uses the GNU C Library in accord
 with that library's distribution terms, it is also permitted for
 Berkeley DB to be loaded dynamically by the GNU C Library to implement
-standard ISO/IEC 9945 (POSIX 1003) and Unix interface functionality.
+standard ISO/IEC 9945 and Unix interface functionality.
 
 Sleepycat Software, Inc.
 
diff --git a/elf/sprof.c b/elf/sprof.c
index 0d50806126..7049012877 100644
--- a/elf/sprof.c
+++ b/elf/sprof.c
@@ -144,6 +144,8 @@ struct known_symbol
   const char *name;
   uintptr_t addr;
   size_t size;
+
+  uintmax_t ticks;
 };
 
 
@@ -192,8 +194,9 @@ struct profdata
 
 /* Search tree for symbols.  */
 void *symroot;
-static const struct known_symbol **sortsym;
+static struct known_symbol **sortsym;
 static size_t symidx;
+static uintmax_t total_ticks;
 
 /* Prototypes for local functions.  */
 static struct shobj *load_shobj (const char *name);
@@ -280,6 +283,14 @@ no filename for profiling data given and shared object `%s' has no soname"),
     {
     case COUNT_TOTAL:
       count_total_ticks (shobj_handle, profdata_handle);
+      {
+	size_t n;
+	for (n = 0; n < symidx; ++n)
+	  if (sortsym[n]->ticks != 0)
+	    printf ("Name: %-30s, Ticks: %" PRIdMAX "\n", sortsym[n]->name,
+		    sortsym[n]->ticks);
+	printf ("Total ticks: %" PRIdMAX "\n", total_ticks);
+      }
       break;
     case NONE:
       /* Do nothing.  */
@@ -443,32 +454,31 @@ load_shobj (const char *name)
 			      * sizeof (struct here_cg_arc_record)));
 
   if (do_test)
-    {
-#define SCALE_1_TO_1	0x10000L
+    printf ("expected size: %Zd\n", result->expected_size);
 
-      printf ("expected size: %Zd\n", result->expected_size);
+#define SCALE_1_TO_1	0x10000L
 
-      if (result->kcountsize < result->highpc - result->lowpc)
-	{
-	  size_t range = result->highpc - result->lowpc;
-	  size_t quot = range / result->kcountsize;
-
-	  if (quot >= SCALE_1_TO_1)
-	    result->s_scale = 1;
-	  else if (quot >= SCALE_1_TO_1 / 256)
-	    result->s_scale = SCALE_1_TO_1 / quot;
-	  else if (range > ULONG_MAX / 256)
-	    result->s_scale = ((SCALE_1_TO_1 * 256)
-			       / (range / (result->kcountsize / 256)));
-	  else
-	    result->s_scale = ((SCALE_1_TO_1 * 256)
-			       / ((range * 256) / result->kcountsize));
-	}
+  if (result->kcountsize < result->highpc - result->lowpc)
+    {
+      size_t range = result->highpc - result->lowpc;
+      size_t quot = range / result->kcountsize;
+
+      if (quot >= SCALE_1_TO_1)
+	result->s_scale = 1;
+      else if (quot >= SCALE_1_TO_1 / 256)
+	result->s_scale = SCALE_1_TO_1 / quot;
+      else if (range > ULONG_MAX / 256)
+	result->s_scale = ((SCALE_1_TO_1 * 256)
+			   / (range / (result->kcountsize / 256)));
       else
-	result->s_scale = SCALE_1_TO_1;
-
-      printf ("s_scale: %d\n", result->s_scale);
+	result->s_scale = ((SCALE_1_TO_1 * 256)
+			   / ((range * 256) / result->kcountsize));
     }
+  else
+    result->s_scale = SCALE_1_TO_1;
+
+  if (do_test)
+    printf ("s_scale: %d\n", result->s_scale);
 
   /* Determine the string table.  */
   if (map->l_info[DT_STRTAB] == NULL)
@@ -775,32 +785,28 @@ static void
 count_total_ticks (struct shobj *shobj, struct profdata *profdata)
 {
   volatile uint16_t *kcount = profdata->kcount;
-  uint64_t sum = 0;
-  size_t idx;
+  size_t maxkidx = shobj->kcountsize;
   size_t factor = 2 * (65536 / shobj->s_scale);
+  size_t kidx = 0;
+  size_t sidx = 0;
 
-  for (idx = shobj->kcountsize / sizeof (*kcount); idx > 0; )
+  while (sidx < symidx)
     {
-      --idx;
-      if (kcount[idx] != 0)
-	{
-	  size_t n;
-
-	  for (n = 0; n < symidx; ++n)
-	    if (sortsym[n]->addr <= factor * idx
-		&& sortsym[n]->addr + sortsym[n]->size > factor * idx)
-	      break;
-
-	  if (n < symidx)
-	    printf ("idx = %d, count = %d, name = %s\n", idx, kcount[idx],
-		    sortsym[n]->name);
-	  else
-	    printf ("idx = %d, N/A\n", idx);
-	}
-      sum += kcount[idx];
-    }
+      uintptr_t start = sortsym[sidx]->addr;
+      uintptr_t end = start + sortsym[sidx]->size;
+
+      while (kidx < maxkidx && factor * kidx < start)
+	++kidx;
+      if (kidx == maxkidx)
+	break;
 
-  printf ("total ticks: %10" PRId64 "\n", sum);
+      while (kidx < maxkidx && factor * kidx < end)
+	sortsym[sidx]->ticks += kcount[kidx++];
+      if (kidx == maxkidx)
+	break;
+
+      total_ticks += sortsym[sidx++]->ticks;
+    }
 }
 
 
@@ -818,14 +824,7 @@ static void
 printsym (const void *node, VISIT value, int level)
 {
   if (value == leaf || value == postorder)
-    {
-      const struct known_symbol *sym = *(const struct known_symbol **) node;
-
-      printf ("Name: %30s, Start: %6x, Len: %5d\n",
-	      sym->name, sym->addr, sym->size);
-
-      sortsym[symidx++] = sym;
-    }
+    sortsym[symidx++] = *(const struct known_symbol **) node;
 }
 
 
@@ -882,6 +881,7 @@ read_symbols (struct shobj *shobj)
 	    newsym->name = name0;
 	    newsym->addr = last_addr;
 	    newsym->size = *((uint32_t *) (shobj->stab + idx + VALOFF));
+	    newsym->ticks = 0;
 
 	    tsearch (newsym, &symroot, symorder);
 	    ++n;
@@ -920,6 +920,7 @@ read_symbols (struct shobj *shobj)
 	      newsym->name = &strtab[symtab->st_name];
 	      newsym->addr = symtab->st_value;
 	      newsym->size = symtab->st_size;
+	      newsym->ticks = 0;
 
 	      tsearch (newsym, &symroot, symorder);
 	      ++n;
diff --git a/sysdeps/generic/sysdep.h b/sysdeps/generic/sysdep.h
index 014cd1c745..2ba01f4240 100644
--- a/sysdeps/generic/sysdep.h
+++ b/sysdeps/generic/sysdep.h
@@ -1,5 +1,5 @@
 /* Generic asm macros used on many machines.
-   Copyright (C) 1991, 92, 93, 96 Free Software Foundation, Inc.
+   Copyright (C) 1991, 92, 93, 96, 98 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -41,3 +41,8 @@
 #ifndef END
 #define END(sym)
 #endif
+
+/* Local label name for asm code. */
+#ifndef L
+#define L(name)		name
+#endif
diff --git a/sysdeps/i386/i586/addmul_1.S b/sysdeps/i386/i586/addmul_1.S
index b97799f387..76bf25f817 100644
--- a/sysdeps/i386/i586/addmul_1.S
+++ b/sysdeps/i386/i586/addmul_1.S
@@ -35,7 +35,7 @@
 #define s2_limb ebp
 
 	.text
-ENRTY(__mpn_addmul_1)
+ENTRY(__mpn_addmul_1)
 
 	INSN1(push,l	,R(edi))
 	INSN1(push,l	,R(esi))
diff --git a/sysdeps/unix/sysv/linux/i386/clone.S b/sysdeps/unix/sysv/linux/i386/clone.S
index 0aec95e219..88d0e27549 100644
--- a/sysdeps/unix/sysv/linux/i386/clone.S
+++ b/sysdeps/unix/sysv/linux/i386/clone.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@tamu.edu)
 
@@ -59,6 +59,7 @@ ENTRY(__clone)
 	jl	syscall_error
 	jz	thread_start
 
+L(pseudo_end):
 	ret
 
 thread_start:
diff --git a/sysdeps/unix/sysv/linux/i386/mmap.S b/sysdeps/unix/sysv/linux/i386/mmap.S
index 30bbcdf80a..5c2449e961 100644
--- a/sysdeps/unix/sysv/linux/i386/mmap.S
+++ b/sysdeps/unix/sysv/linux/i386/mmap.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 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
@@ -40,6 +40,7 @@ ENTRY (__mmap)
 	ja syscall_error
 
 	/* Successful; return the syscall's value.  */
+L(pseudo_end):
 	ret
 
 PSEUDO_END (__mmap)
diff --git a/sysdeps/unix/sysv/linux/i386/s_pread64.S b/sysdeps/unix/sysv/linux/i386/s_pread64.S
index 9e14aa815f..7f8816b3ba 100644
--- a/sysdeps/unix/sysv/linux/i386/s_pread64.S
+++ b/sysdeps/unix/sysv/linux/i386/s_pread64.S
@@ -1,5 +1,5 @@
 /* pread64 syscall for Linux/ix86.
-   Copyright (C) 1997 Free Software Foundation, Inc.
+   Copyright (C) 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
@@ -48,7 +48,8 @@ ENTRY (__syscall_pread64)
 	POPARGS_5		/* Restore register contents.  */
 	cmpl	$-4095, %eax	/* Check %eax for error.  */
 	jae	syscall_error	/* Jump to error handler if error.  */
-	ret			/* Return to caller.  */
 #endif
+	ret			/* Return to caller.  */
+L(pseudo_end):
 
 PSEUDO_END (__syscall_pread64)
diff --git a/sysdeps/unix/sysv/linux/i386/s_pwrite64.S b/sysdeps/unix/sysv/linux/i386/s_pwrite64.S
index a21fe2f99f..7b72d12f0b 100644
--- a/sysdeps/unix/sysv/linux/i386/s_pwrite64.S
+++ b/sysdeps/unix/sysv/linux/i386/s_pwrite64.S
@@ -1,5 +1,5 @@
 /* pwrite64 syscall for Linux/ix86.
-   Copyright (C) 1997 Free Software Foundation, Inc.
+   Copyright (C) 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
@@ -48,7 +48,8 @@ ENTRY (__syscall_pwrite64)
 	POPARGS_5		/* Restore register contents.  */
 	cmpl	$-4095, %eax	/* Check %eax for error.  */
 	jae	syscall_error	/* Jump to error handler if error.  */
-	ret			/* Return to caller.  */
 #endif
+L(pseudo_end):
+	ret			/* Return to caller.  */
 
 PSEUDO_END (__syscall_pwrite64)
diff --git a/sysdeps/unix/sysv/linux/i386/sigaction.c b/sysdeps/unix/sysv/linux/i386/sigaction.c
index a6d2b63634..0110a80a8a 100644
--- a/sysdeps/unix/sysv/linux/i386/sigaction.c
+++ b/sysdeps/unix/sysv/linux/i386/sigaction.c
@@ -48,6 +48,7 @@ __sigaction (int sig, const struct sigaction *act, struct sigaction *oact)
   if (!__libc_missing_rt_sigs)
     {
       struct kernel_sigaction kact, koact;
+      int saved_errno = errno;
 
       if (act)
 	{
@@ -76,6 +77,7 @@ __sigaction (int sig, const struct sigaction *act, struct sigaction *oact)
 	  return result;
 	}
 
+      __set_errno (saved_errno);
       __libc_missing_rt_sigs = 1;
     }
 
diff --git a/sysdeps/unix/sysv/linux/i386/socket.S b/sysdeps/unix/sysv/linux/i386/socket.S
index f649470122..4326676bc2 100644
--- a/sysdeps/unix/sysv/linux/i386/socket.S
+++ b/sysdeps/unix/sysv/linux/i386/socket.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 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
@@ -58,6 +58,7 @@ ENTRY (__socket)
 	jae syscall_error
 
 	/* Successful; return the syscall's value.  */
+L(pseudo_end):
 	ret
 
 PSEUDO_END (__socket)
diff --git a/sysdeps/unix/sysv/linux/i386/syscall.S b/sysdeps/unix/sysv/linux/i386/syscall.S
index 6a020e0d0e..349408de30 100644
--- a/sysdeps/unix/sysv/linux/i386/syscall.S
+++ b/sysdeps/unix/sysv/linux/i386/syscall.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1996, 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
@@ -31,6 +31,7 @@ ENTRY (syscall)
 	POPARGS_5		/* Restore register contents.  */
 	cmpl $-4095, %eax	/* Check %eax for error.  */
 	jae syscall_error	/* Jump to error handler if error.  */
+L(pseudo_end):
 	ret			/* Return to caller.  */
 
 PSEUDO_END (syscall)
diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h b/sysdeps/unix/sysv/linux/i386/sysdep.h
index 7455e8d321..4ebcc6c852 100644
--- a/sysdeps/unix/sysv/linux/i386/sysdep.h
+++ b/sysdeps/unix/sysv/linux/i386/sysdep.h
@@ -30,6 +30,9 @@
 #undef SYS_ify
 #define SYS_ify(syscall_name)	__NR_##syscall_name
 
+/* ELF-like local names start with `.L'.  */
+#undef L
+#define L(name)	.L##name
 
 #ifdef ASSEMBLER
 
diff --git a/sysdeps/unix/sysv/linux/sigaction.c b/sysdeps/unix/sysv/linux/sigaction.c
index 49cb3b6a89..773bfa067f 100644
--- a/sysdeps/unix/sysv/linux/sigaction.c
+++ b/sysdeps/unix/sysv/linux/sigaction.c
@@ -50,6 +50,7 @@ __sigaction (sig, act, oact)
   if (!__libc_missing_rt_sigs)
     {
       struct kernel_sigaction kact, koact;
+      int saved_errno = errno;
 
       if (act)
 	{
@@ -80,6 +81,7 @@ __sigaction (sig, act, oact)
 	  return result;
 	}
 
+      __set_errno (saved_errno);
       __libc_missing_rt_sigs = 1;
     }
 
diff --git a/sysdeps/unix/sysv/linux/sigpending.c b/sysdeps/unix/sysv/linux/sigpending.c
index 4d5514a1bc..1776fdd65f 100644
--- a/sysdeps/unix/sysv/linux/sigpending.c
+++ b/sysdeps/unix/sysv/linux/sigpending.c
@@ -40,11 +40,13 @@ sigpending (set)
     {
       /* XXX The size argument hopefully will have to be changed to the
 	 real size of the user-level sigset_t.  */
+      int saved_errno = errno;
       int result = __syscall_rt_sigpending (set, _NSIG / 8);
 
       if (result >= 0 || errno != ENOSYS)
 	return result;
 
+      __set_errno (saved_errno);
       __libc_missing_rt_sigs = 1;
     }
 
diff --git a/sysdeps/unix/sysv/linux/sigprocmask.c b/sysdeps/unix/sysv/linux/sigprocmask.c
index 476f46a8e6..064179e2b8 100644
--- a/sysdeps/unix/sysv/linux/sigprocmask.c
+++ b/sysdeps/unix/sysv/linux/sigprocmask.c
@@ -41,11 +41,13 @@ __sigprocmask (how, set, oset)
     {
       /* XXX The size argument hopefully will have to be changed to the
 	 real size of the user-level sigset_t.  */
+      int saved_errno = errno;
       int result = __syscall_rt_sigprocmask (how, set, oset, _NSIG / 8);
 
       if (result >= 0 || errno != ENOSYS)
 	return result;
 
+      __set_errno (saved_errno);
       __libc_missing_rt_sigs = 1;
     }
 
diff --git a/sysdeps/unix/sysv/linux/sigsuspend.c b/sysdeps/unix/sysv/linux/sigsuspend.c
index 197015401d..a5d2eb0ad7 100644
--- a/sysdeps/unix/sysv/linux/sigsuspend.c
+++ b/sysdeps/unix/sysv/linux/sigsuspend.c
@@ -40,11 +40,13 @@ __sigsuspend (set)
     {
       /* XXX The size argument hopefully will have to be changed to the
 	 real size of the user-level sigset_t.  */
+      int saved_errno = errno;
       int result = __syscall_rt_sigsuspend (set, _NSIG / 8);
 
       if (result >= 0 || errno != ENOSYS)
 	return result;
 
+      __set_errno (saved_errno);
       __libc_missing_rt_sigs = 1;
     }