$b/pubring.pgp \
$b/contrib/vanilla-module.mk \
`for dir in $b/contrib/*; do
- if test -d $dir && test -e $dir/Makefile; then
+ if test -d $dir && test -f $dir/test-passed; then
echo $dir
fi
done`
SYSTEM=sb-bsd-sockets
+CC=gcc
+export CC
all:
$(MAKE) -C ../asdf
;;; then the stuff we're looking for
((:integer af-inet "AF_INET" "IP Protocol family")
(:integer af-unspec "AF_UNSPEC" "Unspecified.")
-#-solaris (:integer af-local "AF_LOCAL" "Local to host (pipes and file-domain).")
- (:integer af-unix "AF_UNIX" "Old BSD name for af-local. ")
-#-(or solaris freebsd) (:integer af-file "AF_FILE" "POSIX name for af-local. ")
-#+linux (:integer af-inet6 "AF_INET6" "IP version 6. ")
-#+linux (:integer af-route "AF_NETLINK" "Alias to emulate 4.4BSD ")
-
+ (:integer af-local
+ #+(or sunos solaris) "AF_UNIX"
+ #-(or sunos solaris) "AF_LOCAL"
+ "Local to host (pipes and file-domain).")
+ #+linux (:integer af-inet6 "AF_INET6" "IP version 6. ")
+ #+linux (:integer af-route "AF_NETLINK" "Alias to emulate 4.4BSD ")
+
(:integer sock-stream "SOCK_STREAM"
"Sequenced, reliable, connection-based byte streams.")
(:integer sock-dgram "SOCK_DGRAM"
(add-package-nickname "SYSTEM" "SB-SYS"))
(defpackage "SB-BSD-SOCKETS"
- (:export socket unix-socket inet-socket
- make-unix-socket make-inet-socket
+ (:export socket local-socket inet-socket
+ make-local-socket make-inet-socket
socket-bind socket-accept socket-connect
socket-send socket-receive socket-recv
socket-name socket-peername socket-listen
<li> Methods applicable to a particular subclass
<ol>
<li> <a href="#internet">INET-SOCKET</a> - Internet Protocol (TCP, UDP, raw) sockets
-<li> Methods on <a href="#UNIX-SOCKET">UNIX-SOCKET</a> - Unix-domain sockets
+<li> Methods on <a href="#LOCAL-SOCKET">LOCAL-SOCKET</a> - Local-domain sockets
</ol>
<li> <a href="#name-service">Name resolution</a> (DNS, /etc/hosts, &c)
</ol>
differences in approach where we have taken advantage of some of the more useful features of Common Lisp - briefly
<ul>
-<li> Where the C API would typically return -1 and set errno, bsd-sockets
-signals an error. All the errors are subclasses of SOCKET-CONDITION
+<li> Where the C API would typically return -1 and set errno, we
+signal an error. All the errors are subclasses of SOCKET-CONDITION
and generally correspond one for one with possible <tt>errno</tt> values
-<li> We use multiple return values in many places where the C API would use p[ass-by-reference values
+<li> We use multiple return values in many places where the C API would use
+pass-by-reference values
<li> We can often avoid supplying an explicit <i>length</i> argument to
functions because we already know how long the argument is.
--- /dev/null
+(in-package :sb-bsd-sockets)
+
+#|| <h2>Local (unix) domain sockets</h2>
+
+Local domain (AF_LOCAL) sockets are also known as Unix-domain sockets, but were
+renamed by POSIX presumably on the basis that they may be
+available on other systems too.
+
+A local socket address is a string, which is used to create a node
+in the local filesystem. This means of course that they cannot be used across
+a network.
+
+||#
+
+(defclass local-socket (socket)
+ ((family :initform sockint::af-local)))
+
+(defmethod make-sockaddr-for ((socket local-socket) &optional sockaddr &rest address &aux (filename (first address)))
+ (let ((sockaddr (or sockaddr (sockint::allocate-sockaddr-un))))
+ (setf (sockint::sockaddr-un-family sockaddr) sockint::af-local)
+ (when filename
+ (loop for c across filename
+ ;; XXX magic constant ew ew ew. should grovel this from
+ ;; system headers
+ for i from 0 to (min 107 (1- (length filename)))
+ do (setf (sockint::sockaddr-un-path sockaddr i) (char-code c))
+ finally
+ (setf (sockint::sockaddr-un-path sockaddr (1+ i)) 0)))
+ sockaddr))
+
+(defmethod size-of-sockaddr ((socket local-socket))
+ sockint::size-of-sockaddr-un)
+
+(defmethod bits-of-sockaddr ((socket local-socket) sockaddr)
+ "Returns filename of SOCKADDR"
+ (let ((name (sb-c-call::%naturalize-c-string
+ (sb-sys:sap+ (sockint::array-data-address sockaddr)
+ sockint::offset-of-sockaddr-un-path))))
+ (if (zerop (length name)) nil name)))
+
(find-package "SB-BSD-SOCKETS-SYSTEM"))
filename tmp-c-source :sb-bsd-sockets-internal)
(and
- (= (run-shell-command
- "/usr/bin/gcc -o ~S ~S" (namestring tmp-a-dot-out)
+ (= (run-shell-command "gcc -o ~S ~S" (namestring tmp-a-dot-out)
(namestring tmp-c-source)) 0)
(= (run-shell-command "~A >~A"
(namestring tmp-a-dot-out)
(component-pathname c))))
(defmethod perform ((op compile-op) (c c-source-file))
(unless
- (= 0 (run-shell-command "/usr/bin/gcc -fPIC -o ~S -c ~S"
+ (= 0 (run-shell-command "gcc -fPIC -o ~S -c ~S"
(unix-name (car (output-files op c)))
(unix-name (component-pathname c))))
(error 'operation-error :operation op :component c)))
(:file "sockopt" :depends-on ("sockets"))
(:file "inet" :depends-on ("sockets" "split" "constants" ))
- (:file "unix" :depends-on ("sockets" "split" "constants" ))
+ (:file "local" :depends-on ("sockets" "split" "constants" ))
(:file "name-service" :depends-on ("sockets" "constants" "alien"))
(:file "misc" :depends-on ("sockets" "constants"))
t)
#||
-<h2>Unix-domain sockets</h2>
+<h2>Local-domain sockets</h2>
A fairly rudimentary test that connects to the syslog socket and sends a
message. Priority 7 is kern.debug; you'll probably want to look at
/etc/syslog.conf or local equivalent to find out where the message ended up
||#
-(deftest simple-unix-client
- (let ((s (make-instance 'unix-socket :type :datagram)))
+(deftest simple-local-client
+ (let ((s (make-instance 'local-socket :type :datagram)))
(format t "~A~%" s)
(socket-connect s "/dev/log")
(let ((stream (socket-make-stream s :input t :output t :buffering :none)))
(format stream
- "<7>bsd-sockets: Don't panic. We're testing unix-domain client code; this message can safely be ignored")
+ "<7>bsd-sockets: Don't panic. We're testing local-domain client code; this message can safely be ignored")
t))
t)
+++ /dev/null
-(in-package :sb-bsd-sockets)
-
-#|| <h2>File-domain sockets</h2>
-
-File-domain (AF_FILE) sockets are also known as Unix-domain sockets, but were
-renamed by POSIX presumably on the basis that they may be
-available on other systems too.
-
-A file-domain socket address is a string, which is used to create a node
-in the local filesystem. This means of course that they cannot be used across
-a network.
-
-||#
-
-(defclass unix-socket (socket)
- ((family :initform sockint::af-unix)))
-
-(defmethod make-sockaddr-for ((socket unix-socket) &optional sockaddr &rest address &aux (filename (first address)))
- (let ((sockaddr (or sockaddr (sockint::allocate-sockaddr-un))))
- (setf (sockint::sockaddr-un-family sockaddr) sockint::af-unix)
- (when filename
- (loop for c across filename
- ;; XXX magic constant ew ew ew. should grovel this from
- ;; system headers
- for i from 0 to (min 107 (1- (length filename)))
- do (setf (sockint::sockaddr-un-path sockaddr i) (char-code c))
- finally
- (setf (sockint::sockaddr-un-path sockaddr (1+ i)) 0)))
- sockaddr))
-
-(defmethod size-of-sockaddr ((socket unix-socket))
- sockint::size-of-sockaddr-un)
-
-(defmethod bits-of-sockaddr ((socket unix-socket) sockaddr)
- "Returns filename of SOCKADDR"
- (let ((name (sb-c-call::%naturalize-c-string
- (sb-sys:sap+ (sockint::array-data-address sockaddr)
- sockint::offset-of-sockaddr-un-path))))
- (if (zerop (length name)) nil name)))
-
gnumake=${GNUMAKE:-gmake}
for i in contrib/*; do
- test -d $i && test -e $i/Makefile || continue;
+ test -d $i && test -f $i/test-passed || continue;
export INSTALL_DIR=$SBCL_HOME/`basename $i `
- $gnumake -C $i test && ensure_dirs $INSTALL_DIR && $gnumake -C $i install
+ ensure_dirs $INSTALL_DIR && $gnumake -C $i install
done
#!/bin/sh
# This is a script to be run as part of make.sh. The only time you'd
-# probably want to run it by itself is if you're trying to
-# cross-compile the system or if you're doing some kind of
-# troubleshooting.
+# probably want to run it by itself is if you're cross-compiling the
+# system or doing some kind of troubleshooting.
# This software is part of the SBCL system. See the README file for
# more information.
gnumake=${GNUMAKE:-gmake}
for i in contrib/*; do
- test -d $i && test -e $i/Makefile || continue;
+ test -d $i && test -f $i/Makefile || continue;
# export INSTALL_DIR=$SBCL_HOME/`basename $i `
- $gnumake -C $i test
+ test -f $i/test-passed && rm $i/test-passed
+ $gnumake -C $i test && touch $i/test-passed
done
;;; versions, especially for internal versions off the main CVS
;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"0.7.12.49"
+"0.7.12.50"