From nobody Thu Jun 11 09:31:10 2026 X-Original-To: dev-commits-src-main@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 4gbcpQ4SWbz6h35M for ; Thu, 11 Jun 2026 09:31:10 +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 "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gbcpQ3pN7z3qVP for ; Thu, 11 Jun 2026 09:31:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1781170270; 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=qEQBwol+w++b+8d9UZm+mNY9aYdzmgnH+bfxZjmQfcc=; b=mfv+HnQ11wwfc4GDjseFPvLWp+PU8VEcEksR84ADdWpLwdVixRgfVRCFnAMppOHiyeH7X+ vccqADokjZvktWRHmP3F5Qm7XzjE3WLeH8nCTLlSA8CQZOe2KgVCkbnedqyCw2Vi+LeHS1 jyHCx1mM4OaWRGHA6vrNfshwpw/YAFFlyWQpwrlUB3FtZ3kPU25N1nyryyNuFRJbKpJ7eZ acBPT9yt4DnJGp51Jc4NUHtzvycNgeGxczppYqE7YchjSWeXask33N6jpHbsPUTzpI14sL lrflXyCpdErmdvgLSJcEJgNpDCKRynRAYvdXmKCRkQpJGgQdUIWlkmBs0qOjhg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1781170270; a=rsa-sha256; cv=none; b=hzjFFPYZbLg5V8XEmmP0wT9b4zODFrtT+1jfQdHJi3QHhzCZL2qmKH66OnCKpxnPf17Th+ uQTIfXliHJnf5VpB1PUkvMRmn/LtPqRB+veXtBaWk7N6fhhVJOdJyllnaiwl76xvs7Ek1s w4j5skPhoahnt6fEPREOtfPrnY5tcguV6f8iBz/pfpTg38bA/xvsOQzobp+DWme+FYDrRE YeIe7H8K5Ez+BLsCT4HvKd7LeAs/mU3iEe7Hb1/eYnqvGLHYjFVaUsSHvwiP+QJzdOJGo9 2RfitNe9mg95hq10DBCiG5/P78j6o/uzeeFy94FN605s2FuuC5fligSdy8qMpQ== 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=1781170270; 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=qEQBwol+w++b+8d9UZm+mNY9aYdzmgnH+bfxZjmQfcc=; b=UH80hcDfvwndycZN+DcN8PX7FQiKadqWXQT6bNKw5Vht9o8piAjQkOGl4KwYAi27Vce9Vh 9btKC/gFQKLDkm3+hvriRQ67cJcSZinf2a9e+VD3AfZpaRV/ZZ1aT4nu8IgNF1PBCe+lrA r7zjMtLW99gAeEt5pgqCxqJ6ZMX3nx9NOFYk96r6PCZ4FNUIVpTGNvLigQKJkdxh4JOI09 j4IFri2aYomvUouw0PPsDzp34Ikx/PNlVe//wNflbx9I8ZLtQbtHZz/B0HkhAspXlBFVZL QSYDzSf6kQI+EntxKeOZIpJxqWYYUQy+6Jm7t6Z6rT3edY7dSFDPigiLO9Colg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gbcpQ2xltzlnJ for ; Thu, 11 Jun 2026 09:31:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 33bb2 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 11 Jun 2026 09:31:10 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 93a234a694f3 - main - virtual_oss(8): Make sndstat FD global List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 93a234a694f37d373acf303a247d129dda28044e Auto-Submitted: auto-generated Date: Thu, 11 Jun 2026 09:31:10 +0000 Message-Id: <6a2a805e.33bb2.5f1f90bb@gitrepo.freebsd.org> The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=93a234a694f37d373acf303a247d129dda28044e commit 93a234a694f37d373acf303a247d129dda28044e Author: Christos Margiolis AuthorDate: 2026-06-09 13:36:48 +0000 Commit: Christos Margiolis CommitDate: 2026-06-11 09:30:29 +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 --- 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 7b7cabd62743..3cff923b2cfb 100644 --- a/usr.sbin/virtual_oss/virtual_oss/int.h +++ b/usr.sbin/virtual_oss/virtual_oss/int.h @@ -144,7 +144,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 9eafd5549a5c..5b50f8e5ef6c 100644 --- a/usr.sbin/virtual_oss/virtual_oss/main.c +++ b/usr.sbin/virtual_oss/virtual_oss/main.c @@ -1640,6 +1640,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 * @@ -1845,7 +1846,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)"); @@ -1912,7 +1913,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++) { @@ -1953,12 +1953,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) { @@ -2678,6 +2679,7 @@ main(int argc, char **argv) } cuse_uninit(); + close(voss_fd_sta); return (0); }