file-options.scm 1.3 KB

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