Skip to contentSkip to conversation

kconfig: use memcmp instead of deprecated bcmp

PATCH In review Thomas Meyer 3 participants 6 messages Sep 24, 2024 – Jun 15, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kconfig: use memcmp instead of deprecated bcmp

Make build succeed on systems whose c library doesn't provided the deprecated bcmp function.

---
 scripts/kconfig/confdata.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/kconfig/confdata.c +1 -1
index 76193ce5a792..18e229bf3d3e 100644
@@ -76,7 +76,7 @@ static bool is_same(const char *file1, const char *file2)
 	if (map2 == MAP_FAILED)
 		goto close2;
 
-	if (bcmp(map1, map2, st1.st_size))
+	if (memcmp(map1, map2, st1.st_size))
 		goto close2;
 
 	ret = true;
Signature · 3 lines
2.46.1

============================================================
Reviewed-by on v1 1/1
#1 lore raw
Quoted 2 lines · Thomas Meyer

Make build succeed on systems whose c library doesn't provided the deprecated bcmp function.

It would be good to mention which systems are those. Other than that, it looks good to me:

Cheers,
Miguel

#2 lore raw
Quoted 5 lines · Miguel Ojeda
Quoted 2 lines · Thomas Meyer

Make build succeed on systems whose c library doesn't provided the deprecated bcmp function.

Quoted 7 lines

It would be good to mention which systems are those. Other than that, it looks good to me:

Cheers,
Miguel

Agree.

If there is a known system that does not provide bcmp, that information is appreciated.

It might be useful to add a link that mentions that this function is LEGACY.

https://pubs.opengroup.org/onlinepubs/007904875/functions/bcmp.html

Signature · 2 lines
Best Regards
Masahiro Yamada
#3 lore raw

Am 26. September 2024 17:33:20 MESZ schrieb Masahiro Yamada <[email protected]>:

Quoted 12 lines
Quoted 10 lines · Miguel Ojeda
Quoted 2 lines · Thomas Meyer

Make build succeed on systems whose c library doesn't provided the deprecated bcmp function.

It would be good to mention which systems are those. Other than that, it looks good to me:

Quoted 8 lines
Quoted 2 lines

Cheers,
Miguel

Agree.

If there is a known system that does not provide bcmp, that information is appreciated.

This fix is needed when I try to build Linux kernel on my Android phone under Termux with bionic libc, which only seems to implement memcmp.

Quoted 6 lines

It might be useful to add a link that mentions that this function is LEGACY.

https://pubs.opengroup.org/onlinepubs/007904875/functions/bcmp.html

Signature · 1 line
Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet.
#4 lore raw
Quoted 20 lines · Thomas Meyer

Am 26. September 2024 17:33:20 MESZ schrieb Masahiro Yamada <[email protected]>:

Quoted 16 lines
Quoted 12 lines · Miguel Ojeda
Quoted 2 lines · Thomas Meyer

Make build succeed on systems whose c library doesn't provided the deprecated bcmp function.

It would be good to mention which systems are those. Other than that, it looks good to me:

Cheers,
Miguel

Quoted 6 lines
Quoted 4 lines

Agree.

If there is a known system that does not provide bcmp, that information is appreciated.

This fix is needed when I try to build Linux kernel on my Android phone under Termux with bionic libc, which only seems to implement memcmp.

OK, thanks.

Please add a little more description in v2.

For example,

bcmp() was removed in POSIX.1-2008.

This commit replaces bcmp() with memcmp(). This allows Kconfig to link with C libraries that do not provide bcmp(), such as Android bionic libc.

Quoted 10 lines
Quoted 6 lines

It might be useful to add a link that mentions that this function is LEGACY.

https://pubs.opengroup.org/onlinepubs/007904875/functions/bcmp.html

--
Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet.

--
Best Regards
Masahiro Yamada

#5 lore raw
Quoted 39 lines · Masahiro Yamada
Quoted 20 lines · Thomas Meyer

Am 26. September 2024 17:33:20 MESZ schrieb Masahiro Yamada <[email protected]>:

Quoted 16 lines
Quoted 12 lines · Miguel Ojeda
Quoted 2 lines · Thomas Meyer

Make build succeed on systems whose c library doesn't provided the deprecated bcmp function.

It would be good to mention which systems are those. Other than that, it looks good to me:

Cheers,
Miguel

Quoted 6 lines
Quoted 4 lines

Agree.

If there is a known system that does not provide bcmp, that information is appreciated.

This fix is needed when I try to build Linux kernel on my Android phone under Termux with bionic libc, which only seems to implement memcmp.

OK, thanks.

Please add a little more description in v2.

For example,

Quoted 5 lines

bcmp() was removed in POSIX.1-2008.

This commit replaces bcmp() with memcmp(). This allows Kconfig to link with C libraries that do not provide bcmp(), such as Android bionic libc.

Applied with updated commit description.

Signature · 2 lines
Best Regards
Masahiro Yamada