From owner-freebsd-bugs Wed Oct 27 17: 0: 8 1999 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id 09E8514E2D for ; Wed, 27 Oct 1999 17:00:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id RAA75871; Wed, 27 Oct 1999 17:00:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from monkeys.com (i180.value.net [206.14.136.180]) by hub.freebsd.org (Postfix) with ESMTP id 24E0C14E2D for ; Wed, 27 Oct 1999 16:52:36 -0700 (PDT) (envelope-from rfg@monkeys.com) Received: (from rfg@localhost) by monkeys.com (8.9.3/8.9.3) id QAA63935; Wed, 27 Oct 1999 16:52:28 -0700 (PDT) Message-Id: <199910272352.QAA63935@monkeys.com> Date: Wed, 27 Oct 1999 16:52:28 -0700 (PDT) From: "Ronald F. Guilmette" Reply-To: rfg@monkeys.com (Ronald F. Guilmette) To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: kern/14561: ioctl (fd, CDIOCEJECT, (void*) 0) doesn't work, even on SCSI CD drives Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 14561 >Category: kern >Synopsis: ioctl (fd, CDIOCEJECT, (void*) 0) doesn't work >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Oct 27 17:00:01 PDT 1999 >Closed-Date: >Last-Modified: >Originator: Ronald F. Guilmette >Release: FreeBSD 3.3-RELEASE i386 >Organization: E-Scrub Technologies, Inc. >Environment: >Description: Calling ioctl (fd, CDIOCEJECT, (void*) 0) from within a C program for an `fd' value which is an open file descriptor for a SCSI CDROM drive that *does* have eject capabilities and that *does* currently contain a loaded CD fails to cause the drive to perform the eject operation, and the call returns with a negative (-1?) result and with ERRNO set to the mysterious and uninformative value of `EIO' (``Input/output error''). >How-To-Repeat: Compile and run the following trivial program giving it "/dev/cd0c" as its one and only command line argument. Execute the program _only_ on a system with a SCSI CDROM drive that has programmed ejection capability, and only when there is already a CD loaded in the drive. (I also tried specifying "/dev/rcd0c" and also "/dev/cd0a" and even "/dev/rcd0a" and none of these worked any better.) -------------------------------------------------------------------- /* eject.c - program for FreeBSD to eject a CD */ /* Usage: eject [device] */ /* Copyright (c) 1999 Ronald F. Guilmette; all rights reserved. */ #include #include #include #include #include #include static char const *pname; int main (register int const argc, register char const **argv) { register int ifd; register char const *filename; pname = strrchr (argv[0], '/'); pname = pname ? pname + 1 : argv[0]; filename = argv[1]; if ((ifd = open (filename, O_RDONLY)) == -1) { fprintf (stderr, "%s: Error opening `%s': %s\n", pname, filename, strerror (errno)); return 1; } if (ioctl (ifd, CDIOCEJECT, (void*) 0) == -1) { fprintf (stderr, "%s: Error opening `%s': %s\n", pname, filename, strerror (errno)); return 1; } close (ifd); return 0; } -------------------------------------------------------------------- >Fix: Manually eject the CD. (Difficult, if you are not physically adjacent to it.) >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message