2 ms·
Depends on the OS. We also do include some specific things, see https://doc.rust-lang.org/stable/std/os/index.html https://doc.rust-lang.org/stable/std/os/index
by steveklabnik 6y ago
Depends on the OS. We also do include some specific things, see https://doc.rust-lang.org/stable/std/os/index.html https://doc.rust-lang.org/stable/std/os/index.html and https://doc.rust-lang.org/stable/core/arch/index.html https://doc.rust-lang.org/stable/core/arch/index.html
- ChrisSD 6y agoSure platform specific things can be useful. But that's exactly what `syscall()` is. As far as I'm aware, other platforms don't have any real equivalent. On other platforms syscalls must be made via libraries (as Go rather famously found out the hard way).
- steveklabnik 6y agoYes, you're right that most platforms don't have something stable here. I was thinking of the problem more abstractly.
- yxhuvud 6y agoDoesn't most platforms have a reasonably stable interface for functions that are supposed to be reached from userspace? When does it actually matter if that border coincide with where execution privileges are raised?
- steveklabnik 6y agoThey do: the interface is (usually) libc (or some equivalent), not the actual details of how libc makes said call. For an example of how this can play out, the parent is referring to things like https://marcan.st/2017/12/debugging-an-evil-go-runtime-bug/ https://marcan.st/2017/12/debugging-an-evil-go-runtime-bug/