diff --git a/include/nuttx/fs/fs.h b/include/nuttx/fs/fs.h index 82de23a8707..23313d97863 100644 --- a/include/nuttx/fs/fs.h +++ b/include/nuttx/fs/fs.h @@ -73,16 +73,21 @@ * (libuc.a and libunx.a). The that case, the correct interface must be * used for the build context. * - * The interfaces open(), close(), creat(), read(), pread(), write(), - * pwrite(), poll(), select(), fcntl(), and aio_suspend() are all - * cancellation points. + * REVISIT: In the flat build, the same functions must be used both by + * the OS and by applications. We have to use the normal user functions + * in this case or we will fail to set the errno or fail to create the + * cancellation point. + * + * The interfaces close(), creat(), read(), pread(), write(), pwrite(), + * poll(), select(), fcntl(), and aio_suspend() are all cancellation + * points. * * REVISIT: These cancellation points are an issue and may cause * violations: It use of these internally will cause the calling function * to become a cancellation points! */ -#if defined(CONFIG_BUILD_FLAT) || defined(__KERNEL__) +#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__) # ifdef CONFIG_CPP_HAVE_VARARGS # define _NX_OPEN(p,f,...) nx_open(p,f,##__VA_ARGS__) # else diff --git a/include/nuttx/mqueue.h b/include/nuttx/mqueue.h index 9c6a650c287..c33f1768aa5 100644 --- a/include/nuttx/mqueue.h +++ b/include/nuttx/mqueue.h @@ -68,15 +68,13 @@ * (libuc.a and libunx.a). The that case, the correct interface must be * used for the build context. * - * The interfaces sigtimedwait(), sigwait(), sigwaitinfo(), sleep(), - * nanosleep(), and usleep() are cancellation points. - * - * REVISIT: The fact that these interfaces are cancellation points is an - * issue and may cause violations: It use of these internally will cause - * the calling function to become a cancellation points! + * REVISIT: In the flat build, the same functions must be used both by + * the OS and by applications. We have to use the normal user functions + * in this case or we will fail to set the errno or fail to create the + * cancellation point. */ -#if defined(CONFIG_BUILD_FLAT) || defined(__KERNEL__) +#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__) # define _MQ_SEND(d,m,l,p) nxmq_send(d,m,l,p) # define _MQ_TIMEDSEND(d,m,l,p,t) nxmq_timedsend(d,m,l,p,t) # define _MQ_RECEIVE(d,m,l,p) nxmq_receive(d,m,l,p) diff --git a/include/nuttx/net/net.h b/include/nuttx/net/net.h index 93569abae1c..081424bb12e 100644 --- a/include/nuttx/net/net.h +++ b/include/nuttx/net/net.h @@ -65,6 +65,11 @@ * (libuc.a and libunx.a). The that case, the correct interface must be * used for the build context. * + * REVISIT: In the flat build, the same functions must be used both by + * the OS and by applications. We have to use the normal user functions + * in this case or we will fail to set the errno or fail to create the + * cancellation point. + * * The interfaces accept(), read(), recv(), recvfrom(), write(), send(), * sendto() are all cancellation points. * @@ -73,7 +78,7 @@ * to become a cancellation points! */ -#if defined(CONFIG_BUILD_FLAT) || defined(__KERNEL__) +#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__) # define _NX_SEND(s,b,l,f) nx_send(s,b,l,f) # define _NX_RECV(s,b,l,f) nx_recv(s,b,l,f) # define _NX_RECVFROM(s,b,l,f,a,n) nx_recvfrom(s,b,l,f,a,n) diff --git a/include/nuttx/sched.h b/include/nuttx/sched.h index ebac8152ac3..17fb3706226 100644 --- a/include/nuttx/sched.h +++ b/include/nuttx/sched.h @@ -188,9 +188,14 @@ * used both by the OS (libkc.a and libknx.a) or by the applications * (libuc.a and libunx.a). The that case, the correct interface must be * used for the build context. + * + * REVISIT: In the flat build, the same functions must be used both by + * the OS and by applications. We have to use the normal user functions + * in this case or we will fail to set the errno or fail to create the + * cancellation point. */ -#if defined(CONFIG_BUILD_FLAT) || defined(__KERNEL__) +#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__) # define _SCHED_GETPARAM(t,p) nxsched_getparam(t,p) # define _SCHED_SETPARAM(t,p) nxsched_setparam(t,p) # define _SCHED_GETSCHEDULER(t) nxsched_getscheduler(t) diff --git a/include/nuttx/semaphore.h b/include/nuttx/semaphore.h index 4a44f2f4ea6..0b0fc8dbf69 100644 --- a/include/nuttx/semaphore.h +++ b/include/nuttx/semaphore.h @@ -68,14 +68,13 @@ * (libuc.a and libunx.a). The that case, the correct interface must be * used for the build context. * - * The interfaces sem_wait() and sem_timedwait() are cancellation points. - * - * REVISIT: The fact that sem_wait() and sem_timedwait() are cancellation - * points is an issue and may cause violations: It use of these internally - * will cause the calling function to become a cancellation points! + * REVISIT: In the flat build, the same functions must be used both by + * the OS and by applications. We have to use the normal user functions + * in this case or we will fail to set the errno or fail to create the + * cancellation point. */ -#if defined(CONFIG_BUILD_FLAT) || defined(__KERNEL__) +#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__) # define _SEM_INIT(s,p,c) nxsem_init(s,p,c) # define _SEM_DESTROY(s) nxsem_destroy(s) # define _SEM_WAIT(s) nxsem_wait(s) diff --git a/include/nuttx/signal.h b/include/nuttx/signal.h index fda07825a6f..8d48adda23c 100644 --- a/include/nuttx/signal.h +++ b/include/nuttx/signal.h @@ -61,6 +61,11 @@ * (libuc.a and libunx.a). The that case, the correct interface must be * used for the build context. * + * REVISIT: In the flat build, the same functions must be used both by + * the OS and by applications. We have to use the normal user functions + * in this case or we will fail to set the errno or fail to create the + * cancellation point. + * * The interfaces sigtimedwait(), sigwait(), sigwaitinfo(), sleep(), * nanosleep(), and usleep() are cancellation points. * @@ -69,7 +74,7 @@ * the calling function to become a cancellation points! */ -#if defined(CONFIG_BUILD_FLAT) || defined(__KERNEL__) +#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__) # define _SIG_PROCMASK(h,s,o) nxsig_procmask(h,s,o) # define _SIG_SIGACTION(s,a,o) nxsig_action(s,a,o,false) # define _SIG_QUEUE(p,s,v) nxsig_queue(p,s,v)