OSDN Git Service

new repo
[bytom/vapor.git] / vendor / golang.org / x / sys / unix / file_unix.go
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
5 package unix
6
7 import (
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.
14 func 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 }