Crashes in OSSs audio.c on FreeBSD

Eric Pouech eric.pouech at wanadoo.fr
Fri Feb 21 13:48:52 CST 2003


> -	wwo->mapping = mmap(NULL, wwo->maplen, PROT_WRITE, MAP_SHARED,
> -			    wwo->ossdev->fd, 0);
> +	wwo->mapping = mmap(NULL, wwo->maplen, 
> +#if (defined(__FreeBSD__) && (__FreeBSD_version < 500000))
> +			PROT_READ|PROT_WRITE,
> +#else
> +			PROT_WRITE,
> +#endif
> +			MAP_SHARED, wwo->ossdev->fd, 0);

hmm this type of coding isn't really a great idea... do you really know 
what's behind this mmap issue not being possible ?
I don't know how OSS will handle it on BSD: Linux semantics are: if the 
device has been mapped as read only, then assume the mapping is for 
ouput, otherwise assume it's for capture
I don't know what BSD is going to do in this case

> +#ifndef __FreeBSD__
>  	/* for some reason, es1371 and sblive! sometimes have junk in here.
>  	 * clear it, or we get junk noise */
>  	/* some libc implementations are buggy: their memset reads from the buffer...
> @@ -1826,6 +1832,9 @@
>  	    /* in all cases, fill the remaining bytes */
>  	    while (len-- != 0) *p1++ = 0;
>  	}
> +#else
> +        memset(wwo->mapping,0, wwo->maplen);
> +#endif
you shouldn't need this chunk

A+

-- 
Eric Pouech




More information about the wine-devel mailing list