go at_freebsd 源码
golang at_freebsd 代码
文件路径:/src/internal/syscall/unix/at_freebsd.go
// Copyright 2018 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package unix
import (
"syscall"
"unsafe"
)
const (
AT_REMOVEDIR = 0x800
AT_SYMLINK_NOFOLLOW = 0x200
)
func Unlinkat(dirfd int, path string, flags int) error {
p, err := syscall.BytePtrFromString(path)
if err != nil {
return err
}
_, _, errno := syscall.Syscall(syscall.SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(p)), uintptr(flags))
if errno != 0 {
return errno
}
return nil
}
func Openat(dirfd int, path string, flags int, perm uint32) (int, error) {
p, err := syscall.BytePtrFromString(path)
if err != nil {
return 0, err
}
fd, _, errno := syscall.Syscall6(syscall.SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(p)), uintptr(flags), uintptr(perm), 0, 0)
if errno != 0 {
return 0, errno
}
return int(fd), nil
}
func Fstatat(dirfd int, path string, stat *syscall.Stat_t, flags int) error {
return syscall.Fstatat(dirfd, path, stat, flags)
}
相关信息
相关文章
0
赞
热门推荐
-
2、 - 优质文章
-
3、 gate.io
-
7、 golang
-
9、 openharmony
-
10、 Vue中input框自动聚焦