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

UAPI: Fix the guards on various asm/unistd.h files

asm-generic/unistd.h and a number of asm/unistd.h files have been given
reinclusion guards that allow the guard to be overridden if __SYSCALL is
defined. Unfortunately, these files define __SYSCALL and don't undefine it
when they've finished with it, thus rendering the guard ineffective.

The reason for this override is to allow the file to be #included multiple
times with different settings on __SYSCALL for purposes like generating syscall
tables.

The following guards are problematic:

arch/arm64/include/asm/unistd.h:#if !defined(__ASM_UNISTD_H) || defined(__SYSCALL)
arch/arm64/include/asm/unistd32.h:#if !defined(__ASM_UNISTD32_H) || defined(__SYSCALL)
arch/c6x/include/asm/unistd.h:#if !defined(_ASM_C6X_UNISTD_H) || defined(__SYSCALL)
arch/hexagon/include/asm/unistd.h:#if !defined(_ASM_HEXAGON_UNISTD_H) || defined(__SYSCALL)
arch/openrisc/include/asm/unistd.h:#if !defined(__ASM_OPENRISC_UNISTD_H) || defined(__SYSCALL)
arch/score/include/asm/unistd.h:#if !defined(_ASM_SCORE_UNISTD_H) || defined(__SYSCALL)
arch/tile/include/asm/unistd.h:#if !defined(_ASM_TILE_UNISTD_H) || defined(__SYSCALL)
arch/unicore32/include/asm/unistd.h:#if !defined(__UNICORE_UNISTD_H__) || defined(__SYSCALL)
include/asm-generic/unistd.h:#if !defined(_ASM_GENERIC_UNISTD_H) || defined(__SYSCALL)

On the assumption that the guards' ineffectiveness has passed unnoticed, just
remove these guards entirely.

Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>

-40
-4
arch/arm64/include/asm/unistd.h
··· 13 13 * You should have received a copy of the GNU General Public License 14 14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 15 15 */ 16 - #if !defined(__ASM_UNISTD_H) || defined(__SYSCALL) 17 - #define __ASM_UNISTD_H 18 16 19 17 #ifndef __SYSCALL_COMPAT 20 18 #include <asm-generic/unistd.h> ··· 21 23 #if defined(__KERNEL__) && defined(CONFIG_COMPAT) 22 24 #include <asm/unistd32.h> 23 25 #endif 24 - 25 - #endif /* __ASM_UNISTD_H */
-4
arch/arm64/include/asm/unistd32.h
··· 16 16 * You should have received a copy of the GNU General Public License 17 17 * along with this program. If not, see <http://www.gnu.org/licenses/>. 18 18 */ 19 - #if !defined(__ASM_UNISTD32_H) || defined(__SYSCALL) 20 - #define __ASM_UNISTD32_H 21 19 22 20 #ifndef __SYSCALL 23 21 #define __SYSCALL(x, y) ··· 752 754 #define __ARCH_WANT_SYS_SIGPENDING 753 755 #define __ARCH_WANT_SYS_SIGPROCMASK 754 756 #define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND 755 - 756 - #endif /* __ASM_UNISTD32_H */
-4
arch/c6x/include/asm/unistd.h
··· 13 13 * NON INFRINGEMENT. See the GNU General Public License for 14 14 * more details. 15 15 */ 16 - #if !defined(_ASM_C6X_UNISTD_H) || defined(__SYSCALL) 17 - #define _ASM_C6X_UNISTD_H 18 16 19 17 /* Use the standard ABI for syscalls. */ 20 18 #include <asm-generic/unistd.h> ··· 20 22 /* C6X-specific syscalls. */ 21 23 #define __NR_cache_sync (__NR_arch_specific_syscall + 0) 22 24 __SYSCALL(__NR_cache_sync, sys_cache_sync) 23 - 24 - #endif /* _ASM_C6X_UNISTD_H */
-5
arch/hexagon/include/asm/unistd.h
··· 18 18 * 02110-1301, USA. 19 19 */ 20 20 21 - #if !defined(_ASM_HEXAGON_UNISTD_H) || defined(__SYSCALL) 22 - #define _ASM_HEXAGON_UNISTD_H 23 - 24 21 /* 25 22 * The kernel pulls this unistd.h in three different ways: 26 23 * 1. the "normal" way which gets all the __NR defines ··· 29 32 #define sys_mmap2 sys_mmap_pgoff 30 33 31 34 #include <asm-generic/unistd.h> 32 - 33 - #endif
-5
arch/openrisc/include/asm/unistd.h
··· 16 16 * (at your option) any later version. 17 17 */ 18 18 19 - #if !defined(__ASM_OPENRISC_UNISTD_H) || defined(__SYSCALL) 20 - #define __ASM_OPENRISC_UNISTD_H 21 - 22 19 #define __ARCH_HAVE_MMU 23 20 24 21 #define sys_mmap2 sys_mmap_pgoff ··· 24 27 25 28 #define __NR_or1k_atomic __NR_arch_specific_syscall 26 29 __SYSCALL(__NR_or1k_atomic, sys_or1k_atomic) 27 - 28 - #endif /* __ASM_OPENRISC_UNISTD_H */
-5
arch/score/include/asm/unistd.h
··· 1 - #if !defined(_ASM_SCORE_UNISTD_H) || defined(__SYSCALL) 2 - #define _ASM_SCORE_UNISTD_H 3 - 4 1 #define __ARCH_HAVE_MMU 5 2 6 3 #define __ARCH_WANT_SYSCALL_NO_AT ··· 6 9 #define __ARCH_WANT_SYSCALL_DEPRECATED 7 10 8 11 #include <asm-generic/unistd.h> 9 - 10 - #endif /* _ASM_SCORE_UNISTD_H */
-5
arch/tile/include/asm/unistd.h
··· 12 12 * more details. 13 13 */ 14 14 15 - #if !defined(_ASM_TILE_UNISTD_H) || defined(__SYSCALL) 16 - #define _ASM_TILE_UNISTD_H 17 - 18 15 #if !defined(__LP64__) || defined(__SYSCALL_COMPAT) 19 16 /* Use the flavor of this syscall that matches the 32-bit API better. */ 20 17 #define __ARCH_WANT_SYNC_FILE_RANGE2 ··· 40 43 #endif 41 44 #define __ARCH_WANT_SYS_NEWFSTATAT 42 45 #endif 43 - 44 - #endif /* _ASM_TILE_UNISTD_H */
-4
arch/unicore32/include/asm/unistd.h
··· 9 9 * it under the terms of the GNU General Public License version 2 as 10 10 * published by the Free Software Foundation. 11 11 */ 12 - #if !defined(__UNICORE_UNISTD_H__) || defined(__SYSCALL) 13 - #define __UNICORE_UNISTD_H__ 14 12 15 13 /* Use the standard ABI for syscalls. */ 16 14 #include <asm-generic/unistd.h> 17 - 18 - #endif /* __UNICORE_UNISTD_H__ */
-4
include/asm-generic/unistd.h
··· 1 - #if !defined(_ASM_GENERIC_UNISTD_H) || defined(__SYSCALL) 2 - #define _ASM_GENERIC_UNISTD_H 3 - 4 1 #include <asm/bitsperlong.h> 5 2 6 3 /* ··· 927 930 #endif 928 931 929 932 #endif /* __KERNEL__ */ 930 - #endif /* _ASM_GENERIC_UNISTD_H */