* devices.in (dev_storage): Map /dev/dsp to \Device\Null.

* devices.cc: Regenerate.
	* fhandler_dsp.cc (fhandler_dev_dsp::open): Call fhandler_base::open.
	(fhandler_dev_dsp::close): Call fhandler_base::close.
	(fhandler_dev_dsp::fixup_after_fork): Call
	fhandler_base::fixup_after_fork.

	* fhandler_raw.cc (fhandler_dev_raw::fixup_after_fork): Call
	fhandler_base::fixup_after_fork.
This commit is contained in:
Corinna Vinschen 2013-10-26 13:23:54 +00:00
parent 2e178c6909
commit c8ae71316f
6 changed files with 32 additions and 18 deletions

View File

@ -1,4 +1,16 @@
2013-10-25 Corinna Vinschen <corinna@vinschen.de>
2013-10-26 Corinna Vinschen <corinna@vinschen.de>
* devices.in (dev_storage): Map /dev/dsp to \Device\Null.
* devices.cc: Regenerate.
* fhandler_dsp.cc (fhandler_dev_dsp::open): Call fhandler_base::open.
(fhandler_dev_dsp::close): Call fhandler_base::close.
(fhandler_dev_dsp::fixup_after_fork): Call
fhandler_base::fixup_after_fork.
* fhandler_raw.cc (fhandler_dev_raw::fixup_after_fork): Call
fhandler_base::fixup_after_fork.
2013-10-26 Corinna Vinschen <corinna@vinschen.de>
* exception.h (_exception_list): Drop redefinition for x86_64.
* include/exceptions.h: Disable content for x86_64 since it's not

View File

@ -226,7 +226,7 @@ const _RDATA device dev_storage[] =
{"/dev/cons62", BRACK(FHDEV(DEV_CONS_MAJOR, 62)), "/dev/cons62", exists_console, S_IFCHR, true},
{"/dev/cons63", BRACK(FHDEV(DEV_CONS_MAJOR, 63)), "/dev/cons63", exists_console, S_IFCHR, true},
{"/dev/console", BRACK(FH_CONSOLE), "/dev/console", exists_console, S_IFCHR, true},
{"/dev/dsp", BRACK(FH_OSS_DSP), "/dev/dsp", exists, S_IFCHR, true},
{"/dev/dsp", BRACK(FH_OSS_DSP), "\\Device\\Null", exists_ntdev, S_IFCHR, true},
{"/dev/fd0", BRACK(FHDEV(DEV_FLOPPY_MAJOR, 0)), "\\Device\\Floppy0", exists_ntdev, S_IFBLK, true},
{"/dev/fd1", BRACK(FHDEV(DEV_FLOPPY_MAJOR, 1)), "\\Device\\Floppy1", exists_ntdev, S_IFBLK, true},
{"/dev/fd2", BRACK(FHDEV(DEV_FLOPPY_MAJOR, 2)), "\\Device\\Floppy2", exists_ntdev, S_IFBLK, true},

View File

@ -148,7 +148,7 @@ const device dev_error_storage =
"/dev/console", BRACK(FH_CONSOLE), "/dev/console", exists_console, S_IFCHR, =console_dev
"/dev/ptmx", BRACK(FH_PTMX), "/dev/ptmx", exists, S_IFCHR
"/dev/windows", BRACK(FH_WINDOWS), "/dev/windows", exists, S_IFCHR
"/dev/dsp", BRACK(FH_OSS_DSP), "/dev/dsp", exists, S_IFCHR
"/dev/dsp", BRACK(FH_OSS_DSP), "\\Device\\Null", exists_ntdev, S_IFCHR
"/dev/conin", BRACK(FH_CONIN), "/dev/conin", exists_console, S_IFCHR
"/dev/conout", BRACK(FH_CONOUT), "/dev/conout", exists_console, S_IFCHR
"/dev/null", BRACK(FH_NULL), "\\Device\\Null", exists_ntdev, S_IFCHR

View File

@ -1006,7 +1006,7 @@ fhandler_dev_dsp::fhandler_dev_dsp ():
int
fhandler_dev_dsp::open (int flags, mode_t mode)
{
int err = 0;
int ret = 0, err = 0;
UINT num_in = 0, num_out = 0;
set_flags ((flags & ~O_TEXT) | O_BINARY);
// Work out initial sample format & frequency, /dev/dsp defaults
@ -1032,18 +1032,14 @@ fhandler_dev_dsp::open (int flags, mode_t mode)
err = EINVAL;
}
if (!err)
{
set_open_status ();
need_fork_fixup (true);
nohandle (true);
}
else
if (err)
set_errno (err);
else
ret = fhandler_base::open (flags, mode);
debug_printf ("ACCMODE=%y audio_in=%d audio_out=%d, err=%d",
flags & O_ACCMODE, num_in, num_out, err);
return !err;
debug_printf ("ACCMODE=%y audio_in=%d audio_out=%d, err=%d, ret=%d",
flags & O_ACCMODE, num_in, num_out, err, ret);
return ret;
}
#define IS_WRITE() ((get_flags() & O_ACCMODE) != O_RDONLY)
@ -1159,7 +1155,7 @@ fhandler_dev_dsp::close ()
debug_printf ("audio_in=%p audio_out=%p", audio_in_, audio_out_);
close_audio_in ();
close_audio_out (exit_state != ES_NOT_EXITING);
return 0;
return fhandler_base::close ();
}
int
@ -1371,6 +1367,7 @@ fhandler_dev_dsp::fixup_after_fork (HANDLE parent)
debug_printf ("audio_in=%p audio_out=%p",
audio_in_, audio_out_);
fhandler_base::fixup_after_fork (parent);
if (audio_in_)
audio_in_->fork_fixup (parent);
if (audio_out_)

View File

@ -105,8 +105,9 @@ fhandler_dev_raw::dup (fhandler_base *child, int flags)
}
void
fhandler_dev_raw::fixup_after_fork (HANDLE)
fhandler_dev_raw::fixup_after_fork (HANDLE parent)
{
fhandler_base::fixup_after_fork (parent);
devbufstart = 0;
devbufend = 0;
lastblk_to_read (false);

View File

@ -8,8 +8,8 @@ What changed:
- Slightly improve randomness of /dev/random emulation.
- Allow to use advisory locking on any device which is backed by an OS handle.
Right now this excludes /dev/dsp, console windows on pre Windows 8, as well
as almost all virtual files under /proc.
Right now this excludes console windows on pre Windows 8, as well as almost
all virtual files under /proc.
Bug fixes:
@ -28,3 +28,7 @@ Bug fixes:
Fixes: http://cygwin.com/ml/cygwin/2013-10/threads.html#00237
- Fix a potential crash after calling lseek on /dev/clipboard.
- Fix a handle inheritance bug in raw disk and tape device handling which
led to EBADF errors in child processes.