From 7b0c308ab47a9ee06c64773f428e3468c9e4d000 Mon Sep 17 00:00:00 2001 From: mbuhl Date: Thu, 8 Sep 2022 16:04:31 +0000 Subject: [PATCH] Support the sendmmsg and recvmmsg system calls. Input guenther@ OK bluhm@ --- usr.bin/kdump/kdump.c | 4 +++- usr.bin/kdump/ktrstruct.c | 21 ++++++++++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/usr.bin/kdump/kdump.c b/usr.bin/kdump/kdump.c index ef6bb1126bc..0523056dc87 100644 --- a/usr.bin/kdump/kdump.c +++ b/usr.bin/kdump/kdump.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kdump.c,v 1.149 2022/07/20 05:56:36 deraadt Exp $ */ +/* $OpenBSD: kdump.c,v 1.150 2022/09/08 16:04:31 mbuhl Exp $ */ /*- * Copyright (c) 1988, 1993 @@ -720,6 +720,8 @@ static const formatter scargs[][8] = { [SYS_ptrace] = { Ptracedecode, Ppid_t, Pptr, Pdecint }, [SYS_recvmsg] = { Pfd, Pptr, Sendrecvflagsname }, [SYS_sendmsg] = { Pfd, Pptr, Sendrecvflagsname }, + [SYS_recvmmsg] = { Pfd, Pptr, Pucount, Sendrecvflagsname, Pptr }, + [SYS_sendmmsg] = { Pfd, Pptr, Pucount, Sendrecvflagsname }, [SYS_recvfrom] = { Pfd, Pptr, Pbigsize, Sendrecvflagsname }, [SYS_accept] = { Pfd, Pptr, Pptr }, [SYS_getpeername] = { Pfd, Pptr, Pptr }, diff --git a/usr.bin/kdump/ktrstruct.c b/usr.bin/kdump/ktrstruct.c index 45f7ce21b2b..a036f331706 100644 --- a/usr.bin/kdump/ktrstruct.c +++ b/usr.bin/kdump/ktrstruct.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ktrstruct.c,v 1.29 2020/12/21 07:47:37 otto Exp $ */ +/* $OpenBSD: ktrstruct.c,v 1.30 2022/09/08 16:04:31 mbuhl Exp $ */ /*- * Copyright (c) 1988, 1993 @@ -397,6 +397,18 @@ ktrquota(const struct dqblk *quota) printf(" }\n"); } +static void +ktrmmsghdr(const struct mmsghdr *mmsg) +{ + printf("struct mmsghdr { msg_hdr = { name=%p, namelen=%u, " + "iov=%p, iovlen=%u, control=%p, controllen=%u, flags=", + mmsg->msg_hdr.msg_name, mmsg->msg_hdr.msg_namelen, + mmsg->msg_hdr.msg_iov, mmsg->msg_hdr.msg_iovlen, + mmsg->msg_hdr.msg_control, mmsg->msg_hdr.msg_controllen); + sendrecvflagsname(mmsg->msg_hdr.msg_flags); + printf(" }, msg_len = %u }\n", mmsg->msg_len); +} + static void ktrmsghdr(const struct msghdr *msg) { @@ -649,6 +661,13 @@ ktrstruct(char *buf, size_t buflen) goto invalid; memcpy(&msg, data, datalen); ktrmsghdr(&msg); + } else if (strcmp(name, "mmsghdr") == 0) { + struct mmsghdr mmsg; + + if (datalen != sizeof(mmsg)) + goto invalid; + memcpy(&mmsg, data, datalen); + ktrmmsghdr(&mmsg); } else if (strcmp(name, "iovec") == 0) { if (datalen % sizeof(struct iovec)) goto invalid; -- 2.20.1