rvplayer and timidity

Thomas Sailer (sailer@ife.ee.ethz.ch)
Mon, 07 Sep 1998 17:55:08 +0200


This is a multi-part message in MIME format.
--------------D7017FC1BA34DD5628251809
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

The problems with both rvplayer and timidity comes
from the fact that Linux 2.1.120 now uses more logical
semantics wrt. to O_NONBLOCK (aka O_NDELAY).
O_NONBLOCK is now respected not only in open,
but also in read and write.

Timidity 0.2i can be cured with the attached patch.
Timidity with this patch also works under 2.0.x, btw.
<rant>
I've sent this patch ages ago to the Timidity author,
but never heard anything back.
</rant>

Binary only apps such as rvplayer are slightly more
annoying, but they can probably be worked around
by LD_PRELOAD'ing something like the following
(untested, requires the app to be dynamically
linked against glibc2, otherwise you loose).

#include <string.h>
#include <unistd.h>
#include <fcntlbits.h>

extern int __open(const char *pathname, int flags, mode_t mode);
extern int fcntl(int fd, int cmd, long arg);

int open(const char *pathname, int flags, mode_t mode)
{
int res, rstnblk = flags & O_NONBLOCK && !strcmp(pathname, "/dev/dsp");

res = __open(pathname, flags, mode);
if (res == -1 || !rstnblk)
return res;
fcntl(res, F_SETFL, fcntl(res, F_GETFL, 0) & ~O_NONBLOCK);
return res;
}

Tom
--------------D7017FC1BA34DD5628251809
Content-Type: application/octet-stream; name="timidity-0.2i.diff"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="timidity-0.2i.diff"

LS0tIHRpbWlkaXR5LTAuMmktb3JpZy9saW51eF9hLmMJTW9uIE1heSAyMCAxNTowOTo0NiAx
OTk2CisrKyB0aW1pZGl0eS0wLjJpL2xpbnV4X2EuYwlGcmkgQXByICAzIDIyOjIxOjE3IDE5
OTgKQEAgLTIzLDYgKzIzLDggQEAKIAogKi8KIAorI2RlZmluZSBfR05VX1NPVVJDRQorI2lu
Y2x1ZGUgPHN0ZGlvLmg+CiAjaW5jbHVkZSA8dW5pc3RkLmg+CiAjaW5jbHVkZSA8ZmNudGwu
aD4KICNpbmNsdWRlIDxlcnJuby5oPgpAQCAtODMsNyArODUsNyBAQAogCSAgIGRwbS5uYW1l
LCBzeXNfZXJybGlzdFtlcnJub10pOwogICAgICAgcmV0dXJuIC0xOwogICAgIH0KLQorICBm
Y250bChmZCwgRl9TRVRGTCwgZmNudGwoZmQsIEZfR0VURkwsIDApICYgfk9fTkRFTEFZKTsK
ICAgLyogVGhleSBjYW4ndCBtZWFuIHRoZXNlICovCiAgIGRwbS5lbmNvZGluZyAmPSB+KFBF
X1VMQVd8UEVfQllURVNXQVApOwogCkBAIC0xNTIsOSArMTU0LDkgQEAKICAgICB9CiAgIGlm
ICh0bXAgIT0gZHBtLnJhdGUpCiAgICAgewotICAgICAgZHBtLnJhdGU9dG1wOwogICAgICAg
Y3RsLT5jbXNnKENNU0dfV0FSTklORywgVkVSQl9WRVJCT1NFLAotCSAgICJPdXRwdXQgcmF0
ZSBhZGp1c3RlZCB0byAlZCBIeiIsIGRwbS5yYXRlKTsKKwkgICAiT3V0cHV0IHJhdGUgYWRq
dXN0ZWQgdG8gJWQgSHogKHJlcXVlc3RlZCAlZCBIeikiLCB0bXAsIGRwbS5yYXRlKTsKKyAg
ICAgIGRwbS5yYXRlPXRtcDsKICAgICAgIHdhcm5pbmdzPTE7CiAgICAgfQogCg==
--------------D7017FC1BA34DD5628251809--

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/faq.html