Skip to content

Commit fd05418

Browse files
ivanalgojmberg-intel
authored andcommitted
um: Fix tgkill compile error on old host OSes
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. Fixes: 33c9da5 ("um: Rewrite the sigio workaround based on epoll and tgkill") Signed-off-by: Yongting Lin <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Johannes Berg <[email protected]>
1 parent b8c9c3b commit fd05418

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

arch/um/os-Linux/sigio.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <signal.h>
1313
#include <string.h>
1414
#include <sys/epoll.h>
15+
#include <asm/unistd.h>
1516
#include <kern_util.h>
1617
#include <init.h>
1718
#include <os.h>
@@ -46,7 +47,7 @@ static void *write_sigio_thread(void *unused)
4647
__func__, errno);
4748
}
4849

49-
CATCH_EINTR(r = tgkill(pid, pid, SIGIO));
50+
CATCH_EINTR(r = syscall(__NR_tgkill, pid, pid, SIGIO));
5051
if (r < 0)
5152
printk(UM_KERN_ERR "%s: tgkill failed, errno = %d\n",
5253
__func__, errno);

0 commit comments

Comments
 (0)