Resourc manager query


Am trying to implement a resource manager for my own filesystem. Wondering how to implement ftruncate() or truncate() ? QNX seems to return ENOSYS whenever application calls truncate() on a file in my filesystem.

Please let me know.


What filesystem returns ENOSYS on ftruncate()? Flash?

As far as your own filesystem, it depends on the media. If ftruncate() doesn’t make sense for the media it’s perfectly acceptable to return ENOSYS.

ftruncate() should logically shorten a file, and hopefully return any excess media to a free state. This is not much different from appending to a file. How and if you do it depends on the details of your file system.

Am looking at how to hook my own ftruncate or truncate to resource manager? For open, read, write etc. I see resource manager hooks(iofunc_t etc.) but for ftruncate() I do not see a vector where I can register my own function. Hope this time am clear :slight_smile:

Not all functions are represented by a manager hook, nor are they all well documented. Your best bet would be to do a test call of ftruncate() and see what is called in the resource manager.