diff mbox series

kconfig: use memcmp instead of deprecated bcmp

Message ID rxsikukdh39.fsf@localhost.mail-host-address-is-not-set (mailing list archive)
State New
Headers show
Series kconfig: use memcmp instead of deprecated bcmp | expand

Commit Message

Thomas Meyer Sept. 24, 2024, 6:47 p.m. UTC
Make build succeed on systems whose c library doesn't provided the deprecated bcmp function.

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
---
 scripts/kconfig/confdata.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Miguel Ojeda Sept. 24, 2024, 8:49 p.m. UTC | #1
On Tue, Sep 24, 2024 at 9:26 PM Thomas Meyer <thomas@m3y3r.de> wrote:
>
> 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:

Reviewed-by: Miguel Ojeda <ojeda@kernel.org>

Cheers,
Miguel
Masahiro Yamada Sept. 26, 2024, 3:33 p.m. UTC | #2
On Wed, Sep 25, 2024 at 5:50 AM Miguel Ojeda
<miguel.ojeda.sandonis@gmail.com> wrote:
>
> On Tue, Sep 24, 2024 at 9:26 PM Thomas Meyer <thomas@m3y3r.de> wrote:
> >
> > 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:
>
> Reviewed-by: Miguel Ojeda <ojeda@kernel.org>
>
> 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
Thomas Meyer Sept. 27, 2024, 6:53 p.m. UTC | #3
Am 26. September 2024 17:33:20 MESZ schrieb Masahiro Yamada <masahiroy@kernel.org>:
>On Wed, Sep 25, 2024 at 5:50 AM Miguel Ojeda
><miguel.ojeda.sandonis@gmail.com> wrote:
>>
>> On Tue, Sep 24, 2024 at 9:26 PM Thomas Meyer <thomas@m3y3r.de> wrote:
>> >
>> > 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:
>>
>> Reviewed-by: Miguel Ojeda <ojeda@kernel.org>
>>
>> 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.

>
>It might be useful to add a link that mentions that this function is LEGACY.
>
>https://pubs.opengroup.org/onlinepubs/007904875/functions/bcmp.html
>
>
Masahiro Yamada Sept. 30, 2024, 3:26 p.m. UTC | #4
On Sat, Sep 28, 2024 at 3:53 AM Thomas Meyer <thomas@m3y3r.de> wrote:
>
>
>
> Am 26. September 2024 17:33:20 MESZ schrieb Masahiro Yamada <masahiroy@kernel.org>:
> >On Wed, Sep 25, 2024 at 5:50 AM Miguel Ojeda
> ><miguel.ojeda.sandonis@gmail.com> wrote:
> >>
> >> On Tue, Sep 24, 2024 at 9:26 PM Thomas Meyer <thomas@m3y3r.de> wrote:
> >> >
> >> > 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:
> >>
> >> Reviewed-by: Miguel Ojeda <ojeda@kernel.org>
> >>
> >> 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.



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.








> >
> >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
diff mbox series

Patch

diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index 76193ce5a792..18e229bf3d3e 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -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;