Updated comments
This commit is contained in:
parent
1fa790cf8e
commit
7ad7163bd3
@ -69,7 +69,7 @@
|
|||||||
*
|
*
|
||||||
* Return:
|
* Return:
|
||||||
* >=0 on success (positive non-zero values are cmd-specific)
|
* >=0 on success (positive non-zero values are cmd-specific)
|
||||||
* -1 on failure withi errno set properly:
|
* -1 on failure with errno set properly:
|
||||||
*
|
*
|
||||||
* EBADF
|
* EBADF
|
||||||
* 'fd' is not a valid descriptor.
|
* 'fd' is not a valid descriptor.
|
||||||
|
@ -638,7 +638,7 @@ int close_blockdriver(FAR struct inode *inode);
|
|||||||
*
|
*
|
||||||
* Return:
|
* Return:
|
||||||
* >=0 on success (positive non-zero values are cmd-specific)
|
* >=0 on success (positive non-zero values are cmd-specific)
|
||||||
* -1 on failure withi errno set properly:
|
* -1 on failure with errno set properly:
|
||||||
*
|
*
|
||||||
* EBADF
|
* EBADF
|
||||||
* 'fd' is not a valid descriptor.
|
* 'fd' is not a valid descriptor.
|
||||||
|
@ -84,7 +84,7 @@ extern "C"
|
|||||||
*
|
*
|
||||||
* Return:
|
* Return:
|
||||||
* >=0 on success (positive non-zero values are cmd-specific)
|
* >=0 on success (positive non-zero values are cmd-specific)
|
||||||
* -1 on failure withi errno set properly:
|
* -1 on failure with errno set properly:
|
||||||
*
|
*
|
||||||
* EBADF
|
* EBADF
|
||||||
* 'fd' is not a valid descriptor.
|
* 'fd' is not a valid descriptor.
|
||||||
|
15
libc/Kconfig
15
libc/Kconfig
@ -76,7 +76,20 @@ config LIBC_IOCTL_VARIADIC
|
|||||||
|
|
||||||
WARNING: Use of this option could cause subtle system errors is
|
WARNING: Use of this option could cause subtle system errors is
|
||||||
the third argument is omitted or if the sizeof the thread argument
|
the third argument is omitted or if the sizeof the thread argument
|
||||||
is anything other than sizeof (unsigned long).
|
is anything other than sizeof (unsigned long). Most small integers
|
||||||
|
will be promoted to 'int'. The following assertion appears in ioctl():
|
||||||
|
|
||||||
|
DEBUGASSERT(sizeof(int) == sizeof(unsigned long) &&
|
||||||
|
sizeof(FAR void *) == sizeof(unsigned long));
|
||||||
|
|
||||||
|
Do not enable this option if the above is not true. 32-bit ARM
|
||||||
|
should pass this test with all three types having sizeof(type) == 4
|
||||||
|
bytes. 'float' should also be tested. But 'long long' and 'double'
|
||||||
|
are out of the question! Don't event try to pass them.
|
||||||
|
|
||||||
|
And what will happen if no third argument is passed? In most cases,
|
||||||
|
this should just result in a garbage value for arg. But you may
|
||||||
|
discover cases where something worse happens!
|
||||||
|
|
||||||
config LIB_RAND_ORDER
|
config LIB_RAND_ORDER
|
||||||
int "Order of the random number generate"
|
int "Order of the random number generate"
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
#include <nuttx/fs/fs.h>
|
#include <nuttx/fs/fs.h>
|
||||||
|
|
||||||
@ -66,7 +67,7 @@
|
|||||||
*
|
*
|
||||||
* Return:
|
* Return:
|
||||||
* >=0 on success (positive non-zero values are cmd-specific)
|
* >=0 on success (positive non-zero values are cmd-specific)
|
||||||
* -1 on failure withi errno set properly:
|
* -1 on failure with errno set properly:
|
||||||
*
|
*
|
||||||
* EBADF
|
* EBADF
|
||||||
* 'fd' is not a valid descriptor.
|
* 'fd' is not a valid descriptor.
|
||||||
@ -84,15 +85,26 @@
|
|||||||
|
|
||||||
int ioctl(int fd, int req, ...)
|
int ioctl(int fd, int req, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
|
||||||
unsigned long arg;
|
unsigned long arg;
|
||||||
|
va_list ap;
|
||||||
|
|
||||||
/* Get the unsigned long argument.
|
/* Get the unsigned long argument.
|
||||||
*
|
*
|
||||||
* REVISIT: This could cause of the crash down the road if the actual size
|
* REVISIT: This could be the cause of the crash down the road if the
|
||||||
* of the argument is anything other than sizeof(unsigned long);
|
* actual size of the argument is anything other than sizeof(unsigned long).
|
||||||
|
* Most small integers will be promoted to 'int'. ARM should pass the
|
||||||
|
* following test with all three types having sizeof(type) == 4 bytes.
|
||||||
|
* 'float' should also be tested. But 'long long' and 'double' are out of
|
||||||
|
* the question! Don't try to pass them.
|
||||||
|
*
|
||||||
|
* And what will happen if no third argument is passed? In most cases,
|
||||||
|
* this should just result in a garbage value for arg. But you may
|
||||||
|
* discover cases where something worse happens!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
DEBUGASSERT(sizeof(int) == sizeof(unsigned long) &&
|
||||||
|
sizeof(FAR void *) == sizeof(unsigned long));
|
||||||
|
|
||||||
va_start(ap, req);
|
va_start(ap, req);
|
||||||
arg = va_arg(ap, unsigned long);
|
arg = va_arg(ap, unsigned long);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
Loading…
Reference in New Issue
Block a user