#define __NR_rseq                      (__NR_Linux + 367)
 #define __NR_io_pgetevents             (__NR_Linux + 368)
 
+#ifdef __KERNEL__
+#define __NR_syscalls                  368
+#endif
 
 /*
  * Offset of the last Linux o32 flavoured syscall
  */
-#define __NR_Linux_syscalls            368
+#define __NR_Linux_syscalls            __NR_syscalls
 
 #endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
 
 #define __NR_rseq                      (__NR_Linux + 327)
 #define __NR_io_pgetevents             (__NR_Linux + 328)
 
+#ifdef __KERNEL__
+#define __NR_syscalls                  328
+#endif
+
 /*
  * Offset of the last Linux 64-bit flavoured syscall
  */
-#define __NR_Linux_syscalls            328
+#define __NR_Linux_syscalls            __NR_syscalls
 
 #endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */
 
 #define __NR_rseq                      (__NR_Linux + 331)
 #define __NR_io_pgetevents             (__NR_Linux + 332)
 
+#ifdef __KERNEL__
+#define __NR_syscalls                  332
+#endif
+
 /*
  * Offset of the last N32 flavoured syscall
  */
-#define __NR_Linux_syscalls            332
+#define __NR_Linux_syscalls            __NR_syscalls
 
 #endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */