Skip to content

Commit

Permalink
xtensa: allow multi-inclusion for uapi/unistd.h
Browse files Browse the repository at this point in the history
Xtensa implements a method that allows to generate a arbitrary output
for each system call by defining the __SYSCALL(number, function, num_args).
This usually requires to include uapi/unistd.h twice. Instead of removing
the guard agains multiple inclusion entirely, allow to include unistd.h again
only if __SYSCALL is defined. Note that __SYSCALL gets always undefined at
the end of the file.

Signed-off-by: Chris Zankel <chris@zankel.net>
  • Loading branch information
Chris Zankel committed Oct 25, 2012
1 parent 6f0c058 commit 2f72d4f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 25 deletions.
14 changes: 4 additions & 10 deletions arch/xtensa/include/asm/unistd.h
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
/*
* include/asm-xtensa/unistd.h
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (C) 2001 - 2005 Tensilica Inc.
*/
#ifndef _XTENSA_UNISTD_H
#define _XTENSA_UNISTD_H

#include <uapi/asm/unistd.h>


/*
* "Conditional" syscalls
*
Expand All @@ -37,3 +29,5 @@
#define __IGNORE_mmap /* use mmap2 */
#define __IGNORE_vfork /* use clone */
#define __IGNORE_fadvise64 /* use fadvise64_64 */

#endif /* _XTENSA_UNISTD_H */
14 changes: 3 additions & 11 deletions arch/xtensa/include/uapi/asm/unistd.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
/*
* include/asm-xtensa/unistd.h
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (C) 2001 - 2012 Tensilica Inc.
*/

#ifndef _UAPI_XTENSA_UNISTD_H
#if !defined(_UAPI_XTENSA_UNISTD_H) || defined(__SYSCALL)
#define _UAPI_XTENSA_UNISTD_H

#ifndef __SYSCALL
Expand Down Expand Up @@ -759,4 +749,6 @@ __SYSCALL(331, sys_kcmp, 5)

#define SYS_XTENSA_COUNT 5 /* count */

#undef __SYSCALL

#endif /* _UAPI_XTENSA_UNISTD_H */
7 changes: 3 additions & 4 deletions arch/xtensa/kernel/syscall.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,8 @@ typedef void (*syscall_t)(void);
syscall_t sys_call_table[__NR_syscall_count] /* FIXME __cacheline_aligned */= {
[0 ... __NR_syscall_count - 1] = (syscall_t)&sys_ni_syscall,

#undef __SYSCALL
#define __SYSCALL(nr,symbol,nargs) [ nr ] = (syscall_t)symbol,
#undef __KERNEL_SYSCALLS__
#include <asm/unistd.h>
#include <uapi/asm/unistd.h>
};

asmlinkage long xtensa_shmat(int shmid, char __user *shmaddr, int shmflg)
Expand All @@ -49,7 +47,8 @@ asmlinkage long xtensa_shmat(int shmid, char __user *shmaddr, int shmflg)
return (long)ret;
}

asmlinkage long xtensa_fadvise64_64(int fd, int advice, unsigned long long offset, unsigned long long len)
asmlinkage long xtensa_fadvise64_64(int fd, int advice,
unsigned long long offset, unsigned long long len)
{
return sys_fadvise64_64(fd, offset, len, advice);
}
Expand Down

0 comments on commit 2f72d4f

Please sign in to comment.