diff options
author | Achille <[email protected]> | 2023-05-05 00:40:15 -0700 |
---|---|---|
committer | GitHub <[email protected]> | 2023-05-05 09:40:15 +0200 |
commit | 602f35a5ca10093639ecad8c875848df48c3b311 (patch) | |
tree | ec3ece2accd2d3d57a5cf72408b44f4d89a131d9 /src/syscall | |
parent | 1d5c5ca2ef879f61957af146989b53da0814790c (diff) | |
download | tinygo-602f35a5ca10093639ecad8c875848df48c3b311.tar.gz tinygo-602f35a5ca10093639ecad8c875848df48c3b311.zip |
os: implement os.(*File).WriteAt (#3697)
os: implement os.(*File).WriteAt
Signed-off-by: Achille Roussel <[email protected]>
Diffstat (limited to 'src/syscall')
-rw-r--r-- | src/syscall/syscall_libc.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/syscall/syscall_libc.go b/src/syscall/syscall_libc.go index aaba78377..ea0a000d1 100644 --- a/src/syscall/syscall_libc.go +++ b/src/syscall/syscall_libc.go @@ -54,6 +54,15 @@ func Pread(fd int, p []byte, offset int64) (n int, err error) { return } +func Pwrite(fd int, p []byte, offset int64) (n int, err error) { + buf, count := splitSlice(p) + n = libc_pwrite(int32(fd), buf, uint(count), offset) + if n < 0 { + err = getErrno() + } + return +} + func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { newoffset = libc_lseek(int32(fd), offset, whence) if newoffset < 0 { @@ -342,6 +351,11 @@ func libc_read(fd int32, buf *byte, count uint) int //export pread func libc_pread(fd int32, buf *byte, count uint, offset int64) int +// ssize_t pwrite(int fd, void *buf, size_t count, off_t offset); +// +//export pwrite +func libc_pwrite(fd int32, buf *byte, count uint, offset int64) int + // ssize_t lseek(int fd, off_t offset, int whence); // //export lseek |