diff -urN strace-4.5.19-orig/Makefile.am strace-4.5.19/Makefile.am --- strace-4.5.19-orig/Makefile.am 2009-10-10 07:10:09 +0900 +++ strace-4.5.19/Makefile.am 2009-10-29 11:37:14 +0900 @@ -18,6 +18,8 @@ proc.c scsi.c stream.c noinst_HEADERS = defs.h +strace_SOURCES += sound.c + EXTRA_DIST = $(man_MANS) errnoent.sh signalent.sh syscallent.sh ioctlsort.c \ debian/changelog debian/control debian/copyright debian/rules \ debian/compat debian/strace64.install debian/strace64.manpages \ diff -urN strace-4.5.19-orig/Makefile.in strace-4.5.19/Makefile.in --- strace-4.5.19-orig/Makefile.in 2009-10-22 02:41:14 +0900 +++ strace-4.5.19/Makefile.in 2009-10-29 11:40:13 +0900 @@ -65,6 +65,7 @@ resource.$(OBJEXT) signal.$(OBJEXT) sock.$(OBJEXT) \ system.$(OBJEXT) term.$(OBJEXT) time.$(OBJEXT) proc.$(OBJEXT) \ scsi.$(OBJEXT) stream.$(OBJEXT) +am_strace_OBJECTS += sound.$(OBJEXT) strace_OBJECTS = $(am_strace_OBJECTS) strace_LDADD = $(LDADD) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; @@ -229,6 +230,7 @@ resource.c signal.c sock.c system.c term.c time.c \ proc.c scsi.c stream.c +strace_SOURCES += sound.c noinst_HEADERS = defs.h EXTRA_DIST = $(man_MANS) errnoent.sh signalent.sh syscallent.sh ioctlsort.c \ debian/changelog debian/control debian/copyright debian/rules \ @@ -454,6 +456,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scsi.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/signal.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sock.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sound.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strace.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/syscall.Po@am__quote@ diff -urN strace-4.5.19-orig/ioctl.c strace-4.5.19/ioctl.c --- strace-4.5.19-orig/ioctl.c 2007-06-30 20:37:09 +0900 +++ strace-4.5.19/ioctl.c 2009-10-29 11:37:14 +0900 @@ -117,6 +117,10 @@ { switch ((code >> 8) & 0xff) { #ifdef LINUX + case 'M': case 'P': + return sound_ioctl(tcp, code, arg); +#endif +#ifdef LINUX #if defined(ALPHA) || defined(POWERPC) case 'f': case 't': case 'T': #else /* !ALPHA */ diff -urN strace-4.5.19-orig/sound.c strace-4.5.19/sound.c --- strace-4.5.19-orig/sound.c 1970-01-01 09:00:00 +0900 +++ strace-4.5.19/sound.c 2009-10-29 11:37:14 +0900 @@ -0,0 +1,195 @@ +/* + * Copyright (c) 2004 Andrew Church + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $Id: $ + */ + +#include "defs.h" + +#ifdef LINUX + +#include + +static struct xlat mixer_device_mask[] = { + { SOUND_MASK_VOLUME, "SOUND_MASK_VOLUME" }, + { SOUND_MASK_BASS, "SOUND_MASK_BASS" }, + { SOUND_MASK_TREBLE, "SOUND_MASK_TREBLE" }, + { SOUND_MASK_SYNTH, "SOUND_MASK_SYNTH" }, + { SOUND_MASK_PCM, "SOUND_MASK_PCM" }, + { SOUND_MASK_SPEAKER, "SOUND_MASK_SPEAKER" }, + { SOUND_MASK_LINE, "SOUND_MASK_LINE" }, + { SOUND_MASK_MIC, "SOUND_MASK_MIC" }, + { SOUND_MASK_CD, "SOUND_MASK_CD" }, + { SOUND_MASK_IMIX, "SOUND_MASK_IMIX" }, + { SOUND_MASK_ALTPCM, "SOUND_MASK_ALTPCM" }, + { SOUND_MASK_RECLEV, "SOUND_MASK_RECLEV" }, + { SOUND_MASK_IGAIN, "SOUND_MASK_IGAIN" }, + { SOUND_MASK_OGAIN, "SOUND_MASK_OGAIN" }, + { SOUND_MASK_LINE1, "SOUND_MASK_LINE1" }, + { SOUND_MASK_LINE2, "SOUND_MASK_LINE2" }, + { SOUND_MASK_LINE3, "SOUND_MASK_LINE3" }, + { SOUND_MASK_DIGITAL1, "SOUND_MASK_DIGITAL1" }, + { SOUND_MASK_DIGITAL2, "SOUND_MASK_DIGITAL2" }, + { SOUND_MASK_DIGITAL3, "SOUND_MASK_DIGITAL3" }, + { SOUND_MASK_PHONEIN, "SOUND_MASK_PHONEIN" }, + { SOUND_MASK_PHONEOUT, "SOUND_MASK_PHONEOUT" }, + { SOUND_MASK_RADIO, "SOUND_MASK_RADIO" }, + { SOUND_MASK_VIDEO, "SOUND_MASK_VIDEO" }, + { SOUND_MASK_MONITOR, "SOUND_MASK_MONITOR" }, + { 0, NULL } +}; + +int +sound_ioctl(struct tcb *tcp, int code, int arg) +{ + int val; + struct count_info ci; + + switch (code) { + case SOUND_MIXER_READ_VOLUME: + case SOUND_MIXER_READ_BASS: + case SOUND_MIXER_READ_TREBLE: + case SOUND_MIXER_READ_SYNTH: + case SOUND_MIXER_READ_PCM: + case SOUND_MIXER_READ_SPEAKER: + case SOUND_MIXER_READ_LINE: + case SOUND_MIXER_READ_MIC: + case SOUND_MIXER_READ_CD: + case SOUND_MIXER_READ_IMIX: + case SOUND_MIXER_READ_ALTPCM: + case SOUND_MIXER_READ_RECLEV: + case SOUND_MIXER_READ_IGAIN: + case SOUND_MIXER_READ_OGAIN: + case SOUND_MIXER_READ_LINE1: + case SOUND_MIXER_READ_LINE2: + case SOUND_MIXER_READ_LINE3: + /* Pointer to result */ + if (entering(tcp)) + return 1; + if (arg == 0) + tprintf(", NULL"); + else if (syserror(tcp)) + tprintf(", %#x", arg); + else if (umove(tcp, arg, &val) < 0) + tprintf(", ..."); + else + tprintf(", %d:%d", (val>>8) & 0xFF, val & 0xFF); + return 1; + + case SNDCTL_DSP_RESET: + case SNDCTL_DSP_SYNC: + case SNDCTL_DSP_POST: + /* No parameter */ + return 1; + + case SNDCTL_DSP_SPEED: + case SNDCTL_DSP_STEREO: + case SNDCTL_DSP_GETBLKSIZE: + case SNDCTL_DSP_SETFMT: + case SNDCTL_DSP_CHANNELS: + case SNDCTL_DSP_SUBDIVIDE: + /* Pointer to parameter and result */ + if (arg == 0) { + if (entering(tcp)) + tprintf(", NULL"); + } else if (syserror(tcp)) { + if (entering(tcp)) + tprintf(", %#x", arg); + } else if (umove(tcp, arg, &val) < 0) { + if (entering(tcp)) + tprintf(", ..."); + } else { + tprintf("%s %d", entering(tcp) ? "," : " ->", val); + } + return 1; + + case SNDCTL_DSP_SETFRAGMENT: + /* Pointer to parameter and result */ + if (arg == 0) { + if (entering(tcp)) + tprintf(", NULL"); + } else if (syserror(tcp)) { + if (entering(tcp)) + tprintf(", %#x", arg); + } else if (umove(tcp, arg, &val) < 0) { + if (entering(tcp)) + tprintf(", ..."); + } else { + tprintf("%s %d", entering(tcp) ? "," : " ->", val); + } + return 1; + + case SNDCTL_DSP_GETFMTS: + case SNDCTL_DSP_GETCAPS: + /* Pointer to result */ + if (entering(tcp)) + return 1; + if (arg == 0) + tprintf(", NULL"); + else if (syserror(tcp)) + tprintf(", %#x", arg); + else if (umove(tcp, arg, &val) < 0) + tprintf(", ..."); + else + tprintf(", %#x", val); + return 1; + + case SNDCTL_DSP_GETOSPACE: + case SNDCTL_DSP_GETISPACE: + case SNDCTL_DSP_GETODELAY: + /* Pointer to result */ + if (entering(tcp)) + return 1; + if (arg == 0) + tprintf(", NULL"); + else if (syserror(tcp)) + tprintf(", %#x", arg); + else if (umove(tcp, arg, &val) < 0) + tprintf(", ..."); + else + tprintf(", %d", val); + return 1; + + case SNDCTL_DSP_GETIPTR: + case SNDCTL_DSP_GETOPTR: + /* Pointer to count_info result */ + if (entering(tcp)) + return 1; + if (arg == 0) + tprintf(", NULL"); + else if (syserror(tcp)) + tprintf(", %#x", arg); + else if (umove(tcp, arg, &ci) < 0) + tprintf(", ..."); + else + tprintf(", {%d,%d,%#x}", ci.bytes, ci.blocks, ci.ptr); + return 1; + } + + return 0; +} + +#endif /* LINUX */