um: Fix tgkill compile error on old host OSes
PATCH 1/1 um: Fix tgkill compile error on old host OSes
From: Yongting Lin <[email protected]>
tgkill is a quite old syscall since kernel 2.5.75, but unfortunately glibc doesn't support it before 2.30. Thus some systems fail to compile the latest UserMode Linux.
Here is the compile error I encountered when I tried to compile UML in my system shipped with glibc-2.28.
CALL scripts/checksyscalls.sh
CC arch/um/os-Linux/sigio.o
In file included from arch/um/os-Linux/sigio.c:17:
arch/um/os-Linux/sigio.c: In function ‘write_sigio_thread’:
arch/um/os-Linux/sigio.c:49:19: error: implicit declaration of function ‘tgkill’; did you mean ‘kill’? [-Werror=implicit-function-declaration]
CATCH_EINTR(r = tgkill(pid, pid, SIGIO));
^~~~~~
./arch/um/include/shared/os.h:21:48: note: in definition of macro ‘CATCH_EINTR’
#define CATCH_EINTR(expr) while ((errno = 0, ((expr) < 0)) && (errno == EINTR))
^~~~cc1: some warnings being treated as errors
Fix it by Replacing glibc call with raw syscall.
--- arch/um/os-Linux/sigio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/um/os-Linux/sigio.c +2 -1
@@ -12,6 +12,7 @@#include <signal.h> #include <string.h> #include <sys/epoll.h> +#include <asm/unistd.h> #include <kern_util.h> #include <init.h> #include <os.h>
@@ -46,7 +47,7 @@ static void *write_sigio_thread(void *unused) __func__, errno); } -CATCH_EINTR (r =tgkill (pid, pid,SIGIO )); +CATCH_EINTR (r =syscall (__NR_tgkill, pid, pid,SIGIO ));if (r <0 )printk (UM_KERN_ERR "%s: tgkill failed, errno = %d\n" , __func__, errno);
Signature · 1 line
2.20.1