From nobody Sun Feb 11 17:04:49 2024 X-Original-To: dev-commits-ports-all@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 4TXv8d2j3Nz5B45R; Sun, 11 Feb 2024 17:04:49 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TXv8d2Ck1z4lSM; Sun, 11 Feb 2024 17:04:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1707671089; 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=B3cUj3fVHck0BEegB8oGdAyyzNX98yHZ2og3NBHjHcw=; b=fbhbdmH9zfD3rEI+R7WCu0lec+7vZbZLGiyAILuT7KFWLuA0RSrqufXBhUwLXiIPhry27t H5MLj9fveAzvwAX8s8P1R6/MY959+4z1EGQK345p5qw1UjXHfmRGKkD53ehZsE1Od6X70X FdKdweWwqWTLZRZryTyiajG8a8Gdn0BqE9FCHMVzwxgmuq3Z9Yi4WtmvuCP2UEetsctwDv c8CnLd1nIu3chDLTWDG9mNfLNS+6ByODIojpoONvXNEqKwim2oJfrzhDhcEjONAlwUdNYv xoIFSng0WopA6kzM4UR1SLa69AXxJPpv70Hjw0fGWuwTvFPn6Kgsnp63LcSslw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1707671089; a=rsa-sha256; cv=none; b=CBSsgQSqlRJqvM0Yn+dUi6PdvZNHH0wSrsY7IgS2MmRgJhUEaaVwnejEPOSyN9pqJ/rs/m evJA7QX/mzHW5hyNkITgXUGDrCoGl2QQzrzLt1ZTjUc/tcvwVwhD73aAU7a9HJFSx5sSGB a4hE6xCCiJhwSBjkf7DGOrgjFrPcfvOMEHpEg+3FAMKgEOWwKxbVsgtnnjt3gMs3LLkc0a yoJebTvBGsv8/qMONDwgY/CLR81MvHhEELdJLz7p42NXX38HmCCOQqZl5+wnHdT3J77w76 uHTnbBicO25CrdDyYUn1aMUGBj0Lyk2RErIzajwIKpoFvbdBjehMVH8YZHOz5w== 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=1707671089; 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=B3cUj3fVHck0BEegB8oGdAyyzNX98yHZ2og3NBHjHcw=; b=XpmUKriY/tNzUgx5bmk2aPgxwbnpRStkMhCQ1i5y/dHy+GLJO6Bwfd4hZxVIbNMWPsvzWW oulabgkdTzgcmCO17SfUwDhtXX5thDiKJkms54w7XEzLF0tamKsV23U++92T6ZLiYMM4hq pr25PN+LjLQMxD11N/uI8UrpUVVriRa7C3hBQckcSYAX5i0oCgMHByH5st/YxWMdA5i0mQ MiuHeZoa4bcGKfv2NxenamcOdhosD0G8gvy4lV0cy+Ag9LWvB97dnHUu3sCIRlW95EqO2S rpKFzPXCxdogsms0Gr1VHfUG4T5ylyWedNlKjitIUUNrT1x7U4EZk+CT0ayHtQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4TXv8d1CLfz171S; Sun, 11 Feb 2024 17:04:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 41BH4nn9025276; Sun, 11 Feb 2024 17:04:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 41BH4nmK025273; Sun, 11 Feb 2024 17:04:49 GMT (envelope-from git) Date: Sun, 11 Feb 2024 17:04:49 GMT Message-Id: <202402111704.41BH4nmK025273@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Yuri Victorovich Subject: git: 100a9852dd89 - main - audio/jack: Remove obsolete realtime hack for RC service, with checks List-Id: Commit messages for all branches of the ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-all@freebsd.org X-BeenThere: dev-commits-ports-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: yuri X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 100a9852dd8957a1d7a337858a3319da693915c9 Auto-Submitted: auto-generated The branch main has been updated by yuri: URL: https://cgit.FreeBSD.org/ports/commit/?id=100a9852dd8957a1d7a337858a3319da693915c9 commit 100a9852dd8957a1d7a337858a3319da693915c9 Author: Florian Walpen AuthorDate: 2024-02-11 17:03:42 +0000 Commit: Yuri Victorovich CommitDate: 2024-02-11 17:03:42 +0000 audio/jack: Remove obsolete realtime hack for RC service, with checks PR: 276607 --- audio/jack/Makefile | 2 +- audio/jack/files/jackd.in | 43 ++++++++++++++++++++++++++++++++++++------- audio/jack/pkg-message | 11 +++++++---- 3 files changed, 44 insertions(+), 12 deletions(-) diff --git a/audio/jack/Makefile b/audio/jack/Makefile index 49efc4daf81a..f8eeea1cf31e 100644 --- a/audio/jack/Makefile +++ b/audio/jack/Makefile @@ -1,7 +1,7 @@ PORTNAME= jackit DISTVERSIONPREFIX= v DISTVERSION= 1.9.22 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= audio MAINTAINER= dev@submerge.ch diff --git a/audio/jack/files/jackd.in b/audio/jack/files/jackd.in index 9f135a6c8f1b..e78285044ea7 100644 --- a/audio/jack/files/jackd.in +++ b/audio/jack/files/jackd.in @@ -11,7 +11,7 @@ : ${jackd_enable="NO"} : ${jackd_user="root"} : ${jackd_rtprio="NO"} -: ${jackd_args="-r -doss -r44100 -p1024 -n3 -w16"} +: ${jackd_args="--no-realtime -doss -r48000 -p1024 -w32"} . /etc/rc.subr @@ -20,15 +20,44 @@ rcvar=jackd_enable procname=%%PREFIX%%/bin/jackd start_cmd="start_jackd" +fail() { + echo "JACK failed to start: $1" >&2 + exit 1 +} + +check_config() { + # check that jackd_user is set + if [ -z "$jackd_user" ]; then + fail "jackd_user has to be defined" + fi + + # detect intent to use realtime priority + if [ "$jackd_rtprio" = "YES" ] || \ + { echo "$jackd_args" | grep -q -- "oss" && \ + { echo "$jackd_args" | grep -qw -- "--realtime" || \ + echo "$jackd_args" | grep -qw -- "-[A-Za-mo-z]*R[A-Za-z]*"; }; }; then + # check that mac_priority(4) is enabled + if [ "$(sysctl -qn security.mac.priority.realtime)" != "1" ]; then + fail "Realtime priority requires mac_priority(4) to be loaded" + fi + # check that the user has realtime privileges + if ! (su -m "$jackd_user" -c "rtprio 10 test -z"); then + fail "User jackd_user=$jackd_user is not a member of the realtime group" + fi + fi +} + start_jackd() { echo "Starting ${name}." - if [ $jackd_rtprio = "YES" ]; then - local rt="rtprio 1" - fi + + # check that setup is valid + check_config + # log the date and parameters - echo -e "\n[`date`] Starting the daemon, user=$jackd_user rtprio=$jackd_rtprio args=\"$jackd_args\"" >> /var/log/${name}.log - # daemon(8) should be able to set the realtime priority, but it isn't - $rt daemon -p /var/run/${name}.pid -u "${jackd_user}" %%PREFIX%%/bin/jackd ${jackd_args} + echo -e "\n[`date`] Starting the daemon, user=$jackd_user args=\"$jackd_args\"" >> /var/log/${name}.log + + # start the daemon + daemon -p /var/run/${name}.pid -u "$jackd_user" %%PREFIX%%/bin/jackd $jackd_args } load_rc_config ${name} diff --git a/audio/jack/pkg-message b/audio/jack/pkg-message index 2a94946d2d57..6ab2e5764e59 100644 --- a/audio/jack/pkg-message +++ b/audio/jack/pkg-message @@ -3,11 +3,15 @@ The new JACK server comes with a DBUS control interface: $ jack_control help $ jack_control ds oss $ jack_control dp +$ jack_control dps rate 48000 +$ jack_control dps wordlength 16 +$ jack_control dps capture /dev/dsp0 +$ jack_control dps playback /dev/dsp0 $ jack_control eps realtime False $ jack_control start -Only root can grant real-time priority to processes for now, using rtprio(1). -Upcoming FreeBSD releases will have a MAC policy with a realtime user group. +To use real-time priority for JACK server and clients, load the mac_priority(4) +module and add the JACK user to the realtime group. Memory locking has to be allowed in /etc/login.conf or ~/.login_conf. Set the resource limit ":memorylocked=unlimited:" and don't forget to run @@ -19,8 +23,7 @@ Note that only one JACK server can be run at a time. An /etc/rc.conf example: jackd_enable="YES" jackd_user="joe" -jackd_rtprio="YES" -jackd_args="-R -doss -r48000 -p1024 -n1 -w16 \ +jackd_args="--no-realtime -doss -r48000 -p1024 -w16 \ --capture /dev/dsp0 --playback /dev/dsp0" Official JACK example clients and tools are available as jack-example-tools.