Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Mar 2009 10:44:07 +0000
From:      Vincent Hoffman <vince@unsane.co.uk>
To:        Mel Flynn <mel.flynn+fbsd.questions@mailing.thruhere.net>
Cc:        Tobias Rehbein <tobias.rehbein@web.de>, freebsd-questions@freebsd.org
Subject:   Re: [perl] sysopen(CD, "/dev/cd0", O_RDONLY | O_NONBLOCK) fails
Message-ID:  <49CCADF7.5040902@unsane.co.uk>
In-Reply-To: <200903271132.58872.mel.flynn+fbsd.questions@mailing.thruhere.net>
References:  <20090326212045.GB3134@sushi.pseudo.local> <200903271132.58872.mel.flynn+fbsd.questions@mailing.thruhere.net>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
On 27/3/09 10:32, Mel Flynn wrote:
> On Thursday 26 March 2009 22:20:45 Tobias Rehbein wrote:
>   
>> Hi all.
>>
>> I have a perl script which seems to work fine under Linux but fails on
>> FreeBSD. The Problem is the line:
>>
>>         sysopen(CD, "/dev/cd0", O_RDONLY | O_NONBLOCK)
>>
>> After this line the following evaluates to true:
>>
>>         $! eq "No such file or directory."
>>     
>
> If you're running this in a jail, then cd0 is hidden by devfs, hence the 
> ENOENT. You will need to provide a jail specific ruleset, or override 
> devfsrules_jail from /etc/defaults/devfs.rules in /etc/devfs.rules so it 
> applies to all jails without modification to /etc/rc.conf.
>   
By default for an ATA/ATAPI CDROM, you get an /dev/acd0 not a /dev/cd0
in FreeBSD.

[root@seaurchin ~]# ls -la /dev/cd0
ls: /dev/cd0: No such file or directory
[root@seaurchin ~]# ls -la /dev/acd0
crw-r-----  1 root  operator    0,  74 Feb  6 12:11 /dev/acd0
[root@seaurchin ~]#

To have a /dev/cd0 either use a scsi CDROM or kldload atapicam which
allows ATAPI devices to be accessed via the cam subsytem and will create
a /dev/cd0 node

[root@seaurchin ~]# kldload atapicam
[root@seaurchin ~]# ls -la /dev/cd0
crw-r-----  1 root  operator    0, 113 Feb  6 12:11 /dev/cd0

or just change the code to use /dev/acd0

Vince



Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?49CCADF7.5040902>