Hi,
Below is a patch to allow local network address family (aka AF_UNIX, UNIX domain sockets). Note that `open-network-stream' just calls `make-network-process'.
diff --git a/slime.el b/slime.el index 8fc44ce..4afa883 100644 --- a/slime.el +++ b/slime.el @@ -1497,7 +1497,12 @@ first line of the file." (defun slime-net-connect (host port coding-system) "Establish a connection with a CL." (let* ((inhibit-quit nil) - (proc (open-network-stream "SLIME Lisp" nil host port)) + (proc (if (and (stringp port) (eq ?/ (string-to-char port))) + ;; consider a string starting with "/" a local service + (make-network-process :name "SLIME Lisp" :buffer nil + :service port :family 'local) + (make-network-process :name "SLIME Lisp" :buffer nil + :host host :service port))) (buffer (slime-make-net-buffer " *cl-connection*"))) (push proc slime-net-processes) (set-process-buffer proc buffer)
AF_UNIX is beneficial in the sense that it can speedup communication between emacs and the lisp process, and can avoid the need for authentication (presence of ~/.slime-secret).
What do you think?
Gilaras Drakeson gilaras@gmail.com writes:
Hi,
Below is a patch to allow local network address family (aka AF_UNIX, UNIX domain sockets). Note that `open-network-stream' just calls `make-network-process'.
diff --git a/slime.el b/slime.el index 8fc44ce..4afa883 100644 --- a/slime.el +++ b/slime.el @@ -1497,7 +1497,12 @@ first line of the file." (defun slime-net-connect (host port coding-system) "Establish a connection with a CL." (let* ((inhibit-quit nil)
(proc (open-network-stream "SLIME Lisp" nil host port))
(proc (if (and (stringp port) (eq ?/ (string-to-char port)))
;; consider a string starting with "/" a local service
(make-network-process :name "SLIME Lisp" :buffer nil
:service port :family 'local)
(make-network-process :name "SLIME Lisp" :buffer nil
(push proc slime-net-processes) (set-process-buffer proc buffer):host host :service port))) (buffer (slime-make-net-buffer " *cl-connection*")))
AF_UNIX is beneficial in the sense that it can speedup communication between emacs and the lisp process
It can, but does it? And is the amount by which it speeds up noticeable?
* Gilaras Drakeson [2010-10-19 14:59] writes:
Hi,
Below is a patch to allow local network address family (aka AF_UNIX, UNIX domain sockets). Note that `open-network-stream' just calls `make-network-process'.
XEmacs doesn't support Unix sockets (and neither server sockets).
[...]
AF_UNIX is beneficial in the sense that it can speedup communication between emacs and the lisp process, and can avoid the need for authentication (presence of ~/.slime-secret).
What do you think?
In theory yes, but a) we also need to change the Lisp side (for N different Lisps) b) the speed difference is likely negligible as the Unix kernel should be able to recognize and optimize local TCP connections c) doesn't work on Windows d) one more thing that can be misconfigured. So, I think it's not worth the trouble.
Helmut
Hi,
XEmacs doesn't support Unix sockets (and neither server sockets).
Sorry. Imagine checking for GNU Emacs added to the patch.
In theory yes, but a) we also need to change the Lisp side (for N different Lisps) b) the speed difference is likely negligible as the Unix kernel should be able to recognize and optimize local TCP connections c) doesn't work on Windows d) one more thing that can be misconfigured. So, I think it's not worth the trouble.
I understand that it is not supported on some platforms. However, it is not an intrusive change because users won't randomly enter "/some/path" as slime's port number.
The speedup is sometimes negligible, but occasionally large return forms saturate the connection, in which case AF_UNIX is beneficial.
BTW, security was my original motivation for AF_UNIX, as I was not satisfied with ~/.slime-secret for a production server.