blob: 47f6a83f2163e62a9ed30f04cc99f57c86952d27 [file] [log] [blame]
David K. Bainbridge215e0242017-09-05 23:18:24 -07001// 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
5package unix
6
7import (
8 "os"
9 "syscall"
10)
11
12// FIXME: unexported function from os
13// syscallMode returns the syscall-specific mode bits from Go's portable mode bits.
14func syscallMode(i os.FileMode) (o uint32) {
15 o |= uint32(i.Perm())
16 if i&os.ModeSetuid != 0 {
17 o |= syscall.S_ISUID
18 }
19 if i&os.ModeSetgid != 0 {
20 o |= syscall.S_ISGID
21 }
22 if i&os.ModeSticky != 0 {
23 o |= syscall.S_ISVTX
24 }
25 // No mapping for Go's ModeTemporary (plan9 only).
26 return
27}