diff mbox series

[v4,3/6] parisc: add system call table generation support

Message ID 1539337442-3676-4-git-send-email-firoz.khan@linaro.org
State New
Headers show
Series parisc: system call table generation support | expand

Commit Message

Firoz Khan Oct. 12, 2018, 9:43 a.m. UTC
The system call tables are in different format in all
architecture and it will be difficult to manually add or
modify the system calls in the respective files. To make
it easy by keeping a script and which'll generate the
header file and syscall table file so this change will
unify them across all architectures.

The system call table generation script is added in
syscalls directory which contain the script to generate
both uapi header file system call table generation file
and syscall.tbl file which'll be the input for the
scripts.

syscall.tbl contains the list of available system calls
along with system call number and corresponding entry point.
Add a new system call in this architecture will be possible
by adding new entry in the syscall.tbl file.

Adding a new table entry consisting of:
        - System call number.
        - ABI.
        - System call name.
        - Entry point name.
	- Compat entry name, if required.

syscallhdr.sh and syscalltbl.sh will generate uapi header-
unistd_32/64.h and syscall_table_32/64/c32.h files respect-
ively. File syscall_table_32/64/c32.h is included by sys-
call.S - the real system call table. Both .sh files will
parse the content syscall.tbl to generate the header and
table files.

ARM, s390 and x86 architecuture does have the similar support.
I leverage their implementation to come up with a generic
solution.

Signed-off-by: Firoz Khan <firoz.khan@linaro.org>

---
 arch/parisc/kernel/syscalls/Makefile      |  55 +++++
 arch/parisc/kernel/syscalls/syscall.tbl   | 369 ++++++++++++++++++++++++++++++
 arch/parisc/kernel/syscalls/syscallhdr.sh |  35 +++
 arch/parisc/kernel/syscalls/syscalltbl.sh |  46 ++++
 4 files changed, 505 insertions(+)
 create mode 100644 arch/parisc/kernel/syscalls/Makefile
 create mode 100644 arch/parisc/kernel/syscalls/syscall.tbl
 create mode 100644 arch/parisc/kernel/syscalls/syscallhdr.sh
 create mode 100644 arch/parisc/kernel/syscalls/syscalltbl.sh

-- 
1.9.1

Comments

Firoz Khan Oct. 12, 2018, 10:18 a.m. UTC | #1
Hi Arnd, Helge, everyone,

On Fri, 12 Oct 2018 at 15:14, Firoz Khan <firoz.khan@linaro.org> wrote:
>

> The system call tables are in different format in all

> architecture and it will be difficult to manually add or

> modify the system calls in the respective files. To make

> it easy by keeping a script and which'll generate the

> header file and syscall table file so this change will

> unify them across all architectures.

>

> The system call table generation script is added in

> syscalls directory which contain the script to generate

> both uapi header file system call table generation file

> and syscall.tbl file which'll be the input for the

> scripts.

>

> syscall.tbl contains the list of available system calls

> along with system call number and corresponding entry point.

> Add a new system call in this architecture will be possible

> by adding new entry in the syscall.tbl file.

>

> Adding a new table entry consisting of:

>         - System call number.

>         - ABI.

>         - System call name.

>         - Entry point name.

>         - Compat entry name, if required.

>

> syscallhdr.sh and syscalltbl.sh will generate uapi header-

> unistd_32/64.h and syscall_table_32/64/c32.h files respect-

> ively. File syscall_table_32/64/c32.h is included by sys-

> call.S - the real system call table. Both .sh files will

> parse the content syscall.tbl to generate the header and

> table files.

>

> ARM, s390 and x86 architecuture does have the similar support.

> I leverage their implementation to come up with a generic

> solution.

>

> Signed-off-by: Firoz Khan <firoz.khan@linaro.org>

> ---

>  arch/parisc/kernel/syscalls/Makefile      |  55 +++++

>  arch/parisc/kernel/syscalls/syscall.tbl   | 369 ++++++++++++++++++++++++++++++

>  arch/parisc/kernel/syscalls/syscallhdr.sh |  35 +++

>  arch/parisc/kernel/syscalls/syscalltbl.sh |  46 ++++

>  4 files changed, 505 insertions(+)

>  create mode 100644 arch/parisc/kernel/syscalls/Makefile

>  create mode 100644 arch/parisc/kernel/syscalls/syscall.tbl

>  create mode 100644 arch/parisc/kernel/syscalls/syscallhdr.sh

>  create mode 100644 arch/parisc/kernel/syscalls/syscalltbl.sh

>

> diff --git a/arch/parisc/kernel/syscalls/Makefile b/arch/parisc/kernel/syscalls/Makefile

> new file mode 100644

> index 0000000..a0af5a3

> --- /dev/null

> +++ b/arch/parisc/kernel/syscalls/Makefile

> @@ -0,0 +1,55 @@

> +# SPDX-License-Identifier: GPL-2.0

> +kapi := arch/$(SRCARCH)/include/generated/asm

> +uapi := arch/$(SRCARCH)/include/generated/uapi/asm

> +

> +_dummy := $(shell [ -d '$(uapi)' ] || mkdir -p '$(uapi)') \

> +         $(shell [ -d '$(kapi)' ] || mkdir -p '$(kapi)')

> +

> +syscall := $(srctree)/$(src)/syscall.tbl

> +syshdr := $(srctree)/$(src)/syscallhdr.sh

> +systbl := $(srctree)/$(src)/syscalltbl.sh

> +

> +quiet_cmd_syshdr = SYSHDR  $@

> +      cmd_syshdr = $(CONFIG_SHELL) '$(syshdr)' '$<' '$@'  \

> +                  '$(syshdr_abi_$(basetarget))'          \

> +                  '$(syshdr_pfx_$(basetarget))'          \

> +                  '$(syshdr_offset_$(basetarget))'

> +

> +quiet_cmd_systbl = SYSTBL  $@

> +      cmd_systbl = $(CONFIG_SHELL) '$(systbl)' '$<' '$@'  \

> +                   '$(systbl_abi_$(basetarget))'          \

> +                  '$(systbl_offset_$(basetarget))'

> +

> +syshdr_abi_unistd_32 := common,32

> +syshdr_offset_unistd_32 := __NR_Linux

> +$(uapi)/unistd_32.h: $(syscall) $(syshdr)

> +       $(call if_changed,syshdr)

> +

> +syshdr_abi_unistd_64 := common,64

> +syshdr_offset_unistd_64 := __NR_Linux

> +$(uapi)/unistd_64.h: $(syscall) $(syshdr)

> +       $(call if_changed,syshdr)

> +

> +systbl_abi_syscall_table_32 := common,32

> +$(kapi)/syscall_table_32.h: $(syscall) $(systbl)

> +       $(call if_changed,systbl)

> +

> +systbl_abi_syscall_table_64 := common,64

> +$(kapi)/syscall_table_64.h: $(syscall) $(systbl)

> +       $(call if_changed,systbl)

> +

> +systbl_abi_syscall_table_c32 := common,compat,32

> +$(kapi)/syscall_table_c32.h: $(syscall) $(systbl)

> +       $(call if_changed,systbl)

> +

> +uapisyshdr-y                   += unistd_32.h unistd_64.h

> +kapisyshdr-y                   += syscall_table_32.h     \

> +                                   syscall_table_64.h     \

> +                                   syscall_table_c32.h

> +

> +targets        += $(uapisyshdr-y) $(kapisyshdr-y)

> +

> +PHONY += all

> +all: $(addprefix $(uapi)/,$(uapisyshdr-y))

> +all: $(addprefix $(kapi)/,$(kapisyshdr-y))

> +       @:

> diff --git a/arch/parisc/kernel/syscalls/syscall.tbl b/arch/parisc/kernel/syscalls/syscall.tbl

> new file mode 100644

> index 0000000..7c9f268

> --- /dev/null

> +++ b/arch/parisc/kernel/syscalls/syscall.tbl

> @@ -0,0 +1,369 @@

> +# SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note

> +#

> +# system call numbers and entry vectors for parisc

> +#

> +# The format is:

> +# <number> <abi> <name> <entry point> <compat entry point>

> +#

> +# The <abi> can be common, 64, or 32 for this file.

> +#

> +0       common  restart_syscall                 sys_restart_syscall

> +1       common  exit                            sys_exit

> +2       common  fork                            sys_fork_wrapper

> +3       common  read                            sys_read

> +4       common  write                           sys_write

> +5       common  open                            sys_open                        compat_sys_open

> +6       common  close                           sys_close

> +7       common  waitpid                         sys_waitpid

> +8       common  creat                           sys_creat

> +9       common  link                            sys_link

> +10      common  unlink                          sys_unlink

> +11      common  execve                          sys_execve                      compat_sys_execve

> +12      common  chdir                           sys_chdir

> +13      common  time                            sys_time                        compat_sys_time

> +14      common  mknod                           sys_mknod

> +15      common  chmod                           sys_chmod

> +16      common  lchown                          sys_lchown

> +17      common  socket                          sys_socket

> +18      common  stat                            sys_newstat                     compat_sys_newstat

> +19      common  lseek                           sys_lseek                       compat_sys_lseek

> +20      common  getpid                          sys_getpid

> +21      common  mount                           sys_mount                       compat_sys_mount

> +22      common  bind                            sys_bind

> +23      common  setuid                          sys_setuid

> +24      common  getuid                          sys_getuid

> +25      common  stime                           sys_stime                       compat_sys_stime

> +26      common  ptrace                          sys_ptrace                      compat_sys_ptrace

> +27      common  alarm                           sys_alarm

> +28      common  fstat                           sys_newfstat                    compat_sys_newfstat

> +29      common  pause                           sys_pause

> +30      common  utime                           sys_utime                       compat_sys_utime

> +31      common  connect                         sys_connect

> +32      common  listen                          sys_listen

> +33      common  access                          sys_access

> +34      common  nice                            sys_nice

> +35      common  accept                          sys_accept

> +36      common  sync                            sys_sync

> +37      common  kill                            sys_kill

> +38      common  rename                          sys_rename

> +39      common  mkdir                           sys_mkdir

> +40      common  rmdir                           sys_rmdir

> +41      common  dup                             sys_dup

> +42      common  pipe                            sys_pipe

> +43      common  times                           sys_times                       compat_sys_times

> +44      common  getsockname                     sys_getsockname

> +45      common  brk                             sys_brk

> +46      common  setgid                          sys_setgid

> +47      common  getgid                          sys_getgid

> +48      common  signal                          sys_signal

> +49      common  geteuid                         sys_geteuid

> +50      common  getegid                         sys_getegid

> +51      common  acct                            sys_acct

> +52      common  umount2                         sys_umount

> +53      common  getpeername                     sys_getpeername

> +54      common  ioctl                           sys_ioctl                       compat_sys_ioctl

> +55      common  fcntl                           sys_fcntl                       compat_sys_fcntl

> +56      common  socketpair                      sys_socketpair

> +57      common  setpgid                         sys_setpgid

> +58      common  send                            sys_send

> +59      common  uname                           sys_newuname

> +60      common  umask                           sys_umask

> +61      common  chroot                          sys_chroot

> +62      common  ustat                           sys_ustat                       compat_sys_ustat

> +63      common  dup2                            sys_dup2

> +64      common  getppid                         sys_getppid

> +65      common  getpgrp                         sys_getpgrp

> +66      common  setsid                          sys_setsid

> +67      common  pivot_root                      sys_pivot_root

> +68      common  sgetmask                        sys_sgetmask                    sys32_unimplemented

> +69      common  ssetmask                        sys_ssetmask                    sys32_unimplemented

> +70      common  setreuid                        sys_setreuid

> +71      common  setregid                        sys_setregid

> +72      common  mincore                         sys_mincore

> +73      common  sigpending                      sys_sigpending                  compat_sys_sigpending

> +74      common  sethostname                     sys_sethostname

> +75      common  setrlimit                       sys_setrlimit                   compat_sys_setrlimit

> +76      common  getrlimit                       sys_getrlimit                   compat_sys_getrlimit

> +77      common  getrusage                       sys_getrusage                   compat_sys_getrusage

> +78      common  gettimeofday                    sys_gettimeofday                compat_sys_gettimeofday

> +79      common  settimeofday                    sys_settimeofday                compat_sys_settimeofday

> +80      common  getgroups                       sys_getgroups

> +81      common  setgroups                       sys_setgroups

> +82      common  sendto                          sys_sendto

> +83      common  symlink                         sys_symlink

> +84      common  lstat                           sys_newlstat                    compat_sys_newlstat

> +85      common  readlink                        sys_readlink

> +86      common  uselib                          sys_ni_syscall

> +87      common  swapon                          sys_swapon

> +88      common  reboot                          sys_reboot

> +89      common  mmap2                           sys_mmap2

> +90      common  mmap                            sys_mmap

> +91      common  munmap                          sys_munmap

> +92      common  truncate                        sys_truncate                    compat_sys_truncate

> +93      common  ftruncate                       sys_ftruncate                   compat_sys_ftruncate

> +94      common  fchmod                          sys_fchmod

> +95      common  fchown                          sys_fchown

> +96      common  getpriority                     sys_getpriority

> +97      common  setpriority                     sys_setpriority

> +98      common  recv                            sys_recv

> +99      common  statfs                          sys_statfs                      compat_sys_statfs

> +100     common  fstatfs                         sys_fstatfs                     compat_sys_fstatfs

> +101     common  stat64                          sys_stat64

> +# 102 was socketcall

> +103     common  syslog                          sys_syslog

> +104     common  setitimer                       sys_setitimer                   compat_sys_setitimer

> +105     common  getitimer                       sys_getitimer                   compat_sys_getitimer

> +106     common  capget                          sys_capget

> +107     common  capset                          sys_capset

> +108     32      pread64                         parisc_pread64

> +108     64      pread64                         sys_pread64

> +109     32      pwrite64                        parisc_pwrite64

> +109     64      pwrite64                        sys_pwrite64

> +110     common  getcwd                          sys_getcwd

> +111     common  vhangup                         sys_vhangup

> +112     common  fstat64                         sys_fstat64

> +113     common  vfork                           sys_vfork_wrapper

> +114     common  wait4                           sys_wait4                       compat_sys_wait4

> +115     common  swapoff                         sys_swapoff

> +116     common  sysinfo                         sys_sysinfo                     compat_sys_sysinfo

> +117     common  shutdown                        sys_shutdown

> +118     common  fsync                           sys_fsync

> +119     common  madvise                         sys_madvise

> +120     common  clone                           sys_clone_wrapper

> +121     common  setdomainname                   sys_setdomainname

> +122     common  sendfile                        sys_sendfile                    compat_sys_sendfile

> +123     common  recvfrom                        sys_recvfrom

> +124     common  adjtimex                        sys_adjtimex                    compat_sys_adjtimex

> +125     common  mprotect                        sys_mprotect

> +126     common  sigprocmask                     sys_sigprocmask                 compat_sys_sigprocmask

> +# 127 was create_module

> +128     common  init_module                     sys_init_module

> +129     common  delete_module                   sys_delete_module

> +# 130 was get_kernel_syms

> +131     common  quotactl                        sys_quotactl

> +132     common  getpgid                         sys_getpgid

> +133     common  fchdir                          sys_fchdir

> +134     common  bdflush                         sys_bdflush

> +135     common  sysfs                           sys_sysfs

> +136     32      personality                     parisc_personality

> +136     64      personality                     sys_personality

> +# 137 was afs_syscall

> +138     common  setfsuid                        sys_setfsuid

> +139     common  setfsgid                        sys_setfsgid

> +140     common  _llseek                         sys_llseek

> +141     common  getdents                        sys_getdents                    compat_sys_getdents

> +142     common  _newselect                      sys_select                      compat_sys_select

> +143     common  flock                           sys_flock

> +144     common  msync                           sys_msync

> +145     common  readv                           sys_readv                       compat_sys_readv

> +146     common  writev                          sys_writev                      compat_sys_writev

> +147     common  getsid                          sys_getsid

> +148     common  fdatasync                       sys_fdatasync

> +149     common  _sysctl                         sys_sysctl                      compat_sys_sysctl

> +150     common  mlock                           sys_mlock

> +151     common  munlock                         sys_munlock

> +152     common  mlockall                        sys_mlockall

> +153     common  munlockall                      sys_munlockall

> +154     common  sched_setparam                  sys_sched_setparam

> +155     common  sched_getparam                  sys_sched_getparam

> +156     common  sched_setscheduler              sys_sched_setscheduler

> +157     common  sched_getscheduler              sys_sched_getscheduler

> +158     common  sched_yield                     sys_sched_yield

> +159     common  sched_get_priority_max          sys_sched_get_priority_max

> +160     common  sched_get_priority_min          sys_sched_get_priority_min

> +161     common  sched_rr_get_interval           sys_sched_rr_get_interval       compat_sys_sched_rr_get_interval

> +162     common  nanosleep                       sys_nanosleep                   compat_sys_nanosleep

> +163     common  mremap                          sys_mremap

> +164     common  setresuid                       sys_setresuid

> +165     common  getresuid                       sys_getresuid

> +166     common  sigaltstack                     sys_sigaltstack                 compat_sys_sigaltstack

> +# 167 was query_module

> +168     common  poll                            sys_poll

> +# 169 was nfsservctl

> +170     common  setresgid                       sys_setresgid

> +171     common  getresgid                       sys_getresgid

> +172     common  prctl                           sys_prctl

> +173     common  rt_sigreturn                    sys_rt_sigreturn_wrapper

> +174     common  rt_sigaction                    sys_rt_sigaction                compat_sys_rt_sigaction

> +175     common  rt_sigprocmask                  sys_rt_sigprocmask              compat_sys_rt_sigprocmask

> +176     common  rt_sigpending                   sys_rt_sigpending               compat_sys_rt_sigpending

> +177     common  rt_sigtimedwait                 sys_rt_sigtimedwait             compat_sys_rt_sigtimedwait

> +178     common  rt_sigqueueinfo                 sys_rt_sigqueueinfo             compat_sys_rt_sigqueueinfo

> +179     common  rt_sigsuspend                   sys_rt_sigsuspend               compat_sys_rt_sigsuspend

> +180     common  chown                           sys_chown

> +181     common  setsockopt                      sys_setsockopt                  compat_sys_setsockopt

> +182     common  getsockopt                      sys_getsockopt                  compat_sys_getsockopt

> +183     common  sendmsg                         sys_sendmsg                     compat_sys_sendmsg

> +184     common  recvmsg                         sys_recvmsg                     compat_sys_recvmsg

> +185     common  semop                           sys_semop

> +186     common  semget                          sys_semget

> +187     common  semctl                          sys_semctl                      compat_sys_semctl

> +188     common  msgsnd                          sys_msgsnd                      compat_sys_msgsnd

> +189     common  msgrcv                          sys_msgrcv                      compat_sys_msgrcv

> +190     common  msgget                          sys_msgget

> +191     common  msgctl                          sys_msgctl                      compat_sys_msgctl

> +192     common  shmat                           sys_shmat                       compat_sys_shmat

> +193     common  shmdt                           sys_shmdt

> +194     common  shmget                          sys_shmget

> +195     common  shmctl                          sys_shmctl                      compat_sys_shmctl

> +# 196 was getpmsg

> +# 197 was putpmsg

> +198     common  lstat64                         sys_lstat64

> +199     32      truncate64                      parisc_truncate64

> +199     64      truncate64                      sys_truncate64

> +200     32      ftruncate64                     parisc_ftruncate64

> +200     64      ftruncate64                     sys_ftruncate64

> +201     common  getdents64                      sys_getdents64

> +202     common  fcntl64                         sys_fcntl64                     compat_sys_fcntl64

> +# 203 was attrctl

> +# 204 was acl_get

> +# 205 was acl_set

> +206     common  gettid                          sys_gettid

> +207     32      readahead                       parisc_readahead

> +207     64      readahead                       sys_readahead

> +208     common  tkill                           sys_tkill

> +209     common  sendfile64                      sys_sendfile64                  compat_sys_sendfile64

> +210     common  futex                           sys_futex                       compat_sys_futex

> +211     common  sched_setaffinity               sys_sched_setaffinity           compat_sys_sched_setaffinity

> +212     common  sched_getaffinity               sys_sched_getaffinity           compat_sys_sched_getaffinity

> +# 213 was set_thread_area

> +# 214 was get_thread_area

> +215     common  io_setup                        sys_io_setup                    compat_sys_io_setup

> +216     common  io_destroy                      sys_io_destroy

> +217     common  io_getevents                    sys_io_getevents                compat_sys_io_getevents

> +218     common  io_submit                       sys_io_submit                   compat_sys_io_submit

> +219     common  io_cancel                       sys_io_cancel

> +# 220 was alloc_hugepages

> +# 221 was free_hugepages

> +222     common  exit_group                      sys_exit_group

> +223     common  lookup_dcookie                  sys_lookup_dcookie              compat_sys_lookup_dcookie

> +224     common  epoll_create                    sys_epoll_create

> +225     common  epoll_ctl                       sys_epoll_ctl

> +226     common  epoll_wait                      sys_epoll_wait

> +227     common  remap_file_pages                sys_remap_file_pages

> +228     common  semtimedop                      sys_semtimedop                  compat_sys_semtimedop

> +229     common  mq_open                         sys_mq_open                     compat_sys_mq_open

> +230     common  mq_unlink                       sys_mq_unlink

> +231     common  mq_timedsend                    sys_mq_timedsend                compat_sys_mq_timedsend

> +232     common  mq_timedreceive                 sys_mq_timedreceive             compat_sys_mq_timedreceive

> +233     common  mq_notify                       sys_mq_notify                   compat_sys_mq_notify

> +234     common  mq_getsetattr                   sys_mq_getsetattr               compat_sys_mq_getsetattr

> +235     common  waitid                          sys_waitid                      compat_sys_waitid

> +236     32      fadvise64_64                    parisc_fadvise64_64

> +236     64      fadvise64_64                    sys_fadvise64_64

> +237     common  set_tid_address                 sys_set_tid_address

> +238     common  setxattr                        sys_setxattr

> +239     common  lsetxattr                       sys_lsetxattr

> +240     common  fsetxattr                       sys_fsetxattr

> +241     common  getxattr                        sys_getxattr

> +242     common  lgetxattr                       sys_lgetxattr

> +243     common  fgetxattr                       sys_fgetxattr

> +244     common  listxattr                       sys_listxattr

> +245     common  llistxattr                      sys_llistxattr

> +246     common  flistxattr                      sys_flistxattr

> +247     common  removexattr                     sys_removexattr

> +248     common  lremovexattr                    sys_lremovexattr

> +249     common  fremovexattr                    sys_fremovexattr

> +250     common  timer_create                    sys_timer_create                compat_sys_timer_create

> +251     common  timer_settime                   sys_timer_settime               compat_sys_timer_settime

> +252     common  timer_gettime                   sys_timer_gettime               compat_sys_timer_gettime

> +253     common  timer_getoverrun                sys_timer_getoverrun

> +254     common  timer_delete                    sys_timer_delete

> +255     common  clock_settime                   sys_clock_settime               compat_sys_clock_settime

> +256     common  clock_gettime                   sys_clock_gettime               compat_sys_clock_gettime

> +257     common  clock_getres                    sys_clock_getres                compat_sys_clock_getres

> +258     common  clock_nanosleep                 sys_clock_nanosleep             compat_sys_clock_nanosleep

> +259     common  tgkill                          sys_tgkill

> +260     common  mbind                           sys_mbind                       compat_sys_mbind

> +261     common  get_mempolicy                   sys_get_mempolicy               compat_sys_get_mempolicy

> +262     common  set_mempolicy                   sys_set_mempolicy               compat_sys_set_mempolicy

> +# 263 was vserver

> +264     common  add_key                         sys_add_key

> +265     common  request_key                     sys_request_key

> +266     common  keyctl                          sys_keyctl                      compat_sys_keyctl

> +267     common  ioprio_set                      sys_ioprio_set

> +268     common  ioprio_get                      sys_ioprio_get

> +269     common  inotify_init                    sys_inotify_init

> +270     common  inotify_add_watch               sys_inotify_add_watch

> +271     common  inotify_rm_watch                sys_inotify_rm_watch

> +272     common  migrate_pages                   sys_migrate_pages

> +273     common  pselect6                        sys_pselect6                    compat_sys_pselect6

> +274     common  ppoll                           sys_ppoll                       compat_sys_ppoll

> +275     common  openat                          sys_openat                      compat_sys_openat

> +276     common  mkdirat                         sys_mkdirat

> +277     common  mknodat                         sys_mknodat

> +278     common  fchownat                        sys_fchownat

> +279     common  futimesat                       sys_futimesat                   compat_sys_futimesat

> +280     common  fstatat64                       sys_fstatat64

> +281     common  unlinkat                        sys_unlinkat

> +282     common  renameat                        sys_renameat

> +283     common  linkat                          sys_linkat

> +284     common  symlinkat                       sys_symlinkat

> +285     common  readlinkat                      sys_readlinkat

> +286     common  fchmodat                        sys_fchmodat

> +287     common  faccessat                       sys_faccessat

> +288     common  unshare                         sys_unshare

> +289     common  set_robust_list                 sys_set_robust_list             compat_sys_set_robust_list

> +290     common  get_robust_list                 sys_get_robust_list             compat_sys_get_robust_list

> +291     common  splice                          sys_splice

> +292     32      sync_file_range                 parisc_sync_file_range

> +292     64      sync_file_range                 sys_sync_file_range

> +293     common  tee                             sys_tee

> +294     common  vmsplice                        sys_vmsplice                    compat_sys_vmsplice

> +295     common  move_pages                      sys_move_pages                  compat_sys_move_pages

> +296     common  getcpu                          sys_getcpu

> +297     common  epoll_pwait                     sys_epoll_pwait                 compat_sys_epoll_pwait

> +298     common  statfs64                        sys_statfs64                    compat_sys_statfs64

> +299     common  fstatfs64                       sys_fstatfs64                   compat_sys_fstatfs64

> +300     common  kexec_load                      sys_kexec_load                  compat_sys_kexec_load

> +301     common  utimensat                       sys_utimensat                   compat_sys_utimensat

> +302     common  signalfd                        sys_signalfd                    compat_sys_signalfd

> +# 303 was timerfd

> +304     common  eventfd                         sys_eventfd

> +305     32      fallocate                       parisc_fallocate

> +305     64      fallocate                       sys_fallocate

> +306     common  timerfd_create                  sys_timerfd_create

> +307     common  timerfd_settime                 sys_timerfd_settime             compat_sys_timerfd_settime

> +308     common  timerfd_gettime                 sys_timerfd_gettime             compat_sys_timerfd_gettime

> +309     common  signalfd4                       sys_signalfd4                   compat_sys_signalfd4

> +310     common  eventfd2                        sys_eventfd2

> +311     common  epoll_create1                   sys_epoll_create1

> +312     common  dup3                            sys_dup3

> +313     common  pipe2                           sys_pipe2

> +314     common  inotify_init1                   sys_inotify_init1

> +315     common  preadv                          sys_preadv                      compat_sys_preadv

> +316     common  pwritev                         sys_pwritev                     compat_sys_pwritev

> +317     common  rt_tgsigqueueinfo               sys_rt_tgsigqueueinfo           compat_sys_rt_tgsigqueueinfo

> +318     common  perf_event_open                 sys_perf_event_open

> +319     common  recvmmsg                        sys_recvmmsg                    compat_sys_recvmmsg

> +320     common  accept4                         sys_accept4

> +321     common  prlimit64                       sys_prlimit64

> +322     common  fanotify_init                   sys_fanotify_init

> +323     common  fanotify_mark                   sys_fanotify_mark               sys32_fanotify_mark

> +324     common  clock_adjtime                   sys_clock_adjtime               compat_sys_clock_adjtime

> +325     common  name_to_handle_at               sys_name_to_handle_at

> +326     common  open_by_handle_at               sys_open_by_handle_at           compat_sys_open_by_handle_at

> +327     common  syncfs                          sys_syncfs

> +328     common  setns                           sys_setns

> +329     common  sendmmsg                        sys_sendmmsg                    compat_sys_sendmmsg

> +330     common  process_vm_readv                sys_process_vm_readv            compat_sys_process_vm_readv

> +331     common  process_vm_writev               sys_process_vm_writev           compat_sys_process_vm_writev

> +332     common  kcmp                            sys_kcmp

> +333     common  finit_module                    sys_finit_module

> +334     common  sched_setattr                   sys_sched_setattr

> +335     common  sched_getattr                   sys_sched_getattr

> +336     common  utimes                          sys_utimes                      compat_sys_utimes

> +337     common  renameat2                       sys_renameat2

> +338     common  seccomp                         sys_seccomp

> +339     common  getrandom                       sys_getrandom

> +340     common  memfd_create                    sys_memfd_create

> +341     common  bpf                             sys_bpf

> +342     common  execveat                        sys_execveat                    compat_sys_execveat

> +343     common  membarrier                      sys_membarrier

> +344     common  userfaultfd                     sys_userfaultfd

> +345     common  mlock2                          sys_mlock2

> +346     common  copy_file_range                 sys_copy_file_range

> +347     common  preadv2                         sys_preadv2                     compat_sys_preadv2

> +348     common  pwritev2                        sys_pwritev2                    compat_sys_pwritev2

> +349     common  statx                           sys_statx

> +350    common  io_pgetevents                   sys_io_pgetevents               compat_sys_io_pgetevents

> \ No newline at end of file

> diff --git a/arch/parisc/kernel/syscalls/syscallhdr.sh b/arch/parisc/kernel/syscalls/syscallhdr.sh

> new file mode 100644

> index 0000000..607d4ca

> --- /dev/null

> +++ b/arch/parisc/kernel/syscalls/syscallhdr.sh

> @@ -0,0 +1,35 @@

> +#!/bin/sh

> +# SPDX-License-Identifier: GPL-2.0

> +

> +in="$1"

> +out="$2"

> +my_abis=`echo "($3)" | tr ',' '|'`

> +prefix="$4"

> +offset="$5"

> +

> +fileguard=_UAPI_ASM_PARISC_`basename "$out" | sed \

> +    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \

> +    -e 's/[^A-Z0-9_]/_/g' -e 's/__/_/g'`

> +grep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | (

> +    echo "#ifndef ${fileguard}"

> +    echo "#define ${fileguard}"

> +    echo ""

> +

> +    nxt=0

> +    while read nr abi name entry compat ; do

> +       if [ -z "$offset" ]; then

> +           echo -e "#define __NR_${prefix}${name}\t$nr"

> +       else

> +           echo -e "#define __NR_${prefix}${name}\t($offset + $nr)"

> +       fi

> +       nxt=$nr

> +       let nxt=nxt+1

> +    done

> +

> +    echo ""

> +    echo "#ifdef __KERNEL__"

> +    echo -e "#define __NR_syscalls\t$nxt"

> +    echo "#endif"

> +    echo ""

> +    echo "#endif /* ${fileguard} */"

> +) > "$out"

> diff --git a/arch/parisc/kernel/syscalls/syscalltbl.sh b/arch/parisc/kernel/syscalls/syscalltbl.sh

> new file mode 100644

> index 0000000..04abde7

> --- /dev/null

> +++ b/arch/parisc/kernel/syscalls/syscalltbl.sh

> @@ -0,0 +1,46 @@

> +#!/bin/sh

> +# SPDX-License-Identifier: GPL-2.0

> +

> +in="$1"

> +out="$2"

> +my_abis=`echo "($3)" | tr ',' '|'`

> +offset="$4"

> +

> +emit() {

> +    nxt="$1"

> +    if [ -z "$offset" ]; then

> +       nr="$2"

> +    else

> +       nr="$2"

> +       nr=$((nr+offset))

> +    fi

> +    entry="$3"

> +

> +    while [ $nxt -lt $nr ]; do

> +       echo "__SYSCALL($nxt, sys_ni_syscall, )"

> +        let nxt=nxt+1

> +    done

> +    echo "__SYSCALL($nxt, $entry, )"

> +}

> +

> +grep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | (

> +    if [ -z "$offset" ]; then

> +       nxt=0

> +    else

> +       nxt=$offset

> +    fi

> +

> +    my_abi="$(cut -d'|' -f2 <<< $my_abis)"

> +    while read nr abi name entry compat ; do

> +       if [ $my_abi = "compat" ]; then

> +           if [ -z "$compat" ]; then

> +               emit $nxt $nr $entry

> +           else

> +               emit $nxt $nr $compat

> +           fi

> +       else

> +           emit $nxt $nr $entry

> +       fi

> +        let nxt=nxt+1

> +    done

> +) > "$out"


Appreciate if someone can review this script!

Firoz

> --

> 1.9.1

>
Arnd Bergmann Oct. 12, 2018, 11:51 a.m. UTC | #2
On Fri, Oct 12, 2018 at 11:45 AM Firoz Khan <firoz.khan@linaro.org> wrote:

> diff --git a/arch/parisc/kernel/syscalls/Makefile b/arch/parisc/kernel/syscalls/Makefile

> new file mode 100644

> index 0000000..a0af5a3

> --- /dev/null

> +++ b/arch/parisc/kernel/syscalls/Makefile


> +syshdr_abi_unistd_32 := common,32

> +syshdr_offset_unistd_32 := __NR_Linux

> +$(uapi)/unistd_32.h: $(syscall) $(syshdr)

> +       $(call if_changed,syshdr)

> +

> +syshdr_abi_unistd_64 := common,64

> +syshdr_offset_unistd_64 := __NR_Linux

> +$(uapi)/unistd_64.h: $(syscall) $(syshdr)

> +       $(call if_changed,syshdr)


The __NR_Linux seems misplaced here, don't we need that only for ia64
and mips?

> +systbl_abi_syscall_table_32 := common,32

> +$(kapi)/syscall_table_32.h: $(syscall) $(systbl)

> +       $(call if_changed,systbl)

> +

> +systbl_abi_syscall_table_64 := common,64

> +$(kapi)/syscall_table_64.h: $(syscall) $(systbl)

> +       $(call if_changed,systbl)


Have you considered making the 'common' part implied?
I expected to see it done that way, although listing it explicitly
doesn't seem harmful either.

> +systbl_abi_syscall_table_c32 := common,compat,32

> +$(kapi)/syscall_table_c32.h: $(syscall) $(systbl)

> +       $(call if_changed,systbl)


The way you specify 'compat' as one item in a list of
ABIs seems rather odd, I'd suggest keeping that a separate
flag.

I think you can also pass arguments to 'if_changed', rather than
setting a global variable to control it.
arch/powerpc/boot/Makefile has some examples of that.
It should be possible to do this like

$(kapi)/syscall_table_c32.h: $(syscall) $(systbl)
       $(call if_changed,systbl,common|32,compat)

Passing "common|32" as the list of ABIs in the first argument,
and 'compat' as the second argument.

> diff --git a/arch/parisc/kernel/syscalls/syscall.tbl b/arch/parisc/kernel/syscalls/syscall.tbl

> new file mode 100644

> index 0000000..7c9f268

> --- /dev/null

> +++ b/arch/parisc/kernel/syscalls/syscall.tbl

...
> +346     common  copy_file_range                 sys_copy_file_range

> +347     common  preadv2                         sys_preadv2                     compat_sys_preadv2

> +348     common  pwritev2                        sys_pwritev2                    compat_sys_pwritev2

> +349     common  statx                           sys_statx

> +350    common  io_pgetevents                   sys_io_pgetevents               compat_sys_io_pgetevents

> \ No newline at end of file


Here is the missing newline again. This should never happen if your text
editor is configured correctly.

> diff --git a/arch/parisc/kernel/syscalls/syscallhdr.sh b/arch/parisc/kernel/syscalls/syscallhdr.sh

> new file mode 100644

> index 0000000..607d4ca

> --- /dev/null

> +++ b/arch/parisc/kernel/syscalls/syscallhdr.sh

> @@ -0,0 +1,35 @@

> +#!/bin/sh

> +# SPDX-License-Identifier: GPL-2.0

> +

> +in="$1"

> +out="$2"

> +my_abis=`echo "($3)" | tr ',' '|'`

> +prefix="$4"

> +offset="$5"

> +

> +fileguard=_UAPI_ASM_PARISC_`basename "$out" | sed \

> +    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \

> +    -e 's/[^A-Z0-9_]/_/g' -e 's/__/_/g'`


Maybe use ${ARCH} instead of PARISC here to keep it the same
across architectures?

> +    my_abi="$(cut -d'|' -f2 <<< $my_abis)"

> +    while read nr abi name entry compat ; do

> +       if [ $my_abi = "compat" ]; then


This check seems really fragile, but if you add another argument to the
script instead of listing "compat" as the second option in the
list of ABIs, I think it's fine.

        ARnd
Rolf Eike Beer Oct. 12, 2018, 12:07 p.m. UTC | #3
Firoz Khan wrote:

> diff --git a/arch/parisc/kernel/syscalls/syscallhdr.sh

> b/arch/parisc/kernel/syscalls/syscallhdr.sh

> new file mode 100644

> index 0000000..607d4ca

> --- /dev/null

> +++ b/arch/parisc/kernel/syscalls/syscallhdr.sh

> @@ -0,0 +1,35 @@

> +#!/bin/sh

> +# SPDX-License-Identifier: GPL-2.0

> +

> +in="$1"

> +out="$2"

> +my_abis=`echo "($3)" | tr ',' '|'`


Any reason not to use $() instead of backticks?

> +prefix="$4"

> +offset="$5"

> +

> +fileguard=_UAPI_ASM_PARISC_`basename "$out" | sed \

> +    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \

> +    -e 's/[^A-Z0-9_]/_/g' -e 's/__/_/g'`

> +grep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | (

> +    echo "#ifndef ${fileguard}"

> +    echo "#define ${fileguard}"

> +    echo ""

> +

> +    nxt=0

> +    while read nr abi name entry compat ; do

> +	if [ -z "$offset" ]; then

> +	    echo -e "#define __NR_${prefix}${name}\t$nr"


This mixed indentation with both tabs and spaces is a bit messy.

> +	else

> +	    echo -e "#define __NR_${prefix}${name}\t($offset + $nr)"

> +	fi

> +	nxt=$nr

> +	let nxt=nxt+1


Why do you use let here when you do $(()) calculations at other places?

> +    done

> +

> +    echo ""

> +    echo "#ifdef __KERNEL__"

> +    echo -e "#define __NR_syscalls\t$nxt"

> +    echo "#endif"

> +    echo ""

> +    echo "#endif /* ${fileguard} */"

> +) > "$out"

> diff --git a/arch/parisc/kernel/syscalls/syscalltbl.sh

> b/arch/parisc/kernel/syscalls/syscalltbl.sh

> new file mode 100644

> index 0000000..04abde7

> --- /dev/null

> +++ b/arch/parisc/kernel/syscalls/syscalltbl.sh

> @@ -0,0 +1,46 @@

> +#!/bin/sh

> +# SPDX-License-Identifier: GPL-2.0

> +

> +in="$1"

> +out="$2"

> +my_abis=`echo "($3)" | tr ',' '|'`

> +offset="$4"

> +

> +emit() {

> +    nxt="$1"

> +    if [ -z "$offset" ]; then

> +	nr="$2"

> +    else

> +	nr="$2"

> +	nr=$((nr+offset))


This could be one line, no? Or just set offset to 0 if it is empty and 
avoid that if alltogether.

> +    fi

> +    entry="$3"

> +

> +    while [ $nxt -lt $nr ]; do

> +	echo "__SYSCALL($nxt, sys_ni_syscall, )"

> +        let nxt=nxt+1

> +    done

> +    echo "__SYSCALL($nxt, $entry, )"

> +}

> +

> +grep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | (

> +    if [ -z "$offset" ]; then

> +	nxt=0

> +    else

> +	nxt=$offset

> +    fi


Another argument for offset=0 as default.

> +

> +    my_abi="$(cut -d'|' -f2 <<< $my_abis)"


"<<<" is a bash extension and will not work with /bin/sh.

> +    while read nr abi name entry compat ; do

> +	if [ $my_abi = "compat" ]; then

> +	    if [ -z "$compat" ]; then

> +		emit $nxt $nr $entry

> +	    else

> +		emit $nxt $nr $compat

> +	    fi

> +	else

> +	    emit $nxt $nr $entry

> +	fi


I would go for a local variable being set to $compat or $entry and 
calling emit at only one place. And there should be only one if with 2 
expressions, no need for 3 branches.

> +        let nxt=nxt+1


Inconsistent indentation.

> +    done

> +) > "$out"


Eike
Firoz Khan Oct. 12, 2018, 1:57 p.m. UTC | #4
Hi Arnd, Rolf,

Thanks for the comments. It will help me to fine tune my scripts!

On Fri, 12 Oct 2018 at 17:37, Rolf Eike Beer <eike-kernel@sf-tec.de> wrote:
>

> Firoz Khan wrote:

>

> > diff --git a/arch/parisc/kernel/syscalls/syscallhdr.sh

> > b/arch/parisc/kernel/syscalls/syscallhdr.sh

> > new file mode 100644

> > index 0000000..607d4ca

> > --- /dev/null

> > +++ b/arch/parisc/kernel/syscalls/syscallhdr.sh

> > @@ -0,0 +1,35 @@

> > +#!/bin/sh

> > +# SPDX-License-Identifier: GPL-2.0

> > +

> > +in="$1"

> > +out="$2"

> > +my_abis=`echo "($3)" | tr ',' '|'`

>

> Any reason not to use $() instead of backticks?

>

> > +prefix="$4"

> > +offset="$5"

> > +

> > +fileguard=_UAPI_ASM_PARISC_`basename "$out" | sed \

> > +    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \

> > +    -e 's/[^A-Z0-9_]/_/g' -e 's/__/_/g'`

> > +grep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | (

> > +    echo "#ifndef ${fileguard}"

> > +    echo "#define ${fileguard}"

> > +    echo ""

> > +

> > +    nxt=0

> > +    while read nr abi name entry compat ; do

> > +     if [ -z "$offset" ]; then

> > +         echo -e "#define __NR_${prefix}${name}\t$nr"

>

> This mixed indentation with both tabs and spaces is a bit messy.

>

> > +     else

> > +         echo -e "#define __NR_${prefix}${name}\t($offset + $nr)"

> > +     fi

> > +     nxt=$nr

> > +     let nxt=nxt+1

>

> Why do you use let here when you do $(()) calculations at other places?

>

> > +    done

> > +

> > +    echo ""

> > +    echo "#ifdef __KERNEL__"

> > +    echo -e "#define __NR_syscalls\t$nxt"

> > +    echo "#endif"

> > +    echo ""

> > +    echo "#endif /* ${fileguard} */"

> > +) > "$out"

> > diff --git a/arch/parisc/kernel/syscalls/syscalltbl.sh

> > b/arch/parisc/kernel/syscalls/syscalltbl.sh

> > new file mode 100644

> > index 0000000..04abde7

> > --- /dev/null

> > +++ b/arch/parisc/kernel/syscalls/syscalltbl.sh

> > @@ -0,0 +1,46 @@

> > +#!/bin/sh

> > +# SPDX-License-Identifier: GPL-2.0

> > +

> > +in="$1"

> > +out="$2"

> > +my_abis=`echo "($3)" | tr ',' '|'`

> > +offset="$4"

> > +

> > +emit() {

> > +    nxt="$1"

> > +    if [ -z "$offset" ]; then

> > +     nr="$2"

> > +    else

> > +     nr="$2"

> > +     nr=$((nr+offset))

>

> This could be one line, no? Or just set offset to 0 if it is empty and

> avoid that if alltogether.

>

> > +    fi

> > +    entry="$3"

> > +

> > +    while [ $nxt -lt $nr ]; do

> > +     echo "__SYSCALL($nxt, sys_ni_syscall, )"

> > +        let nxt=nxt+1

> > +    done

> > +    echo "__SYSCALL($nxt, $entry, )"

> > +}

> > +

> > +grep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | (

> > +    if [ -z "$offset" ]; then

> > +     nxt=0

> > +    else

> > +     nxt=$offset

> > +    fi

>

> Another argument for offset=0 as default.

>

> > +

> > +    my_abi="$(cut -d'|' -f2 <<< $my_abis)"


Here is the logic of identifying the generated script is for compat interface
or not. So systbl_abi_syscall_table_c32 := common,compat,32 in Makefile
will parse the script and check the second string whether this is
"compat" or not.

Other ways are:
1. add an extra flag, that will again add the complexity
2. check if [ ${out: -5} = "c32.h" ], this looks weird

Is there any better way to do the same?

>

> "<<<" is a bash extension and will not work with /bin/sh.

>

> > +    while read nr abi name entry compat ; do

> > +     if [ $my_abi = "compat" ]; then

> > +         if [ -z "$compat" ]; then

> > +             emit $nxt $nr $entry

> > +         else

> > +             emit $nxt $nr $compat

> > +         fi

> > +     else

> > +         emit $nxt $nr $entry

> > +     fi

>

> I would go for a local variable being set to $compat or $entry and

> calling emit at only one place. And there should be only one if with 2

> expressions, no need for 3 branches.

>

> > +        let nxt=nxt+1

>

> Inconsistent indentation.

>

> > +    done

> > +) > "$out"


I'll address rest of the comment soon.

Helge, I can update this patches asap with their comments and we can
perform the
boot test with next version. And thanks for your great support!

Firoz

>

> Eike
Rolf Eike Beer Oct. 12, 2018, 2:03 p.m. UTC | #5
Firoz Khan wrote:

>> > +

>> > +    my_abi="$(cut -d'|' -f2 <<< $my_abis)"

> 

> Here is the logic of identifying the generated script is for compat 

> interface

> or not. So systbl_abi_syscall_table_c32 := common,compat,32 in Makefile

> will parse the script and check the second string whether this is

> "compat" or not.

> 

> Other ways are:

> 1. add an extra flag, that will again add the complexity

> 2. check if [ ${out: -5} = "c32.h" ], this looks weird

> 

> Is there any better way to do the same?


What part is that comment directed at? I guess it's the next hunk, so 
I'll comment on that.

>> "<<<" is a bash extension and will not work with /bin/sh.

>> 

>> > +    while read nr abi name entry compat ; do

>> > +     if [ $my_abi = "compat" ]; then

>> > +         if [ -z "$compat" ]; then

>> > +             emit $nxt $nr $entry

>> > +         else

>> > +             emit $nxt $nr $compat

>> > +         fi

>> > +     else

>> > +         emit $nxt $nr $entry

>> > +     fi

>> 

>> I would go for a local variable being set to $compat or $entry and

>> calling emit at only one place. And there should be only one if with 2

>> expressions, no need for 3 branches.


if [ $my_abi = "compat" -a -n "${compat}" ]; then
     somevar=${compat}
else
     somevar=${entry}
fi
emit $nxt $nr $somevar

Eike
Firoz Khan Oct. 13, 2018, 3:34 p.m. UTC | #6
+ Rolf
Hi Arnd, Helge, Rolf,

On Fri, 12 Oct 2018 at 17:21, Arnd Bergmann <arnd@arndb.de> wrote:
>

> On Fri, Oct 12, 2018 at 11:45 AM Firoz Khan <firoz.khan@linaro.org> wrote:

>

> > diff --git a/arch/parisc/kernel/syscalls/Makefile b/arch/parisc/kernel/syscalls/Makefile

> > new file mode 100644

> > index 0000000..a0af5a3

> > --- /dev/null

> > +++ b/arch/parisc/kernel/syscalls/Makefile

>

> > +syshdr_abi_unistd_32 := common,32

> > +syshdr_offset_unistd_32 := __NR_Linux

> > +$(uapi)/unistd_32.h: $(syscall) $(syshdr)

> > +       $(call if_changed,syshdr)

> > +

> > +syshdr_abi_unistd_64 := common,64

> > +syshdr_offset_unistd_64 := __NR_Linux

> > +$(uapi)/unistd_64.h: $(syscall) $(syshdr)

> > +       $(call if_changed,syshdr)

>

> The __NR_Linux seems misplaced here, don't we need that only for ia64

> and mips?


No, It wasn't misplaced. you can refer below link.
https://github.com/torvalds/linux/blob/master/arch/parisc/include/uapi/asm/unistd.h#L16

FYI, In IA64, I added the __NR_Linux to come up a generic .tbl file
starts with 0 as a part
system call table generation. I think you might be applied my IA64
patches locally sometimes
before and now you might be confused.
https://github.com/torvalds/linux/blob/master/arch/ia64/include/uapi/asm/unistd.h

Yes, MIPS also uses this macro.

>

> > +systbl_abi_syscall_table_32 := common,32

> > +$(kapi)/syscall_table_32.h: $(syscall) $(systbl)

> > +       $(call if_changed,systbl)

> > +

> > +systbl_abi_syscall_table_64 := common,64

> > +$(kapi)/syscall_table_64.h: $(syscall) $(systbl)

> > +       $(call if_changed,systbl)

>

> Have you considered making the 'common' part implied?

> I expected to see it done that way, although listing it explicitly

> doesn't seem harmful either.


It can't be done in that way easily, I see some problem there existing script.

The problem you will understand by removing "common" and run the script.
You can do diff before and after the generated files.
ref: grep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | (

FYI, x86/arm/s390 implementation listing explicitly! So I almost followed
there way of implementation.

If you really want that way, please comment here. I need to redo the
scripting for
all 10 architecture.

>

> > +systbl_abi_syscall_table_c32 := common,compat,32

> > +$(kapi)/syscall_table_c32.h: $(syscall) $(systbl)

> > +       $(call if_changed,systbl)

>

> The way you specify 'compat' as one item in a list of

> ABIs seems rather odd, I'd suggest keeping that a separate

> flag.


Commented below.

>

> Passing "common|32" as the list of ABIs in the first argument,

> and 'compat' as the second argument.

>

> I think you can also pass arguments to 'if_changed', rather than

> setting a global variable to control it.


Sure. I'll have a look into this one!

> arch/powerpc/boot/Makefile has some examples of that.

> It should be possible to do this like

>

> $(kapi)/syscall_table_c32.h: $(syscall) $(systbl)

>        $(call if_changed,systbl,common|32,compat)


This is something interesting!
Rolf, I was trying to explain this one yesterday. Sorry, I know I
haven't composed
the mail properly.

The uapi header generation script syscall table header generation script is
invoked by this Makefile.

systbl_abi_syscall_table_32 := common,32
$(kapi)/syscall_table_32.h: $(syscall) $(systbl)
        $(call if_changed,systbl)

Here I want to generate systbl_abi_syscall_table_32, so I'll pass few
args including the .tbl file.
So script must have to identify that it is for 32. It has to read 4th
column as <32/64 entry point>
from the .tbl file.

# The format is:
# <number> <abi> <name> <32/64 entry point> <compat entry point>
5       common  open                            sys_open
         compat_sys_open

Similarly for 64 also. Same 4th column should have to read.

systbl_abi_syscall_table_c32 := common,compat,32
$(kapi)/syscall_table_c32.h: $(syscall) $(systbl)
        $(call if_changed,systbl)

But for compat interface either it has to read 5th column if present,
otherwise 4th column.
Script won't understand it is for compat unless we have to explicitly
inform from Makefile.

There are multiple way to do:

1. This implementation
systbl_abi_syscall_table_c32 := common,compat,32 /* Makefile */

my_abi="$(cut -d'|' -f2 <<< $my_abis)" /*systbl.sh */
if [ $my_abi = "compat" ]; then
            if [ -z "$compat" ]; then
                emit $nxt $nr $entry
            else
                emit $nxt $nr $compat
            fi
        else
            emit $nxt $nr $entry
        fi

2. Add extra flag in the Makefile

systbl_abi_syscall_table_c32 := common,32
systbl_xyz_syscall_table_c32 := compat
$(kapi)/syscall_table_c32.h: $(syscall) $(systbl)
        $(call if_changed,systbl)

and check from the script and identify it.
This looks the direct method. Here I think the problem is
adding one more args

3. Without Makefile change we can identify it. No need to add extra flag

Makefile
------------
systbl_abi_syscall_table_c32 := common,32
$(kapi)/syscall_table_c32.h: $(syscall) $(systbl)
        $(call if_changed,systbl)

systbl.sh
-------------
    if [ ${out: -5} = "c32.h" ]; then
            if [ -z "$compat" ]; then
                emit $nxt $nr $entry
            else
                emit $nxt $nr $compat
            fi
        elif [ ${out: -4} = "64.h" -o  ${out: -4} = "32.h" ]; then
            emit $nxt $nr $entry
        fi

Here I was asking is there any better way to do the same.

Note: The name compat in Makefile may change to c32.
Note: This implementation remain same for spark and powerpc
hopefully. But Mips has extra one more interface. We need to consider
that also here.

>

> > diff --git a/arch/parisc/kernel/syscalls/syscall.tbl b/arch/parisc/kernel/syscalls/syscall.tbl

> > new file mode 100644

> > index 0000000..7c9f268

> > --- /dev/null

> > +++ b/arch/parisc/kernel/syscalls/syscall.tbl

> ...

> > +346     common  copy_file_range                 sys_copy_file_range

> > +347     common  preadv2                         sys_preadv2                     compat_sys_preadv2

> > +348     common  pwritev2                        sys_pwritev2                    compat_sys_pwritev2

> > +349     common  statx                           sys_statx

> > +350    common  io_pgetevents                   sys_io_pgetevents               compat_sys_io_pgetevents

> > \ No newline at end of file

>

> Here is the missing newline again. This should never happen if your text

> editor is configured correctly.

>

> > diff --git a/arch/parisc/kernel/syscalls/syscallhdr.sh b/arch/parisc/kernel/syscalls/syscallhdr.sh

> > new file mode 100644

> > index 0000000..607d4ca

> > --- /dev/null

> > +++ b/arch/parisc/kernel/syscalls/syscallhdr.sh

> > @@ -0,0 +1,35 @@

> > +#!/bin/sh

> > +# SPDX-License-Identifier: GPL-2.0

> > +

> > +in="$1"

> > +out="$2"

> > +my_abis=`echo "($3)" | tr ',' '|'`

> > +prefix="$4"

> > +offset="$5"

> > +

> > +fileguard=_UAPI_ASM_PARISC_`basename "$out" | sed \

> > +    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \

> > +    -e 's/[^A-Z0-9_]/_/g' -e 's/__/_/g'`

>

> Maybe use ${ARCH} instead of PARISC here to keep it the same

> across architectures?


Sure. FYI, x86/arm/s390 has the above implementation,

>

> > +    my_abi="$(cut -d'|' -f2 <<< $my_abis)"

> > +    while read nr abi name entry compat ; do

> > +       if [ $my_abi = "compat" ]; then

>

> This check seems really fragile, but if you add another argument to the

> script instead of listing "compat" as the second option in the

> list of ABIs, I think it's fine.


Hmm. Please share ur comment in the above for the same.

Thanks
Firoz

>

>         ARnd
Eugene Syromiatnikov Oct. 14, 2018, 1:06 a.m. UTC | #7
On Fri, Oct 12, 2018 at 03:13:59PM +0530, Firoz Khan wrote:
> diff --git a/arch/parisc/kernel/syscalls/syscall.tbl b/arch/parisc/kernel/syscalls/syscall.tbl

> new file mode 100644

> index 0000000..7c9f268


> +86      common  uselib                          sys_ni_syscall


Again, why is this definition left, while others have been removed?

> +348     common  pwritev2                        sys_pwritev2                    compat_sys_pwritev2

> +349     common  statx                           sys_statx

> +350	common  io_pgetevents			sys_io_pgetevents		compat_sys_io_pgetevents


Tab instead of spaces.

> diff --git a/arch/parisc/kernel/syscalls/syscallhdr.sh b/arch/parisc/kernel/syscalls/syscallhdr.sh

> new file mode 100644

> index 0000000..607d4ca

> --- /dev/null

> +++ b/arch/parisc/kernel/syscalls/syscallhdr.sh

> @@ -0,0 +1,35 @@

> +#!/bin/sh


/bin/sh -efu

> +# SPDX-License-Identifier: GPL-2.0


"export LANG=C", due to usage of sed/grep/sort.

> +

> +in="$1"

> +out="$2"

> +my_abis=`echo "($3)" | tr ',' '|'`

> +prefix="$4"

> +offset="$5"

> +

> +fileguard=_UAPI_ASM_PARISC_`basename "$out" | sed \

> +    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \

> +    -e 's/[^A-Z0-9_]/_/g' -e 's/__/_/g'`

> +grep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | (


grep -E '^[[:xdigit:]Xx]+[[:space:]]+'"${my_abis}" "$in"
sort -n -k1,1

> +    echo "#ifndef ${fileguard}"

> +    echo "#define ${fileguard}"

> +    echo ""


	cat <<-EOF
		#ifndef ${fileguard}
		#define ${fileguard}

	EOF

> +

> +    nxt=0

> +    while read nr abi name entry compat ; do

> +	if [ -z "$offset" ]; then

> +	    echo -e "#define __NR_${prefix}${name}\t$nr"

> +	else

> +	    echo -e "#define __NR_${prefix}${name}\t($offset + $nr)"

> +	fi


echo options are not portable; something like

	printf "#define __NR_%s%s\t(%s + %s)" "${prefix}" "${name}" "${offset}" "${nr}"

> +	nxt=$nr

> +	let nxt=nxt+1


"let" is a bash extension, posix-conformant expression would be

	nxt=$((nr + 1))

(I would also check that nr >= nxt, however)

> +    done

> +

> +    echo ""

> +    echo "#ifdef __KERNEL__"

> +    echo -e "#define __NR_syscalls\t$nxt"

> +    echo "#endif"

> +    echo ""

> +    echo "#endif /* ${fileguard} */"


	cat <<-EOF

		#ifdef __KERNEL__
		# define __NR_syscalls\t${nxt}
		#endif

		#endif /* ${fileguard} */
	EOF

> +) > "$out"

> diff --git a/arch/parisc/kernel/syscalls/syscalltbl.sh b/arch/parisc/kernel/syscalls/syscalltbl.sh

> new file mode 100644

> index 0000000..04abde7

> --- /dev/null

> +++ b/arch/parisc/kernel/syscalls/syscalltbl.sh

> @@ -0,0 +1,46 @@

> +#!/bin/sh

> +# SPDX-License-Identifier: GPL-2.0

> +

> +in="$1"

> +out="$2"

> +my_abis=`echo "($3)" | tr ',' '|'`

> +offset="$4"

> +

> +emit() {

> +    nxt="$1"

> +    if [ -z "$offset" ]; then

> +	nr="$2"

> +    else

> +	nr="$2"

> +	nr=$((nr+offset))

> +    fi

> +    entry="$3"

> +

> +    while [ $nxt -lt $nr ]; do


It would break nicely if nxt="-n x -o 1" or something like that.

> +	echo "__SYSCALL($nxt, sys_ni_syscall, )"

> +        let nxt=nxt+1

> +    done

> +    echo "__SYSCALL($nxt, $entry, )"

> +}

> +

> +grep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | (

> +    if [ -z "$offset" ]; then

> +	nxt=0

> +    else

> +	nxt=$offset

> +    fi

> +

> +    my_abi="$(cut -d'|' -f2 <<< $my_abis)"


	my_abi="${my_abis#*|}"

But it looks like that $my_abis includes parentheses and this code
is broken.

> +    while read nr abi name entry compat ; do

> +	if [ $my_abi = "compat" ]; then

> +	    if [ -z "$compat" ]; then

> +		emit $nxt $nr $entry

> +	    else

> +		emit $nxt $nr $compat

> +	    fi

> +	else

> +	    emit $nxt $nr $entry

> +	fi

> +        let nxt=nxt+1

> +    done

> +) > "$out"

> -- 

> 1.9.1

>
Firoz Khan Oct. 15, 2018, 4:48 a.m. UTC | #8
Hi Rolf,

On Fri, 12 Oct 2018 at 17:37, Rolf Eike Beer <eike-kernel@sf-tec.de> wrote:
>

> Firoz Khan wrote:

>

> > diff --git a/arch/parisc/kernel/syscalls/syscallhdr.sh

> > b/arch/parisc/kernel/syscalls/syscallhdr.sh

> > new file mode 100644

> > index 0000000..607d4ca

> > --- /dev/null

> > +++ b/arch/parisc/kernel/syscalls/syscallhdr.sh

> > @@ -0,0 +1,35 @@

> > +#!/bin/sh

> > +# SPDX-License-Identifier: GPL-2.0

> > +

> > +in="$1"

> > +out="$2"

> > +my_abis=`echo "($3)" | tr ',' '|'`

>

> Any reason not to use $() instead of backticks?


I got this frame work from x86/entry/syscalls;
https://github.com/torvalds/linux/blob/master/arch/x86/entry/syscalls/syscallhdr.sh
I haven't modified the script but I tune this script to meet my requirements.

Sure, I'll look into this.

>

> > +prefix="$4"

> > +offset="$5"

> > +

> > +fileguard=_UAPI_ASM_PARISC_`basename "$out" | sed \

> > +    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \

> > +    -e 's/[^A-Z0-9_]/_/g' -e 's/__/_/g'`

> > +grep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | (

> > +    echo "#ifndef ${fileguard}"

> > +    echo "#define ${fileguard}"

> > +    echo ""

> > +

> > +    nxt=0

> > +    while read nr abi name entry compat ; do

> > +     if [ -z "$offset" ]; then

> > +         echo -e "#define __NR_${prefix}${name}\t$nr"

>

> This mixed indentation with both tabs and spaces is a bit messy.


Is this what you suggested?
-           echo -e "#define __NR_${prefix}${name}\t$nr"
+           echo "#define __NR_${prefix}${name} $nr"

>

> > +     else

> > +         echo -e "#define __NR_${prefix}${name}\t($offset + $nr)"

> > +     fi

> > +     nxt=$nr

> > +     let nxt=nxt+1

>

> Why do you use let here when you do $(()) calculations at other places?


Yes, will do this.
-        nxt=$nr
-        let nxt=nxt+1
+        nxt=$((nxt+1))

>

> > +    done

> > +

> > +    echo ""

> > +    echo "#ifdef __KERNEL__"

> > +    echo -e "#define __NR_syscalls\t$nxt"

> > +    echo "#endif"

> > +    echo ""

> > +    echo "#endif /* ${fileguard} */"

> > +) > "$out"

> > diff --git a/arch/parisc/kernel/syscalls/syscalltbl.sh

> > b/arch/parisc/kernel/syscalls/syscalltbl.sh

> > new file mode 100644

> > index 0000000..04abde7

> > --- /dev/null

> > +++ b/arch/parisc/kernel/syscalls/syscalltbl.sh

> > @@ -0,0 +1,46 @@

> > +#!/bin/sh

> > +# SPDX-License-Identifier: GPL-2.0

> > +

> > +in="$1"

> > +out="$2"

> > +my_abis=`echo "($3)" | tr ',' '|'`

> > +offset="$4"

> > +

> > +emit() {

> > +    nxt="$1"

> > +    if [ -z "$offset" ]; then

> > +     nr="$2"

> > +    else

> > +     nr="$2"

> > +     nr=$((nr+offset))

>

> This could be one line, no? Or just set offset to 0 if it is empty and

> avoid that if alltogether.


Sure!

>

> > +    fi

> > +    entry="$3"

> > +

> > +    while [ $nxt -lt $nr ]; do

> > +     echo "__SYSCALL($nxt, sys_ni_syscall, )"

> > +        let nxt=nxt+1

> > +    done

> > +    echo "__SYSCALL($nxt, $entry, )"

> > +}

> > +

> > +grep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | (

> > +    if [ -z "$offset" ]; then

> > +     nxt=0

> > +    else

> > +     nxt=$offset

> > +    fi

>

> Another argument for offset=0 as default.


Sure.

>

> > +

> > +    my_abi="$(cut -d'|' -f2 <<< $my_abis)"

>

> "<<<" is a bash extension and will not work with /bin/sh.


Ohh, ok

>

> > +    while read nr abi name entry compat ; do

> > +     if [ $my_abi = "compat" ]; then

> > +         if [ -z "$compat" ]; then

> > +             emit $nxt $nr $entry

> > +         else

> > +             emit $nxt $nr $compat

> > +         fi

> > +     else

> > +         emit $nxt $nr $entry

> > +     fi

>

> I would go for a local variable being set to $compat or $entry and

> calling emit at only one place. And there should be only one if with 2

> expressions, no need for 3 branches.


Sure.

>

> > +        let nxt=nxt+1

>

> Inconsistent indentation.


I'm using emacs editor with default settings. In the actual file, there is no
indentation problem which I found but if I get patch using git format-patch,
it has inconsistent indentation.

No idea. I could find the same problem in other patches also.
Let me use the vi editor to save the file and get the patch.

Thanks
Firoz

>

> > +    done

> > +) > "$out"

>

> Eike
Firoz Khan Oct. 15, 2018, 5:12 a.m. UTC | #9
Hi Eugene,

On Sun, 14 Oct 2018 at 06:36, Eugene Syromiatnikov <esyr@redhat.com> wrote:
>

> On Fri, Oct 12, 2018 at 03:13:59PM +0530, Firoz Khan wrote:

> > diff --git a/arch/parisc/kernel/syscalls/syscall.tbl b/arch/parisc/kernel/syscalls/syscall.tbl

> > new file mode 100644

> > index 0000000..7c9f268

>

> > +86      common  uselib                          sys_ni_syscall

>

> Again, why is this definition left, while others have been removed?


The system call generation script will generate new uapi and syscall
table files and replace the existed one. We'll make sure the generated
file against replaced one will be identical.

uselib is declared in uapi header:
https://github.com/torvalds/linux/blob/master/arch/parisc/include/uapi/asm/unistd.h#L103
So I have to make sure this entry is present in the generated uapi header.

>

> > +348     common  pwritev2                        sys_pwritev2                    compat_sys_pwritev2

> > +349     common  statx                           sys_statx

> > +350  common  io_pgetevents                   sys_io_pgetevents               compat_sys_io_pgetevents

>

> Tab instead of spaces.


I'm using emacs editor with default settings. In the actual file, there is no
indentation problem which I find but if I get patch using git format-patch,
it has inconsistent indentation.

No idea. I could find the same problem in other patches also.
Let me use the vi editor to save the file and get the patch.

>

> > diff --git a/arch/parisc/kernel/syscalls/syscallhdr.sh b/arch/parisc/kernel/syscalls/syscallhdr.sh

> > new file mode 100644

> > index 0000000..607d4ca

> > --- /dev/null

> > +++ b/arch/parisc/kernel/syscalls/syscallhdr.sh

> > @@ -0,0 +1,35 @@

> > +#!/bin/sh

>

> /bin/sh -efu

>

> > +# SPDX-License-Identifier: GPL-2.0

>

> "export LANG=C", due to usage of sed/grep/sort.


I got this frame work from x86/entry/syscalls;
https://github.com/torvalds/linux/blob/master/arch/x86/entry/syscalls/syscallhdr.sh
I haven't modified the script but I tune this script to meet my requirements.

Sure, I'll look into this.

>

> > +

> > +in="$1"

> > +out="$2"

> > +my_abis=`echo "($3)" | tr ',' '|'`

> > +prefix="$4"

> > +offset="$5"

> > +

> > +fileguard=_UAPI_ASM_PARISC_`basename "$out" | sed \

> > +    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \

> > +    -e 's/[^A-Z0-9_]/_/g' -e 's/__/_/g'`

> > +grep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | (

>

> grep -E '^[[:xdigit:]Xx]+[[:space:]]+'"${my_abis}" "$in"

> sort -n -k1,1

>

> > +    echo "#ifndef ${fileguard}"

> > +    echo "#define ${fileguard}"

> > +    echo ""

>

>         cat <<-EOF

>                 #ifndef ${fileguard}

>                 #define ${fileguard}

>

>         EOF

>

> > +

> > +    nxt=0

> > +    while read nr abi name entry compat ; do

> > +     if [ -z "$offset" ]; then

> > +         echo -e "#define __NR_${prefix}${name}\t$nr"

> > +     else

> > +         echo -e "#define __NR_${prefix}${name}\t($offset + $nr)"

> > +     fi

>

> echo options are not portable; something like

>

>         printf "#define __NR_%s%s\t(%s + %s)" "${prefix}" "${name}" "${offset}" "${nr}"


x86/armhas similar echo implementation.
https://github.com/torvalds/linux/blob/master/arch/arm/tools/syscallhdr.sh

s390 has this printf implemenation.
https://github.com/torvalds/linux/blob/master/arch/s390/kernel/syscalls/syscalltbl

I chose echo one. but it is easy to change to printf :)

>

> > +     nxt=$nr

> > +     let nxt=nxt+1

>

> "let" is a bash extension, posix-conformant expression would be

>

>         nxt=$((nr + 1))

>

> (I would also check that nr >= nxt, however)


Sure.

>

> > +    done

> > +

> > +    echo ""

> > +    echo "#ifdef __KERNEL__"

> > +    echo -e "#define __NR_syscalls\t$nxt"

> > +    echo "#endif"

> > +    echo ""

> > +    echo "#endif /* ${fileguard} */"

>

>         cat <<-EOF

>

>                 #ifdef __KERNEL__

>                 # define __NR_syscalls\t${nxt}

>                 #endif

>

>                 #endif /* ${fileguard} */

>         EOF

>

> > +) > "$out"

> > diff --git a/arch/parisc/kernel/syscalls/syscalltbl.sh b/arch/parisc/kernel/syscalls/syscalltbl.sh

> > new file mode 100644

> > index 0000000..04abde7

> > --- /dev/null

> > +++ b/arch/parisc/kernel/syscalls/syscalltbl.sh

> > @@ -0,0 +1,46 @@

> > +#!/bin/sh

> > +# SPDX-License-Identifier: GPL-2.0

> > +

> > +in="$1"

> > +out="$2"

> > +my_abis=`echo "($3)" | tr ',' '|'`

> > +offset="$4"

> > +

> > +emit() {

> > +    nxt="$1"

> > +    if [ -z "$offset" ]; then

> > +     nr="$2"

> > +    else

> > +     nr="$2"

> > +     nr=$((nr+offset))

> > +    fi

> > +    entry="$3"

> > +

> > +    while [ $nxt -lt $nr ]; do

>

> It would break nicely if nxt="-n x -o 1" or something like that.

>

> > +     echo "__SYSCALL($nxt, sys_ni_syscall, )"

> > +        let nxt=nxt+1

> > +    done

> > +    echo "__SYSCALL($nxt, $entry, )"

> > +}

> > +

> > +grep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | (

> > +    if [ -z "$offset" ]; then

> > +     nxt=0

> > +    else

> > +     nxt=$offset

> > +    fi

> > +

> > +    my_abi="$(cut -d'|' -f2 <<< $my_abis)"

>

>         my_abi="${my_abis#*|}"

>

> But it looks like that $my_abis includes parentheses and this code

> is broken.


I may planned to have some different implementation for the same.

>

> > +    while read nr abi name entry compat ; do

> > +     if [ $my_abi = "compat" ]; then

> > +         if [ -z "$compat" ]; then

> > +             emit $nxt $nr $entry

> > +         else

> > +             emit $nxt $nr $compat

> > +         fi

> > +     else

> > +         emit $nxt $nr $entry

> > +     fi

> > +        let nxt=nxt+1

> > +    done

> > +) > "$out"


Thanks
Firoz

> > --

> > 1.9.1

> >
Rolf Eike Beer Oct. 15, 2018, 5:16 a.m. UTC | #10
Firoz Khan wrote:
> Hi Rolf,

> 

> On Fri, 12 Oct 2018 at 17:37, Rolf Eike Beer <eike-kernel@sf-tec.de> wrote:

> > Firoz Khan wrote:


> > > +prefix="$4"

> > > +offset="$5"

> > > +

> > > +fileguard=_UAPI_ASM_PARISC_`basename "$out" | sed \

> > > +    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \

> > > +    -e 's/[^A-Z0-9_]/_/g' -e 's/__/_/g'`

> > > +grep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | (

> > > +    echo "#ifndef ${fileguard}"

> > > +    echo "#define ${fileguard}"

> > > +    echo ""

> > > +

> > > +    nxt=0

> > > +    while read nr abi name entry compat ; do

> > > +     if [ -z "$offset" ]; then

> > > +         echo -e "#define __NR_${prefix}${name}\t$nr"

> > 

> > This mixed indentation with both tabs and spaces is a bit messy.

> 

> Is this what you suggested?

> -           echo -e "#define __NR_${prefix}${name}\t$nr"

> +           echo "#define __NR_${prefix}${name} $nr"


No, this was actually only about the script itself. Looks like your editor has 
tab-width 8 and indentation 4 or so.

Eike
Firoz Khan Oct. 15, 2018, 5:45 a.m. UTC | #11
Hi Eike,

On Mon, 15 Oct 2018 at 10:47, Rolf Eike Beer <eike-kernel@sf-tec.de> wrote:
>

> Firoz Khan wrote:

> > Hi Rolf,

> >

> > On Fri, 12 Oct 2018 at 17:37, Rolf Eike Beer <eike-kernel@sf-tec.de> wrote:

> > > Firoz Khan wrote:

>

> > > > +prefix="$4"

> > > > +offset="$5"

> > > > +

> > > > +fileguard=_UAPI_ASM_PARISC_`basename "$out" | sed \

> > > > +    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \

> > > > +    -e 's/[^A-Z0-9_]/_/g' -e 's/__/_/g'`

> > > > +grep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | (

> > > > +    echo "#ifndef ${fileguard}"

> > > > +    echo "#define ${fileguard}"

> > > > +    echo ""

> > > > +

> > > > +    nxt=0

> > > > +    while read nr abi name entry compat ; do

> > > > +     if [ -z "$offset" ]; then

> > > > +         echo -e "#define __NR_${prefix}${name}\t$nr"

> > >

> > > This mixed indentation with both tabs and spaces is a bit messy.

> >

> > Is this what you suggested?

> > -           echo -e "#define __NR_${prefix}${name}\t$nr"

> > +           echo "#define __NR_${prefix}${name} $nr"

>

> No, this was actually only about the script itself. Looks like your editor has

> tab-width 8 and indentation 4 or so.


Ok. Something is going bad while creating the patch series. That's why this
mixed indentation with both tabs and spaces.Will fix now.

It will be ok to have indentation of 4 character?
https://github.com/torvalds/linux/blob/master/arch/x86/entry/syscalls/syscalltbl.sh
https://github.com/torvalds/linux/blob/master/arch/arm/tools/syscalltbl.sh

Thanks
Firoz
>

> Eike
diff mbox series

Patch

diff --git a/arch/parisc/kernel/syscalls/Makefile b/arch/parisc/kernel/syscalls/Makefile
new file mode 100644
index 0000000..a0af5a3
--- /dev/null
+++ b/arch/parisc/kernel/syscalls/Makefile
@@ -0,0 +1,55 @@ 
+# SPDX-License-Identifier: GPL-2.0
+kapi := arch/$(SRCARCH)/include/generated/asm
+uapi := arch/$(SRCARCH)/include/generated/uapi/asm
+
+_dummy := $(shell [ -d '$(uapi)' ] || mkdir -p '$(uapi)') \
+	  $(shell [ -d '$(kapi)' ] || mkdir -p '$(kapi)')
+
+syscall := $(srctree)/$(src)/syscall.tbl
+syshdr := $(srctree)/$(src)/syscallhdr.sh
+systbl := $(srctree)/$(src)/syscalltbl.sh
+
+quiet_cmd_syshdr = SYSHDR  $@
+      cmd_syshdr = $(CONFIG_SHELL) '$(syshdr)' '$<' '$@'  \
+		   '$(syshdr_abi_$(basetarget))'          \
+		   '$(syshdr_pfx_$(basetarget))'          \
+		   '$(syshdr_offset_$(basetarget))'
+
+quiet_cmd_systbl = SYSTBL  $@
+      cmd_systbl = $(CONFIG_SHELL) '$(systbl)' '$<' '$@'  \
+                   '$(systbl_abi_$(basetarget))'          \
+		   '$(systbl_offset_$(basetarget))'
+
+syshdr_abi_unistd_32 := common,32
+syshdr_offset_unistd_32 := __NR_Linux
+$(uapi)/unistd_32.h: $(syscall) $(syshdr)
+	$(call if_changed,syshdr)
+
+syshdr_abi_unistd_64 := common,64
+syshdr_offset_unistd_64 := __NR_Linux
+$(uapi)/unistd_64.h: $(syscall) $(syshdr)
+	$(call if_changed,syshdr)
+
+systbl_abi_syscall_table_32 := common,32
+$(kapi)/syscall_table_32.h: $(syscall) $(systbl)
+	$(call if_changed,systbl)
+
+systbl_abi_syscall_table_64 := common,64
+$(kapi)/syscall_table_64.h: $(syscall) $(systbl)
+	$(call if_changed,systbl)
+
+systbl_abi_syscall_table_c32 := common,compat,32
+$(kapi)/syscall_table_c32.h: $(syscall) $(systbl)
+	$(call if_changed,systbl)
+
+uapisyshdr-y			+= unistd_32.h unistd_64.h
+kapisyshdr-y			+= syscall_table_32.h     \
+                                   syscall_table_64.h     \
+                                   syscall_table_c32.h
+
+targets	+= $(uapisyshdr-y) $(kapisyshdr-y)
+
+PHONY += all
+all: $(addprefix $(uapi)/,$(uapisyshdr-y))
+all: $(addprefix $(kapi)/,$(kapisyshdr-y))
+	@:
diff --git a/arch/parisc/kernel/syscalls/syscall.tbl b/arch/parisc/kernel/syscalls/syscall.tbl
new file mode 100644
index 0000000..7c9f268
--- /dev/null
+++ b/arch/parisc/kernel/syscalls/syscall.tbl
@@ -0,0 +1,369 @@ 
+# SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note
+#
+# system call numbers and entry vectors for parisc
+#
+# The format is:
+# <number> <abi> <name> <entry point> <compat entry point>
+#
+# The <abi> can be common, 64, or 32 for this file.
+#
+0       common  restart_syscall                 sys_restart_syscall
+1       common  exit                            sys_exit
+2       common  fork                            sys_fork_wrapper
+3       common  read                            sys_read
+4       common  write                           sys_write
+5       common  open                            sys_open                        compat_sys_open
+6       common  close                           sys_close
+7       common  waitpid                         sys_waitpid
+8       common  creat                           sys_creat
+9       common  link                            sys_link
+10      common  unlink                          sys_unlink
+11      common  execve                          sys_execve                      compat_sys_execve
+12      common  chdir                           sys_chdir
+13      common  time                            sys_time                        compat_sys_time
+14      common  mknod                           sys_mknod
+15      common  chmod                           sys_chmod
+16      common  lchown                          sys_lchown
+17      common  socket                          sys_socket
+18      common  stat                            sys_newstat                     compat_sys_newstat
+19      common  lseek                           sys_lseek                       compat_sys_lseek
+20      common  getpid                          sys_getpid
+21      common  mount                           sys_mount                       compat_sys_mount
+22      common  bind                            sys_bind
+23      common  setuid                          sys_setuid
+24      common  getuid                          sys_getuid
+25      common  stime                           sys_stime                       compat_sys_stime
+26      common  ptrace                          sys_ptrace                      compat_sys_ptrace
+27      common  alarm                           sys_alarm
+28      common  fstat                           sys_newfstat                    compat_sys_newfstat
+29      common  pause                           sys_pause
+30      common  utime                           sys_utime                       compat_sys_utime
+31      common  connect                         sys_connect
+32      common  listen                          sys_listen
+33      common  access                          sys_access
+34      common  nice                            sys_nice
+35      common  accept                          sys_accept
+36      common  sync                            sys_sync
+37      common  kill                            sys_kill
+38      common  rename                          sys_rename
+39      common  mkdir                           sys_mkdir
+40      common  rmdir                           sys_rmdir
+41      common  dup                             sys_dup
+42      common  pipe                            sys_pipe
+43      common  times                           sys_times                       compat_sys_times
+44      common  getsockname                     sys_getsockname
+45      common  brk                             sys_brk
+46      common  setgid                          sys_setgid
+47      common  getgid                          sys_getgid
+48      common  signal                          sys_signal
+49      common  geteuid                         sys_geteuid
+50      common  getegid                         sys_getegid
+51      common  acct                            sys_acct
+52      common  umount2                         sys_umount
+53      common  getpeername                     sys_getpeername
+54      common  ioctl                           sys_ioctl                       compat_sys_ioctl
+55      common  fcntl                           sys_fcntl                       compat_sys_fcntl
+56      common  socketpair                      sys_socketpair
+57      common  setpgid                         sys_setpgid
+58      common  send                            sys_send
+59      common  uname                           sys_newuname
+60      common  umask                           sys_umask
+61      common  chroot                          sys_chroot
+62      common  ustat                           sys_ustat                       compat_sys_ustat
+63      common  dup2                            sys_dup2
+64      common  getppid                         sys_getppid
+65      common  getpgrp                         sys_getpgrp
+66      common  setsid                          sys_setsid
+67      common  pivot_root                      sys_pivot_root
+68      common  sgetmask                        sys_sgetmask                    sys32_unimplemented
+69      common  ssetmask                        sys_ssetmask                    sys32_unimplemented
+70      common  setreuid                        sys_setreuid
+71      common  setregid                        sys_setregid
+72      common  mincore                         sys_mincore
+73      common  sigpending                      sys_sigpending                  compat_sys_sigpending
+74      common  sethostname                     sys_sethostname
+75      common  setrlimit                       sys_setrlimit                   compat_sys_setrlimit
+76      common  getrlimit                       sys_getrlimit                   compat_sys_getrlimit
+77      common  getrusage                       sys_getrusage                   compat_sys_getrusage
+78      common  gettimeofday                    sys_gettimeofday                compat_sys_gettimeofday
+79      common  settimeofday                    sys_settimeofday                compat_sys_settimeofday
+80      common  getgroups                       sys_getgroups
+81      common  setgroups                       sys_setgroups
+82      common  sendto                          sys_sendto
+83      common  symlink                         sys_symlink
+84      common  lstat                           sys_newlstat                    compat_sys_newlstat
+85      common  readlink                        sys_readlink
+86      common  uselib                          sys_ni_syscall
+87      common  swapon                          sys_swapon
+88      common  reboot                          sys_reboot
+89      common  mmap2                           sys_mmap2
+90      common  mmap                            sys_mmap
+91      common  munmap                          sys_munmap
+92      common  truncate                        sys_truncate                    compat_sys_truncate
+93      common  ftruncate                       sys_ftruncate                   compat_sys_ftruncate
+94      common  fchmod                          sys_fchmod
+95      common  fchown                          sys_fchown
+96      common  getpriority                     sys_getpriority
+97      common  setpriority                     sys_setpriority
+98      common  recv                            sys_recv
+99      common  statfs                          sys_statfs                      compat_sys_statfs
+100     common  fstatfs                         sys_fstatfs                     compat_sys_fstatfs
+101     common  stat64                          sys_stat64
+# 102 was socketcall
+103     common  syslog                          sys_syslog
+104     common  setitimer                       sys_setitimer                   compat_sys_setitimer
+105     common  getitimer                       sys_getitimer                   compat_sys_getitimer
+106     common  capget                          sys_capget
+107     common  capset                          sys_capset
+108     32      pread64                         parisc_pread64
+108     64      pread64                         sys_pread64
+109     32      pwrite64                        parisc_pwrite64
+109     64      pwrite64                        sys_pwrite64
+110     common  getcwd                          sys_getcwd
+111     common  vhangup                         sys_vhangup
+112     common  fstat64                         sys_fstat64
+113     common  vfork                           sys_vfork_wrapper
+114     common  wait4                           sys_wait4                       compat_sys_wait4
+115     common  swapoff                         sys_swapoff
+116     common  sysinfo                         sys_sysinfo                     compat_sys_sysinfo
+117     common  shutdown                        sys_shutdown
+118     common  fsync                           sys_fsync
+119     common  madvise                         sys_madvise
+120     common  clone                           sys_clone_wrapper
+121     common  setdomainname                   sys_setdomainname
+122     common  sendfile                        sys_sendfile                    compat_sys_sendfile
+123     common  recvfrom                        sys_recvfrom
+124     common  adjtimex                        sys_adjtimex                    compat_sys_adjtimex
+125     common  mprotect                        sys_mprotect
+126     common  sigprocmask                     sys_sigprocmask                 compat_sys_sigprocmask
+# 127 was create_module
+128     common  init_module                     sys_init_module
+129     common  delete_module                   sys_delete_module
+# 130 was get_kernel_syms
+131     common  quotactl                        sys_quotactl
+132     common  getpgid                         sys_getpgid
+133     common  fchdir                          sys_fchdir
+134     common  bdflush                         sys_bdflush
+135     common  sysfs                           sys_sysfs
+136     32      personality                     parisc_personality
+136     64      personality                     sys_personality
+# 137 was afs_syscall
+138     common  setfsuid                        sys_setfsuid
+139     common  setfsgid                        sys_setfsgid
+140     common  _llseek                         sys_llseek
+141     common  getdents                        sys_getdents                    compat_sys_getdents
+142     common  _newselect                      sys_select                      compat_sys_select
+143     common  flock                           sys_flock
+144     common  msync                           sys_msync
+145     common  readv                           sys_readv                       compat_sys_readv
+146     common  writev                          sys_writev                      compat_sys_writev
+147     common  getsid                          sys_getsid
+148     common  fdatasync                       sys_fdatasync
+149     common  _sysctl                         sys_sysctl                      compat_sys_sysctl
+150     common  mlock                           sys_mlock
+151     common  munlock                         sys_munlock
+152     common  mlockall                        sys_mlockall
+153     common  munlockall                      sys_munlockall
+154     common  sched_setparam                  sys_sched_setparam
+155     common  sched_getparam                  sys_sched_getparam
+156     common  sched_setscheduler              sys_sched_setscheduler
+157     common  sched_getscheduler              sys_sched_getscheduler
+158     common  sched_yield                     sys_sched_yield
+159     common  sched_get_priority_max          sys_sched_get_priority_max
+160     common  sched_get_priority_min          sys_sched_get_priority_min
+161     common  sched_rr_get_interval           sys_sched_rr_get_interval       compat_sys_sched_rr_get_interval
+162     common  nanosleep                       sys_nanosleep                   compat_sys_nanosleep
+163     common  mremap                          sys_mremap
+164     common  setresuid                       sys_setresuid
+165     common  getresuid                       sys_getresuid
+166     common  sigaltstack                     sys_sigaltstack                 compat_sys_sigaltstack
+# 167 was query_module
+168     common  poll                            sys_poll
+# 169 was nfsservctl
+170     common  setresgid                       sys_setresgid
+171     common  getresgid                       sys_getresgid
+172     common  prctl                           sys_prctl
+173     common  rt_sigreturn                    sys_rt_sigreturn_wrapper
+174     common  rt_sigaction                    sys_rt_sigaction                compat_sys_rt_sigaction
+175     common  rt_sigprocmask                  sys_rt_sigprocmask              compat_sys_rt_sigprocmask
+176     common  rt_sigpending                   sys_rt_sigpending               compat_sys_rt_sigpending
+177     common  rt_sigtimedwait                 sys_rt_sigtimedwait             compat_sys_rt_sigtimedwait
+178     common  rt_sigqueueinfo                 sys_rt_sigqueueinfo             compat_sys_rt_sigqueueinfo
+179     common  rt_sigsuspend                   sys_rt_sigsuspend               compat_sys_rt_sigsuspend
+180     common  chown                           sys_chown
+181     common  setsockopt                      sys_setsockopt                  compat_sys_setsockopt
+182     common  getsockopt                      sys_getsockopt                  compat_sys_getsockopt
+183     common  sendmsg                         sys_sendmsg                     compat_sys_sendmsg
+184     common  recvmsg                         sys_recvmsg                     compat_sys_recvmsg
+185     common  semop                           sys_semop
+186     common  semget                          sys_semget
+187     common  semctl                          sys_semctl                      compat_sys_semctl
+188     common  msgsnd                          sys_msgsnd                      compat_sys_msgsnd
+189     common  msgrcv                          sys_msgrcv                      compat_sys_msgrcv
+190     common  msgget                          sys_msgget
+191     common  msgctl                          sys_msgctl                      compat_sys_msgctl
+192     common  shmat                           sys_shmat                       compat_sys_shmat
+193     common  shmdt                           sys_shmdt
+194     common  shmget                          sys_shmget
+195     common  shmctl                          sys_shmctl                      compat_sys_shmctl
+# 196 was getpmsg
+# 197 was putpmsg
+198     common  lstat64                         sys_lstat64
+199     32      truncate64                      parisc_truncate64
+199     64      truncate64                      sys_truncate64
+200     32      ftruncate64                     parisc_ftruncate64
+200     64      ftruncate64                     sys_ftruncate64
+201     common  getdents64                      sys_getdents64
+202     common  fcntl64                         sys_fcntl64                     compat_sys_fcntl64
+# 203 was attrctl
+# 204 was acl_get
+# 205 was acl_set
+206     common  gettid                          sys_gettid
+207     32      readahead                       parisc_readahead
+207     64      readahead                       sys_readahead
+208     common  tkill                           sys_tkill
+209     common  sendfile64                      sys_sendfile64                  compat_sys_sendfile64
+210     common  futex                           sys_futex                       compat_sys_futex
+211     common  sched_setaffinity               sys_sched_setaffinity           compat_sys_sched_setaffinity
+212     common  sched_getaffinity               sys_sched_getaffinity           compat_sys_sched_getaffinity
+# 213 was set_thread_area
+# 214 was get_thread_area
+215     common  io_setup                        sys_io_setup                    compat_sys_io_setup
+216     common  io_destroy                      sys_io_destroy
+217     common  io_getevents                    sys_io_getevents                compat_sys_io_getevents
+218     common  io_submit                       sys_io_submit                   compat_sys_io_submit
+219     common  io_cancel                       sys_io_cancel
+# 220 was alloc_hugepages
+# 221 was free_hugepages
+222     common  exit_group                      sys_exit_group
+223     common  lookup_dcookie                  sys_lookup_dcookie              compat_sys_lookup_dcookie
+224     common  epoll_create                    sys_epoll_create
+225     common  epoll_ctl                       sys_epoll_ctl
+226     common  epoll_wait                      sys_epoll_wait
+227     common  remap_file_pages                sys_remap_file_pages
+228     common  semtimedop                      sys_semtimedop                  compat_sys_semtimedop
+229     common  mq_open                         sys_mq_open                     compat_sys_mq_open
+230     common  mq_unlink                       sys_mq_unlink
+231     common  mq_timedsend                    sys_mq_timedsend                compat_sys_mq_timedsend
+232     common  mq_timedreceive                 sys_mq_timedreceive             compat_sys_mq_timedreceive
+233     common  mq_notify                       sys_mq_notify                   compat_sys_mq_notify
+234     common  mq_getsetattr                   sys_mq_getsetattr               compat_sys_mq_getsetattr
+235     common  waitid                          sys_waitid                      compat_sys_waitid
+236     32      fadvise64_64                    parisc_fadvise64_64
+236     64      fadvise64_64                    sys_fadvise64_64
+237     common  set_tid_address                 sys_set_tid_address
+238     common  setxattr                        sys_setxattr
+239     common  lsetxattr                       sys_lsetxattr
+240     common  fsetxattr                       sys_fsetxattr
+241     common  getxattr                        sys_getxattr
+242     common  lgetxattr                       sys_lgetxattr
+243     common  fgetxattr                       sys_fgetxattr
+244     common  listxattr                       sys_listxattr
+245     common  llistxattr                      sys_llistxattr
+246     common  flistxattr                      sys_flistxattr
+247     common  removexattr                     sys_removexattr
+248     common  lremovexattr                    sys_lremovexattr
+249     common  fremovexattr                    sys_fremovexattr
+250     common  timer_create                    sys_timer_create                compat_sys_timer_create
+251     common  timer_settime                   sys_timer_settime               compat_sys_timer_settime
+252     common  timer_gettime                   sys_timer_gettime               compat_sys_timer_gettime
+253     common  timer_getoverrun                sys_timer_getoverrun
+254     common  timer_delete                    sys_timer_delete
+255     common  clock_settime                   sys_clock_settime               compat_sys_clock_settime
+256     common  clock_gettime                   sys_clock_gettime               compat_sys_clock_gettime
+257     common  clock_getres                    sys_clock_getres                compat_sys_clock_getres
+258     common  clock_nanosleep                 sys_clock_nanosleep             compat_sys_clock_nanosleep
+259     common  tgkill                          sys_tgkill
+260     common  mbind                           sys_mbind                       compat_sys_mbind
+261     common  get_mempolicy                   sys_get_mempolicy               compat_sys_get_mempolicy
+262     common  set_mempolicy                   sys_set_mempolicy               compat_sys_set_mempolicy
+# 263 was vserver
+264     common  add_key                         sys_add_key
+265     common  request_key                     sys_request_key
+266     common  keyctl                          sys_keyctl                      compat_sys_keyctl
+267     common  ioprio_set                      sys_ioprio_set
+268     common  ioprio_get                      sys_ioprio_get
+269     common  inotify_init                    sys_inotify_init
+270     common  inotify_add_watch               sys_inotify_add_watch
+271     common  inotify_rm_watch                sys_inotify_rm_watch
+272     common  migrate_pages                   sys_migrate_pages
+273     common  pselect6                        sys_pselect6                    compat_sys_pselect6
+274     common  ppoll                           sys_ppoll                       compat_sys_ppoll
+275     common  openat                          sys_openat                      compat_sys_openat
+276     common  mkdirat                         sys_mkdirat
+277     common  mknodat                         sys_mknodat
+278     common  fchownat                        sys_fchownat
+279     common  futimesat                       sys_futimesat                   compat_sys_futimesat
+280     common  fstatat64                       sys_fstatat64
+281     common  unlinkat                        sys_unlinkat
+282     common  renameat                        sys_renameat
+283     common  linkat                          sys_linkat
+284     common  symlinkat                       sys_symlinkat
+285     common  readlinkat                      sys_readlinkat
+286     common  fchmodat                        sys_fchmodat
+287     common  faccessat                       sys_faccessat
+288     common  unshare                         sys_unshare
+289     common  set_robust_list                 sys_set_robust_list             compat_sys_set_robust_list
+290     common  get_robust_list                 sys_get_robust_list             compat_sys_get_robust_list
+291     common  splice                          sys_splice
+292     32      sync_file_range                 parisc_sync_file_range
+292     64      sync_file_range                 sys_sync_file_range
+293     common  tee                             sys_tee
+294     common  vmsplice                        sys_vmsplice                    compat_sys_vmsplice
+295     common  move_pages                      sys_move_pages                  compat_sys_move_pages
+296     common  getcpu                          sys_getcpu
+297     common  epoll_pwait                     sys_epoll_pwait                 compat_sys_epoll_pwait
+298     common  statfs64                        sys_statfs64                    compat_sys_statfs64
+299     common  fstatfs64                       sys_fstatfs64                   compat_sys_fstatfs64
+300     common  kexec_load                      sys_kexec_load                  compat_sys_kexec_load
+301     common  utimensat                       sys_utimensat                   compat_sys_utimensat
+302     common  signalfd                        sys_signalfd                    compat_sys_signalfd
+# 303 was timerfd
+304     common  eventfd                         sys_eventfd
+305     32      fallocate                       parisc_fallocate
+305     64      fallocate                       sys_fallocate
+306     common  timerfd_create                  sys_timerfd_create
+307     common  timerfd_settime                 sys_timerfd_settime             compat_sys_timerfd_settime
+308     common  timerfd_gettime                 sys_timerfd_gettime             compat_sys_timerfd_gettime
+309     common  signalfd4                       sys_signalfd4                   compat_sys_signalfd4
+310     common  eventfd2                        sys_eventfd2
+311     common  epoll_create1                   sys_epoll_create1
+312     common  dup3                            sys_dup3
+313     common  pipe2                           sys_pipe2
+314     common  inotify_init1                   sys_inotify_init1
+315     common  preadv                          sys_preadv                      compat_sys_preadv
+316     common  pwritev                         sys_pwritev                     compat_sys_pwritev
+317     common  rt_tgsigqueueinfo               sys_rt_tgsigqueueinfo           compat_sys_rt_tgsigqueueinfo
+318     common  perf_event_open                 sys_perf_event_open
+319     common  recvmmsg                        sys_recvmmsg                    compat_sys_recvmmsg
+320     common  accept4                         sys_accept4
+321     common  prlimit64                       sys_prlimit64
+322     common  fanotify_init                   sys_fanotify_init
+323     common  fanotify_mark                   sys_fanotify_mark               sys32_fanotify_mark
+324     common  clock_adjtime                   sys_clock_adjtime               compat_sys_clock_adjtime
+325     common  name_to_handle_at               sys_name_to_handle_at
+326     common  open_by_handle_at               sys_open_by_handle_at           compat_sys_open_by_handle_at
+327     common  syncfs                          sys_syncfs
+328     common  setns                           sys_setns
+329     common  sendmmsg                        sys_sendmmsg                    compat_sys_sendmmsg
+330     common  process_vm_readv                sys_process_vm_readv            compat_sys_process_vm_readv
+331     common  process_vm_writev               sys_process_vm_writev           compat_sys_process_vm_writev
+332     common  kcmp                            sys_kcmp
+333     common  finit_module                    sys_finit_module
+334     common  sched_setattr                   sys_sched_setattr
+335     common  sched_getattr                   sys_sched_getattr
+336     common  utimes                          sys_utimes                      compat_sys_utimes
+337     common  renameat2                       sys_renameat2
+338     common  seccomp                         sys_seccomp
+339     common  getrandom                       sys_getrandom
+340     common  memfd_create                    sys_memfd_create
+341     common  bpf                             sys_bpf
+342     common  execveat                        sys_execveat                    compat_sys_execveat
+343     common  membarrier                      sys_membarrier
+344     common  userfaultfd                     sys_userfaultfd
+345     common  mlock2                          sys_mlock2
+346     common  copy_file_range                 sys_copy_file_range
+347     common  preadv2                         sys_preadv2                     compat_sys_preadv2
+348     common  pwritev2                        sys_pwritev2                    compat_sys_pwritev2
+349     common  statx                           sys_statx
+350	common  io_pgetevents			sys_io_pgetevents		compat_sys_io_pgetevents
\ No newline at end of file
diff --git a/arch/parisc/kernel/syscalls/syscallhdr.sh b/arch/parisc/kernel/syscalls/syscallhdr.sh
new file mode 100644
index 0000000..607d4ca
--- /dev/null
+++ b/arch/parisc/kernel/syscalls/syscallhdr.sh
@@ -0,0 +1,35 @@ 
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+
+in="$1"
+out="$2"
+my_abis=`echo "($3)" | tr ',' '|'`
+prefix="$4"
+offset="$5"
+
+fileguard=_UAPI_ASM_PARISC_`basename "$out" | sed \
+    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \
+    -e 's/[^A-Z0-9_]/_/g' -e 's/__/_/g'`
+grep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | (
+    echo "#ifndef ${fileguard}"
+    echo "#define ${fileguard}"
+    echo ""
+
+    nxt=0
+    while read nr abi name entry compat ; do
+	if [ -z "$offset" ]; then
+	    echo -e "#define __NR_${prefix}${name}\t$nr"
+	else
+	    echo -e "#define __NR_${prefix}${name}\t($offset + $nr)"
+	fi
+	nxt=$nr
+	let nxt=nxt+1
+    done
+
+    echo ""
+    echo "#ifdef __KERNEL__"
+    echo -e "#define __NR_syscalls\t$nxt"
+    echo "#endif"
+    echo ""
+    echo "#endif /* ${fileguard} */"
+) > "$out"
diff --git a/arch/parisc/kernel/syscalls/syscalltbl.sh b/arch/parisc/kernel/syscalls/syscalltbl.sh
new file mode 100644
index 0000000..04abde7
--- /dev/null
+++ b/arch/parisc/kernel/syscalls/syscalltbl.sh
@@ -0,0 +1,46 @@ 
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+
+in="$1"
+out="$2"
+my_abis=`echo "($3)" | tr ',' '|'`
+offset="$4"
+
+emit() {
+    nxt="$1"
+    if [ -z "$offset" ]; then
+	nr="$2"
+    else
+	nr="$2"
+	nr=$((nr+offset))
+    fi
+    entry="$3"
+
+    while [ $nxt -lt $nr ]; do
+	echo "__SYSCALL($nxt, sys_ni_syscall, )"
+        let nxt=nxt+1
+    done
+    echo "__SYSCALL($nxt, $entry, )"
+}
+
+grep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | (
+    if [ -z "$offset" ]; then
+	nxt=0
+    else
+	nxt=$offset
+    fi
+
+    my_abi="$(cut -d'|' -f2 <<< $my_abis)"
+    while read nr abi name entry compat ; do
+	if [ $my_abi = "compat" ]; then
+	    if [ -z "$compat" ]; then
+		emit $nxt $nr $entry
+	    else
+		emit $nxt $nr $compat
+	    fi
+	else
+	    emit $nxt $nr $entry
+	fi
+        let nxt=nxt+1
+    done
+) > "$out"