Hello SLIME developers,
Just tried to add slime-restore support for snapshots in SBCL on unix. Patch is in the attachment.
NB. SBCL is able to save snapshot only when exactly one thread is running; therefore, using :fd-handler or nil communication style is mandatory.
My implementation of exec-image currently assumes that SBCL was started using its full pathname (no PATH variable lookup is done). There is no native execve support in SBCL, so I've added a binding using define-alien-routine. SBCL FFI resolve alien references when they are called, so this addition shouldn't affect SLIME when this function is not used (i.e. there should be no problems on UNIX systems that can't resolve "execve" with dlsym(), unless slime-restore is actually called).
Hello SLIME developers,
More elaborate patch for SBCL snapshot support is attached. * Fixed alien array initialization for execve (and execv is now used); * Added posix error handling for execv; * Use *runtime-pathname*'s namestring to find executable reliably; * I/O redirection is now restored correctly with (create-repl).
Unfortunately, there are some parts that I just can't get right, e.g. fd-handlers accumulating in sb-impl::*descriptor-handlers* (for now, I simply #+sbcl (remove them on startup)), file descriptor of the old core that is inherited (now I turn on FD_CLOEXEC on fd#3, that is normally the old core).
However, with all this "duct tape", it works.