Open Legimet opened 9 years ago
I was adding filesystem bindings to Duktape when I noticed that the truncate and ftruncate syscalls don't exist. truncate should be easy to add since we have the syscall.
We don't, actually. Only NU_Truncate is available, but that uses Nucleus file descriptors and they aren't available to us directly (with some hacks/pointer dereferences, it's possible to get to it).
I guess ftruncate would require storing a mapping from file descriptor to filename
https://github.com/ndless-nspire/Ndless/blob/master/ndless-sdk/libsyscalls/stdlib.cpp#L41 should be enough to support fstat and ftruncate.
(similar to fstat, which is also unimplemented).
It's the same problem with fstat, it's not in the current syscall list. It's possible to add them, but then it will require at least ndless 3.6 rWhateverItIsRightNow.
I was adding filesystem bindings to Duktape when I noticed that the truncate and ftruncate syscalls don't exist. truncate should be easy to add since we have the syscall. I guess ftruncate would require storing a mapping from file descriptor to filename (similar to fstat, which is also unimplemented). Of course, I can do without these functions for now.