[Python-Dev] ossaudiodev tweak needs testing (original) (raw)
Greg Ward gward@python.net
Mon, 24 Mar 2003 21:04:20 -0500
- Previous message: [Python-Dev] Checkins to Attic?
- Next message: [Python-Dev] cvs.python.sourceforge.net fouled up
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi all -- I have another tweak to the ossaudiodev module that might make it work a little better. Background: some time ago, Jeremy and Guido had problems with test_ossaudiodev hanging due to a blocking open() call. So I made the open() non-blocking in rev 1.25 on 2003/03/11. But that screwed things up for David Hammerton, who emailed me privately the other day that a write() call later on was dying with EAGAIN -- not entirely surprising, since that's how write() is supposed to behave on a file descriptor opened with O_NONBLOCK if it would have blocked. Most OSS device drivers don't actually act that way (sigh), but apparently David's does.
So this patch reverses the effect of open() with O_NONBLOCK, meaning the file is back in blocking mode in the conventional Unix sense. (It's in blocking mode in the OSS sense the whole time, or at least until Python code calls the nonblock() method on it.) If you have a Linux or FreeBSD machine with sound hardware that works, can you please run
./python Lib/test/regrtest.py -uaudio test_ossaudiodev
with the current CVS head (ie. rev 1.25 of ossaudiodev.c and rev 1.4 of test_ossaudiodev.py), then apply this patch:
--- Modules/ossaudiodev.c 11 Mar 2003 16:53:13 -0000 1.25 +++ Modules/ossaudiodev.c 25 Mar 2003 01:54:46 -0000 @@ -139,6 +139,15 @@ PyErr_SetFromErrnoWithFilename(PyExc_IOError, basedev); return NULL; } +
- /* And (try to) put it back in blocking mode so we get the
expected write() semantics. */
- if (fcntl(fd, F_SETFL, 0) == -1) {
close(fd);
PyErr_SetFromErrnoWithFilename(PyExc_IOError, basedev);
return NULL;
- }
if (ioctl(fd, SNDCTL_DSP_GETFMTS, &afmts) == -1) { PyErr_SetFromErrnoWithFilename(PyExc_IOError, basedev); return NULL;
and try it again? If it works in both cases, great. If it crashed with CVS head (EAGAIN from write()?), and now works, wonderful! (Please let me know.) If it works before this patch but not with it, then PLEASE let me know! Otherwise I'll check this in.
Thanks --
Greg
-- Greg Ward <gward@python.net> http://www.gerg.ca/
- Previous message: [Python-Dev] Checkins to Attic?
- Next message: [Python-Dev] cvs.python.sourceforge.net fouled up
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]