Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/components/ws-daemon/pkg/iws/opentree.go
2499 views
1
// Copyright (c) 2021 Gitpod GmbH. All rights reserved.
2
// Licensed under the GNU Affero General Public License (AGPL).
3
// See License.AGPL.txt in the project root for license information.
4
5
package iws
6
7
import (
8
"unsafe"
9
10
"golang.org/x/sys/unix"
11
)
12
13
func syscallOpenTree(dfd int, path string, flags uintptr) (fd uintptr, err error) {
14
p1, err := unix.BytePtrFromString(path)
15
if err != nil {
16
return 0, err
17
}
18
fd, _, errno := unix.Syscall(unix.SYS_OPEN_TREE, uintptr(dfd), uintptr(unsafe.Pointer(p1)), flags)
19
if errno != 0 {
20
return 0, errno
21
}
22
23
return fd, nil
24
}
25
26
const (
27
// FlagOpenTreeClone: https://elixir.bootlin.com/linux/latest/source/include/uapi/linux/mount.h#L62
28
flagOpenTreeClone = 1
29
// FlagAtRecursive: Apply to the entire subtree: https://elixir.bootlin.com/linux/latest/source/include/uapi/linux/fcntl.h#L112
30
flagAtRecursive = 0x8000
31
)
32
33