<div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Aug 31, 2021, 7:31 AM Sebastian Huber <<a href="mailto:sebastian.huber@embedded-brains.de">sebastian.huber@embedded-brains.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Use EAGIN instead of EWOULDBLOCK to be in line with the Linux man page.<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">EAGAIN AND Linux man page for what?</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
These error numbers have the same values in Newlib.<br>
---<br>
cpukit/score/src/futex.c | 42 ++++++++++++++++++++++++++++++++++++++--<br>
1 file changed, 40 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/cpukit/score/src/futex.c b/cpukit/score/src/futex.c<br>
index b65a843704..f3a1ae3994 100644<br>
--- a/cpukit/score/src/futex.c<br>
+++ b/cpukit/score/src/futex.c<br>
@@ -1,11 +1,12 @@<br>
/**<br>
* @file<br>
*<br>
- * @ingroup RTEMSScore<br>
+ * @ingroup RTEMSScoreFutex<br>
*<br>
* @brief This source file contains the implementation of<br>
* _Futex_Wait() and _Futex_Wake().<br>
*/<br>
+<br>
/*<br>
* Copyright (c) 2015, 2016 embedded brains GmbH. All rights reserved.<br>
*<br>
@@ -20,6 +21,18 @@<br>
* <a href="http://www.rtems.org/license/LICENSE" rel="noreferrer noreferrer" target="_blank">http://www.rtems.org/license/LICENSE</a>.<br>
*/<br>
<br>
+/**<br>
+ * @defgroup RTEMSScoreFutex Futex Handler<br>
+ *<br>
+ * @ingroup RTEMSScore<br>
+ *<br>
+ * @brief This group contains the Futex Handler implementation.<br>
+ *<br>
+ * The behaviour of the futex operations is defined by Linux, see also:<br>
+ *<br>
+ * <a href="https://man7.org/linux/man-pages/man2/futex.2.html" rel="noreferrer noreferrer" target="_blank">https://man7.org/linux/man-pages/man2/futex.2.html</a><br>
+ */<br>
+<br>
#ifdef HAVE_CONFIG_H<br>
#include "config.h"<br>
#endif<br>
@@ -84,6 +97,22 @@ static void _Futex_Queue_release(<br>
_ISR_Local_enable( level );<br>
}<br>
<br>
+/**<br>
+ * @brief Performs the ``FUTEX_WAIT`` operation.<br>
+ *<br>
+ * @param[in, out] _futex is the futex object.<br>
+ *<br>
+ * @param[in] uaddr is the address to the futex state.<br>
+ *<br>
+ * @param val is the expected futex state value.<br>
+ *<br>
+ * @retval 0 Returns zero if the futex state is equal to the expected value.<br>
+ * In this case the calling thread is enqueued on the thread queue of the<br>
+ * futex object.<br>
+ *<br>
+ * @retval EAGAIN Returns EAGAIN if the futex state is not equal to the<br>
+ * expected value.<br>
+ */<br>
int _Futex_Wait( struct _Futex_Control *_futex, int *uaddr, int val )<br>
{<br>
Futex_Control *futex;<br>
@@ -113,7 +142,7 @@ int _Futex_Wait( struct _Futex_Control *_futex, int *uaddr, int val )<br>
eno = 0;<br>
} else {<br>
_Futex_Queue_release( futex, level, &queue_context );<br>
- eno = EWOULDBLOCK;<br>
+ eno = EAGAIN;<br>
}<br>
<br>
return eno;<br>
@@ -143,6 +172,15 @@ static Thread_Control *_Futex_Flush_filter(<br>
return the_thread;<br>
}<br>
<br>
+/**<br>
+ * @brief Performs the ``FUTEX_WAKE`` operation.<br>
+ *<br>
+ * @param[in, out] _futex is the futex.<br>
+ *<br>
+ * @param count is the maximum count of threads to wake up.<br>
+ *<br>
+ * @return Returns the count of woken up threads.<br>
+ */<br>
int _Futex_Wake( struct _Futex_Control *_futex, int count )<br>
{<br>
Futex_Control *futex;<br>
-- <br>
2.31.1<br>
<br>
_______________________________________________<br>
devel mailing list<br>
<a href="mailto:devel@rtems.org" target="_blank" rel="noreferrer">devel@rtems.org</a><br>
<a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/devel</a><br>
</blockquote></div></div></div>