|
|
@@ -36,6 +36,20 @@ func Creat(path string, mode uint32) (fd int, err error) {
|
|
|
return Open(path, O_CREAT|O_WRONLY|O_TRUNC, mode)
|
|
|
}
|
|
|
|
|
|
+//sys fchmodat(dirfd int, path string, mode uint32) (err error)
|
|
|
+
|
|
|
+func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) {
|
|
|
+ // Linux fchmodat doesn't support the flags parameter. Mimick glibc's behavior
|
|
|
+ // and check the flags. Otherwise the mode would be applied to the symlink
|
|
|
+ // destination which is not what the user expects.
|
|
|
+ if flags&^AT_SYMLINK_NOFOLLOW != 0 {
|
|
|
+ return EINVAL
|
|
|
+ } else if flags&AT_SYMLINK_NOFOLLOW != 0 {
|
|
|
+ return EOPNOTSUPP
|
|
|
+ }
|
|
|
+ return fchmodat(dirfd, path, mode)
|
|
|
+}
|
|
|
+
|
|
|
//sys ioctl(fd int, req uint, arg uintptr) (err error)
|
|
|
|
|
|
// ioctl itself should not be exposed directly, but additional get/set
|
|
|
@@ -1177,7 +1191,6 @@ func Mount(source string, target string, fstype string, flags uintptr, data stri
|
|
|
//sys Fallocate(fd int, mode uint32, off int64, len int64) (err error)
|
|
|
//sys Fchdir(fd int) (err error)
|
|
|
//sys Fchmod(fd int, mode uint32) (err error)
|
|
|
-//sys Fchmodat(dirfd int, path string, mode uint32, flags int) (err error)
|
|
|
//sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error)
|
|
|
//sys fcntl(fd int, cmd int, arg int) (val int, err error)
|
|
|
//sys Fdatasync(fd int) (err error)
|