[pg-devel] Re: Socket path

Stefan Scholl stesch at no-spoon.de
Sun Feb 6 18:42:03 UTC 2005


On 2005-02-06 19:22:00, Stefan Scholl wrote:
> But I'd prefer a special *pg-unix-socket-directory*.

Diff attached.


-------------- next part --------------
Index: defpackage.lisp
===================================================================
RCS file: /project/pg/cvsroot/pg/defpackage.lisp,v
retrieving revision 1.4
diff -u -r1.4 defpackage.lisp
--- defpackage.lisp	22 Apr 2004 16:57:39 -0000	1.4
+++ defpackage.lisp	6 Feb 2005 18:39:16 -0000
@@ -9,6 +9,7 @@
 	   #:pgcon-sql-stream
            #:*pg-disable-type-coercion*
            #:*pg-client-encoding*
+           #:*pg-unix-socket-directory*
            #:pg-databases #:pg-tables #:pg-columns
            #:pg-backend-version
            #:pg-date-style
Index: sysdep.lisp
===================================================================
RCS file: /project/pg/cvsroot/pg/sysdep.lisp,v
retrieving revision 1.6
diff -u -r1.6 sysdep.lisp
--- sysdep.lisp	11 Aug 2004 13:27:48 -0000	1.6
+++ sysdep.lisp	6 Feb 2005 18:39:17 -0000
@@ -14,7 +14,8 @@
   #+sbcl (progn (require :asdf) (require :sb-bsd-sockets) (require :sb-md5))
   #+(and mcl (not openmcl)) (require "OPENTRANSPORT"))
 
-
+(defvar *pg-unix-socket-directory* "/tmp"
+  "Directory of the Unix-domain socket")
 
 (defmacro %sysdep (desc &rest forms)
   (when (null forms)
@@ -94,7 +95,9 @@
    (let ((fd (if host
                  (ext:connect-to-inet-socket host port)
                  (ext:connect-to-unix-socket
-                  (format nil "/var/run/postgresql/.s.PGSQL.~D" port)))))
+                  (format nil "~A/.s.PGSQL.~D"
+                          *pg-unix-socket-directory*
+                          port)))))
      (sys:make-fd-stream fd :input t :output t
                          :element-type '(unsigned-byte 8)))
    (error (e)
@@ -161,7 +164,7 @@
              s)
 	   (let ((s (make-instance 'sb-bsd-sockets:local-socket :type :stream)))
 	     (sb-bsd-sockets:socket-connect
-	      s (format nil "/var/run/postgresql/.s.PGSQL.~D" port))
+	      s (format nil "~A/.s.PGSQL.~D" *pg-unix-socket-directory* port))
 	     s))
        :element-type '(unsigned-byte 8)
        :input t
@@ -229,7 +232,9 @@
                        :type :stream
                        :connect :active
                        :format :binary
-                       :remote-filename (format nil "/var/run/postgresql/.s.PGSQL.~D" port)))
+                       :remote-filename (format nil "~A/.s.PGSQL.~D"
+                                                *pg-unix-socket-directory*
+                                                port)))
     (error (e)
       (error 'connection-failure
              :host host


More information about the pg-devel mailing list