Opening "Special" Files

Jayson Vantuyl kagato@REDACTED
Mon Aug 24 10:03:18 CEST 2009


Dear Erlang Questions,

I really need to open a block device.  I'll treat it just like a file,  
I swear.  I'll open it.  I'll read from it.  I'll write to it.  I'll  
close it when I'm done.  I'll even cuddle if it wants to.  Where's the  
harm in that?

Unfortunately, there's a rather bureaucratic function called  
efile_may_openfile in erts/emulator/drivers/unix/unix_efile.c.  It's  
on line 800.  It insists that anything but a purely vanilla file just  
won't do.

As in:

>     808     if (!ISREG(statbuf)) {
>     809         errno = EISDIR;
>     810         return check_error(-1, errInfo);
>     811     }

Ignoring for the moment that synthesizing a system-level error that  
isn't really there is probably bad form, I would greatly enjoy a way  
to override this.  I should really not have to write my own port  
driver just to do this.  I don't want to have to figure out how to  
deal with the async IO pool in C.

Is this on the roadmap?  Can it be on the roadmap?  Is there a good  
workaround?

Also, can anyone even tell me why this is there?  Is there some odd  
behavior on an embedded system?  Is it a primitive attempt at a  
security feature?  Are we really afraid of getting SIGPIPE?

Thanks,

-- 
Jayson Vantuyl
kagato@REDACTED





More information about the erlang-questions mailing list