From: Gary Wright Date: 2007-03-20T07:16:57+09:00 Subject: Re: Passing File Descriptors? On Mar 19, 2007, at 12:43 PM, Worky Workerson wrote: > Is there a ruby way to pass file descriptors to separate processes? > I'm thinking of interfacing with a C program, which uses the > SCM_RIGHTS cmsg over a unix-domain socket ... is this idiom > implemented in Ruby? How would I marshall an IO object into (and out > of) the integer file descriptor, or does this "just work"? In case folks were looking for a use case. A client makes a request to a server which opens the file and sends the opened file descriptor back to the client. Presumably the server process has special permissions to allow it access to the files that the client doesn't have. The server can also implement any additional security controls. The client gets to read and write a file without having had permission to open the file directly. This only works via Unix Domain sockets and so it only works between processes on the same machine. It won't work across a network. Gary Wright