git: 39de84b619b0 - main - kdump: Decode Linux clock_nanosleep syscall

From: Dmitry Chagin <dchagin_at_FreeBSD.org>
Date: Wed, 22 Jun 2022 11:41:07 UTC
The branch main has been updated by dchagin:

URL: https://cgit.FreeBSD.org/src/commit/?id=39de84b619b0d8bb27aa77e49b6134ca06370e1a

commit 39de84b619b0d8bb27aa77e49b6134ca06370e1a
Author:     Dmitry Chagin <dchagin@FreeBSD.org>
AuthorDate: 2022-06-22 11:21:42 +0000
Commit:     Dmitry Chagin <dchagin@FreeBSD.org>
CommitDate: 2022-06-22 11:21:42 +0000

    kdump: Decode Linux clock_nanosleep syscall
    
    MFC after:              2 weeks
---
 lib/libsysdecode/linux.c       |  7 +++++++
 lib/libsysdecode/mklinuxtables |  1 +
 lib/libsysdecode/sysdecode.h   |  1 +
 usr.bin/kdump/linux.c          | 22 ++++++++++++++++++++++
 4 files changed, 31 insertions(+)

diff --git a/lib/libsysdecode/linux.c b/lib/libsysdecode/linux.c
index adaf6172618d..79e71d1207ca 100644
--- a/lib/libsysdecode/linux.c
+++ b/lib/libsysdecode/linux.c
@@ -190,3 +190,10 @@ sysdecode_linux_sigprocmask_how(int how)
 
 	return (lookup_value(sigprocmaskhow, how));
 }
+
+bool
+sysdecode_linux_clock_flags(FILE *fp, int flags, int *rem)
+{
+
+	return (print_mask_int(fp, clockflags, flags, rem));
+}
diff --git a/lib/libsysdecode/mklinuxtables b/lib/libsysdecode/mklinuxtables
index efd579adff35..caeeb785b4d3 100644
--- a/lib/libsysdecode/mklinuxtables
+++ b/lib/libsysdecode/mklinuxtables
@@ -89,6 +89,7 @@ cat <<_EOF_
 _EOF_
 
 gen_table "clockids"    "LINUX_CLOCK_[A-Z_]+[[:space:]]+[0-9]+"          "compat/linux/linux_timer.h"
+gen_table "clockflags"  "LINUX_TIMER_[A-Z_]+[[:space:]]+0x[0-9]+"        "compat/linux/linux_timer.h"
 gen_table "clockcpuids" "LINUX_CPUCLOCK_[A-Z_]+[[:space:]]+[0-9]+"       "compat/linux/linux_timer.h"	"_MASK|_MAX"
 gen_table "sigprocmaskhow" "LINUX_SIG_[A-Z]+[[:space:]]+[0-9]+"          "compat/linux/linux.h"
 
diff --git a/lib/libsysdecode/sysdecode.h b/lib/libsysdecode/sysdecode.h
index 4412f5d70078..4a826f489a16 100644
--- a/lib/libsysdecode/sysdecode.h
+++ b/lib/libsysdecode/sysdecode.h
@@ -140,6 +140,7 @@ bool	sysdecode_shmflags(FILE *_fp, int _flags, int *_rem);
 #define	SYSDECODE_HAVE_LINUX
 
 void	sysdecode_linux_clockid(FILE *_fp, clockid_t _which);
+bool	sysdecode_linux_clock_flags(FILE *_fp, int _flags, int *_rem);
 const char *sysdecode_linux_signal(int _sig);
 const char *sysdecode_linux_sigprocmask_how(int _how);
 
diff --git a/usr.bin/kdump/linux.c b/usr.bin/kdump/linux.c
index f55d0b7da83d..1d9768fc302d 100644
--- a/usr.bin/kdump/linux.c
+++ b/usr.bin/kdump/linux.c
@@ -87,6 +87,17 @@ ktrsyscall_linux(struct ktr_syscall *ktr, register_t **resip,
 		ip++;
 		narg--;
 		break;
+	case LINUX_SYS_linux_clock_nanosleep:
+		putchar('(');
+		sysdecode_linux_clockid(stdout, *ip);
+		putchar(',');
+		ip++;
+		narg--;
+		print_mask_arg0(sysdecode_linux_clock_flags, *ip);
+		c = ',';
+		ip++;
+		narg--;
+		break;
 	case LINUX_SYS_linux_kill:
 	case LINUX_SYS_linux_tkill:
 	case LINUX_SYS_linux_rt_sigqueueinfo:
@@ -169,6 +180,17 @@ ktrsyscall_linux32(struct ktr_syscall *ktr, register_t **resip,
 		ip++;
 		narg--;
 		break;
+	case LINUX32_SYS_linux_clock_nanosleep:
+		putchar('(');
+		sysdecode_linux_clockid(stdout, *ip);
+		putchar(',');
+		ip++;
+		narg--;
+		print_mask_arg0(sysdecode_linux_clock_flags, *ip);
+		c = ',';
+		ip++;
+		narg--;
+		break;
 	case LINUX32_SYS_linux_kill:
 	case LINUX32_SYS_linux_tkill:
 	case LINUX32_SYS_linux_rt_sigqueueinfo: