patch library: os/exec

This commit is contained in:
xushiwei
2024-07-11 18:44:06 +08:00
parent d0b57535ed
commit b81638794f
6 changed files with 1291 additions and 8 deletions

View File

@@ -24,6 +24,34 @@ import (
"github.com/goplus/llgo/c/os"
)
// Unix returns the time stored in ts as seconds plus nanoseconds.
func (ts *Timespec) Unix() (sec int64, nsec int64) {
return int64(ts.Sec), int64(ts.Nsec)
}
// Unix returns the time stored in tv as seconds plus nanoseconds.
func (tv *Timeval) Unix() (sec int64, nsec int64) {
return int64(tv.Sec), int64(tv.Usec) * 1000
}
// Nano returns the time stored in ts as nanoseconds.
func (ts *Timespec) Nano() int64 {
return int64(ts.Sec)*1e9 + int64(ts.Nsec)
}
// Nano returns the time stored in tv as nanoseconds.
func (tv *Timeval) Nano() int64 {
return int64(tv.Sec)*1e9 + int64(tv.Usec)*1000
}
func Getpagesize() int {
panic("todo: syscall.Getpagesize")
}
func Exit(code int) {
os.Exit(c.Int(code))
}
func Getcwd(buf []byte) (n int, err error) {
ptr := unsafe.Pointer(unsafe.SliceData(buf))
ret := os.Getcwd(ptr, uintptr(len(buf)))