kernel: add __poll_t compat for pre-4.16 and backported kernels (#194)

__poll_t was introduced in v4.16-rc1. Add Makefile header check to detect and provide fallback for older kernels and those with backports.

Signed-off-by: AzyrRuthless <azyrruthless@tutamail.com>
This commit is contained in:
Azyr Ruthless
2025-11-08 08:56:18 +07:00
committed by ShirkNeko
parent 2ab373d146
commit 5782afe481
2 changed files with 9 additions and 0 deletions

View File

@@ -119,6 +119,11 @@ ifeq ($(shell grep -q "inode_security_struct\s\+\*selinux_inode" $(srctree)/secu
ccflags-y += -DKSU_OPTIONAL_SELINUX_INODE ccflags-y += -DKSU_OPTIONAL_SELINUX_INODE
endif endif
# Check if __poll_t is available
ifeq ($(shell grep -q "__poll_t" $(srctree)/include/linux/poll.h; echo $$?),1)
ccflags-y += -DKSU_NEED_POLL_T_DEF
endif
# Checks Samsung # Checks Samsung
ifeq ($(shell grep -q "CONFIG_KDP_CRED" $(srctree)/kernel/cred.c; echo $$?),0) ifeq ($(shell grep -q "CONFIG_KDP_CRED" $(srctree)/kernel/cred.c; echo $$?),0)
ccflags-y += -DSAMSUNG_UH_DRIVER_EXIST ccflags-y += -DSAMSUNG_UH_DRIVER_EXIST

View File

@@ -20,6 +20,10 @@
#include "file_wrapper.h" #include "file_wrapper.h"
#ifdef KSU_NEED_POLL_T_DEF
typedef unsigned __bitwise __poll_t;
#endif
static loff_t mksu_wrapper_llseek(struct file *fp, loff_t off, int flags) static loff_t mksu_wrapper_llseek(struct file *fp, loff_t off, int flags)
{ {
struct ksu_file_wrapper *data = fp->private_data; struct ksu_file_wrapper *data = fp->private_data;