@@ -71,7 +71,7 @@ func direntNamlen(buf []byte) (uint64, bool) {
7171// }
7272type Errno uint32
7373
74- func (e Errno ) Error ( ) string {
74+ func Error (e Errno ) string {
7575 if 0 <= int (e ) && int (e ) < len (errorstr ) {
7676 s := errorstr [e ]
7777 if s != "" {
@@ -81,28 +81,6 @@ func (e Errno) Error() string {
8181 return "errno " + utoa (uint64 (e ))
8282}
8383
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-
10684// A Signal is a number describing a process signal.
10785// It implements the [os.Signal] interface.
10886type Signal uint8
@@ -353,9 +331,9 @@ func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errn
353331 return 0 , 0 , ENOSYS
354332}
355333
356- func Sysctl (key string ) (string , error ) {
334+ func Sysctl (key string ) (string , Errno ) {
357335 if key == "kern.hostname" {
358- return "wasip1" , nil
336+ return "wasip1" , 0
359337 }
360338 return "" , ENOSYS
361339}
@@ -376,8 +354,8 @@ func Getegid() int {
376354 return 1
377355}
378356
379- func Getgroups () ([]int , error ) {
380- return []int {1 }, nil
357+ func Getgroups () ([]int , Errno ) {
358+ return []int {1 }, 0
381359}
382360
383361func Getpid () int {
@@ -388,24 +366,24 @@ func Getppid() int {
388366 return 2
389367}
390368
391- // func Gettimeofday(tv *Timeval) error {
369+ // func Gettimeofday(tv *Timeval) Errno {
392370// var time timestamp
393371// if errno := clock_time_get(clockRealtime, 1e3, &time); errno != 0 {
394372// return errno
395373// }
396374// tv.setTimestamp(time)
397- // return nil
375+ // return 0
398376// }
399377
400- func Sendfile (outfd int , infd int , offset * int64 , count int ) (written int , err error ) {
378+ func Sendfile (outfd int , infd int , offset * int64 , count int ) (written int , err Errno ) {
401379 return 0 , ENOSYS
402380}
403381
404- func StartProcess (argv0 string , argv []string , attr * ProcAttr ) (pid int , handle uintptr , err error ) {
382+ func StartProcess (argv0 string , argv []string , attr * ProcAttr ) (pid int , handle uintptr , err Errno ) {
405383 return 0 , 0 , ENOSYS
406384}
407385
408- func Wait4 (pid int , wstatus * WaitStatus , options int , rusage * Rusage ) (wpid int , err error ) {
386+ func Wait4 (pid int , wstatus * WaitStatus , options int , rusage * Rusage ) (wpid int , err Errno ) {
409387 return 0 , ENOSYS
410388}
411389
@@ -440,7 +418,7 @@ const (
440418 clockThreadCPUTimeID
441419)
442420
443- func SetNonblock (fd int , nonblocking bool ) error {
421+ func SetNonblock (fd int , nonblocking bool ) Errno {
444422 panic ("todo: syscall.SetNonblock" )
445423}
446424
@@ -453,7 +431,7 @@ const (
453431 RLIMIT_NOFILE = iota
454432)
455433
456- func Getrlimit (which int , lim * Rlimit ) error {
434+ func Getrlimit (which int , lim * Rlimit ) Errno {
457435 return ENOSYS
458436}
459437
0 commit comments