Subject: kern/6275: minor /dev/audio incompatibility
To: None <gnats-bugs@gnats.netbsd.org>
From: None <dbj@netbsd.org>
List: netbsd-bugs
Date: 10/11/1998 22:00:51
>Number: 6275
>Category: kern
>Synopsis: minor /dev/audio incompatibility
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: kern-bug-people (Kernel Bug People)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Oct 11 19:05:00 1998
>Last-Modified:
>Originator: Darrin B. Jewell
>Organization:
unorganized
>Release: -current, updated ~19981010.0643 EDT
>Environment:
System: NetBSD pan-fried-peking-ravioli 1.3H NetBSD 1.3H (PAN-FRIED-PEKING-RAVIOLI) #1: Sun Oct 11 16:27:17 EDT 1998 jewell@pan-fried-peking-ravioli:/u1/PAN-FRIED-PEKING-RAVIOLI i386
>Description:
I observe that if I use the AUDIO_SETINFO ioctl with
a structure returned from an AUDIO_GETINFO ioctl, I get EINVAL.
Although the man page recommends using the AUDIO_INITINFO()
structure instead, some programs expect sun compatibility.
The program listed below runs without error on a solaris 2.6 system,
but prints out "AUDIO_SETINFO: Invalid argument" under NetBSD.
Darrin
>How-To-Repeat:
Compile and run the following sample program:
#include <stdlib.h>
#include <stddef.h>
#include <stdio.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/audioio.h>
int
main(int argc, char *argv[])
{
int r;
int fd;
audio_info_t info;
fd = open("/dev/audio", O_WRONLY | O_NDELAY);
if (fd < 0) {
perror("Error opening /dev/audio");
exit(EXIT_FAILURE);
}
r = ioctl(fd,AUDIO_GETINFO, &info);
if (r != 0) {
perror("AUDIO_GETINFO");
close(fd);
exit(EXIT_FAILURE);
}
r = ioctl(fd,AUDIO_SETINFO, &info);
if (r != 0) {
perror("AUDIO_SETINFO");
close(fd);
exit(EXIT_FAILURE);
}
close(fd);
return(EXIT_SUCCESS);
}
>Fix:
>Audit-Trail:
>Unformatted: