You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2020/04/12 14:45:27 UTC

[GitHub] [incubator-nuttx] xiaoxiang781216 opened a new pull request #769: misc/Kconfig: enable LIBC_IOCTL_VARIADIC by default

xiaoxiang781216 opened a new pull request #769: misc/Kconfig: enable LIBC_IOCTL_VARIADIC by default
URL: https://github.com/apache/incubator-nuttx/pull/769
 
 
   Since the standard require ioctl has this prototype:
   int ioctl(int fildes, int request, ... /* arg */);
   https://pubs.opengroup.org/onlinepubs/009604599/functions/ioctl.html

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-nuttx] patacongo merged pull request #769: misc/Kconfig: enable LIBC_IOCTL_VARIADIC by default

Posted by GitBox <gi...@apache.org>.
patacongo merged pull request #769: misc/Kconfig: enable LIBC_IOCTL_VARIADIC by default
URL: https://github.com/apache/incubator-nuttx/pull/769
 
 
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-nuttx] patacongo edited a comment on issue #769: misc/Kconfig: enable LIBC_IOCTL_VARIADIC by default

Posted by GitBox <gi...@apache.org>.
patacongo edited a comment on issue #769: misc/Kconfig: enable LIBC_IOCTL_VARIADIC by default
URL: https://github.com/apache/incubator-nuttx/pull/769#issuecomment-612629522
 
 
   This must be a new addition to the specs at OpenGroup.org.  They did not specify ioctl at all in the past.
   
   NOTE: That this is only a thin layer.  It still only accepts one 'unsigned int' argument.  But the ioctl layer just gets that using va_arg. See libs/libc/misc/lib_ioctl.c:
   
       108   va_start(ap, req);
       109   arg = va_arg(ap, unsigned long);
       110   va_end(ap);
       111
       112   /* Then let fs_ioctl() to the real work */
       113
       114   return fs_ioctl(fd, req, arg);
   
   It would take a lot of work to use this properly.  And variadic functions cannot be used in syscalls so we would probably have to have a vioctl() as the primary OS interface.
   
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-nuttx] patacongo commented on issue #769: misc/Kconfig: enable LIBC_IOCTL_VARIADIC by default

Posted by GitBox <gi...@apache.org>.
patacongo commented on issue #769: misc/Kconfig: enable LIBC_IOCTL_VARIADIC by default
URL: https://github.com/apache/incubator-nuttx/pull/769#issuecomment-612631905
 
 
   > NOTE: That this is only a thin layer. It still only accepts one 'unsigned int' argument. But the ioctl layer just gets that using va_arg. See libs/libc/misc/lib_ioctl.c:
   > 
   > ```
   > 108   va_start(ap, req);
   > 109   arg = va_arg(ap, unsigned long);
   > 110   va_end(ap);
   > 111
   > 112   /* Then let fs_ioctl() to the real work */
   > 113
   > 114   return fs_ioctl(fd, req, arg);
   > ```
   
   That problem with that is that it is unsafe.  Per comments in libs/libc/misc/lib_ioctl.c:
   
        91   /* Get the unsigned long argument.
        92    *
        93    * REVISIT:  This could be the cause of the crash down the road if the
        94    * actual size of the argument is anything other than sizeof(unsigned long).
        95    * Most small integers will be promoted to 'int'.  ARM should pass the
        96    * following test with all three types having sizeof(type) == 4 bytes.
        97    * 'float' should also be tested.  But 'long long' and 'double' are out of
        98    * the question!  Don't try to pass them.
        99    *
       100    * And what will happen if no third argument is passed?  In most cases,
       101    * this should just result in a garbage value for arg.  But you may
       102    * discover cases where something worse happens!
       103    */
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-nuttx] patacongo commented on issue #769: misc/Kconfig: enable LIBC_IOCTL_VARIADIC by default

Posted by GitBox <gi...@apache.org>.
patacongo commented on issue #769: misc/Kconfig: enable LIBC_IOCTL_VARIADIC by default
URL: https://github.com/apache/incubator-nuttx/pull/769#issuecomment-612629867
 
 
   None of the ioctl commands listed on that page are defined or supported by NuttX either.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-nuttx] patacongo commented on issue #769: misc/Kconfig: enable LIBC_IOCTL_VARIADIC by default

Posted by GitBox <gi...@apache.org>.
patacongo commented on issue #769: misc/Kconfig: enable LIBC_IOCTL_VARIADIC by default
URL: https://github.com/apache/incubator-nuttx/pull/769#issuecomment-612629522
 
 
   This must be a new addition to the specs at OpenGroup.org.  They did not specify ioctl at all in the past.
   
   NOTE: That this is only a thin layer.  It still only accepts one 'unsigned int' argument.  But the ioctl layer just gets that using va_arg. See libs/libc/misc/lib_ioctl.c:
   
       108   va_start(ap, req);
       109   arg = va_arg(ap, unsigned long);
       110   va_end(ap);
       111
       112   /* Then let fs_ioctl() to the real work */
       113
       114   return fs_ioctl(fd, req, arg);
   
   It would take a lot of work to use this properly.  And variadic functions cannot be used in syscalls so we would probably have to have a vioctl().
   
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services