@@ -71,38 +71,6 @@ func direntNamlen(buf []byte) (uint64, bool) {
7171// }
7272type Errno uint32
7373
74- func (e Errno ) Error () string {
75- if 0 <= int (e ) && int (e ) < len (errorstr ) {
76- s := errorstr [e ]
77- if s != "" {
78- return s
79- }
80- }
81- return "errno " + utoa (uint64 (e ))
82- }
83-
84- func (e Errno ) Is (target error ) bool {
85- switch target {
86- case ErrPermission :
87- return e == EACCES || e == EPERM
88- case ErrExist :
89- return e == EEXIST || e == ENOTEMPTY
90- case ErrNotExist :
91- return e == ENOENT
92- case ErrUnsupported :
93- return e == ENOSYS
94- }
95- return false
96- }
97-
98- func (e Errno ) Temporary () bool {
99- return e == EINTR || e == EMFILE || e .Timeout ()
100- }
101-
102- func (e Errno ) Timeout () bool {
103- return e == EAGAIN || e == ETIMEDOUT
104- }
105-
10674// A Signal is a number describing a process signal.
10775// It implements the [os.Signal] interface.
10876type Signal uint8
@@ -353,7 +321,7 @@ func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errn
353321 return 0 , 0 , ENOSYS
354322}
355323
356- func Sysctl (key string ) (string , error ) {
324+ func Sysctl (key string ) (string , Errno ) {
357325 if key == "kern.hostname" {
358326 return "wasip1" , nil
359327 }
@@ -376,7 +344,7 @@ func Getegid() int {
376344 return 1
377345}
378346
379- func Getgroups () ([]int , error ) {
347+ func Getgroups () ([]int , Errno ) {
380348 return []int {1 }, nil
381349}
382350
@@ -388,24 +356,24 @@ func Getppid() int {
388356 return 2
389357}
390358
391- // func Gettimeofday(tv *Timeval) error {
359+ // func Gettimeofday(tv *Timeval) Errno {
392360// var time timestamp
393361// if errno := clock_time_get(clockRealtime, 1e3, &time); errno != 0 {
394362// return errno
395363// }
396364// tv.setTimestamp(time)
397- // return nil
365+ // return 0
398366// }
399367
400- func Sendfile (outfd int , infd int , offset * int64 , count int ) (written int , err error ) {
368+ func Sendfile (outfd int , infd int , offset * int64 , count int ) (written int , err Errno ) {
401369 return 0 , ENOSYS
402370}
403371
404- func StartProcess (argv0 string , argv []string , attr * ProcAttr ) (pid int , handle uintptr , err error ) {
372+ func StartProcess (argv0 string , argv []string , attr * ProcAttr ) (pid int , handle uintptr , err Errno ) {
405373 return 0 , 0 , ENOSYS
406374}
407375
408- func Wait4 (pid int , wstatus * WaitStatus , options int , rusage * Rusage ) (wpid int , err error ) {
376+ func Wait4 (pid int , wstatus * WaitStatus , options int , rusage * Rusage ) (wpid int , err Errno ) {
409377 return 0 , ENOSYS
410378}
411379
@@ -440,7 +408,7 @@ const (
440408 clockThreadCPUTimeID
441409)
442410
443- func SetNonblock (fd int , nonblocking bool ) error {
411+ func SetNonblock (fd int , nonblocking bool ) Errno {
444412 panic ("todo: syscall.SetNonblock" )
445413}
446414
@@ -453,7 +421,7 @@ const (
453421 RLIMIT_NOFILE = iota
454422)
455423
456- func Getrlimit (which int , lim * Rlimit ) error {
424+ func Getrlimit (which int , lim * Rlimit ) Errno {
457425 return ENOSYS
458426}
459427
0 commit comments