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

Bruce Cran bruce at cran.org.uk
Thu Mar 26 15:19:03 PDT 2009


On Thu, 26 Mar 2009 22:20:45 +0100
Tobias Rehbein <tobias.rehbein at web.de> 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."
> 
> /dev/cd0 is readable and writable for me. I rebooted multiple times
> and tried with and without atapicam. 
> 
>         sysopen(CD, "/dev/acd0", O_RDONLY | O_NONBLOCK)
> 
> fails either. So what's up here? Is sysopen a linuxism?
> 

sysopen certainly works on FreeBSD:

> perl
use POSIX;
sysopen(CD,"/dev/acd0", O_RDONLY|O_NONBLOCK) || perror("sysopen")
> 

and before I fixed the permissions:

> perl
use POSIX;
sysopen(CD,"/dev/acd0", O_RDONLY|O_NONBLOCK) || perror("sysopen")
sysopen: Permission denied
>

-- 
Bruce Cran


More information about the freebsd-questions mailing list