本文整理匯總了Golang中syscall.Fchmod函數的典型用法代碼示例。如果您正苦於以下問題:Golang Fchmod函數的具體用法?Golang Fchmod怎麽用?Golang Fchmod使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了Fchmod函數的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Chmod
// Chmod changes the mode of the file to mode.
// If there is an error, it will be of type *PathError.
func (f *File) Chmod(mode FileMode) error {
if err := f.checkValid("chmod"); err != nil {
return err
}
if e := syscall.Fchmod(f.fd, syscallMode(mode)); e != nil {
return &PathError{"chmod", f.name, e}
}
return nil
}
示例2: Chmod
// Chmod changes the mode of the file to mode.
// If there is an error, it will be of type *PathError.
func (f *File) Chmod(mode FileMode) error {
if f == nil {
return ErrInvalid
}
if e := syscall.Fchmod(f.fd, syscallMode(mode)); e != nil {
return &PathError{"chmod", f.name, e}
}
return nil
}
示例3: Chmod
func (f *file) Chmod(mode uint32) fuse.Status {
f.fdLock.RLock()
defer f.fdLock.RUnlock()
// os.File.Chmod goes through the "syscallMode" translation function that messes
// up the suid and sgid bits. So use syscall.Fchmod directly.
err := syscall.Fchmod(f.intFd(), mode)
return fuse.ToStatus(err)
}
示例4: Chmod
// Chmod changes the mode of the file to mode.
func (f *File) Chmod(mode int) Error {
if e := syscall.Fchmod(f.fd, mode); e != 0 {
return &PathError{"chmod", f.name, Errno(e)}
}
return nil
}
示例5: Chmod
// Chmod changes the mode of the file to mode.
func (f *File) Chmod(mode uint32) error {
if e := syscall.Fchmod(f.fd, mode); iserror(e) {
return &PathError{"chmod", f.name, Errno(e)}
}
return nil
}
示例6: Fchmod
func (k *PosixKernel) Fchmod(fd int, mode uint32) uint64 {
return Errno(syscall.Fchmod(fd, mode))
}
示例7: SetAttr
func (constor *Constor) SetAttr(input *fuse.SetAttrIn, out *fuse.AttrOut) fuse.Status {
var err error
uid := -1
gid := -1
inode := constor.inodemap.findInodePtr(input.NodeId)
if inode == nil {
constor.error("inode nil")
return fuse.EIO
}
constor.log("%s %d", inode.id, input.Valid)
// if ((input.Valid & fuse.FATTR_FH) !=0) && ((input.Valid & (fuse.FATTR_ATIME | fuse.FATTR_MTIME)) == 0) {
if ((input.Valid & fuse.FATTR_FH) != 0) && ((input.Valid & fuse.FATTR_SIZE) != 0) {
ptr := uintptr(input.Fh)
F := constor.getfd(ptr)
if F == nil {
constor.error("F == nil for %s", inode.id)
return fuse.EIO
}
if F.layer != 0 && inode.layer == -1 {
/* FIXME handle this valid case */
// file is in lower layer, opened, deleted, setattr-called
constor.error("FSetAttr F.layer=%d inode.layer=%d", F.layer, inode.layer)
return fuse.EIO
}
if F.layer != 0 && inode.layer != 0 {
err := constor.copyup(inode)
if err != nil {
constor.error("copyup failed for %s - %s", inode.id, err)
return fuse.ToStatus(err)
}
path := constor.getPath(0, inode.id)
syscall.Close(F.fd)
fd, err := syscall.Open(path, F.flags, 0)
if err != nil {
constor.error("open failed on %s - %s", path, err)
return fuse.ToStatus(err)
}
F.fd = fd
F.layer = 0
constor.log("reset fd for %s", path)
} else if F.layer != 0 && inode.layer == 0 {
// when some other process already has done a copyup
syscall.Close(F.fd)
path := constor.getPath(0, inode.id)
fd, err := syscall.Open(path, F.flags, 0)
if err != nil {
constor.error("open failed on %s - %s", path, err)
return fuse.ToStatus(err)
}
F.fd = fd
F.layer = 0
constor.log("reset fd for %s", path)
}
if F.layer != 0 {
constor.error("layer not 0")
return fuse.EIO
}
if input.Valid&fuse.FATTR_MODE != 0 {
permissions := uint32(07777) & input.Mode
err = syscall.Fchmod(F.fd, permissions)
if err != nil {
constor.error("Fchmod failed on %s - %d : %s", F.id, permissions, err)
return fuse.ToStatus(err)
}
}
if input.Valid&(fuse.FATTR_UID) != 0 {
uid = int(input.Uid)
}
if input.Valid&(fuse.FATTR_GID) != 0 {
gid = int(input.Gid)
}
if input.Valid&(fuse.FATTR_UID|fuse.FATTR_GID) != 0 {
err = syscall.Fchown(F.fd, uid, gid)
if err != nil {
constor.error("Fchown failed on %s - %d %d : %s", F.id, uid, gid, err)
return fuse.ToStatus(err)
}
}
if input.Valid&fuse.FATTR_SIZE != 0 {
err := syscall.Ftruncate(F.fd, int64(input.Size))
if err != nil {
constor.error("Ftruncate failed on %s - %d : %s", F.id, input.Size, err)
return fuse.ToStatus(err)
}
}
if input.Valid&(fuse.FATTR_ATIME|fuse.FATTR_MTIME|fuse.FATTR_ATIME_NOW|fuse.FATTR_MTIME_NOW) != 0 {
now := time.Now()
var tv []syscall.Timeval
tv = make([]syscall.Timeval, 2)
if input.Valid&fuse.FATTR_ATIME_NOW != 0 {
tv[0].Sec = now.Unix()
tv[0].Usec = now.UnixNano() / 1000
} else {
//.........這裏部分代碼省略.........