selftests/landlock: Fix net_test build with old libc
authorHu Yadi <hu.yadi@h3c.com>
Tue, 23 Jan 2024 06:26:21 +0000 (14:26 +0800)
committerMickaël Salaün <mic@digikod.net>
Thu, 25 Jan 2024 15:49:04 +0000 (16:49 +0100)
commit116099ed345c932a8ae4a0d884a8f6cc54fd5fed
treeb96158da84b2773ed9910dd4b218169be3b79786
parent6613476e225e090cc9aad49be7fa504e290dd33d
selftests/landlock: Fix net_test build with old libc

One issue comes up while building selftest/landlock/net_test on my side
(gcc 7.3/glibc-2.28/kernel-4.19).

net_test.c: In function ‘set_service’:
net_test.c:91:45: warning: implicit declaration of function ‘gettid’; [-Wimplicit-function-declaration]
    "_selftests-landlock-net-tid%d-index%d", gettid(),
                                             ^~~~~~
                                             getgid
net_test.c:(.text+0x4e0): undefined reference to `gettid'

Signed-off-by: Hu Yadi <hu.yadi@h3c.com>
Suggested-by: Jiao <jiaoxupo@h3c.com>
Reviewed-by: Berlin <berlin@h3c.com>
Fixes: a549d055a22e ("selftests/landlock: Add network tests")
Link: https://lore.kernel.org/r/20240123062621.25082-1-hu.yadi@h3c.com
[mic: Cosmetic fixes]
Signed-off-by: Mickaël Salaün <mic@digikod.net>
tools/testing/selftests/landlock/net_test.c