MCPcopy
hub / github.com/google/gvisor / Fsetxattr

Function Fsetxattr

pkg/sentry/syscalls/linux/sys_xattr.go:217–248  ·  view source on GitHub ↗

Fsetxattr implements Linux syscall fsetxattr(2).

(t *kernel.Task, sysno uintptr, args arch.SyscallArguments)

Source from the content-addressed store, hash-verified

215
216// Fsetxattr implements Linux syscall fsetxattr(2).
217func Fsetxattr(t *kernel.Task, sysno uintptr, args arch.SyscallArguments) (uintptr, *kernel.SyscallControl, error) {
218 fd := args[0].Int()
219 nameAddr := args[1].Pointer()
220 valueAddr := args[2].Pointer()
221 size := args[3].SizeT()
222 flags := args[4].Int()
223
224 if flags&^(linux.XATTR_CREATE|linux.XATTR_REPLACE) != 0 {
225 return 0, nil, linuxerr.EINVAL
226 }
227
228 file := t.GetFile(fd)
229 if file == nil {
230 return 0, nil, linuxerr.EBADF
231 }
232 defer file.DecRef(t)
233
234 name, err := copyInXattrName(t, nameAddr)
235 if err != nil {
236 return 0, nil, err
237 }
238 value, err := copyInXattrValue(t, valueAddr, size)
239 if err != nil {
240 return 0, nil, err
241 }
242
243 return 0, nil, file.SetXattr(t, &vfs.SetXattrOptions{
244 Name: name,
245 Value: value,
246 Flags: uint32(flags),
247 })
248}
249
250// RemoveXattr implements Linux syscall removexattr(2).
251func RemoveXattr(t *kernel.Task, sysno uintptr, args arch.SyscallArguments) (uintptr, *kernel.SyscallControl, error) {

Callers

nothing calls this directly

Calls 8

copyInXattrNameFunction · 0.85
copyInXattrValueFunction · 0.85
SizeTMethod · 0.80
GetFileMethod · 0.80
DecRefMethod · 0.65
SetXattrMethod · 0.65
IntMethod · 0.45
PointerMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…