github.com/bananabytelabs/wazero@v0.0.0-20240105073314-54b22a776da8/internal/fsapi/unimplemented.go (about)

     1  package fsapi
     2  
     3  import experimentalsys "github.com/bananabytelabs/wazero/experimental/sys"
     4  
     5  func Adapt(f experimentalsys.File) File {
     6  	if f, ok := f.(File); ok {
     7  		return f
     8  	}
     9  	return unimplementedFile{f}
    10  }
    11  
    12  type unimplementedFile struct{ experimentalsys.File }
    13  
    14  // IsNonblock implements File.IsNonblock
    15  func (unimplementedFile) IsNonblock() bool {
    16  	return false
    17  }
    18  
    19  // SetNonblock implements File.SetNonblock
    20  func (unimplementedFile) SetNonblock(bool) experimentalsys.Errno {
    21  	return experimentalsys.ENOSYS
    22  }
    23  
    24  // Poll implements File.Poll
    25  func (unimplementedFile) Poll(Pflag, int32) (ready bool, errno experimentalsys.Errno) {
    26  	return false, experimentalsys.ENOSYS
    27  }