You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "Donny9 (via GitHub)" <gi...@apache.org> on 2023/09/05 04:19:28 UTC

[GitHub] [nuttx] Donny9 commented on issue #6710: Nuttx file descriptor dup operation issue

Donny9 commented on issue #6710:
URL: https://github.com/apache/nuttx/issues/6710#issuecomment-1705922116

   @pkarashchenko 
   
   > I see that FreeBSD indeed includes such description, but I failed to find any similar lines in https://pubs.opengroup.org/onlinepubs/9699919799/functions/dup.html
   > 
   > Additionally I can find in description from OpenGroup: The `dup()` function provides an alternative interface to the service provided by [fcntl()](https://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html) using the `F_DUPFD` command. The call `dup(fildes)` shall be equivalent to:
   > 
   > ```
   > fcntl(fildes, F_DUPFD, 0);
   > ```
   > 
   > But fail to find similar in description from FreeBSD
   
   @pkarashchenko FreeBsd also have similar behavior in desctiption:
   https://man.freebsd.org/cgi/man.cgi?query=dup2&apropos=0&sektion=2&manpath=FreeBSD+9.0-RELEASE&arch=amd64&format=html#:~:text=The%20object%20referenced,between%20the%20references.
   ```
   The object referenced by the descriptor does not distinguish between oldd
   and newd in any way.  Thus if newd and oldd are duplicate references to
   an open file, [read(2)],  [write(2)] and [lseek(2)] calls all move a single
   pointer into the file, and append mode, non-blocking I/O and asynchronous
   I/O options are shared between the references.
   ```
   So any good suggestions to solve this problem? @pkarashchenko @acassis If there are no good suggestions, I will use filenode to solve this problem in the near future


-- 
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-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org