Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions wasi/src/main/java/run/endive/wasi/WasiPreview1.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@
*/
@HostModule("wasi_snapshot_preview1")
public final class WasiPreview1 implements Closeable {
// Avoid unix:*: owner and group attributes trigger name lookups.
private static final String FILESTAT_ATTRIBUTES =
"unix:dev,ino,nlink,size,lastAccessTime,lastModifiedTime,ctime,"
+ "isSymbolicLink,isDirectory,isRegularFile";

private final Logger logger;
private final Random random;
private final Clock clock;
Expand Down Expand Up @@ -461,7 +466,7 @@ public int fdFilestatGet(Memory memory, int fd, int buf) {

Map<String, Object> attributes;
try {
attributes = Files.readAttributes(path, "unix:*");
attributes = Files.readAttributes(path, FILESTAT_ATTRIBUTES);
} catch (UnsupportedOperationException e) {
return wasiResult(WasiErrno.ENOTSUP);
} catch (IOException e) {
Expand Down Expand Up @@ -773,7 +778,7 @@ public int fdReaddir(

Map<String, Object> attributes;
try {
attributes = Files.readAttributes(entryPath, "unix:*");
attributes = Files.readAttributes(entryPath, FILESTAT_ATTRIBUTES);
} catch (UnsupportedOperationException e) {
return wasiResult(WasiErrno.ENOTSUP);
} catch (NoSuchFileException e) {
Expand Down Expand Up @@ -1029,7 +1034,7 @@ public int pathFilestatGet(
path = resolved.resolved();
}
}
attributes = Files.readAttributes(path, "unix:*", linkOptions);
attributes = Files.readAttributes(path, FILESTAT_ATTRIBUTES, linkOptions);
} catch (UnsupportedOperationException e) {
return wasiResult(WasiErrno.ENOTSUP);
} catch (NoSuchFileException e) {
Expand Down
Loading