file-options.scm 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. ; Copyright (c) 1993-2007 by Richard Kelsey and Jonathan Rees. See file COPYING.
  2. ; Options for open() and fcntl()
  3. (define-enumerated-type file-option :file-option
  4. file-option? ; predicate
  5. the-file-options ; vector containing all elements
  6. file-option-name ; name accessor
  7. file-option-index ; index accessor
  8. ;; the order of these is known to the C code
  9. ( ;; Options for open()
  10. create
  11. exclusive
  12. no-controlling-tty
  13. truncate
  14. ;; Options for open(), read and written by fcntl()
  15. append
  16. synchronized-data ; New in POSIX 2nd edition, not in Linux
  17. nonblocking
  18. synchronized-read ; New in POSIX 2nd edition, not in Linux
  19. synchronized
  20. ;; Modes for open(), read by fcntl()
  21. read-only
  22. read-write
  23. write-only))
  24. (define open-options-mask #o0777)
  25. (define fcntl-options-mask #o0760)
  26. (define mode-mask #o7000)
  27. (define-enum-set-type file-options :file-options
  28. file-options?
  29. make-file-options
  30. file-option file-option?
  31. the-file-options
  32. file-option-index)
  33. (define-exported-binding "posix-file-options-enum-set-type" :file-options)
  34. (define (file-options-on? options0 options1)
  35. (enum-set=? (enum-set-intersection options0 options1)
  36. options1))
  37. (define (file-options-union options0 options1)
  38. (enum-set-union options0 options1))