mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-21 04:49:04 +00:00
syscall: add fsync using libc
Signed-off-by: Achille Roussel <achille.roussel@gmail.com>
This commit is contained in:
committed by
Ron Evans
parent
1a67795fd3
commit
4fa6a132e2
@@ -71,6 +71,13 @@ func Open(path string, flag int, mode uint32) (fd int, err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Fsync(fd int) (err error) {
|
||||||
|
if libc_fsync(int32(fd)) < 0 {
|
||||||
|
err = getErrno()
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func Readlink(path string, p []byte) (n int, err error) {
|
func Readlink(path string, p []byte) (n int, err error) {
|
||||||
data := cstring(path)
|
data := cstring(path)
|
||||||
buf, count := splitSlice(p)
|
buf, count := splitSlice(p)
|
||||||
@@ -404,6 +411,11 @@ func libc_rename(from, to *byte) int32
|
|||||||
//export symlink
|
//export symlink
|
||||||
func libc_symlink(from, to *byte) int32
|
func libc_symlink(from, to *byte) int32
|
||||||
|
|
||||||
|
// int fsync(int fd);
|
||||||
|
//
|
||||||
|
//export fsync
|
||||||
|
func libc_fsync(fd int32) int32
|
||||||
|
|
||||||
// ssize_t readlink(const char *path, void *buf, size_t count);
|
// ssize_t readlink(const char *path, void *buf, size_t count);
|
||||||
//
|
//
|
||||||
//export readlink
|
//export readlink
|
||||||
|
|||||||
Reference in New Issue
Block a user