kern/50687: ioctl(.., CDIOCCAPABILITY, ...) always reports "Inappropriate ioctl for device" on cd drives

Heiner h.eichmann at gmx.de
Mon Apr 7 11:00:30 PDT 2003


>Number:         50687
>Category:       kern
>Synopsis:       ioctl(.., CDIOCCAPABILITY, ...) always reports "Inappropriate
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Apr 07 11:00:27 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator:     Heiner Eichmann <h.eichmann at gmx.de>
>Release:        FreeBSD 4.8-RC2
>Organization:
Sirius Cybernetics Corp.
>Environment:
System: FreeBSD 4.8-RC #2: Thu Apr  3 11:05:05 CEST 2003
    root at 7of9.unimatrix-zero.borg:/usr/obj/usr/src/sys/MYKERNEL i386
>Description:
A call of ioctl(.., CDIOCCAPABILITY, ...) on a cdrom or cd writer device 
(atapi or scsi) alwas returns errno == 25 (Inappropriate ioctl for device). 
>How-To-Repeat:
#include <errno.h>
#include <string.h>
#include <fcntl.h>
#include <sys/cdio.h>
#include <sys/cdrio.h>
#include <sys/ioctl.h>

int main(int argc, char *argv [])
{
	int fd = open ("/dev/acd0c", O_RDONLY | O_NONBLOCK);
	struct ioc_capability cap; 
	int ret;
	cap.play_function = 0; cap.routing_function = 0; cap.special_function = 0;
	ret=ioctl(fd, CDIOCCAPABILITY, &cap);
	printf("fd: %d, ret: %d, errno: %d: %s\n", fd, ret, errno, strerror(errno));
	close(fd);
	return 0;
}

>Fix:
If I understand it correctly, cdioctl() in src/sys/cam/scsi/scsi_cd.c should 
handle this ioctl call, but I can not find the CDIOCCAPABILITY case. It 
should either be fixed or the corresponding entry in cd(4) should be removed.

>Release-Note:
>Audit-Trail:
>Unformatted:
 ioctl for device" on cd drives


More information about the freebsd-bugs mailing list