From: Ari Pollak <ajp@aripollak.com>
To: linux-kernel@vger.kernel.org
Subject: CD-ROM problems in at least 2.6.2-rc1-mm2 and above
Date: Mon, 09 Feb 2004 15:44:03 -0500 [thread overview]
Message-ID: <c08rem$86a$1@sea.gmane.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 542 bytes --]
The attached program for manually locking the CD-ROM tray used to work
in 2.6.0 and 2.6.1, and possibly some earlier versions of 2.6.2 when
called like "cd-lock /dev/hdc", where hdc is my CD-ROM drive. However,
under 2.6.2-rc1-mm2 and 2.6.2-mm1, calling the program with an empty
drive (which used to work) results in the following:
open failed: No medium found
Has anything changed recently which would cause open() to fail with an
empty CD drive? Just for good measure, I've attached the output of
strace when running this program.
[-- Attachment #2: cdlock.c --]
[-- Type: text/x-c, Size: 763 bytes --]
//Written by Shaya Potter <spotter@cs.columbia.edu>
//Placed in the Public Domain
#include <sys/ioctl.h>
#include <stdio.h>
#include <fcntl.h>
#include <linux/cdrom.h>
#include <string.h>
#include <libgen.h>
int main(int argc, char *argv[])
{
int fd;
int lock;
char *cmd1;
cmd1 = basename(argv[0]);
if (!strcmp(cmd1, "cd-lock"))
lock = 1;
else if (!strcmp(cmd1, "cd-unlock"))
lock = 0;
else {
printf("program must be called cd-lock or cd-unlock\n");
return 1;
}
if (argc != 2) {
printf("not enough options\nUsage:\n\t%s device\n", cmd1);
return 2;
}
if ((fd = open(argv[1], O_RDONLY)) <= 0) {
perror("open failed");
return 3;
}
if (ioctl(fd, CDROM_LOCKDOOR, lock)) {
perror("ioctl failed");
return 4;
}
return 0;
}
[-- Attachment #3: strace-out --]
[-- Type: text/plain, Size: 1899 bytes --]
execve("/home/ari/bin/cd-lock", ["cd-lock", "/dev/cdrom"], [/* 27 vars */]) = 0
uname({sys="Linux", node="ewok", ...}) = 0
brk(0) = 0x804a000
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40017000
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.preload", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=54887, ...}) = 0
old_mmap(NULL, 54887, PROT_READ, MAP_PRIVATE, 3, 0) = 0x40018000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/tls/libc.so.6", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\240X\1"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0644, st_size=1271388, ...}) = 0
old_mmap(NULL, 1281772, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x40026000
old_mmap(0x40154000, 36864, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x12d000) = 0x40154000
old_mmap(0x4015d000, 7916, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x4015d000
close(3) = 0
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x4015f000
set_thread_area({entry_number:-1 -> 6, base_addr:0x4015f2a0, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) = 0
munmap(0x40018000, 54887) = 0
open("/dev/cdrom", O_RDONLY) = -1 ENOMEDIUM (No medium found)
dup(2) = 3
fcntl64(3, F_GETFL) = 0x8001 (flags O_WRONLY|O_LARGEFILE)
close(3) = 0
write(2, "open failed: No medium found\n", 29open failed: No medium found
) = 29
exit_group(3) = ?
next reply other threads:[~2004-02-09 20:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-02-09 20:44 Ari Pollak [this message]
2004-02-09 20:55 ` CD-ROM problems in at least 2.6.2-rc1-mm2 and above Andries Brouwer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='c08rem$86a$1@sea.gmane.org' \
--to=ajp@aripollak.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox