xattr_unsupported.go 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. //go:build !linux && !darwin
  2. // +build !linux,!darwin
  3. /*
  4. Copyright The containerd Authors.
  5. Licensed under the Apache License, Version 2.0 (the "License");
  6. you may not use this file except in compliance with the License.
  7. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. */
  15. package sysx
  16. import (
  17. "errors"
  18. "runtime"
  19. )
  20. var errUnsupported = errors.New("extended attributes unsupported on " + runtime.GOOS)
  21. // Listxattr calls syscall listxattr and reads all content
  22. // and returns a string array
  23. func Listxattr(path string) ([]string, error) {
  24. return []string{}, nil
  25. }
  26. // Removexattr calls syscall removexattr
  27. func Removexattr(path string, attr string) (err error) {
  28. return errUnsupported
  29. }
  30. // Setxattr calls syscall setxattr
  31. func Setxattr(path string, attr string, data []byte, flags int) (err error) {
  32. return errUnsupported
  33. }
  34. // Getxattr calls syscall getxattr
  35. func Getxattr(path, attr string) ([]byte, error) {
  36. return []byte{}, errUnsupported
  37. }
  38. // LListxattr lists xattrs, not following symlinks
  39. func LListxattr(path string) ([]string, error) {
  40. return []string{}, nil
  41. }
  42. // LRemovexattr removes an xattr, not following symlinks
  43. func LRemovexattr(path string, attr string) (err error) {
  44. return errUnsupported
  45. }
  46. // LSetxattr sets an xattr, not following symlinks
  47. func LSetxattr(path string, attr string, data []byte, flags int) (err error) {
  48. return errUnsupported
  49. }
  50. // LGetxattr gets an xattr, not following symlinks
  51. func LGetxattr(path, attr string) ([]byte, error) {
  52. return []byte{}, nil
  53. }