1 (cl:in-package :sb-posix)
3 (defmacro define-protocol-class
4 (name alien-type superclasses slots &rest options)
5 (let ((to-protocol (intern (format nil "ALIEN-TO-~A" name)))
6 (to-alien (intern (format nil "~A-TO-ALIEN" name))))
8 (export ',name :sb-posix)
9 (defclass ,name ,superclasses
10 ,(loop for slotd in slots
11 collect (ldiff slotd (member :array-length slotd)))
13 (declaim (inline ,to-alien ,to-protocol))
14 (declaim (inline ,to-protocol ,to-alien))
15 (defun ,to-protocol (alien &optional instance)
16 (declare (type (sb-alien:alien (* ,alien-type)) alien)
17 (type (or null ,name) instance))
19 (setf instance (make-instance ',name)))
20 ,@(loop for slotd in slots
21 ;; FIXME: slotds in source are more complicated in general
23 ;; FIXME: baroque construction of intricate fragility
24 for array-length = (getf (cdr slotd) :array-length)
27 (let ((array (make-array ,array-length)))
28 (setf (slot-value instance ',(car slotd))
30 (dotimes (i ,array-length)
33 (sb-alien:slot alien ',(car slotd))
36 collect `(setf (slot-value instance ',(car slotd))
37 (sb-alien:slot alien ',(car slotd))))
39 (defun ,to-alien (instance &optional alien)
40 (declare (type (or null (sb-alien:alien (* ,alien-type))) alien)
41 (type ,name instance))
43 (setf alien (sb-alien:make-alien ,alien-type)))
44 ,@(loop for slotd in slots
45 for array-length = (getf (cdr slotd) :array-length)
48 (let ((array (slot-value instance ',(car slotd))))
49 (dotimes (i ,array-length)
51 (sb-alien:slot alien ',(car slotd))
55 collect `(setf (sb-alien:slot alien ',(car slotd))
56 (slot-value instance ',(car slotd)))))
57 (find-class ',name))))
59 (define-condition sb-posix:syscall-error (error)
60 ((errno :initarg :errno :reader sb-posix:syscall-errno))
61 (:report (lambda (c s)
62 (let ((errno (sb-posix:syscall-errno c)))
63 (format s "System call error ~A (~A)"
64 errno (sb-int:strerror errno))))))
66 (defun syscall-error ()
67 (error 'sb-posix:syscall-error :errno (get-errno)))
69 (declaim (inline never-fails))
70 (defun never-fails (&rest args)
71 (declare (ignore args))
74 ;;; Some systems may need C-level wrappers, which can live in the
75 ;;; runtime (so that save-lisp-and-die can produce standalone
76 ;;; executables). See REAL-C-NAME in macros.lisp for the use of this
78 (eval-when (:compile-toplevel :load-toplevel)
79 (setf *c-functions-in-runtime*
80 '`(#+netbsd ,@("stat" "lstat" "fstat" "readdir" "opendir"))))
84 (defmacro define-call* (name &rest arguments)
85 #-win32 `(define-call ,name ,@arguments)
86 #+win32 `(define-call ,(if (consp name)
87 `(,(concatenate 'string "_" (car name))
89 (concatenate 'string "_" name))
92 (define-call* "access" int minusp (pathname filename) (mode int))
93 (define-call* "chdir" int minusp (pathname filename))
94 (define-call* "chmod" int minusp (pathname filename) (mode mode-t))
95 (define-call* "close" int minusp (fd file-descriptor))
96 (define-call* "creat" int minusp (pathname filename) (mode mode-t))
97 (define-call* "dup" int minusp (oldfd file-descriptor))
98 (define-call* "dup2" int minusp (oldfd file-descriptor)
99 (newfd file-descriptor))
100 (define-call* ("lseek" :options :largefile)
101 off-t minusp (fd file-descriptor) (offset off-t)
103 (define-call* "mkdir" int minusp (pathname filename) (mode mode-t))
106 (define-call-internally open-with-mode ,x int minusp
107 (pathname filename) (flags int) (mode mode-t))
108 (define-call-internally open-without-mode ,x int minusp
109 (pathname filename) (flags int))
110 (define-entry-point ,x
111 (pathname flags &optional (mode nil mode-supplied))
113 (open-with-mode pathname flags mode)
114 (open-without-mode pathname flags))))))
115 (def #-win32 "open" #+win32 "_open"))
116 (define-call "rename" int minusp (oldpath filename) (newpath filename))
117 (define-call* "rmdir" int minusp (pathname filename))
118 (define-call* "unlink" int minusp (pathname filename))
119 (define-call #-netbsd "opendir" #+netbsd "_opendir"
120 (* t) null-alien (pathname filename))
121 (define-call (#-netbsd "readdir" #+netbsd "_readdir" :options :largefile)
123 ;; readdir() has the worst error convention in the world. It's just
124 ;; too painful to support. (return is NULL _and_ errno "unchanged"
125 ;; is not an error, it's EOF).
128 (define-call "closedir" int minusp (dir (* t)))
129 ;; need to do this here because we can't do it in the DEFPACKAGE
130 (define-call* "umask" mode-t never-fails (mode mode-t))
131 (define-call* "getpid" pid-t never-fails)
135 (define-call "chown" int minusp (pathname filename)
136 (owner uid-t) (group gid-t))
137 (define-call "chroot" int minusp (pathname filename))
138 (define-call "fchdir" int minusp (fd file-descriptor))
139 (define-call "fchmod" int minusp (fd file-descriptor) (mode mode-t))
140 (define-call "fchown" int minusp (fd file-descriptor)
141 (owner uid-t) (group gid-t))
142 (define-call "fdatasync" int minusp (fd file-descriptor))
143 (define-call ("ftruncate" :options :largefile)
144 int minusp (fd file-descriptor) (length off-t))
145 (define-call "fsync" int minusp (fd file-descriptor))
146 (define-call "lchown" int minusp (pathname filename)
147 (owner uid-t) (group gid-t))
148 (define-call "link" int minusp (oldpath filename) (newpath filename))
149 (define-call "lockf" int minusp (fd file-descriptor) (cmd int) (len off-t))
150 (define-call "mkfifo" int minusp (pathname filename) (mode mode-t))
151 (define-call "symlink" int minusp (oldpath filename) (newpath filename))
152 (define-call "sync" void never-fails)
153 (define-call ("truncate" :options :largefile)
154 int minusp (pathname filename) (length off-t))
155 ;; FIXME: Windows does have _mktemp, which has a slightlty different
157 (defun mkstemp (template)
158 ;; we are emulating sb-alien's charset conversion for strings
159 ;; here, to accommodate for the call-by-reference nature of
160 ;; mkstemp's template strings.
161 (let ((arg (sb-ext:string-to-octets
163 :external-format sb-alien::*default-c-string-external-format*)))
164 (sb-sys:with-pinned-objects (arg)
165 (let ((result (alien-funcall (extern-alien "mkstemp"
166 (function int c-string))
167 (sap-alien (sb-alien::vector-sap arg)
169 (when (minusp result)
172 (sb-ext:octets-to-string
174 :external-format sb-alien::*default-c-string-external-format*))))))
175 (define-call-internally ioctl-without-arg "ioctl" int minusp
176 (fd file-descriptor) (cmd int))
177 (define-call-internally ioctl-with-int-arg "ioctl" int minusp
178 (fd file-descriptor) (cmd int) (arg int))
179 (define-call-internally ioctl-with-pointer-arg "ioctl" int minusp
180 (fd file-descriptor) (cmd int)
181 (arg alien-pointer-to-anything-or-nil))
182 (define-entry-point "ioctl" (fd cmd &optional (arg nil argp))
185 ((alien int) (ioctl-with-int-arg fd cmd arg))
186 ((or (alien (* t)) null) (ioctl-with-pointer-arg fd cmd arg)))
187 (ioctl-without-arg fd cmd)))
188 (define-call-internally fcntl-without-arg "fcntl" int minusp
189 (fd file-descriptor) (cmd int))
190 (define-call-internally fcntl-with-int-arg "fcntl" int minusp
191 (fd file-descriptor) (cmd int) (arg int))
192 (define-call-internally fcntl-with-pointer-arg "fcntl" int minusp
193 (fd file-descriptor) (cmd int)
194 (arg alien-pointer-to-anything-or-nil))
195 (define-entry-point "fcntl" (fd cmd &optional (arg nil argp))
198 ((alien int) (fcntl-with-int-arg fd cmd arg))
199 ((or (alien (* t)) null) (fcntl-with-pointer-arg fd cmd arg)))
200 (fcntl-without-arg fd cmd)))
203 (define-call "geteuid" uid-t never-fails) ; "always successful", it says
204 (define-call "getresuid" uid-t never-fails)
205 (define-call "getuid" uid-t never-fails)
206 (define-call "seteuid" int minusp (uid uid-t))
207 (define-call "setfsuid" int minusp (uid uid-t))
208 (define-call "setreuid" int minusp (ruid uid-t) (euid uid-t))
209 (define-call "setresuid" int minusp (ruid uid-t) (euid uid-t) (suid uid-t))
210 (define-call "setuid" int minusp (uid uid-t))
211 (define-call "getegid" gid-t never-fails)
212 (define-call "getgid" gid-t never-fails)
213 (define-call "getresgid" gid-t never-fails)
214 (define-call "setegid" int minusp (gid gid-t))
215 (define-call "setfsgid" int minusp (gid gid-t))
216 (define-call "setgid" int minusp (gid gid-t))
217 (define-call "setregid" int minusp (rgid gid-t) (egid gid-t))
218 (define-call "setresgid" int minusp (rgid gid-t) (egid gid-t) (sgid gid-t))
220 ;; processes, signals
221 (define-call "alarm" int never-fails (seconds unsigned))
225 #+mach-exception-handler
227 ;; FIXME this is a lie, of course this can fail, but there's no
228 ;; error handling here yet!
229 (define-call "setup_mach_exceptions" void never-fails)
230 (define-call ("posix_fork" :c-name "fork") pid-t minusp)
232 (let ((pid (posix-fork)))
234 (setup-mach-exceptions))
236 (export 'fork :sb-posix))
238 #-mach-exception-handler
239 (define-call "fork" pid-t minusp)
241 (define-call "getpgid" pid-t minusp (pid pid-t))
242 (define-call "getppid" pid-t never-fails)
243 (define-call "getpgrp" pid-t never-fails)
244 (define-call "getsid" pid-t minusp (pid pid-t))
245 (define-call "kill" int minusp (pid pid-t) (signal int))
246 (define-call "killpg" int minusp (pgrp int) (signal int))
247 (define-call "pause" int minusp)
248 (define-call "setpgid" int minusp (pid pid-t) (pgid pid-t))
249 (define-call "setpgrp" int minusp))
251 (defmacro with-growing-c-string ((buffer size) &body body)
252 (sb-int:with-unique-names (c-string-block)
253 `(block ,c-string-block
255 (flet ((,buffer (&optional (size-incl-null))
257 (setf (sb-sys:sap-ref-8 (sb-alien:alien-sap ,buffer) size-incl-null)
259 (return-from ,c-string-block
260 (sb-alien::c-string-to-string
261 (sb-alien:alien-sap ,buffer)
262 (sb-impl::default-external-format)
264 (loop for ,size = 128 then (* 2 ,size)
267 (setf ,buffer (make-alien c-string ,size))
270 (free-alien ,buffer)))))))))
274 (export 'readlink :sb-posix)
275 (defun readlink (pathspec)
276 "Returns the resolved target of a symbolic link as a string."
277 (flet ((%readlink (path buf length)
279 (extern-alien "readlink" (function int c-string (* t) int))
281 (with-growing-c-string (buf size)
282 (let ((count (%readlink (filename pathspec) buf size)))
283 (cond ((minusp count)
289 (export 'getcwd :sb-posix)
291 "Returns the process's current working directory as a string."
292 (flet ((%getcwd (buffer size)
294 (extern-alien #-win32 "getcwd"
295 #+win32 "_getcwd" (function c-string (* t) int))
297 (with-growing-c-string (buf size)
298 (let ((result (%getcwd buf size)))
301 ((/= (get-errno) sb-posix:erange)
302 (syscall-error))))))))
306 (export 'wait :sb-posix)
307 (declaim (inline wait))
308 (defun wait (&optional statusptr)
309 (declare (type (or null (simple-array (signed-byte 32) (1))) statusptr))
310 (let* ((ptr (or statusptr (make-array 1 :element-type '(signed-byte 32))))
311 (pid (sb-sys:with-pinned-objects (ptr)
313 (extern-alien "wait" (function pid-t (* int)))
314 (sb-sys:vector-sap ptr)))))
317 (values pid (aref ptr 0))))))
321 (export 'waitpid :sb-posix)
322 (declaim (inline waitpid))
323 (defun waitpid (pid options &optional statusptr)
324 (declare (type (sb-alien:alien pid-t) pid)
325 (type (sb-alien:alien int) options)
326 (type (or null (simple-array (signed-byte 32) (1))) statusptr))
327 (let* ((ptr (or statusptr (make-array 1 :element-type '(signed-byte 32))))
328 (pid (sb-sys:with-pinned-objects (ptr)
330 (extern-alien "waitpid" (function pid-t
332 pid (sb-sys:vector-sap ptr) options))))
335 (values pid (aref ptr 0)))))
337 (define-call "wifexited" boolean never-fails (status int))
338 (define-call "wexitstatus" int never-fails (status int))
339 (define-call "wifsignaled" boolean never-fails (status int))
340 (define-call "wtermsig" int never-fails (status int))
341 (define-call "wifstopped" boolean never-fails (status int))
342 (define-call "wstopsig" int never-fails (status int))
343 #+nil ; see alien/waitpid-macros.c
344 (define-call "wifcontinued" boolean never-fails (status int)))
349 (define-call ("mmap" :options :largefile) sb-sys:system-area-pointer
351 (= (sb-sys:sap-int res) #.(1- (expt 2 sb-vm::n-machine-word-bits))))
352 (addr sap-or-nil) (length unsigned) (prot unsigned)
353 (flags unsigned) (fd file-descriptor) (offset off-t))
355 (define-call "munmap" int minusp
356 (start sb-sys:system-area-pointer) (length unsigned))
358 (define-call "msync" int minusp
359 (addr sb-sys:system-area-pointer) (length unsigned) (flags int)))
362 (define-call "getpagesize" int minusp)
364 ;;; KLUDGE: This could be taken from GetSystemInfo
365 (export (defun getpagesize () 4096))
368 ;; The docstrings are copied from the descriptions in SUSv3,
371 (define-protocol-class passwd alien-passwd ()
372 ((name :initarg :name :accessor passwd-name
373 :documentation "User's login name.")
374 ;; Note: SUSv3 doesn't require this member.
375 (passwd :initarg :passwd :accessor passwd-passwd
376 :documentation "The account's encrypted password.")
377 (uid :initarg :uid :accessor passwd-uid
378 :documentation "Numerical user ID.")
379 (gid :initarg :gid :accessor passwd-gid
380 :documentation "Numerical group ID.")
381 ;; Note: SUSv3 doesn't require this member.
382 (gecos :initarg :gecos :accessor passwd-gecos
383 :documentation "User's name or comment field.")
384 (dir :initarg :dir :accessor passwd-dir
385 :documentation "Initial working directory.")
386 (shell :initarg :shell :accessor passwd-shell
387 :documentation "Program to use as shell."))
388 (:documentation "Instances of this class represent entries in
389 the system's user database."))
391 (defmacro define-pw-call (name arg type)
393 ;; FIXME: this isn't the documented way of doing this, surely?
394 (let ((lisp-name (intern (string-upcase name) :sb-posix)))
396 (export ',lisp-name :sb-posix)
397 (declaim (inline ,lisp-name))
398 (defun ,lisp-name (,arg)
399 (let ((r (alien-funcall (extern-alien ,name ,type) ,arg)))
402 (alien-to-passwd r)))))))
404 (define-pw-call "getpwnam" login-name (function (* alien-passwd) c-string))
405 (define-pw-call "getpwuid" uid (function (* alien-passwd) uid-t))
408 (define-protocol-class timeval alien-timeval ()
409 ((sec :initarg :tv-sec :accessor timeval-sec
410 :documentation "Seconds.")
411 (usec :initarg :tv-usec :accessor timeval-usec
412 :documentation "Microseconds."))
413 (:documentation "Instances of this class represent time values."))
415 (define-protocol-class stat alien-stat ()
416 ((mode :initarg :mode :reader stat-mode
417 :documentation "Mode of file.")
418 (ino :initarg :ino :reader stat-ino
419 :documentation "File serial number.")
420 (dev :initarg :dev :reader stat-dev
421 :documentation "Device ID of device containing file.")
422 (nlink :initarg :nlink :reader stat-nlink
423 :documentation "Number of hard links to the file.")
424 (uid :initarg :uid :reader stat-uid
425 :documentation "User ID of file.")
426 (gid :initarg :gid :reader stat-gid
427 :documentation "Group ID of file.")
428 (size :initarg :size :reader stat-size
429 :documentation "For regular files, the file size in
430 bytes. For symbolic links, the length
431 in bytes of the filename contained in
433 (atime :initarg :atime :reader stat-atime
434 :documentation "Time of last access.")
435 (mtime :initarg :mtime :reader stat-mtime
436 :documentation "Time of last data modification.")
437 (ctime :initarg :ctime :reader stat-ctime
438 :documentation "Time of last status change"))
439 (:documentation "Instances of this class represent Posix file
442 (defmacro define-stat-call (name arg designator-fun type)
443 ;; FIXME: this isn't the documented way of doing this, surely?
444 (let ((lisp-name (lisp-for-c-symbol name)))
446 (export ',lisp-name :sb-posix)
447 (declaim (inline ,lisp-name))
448 (defun ,lisp-name (,arg &optional stat)
449 (declare (type (or null stat) stat))
450 (with-alien-stat a-stat ()
451 (let ((r (alien-funcall
452 (extern-alien ,(real-c-name (list name :options :largefile)) ,type)
453 (,designator-fun ,arg)
457 (alien-to-stat a-stat stat)))))))
459 (define-stat-call #-win32 "stat" #+win32 "_stat"
461 (function int c-string (* alien-stat)))
464 (define-stat-call "lstat"
466 (function int c-string (* alien-stat)))
467 ;;; No symbolic links on Windows, so use stat
470 (declaim (inline lstat))
471 (export (defun lstat (filename &optional stat)
472 (if stat (stat filename stat) (stat filename)))))
474 (define-stat-call #-win32 "fstat" #+win32 "_fstat"
476 (function int int (* alien-stat)))
480 (define-call "s_isreg" boolean never-fails (mode mode-t))
481 (define-call "s_isdir" boolean never-fails (mode mode-t))
482 (define-call "s_ischr" boolean never-fails (mode mode-t))
483 (define-call "s_isblk" boolean never-fails (mode mode-t))
484 (define-call "s_isfifo" boolean never-fails (mode mode-t))
485 (define-call "s_islnk" boolean never-fails (mode mode-t))
486 (define-call "s_issock" boolean never-fails (mode mode-t))
490 (export 'pipe :sb-posix)
491 (declaim (inline pipe))
492 (defun pipe (&optional filedes2)
493 (declare (type (or null (simple-array (signed-byte 32) (2))) filedes2))
495 (setq filedes2 (make-array 2 :element-type '(signed-byte 32))))
496 (let ((r (sb-sys:with-pinned-objects (filedes2)
498 ;; FIXME: (* INT)? (ARRAY INT 2) would be better
499 (extern-alien "pipe" (function int (* int)))
500 (sb-sys:vector-sap filedes2)))))
503 (values (aref filedes2 0) (aref filedes2 1))))
506 (define-protocol-class termios alien-termios ()
507 ((iflag :initarg :iflag :accessor sb-posix:termios-iflag
508 :documentation "Input modes.")
509 (oflag :initarg :oflag :accessor sb-posix:termios-oflag
510 :documentation "Output modes.")
511 (cflag :initarg :cflag :accessor sb-posix:termios-cflag
512 :documentation "Control modes.")
513 (lflag :initarg :lflag :accessor sb-posix:termios-lflag
514 :documentation "Local modes.")
515 (cc :initarg :cc :accessor sb-posix:termios-cc :array-length nccs
516 :documentation "Control characters"))
517 (:documentation "Instances of this class represent I/O
518 characteristics of the terminal."))
522 (export 'tcsetattr :sb-posix)
523 (declaim (inline tcsetattr))
524 (defun tcsetattr (fd actions termios)
525 (declare (type termios termios))
526 (with-alien-termios a-termios ()
527 (termios-to-alien termios a-termios)
528 (let ((fd (file-descriptor fd)))
529 (let* ((r (alien-funcall
532 (function int int int (* alien-termios)))
533 fd actions a-termios)))
537 (export 'tcgetattr :sb-posix)
538 (declaim (inline tcgetattr))
539 (defun tcgetattr (fd &optional termios)
540 (declare (type (or null termios) termios))
541 (with-alien-termios a-termios ()
542 (let ((r (alien-funcall
543 (extern-alien "tcgetattr"
544 (function int int (* alien-termios)))
549 (setf termios (alien-to-termios a-termios termios))))
551 (export 'cfsetispeed :sb-posix)
552 (declaim (inline cfsetispeed))
553 (defun cfsetispeed (speed &optional termios)
554 (declare (type (or null termios) termios))
555 (with-alien-termios a-termios ()
556 (let ((r (alien-funcall
557 (extern-alien "cfsetispeed"
558 (function int (* alien-termios) speed-t))
563 (setf termios (alien-to-termios a-termios termios))))
565 (export 'cfsetospeed :sb-posix)
566 (declaim (inline cfsetospeed))
567 (defun cfsetospeed (speed &optional termios)
568 (declare (type (or null termios) termios))
569 (with-alien-termios a-termios ()
570 (let ((r (alien-funcall
571 (extern-alien "cfsetospeed"
572 (function int (* alien-termios) speed-t))
577 (setf termios (alien-to-termios a-termios termios))))
579 (export 'cfgetispeed :sb-posix)
580 (declaim (inline cfgetispeed))
581 (defun cfgetispeed (termios)
582 (declare (type termios termios))
583 (with-alien-termios a-termios ()
584 (termios-to-alien termios a-termios)
585 (alien-funcall (extern-alien "cfgetispeed"
586 (function speed-t (* alien-termios)))
588 (export 'cfgetospeed :sb-posix)
589 (declaim (inline cfgetospeed))
590 (defun cfgetospeed (termios)
591 (declare (type termios termios))
592 (with-alien-termios a-termios ()
593 (termios-to-alien termios a-termios)
594 (alien-funcall (extern-alien "cfgetospeed"
595 (function speed-t (* alien-termios)))
601 (export 'time :sb-posix)
603 (let ((result (alien-funcall (extern-alien "time"
604 (function time-t (* time-t)))
609 (export 'utime :sb-posix)
610 (defun utime (filename &optional access-time modification-time)
611 (let ((fun (extern-alien "utime" (function int c-string
613 (name (filename filename)))
614 (if (not (and access-time modification-time))
615 (alien-funcall fun name nil)
616 (with-alien ((utimbuf (struct alien-utimbuf)))
617 (setf (slot utimbuf 'actime) (or access-time 0)
618 (slot utimbuf 'modtime) (or modification-time 0))
619 (let ((result (alien-funcall fun name (alien-sap utimbuf))))
623 (export 'utimes :sb-posix)
624 (defun utimes (filename &optional access-time modification-time)
625 (flet ((seconds-and-useconds (time)
626 (multiple-value-bind (integer fractional)
628 (values integer (cl:truncate (* fractional 1000000)))))
629 (maybe-syscall-error (value)
633 (let ((fun (extern-alien "utimes" (function int c-string
634 (* (array alien-timeval 2)))))
635 (name (filename filename)))
636 (if (not (and access-time modification-time))
637 (maybe-syscall-error (alien-funcall fun name nil))
638 (with-alien ((buf (array alien-timeval 2)))
639 (let ((actime (deref buf 0))
640 (modtime (deref buf 1)))
641 (setf (values (slot actime 'sec)
643 (seconds-and-useconds (or access-time 0))
644 (values (slot modtime 'sec)
645 (slot modtime 'usec))
646 (seconds-and-useconds (or modification-time 0)))
647 (maybe-syscall-error (alien-funcall fun name
648 (alien-sap buf))))))))))
653 (export 'getenv :sb-posix)
655 (let ((r (alien-funcall
656 (extern-alien "getenv" (function (* char) c-string))
658 (declare (type (alien (* char)) r))
659 (unless (null-alien r)
661 (define-call "putenv" int minusp (string c-string))
666 (export 'openlog :sb-posix)
667 (export 'syslog :sb-posix)
668 (export 'closelog :sb-posix)
669 (defun openlog (ident options &optional (facility log-user))
670 (alien-funcall (extern-alien
671 "openlog" (function void c-string int int))
672 ident options facility))
673 (defun syslog (priority format &rest args)
674 "Send a message to the syslog facility, with severity level
675 PRIORITY. The message will be formatted as by CL:FORMAT (rather
676 than C's printf) with format string FORMAT and arguments ARGS."
677 (flet ((syslog1 (priority message)
678 (alien-funcall (extern-alien
679 "syslog" (function void int c-string c-string))
680 priority "%s" message)))
681 (syslog1 priority (apply #'format nil format args))))
682 (define-call "closelog" void never-fails))