Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Apr 1995 08:39:17 -0400 (EDT)
From:      Sujal Patel <smpatel@wam.umd.edu>
To:        Steven Wallace <swallace@ece.uci.edu>
Cc:        hackers@FreeBSD.org
Subject:   Re: Whee - I've got my MBONE feed.. 
Message-ID:  <Pine.BSD.3.91.950404083056.136I-100000@xi.dorm.umd.edu>
In-Reply-To: <199504040742.AA15813@balboa.eng.uci.edu>

next in thread | previous in thread | raw e-mail | index | archive | help

On Tue, 4 Apr 1995, Steven Wallace wrote:

> As you can see, SNDCTL_DSP_GETBLKSIZE has been changed from _IOWR to
> _IOR, so old binaries compiled with _IOWR will not be able to find
> the ioctl, causing the error to be displayed.  You can change it 
> back and then recompile your kernel and the old binaries should work.
> So it is SNDCTL_DSP_GETBLKSIZE that is causing you probs, not
> SNDCTL_DSP_SETFRAGMENT.  If you compile using a -current kernel
> but still have old <machine/soundcard.h> to compile the program,
> they won't match and it will still not work.

I still don't think it's working:

FreeBSD
-------
[smpatel:xi] [0:~]> cat test.c
#include <stdio.h>
#ifdef __FreeBSD__
#include <machine/soundcard.h>
#else
#include <linux/soundcard.h>
#endif

main () {
  int blksize, frag, dsp;

  dsp = open ("/dev/dsp");

  blksize = 0;
  frag = 0x00080007;

  ioctl(dsp, SNDCTL_DSP_SETFRAGMENT, &frag);
  ioctl(dsp, SNDCTL_DSP_GETBLKSIZE, &blksize);

  if (!blksize)
      printf ("Error:  Couldn't Get Block Size\n");
}
[smpatel:xi] [0:~]> cc test.c
[smpatel:xi] [0:~]> a.out
Error:  Couldn't Get Block Size
[smpatel:xi] [32:~]> grep BLKSIZE /usr/include/machine/soundcard.h
#define SNDCTL_DSP_GETBLKSIZE           _IOR('P', 4, int)
#define SNDCTL_DSP_SETBLKSIZE           _IOW('P', 4, int)
#define SOUND_PCM_SETBLKSIZE            SNDCTL_DSP_SETBLKSIZE
[smpatel:xi] [0:~]> grep Id /usr/include/machine/soundcard.h 
 * $Id: soundcard.h,v 1.12 1995/03/08 18:43:49 ugen Exp $



Linux (IOCTL should behave the same)
------------------------------------
linux:23) ~>cat test.c
#include <stdio.h>
#ifdef __FreeBSD__
#include <machine/soundcard.h>
#else
#include <linux/soundcard.h>
#endif

main () {
  int blksize, frag, dsp;

  dsp = open ("/dev/dsp");

  blksize = 0;
  frag = 0x00080007;

  ioctl(dsp, SNDCTL_DSP_SETFRAGMENT, &frag);
  ioctl(dsp, SNDCTL_DSP_GETBLKSIZE, &blksize);

  if (!blksize)
      printf ("Error:  Couldn't Get Block Size\n");
}
linux:24) ~>cc test.c
linux:25) ~>a.out
linux:26) ~>grep BLKSIZE /usr/src/linux/include/linux/soundcard.h 
#define SNDCTL_DSP_GETBLKSIZE           _IOWR('P', 4, int)


See anything wrong in here?  Because I think that since Linux and FreeBSD 
use the sound driver,  that the IOCTLs should behave exactly the same.


Sujal



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSD.3.91.950404083056.136I-100000>