pussuw commented on PR #16431: URL: https://github.com/apache/nuttx/pull/16431#issuecomment-2904240438
> > > > > > Why is fdcheck implemented in the kernel, the kernel should not have to care about such things. Shouldn't it be implemented at the user interface i.e. libc ? > > > > > > > > > > > > > > > @pussuw The implementation of fdcheck originally resides in libc https://github.com/apache/nuttx/blob/889a26db1d229ee462bc8ea075c2330dc5f79b94/libs/libc/misc/lib_fdcheck.c > > > > > But we need to perform the conversion from file descriptor (fd) to file structure pointer (filep) within the kernel, as this conversion cannot be done in user space. And, the parameter for system calls is an fd, nothing else, and the filep is also a kernel data structure. > > > > > > > > > > > > Yes the problem here is that the data is in filep. After #16361 you could do this magic in userspace. > > > > > > > > > @pussuw #16361 would definitely be the best if we could cover this type of scenario. However, the changes in this current Pull Request (PR) are quite extensive, so it's unlikely to be merged into the mainline quickly. There's a possibility of stability issues, so we should ensure its reliability through some testing. Therefore, I will pick it up internally and conduct LTP (Linux Test Project) functional testing, 24-hour Monkey stress testing, as well as functional testing on multiple platforms, before approving it. > > > Therefore, our priority is to ensure that the current design is sound. You can continue to rework based on #16361 . > > > > > > Thanks, I do really prefer fixing the file descriptor subsystem like @xiaoxiang781216 suggested in #16326 . It is better to do a comprehensive fix that as far as I can see, will solve most of your problems as well. > > @pussuw @jlaitine Actually, this current PR doesn't just address the issue with fdcheck. Firstly, optimizing the file descriptors in epoll to be managed as files is quite reasonable, because fds shouldn't exist in the kernel in their raw form; they should be converted into `file structures` or the subsequent `struct fd` representation. [4629fc5](https://github.com/apache/nuttx/commit/4629fc52164b8607b8c5343f1042425531d0df16) Secondly, we've removed poll_fdsetup to ensure that everyone uses interfaces with reference counting to access fds, which is much safer."[0cb3037](https://github.com/apache/nuttx/commit/0cb3037484a143c3c72be4fe421a4fb8983e767a) The other two modifications are minor and only target the usage of file references. Yes, I agree with patches 1 and 4, this is why I did not comment on them -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org