"errno.h"
"dirent.h" "signal.h"
#-win32 "pwd.h"
+ #-win32 "grp.h"
"unistd.h"
#-win32 "termios.h"
#-win32 "syslog.h")
#+nil
(:integer fields "int" "pw_fields")))
+ ;; group database
+ #-win32
+ (:structure alien-group
+ ("struct group"
+ (c-string-pointer name "char *" "gr_name")
+ (c-string-pointer passwd "char *" "gr_passwd")
+ (gid-t gid "gid_t" "gr_gid")))
+
(:structure alien-stat
("struct stat"
(mode-t mode "mode_t" "st_mode")
#:passwd-name #:passwd-passwd #:passwd-uid #:passwd-gid
#:passwd-gecos #:passwd-dir #:passwd-shell
+ #:group-name #:group-gid #:group-passwd
#:stat-mode #:stat-ino #:stat-dev #:stat-nlink #:stat-uid
#:stat-gid #:stat-size #:stat-atime #:stat-mtime #:stat-ctime
#:termios-iflag #:termios-oflag #:termios-cflag
(define-pw-call "getpwnam" login-name (function (* alien-passwd) c-string))
(define-pw-call "getpwuid" uid (function (* alien-passwd) uid-t))
+;;; group database
+#-win32
+(define-protocol-class group alien-group ()
+ ((name :initarg :name :accessor group-name)
+ (passwd :initarg :passwd :accessor group-passwd)
+ (gid :initarg :gid :accessor group-gid)))
+
+(defmacro define-gr-call (name arg type)
+ #-win32
+ ;; FIXME: this isn't the documented way of doing this, surely?
+ (let ((lisp-name (intern (string-upcase name) :sb-posix)))
+ `(progn
+ (export ',lisp-name :sb-posix)
+ (declaim (inline ,lisp-name))
+ (defun ,lisp-name (,arg)
+ (let ((r (alien-funcall (extern-alien ,name ,type) ,arg)))
+ (if (null r)
+ r
+ (alien-to-group r)))))))
+
+(define-gr-call "getgrnam" login-name (function (* alien-group) c-string))
+(define-gr-call "getgrgid" gid (function (* alien-group) gid-t))
+
+
#-win32
(define-protocol-class timeval alien-timeval ()
((sec :initarg :tv-sec :accessor timeval-sec
(not (sb-posix:getpwnam "root"))
nil)
+#-win32
+(deftest grent.1
+ ;; make sure that we found something
+ (not (sb-posix:getgrgid 0))
+ nil)
+
+#-win32
+(deftest grent.2
+ ;; make sure that we found something
+ (not (sb-posix:getgrnam "wheel"))
+ nil)
+
#+nil
;; Requires root or special group + plus a sensible thing on the port
(deftest cfget/setispeed.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".)
-"1.0.10.30"
+"1.0.10.31"