kubkon opened PR #1561 from handle-rights to master:
This commit does a lot of reshuffling and even some more. It introduces
strongly-typed system primitives which are:OsFile,OsDir,Stdio,
andOsOther. Those primitives are separate structs now, each implementing
a subset ofHandlemethods, rather than all being an enumeration of some
supertype such asOsHandle. To summarise the structs:
OsFilerepresents a regular file, and implements fd-ops
ofHandletrait
OsDirrepresents a directory, and primarily implements path-ops, plus
readdirand some common fd-ops such asfdstat, etc.
Stdiorepresents a stdio handle, and implements a subset of fd-ops
such asfdstat_and_read_andwrite_vectoredcalls
OsOthercurrently represents anything else and implements a set similar
to that implemented byStdioThis commit is effectively an experiment and an excercise into better
understanding what's going on for each OS resource/type under-the-hood.
It's meant to give us some intuition in order to move on with the idea
of having strongly-typed handles in WASI both in the syscall impl as well
as at the libc level.Some more minor changes include making
OsHandlerepresent an OS-specific
wrapper for a raw OS handle (Unix fd or Windows handle). Also, sinceOsDir
is tricky across OSes, we also have a supertype ofOsHandlecalled
OsDirHandlewhich may store aDIR*stream pointer (mainly BSD). Last but not
least, theFiletypeandRightsare now computed when the resource is created,
rather than every time we callHandle::get_file_typeandHandle::get_rights.
Finally, in order to facilitate the latter, I've convertedEntryRightsinto
HandleRightsand pushed them into eachHandleimplementor.
kubkon requested sunfishcode for a review on PR #1561.
kubkon updated PR #1561 from handle-rights to master:
This commit does a lot of reshuffling and even some more. It introduces
strongly-typed system primitives which are:OsFile,OsDir,Stdio,
andOsOther. Those primitives are separate structs now, each implementing
a subset ofHandlemethods, rather than all being an enumeration of some
supertype such asOsHandle. To summarise the structs:
OsFilerepresents a regular file, and implements fd-ops
ofHandletrait
OsDirrepresents a directory, and primarily implements path-ops, plus
readdirand some common fd-ops such asfdstat, etc.
Stdiorepresents a stdio handle, and implements a subset of fd-ops
such asfdstat_and_read_andwrite_vectoredcalls
OsOthercurrently represents anything else and implements a set similar
to that implemented byStdioThis commit is effectively an experiment and an excercise into better
understanding what's going on for each OS resource/type under-the-hood.
It's meant to give us some intuition in order to move on with the idea
of having strongly-typed handles in WASI both in the syscall impl as well
as at the libc level.Some more minor changes include making
OsHandlerepresent an OS-specific
wrapper for a raw OS handle (Unix fd or Windows handle). Also, sinceOsDir
is tricky across OSes, we also have a supertype ofOsHandlecalled
OsDirHandlewhich may store aDIR*stream pointer (mainly BSD). Last but not
least, theFiletypeandRightsare now computed when the resource is created,
rather than every time we callHandle::get_file_typeandHandle::get_rights.
Finally, in order to facilitate the latter, I've convertedEntryRightsinto
HandleRightsand pushed them into eachHandleimplementor.
kubkon updated PR #1561 from handle-rights to master:
This commit does a lot of reshuffling and even some more. It introduces
strongly-typed system primitives which are:OsFile,OsDir,Stdio,
andOsOther. Those primitives are separate structs now, each implementing
a subset ofHandlemethods, rather than all being an enumeration of some
supertype such asOsHandle. To summarise the structs:
OsFilerepresents a regular file, and implements fd-ops
ofHandletrait
OsDirrepresents a directory, and primarily implements path-ops, plus
readdirand some common fd-ops such asfdstat, etc.
Stdiorepresents a stdio handle, and implements a subset of fd-ops
such asfdstat_and_read_andwrite_vectoredcalls
OsOthercurrently represents anything else and implements a set similar
to that implemented byStdioThis commit is effectively an experiment and an excercise into better
understanding what's going on for each OS resource/type under-the-hood.
It's meant to give us some intuition in order to move on with the idea
of having strongly-typed handles in WASI both in the syscall impl as well
as at the libc level.Some more minor changes include making
OsHandlerepresent an OS-specific
wrapper for a raw OS handle (Unix fd or Windows handle). Also, sinceOsDir
is tricky across OSes, we also have a supertype ofOsHandlecalled
OsDirHandlewhich may store aDIR*stream pointer (mainly BSD). Last but not
least, theFiletypeandRightsare now computed when the resource is created,
rather than every time we callHandle::get_file_typeandHandle::get_rights.
Finally, in order to facilitate the latter, I've convertedEntryRightsinto
HandleRightsand pushed them into eachHandleimplementor.
kubkon updated PR #1561 from handle-rights to master:
This commit does a lot of reshuffling and even some more. It introduces
strongly-typed system primitives which are:OsFile,OsDir,Stdio,
andOsOther. Those primitives are separate structs now, each implementing
a subset ofHandlemethods, rather than all being an enumeration of some
supertype such asOsHandle. To summarise the structs:
OsFilerepresents a regular file, and implements fd-ops
ofHandletrait
OsDirrepresents a directory, and primarily implements path-ops, plus
readdirand some common fd-ops such asfdstat, etc.
Stdiorepresents a stdio handle, and implements a subset of fd-ops
such asfdstat_and_read_andwrite_vectoredcalls
OsOthercurrently represents anything else and implements a set similar
to that implemented byStdioThis commit is effectively an experiment and an excercise into better
understanding what's going on for each OS resource/type under-the-hood.
It's meant to give us some intuition in order to move on with the idea
of having strongly-typed handles in WASI both in the syscall impl as well
as at the libc level.Some more minor changes include making
OsHandlerepresent an OS-specific
wrapper for a raw OS handle (Unix fd or Windows handle). Also, sinceOsDir
is tricky across OSes, we also have a supertype ofOsHandlecalled
OsDirHandlewhich may store aDIR*stream pointer (mainly BSD). Last but not
least, theFiletypeandRightsare now computed when the resource is created,
rather than every time we callHandle::get_file_typeandHandle::get_rights.
Finally, in order to facilitate the latter, I've convertedEntryRightsinto
HandleRightsand pushed them into eachHandleimplementor.
kubkon updated PR #1561 from handle-rights to master:
This commit does a lot of reshuffling and even some more. It introduces
strongly-typed system primitives which are:OsFile,OsDir,Stdio,
andOsOther. Those primitives are separate structs now, each implementing
a subset ofHandlemethods, rather than all being an enumeration of some
supertype such asOsHandle. To summarise the structs:
OsFilerepresents a regular file, and implements fd-ops
ofHandletrait
OsDirrepresents a directory, and primarily implements path-ops, plus
readdirand some common fd-ops such asfdstat, etc.
Stdiorepresents a stdio handle, and implements a subset of fd-ops
such asfdstat_and_read_andwrite_vectoredcalls
OsOthercurrently represents anything else and implements a set similar
to that implemented byStdioThis commit is effectively an experiment and an excercise into better
understanding what's going on for each OS resource/type under-the-hood.
It's meant to give us some intuition in order to move on with the idea
of having strongly-typed handles in WASI both in the syscall impl as well
as at the libc level.Some more minor changes include making
OsHandlerepresent an OS-specific
wrapper for a raw OS handle (Unix fd or Windows handle). Also, sinceOsDir
is tricky across OSes, we also have a supertype ofOsHandlecalled
OsDirHandlewhich may store aDIR*stream pointer (mainly BSD). Last but not
least, theFiletypeandRightsare now computed when the resource is created,
rather than every time we callHandle::get_file_typeandHandle::get_rights.
Finally, in order to facilitate the latter, I've convertedEntryRightsinto
HandleRightsand pushed them into eachHandleimplementor.
kubkon updated PR #1561 from handle-rights to master:
This commit does a lot of reshuffling and even some more. It introduces
strongly-typed system primitives which are:OsFile,OsDir,Stdio,
andOsOther. Those primitives are separate structs now, each implementing
a subset ofHandlemethods, rather than all being an enumeration of some
supertype such asOsHandle. To summarise the structs:
OsFilerepresents a regular file, and implements fd-ops
ofHandletrait
OsDirrepresents a directory, and primarily implements path-ops, plus
readdirand some common fd-ops such asfdstat, etc.
Stdiorepresents a stdio handle, and implements a subset of fd-ops
such asfdstat_and_read_andwrite_vectoredcalls
OsOthercurrently represents anything else and implements a set similar
to that implemented byStdioThis commit is effectively an experiment and an excercise into better
understanding what's going on for each OS resource/type under-the-hood.
It's meant to give us some intuition in order to move on with the idea
of having strongly-typed handles in WASI both in the syscall impl as well
as at the libc level.Some more minor changes include making
OsHandlerepresent an OS-specific
wrapper for a raw OS handle (Unix fd or Windows handle). Also, sinceOsDir
is tricky across OSes, we also have a supertype ofOsHandlecalled
OsDirHandlewhich may store aDIR*stream pointer (mainly BSD). Last but not
least, theFiletypeandRightsare now computed when the resource is created,
rather than every time we callHandle::get_file_typeandHandle::get_rights.
Finally, in order to facilitate the latter, I've convertedEntryRightsinto
HandleRightsand pushed them into eachHandleimplementor.
kubkon updated PR #1561 from handle-rights to master:
This commit does a lot of reshuffling and even some more. It introduces
strongly-typed system primitives which are:OsFile,OsDir,Stdio,
andOsOther. Those primitives are separate structs now, each implementing
a subset ofHandlemethods, rather than all being an enumeration of some
supertype such asOsHandle. To summarise the structs:
OsFilerepresents a regular file, and implements fd-ops
ofHandletrait
OsDirrepresents a directory, and primarily implements path-ops, plus
readdirand some common fd-ops such asfdstat, etc.
Stdiorepresents a stdio handle, and implements a subset of fd-ops
such asfdstat_and_read_andwrite_vectoredcalls
OsOthercurrently represents anything else and implements a set similar
to that implemented byStdioThis commit is effectively an experiment and an excercise into better
understanding what's going on for each OS resource/type under-the-hood.
It's meant to give us some intuition in order to move on with the idea
of having strongly-typed handles in WASI both in the syscall impl as well
as at the libc level.Some more minor changes include making
OsHandlerepresent an OS-specific
wrapper for a raw OS handle (Unix fd or Windows handle). Also, sinceOsDir
is tricky across OSes, we also have a supertype ofOsHandlecalled
OsDirHandlewhich may store aDIR*stream pointer (mainly BSD). Last but not
least, theFiletypeandRightsare now computed when the resource is created,
rather than every time we callHandle::get_file_typeandHandle::get_rights.
Finally, in order to facilitate the latter, I've convertedEntryRightsinto
HandleRightsand pushed them into eachHandleimplementor.
kubkon requested alexcrichton and sunfishcode for a review on PR #1561.
kubkon requested alexcrichton, pchickey, peterhuene and sunfishcode for a review on PR #1561.
kubkon requested alexcrichton, pchickey, peterhuene and sunfishcode for a review on PR #1561.
Last updated: Dec 13 2025 at 19:03 UTC