(operate 'test-op 'sb-bsd-sockets-tests))
(defsystem sb-bsd-sockets-tests
- :depends-on (sb-rt sb-bsd-sockets)
+ :depends-on (sb-rt sb-bsd-sockets sb-posix)
:components ((:file "tests")))
(defmethod perform ((o test-op) (c (eql (find-system :sb-bsd-sockets-tests))))
(deftest simple-local-client
(progn
- ;; SunOS (Solaris) and Darwin systems don't have a socket at
- ;; /dev/log. We might also be building in a chroot or something,
- ;; so don't fail this test just because the file is unavailable
- (when (probe-file "/dev/log")
+ ;; SunOS (Solaris) and Darwin systems don't have a socket at
+ ;; /dev/log. We might also be building in a chroot or
+ ;; something, so don't fail this test just because the file is
+ ;; unavailable, or if it's a symlink to some weird character
+ ;; device.
+ (when (and (probe-file "/dev/log")
+ (sb-posix:s-issock
+ (sb-posix::stat-mode (sb-posix:stat "/dev/log"))))
(let ((s (make-instance 'local-socket :type :datagram)))
(format t "Connecting ~A... " s)
(finish-output)
We do not automatically translate the returned value into "Lispy"
objects - for example, SB-POSIX:OPEN returns a small integer, not a
-stream.
+stream. Exception: boolean-returning functions (or, more commonly,
+macros) do not return a C integer, but instead a lisp boolean [ or
+maybe "true"/"false" in CLtS parlance ]; the rationale behind this
+exception is that there is nothing that can be meaningfully done with
+the boolean except test for truth or falsity -- it cannot be passed
+meaningfully to other POSIX functions.
[ Rationale: This is an interface to POSIX, not a high-level interface
that uses POSIX, and many people using it will actually want to mess
;;; mode flags
-(define-call "s_isreg" sb-posix::mode-t never-fails (mode sb-posix::mode-t))
-(define-call "s_isdir" sb-posix::mode-t never-fails (mode sb-posix::mode-t))
-(define-call "s_ischr" sb-posix::mode-t never-fails (mode sb-posix::mode-t))
-(define-call "s_isblk" sb-posix::mode-t never-fails (mode sb-posix::mode-t))
-(define-call "s_isfifo" sb-posix::mode-t never-fails (mode sb-posix::mode-t))
-(define-call "s_islnk" sb-posix::mode-t never-fails (mode sb-posix::mode-t))
-(define-call "s_issock" sb-posix::mode-t never-fails (mode sb-posix::mode-t))
+(define-call "s_isreg" boolean never-fails (mode sb-posix::mode-t))
+(define-call "s_isdir" boolean never-fails (mode sb-posix::mode-t))
+(define-call "s_ischr" boolean never-fails (mode sb-posix::mode-t))
+(define-call "s_isblk" boolean never-fails (mode sb-posix::mode-t))
+(define-call "s_isfifo" boolean never-fails (mode sb-posix::mode-t))
+(define-call "s_islnk" boolean never-fails (mode sb-posix::mode-t))
+(define-call "s_issock" boolean never-fails (mode sb-posix::mode-t))
(export 'sb-posix::pipe :sb-posix)
(declaim (inline sb-posix::pipe))
(when (minusp r)
(syscall-error)))
(values (aref filedes2 0) (aref filedes2 1)))
-
-(define-call "frobozz" int minusp)
(string filename))
(define-designator file-descriptor (integer 32)
- (sb-impl::file-stream (sb-impl::fd-stream-fd file-descriptor))
+ (file-stream (sb-sys:fd-stream-fd file-descriptor))
(fixnum file-descriptor))
(define-designator sap-or-nil sb-sys:system-area-pointer
(defmacro define-call (name return-type error-predicate &rest arguments)
(let ((lisp-name (lisp-for-c-symbol name)))
- (if (sb-fasl::foreign-symbol-address-as-integer-or-nil name)
+ (if (sb-fasl::foreign-symbol-address-as-integer-or-nil
+ (sb-vm:extern-alien-name name))
`(progn
(export ',lisp-name :sb-posix)
(declaim (inline ,lisp-name))
#.(logior sb-posix::s-iread sb-posix::s-iwrite sb-posix::s-iexec))
(deftest stat.2
- (let* ((stat (sb-posix:stat "/root"))
+ (let* ((stat (sb-posix:stat "/"))
(mode (sb-posix::stat-mode stat)))
+ ;; it's logically possible for / to be writeable by others... but
+ ;; if it is, either someone is playing with strange security
+ ;; modules or they want to know about it anyway.
(logand mode sb-posix::s-iwoth))
0)
(deftest stat-mode.1
(with-stat-mode (mode *test-directory*)
(sb-posix:s-isreg mode))
- 0)
+ nil)
(deftest stat-mode.2
(with-stat-mode (mode *test-directory*)
- (zerop (sb-posix:s-isdir mode)))
- nil)
+ (sb-posix:s-isdir mode))
+ t)
(deftest stat-mode.3
(with-stat-mode (mode *test-directory*)
(sb-posix:s-ischr mode))
- 0)
+ nil)
(deftest stat-mode.4
(with-stat-mode (mode *test-directory*)
(sb-posix:s-isblk mode))
- 0)
+ nil)
(deftest stat-mode.5
(with-stat-mode (mode *test-directory*)
(sb-posix:s-isfifo mode))
- 0)
+ nil)
(deftest stat-mode.6
(with-stat-mode (mode *test-directory*)
(sb-posix:s-issock mode))
- 0)
+ nil)
(deftest stat-mode.7
(let ((link-pathname (make-pathname :name "stat-mode.7"
(progn
(sb-posix:symlink *test-directory* link-pathname)
(with-lstat-mode (mode link-pathname)
- (zerop (sb-posix:s-islnk mode))))
+ (sb-posix:s-islnk mode)))
(ignore-errors (sb-posix:unlink link-pathname))))
- nil)
+ t)
(deftest stat-mode.8
(let ((pathname (make-pathname :name "stat-mode.8"
(with-open-file (out pathname :direction :output)
(write-line "test" out))
(with-stat-mode (mode pathname)
- (zerop (sb-posix:s-isreg mode))))
+ (sb-posix:s-isreg mode)))
(ignore-errors (delete-file pathname))))
- nil)
+ t)
\f
;;; see comment in filename's designator definition, in macros.lisp
(deftest filename-designator.1
;;; checkins which aren't released. (And occasionally for internal
;;; versions, especially for internal versions off the main CVS
;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"0.8.5.26"
+"0.8.5.27"