-grep "^syscall [^ ]* nr [^ ]* nbargs ${NRARGS} " ${SRCFILE} > ${TMPFILE}
-sed 's/^syscall \([^ ]*\) nr \([^ ]*\) nbargs \([^ ]*\) '\
-'types: (\([^,]*\), \([^,]*\), \([^,]*\), \([^,]*\), \([^,]*\), \([^)]*\)) '\
-'args: (\([^,]*\), \([^,]*\), \([^,]*\), \([^,]*\), \([^,]*\), \([^)]*\))/'\
-'TRACE_EVENT(sys_\1,\n'\
-' TP_PROTO(\4 \10, \5 \11, \6 \12, \7 \13, \8 \14, \9 \15),\n'\
-' TP_ARGS(\10, \11, \12, \13, \14, \15),\n'\
-' TP_STRUCT__entry(__field(\4, \10) __field(\5, \11) __field(\6, \12) __field(\7, \13) __field(\8, \14) __field(\9, \15)),\n'\
-' TP_fast_assign(tp_assign(\10, \10) tp_assign(\11, \11) tp_assign(\12, 12) tp_assign(\13, \13) tp_assign(\14, \14) tp_assign(\15, \15)),\n'\
-' TP_printk()\n'\
-')/g'\
- ${TMPFILE} >> ${HEADER}
+grep "^syscall [^ ]* nr [^ ]* nbargs ${NRARGS} " "${SRCFILE}" | while read -r LINE; do
+ SC_NAME=$(echo "${LINE}" | perl -p -e 's/^syscall ([^ ]*) .*/$1/g')
+ ARG1=$(./lttng-get-syscall-inout.sh table-syscall-inout.txt "${SC_NAME}" 1)
+ ARG2=$(./lttng-get-syscall-inout.sh table-syscall-inout.txt "${SC_NAME}" 2)
+ ARG3=$(./lttng-get-syscall-inout.sh table-syscall-inout.txt "${SC_NAME}" 3)
+ ARG4=$(./lttng-get-syscall-inout.sh table-syscall-inout.txt "${SC_NAME}" 4)
+ ARG5=$(./lttng-get-syscall-inout.sh table-syscall-inout.txt "${SC_NAME}" 5)
+ ARG6=$(./lttng-get-syscall-inout.sh table-syscall-inout.txt "${SC_NAME}" 6)
+
+ echo Syscall: "${SC_NAME}" "${ARG1}" "${ARG2}" "${ARG3}" "${ARG4}" "${ARG5}" "${ARG6}"
+
+ # shellcheck disable=SC2026
+ echo "${LINE}" | perl -p -e 's/^syscall ([^ ]*) nr ([^ ]*) nbargs ([^ ]*) '\
+'types: \(([^,]*), ([^,]*), ([^,]*), ([^,]*), ([^,]*), ([^\)]*)\) '\
+'args: \(([^,]*), ([^,]*), ([^,]*), ([^,]*), ([^,]*), ([^\)]*)\)/'\
+'#ifndef OVERRIDE_'"${BITNESS}"'_$1\n'\
+'SC_LTTNG_TRACEPOINT_EVENT($1,\n'\
+' TP_PROTO(sc_exit(long ret,) $4 $10, $5 $11, $6 $12, $7 $13, $8 $14, $9 $15),\n'\
+' TP_ARGS(sc_exit(ret,) $10, $11, $12, $13, $14, $15),\n'\
+' TP_FIELDS(sc_exit(ctf_integer(long, ret, ret)) '"${ARG1}"'(ctf_integer($4, $10, $10)) '"${ARG2}"'(ctf_integer($5, $11, $11)) '"${ARG3}"'(ctf_integer($6, $12, $12)) '"${ARG4}"'(ctf_integer($7, $13, $13)) '"${ARG5}"'(ctf_integer($8, $14, $14)) '"${ARG6}"'(ctf_integer($9, $15, $15)))\n'\
+')\n'\
+'#endif/g' >> "${HEADER}"
+done