MCPcopy Index your code
hub / github.com/google/gvisor / Pwritev

Function Pwritev

pkg/sentry/syscalls/linux/sys_read_write.go:410–436  ·  view source on GitHub ↗

Pwritev implements Linux syscall pwritev(2).

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

Source from the content-addressed store, hash-verified

408
409// Pwritev implements Linux syscall pwritev(2).
410func Pwritev(t *kernel.Task, sysno uintptr, args arch.SyscallArguments) (uintptr, *kernel.SyscallControl, error) {
411 fd := args[0].Int()
412 addr := args[1].Pointer()
413 iovcnt := int(args[2].Int())
414 offset := args[3].Int64()
415
416 file := t.GetFile(fd)
417 if file == nil {
418 return 0, nil, linuxerr.EBADF
419 }
420 defer file.DecRef(t)
421
422 // Check that the offset is legitimate.
423 if offset < 0 {
424 return 0, nil, linuxerr.EINVAL
425 }
426
427 // Get the source of the write.
428 src, err := t.IovecsIOSequence(addr, iovcnt, usermem.IOOpts{})
429 if err != nil {
430 return 0, nil, err
431 }
432
433 n, err := pwrite(t, file, src, offset, vfs.WriteOptions{})
434 t.IOUsage().AccountReadSyscall(n)
435 return uintptr(n), nil, HandleIOError(t, n != 0, err, linuxerr.ERESTARTSYS, "pwritev", file)
436}
437
438// Pwritev2 implements Linux syscall pwritev2(2).
439func Pwritev2(t *kernel.Task, sysno uintptr, args arch.SyscallArguments) (uintptr, *kernel.SyscallControl, error) {

Callers

nothing calls this directly

Calls 10

pwriteFunction · 0.85
HandleIOErrorFunction · 0.85
GetFileMethod · 0.80
IovecsIOSequenceMethod · 0.80
AccountReadSyscallMethod · 0.80
DecRefMethod · 0.65
IOUsageMethod · 0.65
IntMethod · 0.45
PointerMethod · 0.45
Int64Method · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…