From h.eichmann@gmx.de  Mon Apr  7 10:54:41 2003
Return-Path: <h.eichmann@gmx.de>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 6FBAE37B401
	for <FreeBSD-gnats-submit@freebsd.org>; Mon,  7 Apr 2003 10:54:41 -0700 (PDT)
Received: from mail.gmx.net (pop.gmx.net [213.165.65.60])
	by mx1.FreeBSD.org (Postfix) with SMTP id 387F643F93
	for <FreeBSD-gnats-submit@freebsd.org>; Mon,  7 Apr 2003 10:54:40 -0700 (PDT)
	(envelope-from h.eichmann@gmx.de)
Received: (qmail 16303 invoked by uid 65534); 7 Apr 2003 17:54:38 -0000
Received: from pD9EC39A6.dip.t-dialin.net (EHLO 192.168.254.43) (217.236.57.166)
  by mail.gmx.net (mp001-rz3) with SMTP; 07 Apr 2003 19:54:38 +0200
Message-Id: <200304071954.01722.h.eichmann@gmx.de>
Date: Mon, 7 Apr 2003 18:54:01 +0100
From: Heiner <h.eichmann@gmx.de>
To: FreeBSD-gnats-submit@freebsd.org
Subject: ioctl(.., CDIOCCAPABILITY, ...) always reports "Inappropriate ioctl for device" on cd drives

>Number:         50687
>Category:       kern
>Synopsis:       ioctl(.., CDIOCCAPABILITY, ...) always reports "Inappropriate
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    jmg
>State:          analyzed
>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:  Sat Feb 20 08:16:57 UTC 2010
>Originator:     Heiner Eichmann <h.eichmann@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@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:
State-Changed-From-To: open->analyzed 
State-Changed-By: jmg 
State-Changed-When: Sat Feb 20 08:10:59 UTC 2010 
State-Changed-Why:  
I'm going to look at removing this and CDIOCPITCH...  It looks like 
matcd was the only one that implemented these and matcd died around 
the 4.x/5.x time frame... 


Responsible-Changed-From-To: freebsd-bugs->jmg 
Responsible-Changed-By: jmg 
Responsible-Changed-When: Sat Feb 20 08:10:59 UTC 2010 
Responsible-Changed-Why:  
I'm going to look at removing this and CDIOCPITCH...  It looks like 
matcd was the only one that implemented these and matcd died around 
the 4.x/5.x time frame... 

http://www.freebsd.org/cgi/query-pr.cgi?pr=50687 
>Unformatted:
 ioctl for device" on cd drives
