summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillem Jover <guillem@hadrons.org>2017-09-02 19:55:50 +0200
committerGuillem Jover <guillem@hadrons.org>2017-12-03 16:43:28 +0100
commit22fbd62368c39de8ac5e249d1502d5ac0ffdef30 (patch)
treecfa0f157885b0451cf58997769a3a6961427572a
parentb4f7c065ba6d6649c33f8876445ed30b971fe09e (diff)
Handle several functions now being provided by glibc
We mention that these are now superseded by the glibc implementations, make the headers cope with already declared functions on glibc-based systems, and document this in the man pages.
-rw-r--r--include/bsd/stdlib.h2
-rw-r--r--include/bsd/string.h2
-rw-r--r--man/explicit_bzero.3bsd3
-rw-r--r--man/libbsd.733
-rw-r--r--man/reallocarray.3bsd3
5 files changed, 36 insertions, 7 deletions
diff --git a/include/bsd/stdlib.h b/include/bsd/stdlib.h
index 46a009e..ebc9638 100644
--- a/include/bsd/stdlib.h
+++ b/include/bsd/stdlib.h
@@ -67,7 +67,9 @@ int sradixsort(const unsigned char **base, int nmemb,
const unsigned char *table, unsigned endbyte);
void *reallocf(void *ptr, size_t size);
+#if defined(_GNU_SOURCE) && defined(__GLIBC__) && !__GLIBC_PREREQ(2, 26)
void *reallocarray(void *ptr, size_t nmemb, size_t size);
+#endif
long long strtonum(const char *nptr, long long minval, long long maxval,
const char **errstr);
diff --git a/include/bsd/string.h b/include/bsd/string.h
index ee2f953..6798bf6 100644
--- a/include/bsd/string.h
+++ b/include/bsd/string.h
@@ -42,7 +42,9 @@ size_t strlcat(char *dst, const char *src, size_t siz);
char *strnstr(const char *str, const char *find, size_t str_len);
void strmode(mode_t mode, char *str);
+#if defined(_GNU_SOURCE) && defined(__GLIBC__) && !__GLIBC_PREREQ(2, 25)
void explicit_bzero(void *buf, size_t len);
+#endif
__END_DECLS
#endif
diff --git a/man/explicit_bzero.3bsd b/man/explicit_bzero.3bsd
index b40929e..cf67c56 100644
--- a/man/explicit_bzero.3bsd
+++ b/man/explicit_bzero.3bsd
@@ -72,4 +72,5 @@ pass, making it useful for clearing sensitive memory such as a password.
The
.Fn explicit_bzero
function first appeared in
-.Ox 5.5 .
+.Ox 5.5 ,
+glibc 2.25.
diff --git a/man/libbsd.7 b/man/libbsd.7
index 19af0aa..ea2d281 100644
--- a/man/libbsd.7
+++ b/man/libbsd.7
@@ -150,13 +150,36 @@ function can be used.
Otherwise the code needs to be prepared for neither of these functions being
available.
.El
+.Sh SUPERSEDED
+Some functions have been superseded by implementations in other system
+libraries, and might disappear on the next SONAME bump, assuming those
+other implementation have widespread deployment, or the implementations
+are present in all major
+.Nm libc
+for example.
.Pp
-In addition, the MD5 set of digest funtions are now provided by the
+.Bl -tag -width 4m -compact
+.It Fn MD5Init
+.It Fn MD5Update
+.It Fn MD5Pad
+.It Fn MD5Final
+.It Fn MD5Transform
+.It Fn MD5End
+.It Fn MD5File
+.It Fn MD5FileChunk
+.It Fn MD5Data
+The set of MD5 digest functions are now provided by the
.Nm libmd
-companion library, so it is advised to use that instead, as the ones
-provided in
-.Nm libbsd
-might disappear on the next SONAME bump.
+companion library, so it is advised to use that instead.
+.It Fn explicit_bzero
+This function is provided by
+.Nm glibc
+2.25.
+.It Fn reallocarray
+This function is provided by
+.Nm glibc
+2.26.
+.El
.Sh SEE ALSO
.Xr arc4random 3bsd ,
.Xr bitstring 3bsd ,
diff --git a/man/reallocarray.3bsd b/man/reallocarray.3bsd
index b1aff9c..96563ea 100644
--- a/man/reallocarray.3bsd
+++ b/man/reallocarray.3bsd
@@ -102,4 +102,5 @@ is set to
.Sh HISTORY
.Fn reallocarray
appeared in
-.Ox 5.6 .
+.Ox 5.6 ,
+glibc 2.26.