git: 8e36d212594b - main - sound: Support oss_audioinfo->cmd

From: Christos Margiolis <christos_at_FreeBSD.org>
Date: Tue, 18 Jun 2024 13:19:30 UTC
The branch main has been updated by christos:

URL: https://cgit.FreeBSD.org/src/commit/?id=8e36d212594b542cb0c57d549e0b57fd0f7e307c

commit 8e36d212594b542cb0c57d549e0b57fd0f7e307c
Author:     Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2024-06-18 13:18:58 +0000
Commit:     Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2024-06-18 13:18:58 +0000

    sound: Support oss_audioinfo->cmd
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 day
    Reviewed by:    dev_submerge.ch, markj
    Differential Revision:  https://reviews.freebsd.org/D45603
---
 sys/dev/sound/pcm/dsp.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c
index c737df33b97d..0f6d7e6b7f49 100644
--- a/sys/dev/sound/pcm/dsp.c
+++ b/sys/dev/sound/pcm/dsp.c
@@ -2047,6 +2047,7 @@ dsp_oss_audioinfo_unavail(oss_audioinfo *ai, int unit)
 	ai->dev = unit;
 	snprintf(ai->name, sizeof(ai->name), "pcm%d (unavailable)", unit);
 	ai->pid = -1;
+	strlcpy(ai->cmd, CHN_COMM_UNUSED, sizeof(ai->cmd));
 	ai->card_number = unit;
 	ai->port_number = unit;
 	ai->mixer_dev = -1;
@@ -2132,6 +2133,7 @@ dsp_oss_audioinfo(struct cdev *i_dev, oss_audioinfo *ai, bool ex)
 	ai->dev = unit;
 	strlcpy(ai->name, device_get_desc(d->dev), sizeof(ai->name));
 	ai->pid = -1;
+	strlcpy(ai->cmd, CHN_COMM_UNKNOWN, sizeof(ai->cmd));
 	ai->card_number = -1;
 	ai->port_number = -1;
 	ai->mixer_dev = (d->mixer_dev != NULL) ? unit : -1;
@@ -2317,14 +2319,8 @@ dsp_oss_engineinfo(struct cdev *i_dev, oss_audioinfo *ai)
 			else
 				ai->busy = (ch->direction == PCMDIR_PLAY) ? OPEN_WRITE : OPEN_READ;
 
-			/**
-			 * @note
-			 * @c cmd - OSSv4 docs: "Only supported under Linux at
-			 *    this moment." Cop-out, I know, but I'll save
-			 *    running around in the process table for later.
-			 *    Is there a risk of leaking information?
-			 */
 			ai->pid = ch->pid;
+			strlcpy(ai->cmd, ch->comm, sizeof(ai->cmd));
 
 			/*
 			 * These flags stolen from SNDCTL_DSP_GETCAPS handler.