This file is indexed.

/usr/share/gocode/src/github.com/opencontainers/runc/libcontainer/xattr/xattr_linux.go is in golang-github-opencontainers-runc-dev 0.0.8+dfsg-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// +build linux

package xattr

import (
	"syscall"

	"github.com/opencontainers/runc/libcontainer/system"
)

func XattrEnabled(path string) bool {
	if Setxattr(path, "user.test", "") == syscall.ENOTSUP {
		return false
	}
	return true
}

func stringsfromByte(buf []byte) (result []string) {
	offset := 0
	for index, b := range buf {
		if b == 0 {
			result = append(result, string(buf[offset:index]))
			offset = index + 1
		}
	}
	return
}

func Listxattr(path string) ([]string, error) {
	size, err := system.Llistxattr(path, nil)
	if err != nil {
		return nil, err
	}
	buf := make([]byte, size)
	read, err := system.Llistxattr(path, buf)
	if err != nil {
		return nil, err
	}
	names := stringsfromByte(buf[:read])
	return names, nil
}

func Getxattr(path, attr string) (string, error) {
	value, err := system.Lgetxattr(path, attr)
	if err != nil {
		return "", err
	}
	return string(value), nil
}

func Setxattr(path, xattr, value string) error {
	return system.Lsetxattr(path, xattr, []byte(value), 0)
}