summary refs log tree commit diff
path: root/string
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-03-22 19:54:06 +0000
committerUlrich Drepper <drepper@redhat.com>2004-03-22 19:54:06 +0000
commit61645263d4b3c72c9a33659a0fcabe1dd2814a98 (patch)
tree365a2e35feaf968b8d701d88bf477453fa47a35e /string
parent9708780004abee24d2c49fffe670820e36029377 (diff)
downloadglibc-61645263d4b3c72c9a33659a0fcabe1dd2814a98.tar.gz
glibc-61645263d4b3c72c9a33659a0fcabe1dd2814a98.tar.xz
glibc-61645263d4b3c72c9a33659a0fcabe1dd2814a98.zip
Update.
2004-03-22  Jakub Jelinek  <jakub@redhat.com>

	* sysdeps/unix/sysv/linux/sparc/sparc32/getpagesize.c
	(__getpagesize): Avoid warning about writing into read-only memory.

	* string/Makefile (routines): Add xpg-strerror.
	* string/string.h (strerror_r): If __USE_XOPEN2K but not __USE_GNU,
	redirect strerror_r to __xpg_strerror_r.
	* string/Versions (libc): Add __xpg_strerror_r@@GLIBC_2.3.4.
	* sysdeps/generic/xpg-strerror.c: New file.
	* sysdeps/mach/xpg-strerror.c: New file.
Diffstat (limited to 'string')
-rw-r--r--string/Makefile3
-rw-r--r--string/Versions4
-rw-r--r--string/string.h25
3 files changed, 29 insertions, 3 deletions
diff --git a/string/Makefile b/string/Makefile
index ad5ff79d4c..5ab487f5ba 100644
--- a/string/Makefile
+++ b/string/Makefile
@@ -39,7 +39,8 @@ routines	:= strcat strchr strcmp strcoll strcpy strcspn		\
 			             delete extract insert stringify	\
 				     addsep replace)			\
 		   envz basename					\
-		   strcoll_l strxfrm_l string-inlines memrchr
+		   strcoll_l strxfrm_l string-inlines memrchr		\
+		   xpg-strerror
 
 # Gcc internally generates calls to unbounded memcpy and memset
 # for -fbounded-pointer compiles.  Glibc uses memchr for explicit checks.
diff --git a/string/Versions b/string/Versions
index 2708091a4d..ee5dee903f 100644
--- a/string/Versions
+++ b/string/Versions
@@ -73,4 +73,8 @@ libc {
     # m*
     memrchr;
   }
+  GLIBC_2.3.4 {
+    # x*
+    __xpg_strerror_r;
+  }
 }
diff --git a/string/string.h b/string/string.h
index 108d54da4e..19dd9c3188 100644
--- a/string/string.h
+++ b/string/string.h
@@ -243,9 +243,30 @@ __BEGIN_NAMESPACE_STD
 extern char *strerror (int __errnum) __THROW;
 __END_NAMESPACE_STD
 #if defined __USE_XOPEN2K || defined __USE_MISC
-/* Reentrant version of `strerror'.  If a temporary buffer is required, at
-   most BUFLEN bytes of BUF will be used.  */
+/* Reentrant version of `strerror'.
+   There are 2 flavors of `strerror_r', GNU which returns the string
+   and may or may not use the supplied temporary buffer and POSIX one
+   which fills the string into the buffer.
+   To use the POSIX version, -D_XOPEN_SOURCE=600 or -D_POSIX_C_SOURCE=200112L
+   without -D_GNU_SOURCE is needed, otherwise the GNU version is
+   preferred.  */
+# if defined __USE_XOPEN2K && !defined __USE_GNU
+/* Fill BUF with a string describing the meaning of the `errno' code in
+   ERRNUM.  */
+#  ifdef __REDIRECT
+extern int __REDIRECT (strerror_r,
+		       (int __errnum, char *__buf, size_t __buflen),
+		       __xpg_strerror_r) __THROW;
+#  else
+extern int __xpg_strerror_r (int __errnum, char *__buf, size_t __buflen)
+     __THROW;
+#   define strerror_r __xpg_strerror_r
+#  endif
+# else
+/* If a temporary buffer is required, at most BUFLEN bytes of BUF will be
+   used.  */
 extern char *strerror_r (int __errnum, char *__buf, size_t __buflen) __THROW;
+# endif
 #endif
 
 /* We define this function always since `bzero' is sometimes needed when