From nobody Thu Jun 18 19:33:43 2026 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4gh9rR5r6lz6hp65 for ; Thu, 18 Jun 2026 19:33:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gh9rR4vv7z3mXQ for ; Thu, 18 Jun 2026 19:33:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1781811223; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NG1us6+kKYhVRCCIGu8QED7KUiOd7aIl3+HQPDRAAd4=; b=WW+qj5ZaCe2S5FZ4GAZ0FbsCwCP8t/KS9YQhTSz0G/24Q+rFY2hRrU36iKo+2f8oDtMmdB HMu9y3tJyKzBH7h1KHpynG6nx7usERSXyDP/AHqn0LBDCatEAVa+4gZH7D8lPadv8oYItu bPLC3gDF2xkAzl6TzAaf9agrO4ka60SW6KNKjLp6PyKMacNaLj+pfXEBCdZiNULg8Po/C0 SWsa5ZDFlPqTErbioOcZQK7P1Gdb0as80XBvJtKCw55DCza1P/T1PgoU5vjm7gZFKcaWR1 0pLgQ96TIOm7l5teDiDbTbl4RU3bRofkWnd01cSGW+KEOSA1p4PEBRVoOo5dKw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1781811223; a=rsa-sha256; cv=none; b=j9HDiqRMH5aSfLH2ZVGydclWqz2dcNKFiNR+PHHjz5QCJLOwfknXc+VC8VFikeFgqmMP3a Sh9L/LHiWHda+PAZcrogfDUeOqgIn6F1oyBFM4qbQMxJeV1zuIZmn51W9X1NbWRnbl6isK bCsY7OY0jwjgA7alRAHK+aFv9+SpdYJJyX0lkneOwwXBqtJG3Tmtl0gzyiH7FXT8dHOKM/ a4dOd2V+89/TpP0eSoAJjOFIW0ihGhP8xiMPxjt/+cGS2kAqN3HUpJmQ/7oG10hc7Wenpu udVOpNCOulCtWAR/+OlGso+L0SwheVw2fBJQb4EHP1uXhjbmSLeM7XIGWhvFtQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1781811223; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NG1us6+kKYhVRCCIGu8QED7KUiOd7aIl3+HQPDRAAd4=; b=FrAqC4hnesrBKS4yeLqRenwVRMwCos93GcJ5v+fqHcbSRIoU5/rQST2Ai59fv4CTXcTXI8 VYqhzTAx1+jawNGxzvbd46S2XvMzj1vlEsdA6DBZLhC46GpR+27cl/1tmkz/kzf4pPZfo8 /ZHgQeASG9uJh6E9wlSbOdAF2aNc+OAasaxuj2tmaW4UOSJk2VZErHaWQ3bc9kIWPgnvxL fnDHovYQPeUK/3Nk+uoRYMk5GJIIysUsdyhbGXYtgs+kZtNlVzt5mVZoz6QE2UBjmiEQDA iJxjsIko2lweOO9JjkLQhmQPGfCpyjBi4wlV1TLvgEFRFfq2WE3zXk0bqqP50g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gh9rR3r7rz1BYg for ; Thu, 18 Jun 2026 19:33:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 32df2 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 18 Jun 2026 19:33:43 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Christos Margiolis Subject: git: ac0068384a22 - stable/15 - virtual_oss(8): Make sndstat FD global List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: ac0068384a2228670327fe56bef9e8168c6996d0 Auto-Submitted: auto-generated Date: Thu, 18 Jun 2026 19:33:43 +0000 Message-Id: <6a344817.32df2.11661809@gitrepo.freebsd.org> The branch stable/15 has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=ac0068384a2228670327fe56bef9e8168c6996d0 commit ac0068384a2228670327fe56bef9e8168c6996d0 Author: Christos Margiolis AuthorDate: 2026-06-09 13:36:48 +0000 Commit: Christos Margiolis CommitDate: 2026-06-18 19:33:35 +0000 virtual_oss(8): Make sndstat FD global There is no reason to have per-profile copies, plus this way we open /dev/sndstat multiple times if more than 1 profile is created. Also close the FD on exit to avoid leaking. Sponsored by: The FreeBSD Foundation MFC after: 1 week Reviewed by: jrm Pull-Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/41 (cherry picked from commit 93a234a694f37d373acf303a247d129dda28044e) --- usr.sbin/virtual_oss/virtual_oss/int.h | 1 - usr.sbin/virtual_oss/virtual_oss/main.c | 16 +++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/usr.sbin/virtual_oss/virtual_oss/int.h b/usr.sbin/virtual_oss/virtual_oss/int.h index dbe35dbefd58..141aa8af09f5 100644 --- a/usr.sbin/virtual_oss/virtual_oss/int.h +++ b/usr.sbin/virtual_oss/virtual_oss/int.h @@ -142,7 +142,6 @@ struct virtual_profile { double rx_compressor_gain[VMAX_CHAN]; uint8_t synchronized; uint32_t rec_delay; - int fd_sta; struct { const char * host; const char * port; diff --git a/usr.sbin/virtual_oss/virtual_oss/main.c b/usr.sbin/virtual_oss/virtual_oss/main.c index a6cf691e7fbb..a9ff7d59e584 100644 --- a/usr.sbin/virtual_oss/virtual_oss/main.c +++ b/usr.sbin/virtual_oss/virtual_oss/main.c @@ -1638,6 +1638,7 @@ struct voss_backend *voss_tx_backend; static int voss_dups; static int voss_ntds; static pthread_t *voss_tds; +static int voss_fd_sta = -1; /* XXX I do not like the prefix argument... */ static struct voss_backend * @@ -1843,7 +1844,7 @@ init_sndstat(vprofile_t *ptr) warn("Failed to pack nvlist"); goto done; } - err = ioctl(ptr->fd_sta, SNDSTIOC_ADD_USER_DEVS, &arg); + err = ioctl(voss_fd_sta, SNDSTIOC_ADD_USER_DEVS, &arg); free(arg.buf); if (err != 0) { warn("Failed to issue ioctl(SNDSTIOC_ADD_USER_DEVS)"); @@ -1910,7 +1911,6 @@ dup_profile(vprofile_t *pvp, int *pamp, int pol, int rx_mute, memcpy(ptr, pvp, sizeof(*ptr)); ptr->synchronized = synchronized; - ptr->fd_sta = -1; TAILQ_INIT(&ptr->head); for (x = 0; x != ptr->channels; x++) { @@ -1951,12 +1951,13 @@ dup_profile(vprofile_t *pvp, int *pamp, int pol, int rx_mute, ptr->oss_dev = pdev; /* register to sndstat */ - ptr->fd_sta = open("/dev/sndstat", O_WRONLY); - if (ptr->fd_sta < 0) { - warn("Could not open /dev/sndstat"); - } else { - init_sndstat(ptr); + if (voss_fd_sta < 0) { + if ((voss_fd_sta = open("/dev/sndstat", O_WRONLY)) < 0) { + errstr = "Could not open /dev/sndstat"; + goto err; + } } + init_sndstat(ptr); } /* create WAV device */ if (ptr->wav_name[0] != 0) { @@ -2676,6 +2677,7 @@ main(int argc, char **argv) } cuse_uninit(); + close(voss_fd_sta); return (0); }