X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=contrib%2Fsb-posix%2Finterface.lisp;h=7bc574b6e2c4b91ff01f65de7d9386de07580f08;hb=0b85642df140fabd8f0a91c85edff0543dc359b1;hp=155d84d8c6cf03daf1124a7d7f778b3e5f69cb66;hpb=015dc5f920a57c2e502eef3f54d91ac8fe225747;p=sbcl.git diff --git a/contrib/sb-posix/interface.lisp b/contrib/sb-posix/interface.lisp index 155d84d..7bc574b 100644 --- a/contrib/sb-posix/interface.lisp +++ b/contrib/sb-posix/interface.lisp @@ -404,6 +404,30 @@ (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