Skip to contentSkip to conversation

es1371 driver

DISCUSSION Wilmer van der Gaast 4 participants 4 messages Feb 21, 2002 Sound

lore
Share & tools
lore
#0 lore raw

(I found two addresses for Thomas, which one is the right one?)

Hello,

My computer has a SB PCI128 card and works perfectly with it. But, one strange thing with the current Linux driver for it. Here a piece from es1381_open:

	/* wait for device to become free */
	down(&s->open_sem);
	while (s->open_mode & file->f_mode) {
		if (file->f_flags & O_NONBLOCK) {
			up(&s->open_sem);
			return -EBUSY;
		}
		add_wait_queue(&s->open_wait, &wait);
		__set_current_state(TASK_INTERRUPTIBLE);
		up(&s->open_sem);
		schedule();
		remove_wait_queue(&s->open_wait, &wait);
		set_current_state(TASK_RUNNING);
		if (signal_pending(current))
			return -ERESTARTSYS;
		down(&s->open_sem);
	}

Why does it wait? When I play an MP3 and meanwhile accidentally visit a website which uses Flash, the whole Mozilla process freezes because it can't get /dev/dsp. Maybe all programs should be blamed for opening /dev/dsp without O_NONBLOCK, but for me altering this piece of kernel code worked a lot better. Now any open() is handled as O_NONBLOCK and I don't get those crashes anymore.

Anyway, why this crashy behaviour by default? :-/

Greetings,

Wilmer van der Gaast.

Signature · 5 lines
*=-+-______________________
   |lintux-@t-lintux-d0t-cx:      _________________________________
   | http://www.lintux.cx/ |     /        Currently playing        \
   :http://www.algoritme.nl|    /         Oomph:DerNeueGott         \
    ~~~~~~~~~~~~~~~~~~~~~~-+-=-+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+-=*
#1 lore raw
Quoted 1 line · Wilmer van der Gaast

(I found two addresses for Thomas, which one is the right one?)

The one you used.

Quoted 6 lines

Why does it wait? When I play an MP3 and meanwhile accidentally visit a website which uses Flash, the whole Mozilla process freezes because it can't get /dev/dsp. Maybe all programs should be blamed for opening /dev/dsp without O_NONBLOCK, but for me altering this piece of kernel code worked a lot better. Now any open() is handled as O_NONBLOCK and I don't get those crashes anymore.

Its the userland apps which are broken, they should handle this a bit more sanely instead of throwing childish fits and running in the corner ;)

Regards,
Zwane Mwaikambo

#2 lore raw
In reply to Wilmer van der Gaast
Quoted 26 lines · Wilmer van der Gaast

(I found two addresses for Thomas, which one is the right one?)

Hello,

My computer has a SB PCI128 card and works perfectly with it. But, one strange thing with the current Linux driver for it. Here a piece from es1381_open:

	/* wait for device to become free */
	down(&s->open_sem);
	while (s->open_mode & file->f_mode) {
		if (file->f_flags & O_NONBLOCK) {
			up(&s->open_sem);
			return -EBUSY;
		}
		add_wait_queue(&s->open_wait, &wait);
		__set_current_state(TASK_INTERRUPTIBLE);
		up(&s->open_sem);
		schedule();
		remove_wait_queue(&s->open_wait, &wait);
		set_current_state(TASK_RUNNING);
		if (signal_pending(current))
			return -ERESTARTSYS;
		down(&s->open_sem);
	}
Quoted 8 lines

Why does it wait? When I play an MP3 and meanwhile accidentally visit a website which uses Flash, the whole Mozilla process freezes because it can't get /dev/dsp. Maybe all programs should be blamed for opening /dev/dsp without O_NONBLOCK, but for me altering this piece of kernel code worked a lot better. Now any open() is handled as O_NONBLOCK and I don't get those crashes anymore.

Anyway, why this crashy behaviour by default? :-/

Applications are ignoring standards. For further defails see:

http://www.unix-systems.org/onlinepubs/7908799/xsh/open.html

Especially this sentence:

If O_NONBLOCK is clear:
The open() function will block the calling thread until the device
is ready or available before returning.

Jaroslav

-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project http://www.alsa-project.org
SuSE Linux http://www.suse.com

#3 lore raw
In reply to Wilmer van der Gaast
Quoted 4 lines · Jaroslav Kysela

If O_NONBLOCK is clear:
The open() function will block the calling thread until the device
is ready or available before returning.

Hmm.. Damn, looks like a *lot* of applications don't know about this.

Also, I checked a couple of other drivers (including GUS, the card I used to have), they all return -EBUSY when the device in use, even when O_NONBLOCK is clear. Why this inconsistency?

Greetings,

Wilmer van der Gaast.

Signature · 4 lines
+-------- .''`.     - -- ---+  +         - -- --- ---- ----- ------+
| lintux : :'  :  lintux.cx |  | Unix and CGI @   IOI/NIO(Dutch)at |
|   at   `. `~'  debian.org |  | www.lintux.cx/   www.algoritme.nl |
+--- -- -  ` ---------------+  +------ ----- ---- --- -- -         +