Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Fix up the "generic" unistd.h ABI to be more useful.

Reserve 16 "architecture-specific" syscall numbers starting at 244.

Allow use of the sys_sync_file_range2() API with the generic unistd.h
by specifying __ARCH_WANT_SYNC_FILE_RANGE2 before including it.

Allow using the generic unistd.h to create the "compat" syscall table
by specifying __SYSCALL_COMPAT before including it.

Use sys_fadvise64_64 for __NR3264_fadvise64 in both 32- and 64-bit mode.

Request the appropriate __ARCH_WANT_COMPAT_SYS_xxx values when
some deprecated syscall modes are selected.

As part of this change to fix up the syscalls, also provide a couple
of missing signal-related syscall prototypes in <linux/syscalls.h>.

Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>

+24 -6
+20 -6
include/asm-generic/unistd.h
··· 18 18 #define __SYSCALL(x, y) 19 19 #endif 20 20 21 - #if __BITS_PER_LONG == 32 21 + #if __BITS_PER_LONG == 32 || defined(__SYSCALL_COMPAT) 22 22 #define __SC_3264(_nr, _32, _64) __SYSCALL(_nr, _32) 23 23 #else 24 24 #define __SC_3264(_nr, _32, _64) __SYSCALL(_nr, _64) ··· 241 241 __SYSCALL(__NR_fsync, sys_fsync) 242 242 #define __NR_fdatasync 83 243 243 __SYSCALL(__NR_fdatasync, sys_fdatasync) 244 + #ifdef __ARCH_WANT_SYNC_FILE_RANGE2 245 + #define __NR_sync_file_range2 84 246 + __SYSCALL(__NR_sync_file_range2, sys_sync_file_range2) 247 + #else 244 248 #define __NR_sync_file_range 84 245 - __SYSCALL(__NR_sync_file_range, sys_sync_file_range) /* .long sys_sync_file_range2, */ 249 + __SYSCALL(__NR_sync_file_range, sys_sync_file_range) 250 + #endif 246 251 247 252 /* fs/timerfd.c */ 248 253 #define __NR_timerfd_create 85 ··· 585 580 __SC_3264(__NR3264_mmap, sys_mmap2, sys_mmap) 586 581 /* mm/fadvise.c */ 587 582 #define __NR3264_fadvise64 223 588 - __SC_3264(__NR3264_fadvise64, sys_fadvise64_64, sys_fadvise64) 583 + __SYSCALL(__NR3264_fadvise64, sys_fadvise64_64) 589 584 590 585 /* mm/, CONFIG_MMU only */ 591 586 #ifndef __ARCH_NOMMU ··· 632 627 #define __NR_recvmmsg 243 633 628 __SYSCALL(__NR_recvmmsg, sys_recvmmsg) 634 629 630 + /* 631 + * Architectures may provide up to 16 syscalls of their own 632 + * starting with this value. 633 + */ 634 + #define __NR_arch_specific_syscall 244 635 + 635 636 #undef __NR_syscalls 636 - #define __NR_syscalls 244 637 + #define __NR_syscalls 260 637 638 638 639 /* 639 640 * All syscalls below here should go away really, ··· 705 694 #define __NR_syscalls (__NR_signalfd+1) 706 695 #endif /* __ARCH_WANT_SYSCALL_NO_FLAGS */ 707 696 708 - #if __BITS_PER_LONG == 32 && defined(__ARCH_WANT_SYSCALL_OFF_T) 697 + #if (__BITS_PER_LONG == 32 || defined(__SYSCALL_COMPAT)) && \ 698 + defined(__ARCH_WANT_SYSCALL_OFF_T) 709 699 #define __NR_sendfile 1046 710 700 __SYSCALL(__NR_sendfile, sys_sendfile) 711 701 #define __NR_ftruncate 1047 ··· 752 740 __SYSCALL(__NR_pause, sys_pause) 753 741 #define __NR_time 1062 754 742 #define __ARCH_WANT_SYS_TIME 743 + #define __ARCH_WANT_COMPAT_SYS_TIME 755 744 __SYSCALL(__NR_time, sys_time) 756 745 #define __NR_utime 1063 757 746 #define __ARCH_WANT_SYS_UTIME ··· 814 801 * Here we map the numbers so that both versions 815 802 * use the same syscall table layout. 816 803 */ 817 - #if __BITS_PER_LONG == 64 804 + #if __BITS_PER_LONG == 64 && !defined(__SYSCALL_COMPAT) 818 805 #define __NR_fcntl __NR3264_fcntl 819 806 #define __NR_statfs __NR3264_statfs 820 807 #define __NR_fstatfs __NR3264_fstatfs ··· 861 848 #endif 862 849 #define __ARCH_WANT_SYS_RT_SIGACTION 863 850 #define __ARCH_WANT_SYS_RT_SIGSUSPEND 851 + #define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND 864 852 865 853 /* 866 854 * "Conditional" syscalls
+4
include/linux/syscalls.h
··· 364 364 asmlinkage long sys_delete_module(const char __user *name_user, 365 365 unsigned int flags); 366 366 367 + asmlinkage long sys_rt_sigaction(int sig, const struct sigaction __user *act, 368 + struct sigaction __user *oact, 369 + size_t sigsetsize); 367 370 asmlinkage long sys_rt_sigprocmask(int how, sigset_t __user *set, 368 371 sigset_t __user *oset, size_t sigsetsize); 369 372 asmlinkage long sys_rt_sigpending(sigset_t __user *set, size_t sigsetsize); 373 + asmlinkage long sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize); 370 374 asmlinkage long sys_rt_sigtimedwait(const sigset_t __user *uthese, 371 375 siginfo_t __user *uinfo, 372 376 const struct timespec __user *uts,