#ifdef CONFIG_ARM64
+# include <linux/version.h>
+# if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)
+# define COMPAT_PSR_MODE_MASK PSR_AA32_MODE_MASK
+# define COMPAT_PSR_MODE_USR PSR_AA32_MODE_USR
+# define COMPAT_PSR_T_BIT PSR_AA32_T_BIT
+# endif /* #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0) */
+
# define PSR_T_BIT COMPAT_PSR_T_BIT
# define ARM_r0 compat_usr(0)
# include <linux/wait.h>
#else /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 13, 0) */
# include <linux/wait_bit.h>
+# if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 17, 0)
+# include <linux/sched.h>
+static inline void wake_up_atomic_t(atomic_t *val)
+{
+ wake_up_var(val);
+}
+
+static inline int wait_on_atomic_t(atomic_t *val, int (*action)(atomic_t *),
+ unsigned mode)
+{
+ wait_var_event(val, !atomic_read(val));
+ return 0;
+}
+# endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 17, 0) */
#endif /* LINUX_VERSION_CODE */
#endif /* _SWAP_WAIT_H */
static void kmem_info_fill(struct kmem_info *info, struct task_struct *task)
{
#if defined(CONFIG_ARM)
+# if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)
+# define VECTORS_BASE CONFIG_VECTORS_BASE
+# endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0) */
info->name = "[vectors]";
- info->start = CONFIG_VECTORS_BASE;
- info->end = CONFIG_VECTORS_BASE + PAGE_SIZE;
+ info->start = VECTORS_BASE;
+ info->end = VECTORS_BASE + PAGE_SIZE;
#elif defined(CONFIG_ARM64)
if (test_ti_thread_flag(task_thread_info(task), TIF_32BIT)) {
info->name = "[vectors]";
return S_ISREG(mode);
}
+static int do_kernel_getsockname(struct socket *sock, struct sockaddr *addr)
+{
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 17, 0)
+ return kernel_getsockname(sock, addr);
+#else /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 17, 0) */
+ int addrlen;
+ return kernel_getsockname(sock, addr, &addrlen);
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 17, 0) */
+}
+
static int pack_osock(void *data, size_t size, int fd, struct file *file,
loff_t fsize)
{
struct sockaddr *saddr = (struct sockaddr *)&addr;
struct sockaddr_in *sin = (struct sockaddr_in *)&addr;
int ret_size = sizeof(*pack_sock);
- int addrlen;
int err;
if (size < sizeof(*pack_sock))
if (!sock)
return 0;
- kernel_getsockname(sock, saddr, &addrlen);
+ do_kernel_getsockname(sock, saddr);
pack_sock = (struct osock *)data;
pack_sock->fd = (u32)fd;