[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Failure to open the /dev/dsp character device with a perl script
At 12:41 AM 7/10/97 +0300, Amos Shapira wrote:
>In message <3.0.1.32.19970709124239.006a5e64@dns.slink.co.il> you write:
>|Well, I posted my perl-Audio problem to Usenet, and I got this reply. IMO,
>|the only way to work around this problem while preserving all the
>|functionality of the audio device would be to use PerlXS.
>
>The answer you got sounds very peculiar to me. Perl should be able
>to handle any file under UNIX.
>
>Try using sysopen()/sysread()/syswrite() instead and see what happens.
Oh dear. I think I mentioned that I tried sysopen() and it didn't work. It
_is_ a perl problem or a Linux Kernel problem. Anyway, this pacman guy
(whose real name is Allan Curry) came up with a suggestion, to fix it. Here
it is:
>I hadn't thought ahead, or I would have realized the ioctl would be a
>problem. But let me see... perl does have an ioctl function, which implies it
>should not bomb when opening device files... further investigation reveals
>that if the device is a tty, perl gets an ESPIPE, ignores it and moves on.
>
>Apparently perl is doing that lseek just to test for seekability, and it
>believes that the 3 results are: success->seekable, ESPIPE->unseekable,
>anything_else->bomb.
>
>If you want to test my theory, look for sound_lseek in the kernel source and
>change the error from EPERM to ESPIPE. I have 2.0.28 and there are 2 of them:
>one in drivers/sound/dmasound.c and drivers/sound/soundcard.c, I'm not sure
>which one is relevant. They're both one-line functions that just say
>"return -EPERM". Change that to -ESPIPE, and I theorize that perl might work
>with it.
>
>If I'm right, this could be called a kernel bug. I don't feel like
>compiling a new kernel right now to test it though, so you can do the
>honors...
>
Well, volunteers anyone? Or maybe I should try it on the weekend, for the
collective sake of Perl users on Linux.
Shlomi Fish
BTW, Ira requested me to shorten my signature out of space consideration,
and I intend to do so, while putting the older on my homepage. Anyway,
here's an quote-less one, for the while.
----------------------------------------------------------
Shlomi Fish Smart Link Ltd.
Home: shlomif@ibm.net
Work: shlomi@slink.co.il
----------------------------------------------------------
References: