seteuids.lisp 632 B

12345678910111213141516171819202122232425
  1. (in-package :hurd)
  2. (defcfun ("seteuids" %seteuids)
  3. :int
  4. (n :int)
  5. (ptr :pointer))
  6. (defun seteuids (uid-list)
  7. "Set the effective UID set."
  8. (declare (type cons uid-list))
  9. (unless (and (listp uid-list)
  10. (not (null uid-list)))
  11. (return-from seteuids nil))
  12. (let ((total (length uid-list)))
  13. (with-foreign-pointer (ptr (* +uid-t-size+
  14. total))
  15. (loop for i from 0 below total
  16. for uid in uid-list
  17. do (setf (mem-aref ptr 'uid-t i) uid))
  18. (let ((err (%seteuids total ptr)))
  19. (cond
  20. ((= err -1) nil)
  21. (t err))))))