file_unix.go 614 B

123456789101112131415161718192021222324252627
  1. // Copyright 2017 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. package unix
  5. import (
  6. "os"
  7. "syscall"
  8. )
  9. // FIXME: unexported function from os
  10. // syscallMode returns the syscall-specific mode bits from Go's portable mode bits.
  11. func syscallMode(i os.FileMode) (o uint32) {
  12. o |= uint32(i.Perm())
  13. if i&os.ModeSetuid != 0 {
  14. o |= syscall.S_ISUID
  15. }
  16. if i&os.ModeSetgid != 0 {
  17. o |= syscall.S_ISGID
  18. }
  19. if i&os.ModeSticky != 0 {
  20. o |= syscall.S_ISVTX
  21. }
  22. // No mapping for Go's ModeTemporary (plan9 only).
  23. return
  24. }