Skip to content

Commit 8901395

Browse files
committed
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>
1 parent 612a9aa commit 8901395

9 files changed

Lines changed: 0 additions & 40 deletions

File tree

‎arch/arm64/include/asm/unistd.h‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
* You should have received a copy of the GNU General Public License
1414
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1515
*/
16-
#if !defined(__ASM_UNISTD_H) || defined(__SYSCALL)
17-
#define __ASM_UNISTD_H
1816

1917
#ifndef __SYSCALL_COMPAT
2018
#include <asm-generic/unistd.h>
@@ -23,5 +21,3 @@
2321
#if defined(__KERNEL__) && defined(CONFIG_COMPAT)
2422
#include <asm/unistd32.h>
2523
#endif
26-
27-
#endif /* __ASM_UNISTD_H */

‎arch/arm64/include/asm/unistd32.h‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
* You should have received a copy of the GNU General Public License
1717
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1818
*/
19-
#if !defined(__ASM_UNISTD32_H) || defined(__SYSCALL)
20-
#define __ASM_UNISTD32_H
2119

2220
#ifndef __SYSCALL
2321
#define __SYSCALL(x, y)
@@ -754,5 +752,3 @@ __SYSCALL(__NR_syncfs, sys_syncfs)
754752
#define __ARCH_WANT_SYS_SIGPENDING
755753
#define __ARCH_WANT_SYS_SIGPROCMASK
756754
#define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND
757-
758-
#endif /* __ASM_UNISTD32_H */

‎arch/c6x/include/asm/unistd.h‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,10 @@
1313
* NON INFRINGEMENT. See the GNU General Public License for
1414
* more details.
1515
*/
16-
#if !defined(_ASM_C6X_UNISTD_H) || defined(__SYSCALL)
17-
#define _ASM_C6X_UNISTD_H
1816

1917
/* Use the standard ABI for syscalls. */
2018
#include <asm-generic/unistd.h>
2119

2220
/* C6X-specific syscalls. */
2321
#define __NR_cache_sync (__NR_arch_specific_syscall + 0)
2422
__SYSCALL(__NR_cache_sync, sys_cache_sync)
25-
26-
#endif /* _ASM_C6X_UNISTD_H */

‎arch/hexagon/include/asm/unistd.h‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@
1818
* 02110-1301, USA.
1919
*/
2020

21-
#if !defined(_ASM_HEXAGON_UNISTD_H) || defined(__SYSCALL)
22-
#define _ASM_HEXAGON_UNISTD_H
23-
2421
/*
2522
* The kernel pulls this unistd.h in three different ways:
2623
* 1. the "normal" way which gets all the __NR defines
@@ -32,5 +29,3 @@
3229
#define sys_mmap2 sys_mmap_pgoff
3330

3431
#include <asm-generic/unistd.h>
35-
36-
#endif

‎arch/openrisc/include/asm/unistd.h‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@
1616
* (at your option) any later version.
1717
*/
1818

19-
#if !defined(__ASM_OPENRISC_UNISTD_H) || defined(__SYSCALL)
20-
#define __ASM_OPENRISC_UNISTD_H
21-
2219
#define __ARCH_HAVE_MMU
2320

2421
#define sys_mmap2 sys_mmap_pgoff
@@ -27,5 +24,3 @@
2724

2825
#define __NR_or1k_atomic __NR_arch_specific_syscall
2926
__SYSCALL(__NR_or1k_atomic, sys_or1k_atomic)
30-
31-
#endif /* __ASM_OPENRISC_UNISTD_H */

‎arch/score/include/asm/unistd.h‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
#if !defined(_ASM_SCORE_UNISTD_H) || defined(__SYSCALL)
2-
#define _ASM_SCORE_UNISTD_H
3-
41
#define __ARCH_HAVE_MMU
52

63
#define __ARCH_WANT_SYSCALL_NO_AT
@@ -9,5 +6,3 @@
96
#define __ARCH_WANT_SYSCALL_DEPRECATED
107

118
#include <asm-generic/unistd.h>
12-
13-
#endif /* _ASM_SCORE_UNISTD_H */

‎arch/tile/include/asm/unistd.h‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212
* more details.
1313
*/
1414

15-
#if !defined(_ASM_TILE_UNISTD_H) || defined(__SYSCALL)
16-
#define _ASM_TILE_UNISTD_H
17-
1815
#if !defined(__LP64__) || defined(__SYSCALL_COMPAT)
1916
/* Use the flavor of this syscall that matches the 32-bit API better. */
2017
#define __ARCH_WANT_SYNC_FILE_RANGE2
@@ -43,5 +40,3 @@ __SYSCALL(__NR_cmpxchg_badaddr, sys_cmpxchg_badaddr)
4340
#endif
4441
#define __ARCH_WANT_SYS_NEWFSTATAT
4542
#endif
46-
47-
#endif /* _ASM_TILE_UNISTD_H */

‎arch/unicore32/include/asm/unistd.h‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@
99
* it under the terms of the GNU General Public License version 2 as
1010
* published by the Free Software Foundation.
1111
*/
12-
#if !defined(__UNICORE_UNISTD_H__) || defined(__SYSCALL)
13-
#define __UNICORE_UNISTD_H__
1412

1513
/* Use the standard ABI for syscalls. */
1614
#include <asm-generic/unistd.h>
17-
18-
#endif /* __UNICORE_UNISTD_H__ */

‎include/asm-generic/unistd.h‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
#if !defined(_ASM_GENERIC_UNISTD_H) || defined(__SYSCALL)
2-
#define _ASM_GENERIC_UNISTD_H
3-
41
#include <asm/bitsperlong.h>
52

63
/*
@@ -930,4 +927,3 @@ __SYSCALL(__NR_fork, sys_ni_syscall)
930927
#endif
931928

932929
#endif /* __KERNEL__ */
933-
#endif /* _ASM_GENERIC_UNISTD_H */

0 commit comments

Comments
 (0)