mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-11 06:23:39 +00:00
os: implement readdir for darwin and linux
readdir is disabled on linux for 386 and arm until syscall.seek is implemented there. windows is hard, so leaving that for later. File src/os/dir_other_go115.go can be deleted when we drop support for go 1.15. Also adds TestReadNonDir, which was helpful while debugging.
This commit is contained in:
@@ -202,6 +202,31 @@ const (
|
||||
S_IXUSR = 0x40
|
||||
)
|
||||
|
||||
// dummy
|
||||
const (
|
||||
DT_BLK = 0x6
|
||||
DT_CHR = 0x2
|
||||
DT_DIR = 0x4
|
||||
DT_FIFO = 0x1
|
||||
DT_LNK = 0xa
|
||||
DT_REG = 0x8
|
||||
DT_SOCK = 0xc
|
||||
DT_UNKNOWN = 0x0
|
||||
DT_WHT = 0xe
|
||||
)
|
||||
|
||||
// dummy
|
||||
type Dirent struct {
|
||||
Ino uint64
|
||||
Reclen uint16
|
||||
Type uint8
|
||||
Name [1024]int8
|
||||
}
|
||||
|
||||
func ReadDirent(fd int, buf []byte) (n int, err error) {
|
||||
return -1, ENOSYS
|
||||
}
|
||||
|
||||
func Stat(path string, p *Stat_t) (err error) {
|
||||
data := cstring(path)
|
||||
n := libc_stat(&data[0], unsafe.Pointer(p))
|
||||
|
||||
Reference in New Issue
Block a user