[PATCH v2] man/man3/mem*(): SYNOPSIS: Document non-standard mem*() functions as provided by <memory.h>

Alejandro Colomar <[email protected]> Sat, 1 Aug 2026 02:25:02 +0200
Newsgroups gmane.comp.lib.gnulib.bugs,gmane.linux.man,gmane.comp.lib.glibc.alpha
Message-ID <c5bad3a80de2feaf3838cb302eeaea1dcc4ba672.1785543779.git.alx@kernel.org>
--i64vkpko4v6wf3lj
Content-Type: text/plain; protected-headers=v1; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
From: Alejandro Colomar <[email protected]>
To: [email protected]
Cc: Alejandro Colomar <[email protected]>, Sam James <[email protected]>, 
	"G. Branden Robinson" <[email protected]>, Joseph Myers <[email protected]>, 
	Keith Bostic <[email protected]>, Mark Harris <[email protected]>, 
	Nevin Liber <[email protected]>, Collin Funk <[email protected]>, 
	JeanHeyd Meneide <[email protected]>, Christopher Bazley <[email protected]>, 
	Serge Hallyn <[email protected]>, Iker Pedrosa <[email protected]>, Evgeny Grin <[email protected]>, 
	Kees Cook <[email protected]>, [email protected], [email protected]
Subject: [PATCH v2] man/man3/mem*(): SYNOPSIS: Document non-standard mem*()
 functions as provided by <memory.h>
Message-ID: <c5bad3a80de2feaf3838cb302eeaea1dcc4ba672.1785543779.git.alx@kernel.org>
References: <[email protected]>
MIME-Version: 1.0
In-Reply-To: <[email protected]>

They've been provided there since forever, and that's a more appropriate
header.

While it would be good to document the standard functions also as
provided by <memory.h>, that's more controversial, and is still being
litigated.

Link: <https://lore.kernel.org/linux-man/am0RdPxvbIYUKAL-@devuan/T/#t>
Cc: Sam James <[email protected]>
Cc: "G. Branden Robinson" <[email protected]>
Cc: Joseph Myers <[email protected]>
Cc: Keith Bostic <[email protected]>
Cc: Mark Harris <[email protected]>
Cc: Nevin Liber <[email protected]>
Cc: Collin Funk <[email protected]>
Cc: JeanHeyd Meneide <[email protected]>
Cc: Christopher Bazley <[email protected]>
Cc: Serge Hallyn <[email protected]>
Cc: Iker Pedrosa <[email protected]>
Cc: Evgeny Grin <[email protected]>
Cc: Kees Cook <[email protected]>
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Alejandro Colomar <[email protected]>
---

Hi!

Here's a less ambitious change.  It's not that I don't want to pursue
the other one, but that this one will likely pass more quickly.

This only changes documentation for non-standard functions, where the
argument that the standard says XXX is now irrelevant.


Have a lovely night!
Alex

 man/man3/memfrob.3 | 2 +-
 man/man3/memmem.3  | 2 +-
 man/man3/mempcpy.3 | 2 +-
 man/man3/memrchr.3 | 2 +-
 man/man3/strdupa.3 | 4 ++++
 5 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/man/man3/memfrob.3 b/man/man3/memfrob.3
index ee41da0ced7b..ad736949002c 100644
--- a/man/man3/memfrob.3
+++ b/man/man3/memfrob.3
@@ -13,7 +13,7 @@ .SH LIBRARY
 .SH SYNOPSIS
 .nf
 .BR "#define _GNU_SOURCE" "             /* See feature_test_macros(7) */"
-.B #include <string.h>
+.B #include <memory.h>
 .P
 .BR "void *memfrob(" "size_t n;"
 .BI "              void " s [ n "], size_t " n );
diff --git a/man/man3/memmem.3 b/man/man3/memmem.3
index 13fd8b7cea7b..d0f99e6d577d 100644
--- a/man/man3/memmem.3
+++ b/man/man3/memmem.3
@@ -13,7 +13,7 @@ .SH LIBRARY
 .SH SYNOPSIS
 .nf
 .BR "#define _GNU_SOURCE" "         /* See feature_test_macros(7) */"
-.B #include <string.h>
+.B #include <memory.h>
 .P
 .BR "void *memmem(" "size_t hsize, size_t nsize;"
 .BI "             const void " haystack [ hsize "], size_t " hsize ,
diff --git a/man/man3/mempcpy.3 b/man/man3/mempcpy.3
index 012e6326dd00..4598be5d7bc2 100644
--- a/man/man3/mempcpy.3
+++ b/man/man3/mempcpy.3
@@ -14,7 +14,7 @@ .SH LIBRARY
 .SH SYNOPSIS
 .nf
 .BR "#define _GNU_SOURCE" "         /* See feature_test_macros(7) */"
-.B #include <string.h>
+.B #include <memory.h>
 .P
 .BR "void *mempcpy(" "size_t n;"
 .BI "              void " dest "[restrict " n "], const void " src "[restr=
ict " n ],
diff --git a/man/man3/memrchr.3 b/man/man3/memrchr.3
index 6e49defc5e4a..fe2841147f05 100644
--- a/man/man3/memrchr.3
+++ b/man/man3/memrchr.3
@@ -13,7 +13,7 @@ .SH LIBRARY
 .SH SYNOPSIS
 .nf
 .BR #define\~_GNU_SOURCE "  // See feature_test_macros(7)"
-.B #include <string.h>
+.B #include <memory.h>
 .P
 .BR void\~*memrchr( size_t\~n;
 .BI "              const void " s [ n "], int " c ", size_t " n );
diff --git a/man/man3/strdupa.3 b/man/man3/strdupa.3
index 63b12c83e9ec..412eec9f3491 100644
--- a/man/man3/strdupa.3
+++ b/man/man3/strdupa.3
@@ -16,6 +16,10 @@ .SH SYNOPSIS
 .B #include <string.h>
 .P
 .BI "char *strdupa(const char *" s );
+.P
+.BR "#define _GNU_SOURCE" "  /* See feature_test_macros(7) */"
+.B #include <memory.h>
+.P
 .BR "char *strndupa(" "size_t n;"
 .BI "              const char " s [ n "], size_t " n );
 .fi

base-commit: 8152eb52d9a92f02c14e843545acec7ee1946479
--=20
2.53.0


--i64vkpko4v6wf3lj
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEES7Jt9u9GbmlWADAi64mZXMKQwqkFAmptPN4ACgkQ64mZXMKQ
wqny7g/7BO+QUrK+T5Ol1EsyVckqIRo+MZI9XaKb/l97Xxtsn2ec3lQFs7vPHYc+
vbG4fq9amGW2F1fazvBA6bfFvkCZtAtdVWsSzaNUaxsjL3J6HWzMlrKTIZiKdQpa
yfHMFlVTE9EmuNx6VQCDmD1FihL2sCUnshIVnjOt4067MVnJwaX/gruis8pipQ01
Hb2H0vyqtThSyGmsAynsWNeDejv0c4LP/s+TdEAVYHJygfn4WNVc9fEo8zJLxpwX
glCkKPAvfCRP/Yz0SEcW/ZKAIddzwsMqAuWF9ECvS7oAP5EhMQiwc+0hNlalt3hY
0jd5qCMMJCyOvrrniclWKVAGBDid0ITFMAtdNFcpt8d6nSVfGep8AURhlkBSgKev
TQEgz6vAEYuLU2Fmeo9sDkkyO6vh8jyY3/5g9vgm6Rxsf2E4pxWFrs7KC5kFgFWV
TTxp6uF8eTnnMvzQ8LFADBB/sU8MI2K1IR/MSFdnIIfJAQaq359iJL5boKuHI8e+
1Hzm8TehhLzkiwAOaWNCWBEm9+ksfndOLClvBSX1aSaRr+tMIuDzcblu/ZacVCdN
LyNW0xRhLTF0erpAtmTbhS1f6748Nqxq4thgbQidAJ9T6yC3AkZY1zu6GXl2qq3/
QFKh5HWTdf0nAtXi4vZ5+HIYRZUHlA3kizzZp/pJhSYomNDAD3Y=
=2sdl
-----END PGP SIGNATURE-----

--i64vkpko4v6wf3lj--