Path: blob/main/components/ws-daemon/pkg/iws/opentree.go
2499 views
// Copyright (c) 2021 Gitpod GmbH. All rights reserved.1// Licensed under the GNU Affero General Public License (AGPL).2// See License.AGPL.txt in the project root for license information.34package iws56import (7"unsafe"89"golang.org/x/sys/unix"10)1112func syscallOpenTree(dfd int, path string, flags uintptr) (fd uintptr, err error) {13p1, err := unix.BytePtrFromString(path)14if err != nil {15return 0, err16}17fd, _, errno := unix.Syscall(unix.SYS_OPEN_TREE, uintptr(dfd), uintptr(unsafe.Pointer(p1)), flags)18if errno != 0 {19return 0, errno20}2122return fd, nil23}2425const (26// FlagOpenTreeClone: https://elixir.bootlin.com/linux/latest/source/include/uapi/linux/mount.h#L6227flagOpenTreeClone = 128// FlagAtRecursive: Apply to the entire subtree: https://elixir.bootlin.com/linux/latest/source/include/uapi/linux/fcntl.h#L11229flagAtRecursive = 0x800030)313233