Skip to contentSkip to conversation

Automatically generate syscalls.h

PATCH Superseded Andrea Cervesato 3 participants 12 messages Sep 24, 2024 – Sep 26, 2024

v1 of 9 Superseded Latest is v9 →

lore
Share & tools
lore
#0 lore raw

cover Automatically generate syscalls.h

The problem we have at the moment is that all syscalls input files must be changed by hand each time we need to test a new syscall. The idea is to simplify this process, providing a script that is able to read from kernel sources and to generate all syscalls files we need.

This is done by the generate_syscalls.sh script that can be used as following:

./generate_syscalls.sh path/to/kernel/source path/to/syscalls.h

This approach requires a certain type of attention, due to the fact that we need to generate syscalls.h at each kernel version, or when new syscalls have been added in the kernel.

---
Andrea Cervesato (4):
Rename syscalls order file to supported-arch.txt Add script to generate syscalls.h Deprecate old syscalls input files
Save syscalls.h inside repo

 include/lapi/.gitignore                            |     1 -
 include/lapi/syscalls.h                            | 34272 +++++++++++++++++++
 include/lapi/syscalls/aarch64.in                   |   306 -
 include/lapi/syscalls/arc.in                       |   325 -
 include/lapi/syscalls/arm.in                       |   404 -
 include/lapi/syscalls/blacklist-syscalls.txt       |     6 +
 include/lapi/syscalls/generate_syscalls.sh         |   292 +
 include/lapi/syscalls/hppa.in                      |    52 -
 include/lapi/syscalls/i386.in                      |   439 -
 include/lapi/syscalls/ia64.in                      |   956 +-
 include/lapi/syscalls/loongarch.in                 |   310 -
 include/lapi/syscalls/mips_n32.in                  |   379 -
 include/lapi/syscalls/mips_n64.in                  |   355 -
 include/lapi/syscalls/mips_o32.in                  |   425 -
 include/lapi/syscalls/powerpc.in                   |   432 -
 include/lapi/syscalls/powerpc64.in                 |   432 -
 include/lapi/syscalls/regen.sh                     |   129 -
 include/lapi/syscalls/s390.in                      |   419 -
 include/lapi/syscalls/s390x.in                     |   367 -
 include/lapi/syscalls/sh.in                        |   413 -
 include/lapi/syscalls/sparc.in                     |   418 -
 include/lapi/syscalls/sparc64.in                   |   383 -
 include/lapi/syscalls/strip_syscall.awk            |    19 -
 .../lapi/syscalls/{order => supported-arch.txt}    |     1 -
 include/lapi/syscalls/x86_64.in                    |   396 -
 25 files changed, 35174 insertions(+), 6757 deletions(-)

---
base-commit: 968e6245d93bc91723e72086a71e6bc50f495d0b
change-id: 20240923-generate_syscalls-780dc2227bdb

Best regards,

Signature · 5 lines
Andrea Cervesato <[email protected]>


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#1 lore raw

PATCH 1/4 Rename syscalls order file to supported-arch.txt

From: Andrea Cervesato <[email protected]>

---
 include/lapi/syscalls/regen.sh                     | 88 +++++++++++-----------
 .../lapi/syscalls/{order => supported-arch.txt}    |  1 -
 2 files changed, 44 insertions(+), 45 deletions(-)
include/lapi/syscalls/regen.sh +44 -44
index 663ce4458..e06746483 100755
@@ -14,7 +14,7 @@ err() {
 	exit 1
 }
 
-cat << EOF > "${output_pid}"
+cat <<EOF >"${output_pid}"
 /************************************************
  * GENERATED FILE: DO NOT EDIT/PATCH THIS FILE  *
  *  change your arch specific .in file instead  *
@@ -65,40 +65,40 @@ inline static void dummy_cleanup(void) {}
 EOF
 
 jobs=0
-for arch in $(cat "${srcdir}/order") ; do
+for arch in $(cat "${srcdir}/supported-arch.txt"); do
 	(
-	echo "Generating data for arch $arch ... "
-
-	(
-	echo
-	case ${arch} in
-		sparc64) echo "#if defined(__sparc__) && defined(__arch64__)" ;;
-		sparc) echo "#if defined(__sparc__) && !defined(__arch64__)" ;;
-		s390) echo "#if defined(__s390__) && !defined(__s390x__)" ;;
-		mips_n32) echo "#if defined(__mips__) && defined(_ABIN32)" ;;
-		mips_n64) echo "#if defined(__mips__) && defined(_ABI64)" ;;
-		mips_o32) echo "#if defined(__mips__) && defined(_ABIO32) && _MIPS_SZLONG == 32" ;;
-		*) echo "#ifdef __${arch}__" ;;
-	esac
-	while read line ; do
-		set -- ${line}
-		nr="__NR_$1"
-		shift
-		if [ $# -eq 0 ] ; then
-			err "invalid line found: $line"
-		fi
-		echo "# ifndef ${nr}"
-		echo "#  define ${nr} $*"
-		echo "# endif"
-	done < "${srcdir}/${arch}.in"
-	echo "#endif"
-	echo
-	) >> "${output_pid}.${arch}"
+		echo "Generating data for arch $arch ... "
+
+		(
+			echo
+			case ${arch} in
+			sparc64) echo "#if defined(__sparc__) && defined(__arch64__)" ;;
+			sparc) echo "#if defined(__sparc__) && !defined(__arch64__)" ;;
+			s390) echo "#if defined(__s390__) && !defined(__s390x__)" ;;
+			mips_n32) echo "#if defined(__mips__) && defined(_ABIN32)" ;;
+			mips_n64) echo "#if defined(__mips__) && defined(_ABI64)" ;;
+			mips_o32) echo "#if defined(__mips__) && defined(_ABIO32) && _MIPS_SZLONG == 32" ;;
+			*) echo "#ifdef __${arch}__" ;;
+			esac
+			while read line; do
+				set -- ${line}
+				nr="__NR_$1"
+				shift
+				if [ $# -eq 0 ]; then
+					err "invalid line found: $line"
+				fi
+				echo "# ifndef ${nr}"
+				echo "#  define ${nr} $*"
+				echo "# endif"
+			done <"${srcdir}/${arch}.in"
+			echo "#endif"
+			echo
+		) >>"${output_pid}.${arch}"
 
 	) &
 
-	jobs=$(( jobs + 1 ))
-	if [ ${jobs} -ge ${max_jobs} ] ; then
+	jobs=$((jobs + 1))
+	if [ ${jobs} -ge ${max_jobs} ]; then
 		wait || exit 1
 		jobs=0
 	fi
@@ -106,24 +106,24 @@ done
 
 echo "Generating stub list ... "
 (
-echo
-echo "/* Common stubs */"
-echo "#define __LTP__NR_INVALID_SYSCALL -1" >> "${output_pid}"
-for nr in $(awk '{print $1}' "${srcdir}/"*.in | sort -u) ; do
-	nr="__NR_${nr}"
-	echo "# ifndef ${nr}"
-	echo "#  define ${nr} __LTP__NR_INVALID_SYSCALL"
-	echo "# endif"
-done
-echo "#endif"
-) >> "${output_pid}._footer"
+	echo
+	echo "/* Common stubs */"
+	echo "#define __LTP__NR_INVALID_SYSCALL -1" >>"${output_pid}"
+	for nr in $(awk '{print $1}' "${srcdir}/"*.in | sort -u); do
+		nr="__NR_${nr}"
+		echo "# ifndef ${nr}"
+		echo "#  define ${nr} __LTP__NR_INVALID_SYSCALL"
+		echo "# endif"
+	done
+	echo "#endif"
+) >>"${output_pid}._footer"
 
 wait || exit 1
 
 printf "Combining them all ... "
-for arch in $(cat "${srcdir}/order") _footer ; do
+for arch in $(cat "${srcdir}/supported-arch.txt") _footer; do
 	cat "${output_pid}.${arch}"
-done >> "${output_pid}"
+done >>"${output_pid}"
 mv "${output_pid}" "../${output}"
 rm -f "${output_pid}"*
 echo "OK!"
include/lapi/syscalls/supported-arch.txt renamed from include/lapi/syscalls/order +0 -1
similarity index 91%
rename from include/lapi/syscalls/order
rename to include/lapi/syscalls/supported-arch.txt
index c18aa38cf..de88957ed 100644
@@ -8,7 +8,6 @@ loongarch
 mips_n32
 mips_n64
 mips_o32
-powerpc64
 powerpc
 s390x
 s390
Signature · 5 lines
2.43.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#2 lore raw

PATCH 2/4 Add script to generate syscalls.h

In reply to Andrea Cervesato

From: Andrea Cervesato <[email protected]>

Replicate the https://github.com/hrw/syscalls-table project way, by creating a script that automatically generate syscalls input files, merge them like regen.sh script does and to create syscalls.h header file which can be used by LTP tests to access syscalls values accoring to the architecture.

---
 include/lapi/syscalls/blacklist-syscalls.txt |   6 +
 include/lapi/syscalls/generate_syscalls.sh   | 292 +++++++++++++++++++++++++++
 2 files changed, 298 insertions(+)
include/lapi/syscalls/blacklist-syscalls.txt new file +6 -0
new file mode 100644
index 000000000..e1ae5f76f
@@ -0,0 +1,6 @@
+arch_specific_syscall
+available
+ni_syscall
+reserved
+SYSCALL_MASK
+unused
include/lapi/syscalls/generate_syscalls.sh new file +292 -0

292 lines not on this page · raw message

Signature · 5 lines
2.43.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#3 lore raw

PATCH 3/4 Deprecate old syscalls input files

In reply to Andrea Cervesato

From: Andrea Cervesato <[email protected]>

Remove all unneded syscalls input files and regen.sh script as well. These files will be automatically generated by the generate_syscalls.sh script, except for ia64 syscalls file since its architecture is not present in the kernel anymore.

---
 include/lapi/syscalls/aarch64.in        | 306 ----------
 include/lapi/syscalls/arc.in            | 325 -----------
 include/lapi/syscalls/arm.in            | 404 --------------
 include/lapi/syscalls/hppa.in           |  52 --
 include/lapi/syscalls/i386.in           | 439 ---------------
 include/lapi/syscalls/ia64.in           | 956 ++++++++++++++++++++------------
 include/lapi/syscalls/loongarch.in      | 310 -----------
 include/lapi/syscalls/mips_n32.in       | 379 -------------
 include/lapi/syscalls/mips_n64.in       | 355 ------------
 include/lapi/syscalls/mips_o32.in       | 425 --------------
 include/lapi/syscalls/powerpc.in        | 432 ---------------
 include/lapi/syscalls/powerpc64.in      | 432 ---------------
 include/lapi/syscalls/regen.sh          | 129 -----
 include/lapi/syscalls/s390.in           | 419 --------------
 include/lapi/syscalls/s390x.in          | 367 ------------
 include/lapi/syscalls/sh.in             | 413 --------------
 include/lapi/syscalls/sparc.in          | 418 --------------
 include/lapi/syscalls/sparc64.in        | 383 -------------
 include/lapi/syscalls/strip_syscall.awk |  19 -
 include/lapi/syscalls/x86_64.in         | 396 -------------
 20 files changed, 604 insertions(+), 6755 deletions(-)
include/lapi/syscalls/aarch64.in deleted +0 -306
deleted file mode 100644
index 61d4450bf..000000000
@@ -1,306 +0,0 @@
-io_setup 0
-io_destroy 1
-io_submit 2
-io_cancel 3
-io_getevents 4
-setxattr 5
-lsetxattr 6
-fsetxattr 7
-getxattr 8
-lgetxattr 9
-fgetxattr 10
-listxattr 11
-llistxattr 12
-flistxattr 13
-removexattr 14
-lremovexattr 15
-fremovexattr 16
-getcwd 17
-lookup_dcookie 18
-eventfd2 19
-epoll_create1 20
-epoll_ctl 21
-epoll_pwait 22
-dup 23
-dup3 24
-fcntl 25
-inotify_init1 26
-inotify_add_watch 27
-inotify_rm_watch 28
-ioctl 29
-ioprio_set 30
-ioprio_get 31
-flock 32
-mknodat 33
-mkdirat 34
-unlinkat 35
-symlinkat 36
-linkat 37
-renameat 38
-umount2 39
-mount 40
-pivot_root 41
-nfsservctl 42
-statfs 43
-fstatfs 44
-truncate 45
-ftruncate 46
-fallocate 47
-faccessat 48
-chdir 49
-fchdir 50
-chroot 51
-fchmod 52
-fchmodat 53
-fchownat 54
-fchown 55
-openat 56
-close 57
-vhangup 58
-pipe2 59
-quotactl 60
-getdents64 61
-lseek 62
-read 63
-write 64
-readv 65
-writev 66
-pread64 67
-pwrite64 68
-preadv 69
-pwritev 70
-sendfile 71
-pselect6 72
-ppoll 73
-signalfd4 74
-vmsplice 75
-splice 76
-tee 77
-readlinkat 78
-fstatat 79
-fstat 80
-sync 81
-fsync 82
-fdatasync 83
-sync_file_range2 84
-sync_file_range 84
-timerfd_create 85
-timerfd_settime 86
-timerfd_gettime 87
-utimensat 88
-acct 89
-capget 90
-capset 91
-personality 92
-exit 93
-exit_group 94
-waitid 95
-set_tid_address 96
-unshare 97
-futex 98
-set_robust_list 99
-get_robust_list 100
-nanosleep 101
-getitimer 102
-setitimer 103
-kexec_load 104
-init_module 105
-delete_module 106
-timer_create 107
-timer_gettime 108
-timer_getoverrun 109
-timer_settime 110
-timer_delete 111
-clock_settime 112
-clock_gettime 113
-clock_getres 114
-clock_nanosleep 115
-syslog 116
-ptrace 117
-sched_setparam 118
-sched_setscheduler 119
-sched_getscheduler 120
-sched_getparam 121
-sched_setaffinity 122
-sched_getaffinity 123
-sched_yield 124
-sched_get_priority_max 125
-sched_get_priority_min 126
-sched_rr_get_interval 127
-restart_syscall 128
-kill 129
-tkill 130
-tgkill 131
-sigaltstack 132
-rt_sigsuspend 133
-rt_sigaction 134
-rt_sigprocmask 135
-rt_sigpending 136
-rt_sigtimedwait 137
-rt_sigqueueinfo 138
-rt_sigreturn 139
-setpriority 140
-getpriority 141
-reboot 142
-setregid 143
-setgid 144
-setreuid 145
-setuid 146
-setresuid 147
-getresuid 148
-setresgid 149
-getresgid 150
-setfsuid 151
-setfsgid 152
-times 153
-setpgid 154
-getpgid 155
-getsid 156
-setsid 157
-getgroups 158
-setgroups 159
-uname 160
-sethostname 161
-setdomainname 162
-getrlimit 163
-setrlimit 164
-getrusage 165
-umask 166
-prctl 167
-getcpu 168
-gettimeofday 169
-settimeofday 170
-adjtimex 171
-getpid 172
-getppid 173
-getuid 174
-geteuid 175
-getgid 176
-getegid 177
-gettid 178
-sysinfo 179
-mq_open 180
-mq_unlink 181
-mq_timedsend 182
-mq_timedreceive 183
-mq_notify 184
-mq_getsetattr 185
-msgget 186
-msgctl 187
-msgrcv 188
-msgsnd 189
-semget 190
-semctl 191
-semtimedop 192
-semop 193
-shmget 194
-shmctl 195
-shmat 196
-shmdt 197
-socket 198
-socketpair 199
-bind 200
-listen 201
-accept 202
-connect 203
-getsockname 204
-getpeername 205
-sendto 206
-recvfrom 207
-setsockopt 208
-getsockopt 209
-shutdown 210
-sendmsg 211
-recvmsg 212
-readahead 213
-brk 214
-munmap 215
-mremap 216
-add_key 217
-request_key 218
-keyctl 219
-clone 220
-execve 221
-mmap 222
-fadvise64 223
-swapon 224
-swapoff 225
-mprotect 226
-msync 227
-mlock 228
-munlock 229
-mlockall 230
-munlockall 231
-mincore 232
-madvise 233
-remap_file_pages 234
-mbind 235
-get_mempolicy 236
-set_mempolicy 237
-migrate_pages 238
-move_pages 239
-rt_tgsigqueueinfo 240
-perf_event_open 241
-accept4 242
-recvmmsg 243
-wait4 260
-prlimit64 261
-fanotify_init 262
-fanotify_mark 263
-name_to_handle_at 264
-open_by_handle_at 265
-clock_adjtime 266
-syncfs 267
-setns 268
-sendmmsg 269
-process_vm_readv 270
-process_vm_writev 271
-kcmp 272
-finit_module 273
-sched_setattr 274
-sched_getattr 275
-renameat2 276
-seccomp 277
-getrandom 278
-memfd_create 279
-bpf 280
-execveat 281
-userfaultfd 282
-membarrier 283
-mlock2 284
-copy_file_range 285
-preadv2 286
-pwritev2 287
-pkey_mprotect 288
-pkey_alloc 289
-pkey_free 290
-statx 291
-io_pgetevents 292
-rseq 293
-kexec_file_load 294
-pidfd_send_signal 424
-io_uring_setup 425
-io_uring_enter 426
-io_uring_register 427
-open_tree 428
-move_mount 429
-fsopen 430
-fsconfig 431
-fsmount 432
-fspick 433
-pidfd_open 434
-clone3 435
-close_range 436
-openat2 437
-pidfd_getfd 438
-faccessat2 439
-epoll_pwait2 441
-quotactl_fd 443
-landlock_create_ruleset 444
-landlock_add_rule 445
-landlock_restrict_self 446
-futex_waitv 449
-cachestat 451
-fchmodat2 452
-mseal 462
-_sysctl 1078
include/lapi/syscalls/arc.in deleted +0 -325

325 lines not on this page · raw message

include/lapi/syscalls/arm.in deleted +0 -404

404 lines not on this page · raw message

include/lapi/syscalls/hppa.in deleted +0 -52

52 lines not on this page · raw message

include/lapi/syscalls/i386.in deleted +0 -439

439 lines not on this page · raw message

include/lapi/syscalls/ia64.in +604 -352

956 lines not on this page · raw message

include/lapi/syscalls/loongarch.in deleted +0 -310

310 lines not on this page · raw message

include/lapi/syscalls/mips_n32.in deleted +0 -379

208 lines not on this page · raw message

include/lapi/syscalls/mips_n64.in deleted +0 -355

355 lines not on this page · raw message

include/lapi/syscalls/mips_o32.in deleted +0 -425

425 lines not on this page · raw message

include/lapi/syscalls/powerpc.in deleted +0 -432

432 lines not on this page · raw message

include/lapi/syscalls/powerpc64.in deleted +0 -432

432 lines not on this page · raw message

include/lapi/syscalls/regen.sh deleted +0 -129

129 lines not on this page · raw message

include/lapi/syscalls/s390.in deleted +0 -419

419 lines not on this page · raw message

include/lapi/syscalls/s390x.in deleted +0 -367

367 lines not on this page · raw message

include/lapi/syscalls/sh.in deleted +0 -413

413 lines not on this page · raw message

include/lapi/syscalls/sparc.in deleted +0 -418

418 lines not on this page · raw message

include/lapi/syscalls/sparc64.in deleted +0 -383

383 lines not on this page · raw message

include/lapi/syscalls/strip_syscall.awk deleted +0 -19
deleted file mode 100755
index e8dff422e..000000000

Lines of this file are not shown. View the raw message.

include/lapi/syscalls/x86_64.in deleted +0 -396

396 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 5 lines
2.43.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

Part of the diff is not shown here. View the raw message.

#4 lore raw

PATCH 4/4 Save syscalls.h inside repo

In reply to Andrea Cervesato

From: Andrea Cervesato <[email protected]>

---
 include/lapi/.gitignore |     1 -
 include/lapi/syscalls.h | 34272 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 34272 insertions(+), 1 deletion(-)
include/lapi/.gitignore deleted +0 -1
deleted file mode 100644
index 9867b3f25..000000000
@@ -1 +0,0 @@
-syscalls.h
include/lapi/syscalls.h new file +34272 -0

2,999 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 5 lines
2.43.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

Part of the diff is not shown here. View the raw message.

#5 lore raw
In reply to Andrea Cervesato

Hi!

Please consider this patchset as a draft open for discussion.

Andrea

Quoted 53 lines · Andrea Cervesato

The problem we have at the moment is that all syscalls input files must be changed by hand each time we need to test a new syscall. The idea is to simplify this process, providing a script that is able to read from kernel sources and to generate all syscalls files we need.

This is done by the generate_syscalls.sh script that can be used as following:

./generate_syscalls.sh path/to/kernel/source path/to/syscalls.h

This approach requires a certain type of attention, due to the fact that we need to generate syscalls.h at each kernel version, or when new syscalls have been added in the kernel.

---
Andrea Cervesato (4):
Rename syscalls order file to supported-arch.txt Add script to generate syscalls.h Deprecate old syscalls input files
Save syscalls.h inside repo

  include/lapi/.gitignore                            |     1 -
  include/lapi/syscalls.h                            | 34272 +++++++++++++++++++
  include/lapi/syscalls/aarch64.in                   |   306 -
  include/lapi/syscalls/arc.in                       |   325 -
  include/lapi/syscalls/arm.in                       |   404 -
  include/lapi/syscalls/blacklist-syscalls.txt       |     6 +
  include/lapi/syscalls/generate_syscalls.sh         |   292 +
  include/lapi/syscalls/hppa.in                      |    52 -
  include/lapi/syscalls/i386.in                      |   439 -
  include/lapi/syscalls/ia64.in                      |   956 +-
  include/lapi/syscalls/loongarch.in                 |   310 -
  include/lapi/syscalls/mips_n32.in                  |   379 -
  include/lapi/syscalls/mips_n64.in                  |   355 -
  include/lapi/syscalls/mips_o32.in                  |   425 -
  include/lapi/syscalls/powerpc.in                   |   432 -
  include/lapi/syscalls/powerpc64.in                 |   432 -
  include/lapi/syscalls/regen.sh                     |   129 -
  include/lapi/syscalls/s390.in                      |   419 -
  include/lapi/syscalls/s390x.in                     |   367 -
  include/lapi/syscalls/sh.in                        |   413 -
  include/lapi/syscalls/sparc.in                     |   418 -
  include/lapi/syscalls/sparc64.in                   |   383 -
  include/lapi/syscalls/strip_syscall.awk            |    19 -
  .../lapi/syscalls/{order => supported-arch.txt}    |     1 -
  include/lapi/syscalls/x86_64.in                    |   396 -
  25 files changed, 35174 insertions(+), 6757 deletions(-)

---
base-commit: 968e6245d93bc91723e72086a71e6bc50f495d0b
change-id: 20240923-generate_syscalls-780dc2227bdb

Best regards,

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#6 lore raw
Quoted 4 lines · Andrea Cervesato via ltp

Hi!

Please consider this patchset as a draft open for discussion.

Have you compared old and new defines? Are there any differences (other than additions)?

Quoted 61 lines

Andrea

Quoted 48 lines · Andrea Cervesato

The problem we have at the moment is that all syscalls input files must be changed by hand each time we need to test a new syscall. The idea is to simplify this process, providing a script that is able to read from kernel sources and to generate all syscalls files we need.

This is done by the generate_syscalls.sh script that can be used as following:

./generate_syscalls.sh path/to/kernel/source path/to/syscalls.h

This approach requires a certain type of attention, due to the fact that we need to generate syscalls.h at each kernel version, or when new syscalls have been added in the kernel.

---
Andrea Cervesato (4):
Rename syscalls order file to supported-arch.txt Add script to generate syscalls.h Deprecate old syscalls input files
Save syscalls.h inside repo

  include/lapi/.gitignore                            |     1 -
  include/lapi/syscalls.h                            | 34272 +++++++++++++++++++
  include/lapi/syscalls/aarch64.in                   |   306 -
  include/lapi/syscalls/arc.in                       |   325 -
  include/lapi/syscalls/arm.in                       |   404 -
  include/lapi/syscalls/blacklist-syscalls.txt       |     6 +
  include/lapi/syscalls/generate_syscalls.sh         |   292 +
  include/lapi/syscalls/hppa.in                      |    52 -
  include/lapi/syscalls/i386.in                      |   439 -
  include/lapi/syscalls/ia64.in                      |   956 +-
  include/lapi/syscalls/loongarch.in                 |   310 -
  include/lapi/syscalls/mips_n32.in                  |   379 -
  include/lapi/syscalls/mips_n64.in                  |   355 -
  include/lapi/syscalls/mips_o32.in                  |   425 -
  include/lapi/syscalls/powerpc.in                   |   432 -
  include/lapi/syscalls/powerpc64.in                 |   432 -
  include/lapi/syscalls/regen.sh                     |   129 -
  include/lapi/syscalls/s390.in                      |   419 -
  include/lapi/syscalls/s390x.in                     |   367 -
  include/lapi/syscalls/sh.in                        |   413 -
  include/lapi/syscalls/sparc.in                     |   418 -
  include/lapi/syscalls/sparc64.in                   |   383 -
  include/lapi/syscalls/strip_syscall.awk            |    19 -
  .../lapi/syscalls/{order => supported-arch.txt}    |     1 -
  include/lapi/syscalls/x86_64.in                    |   396 -
  25 files changed, 35174 insertions(+), 6757 deletions(-)
Quoted 5 lines

---
base-commit: 968e6245d93bc91723e72086a71e6bc50f495d0b
change-id: 20240923-generate_syscalls-780dc2227bdb

Best regards,

--
Mailing list info: https://lists.linux.it/listinfo/ltp

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#7 lore raw
Quoted 8 lines · Jan Stancek
Quoted 3 lines · Andrea Cervesato via ltp

Hi!

Please consider this patchset as a draft open for discussion.

Have you compared old and new defines? Are there any differences (other than additions)?

Only additions, but this is a draft work and I'm searching for alternative ideas as well. For example, the limitation of this approach is that syscalls.h has to be generated anyway.

At the same time, we have projects like https://github.com/hrw/syscalls-table (that inspired my script) providing python bindings and *maybe* it could be used to create a python script which generate .in files when they need to be updated.

Etc..

Quoted 59 lines
Quoted 59 lines

Andrea

Quoted 48 lines · Andrea Cervesato

The problem we have at the moment is that all syscalls input files must be changed by hand each time we need to test a new syscall. The idea is to simplify this process, providing a script that is able to read from kernel sources and to generate all syscalls files we need.

This is done by the generate_syscalls.sh script that can be used as following:

./generate_syscalls.sh path/to/kernel/source path/to/syscalls.h

This approach requires a certain type of attention, due to the fact that we need to generate syscalls.h at each kernel version, or when new syscalls have been added in the kernel.

---
Andrea Cervesato (4):
Rename syscalls order file to supported-arch.txt Add script to generate syscalls.h Deprecate old syscalls input files
Save syscalls.h inside repo

   include/lapi/.gitignore                            |     1 -
   include/lapi/syscalls.h                            | 34272 +++++++++++++++++++
   include/lapi/syscalls/aarch64.in                   |   306 -
   include/lapi/syscalls/arc.in                       |   325 -
   include/lapi/syscalls/arm.in                       |   404 -
   include/lapi/syscalls/blacklist-syscalls.txt       |     6 +
   include/lapi/syscalls/generate_syscalls.sh         |   292 +
   include/lapi/syscalls/hppa.in                      |    52 -
   include/lapi/syscalls/i386.in                      |   439 -
   include/lapi/syscalls/ia64.in                      |   956 +-
   include/lapi/syscalls/loongarch.in                 |   310 -
   include/lapi/syscalls/mips_n32.in                  |   379 -
   include/lapi/syscalls/mips_n64.in                  |   355 -
   include/lapi/syscalls/mips_o32.in                  |   425 -
   include/lapi/syscalls/powerpc.in                   |   432 -
   include/lapi/syscalls/powerpc64.in                 |   432 -
   include/lapi/syscalls/regen.sh                     |   129 -
   include/lapi/syscalls/s390.in                      |   419 -
   include/lapi/syscalls/s390x.in                     |   367 -
   include/lapi/syscalls/sh.in                        |   413 -
   include/lapi/syscalls/sparc.in                     |   418 -
   include/lapi/syscalls/sparc64.in                   |   383 -
   include/lapi/syscalls/strip_syscall.awk            |    19 -
   .../lapi/syscalls/{order => supported-arch.txt}    |     1 -
   include/lapi/syscalls/x86_64.in                    |   396 -
   25 files changed, 35174 insertions(+), 6757 deletions(-)
Quoted 5 lines

---
base-commit: 968e6245d93bc91723e72086a71e6bc50f495d0b
change-id: 20240923-generate_syscalls-780dc2227bdb

Best regards,

--
Mailing list info: https://lists.linux.it/listinfo/ltp

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#8 lore raw
Quoted 7 lines · Andrea Cervesato
Quoted 4 lines · Jan Stancek
Quoted 2 lines · Andrea Cervesato via ltp

Hi!

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Please consider this patchset as a draft open for discussion.

Have you compared old and new defines? Are there any differences (other than additions)?

Only additions, but this is a draft work and I'm searching for alternative ideas as well.
For example, the limitation of this approach is that syscalls.h has to be generated anyway.

I guess it wouldn't be too difficult to change script to generate .in files instead, right?

Quoted 5 lines

At the same time, we have projects like
https://github.com/hrw/syscalls-table (that inspired my script) providing python bindings and *maybe* it could be used to create a python script which generate .in files when they need to be updated.

python feels like an extra step, since we could do it in existing shell script. Maybe store a copy of update-tables.sh in LTP repo, and add some wrapper to provide create_tables_for_LTP() function and a check to print warning if original github project changes update-tables.sh.

create_tables_for_LTP() would generate .in files and rest can stay as it is.

Quoted 63 lines

Etc..

Quoted 59 lines
Quoted 59 lines

Andrea

Quoted 48 lines · Andrea Cervesato

The problem we have at the moment is that all syscalls input files must be changed by hand each time we need to test a new syscall. The idea is to simplify this process, providing a script that is able to read from kernel sources and to generate all syscalls files we need.

This is done by the generate_syscalls.sh script that can be used as following:

./generate_syscalls.sh path/to/kernel/source path/to/syscalls.h

This approach requires a certain type of attention, due to the fact that we need to generate syscalls.h at each kernel version, or when new syscalls have been added in the kernel.

---
Andrea Cervesato (4):
Rename syscalls order file to supported-arch.txt Add script to generate syscalls.h Deprecate old syscalls input files
Save syscalls.h inside repo

   include/lapi/.gitignore                            |     1 -
   include/lapi/syscalls.h                            | 34272 +++++++++++++++++++
   include/lapi/syscalls/aarch64.in                   |   306 -
   include/lapi/syscalls/arc.in                       |   325 -
   include/lapi/syscalls/arm.in                       |   404 -
   include/lapi/syscalls/blacklist-syscalls.txt       |     6 +
   include/lapi/syscalls/generate_syscalls.sh         |   292 +
   include/lapi/syscalls/hppa.in                      |    52 -
   include/lapi/syscalls/i386.in                      |   439 -
   include/lapi/syscalls/ia64.in                      |   956 +-
   include/lapi/syscalls/loongarch.in                 |   310 -
   include/lapi/syscalls/mips_n32.in                  |   379 -
   include/lapi/syscalls/mips_n64.in                  |   355 -
   include/lapi/syscalls/mips_o32.in                  |   425 -
   include/lapi/syscalls/powerpc.in                   |   432 -
   include/lapi/syscalls/powerpc64.in                 |   432 -
   include/lapi/syscalls/regen.sh                     |   129 -
   include/lapi/syscalls/s390.in                      |   419 -
   include/lapi/syscalls/s390x.in                     |   367 -
   include/lapi/syscalls/sh.in                        |   413 -
   include/lapi/syscalls/sparc.in                     |   418 -
   include/lapi/syscalls/sparc64.in                   |   383 -
   include/lapi/syscalls/strip_syscall.awk            |    19 -
   .../lapi/syscalls/{order => supported-arch.txt}    |     1 -
   include/lapi/syscalls/x86_64.in                    |   396 -
   25 files changed, 35174 insertions(+), 6757 deletions(-)
Quoted 5 lines

---
base-commit: 968e6245d93bc91723e72086a71e6bc50f495d0b
change-id: 20240923-generate_syscalls-780dc2227bdb

Best regards,

--
Mailing list info: https://lists.linux.it/listinfo/ltp

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#9 lore raw
Quoted 12 lines · Jan Stancek
Quoted 10 lines · Andrea Cervesato
Quoted 8 lines · Jan Stancek
Quoted 3 lines · Andrea Cervesato via ltp

Hi!

Please consider this patchset as a draft open for discussion.

Have you compared old and new defines? Are there any differences (other than additions)?

Quoted 6 lines
Quoted 4 lines

Only additions, but this is a draft work and I'm searching for alternative ideas as well.
For example, the limitation of this approach is that syscalls.h has to be generated anyway.

I guess it wouldn't be too difficult to change script to generate .in files instead, right?

I'm already doing it in the generate_syscalls.sh script, so it's quite easy. The point is if we want to make this extra step, because maybe we can just download the tables already created by the syscalls-table project and we have .in files for free. But that approach has downsides of course.

Quoted 10 lines
Quoted 4 lines

At the same time, we have projects like
https://github.com/hrw/syscalls-table (that inspired my script) providing python bindings and *maybe* it could be used to create a python script which generate .in files when they need to be updated.

python feels like an extra step, since we could do it in existing shell script. Maybe store a copy of update-tables.sh in LTP repo, and add some wrapper to provide create_tables_for_LTP() function and a check to print warning if original github project changes update-tables.sh.

create_tables_for_LTP() would generate .in files and rest can stay as it is.

I was also thinking that maybe it's enough to have 2 scripts: one for updating syscalls .in files when needed and one for merging them.

The only problem I see in this approach is: when do we want to update tables? It would be nice to do that every ./configure , but that would be too much because of git/curl dependency.

Quoted 61 lines
Quoted 61 lines

Etc..

Quoted 59 lines
Quoted 59 lines

Andrea

Quoted 52 lines · Andrea Cervesato

The problem we have at the moment is that all syscalls input files must be changed by hand each time we need to test a new syscall. The idea is to simplify this process, providing a script that is able to read from kernel sources and to generate all syscalls files we need.

This is done by the generate_syscalls.sh script that can be used as following:

./generate_syscalls.sh path/to/kernel/source path/to/syscalls.h

This approach requires a certain type of attention, due to the fact that we need to generate syscalls.h at each kernel version, or when new syscalls have been added in the kernel.

---
Andrea Cervesato (4):
Rename syscalls order file to supported-arch.txt Add script to generate syscalls.h Deprecate old syscalls input files
Save syscalls.h inside repo

include/lapi/.gitignore | 1 -
include/lapi/syscalls.h | 34272 +++++++++++++++++++
include/lapi/syscalls/aarch64.in | 306 -
include/lapi/syscalls/arc.in | 325 -
include/lapi/syscalls/arm.in | 404 -
include/lapi/syscalls/blacklist-syscalls.txt | 6 +
include/lapi/syscalls/generate_syscalls.sh | 292 +
include/lapi/syscalls/hppa.in | 52 -
include/lapi/syscalls/i386.in | 439 -
include/lapi/syscalls/ia64.in | 956 +-
include/lapi/syscalls/loongarch.in | 310 -
include/lapi/syscalls/mips_n32.in | 379 -
include/lapi/syscalls/mips_n64.in | 355 -
include/lapi/syscalls/mips_o32.in | 425 -
include/lapi/syscalls/powerpc.in | 432 -
include/lapi/syscalls/powerpc64.in | 432 -
include/lapi/syscalls/regen.sh | 129 -
include/lapi/syscalls/s390.in | 419 -
include/lapi/syscalls/s390x.in | 367 -
include/lapi/syscalls/sh.in | 413 -
include/lapi/syscalls/sparc.in | 418 -
include/lapi/syscalls/sparc64.in | 383 -
include/lapi/syscalls/strip_syscall.awk | 19 -
.../lapi/syscalls/{order => supported-arch.txt} | 1 -
include/lapi/syscalls/x86_64.in | 396 -
25 files changed, 35174 insertions(+), 6757 deletions(-)
---
base-commit: 968e6245d93bc91723e72086a71e6bc50f495d0b
change-id: 20240923-generate_syscalls-780dc2227bdb

Quoted 1 line

Best regards,

--
Mailing list info: https://lists.linux.it/listinfo/ltp

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#10 lore raw
Quoted 35 lines · Andrea Cervesato
Quoted 12 lines · Jan Stancek
Quoted 10 lines · Andrea Cervesato
Quoted 8 lines · Jan Stancek
Quoted 3 lines · Andrea Cervesato via ltp

Hi!

Please consider this patchset as a draft open for discussion.

Have you compared old and new defines? Are there any differences (other than additions)?

Quoted 6 lines
Quoted 4 lines

Only additions, but this is a draft work and I'm searching for alternative ideas as well.
For example, the limitation of this approach is that syscalls.h has to be generated anyway.

I guess it wouldn't be too difficult to change script to generate .in files instead, right?

I'm already doing it in the generate_syscalls.sh script, so it's quite easy. The point is if we want to make this extra step, because maybe we can just download the tables already created by the syscalls-table project and we have .in files for free. But that approach has downsides of course.

Quoted 9 lines
Quoted 4 lines

At the same time, we have projects like
https://github.com/hrw/syscalls-table (that inspired my script) providing python bindings and *maybe* it could be used to create a python script which generate .in files when they need to be updated.

python feels like an extra step, since we could do it in existing shell script. Maybe store a copy of update-tables.sh in LTP repo, and add some wrapper to provide create_tables_for_LTP() function and a check to print warning if original github project changes update-tables.sh.

Quoted 8 lines
Quoted 1 line

create_tables_for_LTP() would generate .in files and rest can stay as it is.

I was also thinking that maybe it's enough to have 2 scripts: one for updating syscalls .in files when needed and one for merging them.

The only problem I see in this approach is: when do we want to update tables? It would be nice to do that every ./configure , but that would be too much because of git/curl dependency.

LTP can run in labs with no external network access, so I'd avoid any download as part of configure. And in unlikely case github project disappears we would have
LTP releases out there with broken configure.

Looking at git log, in last couple years we updated syscalls maybe 3-4 times each year.
I think it's enough to have it as an extra step when we need to update syscalls. I see it as a helper script you run to patch .in files. Even if that uses readily available
tables from github project, it would still be a patch that people can review and spot
potential issues (originating from script or tables).

Quoted 63 lines
Quoted 62 lines
Quoted 62 lines

Etc..

Quoted 59 lines
Quoted 59 lines

Andrea

Quoted 52 lines · Andrea Cervesato

The problem we have at the moment is that all syscalls input files must be changed by hand each time we need to test a new syscall. The idea is to simplify this process, providing a script that is able to read from kernel sources and to generate all syscalls files we need.

This is done by the generate_syscalls.sh script that can be used as following:

./generate_syscalls.sh path/to/kernel/source path/to/syscalls.h

This approach requires a certain type of attention, due to the fact that we need to generate syscalls.h at each kernel version, or when new syscalls have been added in the kernel.

---
Andrea Cervesato (4):
Rename syscalls order file to supported-arch.txt Add script to generate syscalls.h Deprecate old syscalls input files
Save syscalls.h inside repo

include/lapi/.gitignore | 1 -
include/lapi/syscalls.h | 34272 +++++++++++++++++++
include/lapi/syscalls/aarch64.in | 306 -
include/lapi/syscalls/arc.in | 325 -
include/lapi/syscalls/arm.in | 404 -
include/lapi/syscalls/blacklist-syscalls.txt | 6 +
include/lapi/syscalls/generate_syscalls.sh | 292 +
include/lapi/syscalls/hppa.in | 52 -
include/lapi/syscalls/i386.in | 439 -
include/lapi/syscalls/ia64.in | 956 +-
include/lapi/syscalls/loongarch.in | 310 -
include/lapi/syscalls/mips_n32.in | 379 -
include/lapi/syscalls/mips_n64.in | 355 -
include/lapi/syscalls/mips_o32.in | 425 -
include/lapi/syscalls/powerpc.in | 432 -
include/lapi/syscalls/powerpc64.in | 432 -
include/lapi/syscalls/regen.sh | 129 -
include/lapi/syscalls/s390.in | 419 -
include/lapi/syscalls/s390x.in | 367 -
include/lapi/syscalls/sh.in | 413 -
include/lapi/syscalls/sparc.in | 418 -
include/lapi/syscalls/sparc64.in | 383 -
include/lapi/syscalls/strip_syscall.awk | 19 -
.../lapi/syscalls/{order => supported-arch.txt} | 1 -
include/lapi/syscalls/x86_64.in | 396 -
25 files changed, 35174 insertions(+), 6757 deletions(-)
---
base-commit: 968e6245d93bc91723e72086a71e6bc50f495d0b
change-id: 20240923-generate_syscalls-780dc2227bdb

Quoted 1 line

Best regards,

--
Mailing list info: https://lists.linux.it/listinfo/ltp

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#11 lore raw
Quoted 47 lines · Jan Stancek
Quoted 33 lines · Andrea Cervesato
Quoted 11 lines · Jan Stancek
Quoted 9 lines · Andrea Cervesato
Quoted 8 lines · Jan Stancek
Quoted 3 lines · Andrea Cervesato via ltp

Hi!

Please consider this patchset as a draft open for discussion.

Have you compared old and new defines? Are there any differences (other than additions)?

Quoted 6 lines
Quoted 4 lines

Only additions, but this is a draft work and I'm searching for alternative ideas as well.
For example, the limitation of this approach is that syscalls.h has to be generated anyway.

I guess it wouldn't be too difficult to change script to generate .in files instead, right?

I'm already doing it in the generate_syscalls.sh script, so it's quite easy. The point is if we want to make this extra step, because maybe we can just download the tables already created by the syscalls-table project and we have .in files for free. But that approach has downsides of course.

Quoted 9 lines
Quoted 4 lines

At the same time, we have projects like
https://github.com/hrw/syscalls-table (that inspired my script) providing python bindings and *maybe* it could be used to create a python script which generate .in files when they need to be updated.

python feels like an extra step, since we could do it in existing shell script. Maybe store a copy of update-tables.sh in LTP repo, and add some wrapper to provide create_tables_for_LTP() function and a check to print warning if original github project changes update-tables.sh.

Quoted 7 lines
Quoted 1 line

create_tables_for_LTP() would generate .in files and rest can stay as it is.

I was also thinking that maybe it's enough to have 2 scripts: one for updating syscalls .in files when needed and one for merging them.

The only problem I see in this approach is: when do we want to update tables? It would be nice to do that every ./configure , but that would be too much because of git/curl dependency.

LTP can run in labs with no external network access, so I'd avoid any download as part of configure. And in unlikely case github project disappears we would have
LTP releases out there with broken configure.

Quoted 8 lines

Looking at git log, in last couple years we updated syscalls maybe 3-4 times each year.
I think it's enough to have it as an extra step when we need to update syscalls. I see it as a helper script you run to patch .in files. Even if that uses readily available
tables from github project, it would still be a patch that people can review and spot
potential issues (originating from script or tables).

Yeah, this is something i was thinking about. We can create a script for merging new syscalls into the current .in files and script can be triggered only when needed. I will take a look at it.

Thanks for the feedback

Quoted 61 lines
Quoted 61 lines
Quoted 61 lines
Quoted 61 lines

Etc..

Quoted 59 lines
Quoted 59 lines

Andrea

Quoted 52 lines · Andrea Cervesato

The problem we have at the moment is that all syscalls input files must be changed by hand each time we need to test a new syscall. The idea is to simplify this process, providing a script that is able to read from kernel sources and to generate all syscalls files we need.

This is done by the generate_syscalls.sh script that can be used as following:

./generate_syscalls.sh path/to/kernel/source path/to/syscalls.h

This approach requires a certain type of attention, due to the fact that we need to generate syscalls.h at each kernel version, or when new syscalls have been added in the kernel.

---
Andrea Cervesato (4):
Rename syscalls order file to supported-arch.txt Add script to generate syscalls.h Deprecate old syscalls input files
Save syscalls.h inside repo

include/lapi/.gitignore | 1 -
include/lapi/syscalls.h | 34272 +++++++++++++++++++
include/lapi/syscalls/aarch64.in | 306 -
include/lapi/syscalls/arc.in | 325 -
include/lapi/syscalls/arm.in | 404 -
include/lapi/syscalls/blacklist-syscalls.txt | 6 +
include/lapi/syscalls/generate_syscalls.sh | 292 +
include/lapi/syscalls/hppa.in | 52 -
include/lapi/syscalls/i386.in | 439 -
include/lapi/syscalls/ia64.in | 956 +-
include/lapi/syscalls/loongarch.in | 310 -
include/lapi/syscalls/mips_n32.in | 379 -
include/lapi/syscalls/mips_n64.in | 355 -
include/lapi/syscalls/mips_o32.in | 425 -
include/lapi/syscalls/powerpc.in | 432 -
include/lapi/syscalls/powerpc64.in | 432 -
include/lapi/syscalls/regen.sh | 129 -
include/lapi/syscalls/s390.in | 419 -
include/lapi/syscalls/s390x.in | 367 -
include/lapi/syscalls/sh.in | 413 -
include/lapi/syscalls/sparc.in | 418 -
include/lapi/syscalls/sparc64.in | 383 -
include/lapi/syscalls/strip_syscall.awk | 19 -
.../lapi/syscalls/{order => supported-arch.txt} | 1 -
include/lapi/syscalls/x86_64.in | 396 -
25 files changed, 35174 insertions(+), 6757 deletions(-)
---
base-commit: 968e6245d93bc91723e72086a71e6bc50f495d0b
change-id: 20240923-generate_syscalls-780dc2227bdb

Quoted 1 line

Best regards,

--
Mailing list info: https://lists.linux.it/listinfo/ltp

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp