Re: Setting flags on /dev/audio

2016-10-07 Thread Alexandre Ratchov
On Fri, Oct 07, 2016 at 08:11:46AM +1100, Tobias Brodel wrote:
> On 10/06/16 22:44, ludovic coues wrote:
> >misc strip attachment. Please send your diff inline or start a new thread
> >on dev
> Thanks forthe pointer Ludovic,
> 

Hi,

We moved significant parts of the audio and MIDI sub-system out of
the kernel, so now programs have to use the sio_open(3) interface. 
The audio(4) interface is just a thin private layer to access the
bare hardware internally.  From this stand-point changes in
audio(4) that are not used by the library make no sense.



Re: Setting flags on /dev/audio

2016-10-06 Thread Tobias Brodel

On 10/06/16 22:44, ludovic coues wrote:
misc strip attachment. Please send your diff inline or start a new 
thread on dev

Thanks forthe pointer Ludovic,

sys/dev/audio.c:

@@ -1537,6 +1537,11 @@
 case FIONBIO:
 /* All handled in the upper FS layer. */
 break;
+case FIOASYNC:
+/* No async mode, so set is an error, unset is a noop. */
+if (*(int *)addr)
+error = EINVAL;
+break;
 case AUDIO_GETPOS:
 mtx_enter(_lock);
 ap = (struct audio_pos *)addr;


test program:

#include 
#include 

int
main(void)
{
int fd, flags;
if ((fd = open("/dev/audio", O_RDWR | O_NDELAY, 0)) < 0) {
perror("can't open file");
return fd;
}

if ((flags = fcntl(fd, F_GETFL)) < 0)
perror("can't get flags!\n");
else if (fcntl(fd, F_SETFL, flags & ~(O_NDELAY)) < 0)
perror("can't set flags");
else
printf("good!\n");

close(fd);
return 0;
}


2016-10-06 2:15 GMT+02:00 Tobias Brodel :
Somehow sent the inverse of the intended diff, all apologies. Please 
find the proper diff attached. toby/ On 10/06/16 11:07, Tobias Brodel 
wrote:
Hi, I've been working on porting an audio application which uses the 
OSS compatibility layer. It was throwing warnings at runtime about 
not being able to set flags on /dev/audio. After searching around I 
found a diff written by Steven McDonald in the misc@ archives: 
http://openbsd-archive.7691.n7.nabble.com/perl-fctnl-woes-td276032.html 
Apparently the issue lies with the removal of the FIOASYNC ioctl(2). 
I've applied the diff on -CURRENT and it has solved my issues - 
please find the diff and a test program attached. toby/ 
[demime 1.01d removed an attachment of type text/x-patch which had a 
name of sys_dev_audio_c.diff] 




Re: Setting flags on /dev/audio

2016-10-05 Thread Tobias Brodel
Somehow sent the inverse of the intended diff, all apologies.

Please find the proper diff attached.

toby/

On 10/06/16 11:07, Tobias Brodel wrote:
> Hi,
>
> I've been working on porting an audio application which uses the OSS
> compatibility layer. It was throwing warnings at runtime about not
> being able to set flags on /dev/audio.
>
> After searching around I found a diff written by Steven McDonald in
> the misc@ archives:
>
> http://openbsd-archive.7691.n7.nabble.com/perl-fctnl-woes-td276032.html
>
> Apparently the issue lies with the removal of the FIOASYNC ioctl(2).
>
> I've applied the diff on -CURRENT and it has solved my issues - please
> find the diff and a test program attached.
>
> toby/

[demime 1.01d removed an attachment of type text/x-patch which had a name of 
sys_dev_audio_c.diff]



Setting flags on /dev/audio

2016-10-05 Thread Tobias Brodel
Hi,

I've been working on porting an audio application which uses the OSS
compatibility layer. It was throwing warnings at runtime about not
being able to set flags on /dev/audio.

After searching around I found a diff written by Steven McDonald in
the misc@ archives:

http://openbsd-archive.7691.n7.nabble.com/perl-fctnl-woes-td276032.html

Apparently the issue lies with the removal of the FIOASYNC ioctl(2).

I've applied the diff on -CURRENT and it has solved my issues - please
find the diff and a test program attached.

toby/

[demime 1.01d removed an attachment of type text/x-patch which had a name of 
sys_dev_audio_c.diff]

[demime 1.01d removed an attachment of type text/x-csrc which had a name of 
audio-test.c]