Package: alsa-base
Version: 1.0.17.dfsg-4
Severity: wishlist
Tags: patch

In a desktop build of debian live, i've noticed alsa drags in lsof as
well as python. I hope alsa can rid itself of the heavy python
dependency, though in the meantime I hope you'll at least drop lsof.

Attached is a patch and it's not as fast as lsof or fuser (from psmisc,
which is much faster than lsof).

http://stackoverflow.com/questions/526132/finding-processes-using-alsa-sound-fast

Anyway I don't think the small performance decrease is too bad, as I
assume force_unload_modules is called rarely.

Thank you,

-- Package-specific info:
--- Begin additional package status ---
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Cfg-files/Unpacked/Failed-cfg/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Name                 Version              Description
+++-====================-====================-========================================================
ii  libasound2           1.0.16-2             ALSA library
--- End additional package status ---
--- Begin /proc/asound/version ---
Advanced Linux Sound Architecture Driver Version 1.0.16.
--- End /proc/asound/version ---
--- Begin /proc/asound/cards ---
 0 [Intel          ]: HDA-Intel - HDA Intel
                      HDA Intel at 0xfe020000 irq 17
--- End /proc/asound/cards ---
--- Begin /dev/snd/ listing ---
total 0
crw-rw---- 1 root audio 116,  0 2009-02-09 18:10 controlC0
crw-rw---- 1 root audio 116, 24 2009-02-09 18:10 pcmC0D0c
crw-rw---- 1 root audio 116, 16 2009-02-09 22:11 pcmC0D0p
crw-rw---- 1 root audio 116, 17 2009-02-09 18:10 pcmC0D1p
crw-rw---- 1 root audio 116,  1 2009-02-09 18:10 seq
crw-rw---- 1 root audio 116, 33 2009-02-09 18:10 timer
--- End /dev/snd/ listing ---

-- System Information:
Debian Release: 5.0
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 2.6.26-1-686 (SMP w/2 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages alsa-base depends on:
ii  linux-sound-base           1.0.17.dfsg-4 base package for ALSA and OSS soun
ii  lsof                       4.78.dfsg.1-4 List open files
ii  module-init-tools          3.4-1         tools for managing Linux kernel mo

Versions of packages alsa-base recommends:
ii  alsa-utils                    1.0.16-2   ALSA utilities

Versions of packages alsa-base suggests:
ii  alsa-oss                      1.0.17-1   ALSA wrapper for OSS applications
ii  apmd                          3.2.2-12   Utilities for Advanced Power Manag
ii  oss-compat                    0.0.4+nmu2 OSS compatibility package

Versions of packages libasound2 depends on:
ii  libc6                         2.7-18     GNU C Library: Shared libraries

-- no debconf information
diff -u debian/alsa-base.init /tmp/alsadeb/alsa-base.init
--- debian/alsa-base.init	2009-02-09 22:16:50.000000000 +0000
+++ /tmp/alsadeb/alsa-base.init	2009-02-09 22:15:56.000000000 +0000
@@ -46,12 +46,13 @@
 
 echo_procs_using_sound()
 {
-	echo $( \
-		lsof +D /dev -F rt \
-		| awk '/^p/ {pid=$1} /^t/ {type=$1} /^r0x(74|e)..$/ && type == "tCHR" {print pid}' \
-		| cut -c 2- \
-		| uniq \
-	)
+echo $(for i in /proc/[0-9]*/fd/*
+do
+	if readlink $i | grep -q /dev/snd/pcm
+	then
+		IFS=/; set -- $i; unset IFS; echo -n "$3 "
+	fi
+done)
 }
 
 # $* [PID]...
diff -u debian/control /tmp/alsadeb/control
--- debian/control	2009-02-09 22:16:50.000000000 +0000
+++ /tmp/alsadeb/control	2009-02-09 22:15:56.000000000 +0000
@@ -26,7 +26,7 @@
 Package: alsa-base
 Architecture: all
 Provides: alsa
-Depends: ${misc:Depends}, lsof (>= 4.64), module-init-tools (>= 3.2.1), linux-sound-base
+Depends: ${misc:Depends}, module-init-tools (>= 3.2.1), linux-sound-base
 Recommends: alsa-utils
 Suggests: apmd (>= 3.0.2-1), alsa-oss, oss-compat
 Conflicts: modutils (= 2.3.20-1), lsof-2.2 (<< 4.64), discover1 (<< 1.7.3), discover (<< 2.0.7-1), alsa-utils (<< 1.0.9a-4)
Common subdirectories: debian/patches and /tmp/alsadeb/patches
Common subdirectories: debian/po and /tmp/alsadeb/po

Reply via email to