[perl] sysopen(CD, "/dev/cd0", O_RDONLY | O_NONBLOCK) fails

Mel Flynn mel.flynn+fbsd.questions at mailing.thruhere.net
Fri Mar 27 03:34:17 PDT 2009

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.

More information about the freebsd-questions mailing list