On Sat, May 05, 2012 at 03:23:15AM +0200, Igor Stasenko wrote: > Hi, David, all > > i just want to know, if we can use FFI calls, for implementing an > OSProcessPlugin functionality (or at least most of it). > and if there parts which is hard to implement, i would like to know > what and why.
Most, and probably all, of OSProcess could be implemented with FFI. It would take some work, and others have already pointed out the difficult parts, but with enough time an effort it could be done. > > If you want to ask, why one would want to do this.. the answer is simple: > we stated previously, that we want to reduce the VM complexity by > implementing things at language side, when it possible, > leaving only key parts to VM. > This is the main reason why i consider implementing OSProcess using > purely FFI, not because of quality of OSProcessPlugin > implementation etc. > I also prefer to do things in the image as much as possible. Aside from fork/exec and a few other things, almost everything in OSProcessPlugin is a thin layer over the corresponding C runtime call or system call. On the image side, a platform-specific OSProcessAccessor is responsible for the rest of the interface. If you want to experiment with this, I would suggest starting with a copy of UnixOSProcessAccessor (maybe call it UnixOSProcessFFIAccessor), and replacing calls to the primitives with the corresponding FFI calls. There is a fairly good set of unit tests, so as long as you can keep the tests green you will know you are making progress. Note that I am answering the question "could this be done", not "should this be done" ;) HTH, Dave
