Patch by Daniel Lowe.
Also add missing NEWS entries.
;;;; -*- coding: utf-8; fill-column: 78 -*-
+changes relative to sbcl-1.0.47:
+ * enhancement: read() and write() have been added to SB-POSIX.
+ * enhancement: types of DEFSTRUCT constructors are proclaimed more
+ accurately, allowing better typechecking of call-sites.
+ * bug fix: TRACE behaves better when attempting to trace undefined
+ functions. (lp#740717)
+
changes in sbcl-1.0.47 relative to sbcl-1.0.46:
* bug fix: fix mach port rights leaks in mach exception handling code on
darwin/x86 and /x86-64. (thanks to Willem Oudshoorn for motivation and the
adding.
FD_CLR FD_ISSET FD_SET FD_ZERO accept acct adjtime adjtimex bdflush
-bind break brk cacheflush capget capset clone connect
-create_module delete_module execve exit flock
-fstatfs ftime getcontext getdents getdomainname
-getdtablesize getgroups gethostid gethostname getitimer
+bind break brk cacheflush capget capset clone connect create_module
+delete_module execve exit flock fstatfs ftime getcontext getdents
+getdomainname getdtablesize getgroups gethostid gethostname getitimer
getpeername getpriority getrlimit getrusage getsockname getsockopt
gettimeofday gtty idle init_module ioctl_list ioperm iopl listen
-llseek lock madvise mincore mknod mlock
-modify_ldt mount mprotect mpx mremap msgctl msgget msgop msgrcv msgsnd
-munlock nanosleep nice pause poll
-prctl pread prof profil pselect ptrace pwrite query_module quotactl
-read readv reboot recv recvfrom recvmsg
-sbrk sched_get_priority_max sched_get_priority_min sched_getparam
+llseek lock madvise mincore mknod mlock modify_ldt mount mprotect mpx
+mremap msgctl msgget msgop msgrcv msgsnd munlock nanosleep nice pause
+poll prctl pread prof profil pselect ptrace pwrite query_module
+quotactl readv reboot recv recvfrom recvmsg sbrk
+sched_get_priority_max sched_get_priority_min sched_getparam
sched_getscheduler sched_rr_get_interval sched_setparam
sched_setscheduler sched_yield select semctl semget semop send
sendfile sendmsg sendto setcontext setdomainname setgroups sethostid
-sethostname setitimer setpriority setrlimit setsockopt
-settimeofday sgetmask shmat shmctl shmdt shmget shmop shutdown
-sigaction sigaltstack sigblock siggetmask sigmask signal sigpause
-sigpending sigprocmask sigreturn sigsetmask sigsuspend sigvec socket
-socketcall socketpair ssetmask statfs stime stty swapoff swapon
-syscalls sysctl sysfs sysinfo times
-ulimit umount uname ustat vfork vhangup wait3
-wait4 write writev
-
-4) In the spec but not implemented:
+sethostname setitimer setpriority setrlimit setsockopt settimeofday
+sgetmask shmat shmctl shmdt shmget shmop shutdown sigaction
+sigaltstack sigblock siggetmask sigmask signal sigpause sigpending
+sigprocmask sigreturn sigsetmask sigsuspend sigvec socket socketcall
+socketpair ssetmask statfs stime stty swapoff swapon syscalls sysctl
+sysfs sysinfo times ulimit umount uname ustat vfork vhangup wait3
+wait4 writev
+
+4) In the spec but not implemented:
- buffers
(defpackage :sb-posix (:use #:sb-alien #:cl)
- (:shadow close open ftruncate truncate time)
+ (:shadow close open ftruncate truncate time read write)
(:export #:syscall-error #:syscall-errno
;; types and type conversion
(open-with-mode pathname flags mode)
(open-without-mode pathname flags))))))
(def #-win32 "open" #+win32 "_open"))
+(define-call* "read" int minusp
+ (fd file-descriptor) (buf (* t)) (count int))
(define-call "rename" int minusp (oldpath filename) (newpath filename))
(define-call* "rmdir" int minusp (pathname filename))
(define-call* "unlink" int minusp (pathname filename))
(define-call #-netbsd "opendir" #+netbsd "_opendir"
(* t) null-alien (pathname filename))
+(define-call* "write" int minusp
+ (fd file-descriptor) (buf (* t)) (count int))
#+inode64
(define-call ("readdir" :c-name "readdir$INODE64" :options :largefile)
(* dirent)
kid-status))
42)
+(deftest read.1
+ (progn
+ (with-open-file (ouf (merge-pathnames "read-test.txt" *test-directory*)
+ :direction :output
+ :if-exists :supersede
+ :if-does-not-exist :create)
+ (write-string "foo" ouf))
+ (let ((fd (sb-posix:open (merge-pathnames "read-test.txt" *test-directory*) sb-posix:o-rdonly)))
+ (unwind-protect
+ (let ((buf (make-array 10 :element-type '(unsigned-byte 8))))
+ (values
+ (sb-posix:read fd (sb-sys:vector-sap buf) 10)
+ (code-char (aref buf 0))
+ (code-char (aref buf 1))
+ (code-char (aref buf 2))))
+ (sb-posix:close fd))))
+ 3 #\f #\o #\o)
+
(deftest opendir.1
(let ((dir (sb-posix:opendir "/")))
(unwind-protect (sb-alien:null-alien dir)
(sb-posix:closedir dir)))
t)
+
+(deftest write.1
+ (progn
+ (let ((fd (sb-posix:open (merge-pathnames "write-test.txt" *test-directory*)
+ (logior sb-posix:o-creat sb-posix:o-wronly)
+ (logior sb-posix:s-irusr sb-posix:s-iwusr)))
+ (retval nil))
+ (unwind-protect
+ (let ((buf (coerce "foo" 'simple-base-string)))
+ (setf retval (sb-posix:write fd (sb-sys:vector-sap buf) 3)))
+ (sb-posix:close fd))
+
+ (with-open-file (inf (merge-pathnames "write-test.txt" *test-directory*)
+ :direction :input)
+ (values retval (read-line inf)))))
+ 3 "foo")
+
#-win32
(deftest pwent.1
;; make sure that we found something
;;; 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".)
-"1.0.47.4"
+"1.0.47.5"