[racket] Socket and character resp. block device file

From: Manfred Lotz (manfred.lotz at arcor.de)
Date: Mon Jan 6 04:17:27 EST 2014

On Mon, 6 Jan 2014 05:32:58 +0100
Manfred Lotz <manfred.lotz at arcor.de> wrote:

> On Sun, 5 Jan 2014 14:37:08 -0700
> Matthew Flatt <mflatt at cs.utah.edu> wrote:
> 
> > At Sun, 5 Jan 2014 21:45:59 +0100, Manfred Lotz wrote:
> > > This might be a stupid question. But how do I find out in Racket
> > > if a file is a socket or a haracter resp. block device file.
> > 
> > I don't think any functions currently provide that information. (The
> > only related function that comes to mind is `terminal-port?`, and
> > even that function works on ports instead of files.)
> > 
> 
> Oh, that's really bad. 
> 
> When testing my file duplicate finder one of my test cases is to
> create a socket, a pipe, a character device and a block device file.
> My racket program gets a
>    system error: No such device or address; errno=6
> when dealing with a socket. Or if it is a pipe then it waits for
> input.
> 
> I think functionality should be added in Racket. 
> 
> What's about something like this?
>  socket-exists
>  pipe-exists
>  block-device-exists
>  character-device-exists
> 
> 

As all those files seem to have a size 0 I just will omit doing a
checksum for a size 0. This should solve it for me.

Nevertheless, in the long run it seems a good idea to add those
functions.

-- 
Manfred






Posted on the users mailing list.